@nocobase/plugin-action-import
Version:
Import records using excel templates. You can configure which fields to import and templates will be generated automatically.
49 lines • 1.17 MB
JavaScript
(function(){var __webpack_modules__={43012:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.CsvFormatterStream=void 0;const n=r(12781);const i=r(15539);class CsvFormatterStream extends n.Transform{constructor(e){super({writableObjectMode:e.objectMode});this.hasWrittenBOM=false;this.formatterOptions=e;this.rowFormatter=new i.RowFormatter(e);this.hasWrittenBOM=!e.writeBOM}transform(e){this.rowFormatter.rowTransform=e;return this}_transform(e,t,r){let n=false;try{if(!this.hasWrittenBOM){this.push(this.formatterOptions.BOM);this.hasWrittenBOM=true}this.rowFormatter.format(e,((e,t)=>{if(e){n=true;return r(e)}if(t){t.forEach((e=>{this.push(Buffer.from(e,"utf8"))}))}n=true;return r()}))}catch(e){if(n){throw e}r(e)}}_flush(e){this.rowFormatter.finish(((t,r)=>{if(t){return e(t)}if(r){r.forEach((e=>{this.push(Buffer.from(e,"utf8"))}))}return e()}))}}t.CsvFormatterStream=CsvFormatterStream},47554:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.FormatterOptions=void 0;class FormatterOptions{constructor(e={}){var t;this.objectMode=true;this.delimiter=",";this.rowDelimiter="\n";this.quote='"';this.escape=this.quote;this.quoteColumns=false;this.quoteHeaders=this.quoteColumns;this.headers=null;this.includeEndRowDelimiter=false;this.writeBOM=false;this.BOM="\ufeff";this.alwaysWriteHeaders=false;Object.assign(this,e||{});if(typeof(e===null||e===void 0?void 0:e.quoteHeaders)==="undefined"){this.quoteHeaders=this.quoteColumns}if((e===null||e===void 0?void 0:e.quote)===true){this.quote='"'}else if((e===null||e===void 0?void 0:e.quote)===false){this.quote=""}if(typeof(e===null||e===void 0?void 0:e.escape)!=="string"){this.escape=this.quote}this.shouldWriteHeaders=!!this.headers&&((t=e.writeHeaders)!==null&&t!==void 0?t:true);this.headers=Array.isArray(this.headers)?this.headers:null;this.escapedQuote=`${this.escape}${this.quote}`}}t.FormatterOptions=FormatterOptions},64514:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.FieldFormatter=void 0;const i=n(r(16501));const s=n(r(74643));const o=n(r(27676));class FieldFormatter{constructor(e){this._headers=null;this.formatterOptions=e;if(e.headers!==null){this.headers=e.headers}this.REPLACE_REGEXP=new RegExp(e.quote,"g");const t=`[${e.delimiter}${o.default(e.rowDelimiter)}|\r|\n]`;this.ESCAPE_REGEXP=new RegExp(t)}set headers(e){this._headers=e}shouldQuote(e,t){const r=t?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(i.default(r)){return r}if(Array.isArray(r)){return r[e]}if(this._headers!==null){return r[this._headers[e]]}return false}format(e,t,r){const n=`${s.default(e)?"":e}`.replace(/\0/g,"");const{formatterOptions:i}=this;if(i.quote!==""){const e=n.indexOf(i.quote)!==-1;if(e){return this.quoteField(n.replace(this.REPLACE_REGEXP,i.escapedQuote))}}const o=n.search(this.ESCAPE_REGEXP)!==-1;if(o||this.shouldQuote(t,r)){return this.quoteField(n)}return n}quoteField(e){const{quote:t}=this.formatterOptions;return`${t}${e}${t}`}}t.FieldFormatter=FieldFormatter},17489:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.RowFormatter=void 0;const i=n(r(820));const s=n(r(78309));const o=r(64514);const c=r(83271);class RowFormatter{constructor(e){this.rowCount=0;this.formatterOptions=e;this.fieldFormatter=new o.FieldFormatter(e);this.headers=e.headers;this.shouldWriteHeaders=e.shouldWriteHeaders;this.hasWrittenHeaders=false;if(this.headers!==null){this.fieldFormatter.headers=this.headers}if(e.transform){this.rowTransform=e.transform}}static isRowHashArray(e){if(Array.isArray(e)){return Array.isArray(e[0])&&e[0].length===2}return false}static isRowArray(e){return Array.isArray(e)&&!this.isRowHashArray(e)}static gatherHeaders(e){if(RowFormatter.isRowHashArray(e)){return e.map((e=>e[0]))}if(Array.isArray(e)){return e}return Object.keys(e)}static createTransform(e){if(c.isSyncTransform(e)){return(t,r)=>{let n=null;try{n=e(t)}catch(e){return r(e)}return r(null,n)}}return(t,r)=>{e(t,r)}}set rowTransform(e){if(!i.default(e)){throw new TypeError("The transform should be a function")}this._rowTransform=RowFormatter.createTransform(e)}format(e,t){this.callTransformer(e,((r,n)=>{if(r){return t(r)}if(!e){return t(null)}const i=[];if(n){const{shouldFormatColumns:e,headers:t}=this.checkHeaders(n);if(this.shouldWriteHeaders&&t&&!this.hasWrittenHeaders){i.push(this.formatColumns(t,true));this.hasWrittenHeaders=true}if(e){const e=this.gatherColumns(n);i.push(this.formatColumns(e,false))}}return t(null,i)}))}finish(e){const t=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers){return e(new Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."))}t.push(this.formatColumns(this.headers,true))}if(this.formatterOptions.includeEndRowDelimiter){t.push(this.formatterOptions.rowDelimiter)}return e(null,t)}checkHeaders(e){if(this.headers){return{shouldFormatColumns:true,headers:this.headers}}const t=RowFormatter.gatherHeaders(e);this.headers=t;this.fieldFormatter.headers=t;if(!this.shouldWriteHeaders){return{shouldFormatColumns:true,headers:null}}return{shouldFormatColumns:!s.default(t,e),headers:t}}gatherColumns(e){if(this.headers===null){throw new Error("Headers is currently null")}if(!Array.isArray(e)){return this.headers.map((t=>e[t]))}if(RowFormatter.isRowHashArray(e)){return this.headers.map(((t,r)=>{const n=e[r];if(n){return n[1]}return""}))}if(RowFormatter.isRowArray(e)&&!this.shouldWriteHeaders){return e}return this.headers.map(((t,r)=>e[r]))}callTransformer(e,t){if(!this._rowTransform){return t(null,e)}return this._rowTransform(e,t)}formatColumns(e,t){const r=e.map(((e,r)=>this.fieldFormatter.format(e,r,t))).join(this.formatterOptions.delimiter);const{rowCount:n}=this;this.rowCount+=1;if(n){return[this.formatterOptions.rowDelimiter,r].join("")}return r}}t.RowFormatter=RowFormatter},15539:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.FieldFormatter=t.RowFormatter=void 0;var n=r(17489);Object.defineProperty(t,"RowFormatter",{enumerable:true,get:function(){return n.RowFormatter}});var i=r(64514);Object.defineProperty(t,"FieldFormatter",{enumerable:true,get:function(){return i.FieldFormatter}})},73097:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))n(t,e,r);i(t,e);return t};var o=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))n(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});t.writeToPath=t.writeToString=t.writeToBuffer=t.writeToStream=t.write=t.format=t.FormatterOptions=t.CsvFormatterStream=void 0;const c=r(73837);const h=r(12781);const p=s(r(57147));const g=r(47554);const y=r(43012);o(r(83271),t);var b=r(43012);Object.defineProperty(t,"CsvFormatterStream",{enumerable:true,get:function(){return b.CsvFormatterStream}});var v=r(47554);Object.defineProperty(t,"FormatterOptions",{enumerable:true,get:function(){return v.FormatterOptions}});t.format=e=>new y.CsvFormatterStream(new g.FormatterOptions(e));t.write=(e,r)=>{const n=t.format(r);const i=c.promisify(((e,t)=>{n.write(e,undefined,t)}));e.reduce(((e,t)=>e.then((()=>i(t)))),Promise.resolve()).then((()=>n.end())).catch((e=>{n.emit("error",e)}));return n};t.writeToStream=(e,r,n)=>t.write(r,n).pipe(e);t.writeToBuffer=(e,r={})=>{const n=[];const i=new h.Writable({write(e,t,r){n.push(e);r()}});return new Promise(((s,o)=>{i.on("error",o).on("finish",(()=>s(Buffer.concat(n))));t.write(e,r).pipe(i)}))};t.writeToString=(e,r)=>t.writeToBuffer(e,r).then((e=>e.toString()));t.writeToPath=(e,r,n)=>{const i=p.createWriteStream(e,{encoding:"utf8"});return t.write(r,n).pipe(i)}},83271:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isSyncTransform=void 0;t.isSyncTransform=e=>e.length===1},7337:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.CsvParserStream=void 0;const n=r(71576);const i=r(12781);const s=r(40634);const o=r(15917);class CsvParserStream extends i.Transform{constructor(e){super({objectMode:e.objectMode});this.lines="";this.rowCount=0;this.parsedRowCount=0;this.parsedLineCount=0;this.endEmitted=false;this.headersEmitted=false;this.parserOptions=e;this.parser=new o.Parser(e);this.headerTransformer=new s.HeaderTransformer(e);this.decoder=new n.StringDecoder(e.encoding);this.rowTransformerValidator=new s.RowTransformerValidator}get hasHitRowLimit(){return this.parserOptions.limitRows&&this.rowCount>=this.parserOptions.maxRows}get shouldEmitRows(){return this.parsedRowCount>this.parserOptions.skipRows}get shouldSkipLine(){return this.parsedLineCount<=this.parserOptions.skipLines}transform(e){this.rowTransformerValidator.rowTransform=e;return this}validate(e){this.rowTransformerValidator.rowValidator=e;return this}emit(e,...t){if(e==="end"){if(!this.endEmitted){this.endEmitted=true;super.emit("end",this.rowCount)}return false}return super.emit(e,...t)}_transform(e,t,r){if(this.hasHitRowLimit){return r()}const n=CsvParserStream.wrapDoneCallback(r);try{const{lines:t}=this;const r=t+this.decoder.write(e);const i=this.parse(r,true);return this.processRows(i,n)}catch(e){return n(e)}}_flush(e){const t=CsvParserStream.wrapDoneCallback(e);if(this.hasHitRowLimit){return t()}try{const e=this.lines+this.decoder.end();const r=this.parse(e,false);return this.processRows(r,t)}catch(e){return t(e)}}parse(e,t){if(!e){return[]}const{line:r,rows:n}=this.parser.parse(e,t);this.lines=r;return n}processRows(e,t){const r=e.length;const iterate=n=>{const callNext=e=>{if(e){return t(e)}if(n%100===0){setImmediate((()=>iterate(n+1)));return undefined}return iterate(n+1)};this.checkAndEmitHeaders();if(n>=r||this.hasHitRowLimit){return t()}this.parsedLineCount+=1;if(this.shouldSkipLine){return callNext()}const i=e[n];this.rowCount+=1;this.parsedRowCount+=1;const s=this.rowCount;return this.transformRow(i,((e,t)=>{if(e){this.rowCount-=1;return callNext(e)}if(!t){return callNext(new Error("expected transform result"))}if(!t.isValid){this.emit("data-invalid",t.row,s,t.reason)}else if(t.row){return this.pushRow(t.row,callNext)}return callNext()}))};iterate(0)}transformRow(e,t){try{this.headerTransformer.transform(e,((r,n)=>{if(r){return t(r)}if(!n){return t(new Error("Expected result from header transform"))}if(!n.isValid){if(this.shouldEmitRows){return t(null,{isValid:false,row:e})}return this.skipRow(t)}if(n.row){if(this.shouldEmitRows){return this.rowTransformerValidator.transformAndValidate(n.row,t)}return this.skipRow(t)}this.rowCount-=1;this.parsedRowCount-=1;return t(null,{row:null,isValid:true})}))}catch(e){t(e)}}checkAndEmitHeaders(){if(!this.headersEmitted&&this.headerTransformer.headers){this.headersEmitted=true;this.emit("headers",this.headerTransformer.headers)}}skipRow(e){this.rowCount-=1;return e(null,{row:null,isValid:true})}pushRow(e,t){try{if(!this.parserOptions.objectMode){this.push(JSON.stringify(e))}else{this.push(e)}t()}catch(e){t(e)}}static wrapDoneCallback(e){let t=false;return(r,...n)=>{if(r){if(t){throw r}t=true;e(r);return}e(...n)}}}t.CsvParserStream=CsvParserStream},88487:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.ParserOptions=void 0;const i=n(r(27676));const s=n(r(74643));class ParserOptions{constructor(e){var t;this.objectMode=true;this.delimiter=",";this.ignoreEmpty=false;this.quote='"';this.escape=null;this.escapeChar=this.quote;this.comment=null;this.supportsComments=false;this.ltrim=false;this.rtrim=false;this.trim=false;this.headers=null;this.renameHeaders=false;this.strictColumnHandling=false;this.discardUnmappedColumns=false;this.carriageReturn="\r";this.encoding="utf8";this.limitRows=false;this.maxRows=0;this.skipLines=0;this.skipRows=0;Object.assign(this,e||{});if(this.delimiter.length>1){throw new Error("delimiter option must be one character long")}this.escapedDelimiter=i.default(this.delimiter);this.escapeChar=(t=this.escape)!==null&&t!==void 0?t:this.quote;this.supportsComments=!s.default(this.comment);this.NEXT_TOKEN_REGEXP=new RegExp(`([^\\s]|\\r\\n|\\n|\\r|${this.escapedDelimiter})`);if(this.maxRows>0){this.limitRows=true}}}t.ParserOptions=ParserOptions},28551:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){if(n===undefined)n=r;Object.defineProperty(e,n,{enumerable:true,get:function(){return t[r]}})}:function(e,t,r,n){if(n===undefined)n=r;e[n]=t[r]});var i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)if(r!=="default"&&Object.prototype.hasOwnProperty.call(e,r))n(t,e,r);i(t,e);return t};var o=this&&this.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r))n(t,e,r)};Object.defineProperty(t,"__esModule",{value:true});t.parseString=t.parseFile=t.parseStream=t.parse=t.ParserOptions=t.CsvParserStream=void 0;const c=s(r(57147));const h=r(12781);const p=r(88487);const g=r(7337);o(r(58897),t);var y=r(7337);Object.defineProperty(t,"CsvParserStream",{enumerable:true,get:function(){return y.CsvParserStream}});var b=r(88487);Object.defineProperty(t,"ParserOptions",{enumerable:true,get:function(){return b.ParserOptions}});t.parse=e=>new g.CsvParserStream(new p.ParserOptions(e));t.parseStream=(e,t)=>e.pipe(new g.CsvParserStream(new p.ParserOptions(t)));t.parseFile=(e,t={})=>c.createReadStream(e).pipe(new g.CsvParserStream(new p.ParserOptions(t)));t.parseString=(e,t)=>{const r=new h.Readable;r.push(e);r.push(null);return r.pipe(new g.CsvParserStream(new p.ParserOptions(t)))}},99781:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Parser=void 0;const n=r(99735);const i=r(65655);const s=r(26098);class Parser{constructor(e){this.parserOptions=e;this.rowParser=new i.RowParser(this.parserOptions)}static removeBOM(e){if(e&&e.charCodeAt(0)===65279){return e.slice(1)}return e}parse(e,t){const r=new n.Scanner({line:Parser.removeBOM(e),parserOptions:this.parserOptions,hasMoreData:t});if(this.parserOptions.supportsComments){return this.parseWithComments(r)}return this.parseWithoutComments(r)}parseWithoutComments(e){const t=[];let r=true;while(r){r=this.parseRow(e,t)}return{line:e.line,rows:t}}parseWithComments(e){const{parserOptions:t}=this;const r=[];for(let n=e.nextCharacterToken;n!==null;n=e.nextCharacterToken){if(s.Token.isTokenComment(n,t)){const t=e.advancePastLine();if(t===null){return{line:e.lineFromCursor,rows:r}}if(!e.hasMoreCharacters){return{line:e.lineFromCursor,rows:r}}e.truncateToCursor()}else if(!this.parseRow(e,r)){break}}return{line:e.line,rows:r}}parseRow(e,t){const r=e.nextNonSpaceToken;if(!r){return false}const n=this.rowParser.parse(e);if(n===null){return false}if(this.parserOptions.ignoreEmpty&&i.RowParser.isEmptyRow(n)){return true}t.push(n);return true}}t.Parser=Parser},65655:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.RowParser=void 0;const n=r(93707);const i=r(26098);const s="";class RowParser{constructor(e){this.parserOptions=e;this.columnParser=new n.ColumnParser(e)}static isEmptyRow(e){return e.join(s).replace(/\s+/g,s)===s}parse(e){const{parserOptions:t}=this;const{hasMoreData:r}=e;const n=e;const s=[];let o=this.getStartToken(n,s);while(o){if(i.Token.isTokenRowDelimiter(o)){n.advancePastToken(o);if(!n.hasMoreCharacters&&i.Token.isTokenCarriageReturn(o,t)&&r){return null}n.truncateToCursor();return s}if(!this.shouldSkipColumnParse(n,o,s)){const e=this.columnParser.parse(n);if(e===null){return null}s.push(e)}o=n.nextNonSpaceToken}if(!r){n.truncateToCursor();return s}return null}getStartToken(e,t){const r=e.nextNonSpaceToken;if(r!==null&&i.Token.isTokenDelimiter(r,this.parserOptions)){t.push("");return e.nextNonSpaceToken}return r}shouldSkipColumnParse(e,t,r){const{parserOptions:n}=this;if(i.Token.isTokenDelimiter(t,n)){e.advancePastToken(t);const s=e.nextCharacterToken;if(!e.hasMoreCharacters||s!==null&&i.Token.isTokenRowDelimiter(s)){r.push("");return true}if(s!==null&&i.Token.isTokenDelimiter(s,n)){r.push("");return true}}return false}}t.RowParser=RowParser},99735:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Scanner=void 0;const n=r(26098);const i=/((?:\r\n)|\n|\r)/;class Scanner{constructor(e){this.cursor=0;this.line=e.line;this.lineLength=this.line.length;this.parserOptions=e.parserOptions;this.hasMoreData=e.hasMoreData;this.cursor=e.cursor||0}get hasMoreCharacters(){return this.lineLength>this.cursor}get nextNonSpaceToken(){const{lineFromCursor:e}=this;const t=this.parserOptions.NEXT_TOKEN_REGEXP;if(e.search(t)===-1){return null}const r=t.exec(e);if(r==null){return null}const i=r[1];const s=this.cursor+(r.index||0);return new n.Token({token:i,startCursor:s,endCursor:s+i.length-1})}get nextCharacterToken(){const{cursor:e,lineLength:t}=this;if(t<=e){return null}return new n.Token({token:this.line[e],startCursor:e,endCursor:e})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){const e=i.exec(this.lineFromCursor);if(!e){if(this.hasMoreData){return null}this.cursor=this.lineLength;return this}this.cursor+=(e.index||0)+e[0].length;return this}advanceTo(e){this.cursor=e;return this}advanceToToken(e){this.cursor=e.startCursor;return this}advancePastToken(e){this.cursor=e.endCursor+1;return this}truncateToCursor(){this.line=this.lineFromCursor;this.lineLength=this.line.length;this.cursor=0;return this}}t.Scanner=Scanner},26098:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.Token=void 0;class Token{constructor(e){this.token=e.token;this.startCursor=e.startCursor;this.endCursor=e.endCursor}static isTokenRowDelimiter(e){const t=e.token;return t==="\r"||t==="\n"||t==="\r\n"}static isTokenCarriageReturn(e,t){return e.token===t.carriageReturn}static isTokenComment(e,t){return t.supportsComments&&!!e&&e.token===t.comment}static isTokenEscapeCharacter(e,t){return e.token===t.escapeChar}static isTokenQuote(e,t){return e.token===t.quote}static isTokenDelimiter(e,t){return e.token===t.delimiter}}t.Token=Token},40748:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ColumnFormatter=void 0;class ColumnFormatter{constructor(e){if(e.trim){this.format=e=>e.trim()}else if(e.ltrim){this.format=e=>e.trimLeft()}else if(e.rtrim){this.format=e=>e.trimRight()}else{this.format=e=>e}}}t.ColumnFormatter=ColumnFormatter},5314:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ColumnParser=void 0;const n=r(73649);const i=r(85643);const s=r(26098);class ColumnParser{constructor(e){this.parserOptions=e;this.quotedColumnParser=new i.QuotedColumnParser(e);this.nonQuotedColumnParser=new n.NonQuotedColumnParser(e)}parse(e){const{nextNonSpaceToken:t}=e;if(t!==null&&s.Token.isTokenQuote(t,this.parserOptions)){e.advanceToToken(t);return this.quotedColumnParser.parse(e)}return this.nonQuotedColumnParser.parse(e)}}t.ColumnParser=ColumnParser},73649:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.NonQuotedColumnParser=void 0;const n=r(40748);const i=r(26098);class NonQuotedColumnParser{constructor(e){this.parserOptions=e;this.columnFormatter=new n.ColumnFormatter(e)}parse(e){if(!e.hasMoreCharacters){return null}const{parserOptions:t}=this;const r=[];let n=e.nextCharacterToken;for(;n;n=e.nextCharacterToken){if(i.Token.isTokenDelimiter(n,t)||i.Token.isTokenRowDelimiter(n)){break}r.push(n.token);e.advancePastToken(n)}return this.columnFormatter.format(r.join(""))}}t.NonQuotedColumnParser=NonQuotedColumnParser},85643:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.QuotedColumnParser=void 0;const n=r(40748);const i=r(26098);class QuotedColumnParser{constructor(e){this.parserOptions=e;this.columnFormatter=new n.ColumnFormatter(e)}parse(e){if(!e.hasMoreCharacters){return null}const t=e.cursor;const{foundClosingQuote:r,col:n}=this.gatherDataBetweenQuotes(e);if(!r){e.advanceTo(t);if(!e.hasMoreData){throw new Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${e.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`)}return null}this.checkForMalformedColumn(e);return n}gatherDataBetweenQuotes(e){const{parserOptions:t}=this;let r=false;let n=false;const s=[];let o=e.nextCharacterToken;for(;!n&&o!==null;o=e.nextCharacterToken){const c=i.Token.isTokenQuote(o,t);if(!r&&c){r=true}else if(r){if(i.Token.isTokenEscapeCharacter(o,t)){e.advancePastToken(o);const r=e.nextCharacterToken;if(r!==null&&(i.Token.isTokenQuote(r,t)||i.Token.isTokenEscapeCharacter(r,t))){s.push(r.token);o=r}else if(c){n=true}else{s.push(o.token)}}else if(c){n=true}else{s.push(o.token)}}e.advancePastToken(o)}return{col:this.columnFormatter.format(s.join("")),foundClosingQuote:n}}checkForMalformedColumn(e){const{parserOptions:t}=this;const{nextNonSpaceToken:r}=e;if(r){const n=i.Token.isTokenDelimiter(r,t);const s=i.Token.isTokenRowDelimiter(r);if(!(n||s)){const n=e.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw new Error(`Parse Error: expected: '${t.escapedDelimiter}' OR new line got: '${r.token}'. at '${n}`)}e.advanceToToken(r)}else if(!e.hasMoreData){e.advancePastLine()}}}t.QuotedColumnParser=QuotedColumnParser},93707:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.ColumnFormatter=t.QuotedColumnParser=t.NonQuotedColumnParser=t.ColumnParser=void 0;var n=r(5314);Object.defineProperty(t,"ColumnParser",{enumerable:true,get:function(){return n.ColumnParser}});var i=r(73649);Object.defineProperty(t,"NonQuotedColumnParser",{enumerable:true,get:function(){return i.NonQuotedColumnParser}});var s=r(85643);Object.defineProperty(t,"QuotedColumnParser",{enumerable:true,get:function(){return s.QuotedColumnParser}});var o=r(40748);Object.defineProperty(t,"ColumnFormatter",{enumerable:true,get:function(){return o.ColumnFormatter}})},15917:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.QuotedColumnParser=t.NonQuotedColumnParser=t.ColumnParser=t.Token=t.Scanner=t.RowParser=t.Parser=void 0;var n=r(99781);Object.defineProperty(t,"Parser",{enumerable:true,get:function(){return n.Parser}});var i=r(65655);Object.defineProperty(t,"RowParser",{enumerable:true,get:function(){return i.RowParser}});var s=r(99735);Object.defineProperty(t,"Scanner",{enumerable:true,get:function(){return s.Scanner}});var o=r(26098);Object.defineProperty(t,"Token",{enumerable:true,get:function(){return o.Token}});var c=r(93707);Object.defineProperty(t,"ColumnParser",{enumerable:true,get:function(){return c.ColumnParser}});Object.defineProperty(t,"NonQuotedColumnParser",{enumerable:true,get:function(){return c.NonQuotedColumnParser}});Object.defineProperty(t,"QuotedColumnParser",{enumerable:true,get:function(){return c.QuotedColumnParser}})},4682:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.HeaderTransformer=void 0;const i=n(r(65151));const s=n(r(820));const o=n(r(78216));const c=n(r(66877));class HeaderTransformer{constructor(e){this.headers=null;this.receivedHeaders=false;this.shouldUseFirstRow=false;this.processedFirstRow=false;this.headersLength=0;this.parserOptions=e;if(e.headers===true){this.shouldUseFirstRow=true}else if(Array.isArray(e.headers)){this.setHeaders(e.headers)}else if(s.default(e.headers)){this.headersTransform=e.headers}}transform(e,t){if(!this.shouldMapRow(e)){return t(null,{row:null,isValid:true})}return t(null,this.processRow(e))}shouldMapRow(e){const{parserOptions:t}=this;if(!this.headersTransform&&t.renameHeaders&&!this.processedFirstRow){if(!this.receivedHeaders){throw new Error("Error renaming headers: new headers must be provided in an array")}this.processedFirstRow=true;return false}if(!this.receivedHeaders&&Array.isArray(e)){if(this.headersTransform){this.setHeaders(this.headersTransform(e))}else if(this.shouldUseFirstRow){this.setHeaders(e)}else{return true}return false}return true}processRow(e){if(!this.headers){return{row:e,isValid:true}}const{parserOptions:t}=this;if(!t.discardUnmappedColumns&&e.length>this.headersLength){if(!t.strictColumnHandling){throw new Error(`Unexpected Error: column header mismatch expected: ${this.headersLength} columns got: ${e.length}`)}return{row:e,isValid:false,reason:`Column header mismatch expected: ${this.headersLength} columns got: ${e.length}`}}if(t.strictColumnHandling&&e.length<this.headersLength){return{row:e,isValid:false,reason:`Column header mismatch expected: ${this.headersLength} columns got: ${e.length}`}}return{row:this.mapHeaders(e),isValid:true}}mapHeaders(e){const t={};const{headers:r,headersLength:n}=this;for(let s=0;s<n;s+=1){const n=r[s];if(!i.default(n)){const r=e[s];if(i.default(r)){t[n]=""}else{t[n]=r}}}return t}setHeaders(e){var t;const r=e.filter((e=>!!e));if(o.default(r).length!==r.length){const e=c.default(r);const t=Object.keys(e).filter((t=>e[t].length>1));throw new Error(`Duplicate headers found ${JSON.stringify(t)}`)}this.headers=e;this.receivedHeaders=true;this.headersLength=((t=this.headers)===null||t===void 0?void 0:t.length)||0}}t.HeaderTransformer=HeaderTransformer},98453:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.RowTransformerValidator=void 0;const i=n(r(820));const s=r(58897);class RowTransformerValidator{constructor(){this._rowTransform=null;this._rowValidator=null}static createTransform(e){if(s.isSyncTransform(e)){return(t,r)=>{let n=null;try{n=e(t)}catch(e){return r(e)}return r(null,n)}}return e}static createValidator(e){if(s.isSyncValidate(e)){return(t,r)=>{r(null,{row:t,isValid:e(t)})}}return(t,r)=>{e(t,((e,n,i)=>{if(e){return r(e)}if(n){return r(null,{row:t,isValid:n,reason:i})}return r(null,{row:t,isValid:false,reason:i})}))}}set rowTransform(e){if(!i.default(e)){throw new TypeError("The transform should be a function")}this._rowTransform=RowTransformerValidator.createTransform(e)}set rowValidator(e){if(!i.default(e)){throw new TypeError("The validate should be a function")}this._rowValidator=RowTransformerValidator.createValidator(e)}transformAndValidate(e,t){return this.callTransformer(e,((e,r)=>{if(e){return t(e)}if(!r){return t(null,{row:null,isValid:true})}return this.callValidator(r,((e,n)=>{if(e){return t(e)}if(n&&!n.isValid){return t(null,{row:r,isValid:false,reason:n.reason})}return t(null,{row:r,isValid:true})}))}))}callTransformer(e,t){if(!this._rowTransform){return t(null,e)}return this._rowTransform(e,t)}callValidator(e,t){if(!this._rowValidator){return t(null,{row:e,isValid:true})}return this._rowValidator(e,t)}}t.RowTransformerValidator=RowTransformerValidator},40634:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.HeaderTransformer=t.RowTransformerValidator=void 0;var n=r(98453);Object.defineProperty(t,"RowTransformerValidator",{enumerable:true,get:function(){return n.RowTransformerValidator}});var i=r(4682);Object.defineProperty(t,"HeaderTransformer",{enumerable:true,get:function(){return i.HeaderTransformer}})},58897:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.isSyncValidate=t.isSyncTransform=void 0;t.isSyncTransform=e=>e.length===1;t.isSyncValidate=e=>e.length===1},81231:function(e,t,r){var n=r(77758);var i=r(71017);var s=r(48919);var o=r(89764);var c=r(28651);var h=r(25723);var p=r(91957);var g=e.exports={};var y=/[\/\\]/g;var processPatterns=function(e,t){var r=[];s(e).forEach((function(e){var n=e.indexOf("!")===0;if(n){e=e.slice(1)}var i=t(e);if(n){r=o(r,i)}else{r=c(r,i)}}));return r};g.exists=function(){var e=i.join.apply(i,arguments);return n.existsSync(e)};g.expand=function(...e){var t=h(e[0])?e.shift():{};var r=Array.isArray(e[0])?e[0]:e;if(r.length===0){return[]}var s=processPatterns(r,(function(e){return p.sync(e,t)}));if(t.filter){s=s.filter((function(e){e=i.join(t.cwd||"",e);try{if(typeof t.filter==="function"){return t.filter(e)}else{return n.statSync(e)[t.filter]()}}catch(e){return false}}))}return s};g.expandMapping=function(e,t,r){r=Object.assign({rename:function(e,t){return i.join(e||"",t)}},r);var n=[];var s={};g.expand(r,e).forEach((function(e){var o=e;if(r.flatten){o=i.basename(o)}if(r.ext){o=o.replace(/(\.[^\/]*)?$/,r.ext)}var c=r.rename(t,o,r);if(r.cwd){e=i.join(r.cwd,e)}c=c.replace(y,"/");e=e.replace(y,"/");if(s[c]){s[c].src.push(e)}else{n.push({src:[e],dest:c});s[c]=n[n.length-1]}}));return n};g.normalizeFilesArray=function(e){var t=[];e.forEach((function(e){var r;if("src"in e||"dest"in e){t.push(e)}}));if(t.length===0){return[]}t=_(t).chain().forEach((function(e){if(!("src"in e)||!e.src){return}if(Array.isArray(e.src)){e.src=s(e.src)}else{e.src=[e.src]}})).map((function(e){var t=Object.assign({},e);delete t.src;delete t.dest;if(e.expand){return g.expandMapping(e.src,e.dest,t).map((function(t){var r=Object.assign({},e);r.orig=Object.assign({},e);r.src=t.src;r.dest=t.dest;["expand","cwd","flatten","rename","ext"].forEach((function(e){delete r[e]}));return r}))}var r=Object.assign({},e);r.orig=Object.assign({},e);if("src"in r){Object.defineProperty(r,"src",{enumerable:true,get:function fn(){var r;if(!("result"in fn)){r=e.src;r=Array.isArray(r)?s(r):[r];fn.result=g.expand(t,r)}return fn.result}})}if("dest"in r){r.dest=e.dest}return r})).flatten().value();return t}},82072:function(e,t,r){var n=r(77758);var i=r(71017);var s=r(73837);var o=r(12084);var c=r(55388);var h=r(11289);var p=r(12781).Stream;var g=r(51642).PassThrough;var y=e.exports={};y.file=r(81231);function assertPath(e){if(typeof e!=="string"){throw new TypeError("Path must be a string. Received "+nutils.inspect(e))}}y.collectStream=function(e,t){var r=[];var n=0;e.on("error",t);e.on("data",(function(e){r.push(e);n+=e.length}));e.on("end",(function(){var e=new Buffer(n);var i=0;r.forEach((function(t){t.copy(e,i);i+=t.length}));t(null,e)}))};y.dateify=function(e){e=e||new Date;if(e instanceof Date){e=e}else if(typeof e==="string"){e=new Date(e)}else{e=new Date}return e};y.defaults=function(e,t,r){var n=arguments;n[0]=n[0]||{};return h(...n)};y.isStream=function(e){return e instanceof p};y.lazyReadStream=function(e){return new o.Readable((function(){return n.createReadStream(e)}))};y.normalizeInputSource=function(e){if(e===null){return new Buffer(0)}else if(typeof e==="string"){return new Buffer(e)}else if(y.isStream(e)&&!e._readableState){var t=new g;e.pipe(t);return t}return e};y.sanitizePath=function(e){return c(e,false).replace(/^\w+:/,"").replace(/^(\.\.\/|\/)+/,"")};y.trailingSlashIt=function(e){return e.slice(-1)!=="/"?e+"/":e};y.unixifyPath=function(e){return c(e,false).replace(/^\w+:/,"")};y.walkdir=function(e,t,r){var s=[];if(typeof t==="function"){r=t;t=e}n.readdir(e,(function(o,c){var h=0;var p;var g;if(o){return r(o)}(function next(){p=c[h++];if(!p){return r(null,s)}g=i.join(e,p);n.stat(g,(function(e,r){s.push({path:g,relative:i.relative(t,g).replace(/\\/g,"/"),stats:r});if(r&&r.isDirectory()){y.walkdir(g,t,(function(e,t){t.forEach((function(e){s.push(e)}));next()}))}else{next()}}))})()}))}},43084:function(e,t,r){
/**
* Archiver Vending
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var n=r(35010);var i={};var vending=function(e,t){return vending.create(e,t)};vending.create=function(e,t){if(i[e]){var r=new n(e,t);r.setFormat(e);r.setModule(new i[e](t));return r}else{throw new Error("create("+e+"): format not registered")}};vending.registerFormat=function(e,t){if(i[e]){throw new Error("register("+e+"): format already registered")}if(typeof t!=="function"){throw new Error("register("+e+"): format module invalid")}if(typeof t.prototype.append!=="function"||typeof t.prototype.finalize!=="function"){throw new Error("register("+e+"): format module missing methods")}i[e]=t};vending.isRegisteredFormat=function(e){if(i[e]){return true}return false};vending.registerFormat("zip",r(8987));vending.registerFormat("tar",r(33614));vending.registerFormat("json",r(99827));e.exports=vending},35010:function(e,t,r){
/**
* Archiver Core
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var n=r(57147);var i=r(17978);var s=r(83198);var o=r(71017);var c=r(82072);var h=r(73837).inherits;var p=r(13143);var g=r(43871).Transform;var y=process.platform==="win32";var Archiver=function(e,t){if(!(this instanceof Archiver)){return new Archiver(e,t)}if(typeof e!=="string"){t=e;e="zip"}t=this.options=c.defaults(t,{highWaterMark:1024*1024,statConcurrency:4});g.call(this,t);this._format=false;this._module=false;this._pending=0;this._pointer=0;this._entriesCount=0;this._entriesProcessedCount=0;this._fsEntriesTotalBytes=0;this._fsEntriesProcessedBytes=0;this._queue=s.queue(this._onQueueTask.bind(this),1);this._queue.drain(this._onQueueDrain.bind(this));this._statQueue=s.queue(this._onStatQueueTask.bind(this),t.statConcurrency);this._statQueue.drain(this._onQueueDrain.bind(this));this._state={aborted:false,finalize:false,finalizing:false,finalized:false,modulePiped:false};this._streams=[]};h(Archiver,g);Archiver.prototype._abort=function(){this._state.aborted=true;this._queue.kill();this._statQueue.kill();if(this._queue.idle()){this._shutdown()}};Archiver.prototype._append=function(e,t){t=t||{};var r={source:null,filepath:e};if(!t.name){t.name=e}t.sourcePath=e;r.data=t;this._entriesCount++;if(t.stats&&t.stats instanceof n.Stats){r=this._updateQueueTaskWithStats(r,t.stats);if(r){if(t.stats.size){this._fsEntriesTotalBytes+=t.stats.size}this._queue.push(r)}}else{this._statQueue.push(r)}};Archiver.prototype._finalize=function(){if(this._state.finalizing||this._state.finalized||this._state.aborted){return}this._state.finalizing=true;this._moduleFinalize();this._state.finalizing=false;this._state.finalized=true};Archiver.prototype._maybeFinalize=function(){if(this._state.finalizing||this._state.finalized||this._state.aborted){return false}if(this._state.finalize&&this._pending===0&&this._queue.idle()&&this._statQueue.idle()){this._finalize();return true}return false};Archiver.prototype._moduleAppend=function(e,t,r){if(this._state.aborted){r();return}this._module.append(e,t,function(e){this._task=null;if(this._state.aborted){this._shutdown();return}if(e){this.emit("error",e);setImmediate(r);return}this.emit("entry",t);this._entriesProcessedCount++;if(t.stats&&t.stats.size){this._fsEntriesProcessedBytes+=t.stats.size}this.emit("progress",{entries:{total:this._entriesCount,processed:this._entriesProcessedCount},fs:{totalBytes:this._fsEntriesTotalBytes,processedBytes:this._fsEntriesProcessedBytes}});setImmediate(r)}.bind(this))};Archiver.prototype._moduleFinalize=function(){if(typeof this._module.finalize==="function"){this._module.finalize()}else if(typeof this._module.end==="function"){this._module.end()}else{this.emit("error",new p("NOENDMETHOD"))}};Archiver.prototype._modulePipe=function(){this._module.on("error",this._onModuleError.bind(this));this._module.pipe(this);this._state.modulePiped=true};Archiver.prototype._moduleSupports=function(e){if(!this._module.supports||!this._module.supports[e]){return false}return this._module.supports[e]};Archiver.prototype._moduleUnpipe=function(){this._module.unpipe(this);this._state.modulePiped=false};Archiver.prototype._normalizeEntryData=function(e,t){e=c.defaults(e,{type:"file",name:null,date:null,mode:null,prefix:null,sourcePath:null,stats:false});if(t&&e.stats===false){e.stats=t}var r=e.type==="directory";if(e.name){if(typeof e.prefix==="string"&&""!==e.prefix){e.name=e.prefix+"/"+e.name;e.prefix=null}e.name=c.sanitizePath(e.name);if(e.type!=="symlink"&&e.name.slice(-1)==="/"){r=true;e.type="directory"}else if(r){e.name+="/"}}if(typeof e.mode==="number"){if(y){e.mode&=511}else{e.mode&=4095}}else if(e.stats&&e.mode===null){if(y){e.mode=e.stats.mode&511}else{e.mode=e.stats.mode&4095}if(y&&r){e.mode=493}}else if(e.mode===null){e.mode=r?493:420}if(e.stats&&e.date===null){e.date=e.stats.mtime}else{e.date=c.dateify(e.date)}return e};Archiver.prototype._onModuleError=function(e){this.emit("error",e)};Archiver.prototype._onQueueDrain=function(){if(this._state.finalizing||this._state.finalized||this._state.aborted){return}if(this._state.finalize&&this._pending===0&&this._queue.idle()&&this._statQueue.idle()){this._finalize()}};Archiver.prototype._onQueueTask=function(e,t){var fullCallback=()=>{if(e.data.callback){e.data.callback()}t()};if(this._state.finalizing||this._state.finalized||this._state.aborted){fullCallback();return}this._task=e;this._moduleAppend(e.source,e.data,fullCallback)};Archiver.prototype._onStatQueueTask=function(e,t){if(this._state.finalizing||this._state.finalized||this._state.aborted){t();return}n.lstat(e.filepath,function(r,n){if(this._state.aborted){setImmediate(t);return}if(r){this._entriesCount--;this.emit("warning",r);setImmediate(t);return}e=this._updateQueueTaskWithStats(e,n);if(e){if(n.size){this._fsEntriesTotalBytes+=n.size}this._queue.push(e)}setImmediate(t)}.bind(this))};Archiver.prototype._shutdown=function(){this._moduleUnpipe();this.end()};Archiver.prototype._transform=function(e,t,r){if(e){this._pointer+=e.length}r(null,e)};Archiver.prototype._updateQueueTaskWithStats=function(e,t){if(t.isFile()){e.data.type="file";e.data.sourceType="stream";e.source=c.lazyReadStream(e.filepath)}else if(t.isDirectory()&&this._moduleSupports("directory")){e.data.name=c.trailingSlashIt(e.data.name);e.data.type="directory";e.data.sourcePath=c.trailingSlashIt(e.filepath);e.data.sourceType="buffer";e.source=Buffer.concat([])}else if(t.isSymbolicLink()&&this._moduleSupports("symlink")){var r=n.readlinkSync(e.filepath);var i=o.dirname(e.filepath);e.data.type="symlink";e.data.linkname=o.relative(i,o.resolve(i,r));e.data.sourceType="buffer";e.source=Buffer.concat([])}else{if(t.isDirectory()){this.emit("warning",new p("DIRECTORYNOTSUPPORTED",e.data))}else if(t.isSymbolicLink()){this.emit("warning",new p("SYMLINKNOTSUPPORTED",e.data))}else{this.emit("warning",new p("ENTRYNOTSUPPORTED",e.data))}return null}e.data=this._normalizeEntryData(e.data,t);return e};Archiver.prototype.abort=function(){if(this._state.aborted||this._state.finalized){return this}this._abort();return this};Archiver.prototype.append=function(e,t){if(this._state.finalize||this._state.aborted){this.emit("error",new p("QUEUECLOSED"));return this}t=this._normalizeEntryData(t);if(typeof t.name!=="string"||t.name.length===0){this.emit("error",new p("ENTRYNAMEREQUIRED"));return this}if(t.type==="directory"&&!this._moduleSupports("directory")){this.emit("error",new p("DIRECTORYNOTSUPPORTED",{name:t.name}));return this}e=c.normalizeInputSource(e);if(Buffer.isBuffer(e)){t.sourceType="buffer"}else if(c.isStream(e)){t.sourceType="stream"}else{this.emit("error",new p("INPUTSTEAMBUFFERREQUIRED",{name:t.name}));return this}this._entriesCount++;this._queue.push({data:t,source:e});return this};Archiver.prototype.directory=function(e,t,r){if(this._state.finalize||this._state.aborted){this.emit("error",new p("QUEUECLOSED"));return this}if(typeof e!=="string"||e.length===0){this.emit("error",new p("DIRECTORYDIRPATHREQUIRED"));return this}this._pending++;if(t===false){t=""}else if(typeof t!=="string"){t=e}var n=false;if(typeof r==="function"){n=r;r={}}else if(typeof r!=="object"){r={}}var s={stat:true,dot:true};function onGlobEnd(){this._pending--;this._maybeFinalize()}function onGlobError(e){this.emit("error",e)}function onGlobMatch(i){o.pause();var s=false;var c=Object.assign({},r);c.name=i.relative;c.prefix=t;c.stats=i.stat;c.callback=o.resume.bind(o);try{if(n){c=n(c);if(c===false){s=true}else if(typeof c!=="object"){throw new p("DIRECTORYFUNCTIONINVALIDDATA",{dirpath:e})}}}catch(e){this.emit("error",e);return}if(s){o.resume();return}this._append(i.absolute,c)}var o=i(e,s);o.on("error",onGlobError.bind(this));o.on("match",onGlobMatch.bind(this));o.on("end",onGlobEnd.bind(this));return this};Archiver.prototype.file=function(e,t){if(this._state.finalize||this._state.aborted){this.emit("error",new p("QUEUECLOSED"));return this}if(typeof e!=="string"||e.length===0){this.emit("error",new p("FILEFILEPATHREQUIRED"));return this}this._append(e,t);return this};Archiver.prototype.glob=function(e,t,r){this._pending++;t=c.defaults(t,{stat:true,pattern:e});function onGlobEnd(){this._pending--;this._maybeFinalize()}function onGlobError(e){this.emit("error",e)}function onGlobMatch(e){n.pause();var t=Object.assign({},r);t.callback=n.resume.bind(n);t.stats=e.stat;t.name=e.relative;this._append(e.absolute,t)}var n=i(t.cwd||".",t);n.on("error",onGlobError.bind(this));n.on("match",onGlobMatch.bind(this));n.on("end",onGlobEnd.bind(this));return this};Archiver.prototype.finalize=function(){if(this._state.aborted){var e=new p("ABORTED");this.emit("error",e);return Promise.reject(e)}if(this._state.finalize){var t=new p("FINALIZING");this.emit("error",t);return Promise.reject(t)}this._state.finalize=true;if(this._pending===0&&this._queue.idle()&&this._statQueue.idle()){this._finalize()}var r=this;return new Promise((function(e,t){var n;r._module.on("end",(function(){if(!n){e()}}));r._module.on("error",(function(e){n=true;t(e)}))}))};Archiver.prototype.setFormat=function(e){if(this._format){this.emit("error",new p("FORMATSET"));return this}this._format=e;return this};Archiver.prototype.setModule=function(e){if(this._state.aborted){this.emit("error",new p("ABORTED"));return this}if(this._state.module){this.emit("error",new p("MODULESET"));return this}this._module=e;this._modulePipe();return this};Archiver.prototype.symlink=function(e,t,r){if(this._state.finalize||this._state.aborted){this.emit("error",new p("QUEUECLOSED"));return this}if(typeof e!=="string"||e.length===0){this.emit("error",new p("SYMLINKFILEPATHREQUIRED"));return this}if(typeof t!=="string"||t.length===0){this.emit("error",new p("SYMLINKTARGETREQUIRED",{filepath:e}));return this}if(!this._moduleSupports("symlink")){this.emit("error",new p("SYMLINKNOTSUPPORTED",{filepath:e}));return this}var n={};n.type="symlink";n.name=e.replace(/\\/g,"/");n.linkname=t.replace(/\\/g,"/");n.sourceType="buffer";if(typeof r==="number"){n.mode=r}this._entriesCount++;this._queue.push({data:n,source:Buffer.concat([])});return this};Archiver.prototype.pointer=function(){return this._pointer};Archiver.prototype.use=function(e){this._streams.push(e);return this};e.exports=Archiver},13143:function(e,t,r){
/**
* Archiver Core
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var n=r(73837);const i={ABORTED:"archive was aborted",DIRECTORYDIRPATHREQUIRED:"diretory dirpath argument must be a non-empty string value",DIRECTORYFUNCTIONINVALIDDATA:"invalid data returned by directory custom data function",ENTRYNAMEREQUIRED:"entry name must be a non-empty string value",FILEFILEPATHREQUIRED:"file filepath argument must be a non-empty string value",FINALIZING:"archive already finalizing",QUEUECLOSED:"queue closed",NOENDMETHOD:"no suitable finalize/end method defined by module",DIRECTORYNOTSUPPORTED:"support for directory entries not defined by module",FORMATSET:"archive format already set",INPUTSTEAMBUFFERREQUIRED:"input source must be valid Stream or Buffer instance",MODULESET:"module already set",SYMLINKNOTSUPPORTED:"support for symlink entries not defined by module",SYMLINKFILEPATHREQUIRED:"symlink filepath argument must be a non-empty string value",SYMLINKTARGETREQUIRED:"symlink target argument must be a non-empty string value",ENTRYNOTSUPPORTED:"entry not supported"};function ArchiverError(e,t){Error.captureStackTrace(this,this.constructor);this.message=i[e]||e;this.code=e;this.data=t}n.inherits(ArchiverError,Error);t=e.exports=ArchiverError},99827:function(e,t,r){
/**
* JSON Format Plugin
*
* @module plugins/json
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var n=r(73837).inherits;var i=r(43871).Transform;var s=r(84794);var o=r(82072);var Json=function(e){if(!(this instanceof Json)){return new Json(e)}e=this.options=o.defaults(e,{});i.call(this,e);this.supports={directory:true,symlink:true};this.files=[]};n(Json,i);Json.prototype._transform=function(e,t,r){r(null,e)};Json.prototype._writeStringified=function(){var e=JSON.stringify(this.files);this.write(e)};Json.prototype.append=function(e,t,r){var n=this;t.crc32=0;function onend(e,i){if(e){r(e);return}t.size=i.length||0;t.crc32=s.unsigned(i);n.files.push(t);r(null,t)}if(t.sourceType==="buffer"){onend(null,e)}else if(t.sourceType==="stream"){o.collectStream(e,onend)}};Json.prototype.finalize=function(){this._writeStringified();this.end()};e.exports=Json},33614:function(e,t,r){
/**
* TAR Format Plugin
*
* @module plugins/tar
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var n=r(59796);var i=r(91518);var s=r(82072);var Tar=function(e){if(!(this instanceof Tar)){return new Tar(e)}e=this.options=s.defaults(e,{gzip:false});if(typeof e.gzipOptions!=="object"){e.gzipOptions={}}this.supports={directory:true,symlink:true};this.engine=i.pack(e);this.compressor=false;if(e.gzip){this.compressor=n.createGzip(e.gzipOptions);this.compressor.on("error",this._onCompressorError.bind(this))}};Tar.prototype._onCompressorError=function(e){this.engine.emit("error",e)};Tar.prototype.append=function(e,t,r){var n=this;t.mtime=t.date;function append(e,i){if(e){r(e);return}n.engine.entry(t,i,(function(e){r(e,t)}))}if(t.sourceType==="buffer"){append(null,e)}else if(t.sourceType==="stream"&&t.stats){t.size=t.stats.size;var i=n.engine.entry(t,(function(e){r(e,t)}));e.pipe(i)}else if(t.sourceType==="stream"){s.collectStream(e,append)}};Tar.prototype.finalize=function(){this.engine.finalize()};Tar.prototype.on=function(){return this.engine.on.apply(this.engine,arguments)};Tar.prototype.pipe=function(e,t){if(this.compressor){return this.engine.pipe.apply(this.engine,[this.compressor]).pipe(e,t)}else{return this.engine.pipe.apply(this.engine,arguments)}};Tar.prototype.unpipe=function(){if(this.compressor){return this.compressor.unpipe.apply(this.compressor,arguments)}else{return this.engine.unpipe.apply(this.engine,arguments)}};e.exports=Tar},8987:function(e,t,r){
/**
* ZIP Format Plugin
*
* @module plugins/zip
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var n=r(86454);var i=r(82072);var Zip=function(e){if(!(this instanceof Zip)){return new Zip(e)}e=this.options=i.defaults(e,{comment:"",forceUTC:false,namePrependSlash:false,store:false});this.supports={directory:true,symlink:true};this.engine=new n(e)};Zip.prototype.append=function(e,t,r){this.engine.entry(e,t,r)};Zip.prototype.finalize=function(){this.engine.finalize()};Zip.prototype.on=function(){return this.engine.on.apply(this.engine,arguments)};Zip.prototype.pipe=function(){return this.engine.pipe.apply(this.engine,arguments)};Zip.prototype.unpipe=function(){return this.engine.unpipe.apply(this.engine,arguments)};e.exports=Zip},83198:function(e,t){(function(e,r){true?r(t):0})(this,(function(e){"use strict";function apply(e,...t){return(...r)=>e(...t,...r)}function initialParams(e){return function(...t){var r=t.pop();return e.call(this,t,r)}}var t=typeof queueMicrotask==="function"&&queueMicrotask;var r=typeof setImmediate==="function"&&setImmediate;var n=typeof process==="object"&&typeof process.nextTick==="function";function fallback(e){setTimeout(e,0)}function wrap(e){return(t,...r)=>e((()=>t(...r)))}var i;if(t){i=queueMicrotask}else if(r){i=setImmediate}else if(n){i=process.nextTick}else{i=fallback}var s=wrap(i);function asyncify(e){if(isAsync(e)){return function(...t){const r=t.pop();const n=e.apply(this,t);return handlePromise(n,r)}}return initialParams((function(t,r){var n;try{n=e.apply(this,t)}catch(e){return r(e)}if(n&&typeof n.then==="function"){return handlePromise(n,r)}else{r(null,n)}}))}function handlePromise(e,t){return e.then((e=>{invokeCallback(t,null,e)}),(e=>{invokeCallback(t,e&&(e instanceof Error||e.message)?e:new Error(e))}))}function invokeCallback(e,t,r){try{e(t,r)}catch(e){s((e=>{throw e}),e)}}function isAsync(e){return e[Symbol.toStringTag]==="AsyncFunction"}function isAsyncGenerator(e){return e[Symbol.toStringTag]==="AsyncGenerator"}function isAsyncIterable(e){return typeof e[Symbol.asyncIterator]==="function"}function wrapAsync(e){if(typeof e!=="function")throw new Error("expected a function");return isAsync(e)?asyncify(e):e}function awaitify(e,t){if(!t)t=e.length;if(!t)throw new Error("arity is undefined");function awaitable(...r){if(typeof r[t-1]==="function"){return e.apply(this,r)}return new Promise(((n,i)=>{r[t-1]=(e,...t)=>{if(e)return i(e);n(t.length>1?t:t[0])}