@loaders.gl/json 4.2.0-alpha.6 → 4.2.0-beta.1
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.dev.js +52 -46
- package/dist/dist.min.js +5 -5
- package/dist/geojson-loader.d.ts +58 -4
- package/dist/geojson-loader.d.ts.map +1 -1
- package/dist/geojson-loader.js +3 -1
- package/dist/geojson-worker.js +49 -47
- package/dist/geojson-writer.d.ts +18 -2
- package/dist/geojson-writer.d.ts.map +1 -1
- package/dist/index.cjs +9 -3
- package/dist/index.cjs.map +2 -2
- package/dist/json-loader.d.ts +3 -3
- package/dist/json-loader.d.ts.map +1 -1
- package/dist/json-loader.js +3 -1
- package/dist/json-writer.d.ts +14 -3
- package/dist/json-writer.d.ts.map +1 -1
- package/dist/ndgeoson-loader.d.ts +26 -2
- package/dist/ndgeoson-loader.d.ts.map +1 -1
- package/dist/ndgeoson-loader.js +3 -1
- package/dist/ndjson-loader.d.ts +18 -2
- package/dist/ndjson-loader.d.ts.map +1 -1
- package/dist/ndjson-loader.js +3 -1
- package/package.json +5 -5
- package/src/geojson-loader.ts +7 -4
- package/src/geojson-writer.ts +2 -2
- package/src/json-loader.ts +9 -6
- package/src/json-writer.ts +2 -2
- package/src/ndgeoson-loader.ts +9 -6
- package/src/ndjson-loader.ts +5 -6
package/dist/dist.dev.js
CHANGED
|
@@ -818,6 +818,52 @@ var __exports__ = (() => {
|
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
820
|
|
|
821
|
+
// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
822
|
+
function _typeof(obj) {
|
|
823
|
+
"@babel/helpers - typeof";
|
|
824
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
825
|
+
return typeof obj2;
|
|
826
|
+
} : function(obj2) {
|
|
827
|
+
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
828
|
+
}, _typeof(obj);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
832
|
+
function _toPrimitive(input, hint) {
|
|
833
|
+
if (_typeof(input) !== "object" || input === null)
|
|
834
|
+
return input;
|
|
835
|
+
var prim = input[Symbol.toPrimitive];
|
|
836
|
+
if (prim !== void 0) {
|
|
837
|
+
var res = prim.call(input, hint || "default");
|
|
838
|
+
if (_typeof(res) !== "object")
|
|
839
|
+
return res;
|
|
840
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
841
|
+
}
|
|
842
|
+
return (hint === "string" ? String : Number)(input);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
846
|
+
function _toPropertyKey(arg) {
|
|
847
|
+
var key = _toPrimitive(arg, "string");
|
|
848
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
852
|
+
function _defineProperty(obj, key, value) {
|
|
853
|
+
key = _toPropertyKey(key);
|
|
854
|
+
if (key in obj) {
|
|
855
|
+
Object.defineProperty(obj, key, {
|
|
856
|
+
value,
|
|
857
|
+
enumerable: true,
|
|
858
|
+
configurable: true,
|
|
859
|
+
writable: true
|
|
860
|
+
});
|
|
861
|
+
} else {
|
|
862
|
+
obj[key] = value;
|
|
863
|
+
}
|
|
864
|
+
return obj;
|
|
865
|
+
}
|
|
866
|
+
|
|
821
867
|
// ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
|
|
822
868
|
function concatenateArrayBuffers(...sources) {
|
|
823
869
|
return concatenateArrayBuffersFromArray(sources);
|
|
@@ -875,52 +921,6 @@ var __exports__ = (() => {
|
|
|
875
921
|
return concatenateArrayBuffers(...arrayBuffers);
|
|
876
922
|
}
|
|
877
923
|
|
|
878
|
-
// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
879
|
-
function _typeof(obj) {
|
|
880
|
-
"@babel/helpers - typeof";
|
|
881
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
882
|
-
return typeof obj2;
|
|
883
|
-
} : function(obj2) {
|
|
884
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
885
|
-
}, _typeof(obj);
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
889
|
-
function _toPrimitive(input, hint) {
|
|
890
|
-
if (_typeof(input) !== "object" || input === null)
|
|
891
|
-
return input;
|
|
892
|
-
var prim = input[Symbol.toPrimitive];
|
|
893
|
-
if (prim !== void 0) {
|
|
894
|
-
var res = prim.call(input, hint || "default");
|
|
895
|
-
if (_typeof(res) !== "object")
|
|
896
|
-
return res;
|
|
897
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
898
|
-
}
|
|
899
|
-
return (hint === "string" ? String : Number)(input);
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
903
|
-
function _toPropertyKey(arg) {
|
|
904
|
-
var key = _toPrimitive(arg, "string");
|
|
905
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
909
|
-
function _defineProperty(obj, key, value) {
|
|
910
|
-
key = _toPropertyKey(key);
|
|
911
|
-
if (key in obj) {
|
|
912
|
-
Object.defineProperty(obj, key, {
|
|
913
|
-
value,
|
|
914
|
-
enumerable: true,
|
|
915
|
-
configurable: true,
|
|
916
|
-
writable: true
|
|
917
|
-
});
|
|
918
|
-
} else {
|
|
919
|
-
obj[key] = value;
|
|
920
|
-
}
|
|
921
|
-
return obj;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
924
|
// src/lib/clarinet/clarinet.ts
|
|
925
925
|
var MAX_BUFFER_LENGTH = Number.MAX_SAFE_INTEGER;
|
|
926
926
|
var Char = {
|
|
@@ -1751,6 +1751,8 @@ Char: ${this.c}`;
|
|
|
1751
1751
|
// src/json-loader.ts
|
|
1752
1752
|
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
1753
1753
|
var JSONLoader = {
|
|
1754
|
+
dataType: null,
|
|
1755
|
+
batchType: null,
|
|
1754
1756
|
name: "JSON",
|
|
1755
1757
|
id: "json",
|
|
1756
1758
|
module: "json",
|
|
@@ -1829,6 +1831,8 @@ Char: ${this.c}`;
|
|
|
1829
1831
|
// src/ndjson-loader.ts
|
|
1830
1832
|
var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
1831
1833
|
var NDJSONLoader = {
|
|
1834
|
+
dataType: null,
|
|
1835
|
+
batchType: null,
|
|
1832
1836
|
name: "NDJSON",
|
|
1833
1837
|
id: "ndjson",
|
|
1834
1838
|
module: "json",
|
|
@@ -2858,6 +2862,8 @@ Char: ${this.c}`;
|
|
|
2858
2862
|
// src/geojson-loader.ts
|
|
2859
2863
|
var VERSION3 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
2860
2864
|
var GeoJSONWorkerLoader = {
|
|
2865
|
+
dataType: null,
|
|
2866
|
+
batchType: null,
|
|
2861
2867
|
name: "GeoJSON",
|
|
2862
2868
|
id: "geojson",
|
|
2863
2869
|
module: "geojson",
|
package/dist/dist.min.js
CHANGED
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
6
|
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var yt=Object.create;var D=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var wt=Object.getPrototypeOf,bt=Object.prototype.hasOwnProperty;var At=(t,e,r)=>e in t?D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Pt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),jt=(t,e)=>{for(var r in e)D(t,r,{get:e[r],enumerable:!0})},Q=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xt(e))!bt.call(t,n)&&n!==r&&D(t,n,{get:()=>e[n],enumerable:!(o=gt(e,n))||o.enumerable});return t},X=(t,e,r)=>(Q(t,e,"default"),r&&Q(r,e,"default")),Nt=(t,e,r)=>(r=t!=null?yt(wt(t)):{},Q(e||!t||!t.__esModule?D(r,"default",{value:t,enumerable:!0}):r,t)),Ot=t=>Q(D({},"__esModule",{value:!0}),t);var Le=(t,e,r)=>(At(t,typeof e!="symbol"?e+"":e,r),r);var ve=Pt((Pr,Fe)=>{Fe.exports=globalThis.loaders});var H={};jt(H,{JSONLoader:()=>ce,JSONWriter:()=>qe,NDJSONLoader:()=>Xe,_ClarinetParser:()=>L,_GeoJSONLoader:()=>U,_GeoJSONWorkerLoader:()=>Ce,_GeoJSONWriter:()=>mt,_JSONPath:()=>P,_rebuildJsonObject:()=>Ye});X(H,Nt(ve(),1));var q=class{schema;options;shape;length=0;rows=null;cursor=0;_headers=[];constructor(e,r){if(this.options=r,this.schema=e,!Array.isArray(e)){this._headers=[];for(let o in e)this._headers[e[o].index]=e[o].name}}rowCount(){return this.length}addArrayRow(e,r){Number.isFinite(r)&&(this.cursor=r),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}addObjectRow(e,r){Number.isFinite(r)&&(this.cursor=r),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}getBatch(){let e=this.rows;return e?(e=e.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}};function Re(t,e){if(!t)throw new Error("null row");let r={};if(e)for(let o=0;o<e.length;o++)r[e[o]]=t[o];else for(let o=0;o<t.length;o++){let n=`column-${o}`;r[n]=t[o]}return r}function ke(t,e){if(!t)throw new Error("null row");if(e){let r=new Array(e.length);for(let o=0;o<e.length;o++)r[o]=t[e[o]];return r}return Object.values(t)}function Te(t){let e=[];for(let r=0;r<t.length;r++){let o=`column-${r}`;e.push(o)}return e}function Ue(t){return Object.keys(t)}var De=100,ee=class{schema;options;length=0;objectRows=null;arrayRows=null;cursor=0;_headers=null;constructor(e,r){if(this.options=r,this.schema=e,e){this._headers=[];for(let o in e)this._headers[e[o].index]=e[o].name}}rowCount(){return this.length}addArrayRow(e,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||=Te(e),this.options.shape){case"object-row-table":let o=Re(e,this._headers);this.addObjectRow(o,r);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(De),this.arrayRows[this.length]=e,this.length++;break}}addObjectRow(e,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||=Ue(e),this.options.shape){case"array-row-table":let o=ke(e,this._headers);this.addArrayRow(o,r);break;case"object-row-table":this.objectRows=this.objectRows||new Array(De),this.objectRows[this.length]=e,this.length++;break}}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}};var te=class{schema;length=0;allocated=0;columns={};constructor(e,r){this.schema=e,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(e){this._reallocateColumns();let r=0;for(let o in this.columns)this.columns[o][this.length]=e[r++];this.length++}addObjectRow(e){this._reallocateColumns();for(let r in e)this.columns[r][this.length]=e[r];this.length++}getBatch(){this._pruneColumns();let e=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(let o in this.schema){let n=this.schema[o];e[n.name]=this.columns[n.index]}return this.columns={},{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(let e in this.schema){let r=this.schema[e],o=r.type||Float32Array,n=this.columns[r.index];if(n&&ArrayBuffer.isView(n)){let s=new o(this.allocated);s.set(n),this.columns[r.index]=s}else n?(n.length=this.allocated,this.columns[r.index]=n):this.columns[r.index]=new o(this.allocated)}}}_pruneColumns(){for(let[e,r]of Object.entries(this.columns))this.columns[e]=r.slice(0,this.length)}};var St={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},It="TableBatchBuilder",re=class{schema;options;aggregator=null;batchCount=0;bytesUsed=0;isChunkComplete=!1;lastBatchEmittedMs=Date.now();totalLength=0;totalBytes=0;rowBytes=0;constructor(e,r){this.schema=e,this.options={...St,...r}}limitReached(){return!!(Boolean(this.options?.limit)&&this.totalLength>=this.options.limit||Boolean(this.options?._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){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addArrayRow(e)}addObjectRow(e){if(!this.aggregator){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addObjectRow(e)}chunkComplete(e){e instanceof ArrayBuffer&&(this.bytesUsed+=e.byteLength),typeof e=="string"&&(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)?e.length*8:Object.keys(e).length*8}_isFull(){if(!this.aggregator||this.aggregator.rowCount()===0)return!1;if(this.options.batchSize==="auto"){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs?!1:(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(e){if(!this.aggregator)return null;e?.bytesUsed&&(this.bytesUsed=e.bytesUsed);let r=this.aggregator.getBatch();return r.count=this.batchCount,r.bytesUsed=this.bytesUsed,Object.assign(r,e),this.batchCount++,this.aggregator=null,r}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return ee;case"columnar-table":return te;case"arrow-table":if(!re.ArrowBatch)throw new Error(It);return re.ArrowBatch;default:return q}}},I=re;Le(I,"ArrowBatch");function B(t){switch(t.shape){case"array-row-table":case"object-row-table":return t.data.length;case"geojson-table":return t.features.length;case"arrow-table":return t.data.numRows;case"columnar-table":for(let r of Object.values(t.data))return r.length||0;return 0;default:throw new Error("table")}}function oe(t){if(t.schema)return t.schema.fields.length;if(B(t)===0)throw new Error("empty table");switch(t.shape){case"array-row-table":return t.data[0].length;case"object-row-table":return Object.keys(t.data[0]).length;case"geojson-table":return Object.keys(t.features[0]).length;case"columnar-table":return Object.keys(t.data).length;case"arrow-table":return t.data.numCols;default:throw new Error("table")}}function ne(t,e,r,o){switch(t.shape){case"object-row-table":return o?Object.fromEntries(Object.entries(t.data[e])):t.data[e];case"array-row-table":if(t.schema){let c=r||{};for(let l=0;l<t.schema.fields.length;l++)c[t.schema.fields[l].name]=t.data[e][l];return c}throw new Error("no schema");case"geojson-table":if(t.schema){let c=r||{};for(let l=0;l<t.schema.fields.length;l++)c[t.schema.fields[l].name]=t.features[e][l];return c}throw new Error("no schema");case"columnar-table":if(t.schema){let c=r||{};for(let l=0;l<t.schema.fields.length;l++)c[t.schema.fields[l].name]=t.data[t.schema.fields[l].name][e];return c}else{let c=r||{};for(let[l,u]of Object.entries(t.data))c[l]=u[e];return c}case"arrow-table":let n=t.data,s=r||{},a=n.get(e),i=n.schema;for(let c=0;c<i.fields.length;c++)s[i.fields[c].name]=a?.[i.fields[c].name];return s;default:throw new Error("shape")}}function se(t,e,r,o){switch(t.shape){case"array-row-table":return o?Array.from(t.data[e]):t.data[e];case"object-row-table":if(t.schema){let c=r||[];for(let l=0;l<t.schema.fields.length;l++)c[l]=t.data[e][t.schema.fields[l].name];return c}return Object.values(t.data[e]);case"geojson-table":if(t.schema){let c=r||[];for(let l=0;l<t.schema.fields.length;l++)c[l]=t.features[e][t.schema.fields[l].name];return c}return Object.values(t.features[e]);case"columnar-table":if(t.schema){let c=r||[];for(let l=0;l<t.schema.fields.length;l++)c[l]=t.data[t.schema.fields[l].name][e];return c}else{let c=r||[],l=0;for(let u of Object.values(t.data))c[l]=u[e],l++;return c}case"arrow-table":let n=t.data,s=r||[],a=n.get(e),i=n.schema;for(let c=0;c<i.fields.length;c++)s[c]=a?.[i.fields[c].name];return s;default:throw new Error("shape")}}function*de(t,e){switch(e){case"array-row-table":yield*Je(t);break;case"object-row-table":yield*Ge(t);break;default:throw new Error(`Unknown row type ${e}`)}}function*Je(t,e=[]){let r=B(t);for(let o=0;o<r;o++)yield se(t,o,e)}function*Ge(t,e={}){let r=B(t);for(let o=0;o<r;o++)yield ne(t,o,e)}function ie(t,e="float32"){return t instanceof Date?"date-millisecond":t instanceof Number?e:typeof t=="string"?"utf8":(t===null||t==="undefined","null")}function Me(t){let e=Bt(t);return e!=="null"?{type:e,nullable:!1}:t.length>0?(e=ie(t[0]),{type:e,nullable:!0}):{type:"null",nullable:!0}}function Bt(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function ze(t){switch(t.shape){case"array-row-table":case"object-row-table":return Ct(t.data);case"columnar-table":return Et(t.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Et(t){let e=[];for(let[r,o]of Object.entries(t)){let n=_t(o,r);e.push(n)}return{fields:e,metadata:{}}}function Ct(t){if(!t.length)throw new Error("deduce from empty table");let e=[],r=t[0];for(let[o,n]of Object.entries(r))e.push(Lt(n,o));return{fields:e,metadata:{}}}function _t(t,e){if(ArrayBuffer.isView(t)){let r=Me(t);return{name:e,type:r.type||"null",nullable:r.nullable}}if(Array.isArray(t)&&t.length>0){let r=t[0],o=ie(r);return{name:e,type:o,nullable:!0}}throw new Error("empty table")}function Lt(t,e){let r=ie(t);return{name:e,type:r,nullable:!0}}function J(t){let e;switch(Ft(t)){case"array-row-table":e={shape:"array-row-table",data:t};break;case"object-row-table":e={shape:"object-row-table",data:t};break;case"columnar-table":e={shape:"columnar-table",data:t};break;default:throw new Error("table")}let r=ze(e);return{...e,schema:r}}function Ft(t){if(Array.isArray(t)){if(t.length===0)throw new Error("cannot deduce type of empty table");let e=t[0];if(Array.isArray(e))return"array-row-table";if(e&&typeof e=="object")return"object-row-table"}if(t&&typeof t=="object")return"columnar-table";throw new Error("invalid table")}function We(t,e){try{let r=JSON.parse(t);if(e.json?.table){let o=Ve(r)||r;return J(o)}return r}catch{throw new Error("JSONLoader: failed to parse JSON")}}function Ve(t){if(Array.isArray(t))return t;if(t&&typeof t=="object")for(let e of Object.values(t)){let r=Ve(e);if(r)return r}return null}function me(t,e){if(!t)throw new Error(e||"loader assertion failed.")}function $e(...t){return vt(t)}function vt(t){let e=t.map(s=>s instanceof ArrayBuffer?new Uint8Array(s):s),r=e.reduce((s,a)=>s+a.byteLength,0),o=new Uint8Array(r),n=0;for(let s of e)o.set(s,n),n+=s.byteLength;return o.buffer}async function*G(t,e={}){let r=new TextDecoder(void 0,e);for await(let o of t)yield typeof o=="string"?o:r.decode(o,{stream:!0})}async function*ye(t){let e="";for await(let r of t){e+=r;let o;for(;(o=e.indexOf(`
|
|
8
|
-
`))>=0;){let n=e.slice(0,o+1);e=e.slice(o+1),yield n}}e.length>0&&(yield e)}async function*
|
|
7
|
+
"use strict";var __exports__=(()=>{var yt=Object.create;var D=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var wt=Object.getPrototypeOf,bt=Object.prototype.hasOwnProperty;var At=(t,e,r)=>e in t?D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Pt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),jt=(t,e)=>{for(var r in e)D(t,r,{get:e[r],enumerable:!0})},Q=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xt(e))!bt.call(t,n)&&n!==r&&D(t,n,{get:()=>e[n],enumerable:!(o=gt(e,n))||o.enumerable});return t},X=(t,e,r)=>(Q(t,e,"default"),r&&Q(r,e,"default")),Nt=(t,e,r)=>(r=t!=null?yt(wt(t)):{},Q(e||!t||!t.__esModule?D(r,"default",{value:t,enumerable:!0}):r,t)),Ot=t=>Q(D({},"__esModule",{value:!0}),t);var Le=(t,e,r)=>(At(t,typeof e!="symbol"?e+"":e,r),r);var ve=Pt((Pr,Fe)=>{Fe.exports=globalThis.loaders});var H={};jt(H,{JSONLoader:()=>ce,JSONWriter:()=>qe,NDJSONLoader:()=>Xe,_ClarinetParser:()=>L,_GeoJSONLoader:()=>U,_GeoJSONWorkerLoader:()=>Ce,_GeoJSONWriter:()=>mt,_JSONPath:()=>P,_rebuildJsonObject:()=>Ye});X(H,Nt(ve(),1));var q=class{schema;options;shape;length=0;rows=null;cursor=0;_headers=[];constructor(e,r){if(this.options=r,this.schema=e,!Array.isArray(e)){this._headers=[];for(let o in e)this._headers[e[o].index]=e[o].name}}rowCount(){return this.length}addArrayRow(e,r){Number.isFinite(r)&&(this.cursor=r),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}addObjectRow(e,r){Number.isFinite(r)&&(this.cursor=r),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=e,this.length++}getBatch(){let e=this.rows;return e?(e=e.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:e,length:this.length,schema:this.schema,cursor:this.cursor}):null}};function Re(t,e){if(!t)throw new Error("null row");let r={};if(e)for(let o=0;o<e.length;o++)r[e[o]]=t[o];else for(let o=0;o<t.length;o++){let n=`column-${o}`;r[n]=t[o]}return r}function ke(t,e){if(!t)throw new Error("null row");if(e){let r=new Array(e.length);for(let o=0;o<e.length;o++)r[o]=t[e[o]];return r}return Object.values(t)}function Te(t){let e=[];for(let r=0;r<t.length;r++){let o=`column-${r}`;e.push(o)}return e}function Ue(t){return Object.keys(t)}var De=100,ee=class{schema;options;length=0;objectRows=null;arrayRows=null;cursor=0;_headers=null;constructor(e,r){if(this.options=r,this.schema=e,e){this._headers=[];for(let o in e)this._headers[e[o].index]=e[o].name}}rowCount(){return this.length}addArrayRow(e,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||=Te(e),this.options.shape){case"object-row-table":let o=Re(e,this._headers);this.addObjectRow(o,r);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(De),this.arrayRows[this.length]=e,this.length++;break}}addObjectRow(e,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||=Ue(e),this.options.shape){case"array-row-table":let o=ke(e,this._headers);this.addArrayRow(o,r);break;case"object-row-table":this.objectRows=this.objectRows||new Array(De),this.objectRows[this.length]=e,this.length++;break}}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}};var te=class{schema;length=0;allocated=0;columns={};constructor(e,r){this.schema=e,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(e){this._reallocateColumns();let r=0;for(let o in this.columns)this.columns[o][this.length]=e[r++];this.length++}addObjectRow(e){this._reallocateColumns();for(let r in e)this.columns[r][this.length]=e[r];this.length++}getBatch(){this._pruneColumns();let e=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(let o in this.schema){let n=this.schema[o];e[n.name]=this.columns[n.index]}return this.columns={},{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(let e in this.schema){let r=this.schema[e],o=r.type||Float32Array,n=this.columns[r.index];if(n&&ArrayBuffer.isView(n)){let s=new o(this.allocated);s.set(n),this.columns[r.index]=s}else n?(n.length=this.allocated,this.columns[r.index]=n):this.columns[r.index]=new o(this.allocated)}}}_pruneColumns(){for(let[e,r]of Object.entries(this.columns))this.columns[e]=r.slice(0,this.length)}};var St={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},It="TableBatchBuilder",re=class{schema;options;aggregator=null;batchCount=0;bytesUsed=0;isChunkComplete=!1;lastBatchEmittedMs=Date.now();totalLength=0;totalBytes=0;rowBytes=0;constructor(e,r){this.schema=e,this.options={...St,...r}}limitReached(){return!!(Boolean(this.options?.limit)&&this.totalLength>=this.options.limit||Boolean(this.options?._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){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addArrayRow(e)}addObjectRow(e){if(!this.aggregator){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addObjectRow(e)}chunkComplete(e){e instanceof ArrayBuffer&&(this.bytesUsed+=e.byteLength),typeof e=="string"&&(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)?e.length*8:Object.keys(e).length*8}_isFull(){if(!this.aggregator||this.aggregator.rowCount()===0)return!1;if(this.options.batchSize==="auto"){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs?!1:(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(e){if(!this.aggregator)return null;e?.bytesUsed&&(this.bytesUsed=e.bytesUsed);let r=this.aggregator.getBatch();return r.count=this.batchCount,r.bytesUsed=this.bytesUsed,Object.assign(r,e),this.batchCount++,this.aggregator=null,r}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return ee;case"columnar-table":return te;case"arrow-table":if(!re.ArrowBatch)throw new Error(It);return re.ArrowBatch;default:return q}}},I=re;Le(I,"ArrowBatch");function B(t){switch(t.shape){case"array-row-table":case"object-row-table":return t.data.length;case"geojson-table":return t.features.length;case"arrow-table":return t.data.numRows;case"columnar-table":for(let r of Object.values(t.data))return r.length||0;return 0;default:throw new Error("table")}}function oe(t){if(t.schema)return t.schema.fields.length;if(B(t)===0)throw new Error("empty table");switch(t.shape){case"array-row-table":return t.data[0].length;case"object-row-table":return Object.keys(t.data[0]).length;case"geojson-table":return Object.keys(t.features[0]).length;case"columnar-table":return Object.keys(t.data).length;case"arrow-table":return t.data.numCols;default:throw new Error("table")}}function ne(t,e,r,o){switch(t.shape){case"object-row-table":return o?Object.fromEntries(Object.entries(t.data[e])):t.data[e];case"array-row-table":if(t.schema){let c=r||{};for(let l=0;l<t.schema.fields.length;l++)c[t.schema.fields[l].name]=t.data[e][l];return c}throw new Error("no schema");case"geojson-table":if(t.schema){let c=r||{};for(let l=0;l<t.schema.fields.length;l++)c[t.schema.fields[l].name]=t.features[e][l];return c}throw new Error("no schema");case"columnar-table":if(t.schema){let c=r||{};for(let l=0;l<t.schema.fields.length;l++)c[t.schema.fields[l].name]=t.data[t.schema.fields[l].name][e];return c}else{let c=r||{};for(let[l,u]of Object.entries(t.data))c[l]=u[e];return c}case"arrow-table":let n=t.data,s=r||{},a=n.get(e),i=n.schema;for(let c=0;c<i.fields.length;c++)s[i.fields[c].name]=a?.[i.fields[c].name];return s;default:throw new Error("shape")}}function se(t,e,r,o){switch(t.shape){case"array-row-table":return o?Array.from(t.data[e]):t.data[e];case"object-row-table":if(t.schema){let c=r||[];for(let l=0;l<t.schema.fields.length;l++)c[l]=t.data[e][t.schema.fields[l].name];return c}return Object.values(t.data[e]);case"geojson-table":if(t.schema){let c=r||[];for(let l=0;l<t.schema.fields.length;l++)c[l]=t.features[e][t.schema.fields[l].name];return c}return Object.values(t.features[e]);case"columnar-table":if(t.schema){let c=r||[];for(let l=0;l<t.schema.fields.length;l++)c[l]=t.data[t.schema.fields[l].name][e];return c}else{let c=r||[],l=0;for(let u of Object.values(t.data))c[l]=u[e],l++;return c}case"arrow-table":let n=t.data,s=r||[],a=n.get(e),i=n.schema;for(let c=0;c<i.fields.length;c++)s[c]=a?.[i.fields[c].name];return s;default:throw new Error("shape")}}function*de(t,e){switch(e){case"array-row-table":yield*Je(t);break;case"object-row-table":yield*Ge(t);break;default:throw new Error(`Unknown row type ${e}`)}}function*Je(t,e=[]){let r=B(t);for(let o=0;o<r;o++)yield se(t,o,e)}function*Ge(t,e={}){let r=B(t);for(let o=0;o<r;o++)yield ne(t,o,e)}function ie(t,e="float32"){return t instanceof Date?"date-millisecond":t instanceof Number?e:typeof t=="string"?"utf8":(t===null||t==="undefined","null")}function Me(t){let e=Bt(t);return e!=="null"?{type:e,nullable:!1}:t.length>0?(e=ie(t[0]),{type:e,nullable:!0}):{type:"null",nullable:!0}}function Bt(t){switch(t.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function ze(t){switch(t.shape){case"array-row-table":case"object-row-table":return Ct(t.data);case"columnar-table":return Et(t.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Et(t){let e=[];for(let[r,o]of Object.entries(t)){let n=_t(o,r);e.push(n)}return{fields:e,metadata:{}}}function Ct(t){if(!t.length)throw new Error("deduce from empty table");let e=[],r=t[0];for(let[o,n]of Object.entries(r))e.push(Lt(n,o));return{fields:e,metadata:{}}}function _t(t,e){if(ArrayBuffer.isView(t)){let r=Me(t);return{name:e,type:r.type||"null",nullable:r.nullable}}if(Array.isArray(t)&&t.length>0){let r=t[0],o=ie(r);return{name:e,type:o,nullable:!0}}throw new Error("empty table")}function Lt(t,e){let r=ie(t);return{name:e,type:r,nullable:!0}}function J(t){let e;switch(Ft(t)){case"array-row-table":e={shape:"array-row-table",data:t};break;case"object-row-table":e={shape:"object-row-table",data:t};break;case"columnar-table":e={shape:"columnar-table",data:t};break;default:throw new Error("table")}let r=ze(e);return{...e,schema:r}}function Ft(t){if(Array.isArray(t)){if(t.length===0)throw new Error("cannot deduce type of empty table");let e=t[0];if(Array.isArray(e))return"array-row-table";if(e&&typeof e=="object")return"object-row-table"}if(t&&typeof t=="object")return"columnar-table";throw new Error("invalid table")}function We(t,e){try{let r=JSON.parse(t);if(e.json?.table){let o=Ve(r)||r;return J(o)}return r}catch{throw new Error("JSONLoader: failed to parse JSON")}}function Ve(t){if(Array.isArray(t))return t;if(t&&typeof t=="object")for(let e of Object.values(t)){let r=Ve(e);if(r)return r}return null}function me(t,e){if(!t)throw new Error(e||"loader assertion failed.")}function E(t){return E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E(t)}function ye(t,e){if(E(t)!=="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var o=r.call(t,e||"default");if(E(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ge(t){var e=ye(t,"string");return E(e)==="symbol"?e:String(e)}function j(t,e,r){return e=ge(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $e(...t){return vt(t)}function vt(t){let e=t.map(s=>s instanceof ArrayBuffer?new Uint8Array(s):s),r=e.reduce((s,a)=>s+a.byteLength,0),o=new Uint8Array(r),n=0;for(let s of e)o.set(s,n),n+=s.byteLength;return o.buffer}async function*G(t,e={}){let r=new TextDecoder(void 0,e);for await(let o of t)yield typeof o=="string"?o:r.decode(o,{stream:!0})}async function*xe(t){let e="";for await(let r of t){e+=r;let o;for(;(o=e.indexOf(`
|
|
8
|
+
`))>=0;){let n=e.slice(0,o+1);e=e.slice(o+1),yield n}}e.length>0&&(yield e)}async function*we(t){let e=1;for await(let r of t)yield{counter:e,line:r},e++}async function be(t){let e=[];for await(let r of t)e.push(r);return $e(...e)}var Ae=Number.MAX_SAFE_INTEGER,h;(function(t){t[t.BEGIN=0]="BEGIN",t[t.VALUE=1]="VALUE",t[t.OPEN_OBJECT=2]="OPEN_OBJECT",t[t.CLOSE_OBJECT=3]="CLOSE_OBJECT",t[t.OPEN_ARRAY=4]="OPEN_ARRAY",t[t.CLOSE_ARRAY=5]="CLOSE_ARRAY",t[t.TEXT_ESCAPE=6]="TEXT_ESCAPE",t[t.STRING=7]="STRING",t[t.BACKSLASH=8]="BACKSLASH",t[t.END=9]="END",t[t.OPEN_KEY=10]="OPEN_KEY",t[t.CLOSE_KEY=11]="CLOSE_KEY",t[t.TRUE=12]="TRUE",t[t.TRUE2=13]="TRUE2",t[t.TRUE3=14]="TRUE3",t[t.FALSE=15]="FALSE",t[t.FALSE2=16]="FALSE2",t[t.FALSE3=17]="FALSE3",t[t.FALSE4=18]="FALSE4",t[t.NULL=19]="NULL",t[t.NULL2=20]="NULL2",t[t.NULL3=21]="NULL3",t[t.NUMBER_DECIMAL_POINT=22]="NUMBER_DECIMAL_POINT",t[t.NUMBER_DIGIT=23]="NUMBER_DIGIT"})(h||(h={}));var p={tab:9,lineFeed:10,carriageReturn:13,space:32,doubleQuote:34,plus:43,comma:44,minus:45,period:46,_0:48,_9:57,colon:58,E:69,openBracket:91,backslash:92,closeBracket:93,a:97,b:98,e:101,f:102,l:108,n:110,r:114,s:115,t:116,u:117,openBrace:123,closeBrace:125},Ze=/[\\"\n]/g,Ke={onready:()=>{},onopenobject:()=>{},onkey:()=>{},oncloseobject:()=>{},onopenarray:()=>{},onclosearray:()=>{},onvalue:()=>{},onerror:()=>{},onend:()=>{},onchunkparsed:()=>{}},L=class{options=Ke;bufferCheckPosition=Ae;q="";c="";p="";closed=!1;closedRoot=!1;sawRoot=!1;error=null;state=h.BEGIN;stack=[];position=0;column=0;line=1;slashed=!1;unicodeI=0;unicodeS=null;depth=0;textNode;numberNode;constructor(e={}){this.options={...Ke,...e},this.textNode=void 0,this.numberNode="",this.emit("onready")}end(){return(this.state!==h.VALUE||this.depth!==0)&&this._error("Unexpected end"),this._closeValue(),this.c="",this.closed=!0,this.emit("onend"),this}resume(){return this.error=null,this}close(){return this.write(null)}emit(e,r){this.options[e]?.(r,this)}emitNode(e,r){this._closeValue(),this.emit(e,r)}write(e){if(this.error)throw this.error;if(this.closed)return this._error("Cannot write after close. Assign an onready handler.");if(e===null)return this.end();let r=0,o=e.charCodeAt(0),n=this.p;for(;o&&(n=o,this.c=o=e.charCodeAt(r++),n!==o?this.p=n:n=this.p,!!o);)switch(this.position++,o===p.lineFeed?(this.line++,this.column=0):this.column++,this.state){case h.BEGIN:o===p.openBrace?this.state=h.OPEN_OBJECT:o===p.openBracket?this.state=h.OPEN_ARRAY:M(o)||this._error("Non-whitespace before {[.");continue;case h.OPEN_KEY:case h.OPEN_OBJECT:if(M(o))continue;if(this.state===h.OPEN_KEY)this.stack.push(h.CLOSE_KEY);else if(o===p.closeBrace){this.emit("onopenobject"),this.depth++,this.emit("oncloseobject"),this.depth--,this.state=this.stack.pop()||h.VALUE;continue}else this.stack.push(h.CLOSE_OBJECT);o===p.doubleQuote?this.state=h.STRING:this._error('Malformed object key should start with "');continue;case h.CLOSE_KEY:case h.CLOSE_OBJECT:if(M(o))continue;o===p.colon?(this.state===h.CLOSE_OBJECT?(this.stack.push(h.CLOSE_OBJECT),this._closeValue("onopenobject"),this.depth++):this._closeValue("onkey"),this.state=h.VALUE):o===p.closeBrace?(this.emitNode("oncloseobject"),this.depth--,this.state=this.stack.pop()||h.VALUE):o===p.comma?(this.state===h.CLOSE_OBJECT&&this.stack.push(h.CLOSE_OBJECT),this._closeValue(),this.state=h.OPEN_KEY):this._error("Bad object");continue;case h.OPEN_ARRAY:case h.VALUE:if(M(o))continue;if(this.state===h.OPEN_ARRAY)if(this.emit("onopenarray"),this.depth++,this.state=h.VALUE,o===p.closeBracket){this.emit("onclosearray"),this.depth--,this.state=this.stack.pop()||h.VALUE;continue}else this.stack.push(h.CLOSE_ARRAY);o===p.doubleQuote?this.state=h.STRING:o===p.openBrace?this.state=h.OPEN_OBJECT:o===p.openBracket?this.state=h.OPEN_ARRAY:o===p.t?this.state=h.TRUE:o===p.f?this.state=h.FALSE:o===p.n?this.state=h.NULL:o===p.minus?this.numberNode+="-":p._0<=o&&o<=p._9?(this.numberNode+=String.fromCharCode(o),this.state=h.NUMBER_DIGIT):this._error("Bad value");continue;case h.CLOSE_ARRAY:if(o===p.comma)this.stack.push(h.CLOSE_ARRAY),this._closeValue("onvalue"),this.state=h.VALUE;else if(o===p.closeBracket)this.emitNode("onclosearray"),this.depth--,this.state=this.stack.pop()||h.VALUE;else{if(M(o))continue;this._error("Bad array")}continue;case h.STRING:this.textNode===void 0&&(this.textNode="");let s=r-1,a=this.slashed,i=this.unicodeI;e:for(;;){for(;i>0;)if(this.unicodeS+=String.fromCharCode(o),o=e.charCodeAt(r++),this.position++,i===4?(this.textNode+=String.fromCharCode(parseInt(this.unicodeS,16)),i=0,s=r-1):i++,!o)break e;if(o===p.doubleQuote&&!a){this.state=this.stack.pop()||h.VALUE,this.textNode+=e.substring(s,r-1),this.position+=r-1-s;break}if(o===p.backslash&&!a&&(a=!0,this.textNode+=e.substring(s,r-1),this.position+=r-1-s,o=e.charCodeAt(r++),this.position++,!o))break;if(a){if(a=!1,o===p.n?this.textNode+=`
|
|
9
9
|
`:o===p.r?this.textNode+="\r":o===p.t?this.textNode+=" ":o===p.f?this.textNode+="\f":o===p.b?this.textNode+="\b":o===p.u?(i=1,this.unicodeS=""):this.textNode+=String.fromCharCode(o),o=e.charCodeAt(r++),this.position++,s=r-1,o)continue;break}Ze.lastIndex=r;let c=Ze.exec(e);if(c===null){r=e.length+1,this.textNode+=e.substring(s,r-1),this.position+=r-1-s;break}if(r=c.index+1,o=e.charCodeAt(c.index),!o){this.textNode+=e.substring(s,r-1),this.position+=r-1-s;break}}this.slashed=a,this.unicodeI=i;continue;case h.TRUE:o===p.r?this.state=h.TRUE2:this._error(`Invalid true started with t${o}`);continue;case h.TRUE2:o===p.u?this.state=h.TRUE3:this._error(`Invalid true started with tr${o}`);continue;case h.TRUE3:o===p.e?(this.emit("onvalue",!0),this.state=this.stack.pop()||h.VALUE):this._error(`Invalid true started with tru${o}`);continue;case h.FALSE:o===p.a?this.state=h.FALSE2:this._error(`Invalid false started with f${o}`);continue;case h.FALSE2:o===p.l?this.state=h.FALSE3:this._error(`Invalid false started with fa${o}`);continue;case h.FALSE3:o===p.s?this.state=h.FALSE4:this._error(`Invalid false started with fal${o}`);continue;case h.FALSE4:o===p.e?(this.emit("onvalue",!1),this.state=this.stack.pop()||h.VALUE):this._error(`Invalid false started with fals${o}`);continue;case h.NULL:o===p.u?this.state=h.NULL2:this._error(`Invalid null started with n${o}`);continue;case h.NULL2:o===p.l?this.state=h.NULL3:this._error(`Invalid null started with nu${o}`);continue;case h.NULL3:o===p.l?(this.emit("onvalue",null),this.state=this.stack.pop()||h.VALUE):this._error(`Invalid null started with nul${o}`);continue;case h.NUMBER_DECIMAL_POINT:o===p.period?(this.numberNode+=".",this.state=h.NUMBER_DIGIT):this._error("Leading zero not followed by .");continue;case h.NUMBER_DIGIT:p._0<=o&&o<=p._9?this.numberNode+=String.fromCharCode(o):o===p.period?(this.numberNode.indexOf(".")!==-1&&this._error("Invalid number has two dots"),this.numberNode+="."):o===p.e||o===p.E?((this.numberNode.indexOf("e")!==-1||this.numberNode.indexOf("E")!==-1)&&this._error("Invalid number has two exponential"),this.numberNode+="e"):o===p.plus||o===p.minus?(n===p.e||n===p.E||this._error("Invalid symbol in number"),this.numberNode+=String.fromCharCode(o)):(this._closeNumber(),r--,this.state=this.stack.pop()||h.VALUE);continue;default:this._error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&Rt(this),this.emit("onchunkparsed"),this}_closeValue(e="onvalue"){this.textNode!==void 0&&this.emit(e,this.textNode),this.textNode=void 0}_closeNumber(){this.numberNode&&this.emit("onvalue",parseFloat(this.numberNode)),this.numberNode=""}_error(e=""){this._closeValue(),e+=`
|
|
10
10
|
Line: ${this.line}
|
|
11
11
|
Column: ${this.column}
|
|
12
|
-
Char: ${this.c}`;let r=new Error(e);this.error=r,this.emit("onerror",r)}};function M(t){return t===p.carriageReturn||t===p.lineFeed||t===p.space||t===p.tab}function Rt(t){let e=Math.max(Ae,10),r=0;for(let o of["textNode","numberNode"]){let n=t[o]===void 0?0:t[o].length;if(n>e)switch(o){case"text":break;default:t._error(`Max buffer length exceeded: ${o}`)}r=Math.max(r,n)}t.bufferCheckPosition=Ae-r+t.position}var P=class{path;constructor(e=null){if(this.path=["$"],e instanceof P){this.path=[...e.path];return}if(Array.isArray(e)){this.path.push(...e);return}if(typeof e=="string"&&(this.path=e.split("."),this.path[0]!=="$"))throw new Error("JSONPaths must start with $")}clone(){return new P(this)}toString(){return this.path.join(".")}push(e){this.path.push(e)}pop(){return this.path.pop()}set(e){this.path[this.path.length-1]=e}equals(e){if(!this||!e||this.path.length!==e.path.length)return!1;for(let r=0;r<this.path.length;++r)if(this.path[r]!==e.path[r])return!1;return!0}setFieldAtPath(e,r){let o=[...this.path];o.shift();let n=o.pop();for(let s of o)e=e[s];e[n]=r}getFieldAtPath(e){let r=[...this.path];r.shift();let o=r.pop();for(let n of r)e=e[n];return e[o]}};var z=class{parser;result=void 0;previousStates=[];currentState=Object.freeze({container:[],key:null});jsonpath=new P;constructor(e){this.reset(),this.parser=new L({onready:()=>{this.jsonpath=new P,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:r=>{this._openObject({}),typeof r<"u"&&this.parser.emit("onkey",r)},onkey:r=>{this.jsonpath.set(r),this.currentState.key=r},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:r=>{this._pushOrSet(r)},onerror:r=>{throw r},onend:()=>{this.result=this.currentState.container.pop()},...e})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new P}write(e){this.parser.write(e)}close(){this.parser.close()}_pushOrSet(e){let{container:r,key:o}=this.currentState;o!==null?(r[o]=e,this.currentState.key=null):r.push(e)}_openArray(e=[]){this.jsonpath.push(null),this._pushOrSet(e),this.previousStates.push(this.currentState),this.currentState={container:e,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(e={}){this.jsonpath.push(null),this._pushOrSet(e),this.previousStates.push(this.currentState),this.currentState={container:e,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}};var W=class extends z{jsonPaths;streamingJsonPath=null;streamingArray=null;topLevelObject=null;constructor(e={}){super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath()){this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],this._openArray(this.streamingArray);return}this._openArray()},onopenobject:o=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof o<"u"&&this.parser.emit("onkey",o)}});let r=e.jsonpaths||[];this.jsonPaths=r.map(o=>new P(o))}write(e){super.write(e);let r=[];return this.streamingArray&&(r=[...this.streamingArray],this.streamingArray.length=0),r}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){let e=this.getJsonPath();if(this.jsonPaths.length===0)return!0;for(let r of this.jsonPaths)if(r.equals(e))return!0;return!1}};async function*ae(t,e){let r=G(t),{metadata:o}=e,{jsonpaths:n}=e.json||{},s=!0,a=null,i=new I(a,e),c=new W({jsonpaths:n});for await(let d of r){let f=c.write(d),y=f.length>0&&c.getStreamingJsonPathAsString();f.length>0&&s&&(o&&(yield{shape:e?.json?.shape||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:c.getPartialResult(),jsonpath:y}),s=!1);for(let w of f){i.addRow(w);let A=i.getFullBatch({jsonpath:y});A&&(yield A)}i.chunkComplete(d);let m=i.getFullBatch({jsonpath:y});m&&(yield m)}let l=c.getStreamingJsonPathAsString(),u=i.getFinalBatch({jsonpath:l});u&&(yield u),o&&(yield{shape:"json",batchType:"final-result",container:c.getPartialResult(),jsonpath:c.getStreamingJsonPathAsString(),data:[],length:0})}function Ye(t,e){if(me(t.batchType==="final-result"),t.jsonpath==="$")return e;if(t.jsonpath&&t.jsonpath.length>1){let r=t.container;return new P(t.jsonpath).setFieldAtPath(r,e),r}return t.container}var kt="4.2.0-alpha.
|
|
13
|
-
`).map((o,n)=>{try{return JSON.parse(o)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${n+1}`)}});return J(r)}async function*Qe(t,e){let r=G(t),o=ye(r),n=ge(o),s=null,a="row-table",i=new I(s,{...e,shape:a});for await(let{counter:l,line:u}of n)try{let d=JSON.parse(u);i.addRow(d),i.chunkComplete(u);let f=i.getFullBatch();f&&(yield f)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${l}`)}let c=i.getFinalBatch();c&&(yield c)}var Dt="4.2.0-alpha.5",Xe={name:"NDJSON",id:"ndjson",module:"json",version:Dt,extensions:["ndjson","jsonl"],mimeTypes:["application/x-ndjson","application/jsonlines","application/json-seq"],category:"table",text:!0,parse:async t=>Pe(new TextDecoder().decode(t)),parseTextSync:Pe,parseInBatches:Qe,options:{}};function je(t,e){let r=e?.json?.shape||"object-row-table",o=[],n=de(t,r);for(let s of n)o.push(JSON.stringify(s));return`[${o.join(",")}]`}var qe={id:"json",version:"latest",module:"json",name:"JSON",extensions:["json"],mimeTypes:["application/json"],options:{},text:!0,encode:async(t,e)=>new TextEncoder().encode(je(t,e)).buffer,encodeTextSync:(t,e)=>je(t,e)};var V={x:0,y:1,z:2};function k(t,e={}){let{start:r=0,end:o=t.length,plane:n="xy"}=e,s=e.size||2,a=0,i=V[n[0]],c=V[n[1]];for(let l=r,u=o-s;l<o;l+=s)a+=(t[l+i]-t[u+i])*(t[l+c]+t[u+c]),u=l;return a/2}function Oe(t,e,r=2,o,n="xy"){let s=e&&e.length,a=s?e[0]*r:t.length,i=tt(t,0,a,r,!0,o&&o[0],n),c=[];if(!i||i.next===i.prev)return c;let l,u,d,f,y,m,w;if(s&&(i=$t(t,e,i,r,o,n)),t.length>80*r){f=u=t[0],y=d=t[1];for(let A=r;A<a;A+=r)m=t[A],w=t[A+1],m<f&&(f=m),w<y&&(y=w),m>u&&(u=m),w>d&&(d=w);l=Math.max(u-f,d-y),l=l!==0?32767/l:0}return $(i,c,r,f,y,l,0),c}function tt(t,e,r,o,n,s,a){let i,c;s===void 0&&(s=k(t,{start:e,end:r,size:o,plane:a}));let l=V[a[0]],u=V[a[1]];if(n===s<0)for(i=e;i<r;i+=o)c=et(i,t[i+l],t[i+u],c);else for(i=r-o;i>=e;i-=o)c=et(i,t[i+l],t[i+u],c);return c&&he(c,c.next)&&(K(c),c=c.next),c}function F(t,e){if(!t)return t;e||(e=t);let r=t,o;do if(o=!1,!r.steiner&&(he(r,r.next)||b(r.prev,r,r.next)===0)){if(K(r),r=e=r.prev,r===r.next)break;o=!0}else r=r.next;while(o||r!==e);return e}function $(t,e,r,o,n,s,a){if(!t)return;!a&&s&&Qt(t,o,n,s);let i=t,c,l;for(;t.prev!==t.next;){if(c=t.prev,l=t.next,s?zt(t,o,n,s):Mt(t)){e.push(c.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),K(t),t=l.next,i=l.next;continue}if(t=l,t===i){a?a===1?(t=Wt(F(t),e,r),$(t,e,r,o,n,s,2)):a===2&&Vt(t,e,r,o,n,s):$(F(t),e,r,o,n,s,1);break}}}function Mt(t){let e=t.prev,r=t,o=t.next;if(b(e,r,o)>=0)return!1;let n=e.x,s=r.x,a=o.x,i=e.y,c=r.y,l=o.y,u=n<s?n<a?n:a:s<a?s:a,d=i<c?i<l?i:l:c<l?c:l,f=n>s?n>a?n:a:s>a?s:a,y=i>c?i>l?i:l:c>l?c:l,m=o.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=y&&T(n,i,s,c,a,l,m.x,m.y)&&b(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function zt(t,e,r,o){let n=t.prev,s=t,a=t.next;if(b(n,s,a)>=0)return!1;let i=n.x,c=s.x,l=a.x,u=n.y,d=s.y,f=a.y,y=i<c?i<l?i:l:c<l?c:l,m=u<d?u<f?u:f:d<f?d:f,w=i>c?i>l?i:l:c>l?c:l,A=u>d?u>f?u:f:d>f?d:f,v=Ne(y,m,e,r,o),R=Ne(w,A,e,r,o),x=t.prevZ,g=t.nextZ;for(;x&&x.z>=v&&g&&g.z<=R;){if(x.x>=y&&x.x<=w&&x.y>=m&&x.y<=A&&x!==n&&x!==a&&T(i,u,c,d,l,f,x.x,x.y)&&b(x.prev,x,x.next)>=0||(x=x.prevZ,g.x>=y&&g.x<=w&&g.y>=m&&g.y<=A&&g!==n&&g!==a&&T(i,u,c,d,l,f,g.x,g.y)&&b(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;x&&x.z>=v;){if(x.x>=y&&x.x<=w&&x.y>=m&&x.y<=A&&x!==n&&x!==a&&T(i,u,c,d,l,f,x.x,x.y)&&b(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;g&&g.z<=R;){if(g.x>=y&&g.x<=w&&g.y>=m&&g.y<=A&&g!==n&&g!==a&&T(i,u,c,d,l,f,g.x,g.y)&&b(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function Wt(t,e,r){let o=t;do{let n=o.prev,s=o.next.next;!he(n,s)&&rt(n,o,o.next,s)&&Z(n,s)&&Z(s,n)&&(e.push(n.i/r|0),e.push(o.i/r|0),e.push(s.i/r|0),K(o),K(o.next),o=t=s),o=o.next}while(o!==t);return F(o)}function Vt(t,e,r,o,n,s){let a=t;do{let i=a.next.next;for(;i!==a.prev;){if(a.i!==i.i&&er(a,i)){let c=ot(a,i);a=F(a,a.next),c=F(c,c.next),$(a,e,r,o,n,s,0),$(c,e,r,o,n,s,0);return}i=i.next}a=a.next}while(a!==t)}function $t(t,e,r,o,n,s){let a=[],i,c,l,u,d;for(i=0,c=e.length;i<c;i++)l=e[i]*o,u=i<c-1?e[i+1]*o:t.length,d=tt(t,l,u,o,!1,n&&n[i+1],s),d===d.next&&(d.steiner=!0),a.push(qt(d));for(a.sort(Zt),i=0;i<a.length;i++)r=Kt(a[i],r);return r}function Zt(t,e){return t.x-e.x}function Kt(t,e){let r=Yt(t,e);if(!r)return e;let o=ot(r,t);return F(o,o.next),F(r,r.next)}function Yt(t,e){let r=e,o=t.x,n=t.y,s=-1/0,a;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let f=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(f<=o&&f>s&&(s=f,a=r.x<r.next.x?r:r.next,f===o))return a}r=r.next}while(r!==e);if(!a)return null;let i=a,c=a.x,l=a.y,u=1/0,d;r=a;do o>=r.x&&r.x>=c&&o!==r.x&&T(n<l?o:s,n,c,l,n<l?s:o,n,r.x,r.y)&&(d=Math.abs(n-r.y)/(o-r.x),Z(r,t)&&(d<u||d===u&&(r.x>a.x||r.x===a.x&&Ht(a,r)))&&(a=r,u=d)),r=r.next;while(r!==i);return a}function Ht(t,e){return b(t.prev,t,e.prev)<0&&b(e.next,t,t.next)<0}function Qt(t,e,r,o){let n=t;do n.z===0&&(n.z=Ne(n.x,n.y,e,r,o)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,Xt(n)}function Xt(t){let e,r,o=1,n,s,a,i,c,l;do{for(s=t,t=null,l=null,n=0;s;){for(n++,i=s,a=0,r=0;r<o&&(a++,i=i.nextZ,!!i);r++);for(c=o;a>0||c>0&&i;)a!==0&&(c===0||!i||s.z<=i.z)?(e=s,s=s.nextZ,a--):(e=i,i=i.nextZ,c--),l?l.nextZ=e:t=e,e.prevZ=l,l=e;s=i}l.nextZ=null,o*=2}while(n>1);return t}function Ne(t,e,r,o,n){return t=(t-r)*n|0,e=(e-o)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function qt(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function T(t,e,r,o,n,s,a,i){return(n-a)*(e-i)>=(t-a)*(s-i)&&(t-a)*(o-i)>=(r-a)*(e-i)&&(r-a)*(s-i)>=(n-a)*(o-i)}function er(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!tr(t,e)&&(Z(t,e)&&Z(e,t)&&rr(t,e)&&(b(t.prev,t,e.prev)||b(t,e.prev,e))||he(t,e)&&b(t.prev,t,t.next)>0&&b(e.prev,e,e.next)>0)}function b(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function he(t,e){return t.x===e.x&&t.y===e.y}function rt(t,e,r,o){let n=ue(b(t,e,r)),s=ue(b(t,e,o)),a=ue(b(r,o,t)),i=ue(b(r,o,e));return!!(n!==s&&a!==i||n===0&&le(t,r,e)||s===0&&le(t,o,e)||a===0&&le(r,t,o)||i===0&&le(r,e,o))}function le(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ue(t){return t>0?1:t<0?-1:0}function tr(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&rt(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Z(t,e){return b(t.prev,t,t.next)<0?b(t,e,t.next)>=0&&b(t,t.prev,e)>=0:b(t,e,t.prev)<0||b(t,t.next,e)<0}function rr(t,e){let r=t,o=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(o=!o),r=r.next;while(r!==t);return o}function ot(t,e){let r=new Y(t.i,t.x,t.y),o=new Y(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,o.next=r,r.prev=o,s.next=o,o.prev=s,o}function et(t,e,r,o){let n=new Y(t,e,r);return o?(n.next=o.next,n.prev=o,o.next.prev=n,o.next=n):(n.prev=n,n.next=n),n}function K(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}var Y=class{constructor(e,r,o){j(this,"i",void 0),j(this,"x",void 0),j(this,"y",void 0),j(this,"prev",null),j(this,"next",null),j(this,"z",0),j(this,"prevZ",null),j(this,"nextZ",null),j(this,"steiner",!1),this.i=e,this.x=r,this.y=o}};function it(t,e,r){let o=ar(t),n=Object.keys(o).filter(s=>o[s]!==Array);return cr(t,{propArrayTypes:o,...e},{numericPropKeys:r&&r.numericPropKeys||n,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function ar(t){let e={};for(let r of t)if(r.properties)for(let o in r.properties){let n=r.properties[o];e[o]=dr(n,e[o])}return e}function cr(t,e,r){let{pointPositionsCount:o,pointFeaturesCount:n,linePositionsCount:s,linePathsCount:a,lineFeaturesCount:i,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:d,propArrayTypes:f,coordLength:y}=e,{numericPropKeys:m=[],PositionDataType:w=Float32Array,triangulate:A=!0}=r,v=t[0]&&"id"in t[0],R=t.length>65535?Uint32Array:Uint16Array,x={type:"Point",positions:new w(o*y),globalFeatureIds:new R(o),featureIds:n>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:s>65535?new Uint32Array(a+1):new Uint16Array(a+1),positions:new w(s*y),globalFeatureIds:new R(s),featureIds:i>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},N={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),positions:new w(c*y),globalFeatureIds:new R(c),featureIds:d>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};A&&(N.triangles=[]);for(let O of[x,g,N])for(let _ of m){let S=f[_];O.numericProps[_]=new S(O.positions.length/y)}g.pathIndices[a]=s,N.polygonIndices[l]=c,N.primitivePolygonIndices[u]=c;let C={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let O of t){let _=O.geometry,S=O.properties||{};switch(_.type){case"Point":lr(_,x,C,y,S),x.properties.push(Ie(S,m)),v&&x.fields.push({id:O.id}),C.pointFeature++;break;case"LineString":ur(_,g,C,y,S),g.properties.push(Ie(S,m)),v&&g.fields.push({id:O.id}),C.lineFeature++;break;case"Polygon":hr(_,N,C,y,S),N.properties.push(Ie(S,m)),v&&N.fields.push({id:O.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return pr(x,g,N,y)}function lr(t,e,r,o,n){e.positions.set(t.data,r.pointPosition*o);let s=t.data.length/o;Be(e,n,r.pointPosition,s),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+s),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+s),r.pointPosition+=s}function ur(t,e,r,o,n){e.positions.set(t.data,r.linePosition*o);let s=t.data.length/o;Be(e,n,r.linePosition,s),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+s),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+s);for(let a=0,i=t.indices.length;a<i;++a){let c=t.indices[a],l=a===i-1?t.data.length:t.indices[a+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(l-c)/o}}function hr(t,e,r,o,n){e.positions.set(t.data,r.polygonPosition*o);let s=t.data.length/o;Be(e,n,r.polygonPosition,s),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+s),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+s);for(let a=0,i=t.indices.length;a<i;++a){let c=r.polygonPosition;e.polygonIndices[r.polygonObject++]=c;let l=t.areas[a],u=t.indices[a],d=t.indices[a+1];for(let y=0,m=u.length;y<m;++y){let w=u[y],A=y===m-1?d===void 0?t.data.length:d[0]:u[y+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(A-w)/o}let f=r.polygonPosition;fr(e,l,u,{startPosition:c,endPosition:f,coordLength:o})}}function fr(t,e,r,{startPosition:o,endPosition:n,coordLength:s}){if(!t.triangles)return;let a=o*s,i=n*s,c=t.positions.subarray(a,i),l=r[0],u=r.slice(1).map(f=>(f-l)/s),d=Oe(c,u,s,e);for(let f=0,y=d.length;f<y;++f)t.triangles.push(o+d[f])}function Se(t,e){let r={};for(let o in t)r[o]={value:t[o],size:e};return r}function pr(t,e,r,o){let n={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:o},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Se(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:o},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Se(e.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:o},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Se(r.numericProps,1)}};return n.polygons&&r.triangles&&(n.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),n}function Be(t,e,r,o){for(let n in t.numericProps)if(n in e){let s=e[n];t.numericProps[n].fill(s,r,r+o)}}function Ie(t,e){let r={};for(let o in t)e.includes(o)||(r[o]=t[o]);return r}function dr(t,e){return e===Array||!Number.isFinite(t)?Array:e===Float64Array||Math.fround(t)!==t?Float64Array:Float32Array}function at(t){let e=0,r=0,o=0,n=0,s=0,a=0,i=0,c=0,l=0,u=new Set;for(let d of t){let f=d.geometry;switch(f.type){case"Point":r++,e++,u.add(f.coordinates.length);break;case"MultiPoint":r++,e+=f.coordinates.length;for(let m of f.coordinates)u.add(m.length);break;case"LineString":s++,o+=f.coordinates.length,n++;for(let m of f.coordinates)u.add(m.length);break;case"MultiLineString":s++;for(let m of f.coordinates){o+=m.length,n++;for(let w of m)u.add(w.length)}break;case"Polygon":l++,i++,c+=f.coordinates.length;let y=f.coordinates.flat();a+=y.length;for(let m of y)u.add(m.length);break;case"MultiPolygon":l++;for(let m of f.coordinates){i++,c+=m.length;let w=m.flat();a+=w.length;for(let A of w)u.add(A.length)}break;default:throw new Error(`Unsupported geometry type: ${f.type}`)}}return{coordLength:u.size>0?Math.max(...u):2,pointPositionsCount:e,pointFeaturesCount:r,linePositionsCount:o,linePathsCount:n,lineFeaturesCount:s,polygonPositionsCount:a,polygonObjectsCount:i,polygonRingsCount:c,polygonFeaturesCount:l}}function ut(t,e={coordLength:2,fixRingWinding:!0}){return t.map(r=>mr(r,e))}function ct(t,e,r,o){r.push(e.length),e.push(...t);for(let n=t.length;n<o.coordLength;n++)e.push(0)}function Ee(t,e,r,o){r.push(e.length);for(let n of t){e.push(...n);for(let s=n.length;s<o.coordLength;s++)e.push(0)}}function lt(t,e,r,o,n){let s=0,a=[],i=[];for(let c of t){let l=c.map(f=>f.slice(0,2)),u=k(l.flat()),d=u<0;n.fixRingWinding&&(s===0&&!d||s>0&&d)&&(c.reverse(),u=-u),a.push(u),Ee(c,e,i,n),s++}s>0&&(o.push(a),r.push(i))}function mr(t,e){let{geometry:r}=t;if(r.type==="GeometryCollection")throw new Error("GeometryCollection type not supported");let o=[],n=[],s,a;switch(r.type){case"Point":a="Point",ct(r.coordinates,o,n,e);break;case"MultiPoint":a="Point",r.coordinates.map(i=>ct(i,o,n,e));break;case"LineString":a="LineString",Ee(r.coordinates,o,n,e);break;case"MultiLineString":a="LineString",r.coordinates.map(i=>Ee(i,o,n,e));break;case"Polygon":a="Polygon",s=[],lt(r.coordinates,o,n,s,e);break;case"MultiPolygon":a="Polygon",s=[],r.coordinates.map(i=>lt(i,o,n,s,e));break;default:throw new Error(`Unknown type: ${a}`)}return{...t,geometry:{type:a,indices:n,data:o,areas:s}}}function fe(t,e={fixRingWinding:!0,triangulate:!0}){let r=at(t),o=r.coordLength,{fixRingWinding:n}=e,s=ut(t,{coordLength:o,fixRingWinding:n});return it(s,r,{numericPropKeys:e.numericPropKeys,PositionDataType:e.PositionDataType||Float32Array,triangulate:e.triangulate})}var yr="4.2.0-alpha.5",Ce={name:"GeoJSON",id:"geojson",module:"geojson",version:yr,worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"object-row-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}}},U={...Ce,parse:gr,parseTextSync:ht,parseInBatches:xr};async function gr(t,e){return ht(new TextDecoder().decode(t),e)}function ht(t,e){e={...U.options,...e},e.geojson={...U.options.geojson,...e.geojson},e.gis=e.gis||{};let r;try{r=JSON.parse(t)}catch{r={}}let o={shape:"geojson-table",type:"FeatureCollection",features:r?.features||[]};switch(e.gis.format){case"binary":return fe(o.features);default:return o}}function xr(t,e){e={...U.options,...e},e.json={...U.options.geojson,...e.geojson};let r=ae(t,e);switch(e.gis.format){case"binary":return wr(r);default:return r}}async function*wr(t){for await(let e of t)e.data=fe(e.data),yield e}function ft(t){let e=t.schema?.fields.findIndex(r=>r.name==="geometry")??-1;if(e>-1)return e;if(B(t)>0){let r=se(t,0);for(let o=0;o<oe(t);o++){let n=r?.[o];if(n&&typeof n=="object")return o}}throw new Error("Failed to detect geometry column")}function pt(t,e,r=[]){let o={};for(let n=0;n<oe(t);++n){let s=t.schema?.fields[n].name;s&&!r.includes(n)&&(o[s]=e[s])}return o}function dt(t,e,r,o){let n=ne(t,e);if(!n)return;let s=br(t,n,r),a=JSON.stringify(s);o.push(a)}function br(t,e,r){let o=pt(t,e,[r]),n=t.schema?.fields[r].name,s=n&&e[n];if(!s)return{type:"Feature",geometry:null,properties:o};if(typeof s=="string")try{s=JSON.parse(s)}catch{throw new Error("Invalid string geometry")}if(typeof s!="object"||typeof s?.type!="string")throw new Error("invalid geometry column value");return s?.type==="Feature"?{...s,properties:o}:{type:"Feature",geometry:s,properties:o}}var pe=class{chunkSize;strings=[];totalLength=0;textEncoder=new TextEncoder;constructor(e){this.chunkSize=e}push(...e){for(let r of e)this.strings.push(r),this.totalLength+=r.length}isFull(){return this.totalLength>=this.chunkSize}getArrayBufferBatch(){return this.textEncoder.encode(this.getStringBatch()).buffer}getStringBatch(){let e=this.strings.join("");return this.strings=[],this.totalLength=0,e}};async function*_e(t,e={}){let r={geojson:{},chunkSize:1e4,...e},o=new pe(r.chunkSize);r.geojson.featureArray||o.push(`{
|
|
12
|
+
Char: ${this.c}`;let r=new Error(e);this.error=r,this.emit("onerror",r)}};function M(t){return t===p.carriageReturn||t===p.lineFeed||t===p.space||t===p.tab}function Rt(t){let e=Math.max(Ae,10),r=0;for(let o of["textNode","numberNode"]){let n=t[o]===void 0?0:t[o].length;if(n>e)switch(o){case"text":break;default:t._error(`Max buffer length exceeded: ${o}`)}r=Math.max(r,n)}t.bufferCheckPosition=Ae-r+t.position}var P=class{path;constructor(e=null){if(this.path=["$"],e instanceof P){this.path=[...e.path];return}if(Array.isArray(e)){this.path.push(...e);return}if(typeof e=="string"&&(this.path=e.split("."),this.path[0]!=="$"))throw new Error("JSONPaths must start with $")}clone(){return new P(this)}toString(){return this.path.join(".")}push(e){this.path.push(e)}pop(){return this.path.pop()}set(e){this.path[this.path.length-1]=e}equals(e){if(!this||!e||this.path.length!==e.path.length)return!1;for(let r=0;r<this.path.length;++r)if(this.path[r]!==e.path[r])return!1;return!0}setFieldAtPath(e,r){let o=[...this.path];o.shift();let n=o.pop();for(let s of o)e=e[s];e[n]=r}getFieldAtPath(e){let r=[...this.path];r.shift();let o=r.pop();for(let n of r)e=e[n];return e[o]}};var z=class{parser;result=void 0;previousStates=[];currentState=Object.freeze({container:[],key:null});jsonpath=new P;constructor(e){this.reset(),this.parser=new L({onready:()=>{this.jsonpath=new P,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:r=>{this._openObject({}),typeof r<"u"&&this.parser.emit("onkey",r)},onkey:r=>{this.jsonpath.set(r),this.currentState.key=r},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:r=>{this._pushOrSet(r)},onerror:r=>{throw r},onend:()=>{this.result=this.currentState.container.pop()},...e})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new P}write(e){this.parser.write(e)}close(){this.parser.close()}_pushOrSet(e){let{container:r,key:o}=this.currentState;o!==null?(r[o]=e,this.currentState.key=null):r.push(e)}_openArray(e=[]){this.jsonpath.push(null),this._pushOrSet(e),this.previousStates.push(this.currentState),this.currentState={container:e,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(e={}){this.jsonpath.push(null),this._pushOrSet(e),this.previousStates.push(this.currentState),this.currentState={container:e,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}};var W=class extends z{jsonPaths;streamingJsonPath=null;streamingArray=null;topLevelObject=null;constructor(e={}){super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath()){this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],this._openArray(this.streamingArray);return}this._openArray()},onopenobject:o=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof o<"u"&&this.parser.emit("onkey",o)}});let r=e.jsonpaths||[];this.jsonPaths=r.map(o=>new P(o))}write(e){super.write(e);let r=[];return this.streamingArray&&(r=[...this.streamingArray],this.streamingArray.length=0),r}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){let e=this.getJsonPath();if(this.jsonPaths.length===0)return!0;for(let r of this.jsonPaths)if(r.equals(e))return!0;return!1}};async function*ae(t,e){let r=G(t),{metadata:o}=e,{jsonpaths:n}=e.json||{},s=!0,a=null,i=new I(a,e),c=new W({jsonpaths:n});for await(let d of r){let f=c.write(d),y=f.length>0&&c.getStreamingJsonPathAsString();f.length>0&&s&&(o&&(yield{shape:e?.json?.shape||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:c.getPartialResult(),jsonpath:y}),s=!1);for(let w of f){i.addRow(w);let A=i.getFullBatch({jsonpath:y});A&&(yield A)}i.chunkComplete(d);let m=i.getFullBatch({jsonpath:y});m&&(yield m)}let l=c.getStreamingJsonPathAsString(),u=i.getFinalBatch({jsonpath:l});u&&(yield u),o&&(yield{shape:"json",batchType:"final-result",container:c.getPartialResult(),jsonpath:c.getStreamingJsonPathAsString(),data:[],length:0})}function Ye(t,e){if(me(t.batchType==="final-result"),t.jsonpath==="$")return e;if(t.jsonpath&&t.jsonpath.length>1){let r=t.container;return new P(t.jsonpath).setFieldAtPath(r,e),r}return t.container}var kt="4.2.0-alpha.6",ce={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:kt,extensions:["json","geojson"],mimeTypes:["application/json"],category:"table",text:!0,options:{json:{shape:void 0,table:!1,jsonpaths:[]}},parse:Tt,parseTextSync:He,parseInBatches:Ut};async function Tt(t,e){return He(new TextDecoder().decode(t),e)}function He(t,e){let r={...e,json:{...ce.options.json,...e?.json}};return We(t,r)}function Ut(t,e){let r={...e,json:{...ce.options.json,...e?.json}};return ae(t,r)}function Pe(t){let r=t.trim().split(`
|
|
13
|
+
`).map((o,n)=>{try{return JSON.parse(o)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${n+1}`)}});return J(r)}async function*Qe(t,e){let r=G(t),o=xe(r),n=we(o),s=null,a="row-table",i=new I(s,{...e,shape:a});for await(let{counter:l,line:u}of n)try{let d=JSON.parse(u);i.addRow(d),i.chunkComplete(u);let f=i.getFullBatch();f&&(yield f)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${l}`)}let c=i.getFinalBatch();c&&(yield c)}var Dt="4.2.0-alpha.6",Xe={dataType:null,batchType:null,name:"NDJSON",id:"ndjson",module:"json",version:Dt,extensions:["ndjson","jsonl"],mimeTypes:["application/x-ndjson","application/jsonlines","application/json-seq"],category:"table",text:!0,parse:async t=>Pe(new TextDecoder().decode(t)),parseTextSync:Pe,parseInBatches:Qe,options:{}};function je(t,e){let r=e?.json?.shape||"object-row-table",o=[],n=de(t,r);for(let s of n)o.push(JSON.stringify(s));return`[${o.join(",")}]`}var qe={id:"json",version:"latest",module:"json",name:"JSON",extensions:["json"],mimeTypes:["application/json"],options:{},text:!0,encode:async(t,e)=>new TextEncoder().encode(je(t,e)).buffer,encodeTextSync:(t,e)=>je(t,e)};var V={x:0,y:1,z:2};function k(t,e={}){let{start:r=0,end:o=t.length,plane:n="xy"}=e,s=e.size||2,a=0,i=V[n[0]],c=V[n[1]];for(let l=r,u=o-s;l<o;l+=s)a+=(t[l+i]-t[u+i])*(t[l+c]+t[u+c]),u=l;return a/2}function Oe(t,e,r=2,o,n="xy"){let s=e&&e.length,a=s?e[0]*r:t.length,i=tt(t,0,a,r,!0,o&&o[0],n),c=[];if(!i||i.next===i.prev)return c;let l,u,d,f,y,m,w;if(s&&(i=$t(t,e,i,r,o,n)),t.length>80*r){f=u=t[0],y=d=t[1];for(let A=r;A<a;A+=r)m=t[A],w=t[A+1],m<f&&(f=m),w<y&&(y=w),m>u&&(u=m),w>d&&(d=w);l=Math.max(u-f,d-y),l=l!==0?32767/l:0}return $(i,c,r,f,y,l,0),c}function tt(t,e,r,o,n,s,a){let i,c;s===void 0&&(s=k(t,{start:e,end:r,size:o,plane:a}));let l=V[a[0]],u=V[a[1]];if(n===s<0)for(i=e;i<r;i+=o)c=et(i,t[i+l],t[i+u],c);else for(i=r-o;i>=e;i-=o)c=et(i,t[i+l],t[i+u],c);return c&&he(c,c.next)&&(K(c),c=c.next),c}function F(t,e){if(!t)return t;e||(e=t);let r=t,o;do if(o=!1,!r.steiner&&(he(r,r.next)||b(r.prev,r,r.next)===0)){if(K(r),r=e=r.prev,r===r.next)break;o=!0}else r=r.next;while(o||r!==e);return e}function $(t,e,r,o,n,s,a){if(!t)return;!a&&s&&Qt(t,o,n,s);let i=t,c,l;for(;t.prev!==t.next;){if(c=t.prev,l=t.next,s?zt(t,o,n,s):Mt(t)){e.push(c.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),K(t),t=l.next,i=l.next;continue}if(t=l,t===i){a?a===1?(t=Wt(F(t),e,r),$(t,e,r,o,n,s,2)):a===2&&Vt(t,e,r,o,n,s):$(F(t),e,r,o,n,s,1);break}}}function Mt(t){let e=t.prev,r=t,o=t.next;if(b(e,r,o)>=0)return!1;let n=e.x,s=r.x,a=o.x,i=e.y,c=r.y,l=o.y,u=n<s?n<a?n:a:s<a?s:a,d=i<c?i<l?i:l:c<l?c:l,f=n>s?n>a?n:a:s>a?s:a,y=i>c?i>l?i:l:c>l?c:l,m=o.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=y&&T(n,i,s,c,a,l,m.x,m.y)&&b(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function zt(t,e,r,o){let n=t.prev,s=t,a=t.next;if(b(n,s,a)>=0)return!1;let i=n.x,c=s.x,l=a.x,u=n.y,d=s.y,f=a.y,y=i<c?i<l?i:l:c<l?c:l,m=u<d?u<f?u:f:d<f?d:f,w=i>c?i>l?i:l:c>l?c:l,A=u>d?u>f?u:f:d>f?d:f,v=Ne(y,m,e,r,o),R=Ne(w,A,e,r,o),x=t.prevZ,g=t.nextZ;for(;x&&x.z>=v&&g&&g.z<=R;){if(x.x>=y&&x.x<=w&&x.y>=m&&x.y<=A&&x!==n&&x!==a&&T(i,u,c,d,l,f,x.x,x.y)&&b(x.prev,x,x.next)>=0||(x=x.prevZ,g.x>=y&&g.x<=w&&g.y>=m&&g.y<=A&&g!==n&&g!==a&&T(i,u,c,d,l,f,g.x,g.y)&&b(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;x&&x.z>=v;){if(x.x>=y&&x.x<=w&&x.y>=m&&x.y<=A&&x!==n&&x!==a&&T(i,u,c,d,l,f,x.x,x.y)&&b(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;g&&g.z<=R;){if(g.x>=y&&g.x<=w&&g.y>=m&&g.y<=A&&g!==n&&g!==a&&T(i,u,c,d,l,f,g.x,g.y)&&b(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function Wt(t,e,r){let o=t;do{let n=o.prev,s=o.next.next;!he(n,s)&&rt(n,o,o.next,s)&&Z(n,s)&&Z(s,n)&&(e.push(n.i/r|0),e.push(o.i/r|0),e.push(s.i/r|0),K(o),K(o.next),o=t=s),o=o.next}while(o!==t);return F(o)}function Vt(t,e,r,o,n,s){let a=t;do{let i=a.next.next;for(;i!==a.prev;){if(a.i!==i.i&&er(a,i)){let c=ot(a,i);a=F(a,a.next),c=F(c,c.next),$(a,e,r,o,n,s,0),$(c,e,r,o,n,s,0);return}i=i.next}a=a.next}while(a!==t)}function $t(t,e,r,o,n,s){let a=[],i,c,l,u,d;for(i=0,c=e.length;i<c;i++)l=e[i]*o,u=i<c-1?e[i+1]*o:t.length,d=tt(t,l,u,o,!1,n&&n[i+1],s),d===d.next&&(d.steiner=!0),a.push(qt(d));for(a.sort(Zt),i=0;i<a.length;i++)r=Kt(a[i],r);return r}function Zt(t,e){return t.x-e.x}function Kt(t,e){let r=Yt(t,e);if(!r)return e;let o=ot(r,t);return F(o,o.next),F(r,r.next)}function Yt(t,e){let r=e,o=t.x,n=t.y,s=-1/0,a;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let f=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(f<=o&&f>s&&(s=f,a=r.x<r.next.x?r:r.next,f===o))return a}r=r.next}while(r!==e);if(!a)return null;let i=a,c=a.x,l=a.y,u=1/0,d;r=a;do o>=r.x&&r.x>=c&&o!==r.x&&T(n<l?o:s,n,c,l,n<l?s:o,n,r.x,r.y)&&(d=Math.abs(n-r.y)/(o-r.x),Z(r,t)&&(d<u||d===u&&(r.x>a.x||r.x===a.x&&Ht(a,r)))&&(a=r,u=d)),r=r.next;while(r!==i);return a}function Ht(t,e){return b(t.prev,t,e.prev)<0&&b(e.next,t,t.next)<0}function Qt(t,e,r,o){let n=t;do n.z===0&&(n.z=Ne(n.x,n.y,e,r,o)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,Xt(n)}function Xt(t){let e,r,o=1,n,s,a,i,c,l;do{for(s=t,t=null,l=null,n=0;s;){for(n++,i=s,a=0,r=0;r<o&&(a++,i=i.nextZ,!!i);r++);for(c=o;a>0||c>0&&i;)a!==0&&(c===0||!i||s.z<=i.z)?(e=s,s=s.nextZ,a--):(e=i,i=i.nextZ,c--),l?l.nextZ=e:t=e,e.prevZ=l,l=e;s=i}l.nextZ=null,o*=2}while(n>1);return t}function Ne(t,e,r,o,n){return t=(t-r)*n|0,e=(e-o)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function qt(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function T(t,e,r,o,n,s,a,i){return(n-a)*(e-i)>=(t-a)*(s-i)&&(t-a)*(o-i)>=(r-a)*(e-i)&&(r-a)*(s-i)>=(n-a)*(o-i)}function er(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!tr(t,e)&&(Z(t,e)&&Z(e,t)&&rr(t,e)&&(b(t.prev,t,e.prev)||b(t,e.prev,e))||he(t,e)&&b(t.prev,t,t.next)>0&&b(e.prev,e,e.next)>0)}function b(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function he(t,e){return t.x===e.x&&t.y===e.y}function rt(t,e,r,o){let n=ue(b(t,e,r)),s=ue(b(t,e,o)),a=ue(b(r,o,t)),i=ue(b(r,o,e));return!!(n!==s&&a!==i||n===0&&le(t,r,e)||s===0&&le(t,o,e)||a===0&&le(r,t,o)||i===0&&le(r,e,o))}function le(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function ue(t){return t>0?1:t<0?-1:0}function tr(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&rt(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Z(t,e){return b(t.prev,t,t.next)<0?b(t,e,t.next)>=0&&b(t,t.prev,e)>=0:b(t,e,t.prev)<0||b(t,t.next,e)<0}function rr(t,e){let r=t,o=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(o=!o),r=r.next;while(r!==t);return o}function ot(t,e){let r=new Y(t.i,t.x,t.y),o=new Y(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,o.next=r,r.prev=o,s.next=o,o.prev=s,o}function et(t,e,r,o){let n=new Y(t,e,r);return o?(n.next=o.next,n.prev=o,o.next.prev=n,o.next=n):(n.prev=n,n.next=n),n}function K(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}var Y=class{constructor(e,r,o){j(this,"i",void 0),j(this,"x",void 0),j(this,"y",void 0),j(this,"prev",null),j(this,"next",null),j(this,"z",0),j(this,"prevZ",null),j(this,"nextZ",null),j(this,"steiner",!1),this.i=e,this.x=r,this.y=o}};function it(t,e,r){let o=ar(t),n=Object.keys(o).filter(s=>o[s]!==Array);return cr(t,{propArrayTypes:o,...e},{numericPropKeys:r&&r.numericPropKeys||n,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function ar(t){let e={};for(let r of t)if(r.properties)for(let o in r.properties){let n=r.properties[o];e[o]=dr(n,e[o])}return e}function cr(t,e,r){let{pointPositionsCount:o,pointFeaturesCount:n,linePositionsCount:s,linePathsCount:a,lineFeaturesCount:i,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:d,propArrayTypes:f,coordLength:y}=e,{numericPropKeys:m=[],PositionDataType:w=Float32Array,triangulate:A=!0}=r,v=t[0]&&"id"in t[0],R=t.length>65535?Uint32Array:Uint16Array,x={type:"Point",positions:new w(o*y),globalFeatureIds:new R(o),featureIds:n>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:s>65535?new Uint32Array(a+1):new Uint16Array(a+1),positions:new w(s*y),globalFeatureIds:new R(s),featureIds:i>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},N={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),positions:new w(c*y),globalFeatureIds:new R(c),featureIds:d>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};A&&(N.triangles=[]);for(let O of[x,g,N])for(let _ of m){let S=f[_];O.numericProps[_]=new S(O.positions.length/y)}g.pathIndices[a]=s,N.polygonIndices[l]=c,N.primitivePolygonIndices[u]=c;let C={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let O of t){let _=O.geometry,S=O.properties||{};switch(_.type){case"Point":lr(_,x,C,y,S),x.properties.push(Ie(S,m)),v&&x.fields.push({id:O.id}),C.pointFeature++;break;case"LineString":ur(_,g,C,y,S),g.properties.push(Ie(S,m)),v&&g.fields.push({id:O.id}),C.lineFeature++;break;case"Polygon":hr(_,N,C,y,S),N.properties.push(Ie(S,m)),v&&N.fields.push({id:O.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return pr(x,g,N,y)}function lr(t,e,r,o,n){e.positions.set(t.data,r.pointPosition*o);let s=t.data.length/o;Be(e,n,r.pointPosition,s),e.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+s),e.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+s),r.pointPosition+=s}function ur(t,e,r,o,n){e.positions.set(t.data,r.linePosition*o);let s=t.data.length/o;Be(e,n,r.linePosition,s),e.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+s),e.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+s);for(let a=0,i=t.indices.length;a<i;++a){let c=t.indices[a],l=a===i-1?t.data.length:t.indices[a+1];e.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(l-c)/o}}function hr(t,e,r,o,n){e.positions.set(t.data,r.polygonPosition*o);let s=t.data.length/o;Be(e,n,r.polygonPosition,s),e.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+s),e.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+s);for(let a=0,i=t.indices.length;a<i;++a){let c=r.polygonPosition;e.polygonIndices[r.polygonObject++]=c;let l=t.areas[a],u=t.indices[a],d=t.indices[a+1];for(let y=0,m=u.length;y<m;++y){let w=u[y],A=y===m-1?d===void 0?t.data.length:d[0]:u[y+1];e.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(A-w)/o}let f=r.polygonPosition;fr(e,l,u,{startPosition:c,endPosition:f,coordLength:o})}}function fr(t,e,r,{startPosition:o,endPosition:n,coordLength:s}){if(!t.triangles)return;let a=o*s,i=n*s,c=t.positions.subarray(a,i),l=r[0],u=r.slice(1).map(f=>(f-l)/s),d=Oe(c,u,s,e);for(let f=0,y=d.length;f<y;++f)t.triangles.push(o+d[f])}function Se(t,e){let r={};for(let o in t)r[o]={value:t[o],size:e};return r}function pr(t,e,r,o){let n={shape:"binary-feature-collection",points:{...t,positions:{value:t.positions,size:o},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Se(t.numericProps,1)},lines:{...e,positions:{value:e.positions,size:o},pathIndices:{value:e.pathIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Se(e.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:o},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Se(r.numericProps,1)}};return n.polygons&&r.triangles&&(n.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),n}function Be(t,e,r,o){for(let n in t.numericProps)if(n in e){let s=e[n];t.numericProps[n].fill(s,r,r+o)}}function Ie(t,e){let r={};for(let o in t)e.includes(o)||(r[o]=t[o]);return r}function dr(t,e){return e===Array||!Number.isFinite(t)?Array:e===Float64Array||Math.fround(t)!==t?Float64Array:Float32Array}function at(t){let e=0,r=0,o=0,n=0,s=0,a=0,i=0,c=0,l=0,u=new Set;for(let d of t){let f=d.geometry;switch(f.type){case"Point":r++,e++,u.add(f.coordinates.length);break;case"MultiPoint":r++,e+=f.coordinates.length;for(let m of f.coordinates)u.add(m.length);break;case"LineString":s++,o+=f.coordinates.length,n++;for(let m of f.coordinates)u.add(m.length);break;case"MultiLineString":s++;for(let m of f.coordinates){o+=m.length,n++;for(let w of m)u.add(w.length)}break;case"Polygon":l++,i++,c+=f.coordinates.length;let y=f.coordinates.flat();a+=y.length;for(let m of y)u.add(m.length);break;case"MultiPolygon":l++;for(let m of f.coordinates){i++,c+=m.length;let w=m.flat();a+=w.length;for(let A of w)u.add(A.length)}break;default:throw new Error(`Unsupported geometry type: ${f.type}`)}}return{coordLength:u.size>0?Math.max(...u):2,pointPositionsCount:e,pointFeaturesCount:r,linePositionsCount:o,linePathsCount:n,lineFeaturesCount:s,polygonPositionsCount:a,polygonObjectsCount:i,polygonRingsCount:c,polygonFeaturesCount:l}}function ut(t,e={coordLength:2,fixRingWinding:!0}){return t.map(r=>mr(r,e))}function ct(t,e,r,o){r.push(e.length),e.push(...t);for(let n=t.length;n<o.coordLength;n++)e.push(0)}function Ee(t,e,r,o){r.push(e.length);for(let n of t){e.push(...n);for(let s=n.length;s<o.coordLength;s++)e.push(0)}}function lt(t,e,r,o,n){let s=0,a=[],i=[];for(let c of t){let l=c.map(f=>f.slice(0,2)),u=k(l.flat()),d=u<0;n.fixRingWinding&&(s===0&&!d||s>0&&d)&&(c.reverse(),u=-u),a.push(u),Ee(c,e,i,n),s++}s>0&&(o.push(a),r.push(i))}function mr(t,e){let{geometry:r}=t;if(r.type==="GeometryCollection")throw new Error("GeometryCollection type not supported");let o=[],n=[],s,a;switch(r.type){case"Point":a="Point",ct(r.coordinates,o,n,e);break;case"MultiPoint":a="Point",r.coordinates.map(i=>ct(i,o,n,e));break;case"LineString":a="LineString",Ee(r.coordinates,o,n,e);break;case"MultiLineString":a="LineString",r.coordinates.map(i=>Ee(i,o,n,e));break;case"Polygon":a="Polygon",s=[],lt(r.coordinates,o,n,s,e);break;case"MultiPolygon":a="Polygon",s=[],r.coordinates.map(i=>lt(i,o,n,s,e));break;default:throw new Error(`Unknown type: ${a}`)}return{...t,geometry:{type:a,indices:n,data:o,areas:s}}}function fe(t,e={fixRingWinding:!0,triangulate:!0}){let r=at(t),o=r.coordLength,{fixRingWinding:n}=e,s=ut(t,{coordLength:o,fixRingWinding:n});return it(s,r,{numericPropKeys:e.numericPropKeys,PositionDataType:e.PositionDataType||Float32Array,triangulate:e.triangulate})}var yr="4.2.0-alpha.6",Ce={dataType:null,batchType:null,name:"GeoJSON",id:"geojson",module:"geojson",version:yr,worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"object-row-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}}},U={...Ce,parse:gr,parseTextSync:ht,parseInBatches:xr};async function gr(t,e){return ht(new TextDecoder().decode(t),e)}function ht(t,e){e={...U.options,...e},e.geojson={...U.options.geojson,...e.geojson},e.gis=e.gis||{};let r;try{r=JSON.parse(t)}catch{r={}}let o={shape:"geojson-table",type:"FeatureCollection",features:r?.features||[]};switch(e.gis.format){case"binary":return fe(o.features);default:return o}}function xr(t,e){e={...U.options,...e},e.json={...U.options.geojson,...e.geojson};let r=ae(t,e);switch(e.gis.format){case"binary":return wr(r);default:return r}}async function*wr(t){for await(let e of t)e.data=fe(e.data),yield e}function ft(t){let e=t.schema?.fields.findIndex(r=>r.name==="geometry")??-1;if(e>-1)return e;if(B(t)>0){let r=se(t,0);for(let o=0;o<oe(t);o++){let n=r?.[o];if(n&&typeof n=="object")return o}}throw new Error("Failed to detect geometry column")}function pt(t,e,r=[]){let o={};for(let n=0;n<oe(t);++n){let s=t.schema?.fields[n].name;s&&!r.includes(n)&&(o[s]=e[s])}return o}function dt(t,e,r,o){let n=ne(t,e);if(!n)return;let s=br(t,n,r),a=JSON.stringify(s);o.push(a)}function br(t,e,r){let o=pt(t,e,[r]),n=t.schema?.fields[r].name,s=n&&e[n];if(!s)return{type:"Feature",geometry:null,properties:o};if(typeof s=="string")try{s=JSON.parse(s)}catch{throw new Error("Invalid string geometry")}if(typeof s!="object"||typeof s?.type!="string")throw new Error("invalid geometry column value");return s?.type==="Feature"?{...s,properties:o}:{type:"Feature",geometry:s,properties:o}}var pe=class{chunkSize;strings=[];totalLength=0;textEncoder=new TextEncoder;constructor(e){this.chunkSize=e}push(...e){for(let r of e)this.strings.push(r),this.totalLength+=r.length}isFull(){return this.totalLength>=this.chunkSize}getArrayBufferBatch(){return this.textEncoder.encode(this.getStringBatch()).buffer}getStringBatch(){let e=this.strings.join("");return this.strings=[],this.totalLength=0,e}};async function*_e(t,e={}){let r={geojson:{},chunkSize:1e4,...e},o=new pe(r.chunkSize);r.geojson.featureArray||o.push(`{
|
|
14
14
|
`,`"type": "FeatureCollection",
|
|
15
15
|
`,`"features":
|
|
16
16
|
`),o.push("[");let n=r.geojson.geometryColumn,s=!0,a=0;for await(let i of t){let c=a+B(i);n||(n=n||ft(i));for(let u=a;u<c;++u)s||o.push(","),o.push(`
|
|
17
17
|
`),s=!1,dt(i,u,n,o),o.isFull()&&(yield o.getArrayBufferBatch()),a=c;let l=o.getArrayBufferBatch();l.byteLength>0&&(yield l)}o.push(`
|
|
18
18
|
`),o.push(`]
|
|
19
|
-
`),r.geojson.featureArray||o.push("}"),yield o.getArrayBufferBatch()}var mt={id:"geojson",version:"latest",module:"geojson",name:"GeoJSON",extensions:["geojson"],mimeTypes:["application/geo+json"],text:!0,options:{geojson:{featureArray:!1,geometryColumn:null}},async encode(t,e){let o=_e([t],e);return await
|
|
19
|
+
`),r.geojson.featureArray||o.push("}"),yield o.getArrayBufferBatch()}var mt={id:"geojson",version:"latest",module:"geojson",name:"GeoJSON",extensions:["geojson"],mimeTypes:["application/geo+json"],text:!0,options:{geojson:{featureArray:!1,geometryColumn:null}},async encode(t,e){let o=_e([t],e);return await be(o)},encodeInBatches:(t,e)=>_e(t,e)};return Ot(H);})();
|
|
20
20
|
return __exports__;
|
|
21
21
|
});
|
package/dist/geojson-loader.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { GeoJSON, TableBatch } from '@loaders.gl/schema';
|
|
1
|
+
import type { GeoJSON, GeoJSONTable, TableBatch } from '@loaders.gl/schema';
|
|
3
2
|
import type { JSONLoaderOptions } from "./json-loader.js";
|
|
4
3
|
export type GeoJSONLoaderOptions = JSONLoaderOptions & {
|
|
5
4
|
geojson?: {
|
|
@@ -12,6 +11,61 @@ export type GeoJSONLoaderOptions = JSONLoaderOptions & {
|
|
|
12
11
|
/**
|
|
13
12
|
* GeoJSON loader
|
|
14
13
|
*/
|
|
15
|
-
export declare const GeoJSONWorkerLoader:
|
|
16
|
-
|
|
14
|
+
export declare const GeoJSONWorkerLoader: {
|
|
15
|
+
readonly dataType: GeoJSON;
|
|
16
|
+
readonly batchType: TableBatch;
|
|
17
|
+
readonly name: "GeoJSON";
|
|
18
|
+
readonly id: "geojson";
|
|
19
|
+
readonly module: "geojson";
|
|
20
|
+
readonly version: any;
|
|
21
|
+
readonly worker: true;
|
|
22
|
+
readonly extensions: ["geojson"];
|
|
23
|
+
readonly mimeTypes: ["application/geo+json"];
|
|
24
|
+
readonly category: "geometry";
|
|
25
|
+
readonly text: true;
|
|
26
|
+
readonly options: {
|
|
27
|
+
readonly geojson: {
|
|
28
|
+
readonly shape: "object-row-table";
|
|
29
|
+
};
|
|
30
|
+
readonly json: {
|
|
31
|
+
readonly shape: "object-row-table";
|
|
32
|
+
readonly jsonpaths: ["$", "$.features"];
|
|
33
|
+
};
|
|
34
|
+
readonly gis: {
|
|
35
|
+
readonly format: "geojson";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const GeoJSONLoader: {
|
|
40
|
+
readonly parse: typeof parse;
|
|
41
|
+
readonly parseTextSync: typeof parseTextSync;
|
|
42
|
+
readonly parseInBatches: typeof parseInBatches;
|
|
43
|
+
readonly dataType: GeoJSON;
|
|
44
|
+
readonly batchType: TableBatch;
|
|
45
|
+
readonly name: "GeoJSON";
|
|
46
|
+
readonly id: "geojson";
|
|
47
|
+
readonly module: "geojson";
|
|
48
|
+
readonly version: any;
|
|
49
|
+
readonly worker: true;
|
|
50
|
+
readonly extensions: ["geojson"];
|
|
51
|
+
readonly mimeTypes: ["application/geo+json"];
|
|
52
|
+
readonly category: "geometry";
|
|
53
|
+
readonly text: true;
|
|
54
|
+
readonly options: {
|
|
55
|
+
readonly geojson: {
|
|
56
|
+
readonly shape: "object-row-table";
|
|
57
|
+
};
|
|
58
|
+
readonly json: {
|
|
59
|
+
readonly shape: "object-row-table";
|
|
60
|
+
readonly jsonpaths: ["$", "$.features"];
|
|
61
|
+
};
|
|
62
|
+
readonly gis: {
|
|
63
|
+
readonly format: "geojson";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
declare function parse(arrayBuffer: ArrayBuffer, options?: GeoJSONLoaderOptions): Promise<GeoJSONTable | import("@loaders.gl/schema").BinaryFeatureCollection>;
|
|
68
|
+
declare function parseTextSync(text: string, options?: GeoJSONLoaderOptions): GeoJSONTable | import("@loaders.gl/schema").BinaryFeatureCollection;
|
|
69
|
+
declare function parseInBatches(asyncIterator: any, options: any): AsyncIterable<TableBatch>;
|
|
70
|
+
export {};
|
|
17
71
|
//# sourceMappingURL=geojson-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAC,iBAAiB,EAAC,yBAAsB;AASrD,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG;IACrD,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,kBAAkB,CAAC;KAC5B,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;KAC/B,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;CAyBsC,CAAC;AAEvE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOsD,CAAC;AAEjF,iBAAe,KAAK,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,oBAAoB,gFAE5E;AAED,iBAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,oBAAoB,uEA2BlE;AAED,iBAAS,cAAc,CAAC,aAAa,KAAA,EAAE,OAAO,KAAA,GAAG,aAAa,CAAC,UAAU,CAAC,CAazE"}
|
package/dist/geojson-loader.js
CHANGED
|
@@ -6,11 +6,13 @@ import { geojsonToBinary } from '@loaders.gl/gis';
|
|
|
6
6
|
import { parseJSONInBatches } from "./lib/parsers/parse-json-in-batches.js";
|
|
7
7
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
8
8
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
-
const VERSION = typeof "4.2.0-alpha.
|
|
9
|
+
const VERSION = typeof "4.2.0-alpha.6" !== 'undefined' ? "4.2.0-alpha.6" : 'latest';
|
|
10
10
|
/**
|
|
11
11
|
* GeoJSON loader
|
|
12
12
|
*/
|
|
13
13
|
export const GeoJSONWorkerLoader = {
|
|
14
|
+
dataType: null,
|
|
15
|
+
batchType: null,
|
|
14
16
|
name: 'GeoJSON',
|
|
15
17
|
id: 'geojson',
|
|
16
18
|
module: 'geojson',
|
package/dist/geojson-worker.js
CHANGED
|
@@ -7,6 +7,52 @@
|
|
|
7
7
|
return value;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
11
|
+
function _typeof(obj) {
|
|
12
|
+
"@babel/helpers - typeof";
|
|
13
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
14
|
+
return typeof obj2;
|
|
15
|
+
} : function(obj2) {
|
|
16
|
+
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
17
|
+
}, _typeof(obj);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
21
|
+
function _toPrimitive(input, hint) {
|
|
22
|
+
if (_typeof(input) !== "object" || input === null)
|
|
23
|
+
return input;
|
|
24
|
+
var prim = input[Symbol.toPrimitive];
|
|
25
|
+
if (prim !== void 0) {
|
|
26
|
+
var res = prim.call(input, hint || "default");
|
|
27
|
+
if (_typeof(res) !== "object")
|
|
28
|
+
return res;
|
|
29
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
30
|
+
}
|
|
31
|
+
return (hint === "string" ? String : Number)(input);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
35
|
+
function _toPropertyKey(arg) {
|
|
36
|
+
var key = _toPrimitive(arg, "string");
|
|
37
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
41
|
+
function _defineProperty(obj, key, value) {
|
|
42
|
+
key = _toPropertyKey(key);
|
|
43
|
+
if (key in obj) {
|
|
44
|
+
Object.defineProperty(obj, key, {
|
|
45
|
+
value,
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true,
|
|
48
|
+
writable: true
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
obj[key] = value;
|
|
52
|
+
}
|
|
53
|
+
return obj;
|
|
54
|
+
}
|
|
55
|
+
|
|
10
56
|
// ../worker-utils/src/lib/node/worker_threads-browser.ts
|
|
11
57
|
var parentPort = null;
|
|
12
58
|
|
|
@@ -214,52 +260,6 @@
|
|
|
214
260
|
}
|
|
215
261
|
}
|
|
216
262
|
|
|
217
|
-
// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
218
|
-
function _typeof(obj) {
|
|
219
|
-
"@babel/helpers - typeof";
|
|
220
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
221
|
-
return typeof obj2;
|
|
222
|
-
} : function(obj2) {
|
|
223
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
224
|
-
}, _typeof(obj);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
228
|
-
function _toPrimitive(input, hint) {
|
|
229
|
-
if (_typeof(input) !== "object" || input === null)
|
|
230
|
-
return input;
|
|
231
|
-
var prim = input[Symbol.toPrimitive];
|
|
232
|
-
if (prim !== void 0) {
|
|
233
|
-
var res = prim.call(input, hint || "default");
|
|
234
|
-
if (_typeof(res) !== "object")
|
|
235
|
-
return res;
|
|
236
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
237
|
-
}
|
|
238
|
-
return (hint === "string" ? String : Number)(input);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
242
|
-
function _toPropertyKey(arg) {
|
|
243
|
-
var key = _toPrimitive(arg, "string");
|
|
244
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
248
|
-
function _defineProperty(obj, key, value) {
|
|
249
|
-
key = _toPropertyKey(key);
|
|
250
|
-
if (key in obj) {
|
|
251
|
-
Object.defineProperty(obj, key, {
|
|
252
|
-
value,
|
|
253
|
-
enumerable: true,
|
|
254
|
-
configurable: true,
|
|
255
|
-
writable: true
|
|
256
|
-
});
|
|
257
|
-
} else {
|
|
258
|
-
obj[key] = value;
|
|
259
|
-
}
|
|
260
|
-
return obj;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
263
|
// ../schema/src/lib/table/batches/base-table-batch-aggregator.ts
|
|
264
264
|
var DEFAULT_ROW_COUNT = 100;
|
|
265
265
|
var BaseTableBatchAggregator = class {
|
|
@@ -2454,8 +2454,10 @@ Char: ${this.c}`;
|
|
|
2454
2454
|
}
|
|
2455
2455
|
|
|
2456
2456
|
// src/geojson-loader.ts
|
|
2457
|
-
var VERSION = true ? "4.2.0-alpha.
|
|
2457
|
+
var VERSION = true ? "4.2.0-alpha.6" : "latest";
|
|
2458
2458
|
var GeoJSONWorkerLoader = {
|
|
2459
|
+
dataType: null,
|
|
2460
|
+
batchType: null,
|
|
2459
2461
|
name: "GeoJSON",
|
|
2460
2462
|
id: "geojson",
|
|
2461
2463
|
module: "geojson",
|
package/dist/geojson-writer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type WriterOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
import type { Table, TableBatch } from '@loaders.gl/schema';
|
|
3
3
|
export type GeoJSONWriterOptions = WriterOptions & {
|
|
4
4
|
geojson?: {
|
|
@@ -7,5 +7,21 @@ export type GeoJSONWriterOptions = WriterOptions & {
|
|
|
7
7
|
};
|
|
8
8
|
chunkSize?: number;
|
|
9
9
|
};
|
|
10
|
-
export declare const GeoJSONWriter:
|
|
10
|
+
export declare const GeoJSONWriter: {
|
|
11
|
+
readonly id: "geojson";
|
|
12
|
+
readonly version: "latest";
|
|
13
|
+
readonly module: "geojson";
|
|
14
|
+
readonly name: "GeoJSON";
|
|
15
|
+
readonly extensions: ["geojson"];
|
|
16
|
+
readonly mimeTypes: ["application/geo+json"];
|
|
17
|
+
readonly text: true;
|
|
18
|
+
readonly options: {
|
|
19
|
+
readonly geojson: {
|
|
20
|
+
readonly featureArray: false;
|
|
21
|
+
readonly geometryColumn: null;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
readonly encode: (table: Table, options: GeoJSONWriterOptions) => Promise<ArrayBuffer>;
|
|
25
|
+
readonly encodeInBatches: (tableIterator: AsyncIterable<TableBatch> | Iterable<TableBatch>, options: GeoJSONWriterOptions | undefined) => AsyncIterable<ArrayBuffer>;
|
|
26
|
+
};
|
|
11
27
|
//# sourceMappingURL=geojson-writer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-writer.d.ts","sourceRoot":"","sources":["../src/geojson-writer.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"geojson-writer.d.ts","sourceRoot":"","sources":["../src/geojson-writer.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAC,KAAK,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAG1D,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IACjD,OAAO,CAAC,EAAE;QACR,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAChC,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;6BAeJ,KAAK,WAAW,oBAAoB,KAAG,QAAQ,WAAW,CAAC;8CAM9C,cAAc,UAAU,CAAC,GAAG,SAAS,UAAU,CAAC;CAEJ,CAAC"}
|