@loaders.gl/csv 3.0.10 → 3.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.es5.min.js
CHANGED
|
@@ -4,5 +4,5 @@ Papa Parse
|
|
|
4
4
|
v5.0.0-beta.0
|
|
5
5
|
https://github.com/mholt/PapaParse
|
|
6
6
|
License: MIT
|
|
7
|
-
*/var i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:{},o={};function a(e){this._handle=null,this._finished=!1,this._completed=!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=f(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null);this._handle=new s(t),this._handle.streamer=this,this._config=t}.call(this,e),this.parseChunk=function(e,t){if(this.isFirstChunk&&h(this._config.beforeFirstChunk)){var n=this._config.beforeFirstChunk(e);void 0!==n&&(e=n)}this.isFirstChunk=!1;var r=this._partialLine+e;this._partialLine="";var i=this._handle.parse(r,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var o=i.meta.cursor;this._finished||(this._partialLine=r.substring(o-this._baseIndex),this._baseIndex=o),i&&i.data&&(this._rowCount+=i.data.length);var a=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(h(this._config.chunk)&&!t){if(this._config.chunk(i,this._handle),this._handle.paused()||this._handle.aborted())return;i=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(i.data),this._completeResults.errors=this._completeResults.errors.concat(i.errors),this._completeResults.meta=i.meta),this._completed||!a||!h(this._config.complete)||i&&i.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||i&&i.meta.paused||this._nextChunk(),i}},this._sendError=function(e){h(this._config.error)&&this._config.error(e)}}function u(e){var t;e=e||{},a.call(this,e),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e=this._config.chunkSize,n=e?t.substr(0,e):t;return t=e?t.substr(e):"",this._finished=!t,this.parseChunk(n)}}}function s(e){var t,n,r,i=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,a=/(\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))/,u=this,s=0,d=0,y=!1,p=!1,m=[],v={data:[],errors:[],meta:{}};if(h(e.step)){var b=e.step;e.step=function(t){if(v=t,O())w();else{if(w(),!v.data||0===v.data.length)return;s+=t.data.length,e.preview&&s>e.preview?n.abort():b(v,u)}}}function g(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function w(){if(v&&r&&(j("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines)for(var t=0;t<v.data.length;t++)g(v.data[t])&&v.data.splice(t--,1);return O()&&function(){if(!v)return;function t(t){h(e.transformHeader)&&(t=e.transformHeader(t)),m.push(t)}if(Array.isArray(v.data[0])){for(var n=0;O()&&n<v.data.length;n++)v.data[n].forEach(t);v.data.splice(0,1)}else v.data.forEach(t)}(),function(){if(!v||!v.data||!e.header&&!e.dynamicTyping&&!e.transform)return v;function t(t,n){var r,i=e.header?{}:[];for(r=0;r<t.length;r++){var o=r,a=t[r];e.header&&(o=r>=m.length?"__parsed_extra":m[r]),e.transform&&(a=e.transform(a,o)),a=T(o,a),"__parsed_extra"===o?(i[o]=i[o]||[],i[o].push(a)):i[o]=a}return e.header&&(r>m.length?j("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+r,d+n):r<m.length&&j("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+r,d+n)),i}var n=1;!v.data[0]||Array.isArray(v.data[0])?(v.data=v.data.map(t),n=v.data.length):v.data=t(v.data,0);e.header&&v.meta&&(v.meta.fields=m);return d+=n,v}()}function O(){return e.header&&0===m.length}function T(t,n){return function(t){return e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping)}(t)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(i.test(n)?parseFloat(n):a.test(n)?new Date(n):""===n?null:n):n}function j(e,t,n,r){v.errors.push({type:e,code:t,message:n,row:r})}this.parse=function(i,a,u){var s=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substr(0,1048576);var n=new RegExp(c(t)+"([^]*?)"+c(t),"gm"),r=(e=e.replace(n,"")).split("\r"),i=e.split("\n"),o=i.length>1&&i[0].length<r[0].length;if(1===r.length||o)return"\n";for(var a=0,u=0;u<r.length;u++)"\n"===r[u][0]&&a++;return a>=r.length/2?"\r\n":"\r"}(i,s)),r=!1,e.delimiter)h(e.delimiter)&&(e.delimiter=e.delimiter(i),v.meta.delimiter=e.delimiter);else{var d=function(t,n,r,i,a){var u,s,c;a=a||[",","\t","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var f=0;f<a.length;f++){var h=a[f],d=0,y=0,p=0;c=void 0;for(var m=new l({comments:i,delimiter:h,newline:n,preview:10}).parse(t),v=0;v<m.data.length;v++)if(r&&g(m.data[v]))p++;else{var b=m.data[v].length;y+=b,void 0!==c?b>1&&(d+=Math.abs(b-c),c=b):c=0}m.data.length>0&&(y/=m.data.length-p),(void 0===s||d>s)&&y>1.99&&(s=d,u=h)}return e.delimiter=u,{successful:!!u,bestDelimiter:u}}(i,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);d.successful?e.delimiter=d.bestDelimiter:(r=!0,e.delimiter=o.DefaultDelimiter),v.meta.delimiter=e.delimiter}var p=f(e);return e.preview&&e.header&&p.preview++,t=i,n=new l(p),v=n.parse(t,a,u),w(),y?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return y},this.pause=function(){y=!0,n.abort(),t=t.substr(n.getCharIndex())},this.resume=function(){y=!1,u.streamer.parseChunk(t,!0)},this.aborted=function(){return p},this.abort=function(){p=!0,n.abort(),v.meta.aborted=!0,h(e.complete)&&e.complete(v),t=""}}function c(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function l(e){var t,n=(e=e||{}).delimiter,r=e.newline,i=e.comments,a=e.step,u=e.preview,s=e.fastMode,l=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(l=e.escapeChar),("string"!=typeof n||o.BAD_DELIMITERS.indexOf(n)>-1)&&(n=","),i===n)throw new Error("Comment character same as delimiter");!0===i?i="#":("string"!=typeof i||o.BAD_DELIMITERS.indexOf(i)>-1)&&(i=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var f=0,d=!1;this.parse=function(e,o,y){if("string"!=typeof e)throw new Error("Input must be a string");var p=e.length,m=n.length,v=r.length,b=i.length,g=h(a);f=0;var w=[],O=[],T=[],j=0;if(!e)return B();if(s||!1!==s&&-1===e.indexOf(t)){for(var S=e.split(r),_=0;_<S.length;_++){if(T=S[_],f+=T.length,_!==S.length-1)f+=r.length;else if(y)return B();if(!i||T.substr(0,b)!==i){if(g){if(w=[],x(T.split(n)),F(),d)return B()}else x(T.split(n));if(u&&_>=u)return w=w.slice(0,u),B(!0)}}return B()}for(var k,P=e.indexOf(n,f),I=e.indexOf(r,f),A=new RegExp(c(l)+c(t),"g");;)if(e[f]!==t)if(i&&0===T.length&&e.substr(f,b)===i){if(-1===I)return B();f=I+v,I=e.indexOf(r,f),P=e.indexOf(n,f)}else if(-1!==P&&(P<I||-1===I))T.push(e.substring(f,P)),f=P+m,P=e.indexOf(n,f);else{if(-1===I)break;if(T.push(e.substring(f,I)),C(I+v),g&&(F(),d))return B();if(u&&w.length>=u)return B(!0)}else{for(k=f,f++;;){if(-1===(k=e.indexOf(t,k+1)))return y||O.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:f}),R();if(k===p-1)return R(e.substring(f,k).replace(A,t));if(t!==l||e[k+1]!==l){if(t===l||0===k||e[k-1]!==l){var M=E(-1===I?P:Math.min(P,I));if(e[k+1+M]===n){if(T.push(e.substring(f,k).replace(A,t)),f=k+1+M+m,P=e.indexOf(n,f),I=e.indexOf(r,f),g&&(F(),d))return B();if(u&&w.length>=u)return B(!0);break}var D=E(I);if(e.substr(k+1+D,v)===r){if(T.push(e.substring(f,k).replace(A,t)),C(k+1+D+v),P=e.indexOf(n,f),g&&(F(),d))return B();if(u&&w.length>=u)return B(!0);break}O.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:f}),k++}}else k++}if(g&&(F(),d))return B();if(u&&w.length>=u)return B(!0)}return R();function x(e){w.push(e),j=f}function E(t){var n=0;if(-1!==t){var r=e.substring(k+1,t);r&&""===r.trim()&&(n=r.length)}return n}function R(t){return y||(void 0===t&&(t=e.substr(f)),T.push(t),f=p,x(T),g&&F()),B()}function C(t){f=t,x(T),T=[],I=e.indexOf(r,f)}function B(e,t){return{data:t||!1?w[0]:w,errors:O,meta:{delimiter:n,linebreak:r,aborted:d,truncated:!!e,cursor:j+(o||0)}}}function F(){a(B(void 0,!0)),w=[],O=[]}},this.abort=function(){d=!0},this.getCharIndex=function(){return f}}function f(e){if("object"!==r(e)||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=f(e[n]);return t}function h(e){return"function"==typeof e}e.exports=o,o.parse=function(e,t,n){var r=(t=t||{}).dynamicTyping||!1;h(r)&&(t.dynamicTypingFunction=r,r={});if(t.dynamicTyping=r,t.transform=!!h(t.transform)&&t.transform,t.worker&&o.WORKERS_SUPPORTED){var i=newWorker();return i.userStep=t.step,i.userChunk=t.chunk,i.userComplete=t.complete,i.userError=t.error,t.step=h(t.step),t.chunk=h(t.chunk),t.complete=h(t.complete),t.error=h(t.error),delete t.worker,void i.postMessage({input:e,config:t,workerId:i.id})}var a=null;"string"==typeof e&&(a=new u(t));a||(a=new n(t));return a.stream(e)},o.unparse=function(e,t){var n=!1,i=!0,a=",",u="\r\n",s='"',l=s+s,f=!1,h=null;!function(){if("object"!==r(t))return;"string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(a=t.delimiter);("boolean"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes);"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(f=t.skipEmptyLines);"string"==typeof t.newline&&(u=t.newline);"string"==typeof t.quoteChar&&(s=t.quoteChar);"boolean"==typeof t.header&&(i=t.header);if(Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");h=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+s)}();var d=new RegExp(c(s),"g");"string"==typeof e&&(e=JSON.parse(e));if(Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return p(null,e,f);if("object"===r(e[0]))return p(h||y(e[0]),e,f)}else if("object"===r(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:y(e.data[0])),Array.isArray(e.data[0])||"object"===r(e.data[0])||(e.data=[e.data])),p(e.fields||[],e.data||[],f);throw new Error("Unable to serialize unrecognized input");function y(e){if("object"!==r(e))return[];var t=[];for(var n in e)t.push(n);return t}function p(e,t,n){var r="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var o=Array.isArray(e)&&e.length>0,s=!Array.isArray(t[0]);if(o&&i){for(var c=0;c<e.length;c++)c>0&&(r+=a),r+=m(e[c],c);t.length>0&&(r+=u)}for(var l=0;l<t.length;l++){var f=o?e.length:t[l].length,h=!1,d=o?0===Object.keys(t[l]).length:0===t[l].length;if(n&&!o&&(h="greedy"===n?""===t[l].join("").trim():1===t[l].length&&0===t[l][0].length),"greedy"===n&&o){for(var y=[],p=0;p<f;p++){var v=s?e[p]:p;y.push(t[l][v])}h=""===y.join("").trim()}if(!h){for(var b=0;b<f;b++){b>0&&!d&&(r+=a);var g=o&&s?e[b]:b;r+=m(t[l][g],b)}l<t.length-1&&(!n||f>0&&!d)&&(r+=u)}}return r}function m(e,t){return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(e=e.toString().replace(d,l),"boolean"==typeof n&&n||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return!0;return!1}(e,o.BAD_DELIMITERS)||e.indexOf(a)>-1||" "===e.charAt(0)||" "===e.charAt(e.length-1)?s+e+s:e)}},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=!1,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=l,o.ParserHandle=s,o.ChunkStreamer=a,o.StringStreamer=u,u.prototype=Object.create(u.prototype),u.prototype.constructor=u},function(e,t,n){"use strict";(function(t){var r=n(7),i="undefined"==typeof window?t:window;i.loaders=i.loaders||{},e.exports=Object.assign(i.loaders,r)}).call(this,n(6))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"CSVLoader",{enumerable:!0,get:function(){return r.CSVLoader}});var r=n(8)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._typecheckCSVLoader=t.CSVLoader=void 0;var r=n(9),i=a(n(4)),o=a(n(22));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){f(o,r,i,a,u,"next",e)}function u(e){f(o,r,i,a,u,"throw",e)}a(void 0)}))}}var d,y={csv:{shape:"object-row-table",optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[",","\t","|",";"]}},p={id:"csv",module:"csv",name:"CSV",version:"3.0.10",extensions:["csv"],mimeTypes:["text/csv"],category:"table",parse:(d=h(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",m((new TextDecoder).decode(t),n));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)}),parseText:function(e,t){return m(e,t)},parseInBatches:function(e,t){var n;"auto"===(t=c({},t)).batchSize&&(t.batchSize=4e3);var a=c(c({},y.csv),null===(n=t)||void 0===n?void 0:n.csv),s=new r.AsyncQueue,l=!0,f=null,h=null,d=null,p=c(c({},a),{},{header:!1,download:!1,chunkSize:5242880,skipEmptyLines:!1,step:function(e){var n=e.data;if(a.skipEmptyLines&&""===n.flat().join("").trim())return;var i=e.meta.cursor;if(l&&!f&&("auto"===a.header?b(n):Boolean(a.header)))return void(f=n.map(w()));l&&(l=!1,f||(f=O(a.columnPrefix,n.length)),d=function(e,t){for(var n=t?{}:[],r=0;r<e.length;r++){var i=t&&t[r]||r;switch(u(e[r])){case"number":case"boolean":n[i]={name:String(i),index:r,type:Float32Array};break;case"string":default:n[i]={name:String(i),index:r,type:Array}}}return n}(n,f)),a.optimizeMemoryUsage&&(n=JSON.parse(JSON.stringify(n))),h=h||new r.TableBatchBuilder(d,c({shape:a.shape||"array-row-table"},t));try{h.addRow(n);var o=h&&h.getFullBatch({bytesUsed:i});o&&s.enqueue(o)}catch(e){s.enqueue(e)}},complete:function(e){try{var t=e.meta.cursor,n=h&&h.getFinalBatch({bytesUsed:t});n&&s.enqueue(n)}catch(e){s.enqueue(e)}s.close()}});return i.default.parse(e,p,o.default),s},options:y};function m(e,t){return v.apply(this,arguments)}function v(){return(v=h(regeneratorRuntime.mark((function e(t,n){var o,a,u,s,l,f,h,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=c(c({},y.csv),null==n?void 0:n.csv),a=g(t),u="auto"===o.header?b(a):Boolean(o.header),s=u,l=c(c({},o),{},{header:s,download:!1,transformHeader:s?w():void 0,error:function(e){throw new Error(e)}}),f=i.default.parse(t,l),h=f.data,d=f.meta.fields||O(o.columnPrefix,a.length),e.t0=o.shape,e.next="object-row-table"===e.t0?11:"array-row-table"===e.t0?13:15;break;case 11:return h=h.map((function(e){return Array.isArray(e)?(0,r.convertToObjectRow)(e,d):e})),e.abrupt("break",15);case 13:return h=h.map((function(e){return Array.isArray(e)?e:(0,r.convertToArrayRow)(e,d)})),e.abrupt("break",15);case 15:return e.abrupt("return",h);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(e){return e&&e.every((function(e){return"string"==typeof e}))}function g(e){return i.default.parse(e,{download:!1,dynamicTyping:!0,preview:1}).data[0]}function w(){var e=new Set;return function(t){for(var n=t,r=1;e.has(n);)n="".concat(t,".").concat(r),r++;return e.add(n),n}}function O(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=0;r<t;r++)n.push("".concat(e).concat(r+1));return n}t.CSVLoader=p;var T=p;t._typecheckCSVLoader=T},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"TableBatchBuilder",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"RowTableBatchAggregator",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"ColumnarTableBatchAggregator",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"convertToObjectRow",{enumerable:!0,get:function(){return a.convertToObjectRow}}),Object.defineProperty(t,"convertToArrayRow",{enumerable:!0,get:function(){return a.convertToArrayRow}}),Object.defineProperty(t,"getMeshSize",{enumerable:!0,get:function(){return u.getMeshSize}}),Object.defineProperty(t,"getMeshBoundingBox",{enumerable:!0,get:function(){return u.getMeshBoundingBox}}),Object.defineProperty(t,"Schema",{enumerable:!0,get:function(){return s.Schema}}),Object.defineProperty(t,"Field",{enumerable:!0,get:function(){return s.Field}}),Object.defineProperty(t,"DataType",{enumerable:!0,get:function(){return s.DataType}}),Object.defineProperty(t,"Null",{enumerable:!0,get:function(){return s.Null}}),Object.defineProperty(t,"Binary",{enumerable:!0,get:function(){return s.Binary}}),Object.defineProperty(t,"Bool",{enumerable:!0,get:function(){return s.Bool}}),Object.defineProperty(t,"Int",{enumerable:!0,get:function(){return s.Int}}),Object.defineProperty(t,"Int8",{enumerable:!0,get:function(){return s.Int8}}),Object.defineProperty(t,"Int16",{enumerable:!0,get:function(){return s.Int16}}),Object.defineProperty(t,"Int32",{enumerable:!0,get:function(){return s.Int32}}),Object.defineProperty(t,"Int64",{enumerable:!0,get:function(){return s.Int64}}),Object.defineProperty(t,"Uint8",{enumerable:!0,get:function(){return s.Uint8}}),Object.defineProperty(t,"Uint16",{enumerable:!0,get:function(){return s.Uint16}}),Object.defineProperty(t,"Uint32",{enumerable:!0,get:function(){return s.Uint32}}),Object.defineProperty(t,"Uint64",{enumerable:!0,get:function(){return s.Uint64}}),Object.defineProperty(t,"Float",{enumerable:!0,get:function(){return s.Float}}),Object.defineProperty(t,"Float16",{enumerable:!0,get:function(){return s.Float16}}),Object.defineProperty(t,"Float32",{enumerable:!0,get:function(){return s.Float32}}),Object.defineProperty(t,"Float64",{enumerable:!0,get:function(){return s.Float64}}),Object.defineProperty(t,"Utf8",{enumerable:!0,get:function(){return s.Utf8}}),Object.defineProperty(t,"Date",{enumerable:!0,get:function(){return s.Date}}),Object.defineProperty(t,"DateDay",{enumerable:!0,get:function(){return s.DateDay}}),Object.defineProperty(t,"DateMillisecond",{enumerable:!0,get:function(){return s.DateMillisecond}}),Object.defineProperty(t,"Time",{enumerable:!0,get:function(){return s.Time}}),Object.defineProperty(t,"TimeMillisecond",{enumerable:!0,get:function(){return s.TimeMillisecond}}),Object.defineProperty(t,"TimeSecond",{enumerable:!0,get:function(){return s.TimeSecond}}),Object.defineProperty(t,"Timestamp",{enumerable:!0,get:function(){return s.Timestamp}}),Object.defineProperty(t,"TimestampSecond",{enumerable:!0,get:function(){return s.TimestampSecond}}),Object.defineProperty(t,"TimestampMillisecond",{enumerable:!0,get:function(){return s.TimestampMillisecond}}),Object.defineProperty(t,"TimestampMicrosecond",{enumerable:!0,get:function(){return s.TimestampMicrosecond}}),Object.defineProperty(t,"TimestampNanosecond",{enumerable:!0,get:function(){return s.TimestampNanosecond}}),Object.defineProperty(t,"Interval",{enumerable:!0,get:function(){return s.Interval}}),Object.defineProperty(t,"IntervalDayTime",{enumerable:!0,get:function(){return s.IntervalDayTime}}),Object.defineProperty(t,"IntervalYearMonth",{enumerable:!0,get:function(){return s.IntervalYearMonth}}),Object.defineProperty(t,"FixedSizeList",{enumerable:!0,get:function(){return s.FixedSizeList}}),Object.defineProperty(t,"deduceTableSchema",{enumerable:!0,get:function(){return c.deduceTableSchema}}),Object.defineProperty(t,"getTypeInfo",{enumerable:!0,get:function(){return l.getTypeInfo}}),Object.defineProperty(t,"getArrowTypeFromTypedArray",{enumerable:!0,get:function(){return f.getArrowTypeFromTypedArray}}),Object.defineProperty(t,"AsyncQueue",{enumerable:!0,get:function(){return h.default}});var r=d(n(10)),i=d(n(1)),o=d(n(3)),a=n(2),u=n(12),s=n(0),c=n(18),l=n(19),f=n(20),h=d(n(21));function d(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(11)),i=a(n(1)),o=a(n(3));function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var f={shape:"array-row-table",batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},h=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l(this,"schema",void 0),l(this,"options",void 0),l(this,"aggregator",null),l(this,"batchCount",0),l(this,"bytesUsed",0),l(this,"isChunkComplete",!1),l(this,"lastBatchEmittedMs",Date.now()),l(this,"totalLength",0),l(this,"totalBytes",0),l(this,"rowBytes",0),this.schema=t,this.options=s(s({},f),n)}var t,n,a;return t=e,(n=[{key:"limitReached",value:function(){var e,t;return!!(Boolean(null===(e=this.options)||void 0===e?void 0:e.limit)&&this.totalLength>=this.options.limit)||!!(Boolean(null===(t=this.options)||void 0===t?void 0:t._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}},{key:"addRow",value:function(e){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(e),this.totalBytes+=this.rowBytes,Array.isArray(e)?this.addArrayRow(e):this.addObjectRow(e))}},{key:"addArrayRow",value:function(e){if(!this.aggregator){var t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addArrayRow(e)}},{key:"addObjectRow",value:function(e){if(!this.aggregator){var t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addObjectRow(e)}},{key:"chunkComplete",value:function(e){e instanceof ArrayBuffer&&(this.bytesUsed+=e.byteLength),"string"==typeof e&&(this.bytesUsed+=e.length),this.isChunkComplete=!0}},{key:"getFullBatch",value:function(e){return this._isFull()?this._getBatch(e):null}},{key:"getFinalBatch",value:function(e){return this._getBatch(e)}},{key:"_estimateRowMB",value:function(e){return Array.isArray(e)?8*e.length:8*Object.keys(e).length}},{key:"_isFull",value:function(){if(!this.aggregator||0===this.aggregator.rowCount())return!1;if("auto"===this.options.batchSize){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return!(this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs||(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),0))}},{key:"_getBatch",value:function(e){if(!this.aggregator)return null;null!=e&&e.bytesUsed&&(this.bytesUsed=e.bytesUsed);var t=this.aggregator.getBatch();return t.count=this.batchCount,t.bytesUsed=this.bytesUsed,Object.assign(t,e),this.batchCount++,this.aggregator=null,t}},{key:"_getTableBatchType",value:function(){switch(this.options.shape){case"row-table":return r.default;case"array-row-table":case"object-row-table":return i.default;case"columnar-table":return o.default;case"arrow-table":if(!e.ArrowBatch)throw new Error("TableBatchBuilder");return e.ArrowBatch;default:throw new Error("TableBatchBuilder")}}}])&&c(t.prototype,n),a&&c(t,a),e}();t.default=h,l(h,"ArrowBatch",void 0)},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(){function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"schema",void 0),i(this,"options",void 0),i(this,"length",0),i(this,"rows",null),i(this,"cursor",0),i(this,"_headers",[]),this.options=n,this.schema=t,!Array.isArray(t))for(var r in this._headers=[],t)this._headers[t[r].index]=t[r].name}var t,n,o;return t=e,(n=[{key:"rowCount",value:function(){return this.length}},{key:"addArrayRow",value:function(e,t){Number.isFinite(t)&&(this.cursor=t),this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}},{key:"addObjectRow",value:function(e,t){Number.isFinite(t)&&(this.cursor=t),this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}},{key:"getBatch",value:function(){var e=this.rows;return e?(e=e.slice(0,this.length),this.rows=null,{shape:this.options.shape,batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}}])&&r(t.prototype,n),o&&r(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMeshSize=function(e){var t=0;for(var n in e){var r=e[n];ArrayBuffer.isView(r)&&(t+=r.byteLength*r.BYTES_PER_ELEMENT)}return t},t.getMeshBoundingBox=function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,u=e.POSITION?e.POSITION.value:[],s=u&&u.length,c=0;c<s;c+=3){var l=u[c],f=u[c+1],h=u[c+2];t=l<t?l:t,n=f<n?f:n,r=h<r?h:r,i=l>i?l:i,o=f>o?f:o,a=h>a?h:a}return[[t,n,r],[i,o,a]]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(14);function i(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=a(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){s=!0,o=e},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw o}}}}function a(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"fields",void 0),c(this,"metadata",void 0),(0,r.assert)(Array.isArray(t)),function(e){var t,n={},r=o(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;n[i.name]&&console.warn("Schema: duplicated field name",i.name,i),n[i.name]=!0}}catch(e){r.e(e)}finally{r.f()}}(t),this.fields=t,this.metadata=n||new Map}var t,n,i;return t=e,(n=[{key:"compareTo",value:function(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(var t=0;t<this.fields.length;++t)if(!this.fields[t].compareTo(e.fields[t]))return!1;return!0}},{key:"select",value:function(){for(var t=Object.create(null),n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var o=0,a=r;o<a.length;o++){var u=a[o];t[u]=!0}var s=this.fields.filter((function(e){return t[e.name]}));return new e(s,this.metadata)}},{key:"selectAt",value:function(){for(var t=this,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=r.map((function(e){return t.fields[e]})).filter(Boolean);return new e(o,this.metadata)}},{key:"assign",value:function(t){var n,r=this.metadata;if(t instanceof e){var i=t;n=i.fields,r=f(f(new Map,this.metadata),i.metadata)}else n=t;var a,u=Object.create(null),s=o(this.fields);try{for(s.s();!(a=s.n()).done;){var c=a.value;u[c.name]=c}}catch(e){s.e(e)}finally{s.f()}var l,h=o(n);try{for(h.s();!(l=h.n()).done;){var d=l.value;u[d.name]=d}}catch(e){h.e(e)}finally{h.f()}return new e(Object.values(u),r)}}])&&s(t.prototype,n),i&&s(t,i),e}();function f(e,t){return new Map([].concat(i(e||new Map),i(t||new Map)))}t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Map;r(this,e),o(this,"name",void 0),o(this,"type",void 0),o(this,"nullable",void 0),o(this,"metadata",void 0),this.name=t,this.type=n,this.nullable=i,this.metadata=a}var t,n,a;return t=e,(n=[{key:"typeId",get:function(){return this.type&&this.type.typeId}},{key:"clone",value:function(){return new e(this.name,this.type,this.nullable,this.metadata)}},{key:"compareTo",value:function(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}},{key:"toString",value:function(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}])&&i(t.prototype,n),a&&i(t,a),e}();t.default=a},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Type",{enumerable:!0,get:function(){return f.Type}}),t.FixedSizeList=t.IntervalYearMonth=t.IntervalDayTime=t.Interval=t.TimestampNanosecond=t.TimestampMicrosecond=t.TimestampMillisecond=t.TimestampSecond=t.Timestamp=t.TimeMillisecond=t.TimeSecond=t.Time=t.DateMillisecond=t.DateDay=t.Date=t.Utf8=t.Binary=t.Float64=t.Float32=t.Float16=t.Float=t.Uint64=t.Uint32=t.Uint16=t.Uint8=t.Int64=t.Int32=t.Int16=t.Int8=t.Int=t.Bool=t.Null=t.DataType=void 0;var i,o,a,u,s,c,l,f=n(17);function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var i=b(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return m(this,n)}}function m(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?v(e):t}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function O(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),e}var T=function(){function e(){g(this,e)}return O(e,[{key:"typeId",get:function(){return f.Type.NONE}},{key:"compareTo",value:function(e){return this===e}}],[{key:"isNull",value:function(e){return e&&e.typeId===f.Type.Null}},{key:"isInt",value:function(e){return e&&e.typeId===f.Type.Int}},{key:"isFloat",value:function(e){return e&&e.typeId===f.Type.Float}},{key:"isBinary",value:function(e){return e&&e.typeId===f.Type.Binary}},{key:"isUtf8",value:function(e){return e&&e.typeId===f.Type.Utf8}},{key:"isBool",value:function(e){return e&&e.typeId===f.Type.Bool}},{key:"isDecimal",value:function(e){return e&&e.typeId===f.Type.Decimal}},{key:"isDate",value:function(e){return e&&e.typeId===f.Type.Date}},{key:"isTime",value:function(e){return e&&e.typeId===f.Type.Time}},{key:"isTimestamp",value:function(e){return e&&e.typeId===f.Type.Timestamp}},{key:"isInterval",value:function(e){return e&&e.typeId===f.Type.Interval}},{key:"isList",value:function(e){return e&&e.typeId===f.Type.List}},{key:"isStruct",value:function(e){return e&&e.typeId===f.Type.Struct}},{key:"isUnion",value:function(e){return e&&e.typeId===f.Type.Union}},{key:"isFixedSizeBinary",value:function(e){return e&&e.typeId===f.Type.FixedSizeBinary}},{key:"isFixedSizeList",value:function(e){return e&&e.typeId===f.Type.FixedSizeList}},{key:"isMap",value:function(e){return e&&e.typeId===f.Type.Map}},{key:"isDictionary",value:function(e){return e&&e.typeId===f.Type.Dictionary}}]),e}();t.DataType=T;var j=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.apply(this,arguments)}return O(n,[{key:"typeId",get:function(){return f.Type.Null}},{key:Symbol.toStringTag,get:function(){return"Null"}},{key:"toString",value:function(){return"Null"}}]),n}(T);t.Null=j;var S=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.apply(this,arguments)}return O(n,[{key:"typeId",get:function(){return f.Type.Bool}},{key:Symbol.toStringTag,get:function(){return"Bool"}},{key:"toString",value:function(){return"Bool"}}]),n}(T);t.Bool=S,i=Symbol.toStringTag;var _=function(e){d(n,e);var t=p(n);function n(e,r){var i;return g(this,n),h(v(i=t.call(this)),"isSigned",void 0),h(v(i),"bitWidth",void 0),i.isSigned=e,i.bitWidth=r,i}return O(n,[{key:"typeId",get:function(){return f.Type.Int}},{key:i,get:function(){return"Int"}},{key:"toString",value:function(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}]),n}(T);t.Int=_;var k=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!0,8)}return n}(_);t.Int8=k;var P=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!0,16)}return n}(_);t.Int16=P;var I=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!0,32)}return n}(_);t.Int32=I;var A=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!0,64)}return n}(_);t.Int64=A;var M=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!1,8)}return n}(_);t.Uint8=M;var D=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!1,16)}return n}(_);t.Uint16=D;var x=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!1,32)}return n}(_);t.Uint32=x;var E=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!1,64)}return n}(_);t.Uint64=E;var R=16,C=32,B=64;o=Symbol.toStringTag;var F=function(e){d(n,e);var t=p(n);function n(e){var r;return g(this,n),h(v(r=t.call(this)),"precision",void 0),r.precision=e,r}return O(n,[{key:"typeId",get:function(){return f.Type.Float}},{key:o,get:function(){return"Float"}},{key:"toString",value:function(){return"Float".concat(this.precision)}}]),n}(T);t.Float=F;var U=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,R)}return n}(F);t.Float16=U;var N=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,C)}return n}(F);t.Float32=N;var L=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,B)}return n}(F);t.Float64=L;var z=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this)}return O(n,[{key:"typeId",get:function(){return f.Type.Binary}},{key:"toString",value:function(){return"Binary"}},{key:Symbol.toStringTag,get:function(){return"Binary"}}]),n}(T);t.Binary=z;var q=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.apply(this,arguments)}return O(n,[{key:"typeId",get:function(){return f.Type.Utf8}},{key:Symbol.toStringTag,get:function(){return"Utf8"}},{key:"toString",value:function(){return"Utf8"}}]),n}(T);t.Utf8=q;var Y={DAY:0,MILLISECOND:1};a=Symbol.toStringTag;var V=function(e){d(n,e);var t=p(n);function n(e){var r;return g(this,n),h(v(r=t.call(this)),"unit",void 0),r.unit=e,r}return O(n,[{key:"typeId",get:function(){return f.Type.Date}},{key:a,get:function(){return"Date"}},{key:"toString",value:function(){return"Date".concat(32*(this.unit+1),"<").concat(Y[this.unit],">")}}]),n}(T);t.Date=V;var W=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,Y.DAY)}return n}(V);t.DateDay=W;var J=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,Y.MILLISECOND)}return n}(V);t.DateMillisecond=J;var Q={SECOND:1,MILLISECOND:1e3,MICROSECOND:1e6,NANOSECOND:1e9};u=Symbol.toStringTag;var H=function(e){d(n,e);var t=p(n);function n(e,r){var i;return g(this,n),h(v(i=t.call(this)),"unit",void 0),h(v(i),"bitWidth",void 0),i.unit=e,i.bitWidth=r,i}return O(n,[{key:"typeId",get:function(){return f.Type.Time}},{key:"toString",value:function(){return"Time".concat(this.bitWidth,"<").concat(Q[this.unit],">")}},{key:u,get:function(){return"Time"}}]),n}(T);t.Time=H;var $=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,Q.SECOND,32)}return n}(H);t.TimeSecond=$;var K=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,Q.MILLISECOND,32)}return n}(H);t.TimeMillisecond=K,s=Symbol.toStringTag;var Z=function(e){d(n,e);var t=p(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return g(this,n),h(v(r=t.call(this)),"unit",void 0),h(v(r),"timezone",void 0),r.unit=e,r.timezone=i,r}return O(n,[{key:"typeId",get:function(){return f.Type.Timestamp}},{key:s,get:function(){return"Timestamp"}},{key:"toString",value:function(){return"Timestamp<".concat(Q[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}}]),n}(T);t.Timestamp=Z;var G=function(e){d(n,e);var t=p(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return g(this,n),t.call(this,Q.SECOND,e)}return n}(Z);t.TimestampSecond=G;var X=function(e){d(n,e);var t=p(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return g(this,n),t.call(this,Q.MILLISECOND,e)}return n}(Z);t.TimestampMillisecond=X;var ee=function(e){d(n,e);var t=p(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return g(this,n),t.call(this,Q.MICROSECOND,e)}return n}(Z);t.TimestampMicrosecond=ee;var te=function(e){d(n,e);var t=p(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return g(this,n),t.call(this,Q.NANOSECOND,e)}return n}(Z);t.TimestampNanosecond=te;var ne={DAY_TIME:0,YEAR_MONTH:1};c=Symbol.toStringTag;var re=function(e){d(n,e);var t=p(n);function n(e){var r;return g(this,n),h(v(r=t.call(this)),"unit",void 0),r.unit=e,r}return O(n,[{key:"typeId",get:function(){return f.Type.Interval}},{key:c,get:function(){return"Interval"}},{key:"toString",value:function(){return"Interval<".concat(ne[this.unit],">")}}]),n}(T);t.Interval=re;var ie=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,ne.DAY_TIME)}return n}(re);t.IntervalDayTime=ie;var oe=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,ne.YEAR_MONTH)}return n}(re);t.IntervalYearMonth=oe,l=Symbol.toStringTag;var ae=function(e){d(n,e);var t=p(n);function n(e,r){var i;return g(this,n),h(v(i=t.call(this)),"listSize",void 0),h(v(i),"children",void 0),i.listSize=e,i.children=[r],i}return O(n,[{key:"typeId",get:function(){return f.Type.FixedSizeList}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:l,get:function(){return"FixedSizeList"}},{key:"toString",value:function(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}]),n}(T);t.FixedSizeList=ae},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.Type=void 0,t.Type=r,function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(r||(t.Type=r={}))},function(e,t,n){"use strict";function r(e){return e instanceof Date?Date:e instanceof Number?Float32Array:"string"==typeof e?String:null}Object.defineProperty(t,"__esModule",{value:!0}),t.deduceTableSchema=function(e,t){var n=Array.isArray(e)?function(e){var t={};if(e.length){var n=e[0];for(var i in n){var o=n[i];t[i]=r(o)}}return t}(e):function(e){var t={};for(var n in e){var i=e[n];if(ArrayBuffer.isView(i))t[n]=i.constructor;else if(i.length){var o=i[0];t[n]=r(o)}t[n]=t[n]||null}return t}(e);return Object.assign(n,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTypeInfo=function(e){return{typeId:e.typeId,ArrayType:e.ArrayType,typeName:e.toString(),typeEnumName:o(e.typeId),precision:e.precision}};var r=n(0);var i=null;function o(e){if(!i)for(var t in i={},r.Type)i[r.Type[t]]=t;return i[e]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getArrowTypeFromTypedArray=function(e){switch(e.constructor){case Int8Array:return new r.Int8;case Uint8Array:return new r.Uint8;case Int16Array:return new r.Int16;case Uint16Array:return new r.Uint16;case Int32Array:return new r.Int32;case Uint32Array:return new r.Uint32;case Float32Array:return new r.Float32;case Float64Array:return new r.Float64;default:throw new Error("array type not supported")}};var r=n(0)},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i;function o(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function u(e){o(a,r,i,u,s,"next",e)}function s(e){o(a,r,i,u,s,"throw",e)}u(void 0)}))}}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),e}function f(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){var t="function"==typeof Map?new Map:void 0;return(h=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return d(e,arguments,m(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,e)})(e)}function d(e,t,n){return(d=y()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&p(i,n.prototype),i}).apply(null,arguments)}function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.takeAsync=function(e){return g.apply(this,arguments)},t.default=void 0;var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(i,e);var t,n,r=(t=i,n=y(),function(){var e,r=m(t);if(n){var i=m(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return f(this,e)});function i(){return s(this,i),r.apply(this,arguments)}return l(i,[{key:"enqueue",value:function(e){return this.push(e)}},{key:"dequeue",value:function(){return this.shift()}}]),i}(h(Array));i=Symbol.asyncIterator;var b=function(){function e(){s(this,e),u(this,"_values",void 0),u(this,"_settlers",void 0),u(this,"_closed",void 0),this._values=new v,this._settlers=new v,this._closed=!1}return l(e,[{key:"close",value:function(){for(;this._settlers.length>0;)this._settlers.dequeue().resolve({done:!0});this._closed=!0}},{key:i,value:function(){return this}},{key:"enqueue",value:function(e){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");var t=this._settlers.dequeue();e instanceof Error?t.reject(e):t.resolve({value:e})}else this._values.enqueue(e)}},{key:"next",value:function(){var e=this;if(this._values.length>0){var t=this._values.dequeue();return t instanceof Error?Promise.reject(t):Promise.resolve({value:t})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0})}return new Promise((function(t,n){e._settlers.enqueue({resolve:t,reject:n})}))}}]),e}();function g(){return(g=a(regeneratorRuntime.mark((function e(t){var n,r,i,o,a,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=u.length>1&&void 0!==u[1]?u[1]:1/0,r=[],i=t[Symbol.asyncIterator]();case 3:if(!(r.length<n)){e.next=14;break}return e.next=6,i.next();case 6:if(o=e.sent,a=o.value,!o.done){e.next=11;break}return e.abrupt("break",14);case 11:r.push(a),e.next=3;break;case 14:return e.abrupt("return",r);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}t.default=b},function(e,t,n){"use strict";var r;function i(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function o(e){var t;if("undefined"!=typeof Symbol&&(Symbol.asyncIterator&&(t=e[Symbol.asyncIterator]),null==t&&Symbol.iterator&&(t=e[Symbol.iterator])),null==t&&(t=e["@@asyncIterator"]),null==t&&(t=e["@@iterator"]),null==t)throw new TypeError("Object is not async iterable");return t.call(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var a=((r=n(4))&&r.__esModule?r:{default:r}).default.ChunkStreamer;function u(e){e=e||{},a.call(this,e),this.textDecoder=new TextDecoder(this._config.encoding),this.stream=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,r,i,a,u,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._input=t,e.prev=1,n=!0,r=!1,e.prev=4,a=o(t);case 6:return e.next=8,a.next();case 8:return u=e.sent,n=u.done,e.next=12,u.value;case 12:if(s=e.sent,n){e.next=19;break}c=s,this.parseChunk(this.getStringChunk(c));case 16:n=!0,e.next=6;break;case 19:e.next=25;break;case 21:e.prev=21,e.t0=e.catch(4),r=!0,i=e.t0;case 25:if(e.prev=25,e.prev=26,n||null==a.return){e.next=30;break}return e.next=30,a.return();case 30:if(e.prev=30,!r){e.next=33;break}throw i;case 33:return e.finish(30);case 34:return e.finish(25);case 35:this._finished=!0,this.parseChunk(""),e.next=42;break;case 39:e.prev=39,e.t1=e.catch(1),this._sendError(e.t1);case 42:case"end":return e.stop()}}),e,this,[[1,39],[4,21,25,35],[26,,30,34]])})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,s,"next",e)}function s(e){i(a,r,o,u,s,"throw",e)}u(void 0)}))});return function(e){return t.apply(this,arguments)}}(),this._nextChunk=function(){},this.getStringChunk=function(e){return"string"==typeof e?e:this.textDecoder.decode(e,{stream:!0})}}u.prototype=Object.create(a.prototype),u.prototype.constructor=u}]);
|
|
7
|
+
*/var i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:{},o={};function a(e){this._handle=null,this._finished=!1,this._completed=!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=f(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null);this._handle=new s(t),this._handle.streamer=this,this._config=t}.call(this,e),this.parseChunk=function(e,t){if(this.isFirstChunk&&h(this._config.beforeFirstChunk)){var n=this._config.beforeFirstChunk(e);void 0!==n&&(e=n)}this.isFirstChunk=!1;var r=this._partialLine+e;this._partialLine="";var i=this._handle.parse(r,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var o=i.meta.cursor;this._finished||(this._partialLine=r.substring(o-this._baseIndex),this._baseIndex=o),i&&i.data&&(this._rowCount+=i.data.length);var a=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(h(this._config.chunk)&&!t){if(this._config.chunk(i,this._handle),this._handle.paused()||this._handle.aborted())return;i=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(i.data),this._completeResults.errors=this._completeResults.errors.concat(i.errors),this._completeResults.meta=i.meta),this._completed||!a||!h(this._config.complete)||i&&i.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||i&&i.meta.paused||this._nextChunk(),i}},this._sendError=function(e){h(this._config.error)&&this._config.error(e)}}function u(e){var t;e=e||{},a.call(this,e),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e=this._config.chunkSize,n=e?t.substr(0,e):t;return t=e?t.substr(e):"",this._finished=!t,this.parseChunk(n)}}}function s(e){var t,n,r,i=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,a=/(\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))/,u=this,s=0,d=0,y=!1,p=!1,m=[],v={data:[],errors:[],meta:{}};if(h(e.step)){var b=e.step;e.step=function(t){if(v=t,O())w();else{if(w(),!v.data||0===v.data.length)return;s+=t.data.length,e.preview&&s>e.preview?n.abort():b(v,u)}}}function g(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function w(){if(v&&r&&(j("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+o.DefaultDelimiter+"'"),r=!1),e.skipEmptyLines)for(var t=0;t<v.data.length;t++)g(v.data[t])&&v.data.splice(t--,1);return O()&&function(){if(!v)return;function t(t){h(e.transformHeader)&&(t=e.transformHeader(t)),m.push(t)}if(Array.isArray(v.data[0])){for(var n=0;O()&&n<v.data.length;n++)v.data[n].forEach(t);v.data.splice(0,1)}else v.data.forEach(t)}(),function(){if(!v||!v.data||!e.header&&!e.dynamicTyping&&!e.transform)return v;function t(t,n){var r,i=e.header?{}:[];for(r=0;r<t.length;r++){var o=r,a=t[r];e.header&&(o=r>=m.length?"__parsed_extra":m[r]),e.transform&&(a=e.transform(a,o)),a=T(o,a),"__parsed_extra"===o?(i[o]=i[o]||[],i[o].push(a)):i[o]=a}return e.header&&(r>m.length?j("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+r,d+n):r<m.length&&j("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+r,d+n)),i}var n=1;!v.data[0]||Array.isArray(v.data[0])?(v.data=v.data.map(t),n=v.data.length):v.data=t(v.data,0);e.header&&v.meta&&(v.meta.fields=m);return d+=n,v}()}function O(){return e.header&&0===m.length}function T(t,n){return function(t){return e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping)}(t)?"true"===n||"TRUE"===n||"false"!==n&&"FALSE"!==n&&(i.test(n)?parseFloat(n):a.test(n)?new Date(n):""===n?null:n):n}function j(e,t,n,r){v.errors.push({type:e,code:t,message:n,row:r})}this.parse=function(i,a,u){var s=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substr(0,1048576);var n=new RegExp(c(t)+"([^]*?)"+c(t),"gm"),r=(e=e.replace(n,"")).split("\r"),i=e.split("\n"),o=i.length>1&&i[0].length<r[0].length;if(1===r.length||o)return"\n";for(var a=0,u=0;u<r.length;u++)"\n"===r[u][0]&&a++;return a>=r.length/2?"\r\n":"\r"}(i,s)),r=!1,e.delimiter)h(e.delimiter)&&(e.delimiter=e.delimiter(i),v.meta.delimiter=e.delimiter);else{var d=function(t,n,r,i,a){var u,s,c;a=a||[",","\t","|",";",o.RECORD_SEP,o.UNIT_SEP];for(var f=0;f<a.length;f++){var h=a[f],d=0,y=0,p=0;c=void 0;for(var m=new l({comments:i,delimiter:h,newline:n,preview:10}).parse(t),v=0;v<m.data.length;v++)if(r&&g(m.data[v]))p++;else{var b=m.data[v].length;y+=b,void 0!==c?b>1&&(d+=Math.abs(b-c),c=b):c=0}m.data.length>0&&(y/=m.data.length-p),(void 0===s||d>s)&&y>1.99&&(s=d,u=h)}return e.delimiter=u,{successful:!!u,bestDelimiter:u}}(i,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);d.successful?e.delimiter=d.bestDelimiter:(r=!0,e.delimiter=o.DefaultDelimiter),v.meta.delimiter=e.delimiter}var p=f(e);return e.preview&&e.header&&p.preview++,t=i,n=new l(p),v=n.parse(t,a,u),w(),y?{meta:{paused:!0}}:v||{meta:{paused:!1}}},this.paused=function(){return y},this.pause=function(){y=!0,n.abort(),t=t.substr(n.getCharIndex())},this.resume=function(){y=!1,u.streamer.parseChunk(t,!0)},this.aborted=function(){return p},this.abort=function(){p=!0,n.abort(),v.meta.aborted=!0,h(e.complete)&&e.complete(v),t=""}}function c(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function l(e){var t,n=(e=e||{}).delimiter,r=e.newline,i=e.comments,a=e.step,u=e.preview,s=e.fastMode,l=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(l=e.escapeChar),("string"!=typeof n||o.BAD_DELIMITERS.indexOf(n)>-1)&&(n=","),i===n)throw new Error("Comment character same as delimiter");!0===i?i="#":("string"!=typeof i||o.BAD_DELIMITERS.indexOf(i)>-1)&&(i=!1),"\n"!==r&&"\r"!==r&&"\r\n"!==r&&(r="\n");var f=0,d=!1;this.parse=function(e,o,y){if("string"!=typeof e)throw new Error("Input must be a string");var p=e.length,m=n.length,v=r.length,b=i.length,g=h(a);f=0;var w=[],O=[],T=[],j=0;if(!e)return B();if(s||!1!==s&&-1===e.indexOf(t)){for(var S=e.split(r),_=0;_<S.length;_++){if(T=S[_],f+=T.length,_!==S.length-1)f+=r.length;else if(y)return B();if(!i||T.substr(0,b)!==i){if(g){if(w=[],x(T.split(n)),F(),d)return B()}else x(T.split(n));if(u&&_>=u)return w=w.slice(0,u),B(!0)}}return B()}for(var k,P=e.indexOf(n,f),I=e.indexOf(r,f),A=new RegExp(c(l)+c(t),"g");;)if(e[f]!==t)if(i&&0===T.length&&e.substr(f,b)===i){if(-1===I)return B();f=I+v,I=e.indexOf(r,f),P=e.indexOf(n,f)}else if(-1!==P&&(P<I||-1===I))T.push(e.substring(f,P)),f=P+m,P=e.indexOf(n,f);else{if(-1===I)break;if(T.push(e.substring(f,I)),C(I+v),g&&(F(),d))return B();if(u&&w.length>=u)return B(!0)}else{for(k=f,f++;;){if(-1===(k=e.indexOf(t,k+1)))return y||O.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:w.length,index:f}),R();if(k===p-1)return R(e.substring(f,k).replace(A,t));if(t!==l||e[k+1]!==l){if(t===l||0===k||e[k-1]!==l){var M=E(-1===I?P:Math.min(P,I));if(e[k+1+M]===n){if(T.push(e.substring(f,k).replace(A,t)),f=k+1+M+m,P=e.indexOf(n,f),I=e.indexOf(r,f),g&&(F(),d))return B();if(u&&w.length>=u)return B(!0);break}var D=E(I);if(e.substr(k+1+D,v)===r){if(T.push(e.substring(f,k).replace(A,t)),C(k+1+D+v),P=e.indexOf(n,f),g&&(F(),d))return B();if(u&&w.length>=u)return B(!0);break}O.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:w.length,index:f}),k++}}else k++}if(g&&(F(),d))return B();if(u&&w.length>=u)return B(!0)}return R();function x(e){w.push(e),j=f}function E(t){var n=0;if(-1!==t){var r=e.substring(k+1,t);r&&""===r.trim()&&(n=r.length)}return n}function R(t){return y||(void 0===t&&(t=e.substr(f)),T.push(t),f=p,x(T),g&&F()),B()}function C(t){f=t,x(T),T=[],I=e.indexOf(r,f)}function B(e,t){return{data:t||!1?w[0]:w,errors:O,meta:{delimiter:n,linebreak:r,aborted:d,truncated:!!e,cursor:j+(o||0)}}}function F(){a(B(void 0,!0)),w=[],O=[]}},this.abort=function(){d=!0},this.getCharIndex=function(){return f}}function f(e){if("object"!==r(e)||null===e)return e;var t=Array.isArray(e)?[]:{};for(var n in e)t[n]=f(e[n]);return t}function h(e){return"function"==typeof e}e.exports=o,o.parse=function(e,t,n){var r=(t=t||{}).dynamicTyping||!1;h(r)&&(t.dynamicTypingFunction=r,r={});if(t.dynamicTyping=r,t.transform=!!h(t.transform)&&t.transform,t.worker&&o.WORKERS_SUPPORTED){var i=newWorker();return i.userStep=t.step,i.userChunk=t.chunk,i.userComplete=t.complete,i.userError=t.error,t.step=h(t.step),t.chunk=h(t.chunk),t.complete=h(t.complete),t.error=h(t.error),delete t.worker,void i.postMessage({input:e,config:t,workerId:i.id})}var a=null;"string"==typeof e&&(a=new u(t));a||(a=new n(t));return a.stream(e)},o.unparse=function(e,t){var n=!1,i=!0,a=",",u="\r\n",s='"',l=s+s,f=!1,h=null;!function(){if("object"!==r(t))return;"string"!=typeof t.delimiter||o.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(a=t.delimiter);("boolean"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes);"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(f=t.skipEmptyLines);"string"==typeof t.newline&&(u=t.newline);"string"==typeof t.quoteChar&&(s=t.quoteChar);"boolean"==typeof t.header&&(i=t.header);if(Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");h=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+s)}();var d=new RegExp(c(s),"g");"string"==typeof e&&(e=JSON.parse(e));if(Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return p(null,e,f);if("object"===r(e[0]))return p(h||y(e[0]),e,f)}else if("object"===r(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:y(e.data[0])),Array.isArray(e.data[0])||"object"===r(e.data[0])||(e.data=[e.data])),p(e.fields||[],e.data||[],f);throw new Error("Unable to serialize unrecognized input");function y(e){if("object"!==r(e))return[];var t=[];for(var n in e)t.push(n);return t}function p(e,t,n){var r="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var o=Array.isArray(e)&&e.length>0,s=!Array.isArray(t[0]);if(o&&i){for(var c=0;c<e.length;c++)c>0&&(r+=a),r+=m(e[c],c);t.length>0&&(r+=u)}for(var l=0;l<t.length;l++){var f=o?e.length:t[l].length,h=!1,d=o?0===Object.keys(t[l]).length:0===t[l].length;if(n&&!o&&(h="greedy"===n?""===t[l].join("").trim():1===t[l].length&&0===t[l][0].length),"greedy"===n&&o){for(var y=[],p=0;p<f;p++){var v=s?e[p]:p;y.push(t[l][v])}h=""===y.join("").trim()}if(!h){for(var b=0;b<f;b++){b>0&&!d&&(r+=a);var g=o&&s?e[b]:b;r+=m(t[l][g],b)}l<t.length-1&&(!n||f>0&&!d)&&(r+=u)}}return r}function m(e,t){return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(e=e.toString().replace(d,l),"boolean"==typeof n&&n||Array.isArray(n)&&n[t]||function(e,t){for(var n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return!0;return!1}(e,o.BAD_DELIMITERS)||e.indexOf(a)>-1||" "===e.charAt(0)||" "===e.charAt(e.length-1)?s+e+s:e)}},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=!1,o.NODE_STREAM_INPUT=1,o.LocalChunkSize=10485760,o.RemoteChunkSize=5242880,o.DefaultDelimiter=",",o.Parser=l,o.ParserHandle=s,o.ChunkStreamer=a,o.StringStreamer=u,u.prototype=Object.create(u.prototype),u.prototype.constructor=u},function(e,t,n){"use strict";(function(t){var r=n(7),i="undefined"==typeof window?t:window;i.loaders=i.loaders||{},e.exports=Object.assign(i.loaders,r)}).call(this,n(6))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"CSVLoader",{enumerable:!0,get:function(){return r.CSVLoader}});var r=n(8)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._typecheckCSVLoader=t.CSVLoader=void 0;var r=n(9),i=a(n(4)),o=a(n(22));function a(e){return e&&e.__esModule?e:{default:e}}function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){f(o,r,i,a,u,"next",e)}function u(e){f(o,r,i,a,u,"throw",e)}a(void 0)}))}}var d,y={csv:{shape:"object-row-table",optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[",","\t","|",";"]}},p={id:"csv",module:"csv",name:"CSV",version:"3.0.14",extensions:["csv"],mimeTypes:["text/csv"],category:"table",parse:(d=h(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",m((new TextDecoder).decode(t),n));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)}),parseText:function(e,t){return m(e,t)},parseInBatches:function(e,t){var n;"auto"===(t=c({},t)).batchSize&&(t.batchSize=4e3);var a=c(c({},y.csv),null===(n=t)||void 0===n?void 0:n.csv),s=new r.AsyncQueue,l=!0,f=null,h=null,d=null,p=c(c({},a),{},{header:!1,download:!1,chunkSize:5242880,skipEmptyLines:!1,step:function(e){var n=e.data;if(a.skipEmptyLines&&""===n.flat().join("").trim())return;var i=e.meta.cursor;if(l&&!f&&("auto"===a.header?b(n):Boolean(a.header)))return void(f=n.map(w()));l&&(l=!1,f||(f=O(a.columnPrefix,n.length)),d=function(e,t){for(var n=t?{}:[],r=0;r<e.length;r++){var i=t&&t[r]||r;switch(u(e[r])){case"number":case"boolean":n[i]={name:String(i),index:r,type:Float32Array};break;case"string":default:n[i]={name:String(i),index:r,type:Array}}}return n}(n,f)),a.optimizeMemoryUsage&&(n=JSON.parse(JSON.stringify(n))),h=h||new r.TableBatchBuilder(d,c({shape:a.shape||"array-row-table"},t));try{h.addRow(n);var o=h&&h.getFullBatch({bytesUsed:i});o&&s.enqueue(o)}catch(e){s.enqueue(e)}},complete:function(e){try{var t=e.meta.cursor,n=h&&h.getFinalBatch({bytesUsed:t});n&&s.enqueue(n)}catch(e){s.enqueue(e)}s.close()}});return i.default.parse(e,p,o.default),s},options:y};function m(e,t){return v.apply(this,arguments)}function v(){return(v=h(regeneratorRuntime.mark((function e(t,n){var o,a,u,s,l,f,h,d;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=c(c({},y.csv),null==n?void 0:n.csv),a=g(t),u="auto"===o.header?b(a):Boolean(o.header),s=u,l=c(c({},o),{},{header:s,download:!1,transformHeader:s?w():void 0,error:function(e){throw new Error(e)}}),f=i.default.parse(t,l),h=f.data,d=f.meta.fields||O(o.columnPrefix,a.length),e.t0=o.shape,e.next="object-row-table"===e.t0?11:"array-row-table"===e.t0?13:15;break;case 11:return h=h.map((function(e){return Array.isArray(e)?(0,r.convertToObjectRow)(e,d):e})),e.abrupt("break",15);case 13:return h=h.map((function(e){return Array.isArray(e)?e:(0,r.convertToArrayRow)(e,d)})),e.abrupt("break",15);case 15:return e.abrupt("return",h);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(e){return e&&e.every((function(e){return"string"==typeof e}))}function g(e){return i.default.parse(e,{download:!1,dynamicTyping:!0,preview:1}).data[0]}function w(){var e=new Set;return function(t){for(var n=t,r=1;e.has(n);)n="".concat(t,".").concat(r),r++;return e.add(n),n}}function O(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=0;r<t;r++)n.push("".concat(e).concat(r+1));return n}t.CSVLoader=p;var T=p;t._typecheckCSVLoader=T},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"TableBatchBuilder",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"RowTableBatchAggregator",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"ColumnarTableBatchAggregator",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"convertToObjectRow",{enumerable:!0,get:function(){return a.convertToObjectRow}}),Object.defineProperty(t,"convertToArrayRow",{enumerable:!0,get:function(){return a.convertToArrayRow}}),Object.defineProperty(t,"getMeshSize",{enumerable:!0,get:function(){return u.getMeshSize}}),Object.defineProperty(t,"getMeshBoundingBox",{enumerable:!0,get:function(){return u.getMeshBoundingBox}}),Object.defineProperty(t,"Schema",{enumerable:!0,get:function(){return s.Schema}}),Object.defineProperty(t,"Field",{enumerable:!0,get:function(){return s.Field}}),Object.defineProperty(t,"DataType",{enumerable:!0,get:function(){return s.DataType}}),Object.defineProperty(t,"Null",{enumerable:!0,get:function(){return s.Null}}),Object.defineProperty(t,"Binary",{enumerable:!0,get:function(){return s.Binary}}),Object.defineProperty(t,"Bool",{enumerable:!0,get:function(){return s.Bool}}),Object.defineProperty(t,"Int",{enumerable:!0,get:function(){return s.Int}}),Object.defineProperty(t,"Int8",{enumerable:!0,get:function(){return s.Int8}}),Object.defineProperty(t,"Int16",{enumerable:!0,get:function(){return s.Int16}}),Object.defineProperty(t,"Int32",{enumerable:!0,get:function(){return s.Int32}}),Object.defineProperty(t,"Int64",{enumerable:!0,get:function(){return s.Int64}}),Object.defineProperty(t,"Uint8",{enumerable:!0,get:function(){return s.Uint8}}),Object.defineProperty(t,"Uint16",{enumerable:!0,get:function(){return s.Uint16}}),Object.defineProperty(t,"Uint32",{enumerable:!0,get:function(){return s.Uint32}}),Object.defineProperty(t,"Uint64",{enumerable:!0,get:function(){return s.Uint64}}),Object.defineProperty(t,"Float",{enumerable:!0,get:function(){return s.Float}}),Object.defineProperty(t,"Float16",{enumerable:!0,get:function(){return s.Float16}}),Object.defineProperty(t,"Float32",{enumerable:!0,get:function(){return s.Float32}}),Object.defineProperty(t,"Float64",{enumerable:!0,get:function(){return s.Float64}}),Object.defineProperty(t,"Utf8",{enumerable:!0,get:function(){return s.Utf8}}),Object.defineProperty(t,"Date",{enumerable:!0,get:function(){return s.Date}}),Object.defineProperty(t,"DateDay",{enumerable:!0,get:function(){return s.DateDay}}),Object.defineProperty(t,"DateMillisecond",{enumerable:!0,get:function(){return s.DateMillisecond}}),Object.defineProperty(t,"Time",{enumerable:!0,get:function(){return s.Time}}),Object.defineProperty(t,"TimeMillisecond",{enumerable:!0,get:function(){return s.TimeMillisecond}}),Object.defineProperty(t,"TimeSecond",{enumerable:!0,get:function(){return s.TimeSecond}}),Object.defineProperty(t,"Timestamp",{enumerable:!0,get:function(){return s.Timestamp}}),Object.defineProperty(t,"TimestampSecond",{enumerable:!0,get:function(){return s.TimestampSecond}}),Object.defineProperty(t,"TimestampMillisecond",{enumerable:!0,get:function(){return s.TimestampMillisecond}}),Object.defineProperty(t,"TimestampMicrosecond",{enumerable:!0,get:function(){return s.TimestampMicrosecond}}),Object.defineProperty(t,"TimestampNanosecond",{enumerable:!0,get:function(){return s.TimestampNanosecond}}),Object.defineProperty(t,"Interval",{enumerable:!0,get:function(){return s.Interval}}),Object.defineProperty(t,"IntervalDayTime",{enumerable:!0,get:function(){return s.IntervalDayTime}}),Object.defineProperty(t,"IntervalYearMonth",{enumerable:!0,get:function(){return s.IntervalYearMonth}}),Object.defineProperty(t,"FixedSizeList",{enumerable:!0,get:function(){return s.FixedSizeList}}),Object.defineProperty(t,"deduceTableSchema",{enumerable:!0,get:function(){return c.deduceTableSchema}}),Object.defineProperty(t,"getTypeInfo",{enumerable:!0,get:function(){return l.getTypeInfo}}),Object.defineProperty(t,"getArrowTypeFromTypedArray",{enumerable:!0,get:function(){return f.getArrowTypeFromTypedArray}}),Object.defineProperty(t,"AsyncQueue",{enumerable:!0,get:function(){return h.default}});var r=d(n(10)),i=d(n(1)),o=d(n(3)),a=n(2),u=n(12),s=n(0),c=n(18),l=n(19),f=n(20),h=d(n(21));function d(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(11)),i=a(n(1)),o=a(n(3));function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var f={shape:"array-row-table",batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},h=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),l(this,"schema",void 0),l(this,"options",void 0),l(this,"aggregator",null),l(this,"batchCount",0),l(this,"bytesUsed",0),l(this,"isChunkComplete",!1),l(this,"lastBatchEmittedMs",Date.now()),l(this,"totalLength",0),l(this,"totalBytes",0),l(this,"rowBytes",0),this.schema=t,this.options=s(s({},f),n)}var t,n,a;return t=e,(n=[{key:"limitReached",value:function(){var e,t;return!!(Boolean(null===(e=this.options)||void 0===e?void 0:e.limit)&&this.totalLength>=this.options.limit)||!!(Boolean(null===(t=this.options)||void 0===t?void 0:t._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}},{key:"addRow",value:function(e){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(e),this.totalBytes+=this.rowBytes,Array.isArray(e)?this.addArrayRow(e):this.addObjectRow(e))}},{key:"addArrayRow",value:function(e){if(!this.aggregator){var t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addArrayRow(e)}},{key:"addObjectRow",value:function(e){if(!this.aggregator){var t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addObjectRow(e)}},{key:"chunkComplete",value:function(e){e instanceof ArrayBuffer&&(this.bytesUsed+=e.byteLength),"string"==typeof e&&(this.bytesUsed+=e.length),this.isChunkComplete=!0}},{key:"getFullBatch",value:function(e){return this._isFull()?this._getBatch(e):null}},{key:"getFinalBatch",value:function(e){return this._getBatch(e)}},{key:"_estimateRowMB",value:function(e){return Array.isArray(e)?8*e.length:8*Object.keys(e).length}},{key:"_isFull",value:function(){if(!this.aggregator||0===this.aggregator.rowCount())return!1;if("auto"===this.options.batchSize){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return!(this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs||(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),0))}},{key:"_getBatch",value:function(e){if(!this.aggregator)return null;null!=e&&e.bytesUsed&&(this.bytesUsed=e.bytesUsed);var t=this.aggregator.getBatch();return t.count=this.batchCount,t.bytesUsed=this.bytesUsed,Object.assign(t,e),this.batchCount++,this.aggregator=null,t}},{key:"_getTableBatchType",value:function(){switch(this.options.shape){case"row-table":return r.default;case"array-row-table":case"object-row-table":return i.default;case"columnar-table":return o.default;case"arrow-table":if(!e.ArrowBatch)throw new Error("TableBatchBuilder");return e.ArrowBatch;default:throw new Error("TableBatchBuilder")}}}])&&c(t.prototype,n),a&&c(t,a),e}();t.default=h,l(h,"ArrowBatch",void 0)},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function(){function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"schema",void 0),i(this,"options",void 0),i(this,"length",0),i(this,"rows",null),i(this,"cursor",0),i(this,"_headers",[]),this.options=n,this.schema=t,!Array.isArray(t))for(var r in this._headers=[],t)this._headers[t[r].index]=t[r].name}var t,n,o;return t=e,(n=[{key:"rowCount",value:function(){return this.length}},{key:"addArrayRow",value:function(e,t){Number.isFinite(t)&&(this.cursor=t),this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}},{key:"addObjectRow",value:function(e,t){Number.isFinite(t)&&(this.cursor=t),this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}},{key:"getBatch",value:function(){var e=this.rows;return e?(e=e.slice(0,this.length),this.rows=null,{shape:this.options.shape,batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}}])&&r(t.prototype,n),o&&r(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getMeshSize=function(e){var t=0;for(var n in e){var r=e[n];ArrayBuffer.isView(r)&&(t+=r.byteLength*r.BYTES_PER_ELEMENT)}return t},t.getMeshBoundingBox=function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,u=e.POSITION?e.POSITION.value:[],s=u&&u.length,c=0;c<s;c+=3){var l=u[c],f=u[c+1],h=u[c+2];t=l<t?l:t,n=f<n?f:n,r=h<r?h:r,i=l>i?l:i,o=f>o?f:o,a=h>a?h:a}return[[t,n,r],[i,o,a]]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n(14);function i(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=a(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){s=!0,o=e},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw o}}}}function a(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"fields",void 0),c(this,"metadata",void 0),(0,r.assert)(Array.isArray(t)),function(e){var t,n={},r=o(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;n[i.name]&&console.warn("Schema: duplicated field name",i.name,i),n[i.name]=!0}}catch(e){r.e(e)}finally{r.f()}}(t),this.fields=t,this.metadata=n||new Map}var t,n,i;return t=e,(n=[{key:"compareTo",value:function(e){if(this.metadata!==e.metadata)return!1;if(this.fields.length!==e.fields.length)return!1;for(var t=0;t<this.fields.length;++t)if(!this.fields[t].compareTo(e.fields[t]))return!1;return!0}},{key:"select",value:function(){for(var t=Object.create(null),n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var o=0,a=r;o<a.length;o++){var u=a[o];t[u]=!0}var s=this.fields.filter((function(e){return t[e.name]}));return new e(s,this.metadata)}},{key:"selectAt",value:function(){for(var t=this,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=r.map((function(e){return t.fields[e]})).filter(Boolean);return new e(o,this.metadata)}},{key:"assign",value:function(t){var n,r=this.metadata;if(t instanceof e){var i=t;n=i.fields,r=f(f(new Map,this.metadata),i.metadata)}else n=t;var a,u=Object.create(null),s=o(this.fields);try{for(s.s();!(a=s.n()).done;){var c=a.value;u[c.name]=c}}catch(e){s.e(e)}finally{s.f()}var l,h=o(n);try{for(h.s();!(l=h.n()).done;){var d=l.value;u[d.name]=d}}catch(e){h.e(e)}finally{h.f()}return new e(Object.values(u),r)}}])&&s(t.prototype,n),i&&s(t,i),e}();function f(e,t){return new Map([].concat(i(e||new Map),i(t||new Map)))}t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assert=function(e,t){if(!e)throw new Error(t||"loader assertion failed.")}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Map;r(this,e),o(this,"name",void 0),o(this,"type",void 0),o(this,"nullable",void 0),o(this,"metadata",void 0),this.name=t,this.type=n,this.nullable=i,this.metadata=a}var t,n,a;return t=e,(n=[{key:"typeId",get:function(){return this.type&&this.type.typeId}},{key:"clone",value:function(){return new e(this.name,this.type,this.nullable,this.metadata)}},{key:"compareTo",value:function(e){return this.name===e.name&&this.type===e.type&&this.nullable===e.nullable&&this.metadata===e.metadata}},{key:"toString",value:function(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}])&&i(t.prototype,n),a&&i(t,a),e}();t.default=a},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Type",{enumerable:!0,get:function(){return f.Type}}),t.FixedSizeList=t.IntervalYearMonth=t.IntervalDayTime=t.Interval=t.TimestampNanosecond=t.TimestampMicrosecond=t.TimestampMillisecond=t.TimestampSecond=t.Timestamp=t.TimeMillisecond=t.TimeSecond=t.Time=t.DateMillisecond=t.DateDay=t.Date=t.Utf8=t.Binary=t.Float64=t.Float32=t.Float16=t.Float=t.Uint64=t.Uint32=t.Uint16=t.Uint8=t.Int64=t.Int32=t.Int16=t.Int8=t.Int=t.Bool=t.Null=t.DataType=void 0;var i,o,a,u,s,c,l,f=n(17);function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(t){var i=b(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return m(this,n)}}function m(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?v(e):t}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function O(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),e}var T=function(){function e(){g(this,e)}return O(e,[{key:"typeId",get:function(){return f.Type.NONE}},{key:"compareTo",value:function(e){return this===e}}],[{key:"isNull",value:function(e){return e&&e.typeId===f.Type.Null}},{key:"isInt",value:function(e){return e&&e.typeId===f.Type.Int}},{key:"isFloat",value:function(e){return e&&e.typeId===f.Type.Float}},{key:"isBinary",value:function(e){return e&&e.typeId===f.Type.Binary}},{key:"isUtf8",value:function(e){return e&&e.typeId===f.Type.Utf8}},{key:"isBool",value:function(e){return e&&e.typeId===f.Type.Bool}},{key:"isDecimal",value:function(e){return e&&e.typeId===f.Type.Decimal}},{key:"isDate",value:function(e){return e&&e.typeId===f.Type.Date}},{key:"isTime",value:function(e){return e&&e.typeId===f.Type.Time}},{key:"isTimestamp",value:function(e){return e&&e.typeId===f.Type.Timestamp}},{key:"isInterval",value:function(e){return e&&e.typeId===f.Type.Interval}},{key:"isList",value:function(e){return e&&e.typeId===f.Type.List}},{key:"isStruct",value:function(e){return e&&e.typeId===f.Type.Struct}},{key:"isUnion",value:function(e){return e&&e.typeId===f.Type.Union}},{key:"isFixedSizeBinary",value:function(e){return e&&e.typeId===f.Type.FixedSizeBinary}},{key:"isFixedSizeList",value:function(e){return e&&e.typeId===f.Type.FixedSizeList}},{key:"isMap",value:function(e){return e&&e.typeId===f.Type.Map}},{key:"isDictionary",value:function(e){return e&&e.typeId===f.Type.Dictionary}}]),e}();t.DataType=T;var j=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.apply(this,arguments)}return O(n,[{key:"typeId",get:function(){return f.Type.Null}},{key:Symbol.toStringTag,get:function(){return"Null"}},{key:"toString",value:function(){return"Null"}}]),n}(T);t.Null=j;var S=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.apply(this,arguments)}return O(n,[{key:"typeId",get:function(){return f.Type.Bool}},{key:Symbol.toStringTag,get:function(){return"Bool"}},{key:"toString",value:function(){return"Bool"}}]),n}(T);t.Bool=S,i=Symbol.toStringTag;var _=function(e){d(n,e);var t=p(n);function n(e,r){var i;return g(this,n),h(v(i=t.call(this)),"isSigned",void 0),h(v(i),"bitWidth",void 0),i.isSigned=e,i.bitWidth=r,i}return O(n,[{key:"typeId",get:function(){return f.Type.Int}},{key:i,get:function(){return"Int"}},{key:"toString",value:function(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}]),n}(T);t.Int=_;var k=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!0,8)}return n}(_);t.Int8=k;var P=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!0,16)}return n}(_);t.Int16=P;var I=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!0,32)}return n}(_);t.Int32=I;var A=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!0,64)}return n}(_);t.Int64=A;var M=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!1,8)}return n}(_);t.Uint8=M;var D=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!1,16)}return n}(_);t.Uint16=D;var x=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!1,32)}return n}(_);t.Uint32=x;var E=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,!1,64)}return n}(_);t.Uint64=E;var R=16,C=32,B=64;o=Symbol.toStringTag;var F=function(e){d(n,e);var t=p(n);function n(e){var r;return g(this,n),h(v(r=t.call(this)),"precision",void 0),r.precision=e,r}return O(n,[{key:"typeId",get:function(){return f.Type.Float}},{key:o,get:function(){return"Float"}},{key:"toString",value:function(){return"Float".concat(this.precision)}}]),n}(T);t.Float=F;var U=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,R)}return n}(F);t.Float16=U;var N=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,C)}return n}(F);t.Float32=N;var L=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,B)}return n}(F);t.Float64=L;var z=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this)}return O(n,[{key:"typeId",get:function(){return f.Type.Binary}},{key:"toString",value:function(){return"Binary"}},{key:Symbol.toStringTag,get:function(){return"Binary"}}]),n}(T);t.Binary=z;var q=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.apply(this,arguments)}return O(n,[{key:"typeId",get:function(){return f.Type.Utf8}},{key:Symbol.toStringTag,get:function(){return"Utf8"}},{key:"toString",value:function(){return"Utf8"}}]),n}(T);t.Utf8=q;var Y={DAY:0,MILLISECOND:1};a=Symbol.toStringTag;var V=function(e){d(n,e);var t=p(n);function n(e){var r;return g(this,n),h(v(r=t.call(this)),"unit",void 0),r.unit=e,r}return O(n,[{key:"typeId",get:function(){return f.Type.Date}},{key:a,get:function(){return"Date"}},{key:"toString",value:function(){return"Date".concat(32*(this.unit+1),"<").concat(Y[this.unit],">")}}]),n}(T);t.Date=V;var W=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,Y.DAY)}return n}(V);t.DateDay=W;var J=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,Y.MILLISECOND)}return n}(V);t.DateMillisecond=J;var Q={SECOND:1,MILLISECOND:1e3,MICROSECOND:1e6,NANOSECOND:1e9};u=Symbol.toStringTag;var H=function(e){d(n,e);var t=p(n);function n(e,r){var i;return g(this,n),h(v(i=t.call(this)),"unit",void 0),h(v(i),"bitWidth",void 0),i.unit=e,i.bitWidth=r,i}return O(n,[{key:"typeId",get:function(){return f.Type.Time}},{key:"toString",value:function(){return"Time".concat(this.bitWidth,"<").concat(Q[this.unit],">")}},{key:u,get:function(){return"Time"}}]),n}(T);t.Time=H;var $=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,Q.SECOND,32)}return n}(H);t.TimeSecond=$;var K=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,Q.MILLISECOND,32)}return n}(H);t.TimeMillisecond=K,s=Symbol.toStringTag;var Z=function(e){d(n,e);var t=p(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return g(this,n),h(v(r=t.call(this)),"unit",void 0),h(v(r),"timezone",void 0),r.unit=e,r.timezone=i,r}return O(n,[{key:"typeId",get:function(){return f.Type.Timestamp}},{key:s,get:function(){return"Timestamp"}},{key:"toString",value:function(){return"Timestamp<".concat(Q[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}}]),n}(T);t.Timestamp=Z;var G=function(e){d(n,e);var t=p(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return g(this,n),t.call(this,Q.SECOND,e)}return n}(Z);t.TimestampSecond=G;var X=function(e){d(n,e);var t=p(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return g(this,n),t.call(this,Q.MILLISECOND,e)}return n}(Z);t.TimestampMillisecond=X;var ee=function(e){d(n,e);var t=p(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return g(this,n),t.call(this,Q.MICROSECOND,e)}return n}(Z);t.TimestampMicrosecond=ee;var te=function(e){d(n,e);var t=p(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return g(this,n),t.call(this,Q.NANOSECOND,e)}return n}(Z);t.TimestampNanosecond=te;var ne={DAY_TIME:0,YEAR_MONTH:1};c=Symbol.toStringTag;var re=function(e){d(n,e);var t=p(n);function n(e){var r;return g(this,n),h(v(r=t.call(this)),"unit",void 0),r.unit=e,r}return O(n,[{key:"typeId",get:function(){return f.Type.Interval}},{key:c,get:function(){return"Interval"}},{key:"toString",value:function(){return"Interval<".concat(ne[this.unit],">")}}]),n}(T);t.Interval=re;var ie=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,ne.DAY_TIME)}return n}(re);t.IntervalDayTime=ie;var oe=function(e){d(n,e);var t=p(n);function n(){return g(this,n),t.call(this,ne.YEAR_MONTH)}return n}(re);t.IntervalYearMonth=oe,l=Symbol.toStringTag;var ae=function(e){d(n,e);var t=p(n);function n(e,r){var i;return g(this,n),h(v(i=t.call(this)),"listSize",void 0),h(v(i),"children",void 0),i.listSize=e,i.children=[r],i}return O(n,[{key:"typeId",get:function(){return f.Type.FixedSizeList}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:l,get:function(){return"FixedSizeList"}},{key:"toString",value:function(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}]),n}(T);t.FixedSizeList=ae},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.Type=void 0,t.Type=r,function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(r||(t.Type=r={}))},function(e,t,n){"use strict";function r(e){return e instanceof Date?Date:e instanceof Number?Float32Array:"string"==typeof e?String:null}Object.defineProperty(t,"__esModule",{value:!0}),t.deduceTableSchema=function(e,t){var n=Array.isArray(e)?function(e){var t={};if(e.length){var n=e[0];for(var i in n){var o=n[i];t[i]=r(o)}}return t}(e):function(e){var t={};for(var n in e){var i=e[n];if(ArrayBuffer.isView(i))t[n]=i.constructor;else if(i.length){var o=i[0];t[n]=r(o)}t[n]=t[n]||null}return t}(e);return Object.assign(n,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getTypeInfo=function(e){return{typeId:e.typeId,ArrayType:e.ArrayType,typeName:e.toString(),typeEnumName:o(e.typeId),precision:e.precision}};var r=n(0);var i=null;function o(e){if(!i)for(var t in i={},r.Type)i[r.Type[t]]=t;return i[e]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getArrowTypeFromTypedArray=function(e){switch(e.constructor){case Int8Array:return new r.Int8;case Uint8Array:return new r.Uint8;case Int16Array:return new r.Int16;case Uint16Array:return new r.Uint16;case Int32Array:return new r.Int32;case Uint32Array:return new r.Uint32;case Float32Array:return new r.Float32;case Float64Array:return new r.Float64;default:throw new Error("array type not supported")}};var r=n(0)},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i;function o(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function u(e){o(a,r,i,u,s,"next",e)}function s(e){o(a,r,i,u,s,"throw",e)}u(void 0)}))}}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),e}function f(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function h(e){var t="function"==typeof Map?new Map:void 0;return(h=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return d(e,arguments,m(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,e)})(e)}function d(e,t,n){return(d=y()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&p(i,n.prototype),i}).apply(null,arguments)}function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.takeAsync=function(e){return g.apply(this,arguments)},t.default=void 0;var v=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}(i,e);var t,n,r=(t=i,n=y(),function(){var e,r=m(t);if(n){var i=m(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return f(this,e)});function i(){return s(this,i),r.apply(this,arguments)}return l(i,[{key:"enqueue",value:function(e){return this.push(e)}},{key:"dequeue",value:function(){return this.shift()}}]),i}(h(Array));i=Symbol.asyncIterator;var b=function(){function e(){s(this,e),u(this,"_values",void 0),u(this,"_settlers",void 0),u(this,"_closed",void 0),this._values=new v,this._settlers=new v,this._closed=!1}return l(e,[{key:"close",value:function(){for(;this._settlers.length>0;)this._settlers.dequeue().resolve({done:!0});this._closed=!0}},{key:i,value:function(){return this}},{key:"enqueue",value:function(e){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");var t=this._settlers.dequeue();e instanceof Error?t.reject(e):t.resolve({value:e})}else this._values.enqueue(e)}},{key:"next",value:function(){var e=this;if(this._values.length>0){var t=this._values.dequeue();return t instanceof Error?Promise.reject(t):Promise.resolve({value:t})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0})}return new Promise((function(t,n){e._settlers.enqueue({resolve:t,reject:n})}))}}]),e}();function g(){return(g=a(regeneratorRuntime.mark((function e(t){var n,r,i,o,a,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=u.length>1&&void 0!==u[1]?u[1]:1/0,r=[],i=t[Symbol.asyncIterator]();case 3:if(!(r.length<n)){e.next=14;break}return e.next=6,i.next();case 6:if(o=e.sent,a=o.value,!o.done){e.next=11;break}return e.abrupt("break",14);case 11:r.push(a),e.next=3;break;case 14:return e.abrupt("return",r);case 15:case"end":return e.stop()}}),e)})))).apply(this,arguments)}t.default=b},function(e,t,n){"use strict";var r;function i(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}function o(e){var t;if("undefined"!=typeof Symbol&&(Symbol.asyncIterator&&(t=e[Symbol.asyncIterator]),null==t&&Symbol.iterator&&(t=e[Symbol.iterator])),null==t&&(t=e["@@asyncIterator"]),null==t&&(t=e["@@iterator"]),null==t)throw new TypeError("Object is not async iterable");return t.call(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var a=((r=n(4))&&r.__esModule?r:{default:r}).default.ChunkStreamer;function u(e){e=e||{},a.call(this,e),this.textDecoder=new TextDecoder(this._config.encoding),this.stream=function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var n,r,i,a,u,s,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._input=t,e.prev=1,n=!0,r=!1,e.prev=4,a=o(t);case 6:return e.next=8,a.next();case 8:return u=e.sent,n=u.done,e.next=12,u.value;case 12:if(s=e.sent,n){e.next=19;break}c=s,this.parseChunk(this.getStringChunk(c));case 16:n=!0,e.next=6;break;case 19:e.next=25;break;case 21:e.prev=21,e.t0=e.catch(4),r=!0,i=e.t0;case 25:if(e.prev=25,e.prev=26,n||null==a.return){e.next=30;break}return e.next=30,a.return();case 30:if(e.prev=30,!r){e.next=33;break}throw i;case 33:return e.finish(30);case 34:return e.finish(25);case 35:this._finished=!0,this.parseChunk(""),e.next=42;break;case 39:e.prev=39,e.t1=e.catch(1),this._sendError(e.t1);case 42:case"end":return e.stop()}}),e,this,[[1,39],[4,21,25,35],[26,,30,34]])})),function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,s,"next",e)}function s(e){i(a,r,o,u,s,"throw",e)}u(void 0)}))});return function(e){return t.apply(this,arguments)}}(),this._nextChunk=function(){},this.getStringChunk=function(e){return"string"==typeof e?e:this.textDecoder.decode(e,{stream:!0})}}u.prototype=Object.create(a.prototype),u.prototype.constructor=u}]);
|
|
8
8
|
//# sourceMappingURL=dist.es5.min.js.map
|
package/dist/dist.min.js
CHANGED
|
@@ -5,5 +5,5 @@ v5.0.0-beta.0
|
|
|
5
5
|
https://github.com/mholt/PapaParse
|
|
6
6
|
License: MIT
|
|
7
7
|
*/
|
|
8
|
-
var r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:{},i={};function n(e){this._handle=null,this._finished=!1,this._completed=!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=l(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null);this._handle=new a(t),this._handle.streamer=this,this._config=t}.call(this,e),this.parseChunk=function(e,t){if(this.isFirstChunk&&u(this._config.beforeFirstChunk)){var r=this._config.beforeFirstChunk(e);void 0!==r&&(e=r)}this.isFirstChunk=!1;var i=this._partialLine+e;this._partialLine="";var n=this._handle.parse(i,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var s=n.meta.cursor;this._finished||(this._partialLine=i.substring(s-this._baseIndex),this._baseIndex=s),n&&n.data&&(this._rowCount+=n.data.length);var a=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(u(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return;n=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!a||!u(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||n&&n.meta.paused||this._nextChunk(),n}},this._sendError=function(e){u(this._config.error)&&this._config.error(e)}}function s(e){var t;e=e||{},n.call(this,e),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e=this._config.chunkSize,r=e?t.substr(0,e):t;return t=e?t.substr(e):"",this._finished=!t,this.parseChunk(r)}}}function a(e){var t,r,n,s=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,a=/(\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,d=0,f=0,p=!1,g=!1,m=[],y={data:[],errors:[],meta:{}};if(u(e.step)){var w=e.step;e.step=function(t){if(y=t,_())v();else{if(v(),!y.data||0===y.data.length)return;d+=t.data.length,e.preview&&d>e.preview?r.abort():w(y,c)}}}function b(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function v(){if(y&&n&&(C("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+i.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines)for(var t=0;t<y.data.length;t++)b(y.data[t])&&y.data.splice(t--,1);return _()&&function(){if(!y)return;function t(t){u(e.transformHeader)&&(t=e.transformHeader(t)),m.push(t)}if(Array.isArray(y.data[0])){for(var r=0;_()&&r<y.data.length;r++)y.data[r].forEach(t);y.data.splice(0,1)}else y.data.forEach(t)}(),function(){if(!y||!y.data||!e.header&&!e.dynamicTyping&&!e.transform)return y;function t(t,r){var i,n=e.header?{}:[];for(i=0;i<t.length;i++){var s=i,a=t[i];e.header&&(s=i>=m.length?"__parsed_extra":m[i]),e.transform&&(a=e.transform(a,s)),a=A(s,a),"__parsed_extra"===s?(n[s]=n[s]||[],n[s].push(a)):n[s]=a}return e.header&&(i>m.length?C("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+i,f+r):i<m.length&&C("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+i,f+r)),n}var r=1;!y.data[0]||Array.isArray(y.data[0])?(y.data=y.data.map(t),r=y.data.length):y.data=t(y.data,0);e.header&&y.meta&&(y.meta.fields=m);return f+=r,y}()}function _(){return e.header&&0===m.length}function A(t,r){return function(t){return e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping)}(t)?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&(s.test(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r}function C(e,t,r,i){y.errors.push({type:e,code:t,message:r,row:i})}this.parse=function(s,a,c){var d=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substr(0,1048576);var r=new RegExp(o(t)+"([^]*?)"+o(t),"gm"),i=(e=e.replace(r,"")).split("\r"),n=e.split("\n"),s=n.length>1&&n[0].length<i[0].length;if(1===i.length||s)return"\n";for(var a=0,h=0;h<i.length;h++)"\n"===i[h][0]&&a++;return a>=i.length/2?"\r\n":"\r"}(s,d)),n=!1,e.delimiter)u(e.delimiter)&&(e.delimiter=e.delimiter(s),y.meta.delimiter=e.delimiter);else{var f=function(t,r,n,s,a){var o,l,u;a=a||[",","\t","|",";",i.RECORD_SEP,i.UNIT_SEP];for(var c=0;c<a.length;c++){var d=a[c],f=0,p=0,g=0;u=void 0;for(var m=new h({comments:s,delimiter:d,newline:r,preview:10}).parse(t),y=0;y<m.data.length;y++)if(n&&b(m.data[y]))g++;else{var w=m.data[y].length;p+=w,void 0!==u?w>1&&(f+=Math.abs(w-u),u=w):u=0}m.data.length>0&&(p/=m.data.length-g),(void 0===l||f>l)&&p>1.99&&(l=f,o=d)}return e.delimiter=o,{successful:!!o,bestDelimiter:o}}(s,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);f.successful?e.delimiter=f.bestDelimiter:(n=!0,e.delimiter=i.DefaultDelimiter),y.meta.delimiter=e.delimiter}var g=l(e);return e.preview&&e.header&&g.preview++,t=s,r=new h(g),y=r.parse(t,a,c),v(),p?{meta:{paused:!0}}:y||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,r.abort(),t=t.substr(r.getCharIndex())},this.resume=function(){p=!1,c.streamer.parseChunk(t,!0)},this.aborted=function(){return g},this.abort=function(){g=!0,r.abort(),y.meta.aborted=!0,u(e.complete)&&e.complete(y),t=""}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function h(e){var t,r=(e=e||{}).delimiter,n=e.newline,s=e.comments,a=e.step,h=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof r||i.BAD_DELIMITERS.indexOf(r)>-1)&&(r=","),s===r)throw new Error("Comment character same as delimiter");!0===s?s="#":("string"!=typeof s||i.BAD_DELIMITERS.indexOf(s)>-1)&&(s=!1),"\n"!==n&&"\r"!==n&&"\r\n"!==n&&(n="\n");var d=0,f=!1;this.parse=function(e,i,p){if("string"!=typeof e)throw new Error("Input must be a string");var g=e.length,m=r.length,y=n.length,w=s.length,b=u(a);d=0;var v=[],_=[],A=[],C=0;if(!e)return P();if(l||!1!==l&&-1===e.indexOf(t)){for(var x=e.split(n),R=0;R<x.length;R++){if(A=x[R],d+=A.length,R!==x.length-1)d+=n.length;else if(p)return P();if(!s||A.substr(0,w)!==s){if(b){if(v=[],B(A.split(r)),I(),f)return P()}else B(A.split(r));if(h&&R>=h)return v=v.slice(0,h),P(!0)}}return P()}for(var E,k=e.indexOf(r,d),O=e.indexOf(n,d),S=new RegExp(o(c)+o(t),"g");;)if(e[d]!==t)if(s&&0===A.length&&e.substr(d,w)===s){if(-1===O)return P();d=O+y,O=e.indexOf(n,d),k=e.indexOf(r,d)}else if(-1!==k&&(k<O||-1===O))A.push(e.substring(d,k)),d=k+m,k=e.indexOf(r,d);else{if(-1===O)break;if(A.push(e.substring(d,O)),F(O+y),b&&(I(),f))return P();if(h&&v.length>=h)return P(!0)}else{for(E=d,d++;;){if(-1===(E=e.indexOf(t,E+1)))return p||_.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:v.length,index:d}),M();if(E===g-1)return M(e.substring(d,E).replace(S,t));if(t!==c||e[E+1]!==c){if(t===c||0===E||e[E-1]!==c){var j=D(-1===O?k:Math.min(k,O));if(e[E+1+j]===r){if(A.push(e.substring(d,E).replace(S,t)),d=E+1+j+m,k=e.indexOf(r,d),O=e.indexOf(n,d),b&&(I(),f))return P();if(h&&v.length>=h)return P(!0);break}var T=D(O);if(e.substr(E+1+T,y)===n){if(A.push(e.substring(d,E).replace(S,t)),F(E+1+T+y),k=e.indexOf(r,d),b&&(I(),f))return P();if(h&&v.length>=h)return P(!0);break}_.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:v.length,index:d}),E++}}else E++}if(b&&(I(),f))return P();if(h&&v.length>=h)return P(!0)}return M();function B(e){v.push(e),C=d}function D(t){var r=0;if(-1!==t){var i=e.substring(E+1,t);i&&""===i.trim()&&(r=i.length)}return r}function M(t){return p||(void 0===t&&(t=e.substr(d)),A.push(t),d=g,B(A),b&&I()),P()}function F(t){d=t,B(A),A=[],O=e.indexOf(n,d)}function P(e,t){return{data:t||!1?v[0]:v,errors:_,meta:{delimiter:r,linebreak:n,aborted:f,truncated:!!e,cursor:C+(i||0)}}}function I(){a(P(void 0,!0)),v=[],_=[]}},this.abort=function(){f=!0},this.getCharIndex=function(){return d}}function l(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var r in e)t[r]=l(e[r]);return t}function u(e){return"function"==typeof e}e.exports=i,i.parse=function(e,t,r){var n=(t=t||{}).dynamicTyping||!1;u(n)&&(t.dynamicTypingFunction=n,n={});if(t.dynamicTyping=n,t.transform=!!u(t.transform)&&t.transform,t.worker&&i.WORKERS_SUPPORTED){var a=newWorker();return a.userStep=t.step,a.userChunk=t.chunk,a.userComplete=t.complete,a.userError=t.error,t.step=u(t.step),t.chunk=u(t.chunk),t.complete=u(t.complete),t.error=u(t.error),delete t.worker,void a.postMessage({input:e,config:t,workerId:a.id})}var o=null;"string"==typeof e&&(o=new s(t));o||(o=new r(t));return o.stream(e)},i.unparse=function(e,t){var r=!1,n=!0,s=",",a="\r\n",h='"',l=h+h,u=!1,c=null;!function(){if("object"!=typeof t)return;"string"!=typeof t.delimiter||i.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(s=t.delimiter);("boolean"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes);"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines);"string"==typeof t.newline&&(a=t.newline);"string"==typeof t.quoteChar&&(h=t.quoteChar);"boolean"==typeof t.header&&(n=t.header);if(Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+h)}();var d=new RegExp(o(h),"g");"string"==typeof e&&(e=JSON.parse(e));if(Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return p(null,e,u);if("object"==typeof e[0])return p(c||f(e[0]),e,u)}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:f(e.data[0])),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),p(e.fields||[],e.data||[],u);throw new Error("Unable to serialize unrecognized input");function f(e){if("object"!=typeof e)return[];var t=[];for(var r in e)t.push(r);return t}function p(e,t,r){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var o=Array.isArray(e)&&e.length>0,h=!Array.isArray(t[0]);if(o&&n){for(var l=0;l<e.length;l++)l>0&&(i+=s),i+=g(e[l],l);t.length>0&&(i+=a)}for(var u=0;u<t.length;u++){var c=o?e.length:t[u].length,d=!1,f=o?0===Object.keys(t[u]).length:0===t[u].length;if(r&&!o&&(d="greedy"===r?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===r&&o){for(var p=[],m=0;m<c;m++){var y=h?e[m]:m;p.push(t[u][y])}d=""===p.join("").trim()}if(!d){for(var w=0;w<c;w++){w>0&&!f&&(i+=s);var b=o&&h?e[w]:w;i+=g(t[u][b],w)}u<t.length-1&&(!r||c>0&&!f)&&(i+=a)}}return i}function g(e,t){return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(e=e.toString().replace(d,l),"boolean"==typeof r&&r||Array.isArray(r)&&r[t]||function(e,t){for(var r=0;r<t.length;r++)if(e.indexOf(t[r])>-1)return!0;return!1}(e,i.BAD_DELIMITERS)||e.indexOf(s)>-1||" "===e.charAt(0)||" "===e.charAt(e.length-1)?h+e+h:e)}},i.RECORD_SEP=String.fromCharCode(30),i.UNIT_SEP=String.fromCharCode(31),i.BYTE_ORDER_MARK="\ufeff",i.BAD_DELIMITERS=["\r","\n",'"',i.BYTE_ORDER_MARK],i.WORKERS_SUPPORTED=!1,i.NODE_STREAM_INPUT=1,i.LocalChunkSize=10485760,i.RemoteChunkSize=5242880,i.DefaultDelimiter=",",i.Parser=h,i.ParserHandle=a,i.ChunkStreamer=n,i.StringStreamer=s,s.prototype=Object.create(s.prototype),s.prototype.constructor=s},function(e,t,r){(function(t){const i=r(3),n="undefined"==typeof window?t:window;n.loaders=n.loaders||{},e.exports=Object.assign(n.loaders,i)}).call(this,r(2))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";function i(e,t){if(!e)throw new Error("null row");if(!t)throw new Error("no headers");const r={};for(let i=0;i<t.length;i++)r[t[i]]=e[i];return r}function n(e,t){if(!e)throw new Error("null row");if(!t)throw new Error("no headers");const r=new Array(t.length);for(let i=0;i<t.length;i++)r[i]=e[t[i]];return r}let s;function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.r(t),r.d(t,"CSVLoader",(function(){return C}));class o extends Array{enqueue(e){return this.push(e)}dequeue(){return this.shift()}}s=Symbol.asyncIterator;class h{constructor(){a(this,"_values",void 0),a(this,"_settlers",void 0),a(this,"_closed",void 0),this._values=new o,this._settlers=new o,this._closed=!1}close(){for(;this._settlers.length>0;)this._settlers.dequeue().resolve({done:!0});this._closed=!0}[s](){return this}enqueue(e){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");const t=this._settlers.dequeue();e instanceof Error?t.reject(e):t.resolve({value:e})}else this._values.enqueue(e)}next(){if(this._values.length>0){const e=this._values.dequeue();return e instanceof Error?Promise.reject(e):Promise.resolve({value:e})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0})}return new Promise((e,t)=>{this._settlers.enqueue({resolve:e,reject:t})})}}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class u{constructor(e,t){if(l(this,"schema",void 0),l(this,"options",void 0),l(this,"length",0),l(this,"rows",null),l(this,"cursor",0),l(this,"_headers",[]),this.options=t,this.schema=e,!Array.isArray(e)){this._headers=[];for(const t in e)this._headers[e[t].index]=e[t].name}}rowCount(){return this.length}addArrayRow(e,t){Number.isFinite(t)&&(this.cursor=t),this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}addObjectRow(e,t){Number.isFinite(t)&&(this.cursor=t),this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}getBatch(){let e=this.rows;if(!e)return null;e=e.slice(0,this.length),this.rows=null;return{shape:this.options.shape,batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}}}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class d{constructor(e,t){if(c(this,"schema",void 0),c(this,"options",void 0),c(this,"length",0),c(this,"objectRows",null),c(this,"arrayRows",null),c(this,"cursor",0),c(this,"_headers",[]),this.options=t,this.schema=e,!Array.isArray(e)){this._headers=[];for(const t in e)this._headers[e[t].index]=e[t].name}}rowCount(){return this.length}addArrayRow(e,t){switch(Number.isFinite(t)&&(this.cursor=t),this.options.shape){case"object-row-table":const r=i(e,this._headers);this.addObjectRow(r,t);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(100),this.arrayRows[this.length]=e,this.length++}}addObjectRow(e,t){switch(Number.isFinite(t)&&(this.cursor=t),this.options.shape){case"array-row-table":const r=n(e,this._headers);this.addArrayRow(r,t);break;case"object-row-table":this.objectRows=this.objectRows||new Array(100),this.objectRows[this.length]=e,this.length++}}getBatch(){let e=this.arrayRows||this.objectRows;return e?(e=e.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class p{constructor(e,t){f(this,"schema",void 0),f(this,"length",0),f(this,"allocated",0),f(this,"columns",{}),this.schema=e,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(e){this._reallocateColumns();let t=0;for(const r in this.columns)this.columns[r][this.length]=e[t++];this.length++}addObjectRow(e){this._reallocateColumns();for(const t in e)this.columns[t][this.length]=e[t];this.length++}getBatch(){this._pruneColumns();const e=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(const t in this.schema){const r=this.schema[t];e[r.name]=this.columns[r.index]}this.columns={};return{shape:"columnar-table",batchType:"data",data:e,schema:this.schema,length:this.length}}_reallocateColumns(){if(!(this.length<this.allocated)){this.allocated=this.allocated>0?this.allocated*=2:100,this.columns={};for(const e in this.schema){const t=this.schema[e],r=t.type||Float32Array,i=this.columns[t.index];if(i&&ArrayBuffer.isView(i)){const e=new r(this.allocated);e.set(i),this.columns[t.index]=e}else i?(i.length=this.allocated,this.columns[t.index]=i):this.columns[t.index]=new r(this.allocated)}}}_pruneColumns(){for(const[e,t]of Object.entries(this.columns))this.columns[e]=t.slice(0,this.length)}}function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const m={shape:"array-row-table",batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0};class y{constructor(e,t){g(this,"schema",void 0),g(this,"options",void 0),g(this,"aggregator",null),g(this,"batchCount",0),g(this,"bytesUsed",0),g(this,"isChunkComplete",!1),g(this,"lastBatchEmittedMs",Date.now()),g(this,"totalLength",0),g(this,"totalBytes",0),g(this,"rowBytes",0),this.schema=e,this.options={...m,...t}}limitReached(){var e,t;return!!(Boolean(null===(e=this.options)||void 0===e?void 0:e.limit)&&this.totalLength>=this.options.limit)||!!(Boolean(null===(t=this.options)||void 0===t?void 0:t._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(e){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(e),this.totalBytes+=this.rowBytes,Array.isArray(e)?this.addArrayRow(e):this.addObjectRow(e))}addArrayRow(e){if(!this.aggregator){const e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addArrayRow(e)}addObjectRow(e){if(!this.aggregator){const e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addObjectRow(e)}chunkComplete(e){e instanceof ArrayBuffer&&(this.bytesUsed+=e.byteLength),"string"==typeof e&&(this.bytesUsed+=e.length),this.isChunkComplete=!0}getFullBatch(e){return this._isFull()?this._getBatch(e):null}getFinalBatch(e){return this._getBatch(e)}_estimateRowMB(e){return Array.isArray(e)?8*e.length:8*Object.keys(e).length}_isFull(){if(!this.aggregator||0===this.aggregator.rowCount())return!1;if("auto"===this.options.batchSize){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return!(this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs)&&(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(e){if(!this.aggregator)return null;null!=e&&e.bytesUsed&&(this.bytesUsed=e.bytesUsed);const t=this.aggregator.getBatch();return t.count=this.batchCount,t.bytesUsed=this.bytesUsed,Object.assign(t,e),this.batchCount++,this.aggregator=null,t}_getTableBatchType(){switch(this.options.shape){case"row-table":return u;case"array-row-table":case"object-row-table":return d;case"columnar-table":return p;case"arrow-table":if(!y.ArrowBatch)throw new Error("TableBatchBuilder");return y.ArrowBatch;default:throw new Error("TableBatchBuilder")}}}g(y,"ArrowBatch",void 0);var w=r(0),b=r.n(w);const{ChunkStreamer:v}=b.a;function _(e){e=e||{},v.call(this,e),this.textDecoder=new TextDecoder(this._config.encoding),this.stream=async function(e){this._input=e;try{for await(const t of e)this.parseChunk(this.getStringChunk(t));this._finished=!0,this.parseChunk("")}catch(e){this._sendError(e)}},this._nextChunk=function(){},this.getStringChunk=function(e){return"string"==typeof e?e:this.textDecoder.decode(e,{stream:!0})}}_.prototype=Object.create(v.prototype),_.prototype.constructor=_;const A={csv:{shape:"object-row-table",optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[",","\t","|",";"]}},C={id:"csv",module:"csv",name:"CSV",version:"3.0.10",extensions:["csv"],mimeTypes:["text/csv"],category:"table",parse:async(e,t)=>x((new TextDecoder).decode(e),t),parseText:(e,t)=>x(e,t),parseInBatches:function(e,t){var r;"auto"===(t={...t}).batchSize&&(t.batchSize=4e3);const i={...A.csv,...null===(r=t)||void 0===r?void 0:r.csv},n=new h;let s=!0,a=null,o=null,l=null;const u={...i,header:!1,download:!1,chunkSize:5242880,skipEmptyLines:!1,step(e){let r=e.data;if(i.skipEmptyLines){if(""===r.flat().join("").trim())return}const h=e.meta.cursor;if(s&&!a){if("auto"===i.header?R(r):Boolean(i.header))return void(a=r.map(E()))}s&&(s=!1,a||(a=k(i.columnPrefix,r.length)),l=function(e,t){const r=t?{}:[];for(let i=0;i<e.length;i++){const n=t&&t[i]||i;switch(typeof e[i]){case"number":case"boolean":r[n]={name:String(n),index:i,type:Float32Array};break;case"string":default:r[n]={name:String(n),index:i,type:Array}}}return r}(r,a)),i.optimizeMemoryUsage&&(r=JSON.parse(JSON.stringify(r))),o=o||new y(l,{shape:i.shape||"array-row-table",...t});try{o.addRow(r);const e=o&&o.getFullBatch({bytesUsed:h});e&&n.enqueue(e)}catch(e){n.enqueue(e)}},complete(e){try{const t=e.meta.cursor,r=o&&o.getFinalBatch({bytesUsed:t});r&&n.enqueue(r)}catch(e){n.enqueue(e)}n.close()}};return b.a.parse(e,u,_),n},options:A};async function x(e,t){const r={...A.csv,...null==t?void 0:t.csv},s=function(e){return b.a.parse(e,{download:!1,dynamicTyping:!0,preview:1}).data[0]}(e),a="auto"===r.header?R(s):Boolean(r.header),o={...r,header:a,download:!1,transformHeader:a?E():void 0,error:e=>{throw new Error(e)}},h=b.a.parse(e,o);let{data:l}=h;const u=h.meta.fields||k(r.columnPrefix,s.length);switch(r.shape){case"object-row-table":l=l.map(e=>Array.isArray(e)?i(e,u):e);break;case"array-row-table":l=l.map(e=>Array.isArray(e)?e:n(e,u))}return l}function R(e){return e&&e.every(e=>"string"==typeof e)}function E(){const e=new Set;return t=>{let r=t,i=1;for(;e.has(r);)r=`${t}.${i}`,i++;return e.add(r),r}}function k(e,t=0){const r=[];for(let i=0;i<t;i++)r.push(`${e}${i+1}`);return r}}])}));
|
|
8
|
+
var r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==r?r:{},i={};function n(e){this._handle=null,this._finished=!1,this._completed=!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=l(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null);this._handle=new a(t),this._handle.streamer=this,this._config=t}.call(this,e),this.parseChunk=function(e,t){if(this.isFirstChunk&&u(this._config.beforeFirstChunk)){var r=this._config.beforeFirstChunk(e);void 0!==r&&(e=r)}this.isFirstChunk=!1;var i=this._partialLine+e;this._partialLine="";var n=this._handle.parse(i,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var s=n.meta.cursor;this._finished||(this._partialLine=i.substring(s-this._baseIndex),this._baseIndex=s),n&&n.data&&(this._rowCount+=n.data.length);var a=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(u(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return;n=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!a||!u(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||n&&n.meta.paused||this._nextChunk(),n}},this._sendError=function(e){u(this._config.error)&&this._config.error(e)}}function s(e){var t;e=e||{},n.call(this,e),this.stream=function(e){return t=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e=this._config.chunkSize,r=e?t.substr(0,e):t;return t=e?t.substr(e):"",this._finished=!t,this.parseChunk(r)}}}function a(e){var t,r,n,s=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,a=/(\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,d=0,f=0,p=!1,g=!1,m=[],y={data:[],errors:[],meta:{}};if(u(e.step)){var w=e.step;e.step=function(t){if(y=t,_())v();else{if(v(),!y.data||0===y.data.length)return;d+=t.data.length,e.preview&&d>e.preview?r.abort():w(y,c)}}}function b(t){return"greedy"===e.skipEmptyLines?""===t.join("").trim():1===t.length&&0===t[0].length}function v(){if(y&&n&&(C("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+i.DefaultDelimiter+"'"),n=!1),e.skipEmptyLines)for(var t=0;t<y.data.length;t++)b(y.data[t])&&y.data.splice(t--,1);return _()&&function(){if(!y)return;function t(t){u(e.transformHeader)&&(t=e.transformHeader(t)),m.push(t)}if(Array.isArray(y.data[0])){for(var r=0;_()&&r<y.data.length;r++)y.data[r].forEach(t);y.data.splice(0,1)}else y.data.forEach(t)}(),function(){if(!y||!y.data||!e.header&&!e.dynamicTyping&&!e.transform)return y;function t(t,r){var i,n=e.header?{}:[];for(i=0;i<t.length;i++){var s=i,a=t[i];e.header&&(s=i>=m.length?"__parsed_extra":m[i]),e.transform&&(a=e.transform(a,s)),a=A(s,a),"__parsed_extra"===s?(n[s]=n[s]||[],n[s].push(a)):n[s]=a}return e.header&&(i>m.length?C("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+i,f+r):i<m.length&&C("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+i,f+r)),n}var r=1;!y.data[0]||Array.isArray(y.data[0])?(y.data=y.data.map(t),r=y.data.length):y.data=t(y.data,0);e.header&&y.meta&&(y.meta.fields=m);return f+=r,y}()}function _(){return e.header&&0===m.length}function A(t,r){return function(t){return e.dynamicTypingFunction&&void 0===e.dynamicTyping[t]&&(e.dynamicTyping[t]=e.dynamicTypingFunction(t)),!0===(e.dynamicTyping[t]||e.dynamicTyping)}(t)?"true"===r||"TRUE"===r||"false"!==r&&"FALSE"!==r&&(s.test(r)?parseFloat(r):a.test(r)?new Date(r):""===r?null:r):r}function C(e,t,r,i){y.errors.push({type:e,code:t,message:r,row:i})}this.parse=function(s,a,c){var d=e.quoteChar||'"';if(e.newline||(e.newline=function(e,t){e=e.substr(0,1048576);var r=new RegExp(o(t)+"([^]*?)"+o(t),"gm"),i=(e=e.replace(r,"")).split("\r"),n=e.split("\n"),s=n.length>1&&n[0].length<i[0].length;if(1===i.length||s)return"\n";for(var a=0,h=0;h<i.length;h++)"\n"===i[h][0]&&a++;return a>=i.length/2?"\r\n":"\r"}(s,d)),n=!1,e.delimiter)u(e.delimiter)&&(e.delimiter=e.delimiter(s),y.meta.delimiter=e.delimiter);else{var f=function(t,r,n,s,a){var o,l,u;a=a||[",","\t","|",";",i.RECORD_SEP,i.UNIT_SEP];for(var c=0;c<a.length;c++){var d=a[c],f=0,p=0,g=0;u=void 0;for(var m=new h({comments:s,delimiter:d,newline:r,preview:10}).parse(t),y=0;y<m.data.length;y++)if(n&&b(m.data[y]))g++;else{var w=m.data[y].length;p+=w,void 0!==u?w>1&&(f+=Math.abs(w-u),u=w):u=0}m.data.length>0&&(p/=m.data.length-g),(void 0===l||f>l)&&p>1.99&&(l=f,o=d)}return e.delimiter=o,{successful:!!o,bestDelimiter:o}}(s,e.newline,e.skipEmptyLines,e.comments,e.delimitersToGuess);f.successful?e.delimiter=f.bestDelimiter:(n=!0,e.delimiter=i.DefaultDelimiter),y.meta.delimiter=e.delimiter}var g=l(e);return e.preview&&e.header&&g.preview++,t=s,r=new h(g),y=r.parse(t,a,c),v(),p?{meta:{paused:!0}}:y||{meta:{paused:!1}}},this.paused=function(){return p},this.pause=function(){p=!0,r.abort(),t=t.substr(r.getCharIndex())},this.resume=function(){p=!1,c.streamer.parseChunk(t,!0)},this.aborted=function(){return g},this.abort=function(){g=!0,r.abort(),y.meta.aborted=!0,u(e.complete)&&e.complete(y),t=""}}function o(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function h(e){var t,r=(e=e||{}).delimiter,n=e.newline,s=e.comments,a=e.step,h=e.preview,l=e.fastMode,c=t=void 0===e.quoteChar?'"':e.quoteChar;if(void 0!==e.escapeChar&&(c=e.escapeChar),("string"!=typeof r||i.BAD_DELIMITERS.indexOf(r)>-1)&&(r=","),s===r)throw new Error("Comment character same as delimiter");!0===s?s="#":("string"!=typeof s||i.BAD_DELIMITERS.indexOf(s)>-1)&&(s=!1),"\n"!==n&&"\r"!==n&&"\r\n"!==n&&(n="\n");var d=0,f=!1;this.parse=function(e,i,p){if("string"!=typeof e)throw new Error("Input must be a string");var g=e.length,m=r.length,y=n.length,w=s.length,b=u(a);d=0;var v=[],_=[],A=[],C=0;if(!e)return P();if(l||!1!==l&&-1===e.indexOf(t)){for(var x=e.split(n),R=0;R<x.length;R++){if(A=x[R],d+=A.length,R!==x.length-1)d+=n.length;else if(p)return P();if(!s||A.substr(0,w)!==s){if(b){if(v=[],B(A.split(r)),I(),f)return P()}else B(A.split(r));if(h&&R>=h)return v=v.slice(0,h),P(!0)}}return P()}for(var E,k=e.indexOf(r,d),O=e.indexOf(n,d),S=new RegExp(o(c)+o(t),"g");;)if(e[d]!==t)if(s&&0===A.length&&e.substr(d,w)===s){if(-1===O)return P();d=O+y,O=e.indexOf(n,d),k=e.indexOf(r,d)}else if(-1!==k&&(k<O||-1===O))A.push(e.substring(d,k)),d=k+m,k=e.indexOf(r,d);else{if(-1===O)break;if(A.push(e.substring(d,O)),F(O+y),b&&(I(),f))return P();if(h&&v.length>=h)return P(!0)}else{for(E=d,d++;;){if(-1===(E=e.indexOf(t,E+1)))return p||_.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:v.length,index:d}),M();if(E===g-1)return M(e.substring(d,E).replace(S,t));if(t!==c||e[E+1]!==c){if(t===c||0===E||e[E-1]!==c){var j=D(-1===O?k:Math.min(k,O));if(e[E+1+j]===r){if(A.push(e.substring(d,E).replace(S,t)),d=E+1+j+m,k=e.indexOf(r,d),O=e.indexOf(n,d),b&&(I(),f))return P();if(h&&v.length>=h)return P(!0);break}var T=D(O);if(e.substr(E+1+T,y)===n){if(A.push(e.substring(d,E).replace(S,t)),F(E+1+T+y),k=e.indexOf(r,d),b&&(I(),f))return P();if(h&&v.length>=h)return P(!0);break}_.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:v.length,index:d}),E++}}else E++}if(b&&(I(),f))return P();if(h&&v.length>=h)return P(!0)}return M();function B(e){v.push(e),C=d}function D(t){var r=0;if(-1!==t){var i=e.substring(E+1,t);i&&""===i.trim()&&(r=i.length)}return r}function M(t){return p||(void 0===t&&(t=e.substr(d)),A.push(t),d=g,B(A),b&&I()),P()}function F(t){d=t,B(A),A=[],O=e.indexOf(n,d)}function P(e,t){return{data:t||!1?v[0]:v,errors:_,meta:{delimiter:r,linebreak:n,aborted:f,truncated:!!e,cursor:C+(i||0)}}}function I(){a(P(void 0,!0)),v=[],_=[]}},this.abort=function(){f=!0},this.getCharIndex=function(){return d}}function l(e){if("object"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var r in e)t[r]=l(e[r]);return t}function u(e){return"function"==typeof e}e.exports=i,i.parse=function(e,t,r){var n=(t=t||{}).dynamicTyping||!1;u(n)&&(t.dynamicTypingFunction=n,n={});if(t.dynamicTyping=n,t.transform=!!u(t.transform)&&t.transform,t.worker&&i.WORKERS_SUPPORTED){var a=newWorker();return a.userStep=t.step,a.userChunk=t.chunk,a.userComplete=t.complete,a.userError=t.error,t.step=u(t.step),t.chunk=u(t.chunk),t.complete=u(t.complete),t.error=u(t.error),delete t.worker,void a.postMessage({input:e,config:t,workerId:a.id})}var o=null;"string"==typeof e&&(o=new s(t));o||(o=new r(t));return o.stream(e)},i.unparse=function(e,t){var r=!1,n=!0,s=",",a="\r\n",h='"',l=h+h,u=!1,c=null;!function(){if("object"!=typeof t)return;"string"!=typeof t.delimiter||i.BAD_DELIMITERS.filter((function(e){return-1!==t.delimiter.indexOf(e)})).length||(s=t.delimiter);("boolean"==typeof t.quotes||Array.isArray(t.quotes))&&(r=t.quotes);"boolean"!=typeof t.skipEmptyLines&&"string"!=typeof t.skipEmptyLines||(u=t.skipEmptyLines);"string"==typeof t.newline&&(a=t.newline);"string"==typeof t.quoteChar&&(h=t.quoteChar);"boolean"==typeof t.header&&(n=t.header);if(Array.isArray(t.columns)){if(0===t.columns.length)throw new Error("Option columns is empty");c=t.columns}void 0!==t.escapeChar&&(l=t.escapeChar+h)}();var d=new RegExp(o(h),"g");"string"==typeof e&&(e=JSON.parse(e));if(Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return p(null,e,u);if("object"==typeof e[0])return p(c||f(e[0]),e,u)}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:f(e.data[0])),Array.isArray(e.data[0])||"object"==typeof e.data[0]||(e.data=[e.data])),p(e.fields||[],e.data||[],u);throw new Error("Unable to serialize unrecognized input");function f(e){if("object"!=typeof e)return[];var t=[];for(var r in e)t.push(r);return t}function p(e,t,r){var i="";"string"==typeof e&&(e=JSON.parse(e)),"string"==typeof t&&(t=JSON.parse(t));var o=Array.isArray(e)&&e.length>0,h=!Array.isArray(t[0]);if(o&&n){for(var l=0;l<e.length;l++)l>0&&(i+=s),i+=g(e[l],l);t.length>0&&(i+=a)}for(var u=0;u<t.length;u++){var c=o?e.length:t[u].length,d=!1,f=o?0===Object.keys(t[u]).length:0===t[u].length;if(r&&!o&&(d="greedy"===r?""===t[u].join("").trim():1===t[u].length&&0===t[u][0].length),"greedy"===r&&o){for(var p=[],m=0;m<c;m++){var y=h?e[m]:m;p.push(t[u][y])}d=""===p.join("").trim()}if(!d){for(var w=0;w<c;w++){w>0&&!f&&(i+=s);var b=o&&h?e[w]:w;i+=g(t[u][b],w)}u<t.length-1&&(!r||c>0&&!f)&&(i+=a)}}return i}function g(e,t){return null==e?"":e.constructor===Date?JSON.stringify(e).slice(1,25):(e=e.toString().replace(d,l),"boolean"==typeof r&&r||Array.isArray(r)&&r[t]||function(e,t){for(var r=0;r<t.length;r++)if(e.indexOf(t[r])>-1)return!0;return!1}(e,i.BAD_DELIMITERS)||e.indexOf(s)>-1||" "===e.charAt(0)||" "===e.charAt(e.length-1)?h+e+h:e)}},i.RECORD_SEP=String.fromCharCode(30),i.UNIT_SEP=String.fromCharCode(31),i.BYTE_ORDER_MARK="\ufeff",i.BAD_DELIMITERS=["\r","\n",'"',i.BYTE_ORDER_MARK],i.WORKERS_SUPPORTED=!1,i.NODE_STREAM_INPUT=1,i.LocalChunkSize=10485760,i.RemoteChunkSize=5242880,i.DefaultDelimiter=",",i.Parser=h,i.ParserHandle=a,i.ChunkStreamer=n,i.StringStreamer=s,s.prototype=Object.create(s.prototype),s.prototype.constructor=s},function(e,t,r){(function(t){const i=r(3),n="undefined"==typeof window?t:window;n.loaders=n.loaders||{},e.exports=Object.assign(n.loaders,i)}).call(this,r(2))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";function i(e,t){if(!e)throw new Error("null row");if(!t)throw new Error("no headers");const r={};for(let i=0;i<t.length;i++)r[t[i]]=e[i];return r}function n(e,t){if(!e)throw new Error("null row");if(!t)throw new Error("no headers");const r=new Array(t.length);for(let i=0;i<t.length;i++)r[i]=e[t[i]];return r}let s;function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.r(t),r.d(t,"CSVLoader",(function(){return C}));class o extends Array{enqueue(e){return this.push(e)}dequeue(){return this.shift()}}s=Symbol.asyncIterator;class h{constructor(){a(this,"_values",void 0),a(this,"_settlers",void 0),a(this,"_closed",void 0),this._values=new o,this._settlers=new o,this._closed=!1}close(){for(;this._settlers.length>0;)this._settlers.dequeue().resolve({done:!0});this._closed=!0}[s](){return this}enqueue(e){if(this._closed)throw new Error("Closed");if(this._settlers.length>0){if(this._values.length>0)throw new Error("Illegal internal state");const t=this._settlers.dequeue();e instanceof Error?t.reject(e):t.resolve({value:e})}else this._values.enqueue(e)}next(){if(this._values.length>0){const e=this._values.dequeue();return e instanceof Error?Promise.reject(e):Promise.resolve({value:e})}if(this._closed){if(this._settlers.length>0)throw new Error("Illegal internal state");return Promise.resolve({done:!0})}return new Promise((e,t)=>{this._settlers.enqueue({resolve:e,reject:t})})}}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class u{constructor(e,t){if(l(this,"schema",void 0),l(this,"options",void 0),l(this,"length",0),l(this,"rows",null),l(this,"cursor",0),l(this,"_headers",[]),this.options=t,this.schema=e,!Array.isArray(e)){this._headers=[];for(const t in e)this._headers[e[t].index]=e[t].name}}rowCount(){return this.length}addArrayRow(e,t){Number.isFinite(t)&&(this.cursor=t),this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}addObjectRow(e,t){Number.isFinite(t)&&(this.cursor=t),this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}getBatch(){let e=this.rows;if(!e)return null;e=e.slice(0,this.length),this.rows=null;return{shape:this.options.shape,batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}}}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class d{constructor(e,t){if(c(this,"schema",void 0),c(this,"options",void 0),c(this,"length",0),c(this,"objectRows",null),c(this,"arrayRows",null),c(this,"cursor",0),c(this,"_headers",[]),this.options=t,this.schema=e,!Array.isArray(e)){this._headers=[];for(const t in e)this._headers[e[t].index]=e[t].name}}rowCount(){return this.length}addArrayRow(e,t){switch(Number.isFinite(t)&&(this.cursor=t),this.options.shape){case"object-row-table":const r=i(e,this._headers);this.addObjectRow(r,t);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(100),this.arrayRows[this.length]=e,this.length++}}addObjectRow(e,t){switch(Number.isFinite(t)&&(this.cursor=t),this.options.shape){case"array-row-table":const r=n(e,this._headers);this.addArrayRow(r,t);break;case"object-row-table":this.objectRows=this.objectRows||new Array(100),this.objectRows[this.length]=e,this.length++}}getBatch(){let e=this.arrayRows||this.objectRows;return e?(e=e.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class p{constructor(e,t){f(this,"schema",void 0),f(this,"length",0),f(this,"allocated",0),f(this,"columns",{}),this.schema=e,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(e){this._reallocateColumns();let t=0;for(const r in this.columns)this.columns[r][this.length]=e[t++];this.length++}addObjectRow(e){this._reallocateColumns();for(const t in e)this.columns[t][this.length]=e[t];this.length++}getBatch(){this._pruneColumns();const e=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(const t in this.schema){const r=this.schema[t];e[r.name]=this.columns[r.index]}this.columns={};return{shape:"columnar-table",batchType:"data",data:e,schema:this.schema,length:this.length}}_reallocateColumns(){if(!(this.length<this.allocated)){this.allocated=this.allocated>0?this.allocated*=2:100,this.columns={};for(const e in this.schema){const t=this.schema[e],r=t.type||Float32Array,i=this.columns[t.index];if(i&&ArrayBuffer.isView(i)){const e=new r(this.allocated);e.set(i),this.columns[t.index]=e}else i?(i.length=this.allocated,this.columns[t.index]=i):this.columns[t.index]=new r(this.allocated)}}}_pruneColumns(){for(const[e,t]of Object.entries(this.columns))this.columns[e]=t.slice(0,this.length)}}function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const m={shape:"array-row-table",batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0};class y{constructor(e,t){g(this,"schema",void 0),g(this,"options",void 0),g(this,"aggregator",null),g(this,"batchCount",0),g(this,"bytesUsed",0),g(this,"isChunkComplete",!1),g(this,"lastBatchEmittedMs",Date.now()),g(this,"totalLength",0),g(this,"totalBytes",0),g(this,"rowBytes",0),this.schema=e,this.options={...m,...t}}limitReached(){var e,t;return!!(Boolean(null===(e=this.options)||void 0===e?void 0:e.limit)&&this.totalLength>=this.options.limit)||!!(Boolean(null===(t=this.options)||void 0===t?void 0:t._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(e){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(e),this.totalBytes+=this.rowBytes,Array.isArray(e)?this.addArrayRow(e):this.addObjectRow(e))}addArrayRow(e){if(!this.aggregator){const e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addArrayRow(e)}addObjectRow(e){if(!this.aggregator){const e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addObjectRow(e)}chunkComplete(e){e instanceof ArrayBuffer&&(this.bytesUsed+=e.byteLength),"string"==typeof e&&(this.bytesUsed+=e.length),this.isChunkComplete=!0}getFullBatch(e){return this._isFull()?this._getBatch(e):null}getFinalBatch(e){return this._getBatch(e)}_estimateRowMB(e){return Array.isArray(e)?8*e.length:8*Object.keys(e).length}_isFull(){if(!this.aggregator||0===this.aggregator.rowCount())return!1;if("auto"===this.options.batchSize){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return!(this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs)&&(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(e){if(!this.aggregator)return null;null!=e&&e.bytesUsed&&(this.bytesUsed=e.bytesUsed);const t=this.aggregator.getBatch();return t.count=this.batchCount,t.bytesUsed=this.bytesUsed,Object.assign(t,e),this.batchCount++,this.aggregator=null,t}_getTableBatchType(){switch(this.options.shape){case"row-table":return u;case"array-row-table":case"object-row-table":return d;case"columnar-table":return p;case"arrow-table":if(!y.ArrowBatch)throw new Error("TableBatchBuilder");return y.ArrowBatch;default:throw new Error("TableBatchBuilder")}}}g(y,"ArrowBatch",void 0);var w=r(0),b=r.n(w);const{ChunkStreamer:v}=b.a;function _(e){e=e||{},v.call(this,e),this.textDecoder=new TextDecoder(this._config.encoding),this.stream=async function(e){this._input=e;try{for await(const t of e)this.parseChunk(this.getStringChunk(t));this._finished=!0,this.parseChunk("")}catch(e){this._sendError(e)}},this._nextChunk=function(){},this.getStringChunk=function(e){return"string"==typeof e?e:this.textDecoder.decode(e,{stream:!0})}}_.prototype=Object.create(v.prototype),_.prototype.constructor=_;const A={csv:{shape:"object-row-table",optimizeMemoryUsage:!1,header:"auto",columnPrefix:"column",quoteChar:'"',escapeChar:'"',dynamicTyping:!0,comments:!1,skipEmptyLines:!0,delimitersToGuess:[",","\t","|",";"]}},C={id:"csv",module:"csv",name:"CSV",version:"3.0.14",extensions:["csv"],mimeTypes:["text/csv"],category:"table",parse:async(e,t)=>x((new TextDecoder).decode(e),t),parseText:(e,t)=>x(e,t),parseInBatches:function(e,t){var r;"auto"===(t={...t}).batchSize&&(t.batchSize=4e3);const i={...A.csv,...null===(r=t)||void 0===r?void 0:r.csv},n=new h;let s=!0,a=null,o=null,l=null;const u={...i,header:!1,download:!1,chunkSize:5242880,skipEmptyLines:!1,step(e){let r=e.data;if(i.skipEmptyLines){if(""===r.flat().join("").trim())return}const h=e.meta.cursor;if(s&&!a){if("auto"===i.header?R(r):Boolean(i.header))return void(a=r.map(E()))}s&&(s=!1,a||(a=k(i.columnPrefix,r.length)),l=function(e,t){const r=t?{}:[];for(let i=0;i<e.length;i++){const n=t&&t[i]||i;switch(typeof e[i]){case"number":case"boolean":r[n]={name:String(n),index:i,type:Float32Array};break;case"string":default:r[n]={name:String(n),index:i,type:Array}}}return r}(r,a)),i.optimizeMemoryUsage&&(r=JSON.parse(JSON.stringify(r))),o=o||new y(l,{shape:i.shape||"array-row-table",...t});try{o.addRow(r);const e=o&&o.getFullBatch({bytesUsed:h});e&&n.enqueue(e)}catch(e){n.enqueue(e)}},complete(e){try{const t=e.meta.cursor,r=o&&o.getFinalBatch({bytesUsed:t});r&&n.enqueue(r)}catch(e){n.enqueue(e)}n.close()}};return b.a.parse(e,u,_),n},options:A};async function x(e,t){const r={...A.csv,...null==t?void 0:t.csv},s=function(e){return b.a.parse(e,{download:!1,dynamicTyping:!0,preview:1}).data[0]}(e),a="auto"===r.header?R(s):Boolean(r.header),o={...r,header:a,download:!1,transformHeader:a?E():void 0,error:e=>{throw new Error(e)}},h=b.a.parse(e,o);let{data:l}=h;const u=h.meta.fields||k(r.columnPrefix,s.length);switch(r.shape){case"object-row-table":l=l.map(e=>Array.isArray(e)?i(e,u):e);break;case"array-row-table":l=l.map(e=>Array.isArray(e)?e:n(e,u))}return l}function R(e){return e&&e.every(e=>"string"==typeof e)}function E(){const e=new Set;return t=>{let r=t,i=1;for(;e.has(r);)r=`${t}.${i}`,i++;return e.add(r),r}}function k(e,t=0){const r=[];for(let i=0;i<t;i++)r.push(`${e}${i+1}`);return r}}])}));
|
|
9
9
|
//# sourceMappingURL=dist.min.js.map
|
package/dist/es5/csv-loader.js
CHANGED
|
@@ -25,7 +25,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
25
25
|
|
|
26
26
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
27
27
|
|
|
28
|
-
var VERSION = typeof "3.0.
|
|
28
|
+
var VERSION = typeof "3.0.14" !== 'undefined' ? "3.0.14" : 'latest';
|
|
29
29
|
var DEFAULT_CSV_LOADER_OPTIONS = {
|
|
30
30
|
csv: {
|
|
31
31
|
shape: 'object-row-table',
|
package/dist/esm/csv-loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsyncQueue, TableBatchBuilder, convertToArrayRow, convertToObjectRow } from '@loaders.gl/schema';
|
|
2
2
|
import Papa from './libs/papaparse';
|
|
3
3
|
import AsyncIteratorStreamer from './lib/async-iterator-streamer';
|
|
4
|
-
const VERSION = typeof "3.0.
|
|
4
|
+
const VERSION = typeof "3.0.14" !== 'undefined' ? "3.0.14" : 'latest';
|
|
5
5
|
const DEFAULT_CSV_LOADER_OPTIONS = {
|
|
6
6
|
csv: {
|
|
7
7
|
shape: 'object-row-table',
|
|
@@ -187,7 +187,7 @@ function duplicateColumnTransformer() {
|
|
|
187
187
|
let counter = 1;
|
|
188
188
|
|
|
189
189
|
while (observedColumns.has(colName)) {
|
|
190
|
-
colName =
|
|
190
|
+
colName = "".concat(col, ".").concat(counter);
|
|
191
191
|
counter++;
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -200,7 +200,7 @@ function generateHeader(columnPrefix, count = 0) {
|
|
|
200
200
|
const headers = [];
|
|
201
201
|
|
|
202
202
|
for (let i = 0; i < count; i++) {
|
|
203
|
-
headers.push(
|
|
203
|
+
headers.push("".concat(columnPrefix).concat(i + 1));
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
return headers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/csv-loader.ts"],"names":["AsyncQueue","TableBatchBuilder","convertToArrayRow","convertToObjectRow","Papa","AsyncIteratorStreamer","VERSION","DEFAULT_CSV_LOADER_OPTIONS","csv","shape","optimizeMemoryUsage","header","columnPrefix","quoteChar","escapeChar","dynamicTyping","comments","skipEmptyLines","delimitersToGuess","CSVLoader","id","module","name","version","extensions","mimeTypes","category","parse","arrayBuffer","options","parseCSV","TextDecoder","decode","parseText","text","parseInBatches","parseCSVInBatches","csvText","csvOptions","firstRow","readFirstRow","isHeaderRow","Boolean","parseWithHeader","papaparseConfig","download","transformHeader","duplicateColumnTransformer","undefined","error","e","Error","result","data","rows","headerRow","meta","fields","generateHeader","length","map","row","Array","isArray","asyncIterator","batchSize","asyncQueue","isFirstRow","tableBatchBuilder","schema","config","chunkSize","step","results","collapsedRow","flat","join","trim","bytesUsed","cursor","deduceSchema","JSON","stringify","addRow","batch","getFullBatch","enqueue","complete","getFinalBatch","close","every","value","preview","observedColumns","Set","col","colName","counter","has","add","count","headers","i","push","columnName","String","index","type","Float32Array","_typecheckCSVLoader"],"mappings":"AAIA,SACEA,UADF,EAEEC,iBAFF,EAGEC,iBAHF,EAIEC,kBAJF,QAKO,oBALP;AAMA,OAAOC,IAAP,MAAiB,kBAAjB;AACA,OAAOC,qBAAP,MAAkC,+BAAlC;AAIA,MAAMC,OAAO,GAAG,oBAAuB,WAAvB,cAAmD,QAAnE;AA0BA,MAAMC,0BAA0B,GAAG;AACjCC,EAAAA,GAAG,EAAE;AACHC,IAAAA,KAAK,EAAE,kBADJ;AAEHC,IAAAA,mBAAmB,EAAE,KAFlB;AAIHC,IAAAA,MAAM,EAAE,MAJL;AAKHC,IAAAA,YAAY,EAAE,QALX;AAQHC,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9D,EAA2E;AACzE,QAAMC,OAAiB,GAAG,EAA1B;;AACA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,KAApB,EAA2BE,CAAC,EAA5B,EAAgC;AAC9BD,IAAAA,OAAO,CAACE,IAAR,CAAc,GAAE3F,YAAa,GAAE0F,CAAC,GAAG,CAAE,EAArC;AACD;;AACD,SAAOD,OAAP;AACD;;AAED,SAASrB,YAAT,CAAsBnB,GAAtB,EAA2BN,SAA3B,EAAsC;AACpC,QAAMc,MAAM,GAAGd,SAAS,GAAG,EAAH,GAAQ,EAAhC;;AACA,OAAK,IAAI+C,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGzC,GAAG,CAACF,MAAxB,EAAgC2C,CAAC,EAAjC,EAAqC;AACnC,UAAME,UAAU,GAAIjD,SAAS,IAAIA,SAAS,CAAC+C,CAAD,CAAvB,IAA+BA,CAAlD;AACA,UAAMX,KAAK,GAAG9B,GAAG,CAACyC,CAAD,CAAjB;;AACA,YAAQ,OAAOX,KAAf;AACE,WAAK,QAAL;AACA,WAAK,SAAL;AAEEtB,QAAAA,MAAM,CAACmC,UAAD,CAAN,GAAqB;AAAClF,UAAAA,IAAI,EAAEmF,MAAM,CAACD,UAAD,CAAb;AAA2BE,UAAAA,KAAK,EAAEJ,CAAlC;AAAqCK,UAAAA,IAAI,EAAEC;AAA3C,SAArB;AACA;;AACF,WAAK,QAAL;AACA;AACEvC,QAAAA,MAAM,CAACmC,UAAD,CAAN,GAAqB;AAAClF,UAAAA,IAAI,EAAEmF,MAAM,CAACD,UAAD,CAAb;AAA2BE,UAAAA,KAAK,EAAEJ,CAAlC;AAAqCK,UAAAA,IAAI,EAAE7C;AAA3C,SAArB;AARJ;AAYD;;AACD,SAAOO,MAAP;AACD;;AAED,OAAO,MAAMwC,mBAAqC,GAAG1F,SAA9C","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {Batch} from '@loaders.gl/schema';\ntype Schema = any;\n\nimport {\n AsyncQueue,\n TableBatchBuilder,\n convertToArrayRow,\n convertToObjectRow\n} from '@loaders.gl/schema';\nimport Papa from './libs/papaparse';\nimport AsyncIteratorStreamer from './lib/async-iterator-streamer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type CSVLoaderOptions = LoaderOptions & {\n csv?: {\n // loaders.gl options\n shape?: 'array-row-table' | 'object-row-table' | 'columnar-table';\n /** optimizes memory usage but increases parsing time. */\n optimizeMemoryUsage?: boolean;\n columnPrefix?: string;\n header?: 'auto';\n\n // CSV options (papaparse)\n // delimiter: auto\n // newline: auto\n quoteChar?: string;\n escapeChar?: string;\n // Convert numbers and boolean values in rows from strings\n dynamicTyping?: boolean;\n comments?: boolean;\n skipEmptyLines?: boolean | 'greedy';\n // transform: null?\n delimitersToGuess?: string[];\n // fastMode: auto\n };\n};\n\nconst DEFAULT_CSV_LOADER_OPTIONS = {\n csv: {\n shape: 'object-row-table',\n optimizeMemoryUsage: false,\n // CSV options\n header: 'auto',\n columnPrefix: 'column',\n // delimiter: auto\n // newline: auto\n quoteChar: '\"',\n escapeChar: '\"',\n dynamicTyping: true,\n comments: false,\n skipEmptyLines: true,\n // transform: null?\n delimitersToGuess: [',', '\\t', '|', ';']\n // fastMode: auto\n }\n};\n\nexport const CSVLoader = {\n id: 'csv',\n module: 'csv',\n name: 'CSV',\n version: VERSION,\n extensions: ['csv'],\n mimeTypes: ['text/csv'],\n category: 'table',\n parse: async (arrayBuffer: ArrayBuffer, options?: CSVLoaderOptions) =>\n parseCSV(new TextDecoder().decode(arrayBuffer), options),\n parseText: (text: string, options?: CSVLoaderOptions) => parseCSV(text, options),\n parseInBatches: parseCSVInBatches,\n // @ts-ignore\n // testText: null,\n options: DEFAULT_CSV_LOADER_OPTIONS as CSVLoaderOptions\n};\n\nasync function parseCSV(csvText: string, options?: CSVLoaderOptions) {\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...DEFAULT_CSV_LOADER_OPTIONS.csv, ...options?.csv};\n\n const firstRow = readFirstRow(csvText);\n const header: boolean =\n csvOptions.header === 'auto' ? isHeaderRow(firstRow) : Boolean(csvOptions.header);\n\n const parseWithHeader = header;\n\n const papaparseConfig = {\n // dynamicTyping: true,\n ...csvOptions,\n header: parseWithHeader,\n download: false, // We handle loading, no need for papaparse to do it for us\n transformHeader: parseWithHeader ? duplicateColumnTransformer() : undefined,\n error: (e) => {\n throw new Error(e);\n }\n };\n\n const result = Papa.parse(csvText, papaparseConfig);\n let {data: rows} = result;\n\n const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix, firstRow.length);\n\n switch (csvOptions.shape) {\n case 'object-row-table':\n rows = rows.map((row) => (Array.isArray(row) ? convertToObjectRow(row, headerRow) : row));\n break;\n case 'array-row-table':\n rows = rows.map((row) => (Array.isArray(row) ? row : convertToArrayRow(row, headerRow)));\n break;\n default:\n }\n\n /*\n if (!header && shape === 'object-row-table') {\n // If the dataset has no header, transform the array result into an object shape with an\n // autogenerated header\n return result.data.map((row) =>\n row.reduce((acc, value, i) => {\n acc[headerRow[i]] = value;\n return acc;\n }, {})\n );\n }\n */\n return rows;\n}\n\n// TODO - support batch size 0 = no batching/single batch?\nfunction parseCSVInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: CSVLoaderOptions\n): AsyncIterable<Batch> {\n // Papaparse does not support standard batch size handling\n // TODO - investigate papaparse chunks mode\n options = {...options};\n if (options.batchSize === 'auto') {\n options.batchSize = 4000;\n }\n\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...DEFAULT_CSV_LOADER_OPTIONS.csv, ...options?.csv};\n\n const asyncQueue = new AsyncQueue<Batch>();\n\n let isFirstRow: boolean = true;\n let headerRow: string[] | null = null;\n let tableBatchBuilder: TableBatchBuilder | null = null;\n let schema: Schema | null = null;\n\n const config = {\n // dynamicTyping: true, // Convert numbers and boolean values in rows from strings,\n ...csvOptions,\n header: false, // Unfortunately, header detection is not automatic and does not infer shapes\n download: false, // We handle loading, no need for papaparse to do it for us\n // chunkSize is set to 5MB explicitly (same as Papaparse default) due to a bug where the\n // streaming parser gets stuck if skipEmptyLines and a step callback are both supplied.\n // See https://github.com/mholt/PapaParse/issues/465\n chunkSize: 1024 * 1024 * 5,\n // skipEmptyLines is set to a boolean value if supplied. Greedy is set to true\n // skipEmptyLines is handled manually given two bugs where the streaming parser gets stuck if\n // both of the skipEmptyLines and step callback options are provided:\n // - true doesn't work unless chunkSize is set: https://github.com/mholt/PapaParse/issues/465\n // - greedy doesn't work: https://github.com/mholt/PapaParse/issues/825\n skipEmptyLines: false,\n\n // step is called on every row\n // eslint-disable-next-line complexity\n step(results) {\n let row = results.data;\n\n if (csvOptions.skipEmptyLines) {\n // Manually reject lines that are empty\n const collapsedRow = row.flat().join('').trim();\n if (collapsedRow === '') {\n return;\n }\n }\n const bytesUsed = results.meta.cursor;\n\n // Check if we need to save a header row\n if (isFirstRow && !headerRow) {\n // Auto detects or can be forced with csvOptions.header\n const header = csvOptions.header === 'auto' ? isHeaderRow(row) : Boolean(csvOptions.header);\n if (header) {\n headerRow = row.map(duplicateColumnTransformer());\n return;\n }\n }\n\n // If first data row, we can deduce the schema\n if (isFirstRow) {\n isFirstRow = false;\n if (!headerRow) {\n headerRow = generateHeader(csvOptions.columnPrefix, row.length);\n }\n schema = deduceSchema(row, headerRow);\n }\n\n if (csvOptions.optimizeMemoryUsage) {\n // A workaround to allocate new strings and don't retain pointers to original strings.\n // https://bugs.chromium.org/p/v8/issues/detail?id=2869\n row = JSON.parse(JSON.stringify(row));\n }\n\n // Add the row\n tableBatchBuilder =\n tableBatchBuilder ||\n new TableBatchBuilder(schema, {\n // @ts-expect-error\n shape: csvOptions.shape || 'array-row-table',\n ...options\n });\n\n try {\n tableBatchBuilder.addRow(row);\n // If a batch has been completed, emit it\n const batch = tableBatchBuilder && tableBatchBuilder.getFullBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n },\n\n // complete is called when all rows have been read\n complete(results) {\n try {\n const bytesUsed = results.meta.cursor;\n // Ensure any final (partial) batch gets emitted\n const batch = tableBatchBuilder && tableBatchBuilder.getFinalBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n\n asyncQueue.close();\n }\n };\n\n Papa.parse(asyncIterator, config, AsyncIteratorStreamer);\n\n // TODO - Does it matter if we return asyncIterable or asyncIterator\n // return asyncQueue[Symbol.asyncIterator]();\n return asyncQueue;\n}\n\n/**\n * Checks if a certain row is a header row\n * @param row the row to check\n * @returns true if the row looks like a header\n */\nfunction isHeaderRow(row: string[]): boolean {\n return row && row.every((value) => typeof value === 'string');\n}\n\n/**\n * Reads, parses, and returns the first row of a CSV text\n * @param csvText the csv text to parse\n * @returns the first row\n */\nfunction readFirstRow(csvText: string): any[] {\n const result = Papa.parse(csvText, {\n download: false,\n dynamicTyping: true,\n preview: 1\n });\n return result.data[0];\n}\n\n/**\n * Creates a transformer that renames duplicate columns. This is needed as Papaparse doesn't handle\n * duplicate header columns and would use the latest occurrence by default.\n * See the header option in https://www.papaparse.com/docs#config\n * @returns a transform function that returns sanitized names for duplicate fields\n */\nfunction duplicateColumnTransformer() {\n const observedColumns = new Set();\n return (col) => {\n let colName = col;\n let counter = 1;\n while (observedColumns.has(colName)) {\n colName = `${col}.${counter}`;\n counter++;\n }\n observedColumns.add(colName);\n return colName;\n };\n}\n\n/**\n * Generates the header of a CSV given a prefix and a column count\n * @param columnPrefix the columnPrefix to use\n * @param count the count of column names to generate\n * @returns an array of column names\n */\nfunction generateHeader(columnPrefix: string, count: number = 0): string[] {\n const headers: string[] = [];\n for (let i = 0; i < count; i++) {\n headers.push(`${columnPrefix}${i + 1}`);\n }\n return headers;\n}\n\nfunction deduceSchema(row, headerRow) {\n const schema = headerRow ? {} : [];\n for (let i = 0; i < row.length; i++) {\n const columnName = (headerRow && headerRow[i]) || i;\n const value = row[i];\n switch (typeof value) {\n case 'number':\n case 'boolean':\n // TODO - booleans could be handled differently...\n schema[columnName] = {name: String(columnName), index: i, type: Float32Array};\n break;\n case 'string':\n default:\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n // We currently only handle numeric rows\n // TODO we could offer a function to map strings to numbers?\n }\n }\n return schema;\n}\n\nexport const _typecheckCSVLoader: LoaderWithParser = CSVLoader;\n"],"file":"csv-loader.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/csv-loader.ts"],"names":["AsyncQueue","TableBatchBuilder","convertToArrayRow","convertToObjectRow","Papa","AsyncIteratorStreamer","VERSION","DEFAULT_CSV_LOADER_OPTIONS","csv","shape","optimizeMemoryUsage","header","columnPrefix","quoteChar","escapeChar","dynamicTyping","comments","skipEmptyLines","delimitersToGuess","CSVLoader","id","module","name","version","extensions","mimeTypes","category","parse","arrayBuffer","options","parseCSV","TextDecoder","decode","parseText","text","parseInBatches","parseCSVInBatches","csvText","csvOptions","firstRow","readFirstRow","isHeaderRow","Boolean","parseWithHeader","papaparseConfig","download","transformHeader","duplicateColumnTransformer","undefined","error","e","Error","result","data","rows","headerRow","meta","fields","generateHeader","length","map","row","Array","isArray","asyncIterator","batchSize","asyncQueue","isFirstRow","tableBatchBuilder","schema","config","chunkSize","step","results","collapsedRow","flat","join","trim","bytesUsed","cursor","deduceSchema","JSON","stringify","addRow","batch","getFullBatch","enqueue","complete","getFinalBatch","close","every","value","preview","observedColumns","Set","col","colName","counter","has","add","count","headers","i","push","columnName","String","index","type","Float32Array","_typecheckCSVLoader"],"mappings":"AAIA,SACEA,UADF,EAEEC,iBAFF,EAGEC,iBAHF,EAIEC,kBAJF,QAKO,oBALP;AAMA,OAAOC,IAAP,MAAiB,kBAAjB;AACA,OAAOC,qBAAP,MAAkC,+BAAlC;AAIA,MAA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K,EAAEJ,CAAlC;AAAqCK,UAAAA,IAAI,EAAE7C;AAA3C,SAArB;AARJ;AAYD;;AACD,SAAOO,MAAP;AACD;;AAED,OAAO,MAAMwC,mBAAqC,GAAG1F,SAA9C","sourcesContent":["import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {Batch} from '@loaders.gl/schema';\ntype Schema = any;\n\nimport {\n AsyncQueue,\n TableBatchBuilder,\n convertToArrayRow,\n convertToObjectRow\n} from '@loaders.gl/schema';\nimport Papa from './libs/papaparse';\nimport AsyncIteratorStreamer from './lib/async-iterator-streamer';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\nexport type CSVLoaderOptions = LoaderOptions & {\n csv?: {\n // loaders.gl options\n shape?: 'array-row-table' | 'object-row-table' | 'columnar-table';\n /** optimizes memory usage but increases parsing time. */\n optimizeMemoryUsage?: boolean;\n columnPrefix?: string;\n header?: 'auto';\n\n // CSV options (papaparse)\n // delimiter: auto\n // newline: auto\n quoteChar?: string;\n escapeChar?: string;\n // Convert numbers and boolean values in rows from strings\n dynamicTyping?: boolean;\n comments?: boolean;\n skipEmptyLines?: boolean | 'greedy';\n // transform: null?\n delimitersToGuess?: string[];\n // fastMode: auto\n };\n};\n\nconst DEFAULT_CSV_LOADER_OPTIONS = {\n csv: {\n shape: 'object-row-table',\n optimizeMemoryUsage: false,\n // CSV options\n header: 'auto',\n columnPrefix: 'column',\n // delimiter: auto\n // newline: auto\n quoteChar: '\"',\n escapeChar: '\"',\n dynamicTyping: true,\n comments: false,\n skipEmptyLines: true,\n // transform: null?\n delimitersToGuess: [',', '\\t', '|', ';']\n // fastMode: auto\n }\n};\n\nexport const CSVLoader = {\n id: 'csv',\n module: 'csv',\n name: 'CSV',\n version: VERSION,\n extensions: ['csv'],\n mimeTypes: ['text/csv'],\n category: 'table',\n parse: async (arrayBuffer: ArrayBuffer, options?: CSVLoaderOptions) =>\n parseCSV(new TextDecoder().decode(arrayBuffer), options),\n parseText: (text: string, options?: CSVLoaderOptions) => parseCSV(text, options),\n parseInBatches: parseCSVInBatches,\n // @ts-ignore\n // testText: null,\n options: DEFAULT_CSV_LOADER_OPTIONS as CSVLoaderOptions\n};\n\nasync function parseCSV(csvText: string, options?: CSVLoaderOptions) {\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...DEFAULT_CSV_LOADER_OPTIONS.csv, ...options?.csv};\n\n const firstRow = readFirstRow(csvText);\n const header: boolean =\n csvOptions.header === 'auto' ? isHeaderRow(firstRow) : Boolean(csvOptions.header);\n\n const parseWithHeader = header;\n\n const papaparseConfig = {\n // dynamicTyping: true,\n ...csvOptions,\n header: parseWithHeader,\n download: false, // We handle loading, no need for papaparse to do it for us\n transformHeader: parseWithHeader ? duplicateColumnTransformer() : undefined,\n error: (e) => {\n throw new Error(e);\n }\n };\n\n const result = Papa.parse(csvText, papaparseConfig);\n let {data: rows} = result;\n\n const headerRow = result.meta.fields || generateHeader(csvOptions.columnPrefix, firstRow.length);\n\n switch (csvOptions.shape) {\n case 'object-row-table':\n rows = rows.map((row) => (Array.isArray(row) ? convertToObjectRow(row, headerRow) : row));\n break;\n case 'array-row-table':\n rows = rows.map((row) => (Array.isArray(row) ? row : convertToArrayRow(row, headerRow)));\n break;\n default:\n }\n\n /*\n if (!header && shape === 'object-row-table') {\n // If the dataset has no header, transform the array result into an object shape with an\n // autogenerated header\n return result.data.map((row) =>\n row.reduce((acc, value, i) => {\n acc[headerRow[i]] = value;\n return acc;\n }, {})\n );\n }\n */\n return rows;\n}\n\n// TODO - support batch size 0 = no batching/single batch?\nfunction parseCSVInBatches(\n asyncIterator: AsyncIterable<ArrayBuffer> | Iterable<ArrayBuffer>,\n options?: CSVLoaderOptions\n): AsyncIterable<Batch> {\n // Papaparse does not support standard batch size handling\n // TODO - investigate papaparse chunks mode\n options = {...options};\n if (options.batchSize === 'auto') {\n options.batchSize = 4000;\n }\n\n // Apps can call the parse method directly, we so apply default options here\n const csvOptions = {...DEFAULT_CSV_LOADER_OPTIONS.csv, ...options?.csv};\n\n const asyncQueue = new AsyncQueue<Batch>();\n\n let isFirstRow: boolean = true;\n let headerRow: string[] | null = null;\n let tableBatchBuilder: TableBatchBuilder | null = null;\n let schema: Schema | null = null;\n\n const config = {\n // dynamicTyping: true, // Convert numbers and boolean values in rows from strings,\n ...csvOptions,\n header: false, // Unfortunately, header detection is not automatic and does not infer shapes\n download: false, // We handle loading, no need for papaparse to do it for us\n // chunkSize is set to 5MB explicitly (same as Papaparse default) due to a bug where the\n // streaming parser gets stuck if skipEmptyLines and a step callback are both supplied.\n // See https://github.com/mholt/PapaParse/issues/465\n chunkSize: 1024 * 1024 * 5,\n // skipEmptyLines is set to a boolean value if supplied. Greedy is set to true\n // skipEmptyLines is handled manually given two bugs where the streaming parser gets stuck if\n // both of the skipEmptyLines and step callback options are provided:\n // - true doesn't work unless chunkSize is set: https://github.com/mholt/PapaParse/issues/465\n // - greedy doesn't work: https://github.com/mholt/PapaParse/issues/825\n skipEmptyLines: false,\n\n // step is called on every row\n // eslint-disable-next-line complexity\n step(results) {\n let row = results.data;\n\n if (csvOptions.skipEmptyLines) {\n // Manually reject lines that are empty\n const collapsedRow = row.flat().join('').trim();\n if (collapsedRow === '') {\n return;\n }\n }\n const bytesUsed = results.meta.cursor;\n\n // Check if we need to save a header row\n if (isFirstRow && !headerRow) {\n // Auto detects or can be forced with csvOptions.header\n const header = csvOptions.header === 'auto' ? isHeaderRow(row) : Boolean(csvOptions.header);\n if (header) {\n headerRow = row.map(duplicateColumnTransformer());\n return;\n }\n }\n\n // If first data row, we can deduce the schema\n if (isFirstRow) {\n isFirstRow = false;\n if (!headerRow) {\n headerRow = generateHeader(csvOptions.columnPrefix, row.length);\n }\n schema = deduceSchema(row, headerRow);\n }\n\n if (csvOptions.optimizeMemoryUsage) {\n // A workaround to allocate new strings and don't retain pointers to original strings.\n // https://bugs.chromium.org/p/v8/issues/detail?id=2869\n row = JSON.parse(JSON.stringify(row));\n }\n\n // Add the row\n tableBatchBuilder =\n tableBatchBuilder ||\n new TableBatchBuilder(schema, {\n // @ts-expect-error\n shape: csvOptions.shape || 'array-row-table',\n ...options\n });\n\n try {\n tableBatchBuilder.addRow(row);\n // If a batch has been completed, emit it\n const batch = tableBatchBuilder && tableBatchBuilder.getFullBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n },\n\n // complete is called when all rows have been read\n complete(results) {\n try {\n const bytesUsed = results.meta.cursor;\n // Ensure any final (partial) batch gets emitted\n const batch = tableBatchBuilder && tableBatchBuilder.getFinalBatch({bytesUsed});\n if (batch) {\n asyncQueue.enqueue(batch);\n }\n } catch (error) {\n asyncQueue.enqueue(error as Error);\n }\n\n asyncQueue.close();\n }\n };\n\n Papa.parse(asyncIterator, config, AsyncIteratorStreamer);\n\n // TODO - Does it matter if we return asyncIterable or asyncIterator\n // return asyncQueue[Symbol.asyncIterator]();\n return asyncQueue;\n}\n\n/**\n * Checks if a certain row is a header row\n * @param row the row to check\n * @returns true if the row looks like a header\n */\nfunction isHeaderRow(row: string[]): boolean {\n return row && row.every((value) => typeof value === 'string');\n}\n\n/**\n * Reads, parses, and returns the first row of a CSV text\n * @param csvText the csv text to parse\n * @returns the first row\n */\nfunction readFirstRow(csvText: string): any[] {\n const result = Papa.parse(csvText, {\n download: false,\n dynamicTyping: true,\n preview: 1\n });\n return result.data[0];\n}\n\n/**\n * Creates a transformer that renames duplicate columns. This is needed as Papaparse doesn't handle\n * duplicate header columns and would use the latest occurrence by default.\n * See the header option in https://www.papaparse.com/docs#config\n * @returns a transform function that returns sanitized names for duplicate fields\n */\nfunction duplicateColumnTransformer() {\n const observedColumns = new Set();\n return (col) => {\n let colName = col;\n let counter = 1;\n while (observedColumns.has(colName)) {\n colName = `${col}.${counter}`;\n counter++;\n }\n observedColumns.add(colName);\n return colName;\n };\n}\n\n/**\n * Generates the header of a CSV given a prefix and a column count\n * @param columnPrefix the columnPrefix to use\n * @param count the count of column names to generate\n * @returns an array of column names\n */\nfunction generateHeader(columnPrefix: string, count: number = 0): string[] {\n const headers: string[] = [];\n for (let i = 0; i < count; i++) {\n headers.push(`${columnPrefix}${i + 1}`);\n }\n return headers;\n}\n\nfunction deduceSchema(row, headerRow) {\n const schema = headerRow ? {} : [];\n for (let i = 0; i < row.length; i++) {\n const columnName = (headerRow && headerRow[i]) || i;\n const value = row[i];\n switch (typeof value) {\n case 'number':\n case 'boolean':\n // TODO - booleans could be handled differently...\n schema[columnName] = {name: String(columnName), index: i, type: Float32Array};\n break;\n case 'string':\n default:\n schema[columnName] = {name: String(columnName), index: i, type: Array};\n // We currently only handle numeric rows\n // TODO we could offer a function to map strings to numbers?\n }\n }\n return schema;\n}\n\nexport const _typecheckCSVLoader: LoaderWithParser = CSVLoader;\n"],"file":"csv-loader.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/csv",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.14",
|
|
4
4
|
"description": "Framework-independent loader for CSV and DSV table formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"build-bundle": "webpack --display=minimal --config ../../scripts/webpack/bundle.js"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@loaders.gl/loader-utils": "3.0.
|
|
34
|
-
"@loaders.gl/schema": "3.0.
|
|
33
|
+
"@loaders.gl/loader-utils": "3.0.14",
|
|
34
|
+
"@loaders.gl/schema": "3.0.14"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"d3-dsv": "^1.2.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "dc931768fc34de549ef6baeb94e2ee5aa8163baf"
|
|
40
40
|
}
|