@loaders.gl/json 3.1.0-alpha.1 → 3.1.0-alpha.5
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/bundle.d.ts +1 -0
- package/dist/dist.min.js +1 -1
- package/dist/dist.min.js.map +1 -1
- package/dist/es5/bundle.js +7 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/geojson-loader.js +95 -0
- package/dist/es5/geojson-loader.js.map +1 -0
- package/dist/es5/index.js +54 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/json-loader.js +59 -0
- package/dist/es5/json-loader.js.map +1 -0
- package/dist/es5/jsonl-loader.js +2 -0
- package/dist/{jsonl-loader.js.map → es5/jsonl-loader.js.map} +0 -0
- package/dist/{lib → es5/lib}/clarinet/LICENSE +0 -0
- package/dist/es5/lib/clarinet/clarinet.js +566 -0
- package/dist/es5/lib/clarinet/clarinet.js.map +1 -0
- package/dist/es5/lib/jsonpath/jsonpath.js +97 -0
- package/dist/es5/lib/jsonpath/jsonpath.js.map +1 -0
- package/dist/es5/lib/parse-json-in-batches.js +99 -0
- package/dist/es5/lib/parse-json-in-batches.js.map +1 -0
- package/dist/es5/lib/parse-json.js +41 -0
- package/dist/es5/lib/parse-json.js.map +1 -0
- package/dist/es5/lib/parse-ndjson-in-batches.js +46 -0
- package/dist/es5/lib/parse-ndjson-in-batches.js.map +1 -0
- package/dist/es5/lib/parse-ndjson.js +18 -0
- package/dist/es5/lib/parse-ndjson.js.map +1 -0
- package/dist/es5/lib/parser/json-parser.js +139 -0
- package/dist/es5/lib/parser/json-parser.js.map +1 -0
- package/dist/es5/lib/parser/streaming-json-parser.js +107 -0
- package/dist/es5/lib/parser/streaming-json-parser.js.map +1 -0
- package/dist/es5/ndjson-loader.js +42 -0
- package/dist/es5/ndjson-loader.js.map +1 -0
- package/dist/es5/workers/geojson-worker.js +8 -0
- package/dist/es5/workers/geojson-worker.js.map +1 -0
- package/dist/esm/bundle.js +5 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/{geojson-loader.js → esm/geojson-loader.js} +1 -1
- package/dist/esm/geojson-loader.js.map +1 -0
- package/dist/{index.js → esm/index.js} +0 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/{json-loader.js → esm/json-loader.js} +1 -1
- package/dist/esm/json-loader.js.map +1 -0
- package/dist/{jsonl-loader.js → esm/jsonl-loader.js} +0 -0
- package/dist/esm/jsonl-loader.js.map +1 -0
- package/dist/esm/lib/clarinet/LICENSE +28 -0
- package/dist/{lib → esm/lib}/clarinet/clarinet.js +0 -0
- package/dist/esm/lib/clarinet/clarinet.js.map +1 -0
- package/dist/{lib → esm/lib}/jsonpath/jsonpath.js +0 -0
- package/dist/esm/lib/jsonpath/jsonpath.js.map +1 -0
- package/dist/{lib → esm/lib}/parse-json-in-batches.js +0 -0
- package/dist/esm/lib/parse-json-in-batches.js.map +1 -0
- package/dist/{lib → esm/lib}/parse-json.js +0 -0
- package/dist/esm/lib/parse-json.js.map +1 -0
- package/dist/{lib → esm/lib}/parse-ndjson-in-batches.js +1 -1
- package/dist/esm/lib/parse-ndjson-in-batches.js.map +1 -0
- package/dist/{lib → esm/lib}/parse-ndjson.js +1 -1
- package/dist/esm/lib/parse-ndjson.js.map +1 -0
- package/dist/{lib → esm/lib}/parser/json-parser.js +0 -0
- package/dist/esm/lib/parser/json-parser.js.map +1 -0
- package/dist/{lib → esm/lib}/parser/streaming-json-parser.js +0 -0
- package/dist/esm/lib/parser/streaming-json-parser.js.map +1 -0
- package/dist/{ndjson-loader.js → esm/ndjson-loader.js} +1 -1
- package/dist/esm/ndjson-loader.js.map +1 -0
- package/dist/{workers → esm/workers}/geojson-worker.js +0 -0
- package/dist/esm/workers/geojson-worker.js.map +1 -0
- package/dist/geojson-loader.d.ts +15 -0
- package/dist/geojson-worker.js +1 -1
- package/dist/geojson-worker.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/json-loader.d.ts +13 -0
- package/dist/jsonl-loader.d.ts +0 -0
- package/dist/lib/clarinet/clarinet.d.ts +40 -0
- package/dist/lib/jsonpath/jsonpath.d.ts +31 -0
- package/dist/lib/parse-json-in-batches.d.ts +3 -0
- package/dist/lib/parse-json.d.ts +2 -0
- package/dist/lib/parse-ndjson-in-batches.d.ts +3 -0
- package/dist/lib/parse-ndjson.d.ts +1 -0
- package/dist/lib/parser/json-parser.d.ts +17 -0
- package/dist/lib/parser/streaming-json-parser.d.ts +37 -0
- package/dist/ndjson-loader.d.ts +2 -0
- package/dist/workers/geojson-worker.d.ts +1 -0
- package/package.json +9 -8
- package/src/bundle.ts +2 -3
- package/dist/bundle.js +0 -7
- package/dist/bundle.js.map +0 -1
- package/dist/geojson-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json-loader.js.map +0 -1
- package/dist/lib/clarinet/clarinet.js.map +0 -1
- package/dist/lib/jsonpath/jsonpath.js.map +0 -1
- package/dist/lib/parse-json-in-batches.js.map +0 -1
- package/dist/lib/parse-json.js.map +0 -1
- package/dist/lib/parse-ndjson-in-batches.js.map +0 -1
- package/dist/lib/parse-ndjson.js.map +0 -1
- package/dist/lib/parser/json-parser.js.map +0 -1
- package/dist/lib/parser/streaming-json-parser.js.map +0 -1
- package/dist/ndjson-loader.js.map +0 -1
- package/dist/workers/geojson-worker.js.map +0 -1
package/dist/bundle.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const moduleExports: any;
|
package/dist/dist.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var n in s)("object"==typeof exports?exports:t)[n]=s[n]}}(window,(function(){return function(t){var e={};function s(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,s),o.l=!0,o.exports}return s.m=t,s.c=e,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)s.d(n,o,function(e){return t[e]}.bind(null,o));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=0)}([function(t,e,s){(function(e){const n=s(4),o="undefined"==typeof window?e:window;o.loaders=o.loaders||{},t.exports=Object.assign(o.loaders,n)}).call(this,s(3))},,,function(t,e){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(t){"object"==typeof window&&(s=window)}t.exports=s},function(t,e,s){"use strict";function n(t,e){try{var s;const n=JSON.parse(t);return null!==(s=e.json)&&void 0!==s&&s.table&&function t(e){if(Array.isArray(e))return e;if(e&&"object"==typeof e)for(const s of Object.values(e)){const e=t(s);if(e)return e}return null}(n)||n}catch(t){throw new Error("JSONLoader: failed to parse JSON")}}function o(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}s.r(e),s.d(e,"JSONLoader",(function(){return ht})),s.d(e,"NDJSONLoader",(function(){return lt})),s.d(e,"_GeoJSONLoader",(function(){return _t})),s.d(e,"_GeoJSONWorkerLoader",(function(){return Ot})),s.d(e,"_JSONPath",(function(){return st})),s.d(e,"_ClarinetParser",(function(){return X}));class i{constructor(t,e){if(o(this,"schema",void 0),o(this,"options",void 0),o(this,"length",0),o(this,"rows",null),o(this,"cursor",0),o(this,"_headers",[]),this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;if(!t)return null;t=t.slice(0,this.length),this.rows=null;return{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}}}function r(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class a{constructor(t,e){if(r(this,"schema",void 0),r(this,"options",void 0),r(this,"length",0),r(this,"objectRows",null),r(this,"arrayRows",null),r(this,"cursor",0),r(this,"_headers",[]),this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this.options.shape){case"object-row-table":const s=function(t,e){if(!t)throw new Error("null row");if(!e)throw new Error("no headers");const s={};for(let n=0;n<e.length;n++)s[e[n]]=t[n];return s}(t,this._headers);this.addObjectRow(s,e);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(100),this.arrayRows[this.length]=t,this.length++}}addObjectRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this.options.shape){case"array-row-table":const s=function(t,e){if(!t)throw new Error("null row");if(!e)throw new Error("no headers");const s=new Array(e.length);for(let n=0;n<e.length;n++)s[n]=t[e[n]];return s}(t,this._headers);this.addArrayRow(s,e);break;case"object-row-table":this.objectRows=this.objectRows||new Array(100),this.objectRows[this.length]=t,this.length++}}getBatch(){let t=this.arrayRows||this.objectRows;return t?(t=t.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}}function h(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class c{constructor(t,e){h(this,"schema",void 0),h(this,"length",0),h(this,"allocated",0),h(this,"columns",{}),this.schema=t,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(t){this._reallocateColumns();let e=0;for(const s in this.columns)this.columns[s][this.length]=t[e++];this.length++}addObjectRow(t){this._reallocateColumns();for(const e in t)this.columns[e][this.length]=t[e];this.length++}getBatch(){this._pruneColumns();const t=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(const e in this.schema){const s=this.schema[e];t[s.name]=this.columns[s.index]}this.columns={};return{shape:"columnar-table",batchType:"data",data:t,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 t in this.schema){const e=this.schema[t],s=e.type||Float32Array,n=this.columns[e.index];if(n&&ArrayBuffer.isView(n)){const t=new s(this.allocated);t.set(n),this.columns[e.index]=t}else n?(n.length=this.allocated,this.columns[e.index]=n):this.columns[e.index]=new s(this.allocated)}}}_pruneColumns(){for(const[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}}function l(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const u={shape:"array-row-table",batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0};class p{constructor(t,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={...u,...e}}limitReached(){var t,e;return!!(Boolean(null===(t=this.options)||void 0===t?void 0:t.limit)&&this.totalLength>=this.options.limit)||!!(Boolean(null===(e=this.options)||void 0===e?void 0:e._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),"string"==typeof t&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?8*t.length:8*Object.keys(t).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(t){if(!this.aggregator)return null;null!=t&&t.bytesUsed&&(this.bytesUsed=t.bytesUsed);const e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"row-table":return i;case"array-row-table":case"object-row-table":return a;case"columnar-table":return c;case"arrow-table":if(!p.ArrowBatch)throw new Error("TableBatchBuilder");return p.ArrowBatch;default:throw new Error("TableBatchBuilder")}}}async function*d(t,e={}){const s=new TextDecoder(void 0,e);for await(const e of t)yield"string"==typeof e?e:s.decode(e,{stream:!0})}l(p,"ArrowBatch",void 0);const f=Number.MAX_SAFE_INTEGER,g="debug"==={}.CDEBUG,y={textNode:void 0,numberNode:""};let b=0;const w={BEGIN:b++,VALUE:b++,OPEN_OBJECT:b++,CLOSE_OBJECT:b++,OPEN_ARRAY:b++,CLOSE_ARRAY:b++,TEXT_ESCAPE:b++,STRING:b++,BACKSLASH:b++,END:b++,OPEN_KEY:b++,CLOSE_KEY:b++,TRUE:b++,TRUE2:b++,TRUE3:b++,FALSE:b++,FALSE2:b++,FALSE3:b++,FALSE4:b++,NULL:b++,NULL2:b++,NULL3:b++,NUMBER_DECIMAL_POINT:b++,NUMBER_DIGIT:b++};for(var m in w)w[w[m]]=m;b=w;const A=9,j=10,P=13,v=32,E=34,S=43,O=44,_=45,N=46,C=48,L=57,I=58,R=69,B=91,x=92,k=93,U=97,F=98,T=101,J=102,M=108,z=110,D=114,Y=115,G=116,V=117,K=123,$=125;var q=/[\\"\n]/g;class X{constructor(t={}){this._initialize(t)}_initialize(t){this._clearBuffers(this),this.bufferCheckPosition=f,this.q="",this.c="",this.p="",this.options=t||{},this.closed=!1,this.closedRoot=!1,this.sawRoot=!1,this.tag=null,this.error=null,this.state=b.BEGIN,this.stack=new Array,this.position=this.column=0,this.line=1,this.slashed=!1,this.unicodeI=0,this.unicodeS=null,this.depth=0,"onready"in t&&(this.onready=t.onready),"onopenobject"in t&&(this.onopenobject=t.onopenobject),"onkey"in t&&(this.onkey=t.onkey),"oncloseobject"in t&&(this.oncloseobject=t.oncloseobject),"onopenarray"in t&&(this.onopenarray=t.onopenarray),"onclosearray"in t&&(this.onclosearray=t.onclosearray),"onvalue"in t&&(this.onvalue=t.onvalue),"onerror"in t&&(this.onerror=t.onerror),"onend"in t&&(this.onend=t.onend),"onchunkparsed"in t&&(this.onchunkparsed=t.onchunkparsed),H(this,"onready")}_clearBuffers(){for(var t in y)this[t]=y[t]}end(){return this.state===b.VALUE&&0===this.depth||tt(this,"Unexpected end"),Q(this),this.c="",this.closed=!0,H(this,"onend"),this._initialize(this.options),this}resume(){return this.error=null,this}close(){return this.write(null)}write(t){if(this.error)throw this.error;if(this.closed)return tt(this,"Cannot write after close. Assign an onready handler.");if(null===t)return this.end();var e=0,s=t.charCodeAt(0),n=this.p;for(g&&console.log("write -> ["+t+"]");s&&(n=s,this.c=s=t.charCodeAt(e++),n!==s?this.p=n:n=this.p,s);)switch(g&&console.log(e,s,w[this.state]),this.position++,s===j?(this.line++,this.column=0):this.column++,this.state){case b.BEGIN:s===K?this.state=b.OPEN_OBJECT:s===B?this.state=b.OPEN_ARRAY:et(s)||tt(this,"Non-whitespace before {[.");continue;case b.OPEN_KEY:case b.OPEN_OBJECT:if(et(s))continue;if(this.state===b.OPEN_KEY)this.stack.push(b.CLOSE_KEY);else{if(s===$){H(this,"onopenobject"),this.depth++,H(this,"oncloseobject"),this.depth--,this.state=this.stack.pop()||b.VALUE;continue}this.stack.push(b.CLOSE_OBJECT)}s===E?this.state=b.STRING:tt(this,'Malformed object key should start with "');continue;case b.CLOSE_KEY:case b.CLOSE_OBJECT:if(et(s))continue;this.state,b.CLOSE_KEY;s===I?(this.state===b.CLOSE_OBJECT?(this.stack.push(b.CLOSE_OBJECT),Q(this,"onopenobject"),this.depth++):Q(this,"onkey"),this.state=b.VALUE):s===$?(W(this,"oncloseobject"),this.depth--,this.state=this.stack.pop()||b.VALUE):s===O?(this.state===b.CLOSE_OBJECT&&this.stack.push(b.CLOSE_OBJECT),Q(this),this.state=b.OPEN_KEY):tt(this,"Bad object");continue;case b.OPEN_ARRAY:case b.VALUE:if(et(s))continue;if(this.state===b.OPEN_ARRAY){if(H(this,"onopenarray"),this.depth++,this.state=b.VALUE,s===k){H(this,"onclosearray"),this.depth--,this.state=this.stack.pop()||b.VALUE;continue}this.stack.push(b.CLOSE_ARRAY)}s===E?this.state=b.STRING:s===K?this.state=b.OPEN_OBJECT:s===B?this.state=b.OPEN_ARRAY:s===G?this.state=b.TRUE:s===J?this.state=b.FALSE:s===z?this.state=b.NULL:s===_?this.numberNode+="-":C<=s&&s<=L?(this.numberNode+=String.fromCharCode(s),this.state=b.NUMBER_DIGIT):tt(this,"Bad value");continue;case b.CLOSE_ARRAY:if(s===O)this.stack.push(b.CLOSE_ARRAY),Q(this,"onvalue"),this.state=b.VALUE;else if(s===k)W(this,"onclosearray"),this.depth--,this.state=this.stack.pop()||b.VALUE;else{if(et(s))continue;tt(this,"Bad array")}continue;case b.STRING:void 0===this.textNode&&(this.textNode="");var o=e-1,i=this.slashed,r=this.unicodeI;t:for(;;){for(g&&console.log(e,s,w[this.state],i);r>0;)if(this.unicodeS+=String.fromCharCode(s),s=t.charCodeAt(e++),this.position++,4===r?(this.textNode+=String.fromCharCode(parseInt(this.unicodeS,16)),r=0,o=e-1):r++,!s)break t;if(s===E&&!i){this.state=this.stack.pop()||b.VALUE,this.textNode+=t.substring(o,e-1),this.position+=e-1-o;break}if(s===x&&!i&&(i=!0,this.textNode+=t.substring(o,e-1),this.position+=e-1-o,s=t.charCodeAt(e++),this.position++,!s))break;if(i){if(i=!1,s===z?this.textNode+="\n":s===D?this.textNode+="\r":s===G?this.textNode+="\t":s===J?this.textNode+="\f":s===F?this.textNode+="\b":s===V?(r=1,this.unicodeS=""):this.textNode+=String.fromCharCode(s),s=t.charCodeAt(e++),this.position++,o=e-1,s)continue;break}q.lastIndex=e;var a=q.exec(t);if(null===a){e=t.length+1,this.textNode+=t.substring(o,e-1),this.position+=e-1-o;break}if(e=a.index+1,!(s=t.charCodeAt(a.index))){this.textNode+=t.substring(o,e-1),this.position+=e-1-o;break}}this.slashed=i,this.unicodeI=r;continue;case b.TRUE:s===D?this.state=b.TRUE2:tt(this,"Invalid true started with t"+s);continue;case b.TRUE2:s===V?this.state=b.TRUE3:tt(this,"Invalid true started with tr"+s);continue;case b.TRUE3:s===T?(H(this,"onvalue",!0),this.state=this.stack.pop()||b.VALUE):tt(this,"Invalid true started with tru"+s);continue;case b.FALSE:s===U?this.state=b.FALSE2:tt(this,"Invalid false started with f"+s);continue;case b.FALSE2:s===M?this.state=b.FALSE3:tt(this,"Invalid false started with fa"+s);continue;case b.FALSE3:s===Y?this.state=b.FALSE4:tt(this,"Invalid false started with fal"+s);continue;case b.FALSE4:s===T?(H(this,"onvalue",!1),this.state=this.stack.pop()||b.VALUE):tt(this,"Invalid false started with fals"+s);continue;case b.NULL:s===V?this.state=b.NULL2:tt(this,"Invalid null started with n"+s);continue;case b.NULL2:s===M?this.state=b.NULL3:tt(this,"Invalid null started with nu"+s);continue;case b.NULL3:s===M?(H(this,"onvalue",null),this.state=this.stack.pop()||b.VALUE):tt(this,"Invalid null started with nul"+s);continue;case b.NUMBER_DECIMAL_POINT:s===N?(this.numberNode+=".",this.state=b.NUMBER_DIGIT):tt(this,"Leading zero not followed by .");continue;case b.NUMBER_DIGIT:C<=s&&s<=L?this.numberNode+=String.fromCharCode(s):s===N?(-1!==this.numberNode.indexOf(".")&&tt(this,"Invalid number has two dots"),this.numberNode+="."):s===T||s===R?(-1===this.numberNode.indexOf("e")&&-1===this.numberNode.indexOf("E")||tt(this,"Invalid number has two exponential"),this.numberNode+="e"):s===S||s===_?(n!==T&&n!==R&&tt(this,"Invalid symbol in number"),this.numberNode+=String.fromCharCode(s)):(Z(this),e--,this.state=this.stack.pop()||b.VALUE);continue;default:tt(this,"Unknown state: "+this.state)}return this.position>=this.bufferCheckPosition&&function(t){const e=Math.max(f,10);let s=0;for(var n in y){var o=void 0===t[n]?0:t[n].length;if(o>e)switch(n){case"text":closeText(t);break;default:tt(t,"Max buffer length exceeded: "+n)}s=Math.max(s,o)}t.bufferCheckPosition=f-s+t.position}(this),H(this,"onchunkparsed"),this}}function H(t,e,s){g&&console.log("-- emit",e,s),t[e]&&t[e](s,t)}function W(t,e,s){Q(t),H(t,e,s)}function Q(t,e){t.textNode=function(t,e){if(void 0===e)return e;t.trim&&(e=e.trim());t.normalize&&(e=e.replace(/\s+/g," "));return e}(t.options,t.textNode),void 0!==t.textNode&&H(t,e||"onvalue",t.textNode),t.textNode=void 0}function Z(t){t.numberNode&&H(t,"onvalue",parseFloat(t.numberNode)),t.numberNode=""}function tt(t,e){return Q(t),e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c,e=new Error(e),t.error=e,H(t,"onerror",e),t}function et(t){return t===P||t===j||t===v||t===A}class st{constructor(t=null){var e,s,n;if(n=void 0,(s="path")in(e=this)?Object.defineProperty(e,s,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[s]=n,this.path=["$"],t instanceof st)this.path=[...t.path];else if(Array.isArray(t))this.path.push(...t);else if("string"==typeof t&&(this.path=t.split("."),"$"!==this.path[0]))throw new Error("JSONPaths must start with $")}clone(){return new st(this)}toString(){return this.path.join(".")}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let e=0;e<this.path.length;++e)if(this.path[e]!==t.path[e])return!1;return!0}setFieldAtPath(t,e){const s=[...this.path];s.shift();const n=s.pop();for(const e of s)t=t[e];t[n]=e}getFieldAtPath(t){const e=[...this.path];e.shift();const s=e.pop();for(const s of e)t=t[s];return t[s]}}function nt(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function ot(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class it extends class{constructor(){nt(this,"jsonpath",void 0),nt(this,"_parser",void 0),this.reset(),this._initializeParser()}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new st}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){const{container:e,key:s}=this.currentState;null!==s?(e[s]=t,this.currentState.key=null):e.push(t)}_openArray(t=[]){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(t={}){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_initializeParser(){this._parser=new X({onready:()=>{this.jsonpath=new st,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:t=>{this._openObject({}),void 0!==t&&this.parser.onkey(t)},onkey:t=>{this.jsonpath.set(t),this.currentState.key=t},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:t=>{this._pushOrSet(t)},onerror:t=>{throw t},onend:()=>{this.result=this.currentState.container.pop()}})}get parser(){return this._parser}}{constructor(t={}){super(),ot(this,"jsonPaths",void 0),ot(this,"streamingJsonPath",null),ot(this,"streamingArray",null),ot(this,"topLevelObject",null);const e=t.jsonpaths||[];this.jsonPaths=e.map(t=>new st(t)),this._extendParser()}write(t){super.write(t);let e=[];return this.streamingArray&&(e=[...this.streamingArray],this.streamingArray.length=0),e}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){const t=this.getJsonPath();if(0===this.jsonPaths.length)return!0;for(const e of this.jsonPaths)if(e.equals(t))return!0;return!1}_extendParser(){this.parser.onopenarray=()=>{if(!this.streamingArray&&this._matchJSONPath())return this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],void this._openArray(this.streamingArray);this._openArray()},this.parser.onopenobject=t=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),void 0!==t&&this.parser.onkey(t)}}}async function*rt(t,e){var s;const n=d(t),{metadata:o}=e,{jsonpaths:i}=e.json||{};let r=!0;const a=(null==e||null===(s=e.json)||void 0===s?void 0:s.shape)||"row-table",h=new p(null,{...e,shape:a}),c=new it({jsonpaths:i});for await(const t of n){const e=c.write(t),s=e.length>0&&c.getStreamingJsonPathAsString();if(e.length>0&&r){if(o){const t={shape:a,batchType:"partial-result",data:[],length:0,bytesUsed:0,container:c.getPartialResult(),jsonpath:s};yield t}r=!1}for(const t of e){h.addRow(t);const e=h.getFullBatch({jsonpath:s});e&&(yield e)}h.chunkComplete(t);const n=h.getFullBatch({jsonpath:s});n&&(yield n)}const l=c.getStreamingJsonPathAsString(),u=h.getFinalBatch({jsonpath:l});if(u&&(yield u),o){const t={shape:a,batchType:"final-result",container:c.getPartialResult(),jsonpath:c.getStreamingJsonPathAsString(),data:[],length:0};yield t}}const at={json:{shape:"row-table",table:!1,jsonpaths:[]}},ht={name:"JSON",id:"json",module:"json",version:"3.1.0-alpha.1",extensions:["json","geojson"],mimeTypes:["application/json"],category:"table",text:!0,parse:async function(t,e){return ct((new TextDecoder).decode(t),e)},parseTextSync:ct,parseInBatches:function(t,e){const s={...e,json:{...at.json,...null==e?void 0:e.json}};return rt(t,s)},options:at};function ct(t,e){return n(t,{...e,json:{...at.json,...null==e?void 0:e.json}})}const lt={name:"NDJSON",id:"ndjson",module:"json",version:"3.1.0-alpha.1",extensions:["ndjson"],mimeTypes:["application/x-ndjson"],category:"table",text:!0,parse:async function(t){return ut((new TextDecoder).decode(t))},parseTextSync:ut,parseInBatches:function(t,e){return async function*(t,e){const s=async function*(t){let e=1;for await(const s of t)yield{counter:e,line:s},e++}(async function*(t){let e="";for await(const s of t){let t;for(e+=s;(t=e.indexOf("\n"))>=0;){const s=e.slice(0,t+1);e=e.slice(t+1),yield s}}e.length>0&&(yield e)}(d(t))),n=new p(null,{...e,shape:"row-table"});for await(const{counter:t,line:e}of s)try{const t=JSON.parse(e);n.addRow(t),n.chunkComplete(e);const s=n.getFullBatch();s&&(yield s)}catch(e){throw new Error("NDJSONLoader: failed to parse JSON on line "+t)}const o=n.getFinalBatch();o&&(yield o)}(t,e)},options:{}};function ut(t){return t.trim().split("\n").map((t,e)=>{try{return JSON.parse(t)}catch(t){throw new Error("NDJSONLoader: failed to parse JSON on line "+(e+1))}})}function pt(t,e={}){const s=dt(t);return ft(t,s,{coordLength:e.coordLength||s.coordLength,numericPropKeys:e.numericPropKeys||s.numericPropKeys,PositionDataType:e.PositionDataType||Float32Array})}function dt(t){let e=0,s=0,n=0,o=0,i=0,r=0,a=0,h=0,c=0;const l=new Set,u={};for(const d of t){const t=d.geometry;switch(t.type){case"Point":s++,e++,l.add(t.coordinates.length);break;case"MultiPoint":s++,e+=t.coordinates.length;for(const e of t.coordinates)l.add(e.length);break;case"LineString":i++,n+=t.coordinates.length,o++;for(const e of t.coordinates)l.add(e.length);break;case"MultiLineString":i++;for(const e of t.coordinates){n+=e.length,o++;for(const t of e)l.add(t.length)}break;case"Polygon":c++,a++,h+=t.coordinates.length,r+=Et(t.coordinates).length;for(const e of Et(t.coordinates))l.add(e.length);break;case"MultiPolygon":c++;for(const e of t.coordinates){a++,h+=e.length,r+=Et(e).length;for(const t of Et(e))l.add(t.length)}break;default:throw new Error("Unsupported geometry type: "+t.type)}if(d.properties)for(const t in d.properties){const e=d.properties[t];u[t]=u[t]||void 0===u[t]?(p=e,Number.isFinite(p)):u[t]}}var p;return{coordLength:l.size>0?Math.max(...l):2,pointPositionsCount:e,pointFeaturesCount:s,linePositionsCount:n,linePathsCount:o,lineFeaturesCount:i,polygonPositionsCount:r,polygonObjectsCount:a,polygonRingsCount:h,polygonFeaturesCount:c,numericPropKeys:Object.keys(u).filter(t=>u[t])}}function ft(t,e,s){const{pointPositionsCount:n,pointFeaturesCount:o,linePositionsCount:i,linePathsCount:r,lineFeaturesCount:a,polygonPositionsCount:h,polygonObjectsCount:c,polygonRingsCount:l,polygonFeaturesCount:u}=e,{coordLength:p,numericPropKeys:d,PositionDataType:f=Float32Array}=s,g=t.length>65535?Uint32Array:Uint16Array,y={positions:new f(n*p),globalFeatureIds:new g(n),featureIds:o>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:Array(),fields:Array()},b={positions:new f(i*p),pathIndices:i>65535?new Uint32Array(r+1):new Uint16Array(r+1),globalFeatureIds:new g(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:Array(),fields:Array()},w={positions:new f(h*p),polygonIndices:h>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:h>65535?new Uint32Array(l+1):new Uint16Array(l+1),globalFeatureIds:new g(h),featureIds:u>65535?new Uint32Array(h):new Uint16Array(h),numericProps:{},properties:Array(),fields:Array()};for(const t of[y,b,w])for(const e of d||[])t.numericProps[e]=new Float32Array(t.positions.length/p);b.pathIndices[r]=i,w.polygonIndices[c]=h,w.primitivePolygonIndices[l]=h;const m={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(const e of t){const t=e.geometry,s=e.properties||{};switch(t.type){case"Point":gt(t.coordinates,y,m,p,s),y.properties.push(Pt(s,d)),m.pointFeature++;break;case"MultiPoint":yt(t.coordinates,y,m,p,s),y.properties.push(Pt(s,d)),m.pointFeature++;break;case"LineString":bt(t.coordinates,b,m,p,s),b.properties.push(Pt(s,d)),m.lineFeature++;break;case"MultiLineString":wt(t.coordinates,b,m,p,s),b.properties.push(Pt(s,d)),m.lineFeature++;break;case"Polygon":mt(t.coordinates,w,m,p,s),w.properties.push(Pt(s,d)),m.polygonFeature++;break;case"MultiPolygon":At(t.coordinates,w,m,p,s),w.properties.push(Pt(s,d)),m.polygonFeature++;break;default:throw new Error("Invalid geometry type")}m.feature++}return function(t,e,s,n){const o={points:{...t,positions:{value:t.positions,size:n},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},type:"Point"},lines:{...e,pathIndices:{value:e.pathIndices,size:1},positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},type:"LineString"},polygons:{...s,polygonIndices:{value:s.polygonIndices,size:1},primitivePolygonIndices:{value:s.primitivePolygonIndices,size:1},positions:{value:s.positions,size:n},globalFeatureIds:{value:s.globalFeatureIds,size:1},featureIds:{value:s.featureIds,size:1},type:"Polygon"}};for(const t in o)for(const e in o[t].numericProps)o[t].numericProps[e]={value:o[t].numericProps[e],size:1};return o}(y,b,w,p)}function gt(t,e,s,n,o){e.positions.set(t,s.pointPosition*n),e.globalFeatureIds[s.pointPosition]=s.feature,e.featureIds[s.pointPosition]=s.pointFeature,jt(e,o,s.pointPosition,1),s.pointPosition++}function yt(t,e,s,n,o){for(const i of t)gt(i,e,s,n,o)}function bt(t,e,s,n,o){e.pathIndices[s.linePath]=s.linePosition,s.linePath++,vt(e.positions,t,s.linePosition,n);const i=t.length;jt(e,o,s.linePosition,i),e.globalFeatureIds.set(new Uint32Array(i).fill(s.feature),s.linePosition),e.featureIds.set(new Uint32Array(i).fill(s.lineFeature),s.linePosition),s.linePosition+=i}function wt(t,e,s,n,o){for(const i of t)bt(i,e,s,n,o)}function mt(t,e,s,n,o){e.polygonIndices[s.polygonObject]=s.polygonPosition,s.polygonObject++;for(const i of t){e.primitivePolygonIndices[s.polygonRing]=s.polygonPosition,s.polygonRing++,vt(e.positions,i,s.polygonPosition,n);const t=i.length;jt(e,o,s.polygonPosition,t),e.globalFeatureIds.set(new Uint32Array(t).fill(s.feature),s.polygonPosition),e.featureIds.set(new Uint32Array(t).fill(s.polygonFeature),s.polygonPosition),s.polygonPosition+=t}}function At(t,e,s,n,o){for(const i of t)mt(i,e,s,n,o)}function jt(t,e,s,n){for(const o in t.numericProps)o in e&&t.numericProps[o].set(new Array(n).fill(e[o]),s)}function Pt(t,e){const s={};for(const n in t)e.includes(n)||(s[n]=t[n]);return s}function vt(t,e,s,n){let o=s*n;for(const s of e)t.set(s,o),o+=n}function Et(t){return[].concat(...t)}const St={geojson:{shape:"object-row-table"},json:{jsonpaths:["$","$.features"]},gis:{format:"geojson"}},Ot={name:"GeoJSON",id:"geojson",module:"geojson",version:"3.1.0-alpha.1",worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:St},_t={...Ot,parse:async function(t,e){return Nt((new TextDecoder).decode(t),e)},parseTextSync:Nt,parseInBatches:function(t,e){(e={...St,...e}).json={...St.geojson,...e.geojson};const s=rt(t,e);switch(e.gis.format){case"binary":return async function*(t){for await(const e of t)e.data=pt(e.data),yield e}(s);default:return s}}};function Nt(t,e){(e={...St,...e}).json={...St.geojson,...e.geojson},e.gis=e.gis||{};const s=n(t,e);switch(e.gis.format){case"binary":return pt(s);default:return s}}}])}));
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var o in s)("object"==typeof exports?exports:t)[o]=s[o]}}(window,(function(){return function(t){var e={};function s(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=t,s.c=e,s.d=function(t,e,o){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(s.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)s.d(o,n,function(e){return t[e]}.bind(null,n));return o},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=0)}([function(t,e,s){const o=s(3);globalThis.loaders=globalThis.loaders||{},t.exports=Object.assign(globalThis.loaders,o)},,,function(t,e,s){"use strict";function o(t,e){try{var s;const o=JSON.parse(t);return null!==(s=e.json)&&void 0!==s&&s.table&&function t(e){if(Array.isArray(e))return e;if(e&&"object"==typeof e)for(const s of Object.values(e)){const e=t(s);if(e)return e}return null}(o)||o}catch(t){throw new Error("JSONLoader: failed to parse JSON")}}function n(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}s.r(e),s.d(e,"JSONLoader",(function(){return ht})),s.d(e,"NDJSONLoader",(function(){return lt})),s.d(e,"_GeoJSONLoader",(function(){return _t})),s.d(e,"_GeoJSONWorkerLoader",(function(){return Ot})),s.d(e,"_JSONPath",(function(){return st})),s.d(e,"_ClarinetParser",(function(){return X}));class i{constructor(t,e){if(n(this,"schema",void 0),n(this,"options",void 0),n(this,"length",0),n(this,"rows",null),n(this,"cursor",0),n(this,"_headers",[]),this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;if(!t)return null;t=t.slice(0,this.length),this.rows=null;return{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}}}function r(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class a{constructor(t,e){if(r(this,"schema",void 0),r(this,"options",void 0),r(this,"length",0),r(this,"objectRows",null),r(this,"arrayRows",null),r(this,"cursor",0),r(this,"_headers",[]),this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(const e in t)this._headers[t[e].index]=t[e].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this.options.shape){case"object-row-table":const s=function(t,e){if(!t)throw new Error("null row");if(!e)throw new Error("no headers");const s={};for(let o=0;o<e.length;o++)s[e[o]]=t[o];return s}(t,this._headers);this.addObjectRow(s,e);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(100),this.arrayRows[this.length]=t,this.length++}}addObjectRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this.options.shape){case"array-row-table":const s=function(t,e){if(!t)throw new Error("null row");if(!e)throw new Error("no headers");const s=new Array(e.length);for(let o=0;o<e.length;o++)s[o]=t[e[o]];return s}(t,this._headers);this.addArrayRow(s,e);break;case"object-row-table":this.objectRows=this.objectRows||new Array(100),this.objectRows[this.length]=t,this.length++}}getBatch(){let t=this.arrayRows||this.objectRows;return t?(t=t.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}}function h(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class c{constructor(t,e){h(this,"schema",void 0),h(this,"length",0),h(this,"allocated",0),h(this,"columns",{}),this.schema=t,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(t){this._reallocateColumns();let e=0;for(const s in this.columns)this.columns[s][this.length]=t[e++];this.length++}addObjectRow(t){this._reallocateColumns();for(const e in t)this.columns[e][this.length]=t[e];this.length++}getBatch(){this._pruneColumns();const t=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(const e in this.schema){const s=this.schema[e];t[s.name]=this.columns[s.index]}this.columns={};return{shape:"columnar-table",batchType:"data",data:t,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 t in this.schema){const e=this.schema[t],s=e.type||Float32Array,o=this.columns[e.index];if(o&&ArrayBuffer.isView(o)){const t=new s(this.allocated);t.set(o),this.columns[e.index]=t}else o?(o.length=this.allocated,this.columns[e.index]=o):this.columns[e.index]=new s(this.allocated)}}}_pruneColumns(){for(const[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}}function l(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}const u={shape:"array-row-table",batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0};class p{constructor(t,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={...u,...e}}limitReached(){var t,e;return!!(Boolean(null===(t=this.options)||void 0===t?void 0:t.limit)&&this.totalLength>=this.options.limit)||!!(Boolean(null===(e=this.options)||void 0===e?void 0:e._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){const t=this._getTableBatchType();this.aggregator=new t(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),"string"==typeof t&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?8*t.length:8*Object.keys(t).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(t){if(!this.aggregator)return null;null!=t&&t.bytesUsed&&(this.bytesUsed=t.bytesUsed);const e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"row-table":return i;case"array-row-table":case"object-row-table":return a;case"columnar-table":return c;case"arrow-table":if(!p.ArrowBatch)throw new Error("TableBatchBuilder");return p.ArrowBatch;default:throw new Error("TableBatchBuilder")}}}async function*d(t,e={}){const s=new TextDecoder(void 0,e);for await(const e of t)yield"string"==typeof e?e:s.decode(e,{stream:!0})}l(p,"ArrowBatch",void 0);const f=Number.MAX_SAFE_INTEGER,g="debug"==={}.CDEBUG,y={textNode:void 0,numberNode:""};let b=0;const w={BEGIN:b++,VALUE:b++,OPEN_OBJECT:b++,CLOSE_OBJECT:b++,OPEN_ARRAY:b++,CLOSE_ARRAY:b++,TEXT_ESCAPE:b++,STRING:b++,BACKSLASH:b++,END:b++,OPEN_KEY:b++,CLOSE_KEY:b++,TRUE:b++,TRUE2:b++,TRUE3:b++,FALSE:b++,FALSE2:b++,FALSE3:b++,FALSE4:b++,NULL:b++,NULL2:b++,NULL3:b++,NUMBER_DECIMAL_POINT:b++,NUMBER_DIGIT:b++};for(var m in w)w[w[m]]=m;b=w;const A=9,j=10,P=13,v=32,E=34,S=43,O=44,_=45,N=46,C=48,L=57,I=58,R=69,B=91,k=92,x=93,U=97,T=98,F=101,J=102,M=108,z=110,D=114,Y=115,G=116,V=117,K=123,$=125;var q=/[\\"\n]/g;class X{constructor(t={}){this._initialize(t)}_initialize(t){this._clearBuffers(this),this.bufferCheckPosition=f,this.q="",this.c="",this.p="",this.options=t||{},this.closed=!1,this.closedRoot=!1,this.sawRoot=!1,this.tag=null,this.error=null,this.state=b.BEGIN,this.stack=new Array,this.position=this.column=0,this.line=1,this.slashed=!1,this.unicodeI=0,this.unicodeS=null,this.depth=0,"onready"in t&&(this.onready=t.onready),"onopenobject"in t&&(this.onopenobject=t.onopenobject),"onkey"in t&&(this.onkey=t.onkey),"oncloseobject"in t&&(this.oncloseobject=t.oncloseobject),"onopenarray"in t&&(this.onopenarray=t.onopenarray),"onclosearray"in t&&(this.onclosearray=t.onclosearray),"onvalue"in t&&(this.onvalue=t.onvalue),"onerror"in t&&(this.onerror=t.onerror),"onend"in t&&(this.onend=t.onend),"onchunkparsed"in t&&(this.onchunkparsed=t.onchunkparsed),H(this,"onready")}_clearBuffers(){for(var t in y)this[t]=y[t]}end(){return this.state===b.VALUE&&0===this.depth||tt(this,"Unexpected end"),Q(this),this.c="",this.closed=!0,H(this,"onend"),this._initialize(this.options),this}resume(){return this.error=null,this}close(){return this.write(null)}write(t){if(this.error)throw this.error;if(this.closed)return tt(this,"Cannot write after close. Assign an onready handler.");if(null===t)return this.end();var e=0,s=t.charCodeAt(0),o=this.p;for(g&&console.log("write -> ["+t+"]");s&&(o=s,this.c=s=t.charCodeAt(e++),o!==s?this.p=o:o=this.p,s);)switch(g&&console.log(e,s,w[this.state]),this.position++,s===j?(this.line++,this.column=0):this.column++,this.state){case b.BEGIN:s===K?this.state=b.OPEN_OBJECT:s===B?this.state=b.OPEN_ARRAY:et(s)||tt(this,"Non-whitespace before {[.");continue;case b.OPEN_KEY:case b.OPEN_OBJECT:if(et(s))continue;if(this.state===b.OPEN_KEY)this.stack.push(b.CLOSE_KEY);else{if(s===$){H(this,"onopenobject"),this.depth++,H(this,"oncloseobject"),this.depth--,this.state=this.stack.pop()||b.VALUE;continue}this.stack.push(b.CLOSE_OBJECT)}s===E?this.state=b.STRING:tt(this,'Malformed object key should start with "');continue;case b.CLOSE_KEY:case b.CLOSE_OBJECT:if(et(s))continue;this.state,b.CLOSE_KEY;s===I?(this.state===b.CLOSE_OBJECT?(this.stack.push(b.CLOSE_OBJECT),Q(this,"onopenobject"),this.depth++):Q(this,"onkey"),this.state=b.VALUE):s===$?(W(this,"oncloseobject"),this.depth--,this.state=this.stack.pop()||b.VALUE):s===O?(this.state===b.CLOSE_OBJECT&&this.stack.push(b.CLOSE_OBJECT),Q(this),this.state=b.OPEN_KEY):tt(this,"Bad object");continue;case b.OPEN_ARRAY:case b.VALUE:if(et(s))continue;if(this.state===b.OPEN_ARRAY){if(H(this,"onopenarray"),this.depth++,this.state=b.VALUE,s===x){H(this,"onclosearray"),this.depth--,this.state=this.stack.pop()||b.VALUE;continue}this.stack.push(b.CLOSE_ARRAY)}s===E?this.state=b.STRING:s===K?this.state=b.OPEN_OBJECT:s===B?this.state=b.OPEN_ARRAY:s===G?this.state=b.TRUE:s===J?this.state=b.FALSE:s===z?this.state=b.NULL:s===_?this.numberNode+="-":C<=s&&s<=L?(this.numberNode+=String.fromCharCode(s),this.state=b.NUMBER_DIGIT):tt(this,"Bad value");continue;case b.CLOSE_ARRAY:if(s===O)this.stack.push(b.CLOSE_ARRAY),Q(this,"onvalue"),this.state=b.VALUE;else if(s===x)W(this,"onclosearray"),this.depth--,this.state=this.stack.pop()||b.VALUE;else{if(et(s))continue;tt(this,"Bad array")}continue;case b.STRING:void 0===this.textNode&&(this.textNode="");var n=e-1,i=this.slashed,r=this.unicodeI;t:for(;;){for(g&&console.log(e,s,w[this.state],i);r>0;)if(this.unicodeS+=String.fromCharCode(s),s=t.charCodeAt(e++),this.position++,4===r?(this.textNode+=String.fromCharCode(parseInt(this.unicodeS,16)),r=0,n=e-1):r++,!s)break t;if(s===E&&!i){this.state=this.stack.pop()||b.VALUE,this.textNode+=t.substring(n,e-1),this.position+=e-1-n;break}if(s===k&&!i&&(i=!0,this.textNode+=t.substring(n,e-1),this.position+=e-1-n,s=t.charCodeAt(e++),this.position++,!s))break;if(i){if(i=!1,s===z?this.textNode+="\n":s===D?this.textNode+="\r":s===G?this.textNode+="\t":s===J?this.textNode+="\f":s===T?this.textNode+="\b":s===V?(r=1,this.unicodeS=""):this.textNode+=String.fromCharCode(s),s=t.charCodeAt(e++),this.position++,n=e-1,s)continue;break}q.lastIndex=e;var a=q.exec(t);if(null===a){e=t.length+1,this.textNode+=t.substring(n,e-1),this.position+=e-1-n;break}if(e=a.index+1,!(s=t.charCodeAt(a.index))){this.textNode+=t.substring(n,e-1),this.position+=e-1-n;break}}this.slashed=i,this.unicodeI=r;continue;case b.TRUE:s===D?this.state=b.TRUE2:tt(this,"Invalid true started with t"+s);continue;case b.TRUE2:s===V?this.state=b.TRUE3:tt(this,"Invalid true started with tr"+s);continue;case b.TRUE3:s===F?(H(this,"onvalue",!0),this.state=this.stack.pop()||b.VALUE):tt(this,"Invalid true started with tru"+s);continue;case b.FALSE:s===U?this.state=b.FALSE2:tt(this,"Invalid false started with f"+s);continue;case b.FALSE2:s===M?this.state=b.FALSE3:tt(this,"Invalid false started with fa"+s);continue;case b.FALSE3:s===Y?this.state=b.FALSE4:tt(this,"Invalid false started with fal"+s);continue;case b.FALSE4:s===F?(H(this,"onvalue",!1),this.state=this.stack.pop()||b.VALUE):tt(this,"Invalid false started with fals"+s);continue;case b.NULL:s===V?this.state=b.NULL2:tt(this,"Invalid null started with n"+s);continue;case b.NULL2:s===M?this.state=b.NULL3:tt(this,"Invalid null started with nu"+s);continue;case b.NULL3:s===M?(H(this,"onvalue",null),this.state=this.stack.pop()||b.VALUE):tt(this,"Invalid null started with nul"+s);continue;case b.NUMBER_DECIMAL_POINT:s===N?(this.numberNode+=".",this.state=b.NUMBER_DIGIT):tt(this,"Leading zero not followed by .");continue;case b.NUMBER_DIGIT:C<=s&&s<=L?this.numberNode+=String.fromCharCode(s):s===N?(-1!==this.numberNode.indexOf(".")&&tt(this,"Invalid number has two dots"),this.numberNode+="."):s===F||s===R?(-1===this.numberNode.indexOf("e")&&-1===this.numberNode.indexOf("E")||tt(this,"Invalid number has two exponential"),this.numberNode+="e"):s===S||s===_?(o!==F&&o!==R&&tt(this,"Invalid symbol in number"),this.numberNode+=String.fromCharCode(s)):(Z(this),e--,this.state=this.stack.pop()||b.VALUE);continue;default:tt(this,"Unknown state: "+this.state)}return this.position>=this.bufferCheckPosition&&function(t){const e=Math.max(f,10);let s=0;for(var o in y){var n=void 0===t[o]?0:t[o].length;if(n>e)switch(o){case"text":closeText(t);break;default:tt(t,"Max buffer length exceeded: "+o)}s=Math.max(s,n)}t.bufferCheckPosition=f-s+t.position}(this),H(this,"onchunkparsed"),this}}function H(t,e,s){g&&console.log("-- emit",e,s),t[e]&&t[e](s,t)}function W(t,e,s){Q(t),H(t,e,s)}function Q(t,e){t.textNode=function(t,e){if(void 0===e)return e;t.trim&&(e=e.trim());t.normalize&&(e=e.replace(/\s+/g," "));return e}(t.options,t.textNode),void 0!==t.textNode&&H(t,e||"onvalue",t.textNode),t.textNode=void 0}function Z(t){t.numberNode&&H(t,"onvalue",parseFloat(t.numberNode)),t.numberNode=""}function tt(t,e){return Q(t),e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c,e=new Error(e),t.error=e,H(t,"onerror",e),t}function et(t){return t===P||t===j||t===v||t===A}class st{constructor(t=null){var e,s,o;if(o=void 0,(s="path")in(e=this)?Object.defineProperty(e,s,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[s]=o,this.path=["$"],t instanceof st)this.path=[...t.path];else if(Array.isArray(t))this.path.push(...t);else if("string"==typeof t&&(this.path=t.split("."),"$"!==this.path[0]))throw new Error("JSONPaths must start with $")}clone(){return new st(this)}toString(){return this.path.join(".")}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let e=0;e<this.path.length;++e)if(this.path[e]!==t.path[e])return!1;return!0}setFieldAtPath(t,e){const s=[...this.path];s.shift();const o=s.pop();for(const e of s)t=t[e];t[o]=e}getFieldAtPath(t){const e=[...this.path];e.shift();const s=e.pop();for(const s of e)t=t[s];return t[s]}}function ot(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function nt(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class it extends class{constructor(){ot(this,"jsonpath",void 0),ot(this,"_parser",void 0),this.reset(),this._initializeParser()}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new st}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){const{container:e,key:s}=this.currentState;null!==s?(e[s]=t,this.currentState.key=null):e.push(t)}_openArray(t=[]){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(t={}){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_initializeParser(){this._parser=new X({onready:()=>{this.jsonpath=new st,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:t=>{this._openObject({}),void 0!==t&&this.parser.onkey(t)},onkey:t=>{this.jsonpath.set(t),this.currentState.key=t},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:t=>{this._pushOrSet(t)},onerror:t=>{throw t},onend:()=>{this.result=this.currentState.container.pop()}})}get parser(){return this._parser}}{constructor(t={}){super(),nt(this,"jsonPaths",void 0),nt(this,"streamingJsonPath",null),nt(this,"streamingArray",null),nt(this,"topLevelObject",null);const e=t.jsonpaths||[];this.jsonPaths=e.map(t=>new st(t)),this._extendParser()}write(t){super.write(t);let e=[];return this.streamingArray&&(e=[...this.streamingArray],this.streamingArray.length=0),e}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){const t=this.getJsonPath();if(0===this.jsonPaths.length)return!0;for(const e of this.jsonPaths)if(e.equals(t))return!0;return!1}_extendParser(){this.parser.onopenarray=()=>{if(!this.streamingArray&&this._matchJSONPath())return this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],void this._openArray(this.streamingArray);this._openArray()},this.parser.onopenobject=t=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),void 0!==t&&this.parser.onkey(t)}}}async function*rt(t,e){var s;const o=d(t),{metadata:n}=e,{jsonpaths:i}=e.json||{};let r=!0;const a=(null==e||null===(s=e.json)||void 0===s?void 0:s.shape)||"row-table",h=new p(null,{...e,shape:a}),c=new it({jsonpaths:i});for await(const t of o){const e=c.write(t),s=e.length>0&&c.getStreamingJsonPathAsString();if(e.length>0&&r){if(n){const t={shape:a,batchType:"partial-result",data:[],length:0,bytesUsed:0,container:c.getPartialResult(),jsonpath:s};yield t}r=!1}for(const t of e){h.addRow(t);const e=h.getFullBatch({jsonpath:s});e&&(yield e)}h.chunkComplete(t);const o=h.getFullBatch({jsonpath:s});o&&(yield o)}const l=c.getStreamingJsonPathAsString(),u=h.getFinalBatch({jsonpath:l});if(u&&(yield u),n){const t={shape:a,batchType:"final-result",container:c.getPartialResult(),jsonpath:c.getStreamingJsonPathAsString(),data:[],length:0};yield t}}const at={json:{shape:"row-table",table:!1,jsonpaths:[]}},ht={name:"JSON",id:"json",module:"json",version:"3.1.0-alpha.5",extensions:["json","geojson"],mimeTypes:["application/json"],category:"table",text:!0,parse:async function(t,e){return ct((new TextDecoder).decode(t),e)},parseTextSync:ct,parseInBatches:function(t,e){const s={...e,json:{...at.json,...null==e?void 0:e.json}};return rt(t,s)},options:at};function ct(t,e){return o(t,{...e,json:{...at.json,...null==e?void 0:e.json}})}const lt={name:"NDJSON",id:"ndjson",module:"json",version:"3.1.0-alpha.5",extensions:["ndjson"],mimeTypes:["application/x-ndjson"],category:"table",text:!0,parse:async function(t){return ut((new TextDecoder).decode(t))},parseTextSync:ut,parseInBatches:function(t,e){return async function*(t,e){const s=async function*(t){let e=1;for await(const s of t)yield{counter:e,line:s},e++}(async function*(t){let e="";for await(const s of t){let t;for(e+=s;(t=e.indexOf("\n"))>=0;){const s=e.slice(0,t+1);e=e.slice(t+1),yield s}}e.length>0&&(yield e)}(d(t))),o=new p(null,{...e,shape:"row-table"});for await(const{counter:t,line:e}of s)try{const t=JSON.parse(e);o.addRow(t),o.chunkComplete(e);const s=o.getFullBatch();s&&(yield s)}catch(e){throw new Error("NDJSONLoader: failed to parse JSON on line "+t)}const n=o.getFinalBatch();n&&(yield n)}(t,e)},options:{}};function ut(t){return t.trim().split("\n").map((t,e)=>{try{return JSON.parse(t)}catch(t){throw new Error("NDJSONLoader: failed to parse JSON on line "+(e+1))}})}function pt(t,e={}){const s=dt(t);return ft(t,s,{coordLength:e.coordLength||s.coordLength,numericPropKeys:e.numericPropKeys||s.numericPropKeys,PositionDataType:e.PositionDataType||Float32Array})}function dt(t){let e=0,s=0,o=0,n=0,i=0,r=0,a=0,h=0,c=0;const l=new Set,u={};for(const d of t){const t=d.geometry;switch(t.type){case"Point":s++,e++,l.add(t.coordinates.length);break;case"MultiPoint":s++,e+=t.coordinates.length;for(const e of t.coordinates)l.add(e.length);break;case"LineString":i++,o+=t.coordinates.length,n++;for(const e of t.coordinates)l.add(e.length);break;case"MultiLineString":i++;for(const e of t.coordinates){o+=e.length,n++;for(const t of e)l.add(t.length)}break;case"Polygon":c++,a++,h+=t.coordinates.length,r+=Et(t.coordinates).length;for(const e of Et(t.coordinates))l.add(e.length);break;case"MultiPolygon":c++;for(const e of t.coordinates){a++,h+=e.length,r+=Et(e).length;for(const t of Et(e))l.add(t.length)}break;default:throw new Error("Unsupported geometry type: "+t.type)}if(d.properties)for(const t in d.properties){const e=d.properties[t];u[t]=u[t]||void 0===u[t]?(p=e,Number.isFinite(p)):u[t]}}var p;return{coordLength:l.size>0?Math.max(...l):2,pointPositionsCount:e,pointFeaturesCount:s,linePositionsCount:o,linePathsCount:n,lineFeaturesCount:i,polygonPositionsCount:r,polygonObjectsCount:a,polygonRingsCount:h,polygonFeaturesCount:c,numericPropKeys:Object.keys(u).filter(t=>u[t])}}function ft(t,e,s){const{pointPositionsCount:o,pointFeaturesCount:n,linePositionsCount:i,linePathsCount:r,lineFeaturesCount:a,polygonPositionsCount:h,polygonObjectsCount:c,polygonRingsCount:l,polygonFeaturesCount:u}=e,{coordLength:p,numericPropKeys:d,PositionDataType:f=Float32Array}=s,g=t.length>65535?Uint32Array:Uint16Array,y={positions:new f(o*p),globalFeatureIds:new g(o),featureIds:n>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:Array(),fields:Array()},b={positions:new f(i*p),pathIndices:i>65535?new Uint32Array(r+1):new Uint16Array(r+1),globalFeatureIds:new g(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:Array(),fields:Array()},w={positions:new f(h*p),polygonIndices:h>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:h>65535?new Uint32Array(l+1):new Uint16Array(l+1),globalFeatureIds:new g(h),featureIds:u>65535?new Uint32Array(h):new Uint16Array(h),numericProps:{},properties:Array(),fields:Array()};for(const t of[y,b,w])for(const e of d||[])t.numericProps[e]=new Float32Array(t.positions.length/p);b.pathIndices[r]=i,w.polygonIndices[c]=h,w.primitivePolygonIndices[l]=h;const m={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(const e of t){const t=e.geometry,s=e.properties||{};switch(t.type){case"Point":gt(t.coordinates,y,m,p,s),y.properties.push(Pt(s,d)),m.pointFeature++;break;case"MultiPoint":yt(t.coordinates,y,m,p,s),y.properties.push(Pt(s,d)),m.pointFeature++;break;case"LineString":bt(t.coordinates,b,m,p,s),b.properties.push(Pt(s,d)),m.lineFeature++;break;case"MultiLineString":wt(t.coordinates,b,m,p,s),b.properties.push(Pt(s,d)),m.lineFeature++;break;case"Polygon":mt(t.coordinates,w,m,p,s),w.properties.push(Pt(s,d)),m.polygonFeature++;break;case"MultiPolygon":At(t.coordinates,w,m,p,s),w.properties.push(Pt(s,d)),m.polygonFeature++;break;default:throw new Error("Invalid geometry type")}m.feature++}return function(t,e,s,o){const n={points:{...t,positions:{value:t.positions,size:o},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},type:"Point"},lines:{...e,pathIndices:{value:e.pathIndices,size:1},positions:{value:e.positions,size:o},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},type:"LineString"},polygons:{...s,polygonIndices:{value:s.polygonIndices,size:1},primitivePolygonIndices:{value:s.primitivePolygonIndices,size:1},positions:{value:s.positions,size:o},globalFeatureIds:{value:s.globalFeatureIds,size:1},featureIds:{value:s.featureIds,size:1},type:"Polygon"}};for(const t in n)for(const e in n[t].numericProps)n[t].numericProps[e]={value:n[t].numericProps[e],size:1};return n}(y,b,w,p)}function gt(t,e,s,o,n){e.positions.set(t,s.pointPosition*o),e.globalFeatureIds[s.pointPosition]=s.feature,e.featureIds[s.pointPosition]=s.pointFeature,jt(e,n,s.pointPosition,1),s.pointPosition++}function yt(t,e,s,o,n){for(const i of t)gt(i,e,s,o,n)}function bt(t,e,s,o,n){e.pathIndices[s.linePath]=s.linePosition,s.linePath++,vt(e.positions,t,s.linePosition,o);const i=t.length;jt(e,n,s.linePosition,i),e.globalFeatureIds.set(new Uint32Array(i).fill(s.feature),s.linePosition),e.featureIds.set(new Uint32Array(i).fill(s.lineFeature),s.linePosition),s.linePosition+=i}function wt(t,e,s,o,n){for(const i of t)bt(i,e,s,o,n)}function mt(t,e,s,o,n){e.polygonIndices[s.polygonObject]=s.polygonPosition,s.polygonObject++;for(const i of t){e.primitivePolygonIndices[s.polygonRing]=s.polygonPosition,s.polygonRing++,vt(e.positions,i,s.polygonPosition,o);const t=i.length;jt(e,n,s.polygonPosition,t),e.globalFeatureIds.set(new Uint32Array(t).fill(s.feature),s.polygonPosition),e.featureIds.set(new Uint32Array(t).fill(s.polygonFeature),s.polygonPosition),s.polygonPosition+=t}}function At(t,e,s,o,n){for(const i of t)mt(i,e,s,o,n)}function jt(t,e,s,o){for(const n in t.numericProps)n in e&&t.numericProps[n].set(new Array(o).fill(e[n]),s)}function Pt(t,e){const s={};for(const o in t)e.includes(o)||(s[o]=t[o]);return s}function vt(t,e,s,o){let n=s*o;for(const s of e)t.set(s,n),n+=o}function Et(t){return[].concat(...t)}const St={geojson:{shape:"object-row-table"},json:{jsonpaths:["$","$.features"]},gis:{format:"geojson"}},Ot={name:"GeoJSON",id:"geojson",module:"geojson",version:"3.1.0-alpha.5",worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:St},_t={...Ot,parse:async function(t,e){return Nt((new TextDecoder).decode(t),e)},parseTextSync:Nt,parseInBatches:function(t,e){(e={...St,...e}).json={...St.geojson,...e.geojson};const s=rt(t,e);switch(e.gis.format){case"binary":return async function*(t){for await(const e of t)e.data=pt(e.data),yield e}(s);default:return s}}};function Nt(t,e){(e={...St,...e}).json={...St.geojson,...e.geojson},e.gis=e.gis||{};const s=o(t,e);switch(e.gis.format){case"binary":return pt(s);default:return s}}}])}));
|
|
2
2
|
//# sourceMappingURL=dist.min.js.map
|