extra-request 2.3.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +233 -0
- package/LICENSE +1 -1
- package/dist/es2015/index.min.mjs +2 -2
- package/dist/es2015/index.min.mjs.map +1 -1
- package/dist/es2015/index.mjs +48 -63
- package/dist/es2015/index.mjs.map +1 -1
- package/dist/es2015/index.umd.js +50 -65
- package/dist/es2015/index.umd.js.map +1 -1
- package/dist/es2015/index.umd.min.js +2 -2
- package/dist/es2015/index.umd.min.js.map +1 -1
- package/dist/es2018/index.min.mjs +2 -2
- package/dist/es2018/index.min.mjs.map +1 -1
- package/dist/es2018/index.mjs +48 -63
- package/dist/es2018/index.mjs.map +1 -1
- package/dist/es2018/index.umd.js +50 -65
- package/dist/es2018/index.umd.js.map +1 -1
- package/dist/es2018/index.umd.min.js +2 -2
- package/dist/es2018/index.umd.min.js.map +1 -1
- package/lib/es2015/request.js +1 -1
- package/lib/es2015/request.js.map +1 -1
- package/lib/es2015/transformers/accept.js +1 -1
- package/lib/es2015/transformers/accept.js.map +1 -1
- package/lib/es2015/transformers/basic-auth.js +1 -1
- package/lib/es2015/transformers/basic-auth.js.map +1 -1
- package/lib/es2015/transformers/bearer-auth.js +1 -1
- package/lib/es2015/transformers/bearer-auth.js.map +1 -1
- package/lib/es2015/transformers/csv.js +2 -2
- package/lib/es2015/transformers/csv.js.map +1 -1
- package/lib/es2015/transformers/form-data-field.js +2 -1
- package/lib/es2015/transformers/form-data-field.js.map +1 -1
- package/lib/es2018/request.js +1 -1
- package/lib/es2018/request.js.map +1 -1
- package/lib/es2018/transformers/accept.js +1 -1
- package/lib/es2018/transformers/accept.js.map +1 -1
- package/lib/es2018/transformers/basic-auth.js +1 -1
- package/lib/es2018/transformers/basic-auth.js.map +1 -1
- package/lib/es2018/transformers/bearer-auth.js +1 -1
- package/lib/es2018/transformers/bearer-auth.js.map +1 -1
- package/lib/es2018/transformers/csv.js +2 -2
- package/lib/es2018/transformers/csv.js.map +1 -1
- package/lib/es2018/transformers/form-data-field.js +2 -1
- package/lib/es2018/transformers/form-data-field.js.map +1 -1
- package/package.json +30 -23
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ExtraRequest={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r={fetch:void 0};r.fetch=globalThis.fetch.bind(globalThis);var i={Headers:void 0};i.Headers=globalThis.Headers;var s={Request:void 0};s.Request=globalThis.Request;var o={Response:void 0};o.Response=globalThis.Response;var a={FormData:void 0};a.FormData=globalThis.FormData;var u={AbortController:void 0};u.AbortController=globalThis.AbortController;var c={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ExtraRequest={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r={fetch:void 0};r.fetch=globalThis.fetch.bind(globalThis);var i={Headers:void 0};i.Headers=globalThis.Headers;var s={Request:void 0};s.Request=globalThis.Request;var o={Response:void 0};o.Response=globalThis.Response;var a={FormData:void 0};a.FormData=globalThis.FormData;var u={AbortController:void 0};u.AbortController=globalThis.AbortController;var c={AbortError:void 0};c.AbortError=globalThis.DOMException;var f={Blob:void 0};f.Blob=globalThis.Blob;var h={EventSource:void 0};h.EventSource=globalThis.EventSource,function(e){var n=t&&t.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),d=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};d(r,e),d(i,e),d(s,e),d(o,e),d(a,e),d(u,e),d(c,e),d(f,e),d(h,e)}(n);var d={},l={};function p(e){return Array.isArray(e)}l.isntEmptyArray=l.isEmptyArray=l.isntArray=l.isArray=void 0,l.isArray=p,l.isntArray=function(e){return!p(e)},l.isEmptyArray=function(e){return 0===e.length},l.isntEmptyArray=function(e){return 0!==e.length};var g={},m={};function y(e){return null===e}m.isntNull=m.isNull=void 0,m.isNull=y,m.isntNull=function(e){return!y(e)};var v={};function b(e){return void 0===e}v.isntUndefined=v.isUndefined=void 0,v.isUndefined=b,v.isntUndefined=function(e){return!b(e)},g.isntAsyncIterable=g.isAsyncIterable=void 0;const _=m,E=v;function O(e){return(0,_.isntNull)(e)&&(0,E.isntUndefined)(e)&&"function"==typeof e[Symbol.asyncIterator]}g.isAsyncIterable=O,g.isntAsyncIterable=function(e){return!O(e)};var w={};function R(e){return"bigint"==typeof e}w.isntBigInt=w.isBigInt=void 0,w.isBigInt=R,w.isntBigInt=function(e){return!R(e)};var k={};function S(e){return"boolean"==typeof e}k.isntBoolean=k.isBoolean=void 0,k.isBoolean=S,k.isntBoolean=function(e){return!S(e)};var C={},j={};function A(e){return"string"==typeof e}j.isntString=j.isString=void 0,j.isString=A,j.isntString=function(e){return!A(e)},C.isntChar=C.isChar=void 0;const x=j;function T(e){return(0,x.isString)(e)&&1===e.length}C.isChar=T,C.isntChar=function(e){return!T(e)};var D={};function I(e){return e instanceof Date}D.isntDate=D.isDate=void 0,D.isDate=I,D.isntDate=function(e){return!I(e)};var L={};L.inEnum=void 0,L.inEnum=function(e,t){return Object.values(t).includes(e)};var U={};function F(e){return e instanceof Error}U.isntError=U.isError=void 0,U.isError=F,U.isntError=function(e){return!F(e)};var P={};function N(e){return!e}P.isntFalsy=P.isFalsy=void 0,P.isFalsy=N,P.isntFalsy=function(e){return!N(e)};var B={};function z(e){return"function"==typeof e}B.isntFunction=B.isFunction=void 0,B.isFunction=z,B.isntFunction=function(e){return!z(e)};var q={};q.isntIterable=q.isIterable=void 0;const J=m,M=v;function H(e){return(0,J.isntNull)(e)&&(0,M.isntUndefined)(e)&&"function"==typeof e[Symbol.iterator]}q.isIterable=H,q.isntIterable=function(e){return!H(e)};var K={},W={};function Q(e){return null!==e&&"object"==typeof e}W.isntEmptyObject=W.isEmptyObject=W.isRecord=W.isntObject=W.isObject=void 0,W.isObject=Q,W.isntObject=function(e){return!Q(e)},W.isRecord=function(e){return Q(e)},W.isEmptyObject=function(e){return 0===Object.keys(e).length},W.isntEmptyObject=function(e){return 0!==Object.keys(e).length};var $={};function G(e){return"number"==typeof e}$.isntNumber=$.isNumber=void 0,$.isNumber=G,$.isntNumber=function(e){return!G(e)},K.isntJsonRpcError=K.isJsonRpcError=K.isntJsonRpcSuccess=K.isJsonRpcSuccess=K.isntJsonRpcRequest=K.isJsonRpcRequest=K.isntJsonRpcNotification=K.isJsonRpcNotification=void 0;const Z=l,Y=W,X=j,V=$,ee=v;function te(e){return(0,X.isString)(e)||(0,V.isNumber)(e)}function ne(e){return(0,Z.isArray)(e)||(0,Y.isObject)(e)}function re(e){return(0,Y.isRecord)(e)&&(0,X.isString)(e.jsonrpc)&&(0,X.isString)(e.method)&&(0,ee.isUndefined)(e.id)&&ne(e.params)}function ie(e){return(0,Y.isRecord)(e)&&(0,X.isString)(e.jsonrpc)&&(0,X.isString)(e.method)&&te(e.id)&&ne(e.params)}function se(e){return(0,Y.isRecord)(e)&&(0,X.isString)(e.jsonrpc)&&(0,X.isString)(e.id)&&"result"in e}function oe(e){return(0,Y.isRecord)(e)&&(0,X.isString)(e.jsonrpc)&&te(e.id)&&function(e){return(0,Y.isRecord)(e)&&(0,V.isNumber)(e.code)&&(0,X.isString)(e.message)&&((0,ee.isUndefined)(e.data)||(0,Y.isObject)(e.data))}(e.error)}K.isJsonRpcNotification=re,K.isntJsonRpcNotification=function(e){return!re(e)},K.isJsonRpcRequest=ie,K.isntJsonRpcRequest=function(e){return!ie(e)},K.isJsonRpcSuccess=se,K.isntJsonRpcSuccess=function(e){return!se(e)},K.isJsonRpcError=oe,K.isntJsonRpcError=function(e){return!oe(e)};var ae={};ae.isntJson=ae.isJson=void 0,ae.isJson=function(e){try{return JSON.stringify(e),!0}catch(e){return!1}},ae.isntJson=function e(t){return!e()};var ue={};function ce(e,...t){const r=t.reduce(((e,t)=>d.isFunction(t)?t(e):e),{url:new URL("http://localhost"),headers:new n.Headers}),i=new n.Headers(r.headers);return new n.Request(r.url.href,{method:e,headers:i,signal:r.signal,body:r.payload,keepalive:r.keepalive})}ue.isAbsoluteURL=void 0,ue.isAbsoluteURL=function(e){try{return new URL(e),!0}catch(e){return!1}},function(e){var n=t&&t.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};r(l,e),r(g,e),r(w,e),r(k,e),r(C,e),r(D,e),r(L,e),r(U,e),r(P,e),r(B,e),r(q,e),r(K,e),r(ae,e),r(m,e),r($,e),r(W,e),r(j,e),r(v,e),r(ue,e)}(d);var fe={exports:{}};
|
|
2
2
|
/* @license
|
|
3
3
|
Papa Parse
|
|
4
4
|
v5.3.1
|
|
5
5
|
https://github.com/mholt/PapaParse
|
|
6
6
|
License: MIT
|
|
7
|
-
*/!function(e,t){e.exports=function e(){var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=n&&/blob:/i.test((t.location||{}).protocol),i={},s=0,o={parse:function(n,r){var a=(r=r||{}).dynamicTyping||!1;if(O(a)&&(r.dynamicTypingFunction=a,a={}),r.dynamicTyping=a,r.transform=!!O(r.transform)&&r.transform,r.worker&&o.WORKERS_SUPPORTED){var u=function(){if(!o.WORKERS_SUPPORTED)return!1;var n,r,a=(n=t.URL||t.webkitURL||null,r=e.toString(),o.BLOB_URL||(o.BLOB_URL=n.createObjectURL(new Blob(["(",r,")();"],{type:"text/javascript"})))),u=new t.Worker(a);return u.onmessage=m,u.id=s++,i[u.id]=u}();return u.userStep=r.step,u.userChunk=r.chunk,u.userComplete=r.complete,u.userError=r.error,r.step=O(r.step),r.chunk=O(r.chunk),r.complete=O(r.complete),r.error=O(r.error),delete r.worker,void u.postMessage({input:n,config:r,workerId:u.id})}var l=null;return o.NODE_STREAM_INPUT,"string"==typeof n?l=r.download?new c(r):new h(r):!0===n.readable&&O(n.read)&&O(n.on)?l=new d(r):(t.File&&n instanceof File||n instanceof Object)&&(l=new f(r)),l.stream(n)},unparse:function(e,t){var n=!1,r=!0,i=",",s="\r\n",a='"',u=a+a,c=!1,f=null,h=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");f=t.columns}void 0!==t.escapeChar&&(u=t.escapeChar+a),"boolean"==typeof t.escapeFormulae&&(h=t.escapeFormulae)}}();var d=new RegExp(p(a),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return l(null,e,c);if("object"==typeof e[0])return l(f||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),l(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function l(e,t,n){var o="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var a=Array.isArray(e)&&0<e.length,u=!Array.isArray(t[0]);if(a&&r){for(var c=0;c<e.length;c++)0<c&&(o+=i),o+=g(e[c],c);0<t.length&&(o+=s)}for(var f=0;f<t.length;f++){var h=a?e.length:t[f].length,d=!1,l=a?0===Object.keys(t[f]).length:0===t[f].length;if(n&&!a&&(d="greedy"===n?""===t[f].join("").trim():1===t[f].length&&0===t[f][0].length),"greedy"===n&&a){for(var p=[],m=0;m<h;m++){var b=u?e[m]:m;p.push(t[f][b])}d=""===p.join("").trim()}if(!d){for(var v=0;v<h;v++){0<v&&!l&&(o+=i);var y=a&&u?e[v]:v;o+=g(t[f][y],v)}f<t.length-1&&(!n||0<h&&!l)&&(o+=s)}}return o}function g(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===h&&"string"==typeof e&&null!==e.match(/^[=+\-@].*$/)&&(e="'"+e);var r=e.toString().replace(d,u);return"boolean"==typeof n&&n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(r,o.BAD_DELIMITERS)||-1<r.indexOf(i)||" "===r.charAt(0)||" "===r.charAt(r.length-1)?a+r+a:r}}};if(o.RECORD_SEP=String.fromCharCode(30),o.UNIT_SEP=String.fromCharCode(31),o.BYTE_ORDER_MARK="\ufeff",o.BAD_DELIMITERS=["\r","\n",'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!n&&!!t.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=g,o.ParserHandle=l,o.NetworkStreamer=c,o.FileStreamer=f,o.StringStreamer=h,o.ReadableStreamStreamer=d,t.jQuery){var a=t.jQuery;a.fn.parse=function(e){var n=e.config||{},r=[];return this.each((function(e){if("INPUT"!==a(this).prop("tagName").toUpperCase()||"file"!==a(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var i=0;i<this.files.length;i++)r.push({file:this.files[i],inputElem:this,instanceConfig:a.extend({},n)})})),i(),this;function i(){if(0!==r.length){var t,n,i,u,c=r[0];if(O(e.before)){var f=e.before(c.file,c.inputElem);if("object"==typeof f){if("abort"===f.action)return t="AbortError",n=c.file,i=c.inputElem,u=f.reason,void(O(e.error)&&e.error({name:t},n,i,u));if("skip"===f.action)return void s();"object"==typeof f.config&&(c.instanceConfig=a.extend(c.instanceConfig,f.config))}else if("skip"===f)return void s()}var h=c.instanceConfig.complete;c.instanceConfig.complete=function(e){O(h)&&h(e,c.file,c.inputElem),s()},o.parse(c.file,c.instanceConfig)}else O(e.complete)&&e.complete()}function s(){r.splice(0,1),i()}}}function u(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=y(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new l(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&O(this._config.beforeFirstChunk)){var i=this._config.beforeFirstChunk(e);void 0!==i&&(e=i)}this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e;this._partialLine="";var a=this._handle.parse(s,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var u=a.meta.cursor;this._finished||(this._partialLine=s.substring(u-this._baseIndex),this._baseIndex=u),a&&a.data&&(this._rowCount+=a.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)t.postMessage({results:a,workerId:o.WORKER_ID,finished:c});else if(O(this._config.chunk)&&!n){if(this._config.chunk(a,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);a=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(a.data),this._completeResults.errors=this._completeResults.errors.concat(a.errors),this._completeResults.meta=a.meta),this._completed||!c||!O(this._config.complete)||a&&a.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||a&&a.meta.paused||this._nextChunk(),a}this._halted=!0},this._sendError=function(e){O(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),u.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var i=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+i)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function f(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),u.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var i=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,i)}var s=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:s}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function h(e){var t;u.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function d(e){u.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=_((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=_((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=_((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=_((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function l(e){var t,n,r,i=Math.pow(2,53),s=-i,a=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,u=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,c=this,f=0,h=0,d=!1,l=!1,m=[],b={data:[],errors:[],meta:{}};if(O(e.step)){var v=e.step;e.step=function(t){if(b=t,E())w();else{if(w(),0===b.data.length)return;f+=t.data.length,e.preview&&f>e.preview?n.abort():(b.data=b.data[0],v(b,c))}}}function _(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function w(){if(b&&r&&(S("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines)for(var t=0;t<b.data.length;t++)_(b.data[t])&&b.data.splice(t--,1);return E()&&function(){if(b)if(Array.isArray(b.data[0])){for(var t=0;E()&&t<b.data.length;t++)b.data[t].forEach(n);b.data.splice(0,1)}else b.data.forEach(n);function n(t,n){O(e.transformHeader)&&(t=e.transformHeader(t,n)),m.push(t)}}(),function(){if(!b||!e.header&&!e.dynamicTyping&&!e.transform)return b;function t(t,n){var r,i=e.header?{}:[];for(r=0;r<t.length;r++){var s=r,o=t[r];e.header&&(s=r>=m.length?"__parsed_extra":m[r]),e.transform&&(o=e.transform(o,s)),o=R(s,o),"__parsed_extra"===s?(i[s]=i[s]||[],i[s].push(o)):i[s]=o}return e.header&&(r>m.length?S("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+r,h+n):r<m.length&&S("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+r,h+n)),i}var n=1;return!b.data.length||Array.isArray(b.data[0])?(b.data=b.data.map(t),n=b.data.length):b.data=t(b.data,0),e.header&&b.meta&&(b.meta.fields=m),h+=n,b}()}function E(){return e.header&&0===m.length}function R(t,n){return r=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(a.test(e)){var t=parseFloat(e);if(s<t&&t<i)return!0}return!1}(n)?parseFloat(n):u.test(n)?new Date(n):""===n?null:n):n;var r}function S(e,t,n,r){var i={type:e,code:t,message:n};void 0!==r&&(i.row=r),b.errors.push(i)}this.parse=function(i,s,a){var u=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var n=new RegExp(p(t)+"([^]*?)"+p(t),"gm"),r=(e=e.replace(n,"")).split("\r"),i=e.split("\n"),s=1<i.length&&i[0].length<r[0].length;if(1===r.length||s)return"\n";for(var o=0,a=0;a<r.length;a++)"\n"===r[a][0]&&o++;return o>=r.length/2?"\r\n":"\r"}(i,u)),r=!1,e.delimiter)O(e.delimiter)&&(e.delimiter=e.delimiter(i),b.meta.delimiter=e.delimiter);else{var c=function(t,n,r,i,s){var a,u,c,f;s=s||[",","\t","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var h=0;h<s.length;h++){var d=s[h],l=0,p=0,m=0;c=void 0;for(var b=new g({comments:i,delimiter:d,newline:n,preview:10}).parse(t),v=0;v<b.data.length;v++)if(r&&_(b.data[v]))m++;else{var y=b.data[v].length;p+=y,void 0!==c?0<y&&(l+=Math.abs(y-c),c=y):c=y}0<b.data.length&&(p/=b.data.length-m),(void 0===u||l<=u)&&(void 0===f||f<p)&&1.99<p&&(u=l,a=d,f=p)}return{successful:!!(e.delimiter=a),bestDelimiter:a}}(i,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(r=!0,e.delimiter=o.DefaultDelimiter),b.meta.delimiter=e.delimiter}var f=y(e);return e.preview&&e.header&&f.preview++,t=i,n=new g(f),b=n.parse(t,s,a),w(),d?{meta:{paused:!0}}:b||{meta:{paused:!1}}},this.paused=function(){return d},this.pause=function(){d=!0,n.abort(),t=O(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(d=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return l},this.abort=function(){l=!0,n.abort(),b.meta.aborted=!0,O(e.complete)&&e.complete(b),t=""}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(e){var t,n=(e=e||{}).delimiter,r=e.newline,i=e.comments,s=e.step,a=e.preview,u=e.fastMode,c=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<o.BAD_DELIMITERS.indexOf(n))&&(n=","),i===n)throw new Error("Comment character same as delimiter");!0===i?i="#":("string"!=typeof i||-1<o.BAD_DELIMITERS.indexOf(i))&&(i=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var f=0,h=!1;this.parse=function(e,o,d){if("string"!=typeof e)throw new Error("Input must be a string");var l=e.length,g=n.length,m=r.length,b=i.length,v=O(s),y=[],_=[],w=[],E=f=0;if(!e)return F();if(u||!1!==u&&-1===e.indexOf(t)){for(var R=e.split(r),S=0;S<R.length;S++){if(w=R[S],f+=w.length,S!==R.length-1)f+=r.length;else if(d)return F();if(!i||w.substring(0,b)!==i){if(v){if(y=[],D(w.split(n)),P(),h)return F()}else D(w.split(n));if(a&&a<=S)return y=y.slice(0,a),F(!0)}}return F()}for(var k=e.indexOf(n,f),j=e.indexOf(r,f),C=new RegExp(p(c)+p(t),"g"),A=e.indexOf(t,f);;)if(e[f]!==t)if(i&&0===w.length&&e.substring(f,f+b)===i){if(-1===j)return F();f=j+m,j=e.indexOf(r,f),k=e.indexOf(n,f)}else if(-1!==k&&(k<j||-1===j))w.push(e.substring(f,k)),f=k+g,k=e.indexOf(n,f);else{if(-1===j)break;if(w.push(e.substring(f,j)),U(j+m),v&&(P(),h))return F();if(a&&y.length>=a)return F(!0)}else for(A=f,f++;;){if(-1===(A=e.indexOf(t,A+1)))return d||_.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:y.length,index:f}),L();if(A===l-1)return L(e.substring(f,A).replace(C,t));if(t!==c||e[A+1]!==c){if(t===c||0===A||e[A-1]!==c){-1!==k&&k<A+1&&(k=e.indexOf(n,A+1)),-1!==j&&j<A+1&&(j=e.indexOf(r,A+1));var x=I(-1===j?k:Math.min(k,j));if(e[A+1+x]===n){w.push(e.substring(f,A).replace(C,t)),e[f=A+1+x+g]!==t&&(A=e.indexOf(t,f)),k=e.indexOf(n,f),j=e.indexOf(r,f);break}var T=I(j);if(e.substring(A+1+T,A+1+T+m)===r){if(w.push(e.substring(f,A).replace(C,t)),U(A+1+T+m),k=e.indexOf(n,f),A=e.indexOf(t,f),v&&(P(),h))return F();if(a&&y.length>=a)return F(!0);break}_.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:y.length,index:f}),A++}}else A++}return L();function D(e){y.push(e),E=f}function I(t){var n=0;if(-1!==t){var r=e.substring(A+1,t);r&&""===r.trim()&&(n=r.length)}return n}function L(t){return d||(void 0===t&&(t=e.substring(f)),w.push(t),f=l,D(w),v&&P()),F()}function U(t){f=t,D(w),w=[],j=e.indexOf(r,f)}function F(e){return{data:y,errors:_,meta:{delimiter:n,linebreak:r,aborted:h,truncated:!!e,cursor:E+(o||0)}}}function P(){s(F()),y=[],_=[]}},this.abort=function(){h=!0},this.getCharIndex=function(){return f}}function m(e){var t=e.data,n=i[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var s={abort:function(){r=!0,b(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(O(n.userStep)){for(var o=0;o<t.results.data.length&&(n.userStep({data:t.results.data[o],errors:t.results.errors,meta:t.results.meta},s),!r);o++);delete t.results}else O(n.userChunk)&&(n.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!r&&b(t.workerId,t.results)}function b(e,t){var n=i[e];O(n.userComplete)&&n.userComplete(t),n.terminate(),delete i[e]}function v(){throw new Error("Not implemented.")}function y(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=y(e[n]);return t}function _(e,t){return function(){e.apply(t,arguments)}}function O(e){return"function"==typeof e}return r&&(t.onmessage=function(e){var n=e.data;if(void 0===o.WORKER_ID&&n&&(o.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:o.WORKER_ID,results:o.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var r=o.parse(n.input,n.config);r&&t.postMessage({workerId:o.WORKER_ID,results:r,finished:!0})}}),(c.prototype=Object.create(u.prototype)).constructor=c,(f.prototype=Object.create(u.prototype)).constructor=f,(h.prototype=Object.create(h.prototype)).constructor=h,(d.prototype=Object.create(u.prototype)).constructor=d,o}()}(he);var de={},le={CustomError:void 0};class pe extends Error{get name(){return this.constructor.name}}le.CustomError=pe;var ge={ExpectedError:void 0};const me=le;class be extends me.CustomError{}ge.ExpectedError=be;var ve={AssertionError:void 0};const ye=le;class _e extends ye.CustomError{}ve.AssertionError=_e;var Oe={};Oe.normalize=void 0,Oe.normalize=function(e){var t;return{name:e.name,message:e.message,stack:null!==(t=e.stack)&&void 0!==t?t:null}};var we={refute:void 0};const Ee=ge;we.refute=function(e,t){if(e)throw new Ee.ExpectedError(t)};var Re={assert:void 0};const Se=ve;function ke(e){const t=Object.keys(e[0]);return he.exports.unparse({data:e,fields:t})}function je(e,t){return r=>{const i=new n.Headers(r.headers);return i.set(e,t),Object.assign(Object.assign({},r),{headers:i})}}function Ce(e,t){return r=>{const i=new n.Headers(r.headers);return i.append(e,t),Object.assign(Object.assign({},r),{headers:i})}}Re.assert=function(e,t){if(!e)throw new Se.AssertionError(t)},function(e){var n=t&&t.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};r(le,e),r(ge,e),r(ve,e),r(Oe,e),r(we,e),r(Re,e)}(de);const Ae="function"==typeof btoa,xe="function"==typeof Buffer;"function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder;const Te=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="];(e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(Te),String.fromCharCode.bind(String),"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);const De=Ae?e=>btoa(e):xe?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,n,r,i,s="";const o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|i,s+=Te[t>>18&63]+Te[t>>12&63]+Te[t>>6&63]+Te[63&t]}return o?s.slice(0,o-3)+"===".substring(o):s};e.accept=function(e){return Ce("Accept",e)},e.appendHeader=Ce,e.appendSearchParam=function(e,t){return n=>{const r=new URL(n.url.href),i=new URLSearchParams(r.searchParams);return i.append(e,t.toString()),r.search=i.toString(),Object.assign(Object.assign({},n),{url:r})}},e.basicAuth=function(e,t){return je("Authorization","Basic "+De(`${e}:${t}`))},e.bearerAuth=function(e){return je("Authorization",`Bearer ${e}`)},e.csv=function(e){return de.assert(e.length>0,"payload must be a non-empty array"),t=>{const r=new n.Headers(t.headers);return r.set("Content-Type","text/csv"),Object.assign(Object.assign({},t),{headers:r,payload:ke(e)})}},e.del=function(...e){return fe("DELETE",...e)},e.formDataField=function(e,t){return r=>{const i=r.payload instanceof n.FormData?function(e){const t=new n.FormData;for(const[n,r]of e.entries())t.append(n,r);return t}(r.payload):new n.FormData;return Array.isArray(t)?t.forEach((t=>i.append(e,t))):i.append(e,t),Object.assign(Object.assign({},r),{payload:i})}},e.get=function(...e){return fe("GET",...e)},e.head=function(...e){return fe("HEAD",...e)},e.header=je,e.headers=function(e){return t=>{const r=new n.Headers(t.headers);for(const[t,n]of Object.entries(e))r.set(t,n);return Object.assign(Object.assign({},t),{headers:r})}},e.host=function(e){return t=>{const n=new URL(t.url.href);return n.host=e,Object.assign(Object.assign({},t),{url:n})}},e.json=function(e){return t=>{const r=new n.Headers(t.headers);return r.set("Content-Type","application/json"),Object.assign(Object.assign({},t),{headers:r,payload:JSON.stringify(e)})}},e.keepalive=function(e=!0){return t=>Object.assign(Object.assign({},t),{keepalive:e})},e.patch=function(...e){return fe("PATCH",...e)},e.pathname=function(e){return t=>{const n=new URL(t.url.href);return n.pathname=e,Object.assign(Object.assign({},t),{url:n})}},e.port=function(e){return t=>{const n=new URL(t.url.href);return n.port=e.toString(),Object.assign(Object.assign({},t),{url:n})}},e.post=function(...e){return fe("POST",...e)},e.put=function(...e){return fe("PUT",...e)},e.search=function(e){return t=>{const n=new URL(t.url.href);return n.search=e,Object.assign(Object.assign({},t),{url:n})}},e.searchParam=function(e,t){return n=>{const r=new URL(n.url.href),i=new URLSearchParams(r.searchParams);return i.set(e,t.toString()),r.search=i.toString(),Object.assign(Object.assign({},n),{url:r})}},e.searchParams=function(e){return t=>{const n=new URL(t.url.href),r=new URLSearchParams(n.searchParams);for(const[t,n]of Object.entries(e))r.set(t,n.toString());return n.search=r.toString(),Object.assign(Object.assign({},t),{url:n})}},e.signal=function(e){return t=>Object.assign(Object.assign({},t),{signal:e})},e.text=function(e){return t=>{const r=new n.Headers(t.headers);return r.set("Content-Type","application/x-www-form-urlencoded"),Object.assign(Object.assign({},t),{headers:r,payload:e})}},e.url=function(...e){return t=>{const n=new URL(e.reduce(((e,t)=>new URL(t,e).href)));return Object.assign(Object.assign({},t),{url:n})}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
7
|
+
*/!function(e,t){e.exports=function e(){var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{},n=!t.document&&!!t.postMessage,r=n&&/blob:/i.test((t.location||{}).protocol),i={},s=0,o={parse:function(n,r){var a=(r=r||{}).dynamicTyping||!1;if(E(a)&&(r.dynamicTypingFunction=a,a={}),r.dynamicTyping=a,r.transform=!!E(r.transform)&&r.transform,r.worker&&o.WORKERS_SUPPORTED){var u=function(){if(!o.WORKERS_SUPPORTED)return!1;var n,r,a=(n=t.URL||t.webkitURL||null,r=e.toString(),o.BLOB_URL||(o.BLOB_URL=n.createObjectURL(new Blob(["(",r,")();"],{type:"text/javascript"})))),u=new t.Worker(a);return u.onmessage=m,u.id=s++,i[u.id]=u}();return u.userStep=r.step,u.userChunk=r.chunk,u.userComplete=r.complete,u.userError=r.error,r.step=E(r.step),r.chunk=E(r.chunk),r.complete=E(r.complete),r.error=E(r.error),delete r.worker,void u.postMessage({input:n,config:r,workerId:u.id})}var l=null;return o.NODE_STREAM_INPUT,"string"==typeof n?l=r.download?new c(r):new h(r):!0===n.readable&&E(n.read)&&E(n.on)?l=new d(r):(t.File&&n instanceof File||n instanceof Object)&&(l=new f(r)),l.stream(n)},unparse:function(e,t){var n=!1,r=!0,i=",",s="\r\n",a='"',u=a+a,c=!1,f=null,h=!1;!function(){if("object"==typeof t){if("string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(i=t.delimiter),("boolean"==typeof t.quotes||"function"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes),"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(c=t.skipEmptyLines),"string"==typeof t.newline&&(s=t.newline),"string"==typeof t.quoteChar&&(a=t.quoteChar),"boolean"==typeof t.header&&(r=t.header),Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");f=t.columns}void 0!==t.escapeChar&&(u=t.escapeChar+a),"boolean"==typeof t.escapeFormulae&&(h=t.escapeFormulae)}}();var d=new RegExp(p(a),"g");if("string"==typeof e&&(e=JSON.parse(e)),Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return l(null,e,c);if("object"==typeof e[0])return l(f||Object.keys(e[0]),e,c)}else if("object"==typeof e)return"string"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:"object"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),l(e.fields||[],e.data||[],c);throw new Error("Unable to serialize unrecognized input");function l(e,t,n){var o="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var a=Array.isArray(e)&&0<e.length,u=!Array.isArray(t[0]);if(a&&r){for(var c=0;c<e.length;c++)0<c&&(o+=i),o+=g(e[c],c);0<t.length&&(o+=s)}for(var f=0;f<t.length;f++){var h=a?e.length:t[f].length,d=!1,l=a?0===Object.keys(t[f]).length:0===t[f].length;if(n&&!a&&(d="greedy"===n?""===t[f].join("").trim():1===t[f].length&&0===t[f][0].length),"greedy"===n&&a){for(var p=[],m=0;m<h;m++){var y=u?e[m]:m;p.push(t[f][y])}d=""===p.join("").trim()}if(!d){for(var v=0;v<h;v++){0<v&&!l&&(o+=i);var b=a&&u?e[v]:v;o+=g(t[f][b],v)}f<t.length-1&&(!n||0<h&&!l)&&(o+=s)}}return o}function g(e,t){if(null==e)return"";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===h&&"string"==typeof e&&null!==e.match(/^[=+\-@].*$/)&&(e="'"+e);var r=e.toString().replace(d,u);return"boolean"==typeof n&&n||"function"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(-1<e.indexOf(t[n]))return!0;return!1}(r,o.BAD_DELIMITERS)||-1<r.indexOf(i)||" "===r.charAt(0)||" "===r.charAt(r.length-1)?a+r+a:r}}};if(o.RECORD_SEP=String.fromCharCode(30),o.UNIT_SEP=String.fromCharCode(31),o.BYTE_ORDER_MARK="\ufeff",o.BAD_DELIMITERS=["\r","\n",'"',o.BYTE_ORDER_MARK],o.WORKERS_SUPPORTED=!n&&!!t.Worker,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=g,o.ParserHandle=l,o.NetworkStreamer=c,o.FileStreamer=f,o.StringStreamer=h,o.ReadableStreamStreamer=d,t.jQuery){var a=t.jQuery;a.fn.parse=function(e){var n=e.config||{},r=[];return this.each((function(e){if("INPUT"!==a(this).prop("tagName").toUpperCase()||"file"!==a(this).attr("type").toLowerCase()||!t.FileReader||!this.files||0===this.files.length)return!0;for(var i=0;i<this.files.length;i++)r.push({file:this.files[i],inputElem:this,instanceConfig:a.extend({},n)})})),i(),this;function i(){if(0!==r.length){var t,n,i,u,c=r[0];if(E(e.before)){var f=e.before(c.file,c.inputElem);if("object"==typeof f){if("abort"===f.action)return t="AbortError",n=c.file,i=c.inputElem,u=f.reason,void(E(e.error)&&e.error({name:t},n,i,u));if("skip"===f.action)return void s();"object"==typeof f.config&&(c.instanceConfig=a.extend(c.instanceConfig,f.config))}else if("skip"===f)return void s()}var h=c.instanceConfig.complete;c.instanceConfig.complete=function(e){E(h)&&h(e,c.file,c.inputElem),s()},o.parse(c.file,c.instanceConfig)}else E(e.complete)&&e.complete()}function s(){r.splice(0,1),i()}}}function u(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=b(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null),this._handle=new l(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,n){if(this.isFirstChunk&&E(this._config.beforeFirstChunk)){var i=this._config.beforeFirstChunk(e);void 0!==i&&(e=i)}this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e;this._partialLine="";var a=this._handle.parse(s,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var u=a.meta.cursor;this._finished||(this._partialLine=s.substring(u-this._baseIndex),this._baseIndex=u),a&&a.data&&(this._rowCount+=a.data.length);var c=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(r)t.postMessage({results:a,workerId:o.WORKER_ID,finished:c});else if(E(this._config.chunk)&&!n){if(this._config.chunk(a,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);a=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(a.data),this._completeResults.errors=this._completeResults.errors.concat(a.errors),this._completeResults.meta=a.meta),this._completed||!c||!E(this._config.complete)||a&&a.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),c||a&&a.meta.paused||this._nextChunk(),a}this._halted=!0},this._sendError=function(e){E(this._config.error)?this._config.error(e):r&&this._config.error&&t.postMessage({workerId:o.WORKER_ID,error:e,finished:!1})}}function c(e){var t;(e=e||{}).chunkSize||(e.chunkSize=o.RemoteChunkSize),u.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(t=new XMLHttpRequest,this._config.withCredentials&&(t.withCredentials=this._config.withCredentials),n||(t.onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)),t.open(this._config.downloadRequestBody?"POST":"GET",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var r in e)t.setRequestHeader(r,e[r])}if(this._config.chunkSize){var i=this._start+this._config.chunkSize-1;t.setRequestHeader("Range","bytes="+this._start+"-"+i)}try{t.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===t.status&&this._chunkError()}},this._chunkLoaded=function(){4===t.readyState&&(t.status<200||400<=t.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:t.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader("Content-Range");return null===t?-1:parseInt(t.substring(t.lastIndexOf("/")+1))}(t),this.parseChunk(t.responseText)))},this._chunkError=function(e){var n=t.statusText||e;this._sendError(new Error(n))}}function f(e){var t,n;(e=e||{}).chunkSize||(e.chunkSize=o.LocalChunkSize),u.call(this,e);var r="undefined"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,r?((t=new FileReader).onload=_(this._chunkLoaded,this),t.onerror=_(this._chunkError,this)):t=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var i=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,i)}var s=t.readAsText(e,this._config.encoding);r||this._chunkLoaded({target:{result:s}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(t.error)}}function h(e){var t;u.call(this,e=e||{}),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,n=this._config.chunkSize;return n?(e=t.substring(0,n),t=t.substring(n)):(e=t,t=""),this._finished=!t,this.parseChunk(e)}}}function d(e){u.call(this,e=e||{});var t=[],n=!0,r=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):n=!0},this._streamData=_((function(e){try{t.push("string"==typeof e?e:e.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}}),this),this._streamError=_((function(e){this._streamCleanUp(),this._sendError(e)}),this),this._streamEnd=_((function(){this._streamCleanUp(),r=!0,this._streamData("")}),this),this._streamCleanUp=_((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function l(e){var t,n,r,i=Math.pow(2,53),s=-i,a=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,u=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,c=this,f=0,h=0,d=!1,l=!1,m=[],y={data:[],errors:[],meta:{}};if(E(e.step)){var v=e.step;e.step=function(t){if(y=t,w())O();else{if(O(),0===y.data.length)return;f+=t.data.length,e.preview&&f>e.preview?n.abort():(y.data=y.data[0],v(y,c))}}}function _(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function O(){if(y&&r&&(k("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines)for(var t=0;t<y.data.length;t++)_(y.data[t])&&y.data.splice(t--,1);return w()&&function(){if(y)if(Array.isArray(y.data[0])){for(var t=0;w()&&t<y.data.length;t++)y.data[t].forEach(n);y.data.splice(0,1)}else y.data.forEach(n);function n(t,n){E(e.transformHeader)&&(t=e.transformHeader(t,n)),m.push(t)}}(),function(){if(!y||!e.header&&!e.dynamicTyping&&!e.transform)return y;function t(t,n){var r,i=e.header?{}:[];for(r=0;r<t.length;r++){var s=r,o=t[r];e.header&&(s=r>=m.length?"__parsed_extra":m[r]),e.transform&&(o=e.transform(o,s)),o=R(s,o),"__parsed_extra"===s?(i[s]=i[s]||[],i[s].push(o)):i[s]=o}return e.header&&(r>m.length?k("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+r,h+n):r<m.length&&k("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+r,h+n)),i}var n=1;return!y.data.length||Array.isArray(y.data[0])?(y.data=y.data.map(t),n=y.data.length):y.data=t(y.data,0),e.header&&y.meta&&(y.meta.fields=m),h+=n,y}()}function w(){return e.header&&0===m.length}function R(t,n){return r=t,e.dynamicTypingFunction&&void 0===e.dynamicTyping[r]&&(e.dynamicTyping[r]=e.dynamicTypingFunction(r)),!0===(e.dynamicTyping[r]||e.dynamicTyping)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(function(e){if(a.test(e)){var t=parseFloat(e);if(s<t&&t<i)return!0}return!1}(n)?parseFloat(n):u.test(n)?new Date(n):""===n?null:n):n;var r}function k(e,t,n,r){var i={type:e,code:t,message:n};void 0!==r&&(i.row=r),y.errors.push(i)}this.parse=function(i,s,a){var u=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substring(0,1048576);var n=new RegExp(p(t)+"([^]*?)"+p(t),"gm"),r=(e=e.replace(n,"")).split("\r"),i=e.split("\n"),s=1<i.length&&i[0].length<r[0].length;if(1===r.length||s)return"\n";for(var o=0,a=0;a<r.length;a++)"\n"===r[a][0]&&o++;return o>=r.length/2?"\r\n":"\r"}(i,u)),r=!1,e.delimiter)E(e.delimiter)&&(e.delimiter=e.delimiter(i),y.meta.delimiter=e.delimiter);else{var c=function(t,n,r,i,s){var a,u,c,f;s=s||[",","\t","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var h=0;h<s.length;h++){var d=s[h],l=0,p=0,m=0;c=void 0;for(var y=new g({comments:i,delimiter:d,newline:n,preview:10}).parse(t),v=0;v<y.data.length;v++)if(r&&_(y.data[v]))m++;else{var b=y.data[v].length;p+=b,void 0!==c?0<b&&(l+=Math.abs(b-c),c=b):c=b}0<y.data.length&&(p/=y.data.length-m),(void 0===u||l<=u)&&(void 0===f||f<p)&&1.99<p&&(u=l,a=d,f=p)}return{successful:!!(e.delimiter=a),bestDelimiter:a}}(i,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);c.successful?e.delimiter=c.bestDelimiter:(r=!0,e.delimiter=o.DefaultDelimiter),y.meta.delimiter=e.delimiter}var f=b(e);return e.preview&&e.header&&f.preview++,t=i,n=new g(f),y=n.parse(t,s,a),O(),d?{meta:{paused:!0}}:y||{meta:{paused:!1}}},this.paused=function(){return d},this.pause=function(){d=!0,n.abort(),t=E(e.chunk)?"":t.substring(n.getCharIndex())},this.resume=function(){c.streamer._halted?(d=!1,c.streamer.parseChunk(t,!0)):setTimeout(c.resume,3)},this.aborted=function(){return l},this.abort=function(){l=!0,n.abort(),y.meta.aborted=!0,E(e.complete)&&e.complete(y),t=""}}function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(e){var t,n=(e=e||{}).delimiter,r=e.newline,i=e.comments,s=e.step,a=e.preview,u=e.fastMode,c=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof n||-1<o.BAD_DELIMITERS.indexOf(n))&&(n=","),i===n)throw new Error("Comment character same as delimiter");!0===i?i="#":("string"!=typeof i||-1<o.BAD_DELIMITERS.indexOf(i))&&(i=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var f=0,h=!1;this.parse=function(e,o,d){if("string"!=typeof e)throw new Error("Input must be a string");var l=e.length,g=n.length,m=r.length,y=i.length,v=E(s),b=[],_=[],O=[],w=f=0;if(!e)return F();if(u||!1!==u&&-1===e.indexOf(t)){for(var R=e.split(r),k=0;k<R.length;k++){if(O=R[k],f+=O.length,k!==R.length-1)f+=r.length;else if(d)return F();if(!i||O.substring(0,y)!==i){if(v){if(b=[],D(O.split(n)),P(),h)return F()}else D(O.split(n));if(a&&a<=k)return b=b.slice(0,a),F(!0)}}return F()}for(var S=e.indexOf(n,f),C=e.indexOf(r,f),j=new RegExp(p(c)+p(t),"g"),A=e.indexOf(t,f);;)if(e[f]!==t)if(i&&0===O.length&&e.substring(f,f+y)===i){if(-1===C)return F();f=C+m,C=e.indexOf(r,f),S=e.indexOf(n,f)}else if(-1!==S&&(S<C||-1===C))O.push(e.substring(f,S)),f=S+g,S=e.indexOf(n,f);else{if(-1===C)break;if(O.push(e.substring(f,C)),U(C+m),v&&(P(),h))return F();if(a&&b.length>=a)return F(!0)}else for(A=f,f++;;){if(-1===(A=e.indexOf(t,A+1)))return d||_.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:f}),L();if(A===l-1)return L(e.substring(f,A).replace(j,t));if(t!==c||e[A+1]!==c){if(t===c||0===A||e[A-1]!==c){-1!==S&&S<A+1&&(S=e.indexOf(n,A+1)),-1!==C&&C<A+1&&(C=e.indexOf(r,A+1));var x=I(-1===C?S:Math.min(S,C));if(e[A+1+x]===n){O.push(e.substring(f,A).replace(j,t)),e[f=A+1+x+g]!==t&&(A=e.indexOf(t,f)),S=e.indexOf(n,f),C=e.indexOf(r,f);break}var T=I(C);if(e.substring(A+1+T,A+1+T+m)===r){if(O.push(e.substring(f,A).replace(j,t)),U(A+1+T+m),S=e.indexOf(n,f),A=e.indexOf(t,f),v&&(P(),h))return F();if(a&&b.length>=a)return F(!0);break}_.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:f}),A++}}else A++}return L();function D(e){b.push(e),w=f}function I(t){var n=0;if(-1!==t){var r=e.substring(A+1,t);r&&""===r.trim()&&(n=r.length)}return n}function L(t){return d||(void 0===t&&(t=e.substring(f)),O.push(t),f=l,D(O),v&&P()),F()}function U(t){f=t,D(O),O=[],C=e.indexOf(r,f)}function F(e){return{data:b,errors:_,meta:{delimiter:n,linebreak:r,aborted:h,truncated:!!e,cursor:w+(o||0)}}}function P(){s(F()),b=[],_=[]}},this.abort=function(){h=!0},this.getCharIndex=function(){return f}}function m(e){var t=e.data,n=i[t.workerId],r=!1;if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){var s={abort:function(){r=!0,y(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:v,resume:v};if(E(n.userStep)){for(var o=0;o<t.results.data.length&&(n.userStep({data:t.results.data[o],errors:t.results.errors,meta:t.results.meta},s),!r);o++);delete t.results}else E(n.userChunk)&&(n.userChunk(t.results,s,t.file),delete t.results)}t.finished&&!r&&y(t.workerId,t.results)}function y(e,t){var n=i[e];E(n.userComplete)&&n.userComplete(t),n.terminate(),delete i[e]}function v(){throw new Error("Not implemented.")}function b(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=b(e[n]);return t}function _(e,t){return function(){e.apply(t,arguments)}}function E(e){return"function"==typeof e}return r&&(t.onmessage=function(e){var n=e.data;if(void 0===o.WORKER_ID&&n&&(o.WORKER_ID=n.workerId),"string"==typeof n.input)t.postMessage({workerId:o.WORKER_ID,results:o.parse(n.input,n.config),finished:!0});else if(t.File&&n.input instanceof File||n.input instanceof Object){var r=o.parse(n.input,n.config);r&&t.postMessage({workerId:o.WORKER_ID,results:r,finished:!0})}}),(c.prototype=Object.create(u.prototype)).constructor=c,(f.prototype=Object.create(u.prototype)).constructor=f,(h.prototype=Object.create(h.prototype)).constructor=h,(d.prototype=Object.create(u.prototype)).constructor=d,o}()}(fe);var he={},de={CustomError:void 0};class le extends Error{get name(){return this.constructor.name}}de.CustomError=le;var pe={ExpectedError:void 0};const ge=de;class me extends ge.CustomError{}pe.ExpectedError=me;var ye={AssertionError:void 0};const ve=de;class be extends ve.CustomError{}ye.AssertionError=be;var _e={};_e.normalize=void 0,_e.normalize=function(e){var t;return{name:e.name,message:e.message,stack:null!==(t=e.stack)&&void 0!==t?t:null}};var Ee={refute:void 0};const Oe=pe;Ee.refute=function(e,t){if(e)throw new Oe.ExpectedError(t)};var we={assert:void 0};const Re=ye;function ke(e){const t=Object.keys(e[0]);return fe.exports.unparse({data:e,fields:t})}function Se(e,t){return r=>{const i=new n.Headers(r.headers);return i.set(e,t),Object.assign(Object.assign({},r),{headers:i})}}function Ce(e,t){return r=>{const i=new n.Headers(r.headers);return i.append(e,t),Object.assign(Object.assign({},r),{headers:i})}}we.assert=function(e,t){if(!e)throw new Re.AssertionError(t)},function(e){var n=t&&t.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),r=t&&t.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};r(de,e),r(pe,e),r(ye,e),r(_e,e),r(Ee,e),r(we,e)}(he);const je="function"==typeof btoa,Ae="function"==typeof Buffer;"function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder;const xe=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=");(e=>{let t={};e.forEach(((e,n)=>t[e]=n))})(xe),String.fromCharCode.bind(String),"function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);const Te=je?e=>btoa(e):Ae?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,n,r,i,s="";const o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|i,s+=xe[t>>18&63]+xe[t>>12&63]+xe[t>>6&63]+xe[63&t]}return o?s.slice(0,o-3)+"===".substring(o):s};e.accept=function(e){return Ce("Accept",e)},e.appendHeader=Ce,e.appendSearchParam=function(e,t){return n=>{const r=new URL(n.url.href),i=new URLSearchParams(r.searchParams);return i.append(e,t.toString()),r.search=i.toString(),Object.assign(Object.assign({},n),{url:r})}},e.basicAuth=function(e,t){return Se("Authorization","Basic "+Te(`${e}:${t}`))},e.bearerAuth=function(e){return Se("Authorization",`Bearer ${e}`)},e.csv=function(e){return he.assert(e.length>0,"payload must be a non-empty array"),t=>{const r=new n.Headers(t.headers);return r.set("Content-Type","text/csv"),Object.assign(Object.assign({},t),{headers:r,payload:ke(e)})}},e.del=function(...e){return ce("DELETE",...e)},e.formDataField=function(e,t){return r=>{const i=r.payload instanceof n.FormData?function(e){const t=new n.FormData;for(const[n,r]of e.entries())t.append(n,r);return t}(r.payload):new n.FormData;return d.isArray(t)?t.forEach((t=>i.append(e,t))):i.append(e,t),Object.assign(Object.assign({},r),{payload:i})}},e.get=function(...e){return ce("GET",...e)},e.head=function(...e){return ce("HEAD",...e)},e.header=Se,e.headers=function(e){return t=>{const r=new n.Headers(t.headers);for(const[t,n]of Object.entries(e))r.set(t,n);return Object.assign(Object.assign({},t),{headers:r})}},e.host=function(e){return t=>{const n=new URL(t.url.href);return n.host=e,Object.assign(Object.assign({},t),{url:n})}},e.json=function(e){return t=>{const r=new n.Headers(t.headers);return r.set("Content-Type","application/json"),Object.assign(Object.assign({},t),{headers:r,payload:JSON.stringify(e)})}},e.keepalive=function(e=!0){return t=>Object.assign(Object.assign({},t),{keepalive:e})},e.patch=function(...e){return ce("PATCH",...e)},e.pathname=function(e){return t=>{const n=new URL(t.url.href);return n.pathname=e,Object.assign(Object.assign({},t),{url:n})}},e.port=function(e){return t=>{const n=new URL(t.url.href);return n.port=e.toString(),Object.assign(Object.assign({},t),{url:n})}},e.post=function(...e){return ce("POST",...e)},e.put=function(...e){return ce("PUT",...e)},e.search=function(e){return t=>{const n=new URL(t.url.href);return n.search=e,Object.assign(Object.assign({},t),{url:n})}},e.searchParam=function(e,t){return n=>{const r=new URL(n.url.href),i=new URLSearchParams(r.searchParams);return i.set(e,t.toString()),r.search=i.toString(),Object.assign(Object.assign({},n),{url:r})}},e.searchParams=function(e){return t=>{const n=new URL(t.url.href),r=new URLSearchParams(n.searchParams);for(const[t,n]of Object.entries(e))r.set(t,n.toString());return n.search=r.toString(),Object.assign(Object.assign({},t),{url:n})}},e.signal=function(e){return t=>Object.assign(Object.assign({},t),{signal:e})},e.text=function(e){return t=>{const r=new n.Headers(t.headers);return r.set("Content-Type","application/x-www-form-urlencoded"),Object.assign(Object.assign({},t),{headers:r,payload:e})}},e.url=function(...e){return t=>{const n=new URL(e.reduce(((e,t)=>new URL(t,e).href)));return Object.assign(Object.assign({},t),{url:n})}},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
8
8
|
//# sourceMappingURL=index.umd.min.js.map
|