@loaders.gl/json 4.4.0-alpha.11 → 4.4.0-alpha.13

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.min.js CHANGED
@@ -18,8 +18,8 @@ return true;`)}function eh(r){return typeof r!="bigint"?me(r):`${me(r)}n`}functi
18
18
  `:n===F.r?this.textNode+="\r":n===F.t?this.textNode+=" ":n===F.f?this.textNode+="\f":n===F.b?this.textNode+="\b":n===F.u?(a=1,this.unicodeS=""):this.textNode+=String.fromCharCode(n),n=t.charCodeAt(e++),this.position++,s=e-1,n)continue;break}Yl.lastIndex=e;let c=Yl.exec(t);if(c===null){e=t.length+1,this.textNode+=t.substring(s,e-1),this.position+=e-1-s;break}if(e=c.index+1,n=t.charCodeAt(c.index),!n){this.textNode+=t.substring(s,e-1),this.position+=e-1-s;break}}this.slashed=o,this.unicodeI=a;continue;case b.TRUE:n===F.r?this.state=b.TRUE2:this._error(`Invalid true started with t${n}`);continue;case b.TRUE2:n===F.u?this.state=b.TRUE3:this._error(`Invalid true started with tr${n}`);continue;case b.TRUE3:n===F.e?(this.emit("onvalue",!0),this.state=this.stack.pop()||b.VALUE):this._error(`Invalid true started with tru${n}`);continue;case b.FALSE:n===F.a?this.state=b.FALSE2:this._error(`Invalid false started with f${n}`);continue;case b.FALSE2:n===F.l?this.state=b.FALSE3:this._error(`Invalid false started with fa${n}`);continue;case b.FALSE3:n===F.s?this.state=b.FALSE4:this._error(`Invalid false started with fal${n}`);continue;case b.FALSE4:n===F.e?(this.emit("onvalue",!1),this.state=this.stack.pop()||b.VALUE):this._error(`Invalid false started with fals${n}`);continue;case b.NULL:n===F.u?this.state=b.NULL2:this._error(`Invalid null started with n${n}`);continue;case b.NULL2:n===F.l?this.state=b.NULL3:this._error(`Invalid null started with nu${n}`);continue;case b.NULL3:n===F.l?(this.emit("onvalue",null),this.state=this.stack.pop()||b.VALUE):this._error(`Invalid null started with nul${n}`);continue;case b.NUMBER_DECIMAL_POINT:n===F.period?(this.numberNode+=".",this.state=b.NUMBER_DIGIT):this._error("Leading zero not followed by .");continue;case b.NUMBER_DIGIT:F._0<=n&&n<=F._9?this.numberNode+=String.fromCharCode(n):n===F.period?(this.numberNode.indexOf(".")!==-1&&this._error("Invalid number has two dots"),this.numberNode+="."):n===F.e||n===F.E?((this.numberNode.indexOf("e")!==-1||this.numberNode.indexOf("E")!==-1)&&this._error("Invalid number has two exponential"),this.numberNode+="e"):n===F.plus||n===F.minus?(i===F.e||i===F.E||this._error("Invalid symbol in number"),this.numberNode+=String.fromCharCode(n)):(this._closeNumber(),e--,this.state=this.stack.pop()||b.VALUE);continue;default:this._error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&vd(this),this.emit("onchunkparsed"),this}_closeValue(t="onvalue"){this.textNode!==void 0&&this.emit(t,this.textNode),this.textNode=void 0}_closeNumber(){this.numberNode&&this.emit("onvalue",parseFloat(this.numberNode)),this.numberNode=""}_error(t=""){this._closeValue(),t+=`
19
19
  Line: ${this.line}
20
20
  Column: ${this.column}
21
- Char: ${this.c}`;let e=new Error(t);this.error=e,this.emit("onerror",e)}};function Bi(r){return r===F.carriageReturn||r===F.lineFeed||r===F.space||r===F.tab}function vd(r){let t=Math.max(Sa,10),e=0;for(let n of["textNode","numberNode"]){let i=r[n]===void 0?0:r[n].length;if(i>t)switch(n){case"text":break;default:r._error(`Max buffer length exceeded: ${n}`)}e=Math.max(e,i)}r.bufferCheckPosition=Sa-e+r.position}var Dt=class{path;constructor(t=null){this.path=Id(t)}clone(){return new Dt(this)}toString(){return Nd(this.path)}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let e=0;e<this.path.length;++e)if(this.path[e]!==t.path[e])return!1;return!0}setFieldAtPath(t,e){let n=[...this.path];n.shift();let i=n.pop();for(let s of n)t=t[s];t[i]=e}getFieldAtPath(t){let e=[...this.path];e.shift();let n=e.pop();for(let i of e)t=t[i];return t[n]}};function Id(r){return r instanceof Dt?[...r.path]:Array.isArray(r)?["$"].concat(r):typeof r=="string"?xd(r):["$"]}function xd(r){let t=r.trim();if(!t.startsWith("$"))throw new Error("JSONPath must start with $");let e=["$"],n=1,i=!1;for(;n<t.length;){let s=t[n];if(s==="."){if(i)throw new Error("JSONPath cannot select fields after array element selectors");if(n+=1,t[n]===".")throw new Error("JSONPath descendant selectors (..) are not supported");let{value:o,nextIndex:a,isWildcard:c}=Sd(t,n);if(c){if(a<t.length)throw new Error("JSONPath wildcard selectors must terminate the path");i=!0,n=a;continue}e.push(o),n=a;continue}if(s==="["){let o=Bd(t,n);if(o.type==="property"){if(i)throw new Error("JSONPath cannot select fields after array element selectors");e.push(o.value)}else i=!0;n=o.nextIndex;continue}if(s==="@")throw new Error("JSONPath current node selector (@) is not supported");if(s.trim()===""){n+=1;continue}throw new Error(`Unexpected character "${s}" in JSONPath`)}return e}function Sd(r,t){if(t>=r.length)throw new Error("JSONPath cannot end with a period");if(r[t]==="*")return{value:"*",nextIndex:t+1,isWildcard:!0};let e=r[t];if(e==="@")throw new Error("JSONPath current node selector (@) is not supported");if(!Fd(e))throw new Error("JSONPath property names after period must start with a letter, $ or _");let n=t+1;for(;n<r.length&&Dd(r[n]);)n++;if(n===t)throw new Error("JSONPath is missing a property name after period");return{value:r.slice(t,n),nextIndex:n,isWildcard:!1}}function Bd(r,t){let e=t+1;if(e>=r.length)throw new Error("JSONPath has unterminated bracket");let n=r[e];if(n==="'"||n==='"'){let{value:a,nextIndex:c}=Od(r,e);return{type:"property",value:a,nextIndex:c}}let i=r.indexOf("]",e);if(i===-1)throw new Error("JSONPath has unterminated bracket");let s=r.slice(e,i).trim(),o=Ad(s);if(o)throw new Error(o);if(s==="*")return{type:"array-selector",nextIndex:i+1};if(/^\d+$/.test(s))throw new Error("JSONPath array index selectors are not supported");if(/^\d*\s*:\s*\d*(\s*:\s*\d*)?$/.test(s))return{type:"array-selector",nextIndex:i+1};throw new Error(`Unsupported bracket selector "[${s}]" in JSONPath`)}function Ad(r){return r.length?r.startsWith("(")?"JSONPath script selectors are not supported":r.startsWith("?")?"JSONPath filter selectors are not supported":r.includes(",")?"JSONPath union selectors are not supported":r.startsWith("@")||r.includes("@.")?"JSONPath current node selector (@) is not supported":null:"JSONPath bracket selectors cannot be empty"}function Od(r,t){let e=r[t],n=t+1,i="",s=!1;for(;n<r.length;){let o=r[n];if(o==="\\"){if(n+=1,n>=r.length)break;i+=r[n],n+=1;continue}if(o===e){s=!0,n+=1;break}i+=o,n+=1}if(!s)throw new Error("JSONPath string in bracket property selector is unterminated");for(;n<r.length&&r[n].trim()==="";)n+=1;if(r[n]!=="]")throw new Error("JSONPath property selectors must end with ]");if(!i.length)throw new Error("JSONPath property selectors cannot be empty");return{value:i,nextIndex:n+1}}function Dd(r){return/[a-zA-Z0-9$_]/.test(r)}function Fd(r){return/[a-zA-Z_$]/.test(r)}function Td(r){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(r)}function Nd(r){return r.map((t,e)=>e===0?t:t==="*"?".*":Td(t)?`.${t}`:`['${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}']`).join("")}var Ai=class{parser;result=void 0;previousStates=[];currentState=Object.freeze({container:[],key:null});jsonpath=new Dt;constructor(t){this.reset(),this.parser=new Xr({onready:()=>{this.jsonpath=new Dt,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:e=>{this._openObject({}),typeof e<"u"&&this.parser.emit("onkey",e)},onkey:e=>{this.jsonpath.set(e),this.currentState.key=e},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:e=>{this._pushOrSet(e)},onerror:e=>{throw e},onend:()=>{this.result=this.currentState.container.pop()},...t})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new Dt}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){let{container:e,key:n}=this.currentState;n!==null?(e[n]=t,this.currentState.key=null):e.push(t)}_openArray(t=[]){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(t={}){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}};var Oi=class extends Ai{jsonPaths;streamingJsonPath=null;streamingArray=null;topLevelObject=null;constructor(t={}){super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath()){this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],this._openArray(this.streamingArray);return}this._openArray()},onopenobject:n=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof n<"u"&&this.parser.emit("onkey",n)}});let e=t.jsonpaths||[];this.jsonPaths=e.map(n=>new Dt(n))}write(t){super.write(t);let e=[];return this.streamingArray&&(e=[...this.streamingArray],this.streamingArray.length=0),e}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){let t=this.getJsonPath();if(this.jsonPaths.length===0)return!0;for(let e of this.jsonPaths)if(e.equals(t))return!0;return!1}};async function*lo(r,t){let e=xi(Si(r)),n=Boolean(t?.core?.metadata||t?.metadata),{jsonpaths:i}=t.json||{},s=!0,o=null,a=new br(o,t?.core),c=new Oi({jsonpaths:i});for await(let h of e){let d=c.write(h),p=d.length>0&&c.getStreamingJsonPathAsString();d.length>0&&s&&(n&&(yield{shape:t?.json?.shape||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:c.getPartialResult(),jsonpath:p}),s=!1);for(let J of d){a.addRow(J);let nt=a.getFullBatch({jsonpath:p});nt&&(yield nt)}a.chunkComplete(h);let g=a.getFullBatch({jsonpath:p});g&&(yield g)}let l=c.getStreamingJsonPathAsString(),u=a.getFinalBatch({jsonpath:l});u&&(yield u),n&&(yield{shape:"json",batchType:"final-result",container:c.getPartialResult(),jsonpath:c.getStreamingJsonPathAsString(),data:[],length:0})}function Kl(r,t){if(ba(r.batchType==="final-result"),r.jsonpath==="$")return t;if(r.jsonpath&&r.jsonpath.length>1){let e=r.container;return new Dt(r.jsonpath).setFieldAtPath(e,t),e}return r.container}var Ld="4.4.0-alpha.11",uo={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:Ld,extensions:["json","geojson"],mimeTypes:["application/json"],category:"table",text:!0,options:{json:{shape:void 0,table:!1,jsonpaths:[]}},parse:Ud,parseTextSync:Xl,parseInBatches:Ed};async function Ud(r,t){return Xl(new TextDecoder().decode(r),t)}function Xl(r,t){let e={...t,json:{...uo.options.json,...t?.json}};return zl(r,e)}function Ed(r,t){let e={...t,json:{...uo.options.json,...t?.json}};return lo(r,e)}function Ba(r){let e=r.trim().split(`
22
- `).map((n,i)=>{try{return JSON.parse(n)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${i+1}`)}});return Ii(e)}async function*ql(r,t){let e=xi(Si(r)),n=_a(e),i=wa(n),s=null,o="row-table",a=new br(s,{...t?.core||t,shape:o});for await(let{counter:l,line:u}of i)try{let h=JSON.parse(u);a.addRow(h),a.chunkComplete(u);let d=a.getFullBatch();d&&(yield d)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${l}`)}let c=a.getFinalBatch();c&&(yield c)}var Md="4.4.0-alpha.11",Ql={dataType:null,batchType:null,name:"NDJSON",id:"ndjson",module:"json",version:Md,extensions:["ndjson","jsonl"],mimeTypes:["application/x-ndjson","application/jsonlines","application/json-seq"],category:"table",text:!0,parse:async r=>Ba(new TextDecoder().decode(r)),parseTextSync:Ba,parseInBatches:ql,options:{}};function Aa(r,t){let e=t?.json?.shape||"object-row-table",n=[],i=ya(r,e);for(let s of i)n.push(JSON.stringify(s));return`[${n.join(",")}]`}var tu={id:"json",version:"latest",module:"json",name:"JSON",extensions:["json"],mimeTypes:["application/json"],options:{},text:!0,encode:async(r,t)=>new TextEncoder().encode(Aa(r,t)).buffer,encodeTextSync:(r,t)=>Aa(r,t)};function eu(r){let t=0,e=0,n=0,i=0,s=0,o=0,a=0,c=0,l=0,u=new Set;for(let h of r){let d=h.geometry;switch(d.type){case"Point":e++,t++,u.add(d.coordinates.length);break;case"MultiPoint":e++,t+=d.coordinates.length;for(let g of d.coordinates)u.add(g.length);break;case"LineString":s++,n+=d.coordinates.length,i++;for(let g of d.coordinates)u.add(g.length);break;case"MultiLineString":s++;for(let g of d.coordinates){n+=g.length,i++;for(let J of g)u.add(J.length)}break;case"Polygon":l++,a++,c+=d.coordinates.length;let p=d.coordinates.flat();o+=p.length;for(let g of p)u.add(g.length);break;case"MultiPolygon":l++;for(let g of d.coordinates){a++,c+=g.length;let J=g.flat();o+=J.length;for(let nt of J)u.add(nt.length)}break;default:throw new Error(`Unsupported geometry type: ${d.type}`)}}return{coordLength:u.size>0?Math.max(...u):2,pointPositionsCount:t,pointFeaturesCount:e,linePositionsCount:n,linePathsCount:i,lineFeaturesCount:s,polygonPositionsCount:o,polygonObjectsCount:a,polygonRingsCount:c,polygonFeaturesCount:l}}var Di={x:0,y:1,z:2};function Tn(r,t={}){let{start:e=0,end:n=r.length,plane:i="xy"}=t,s=t.size||2,o=0,a=Di[i[0]],c=Di[i[1]];for(let l=e,u=n-s;l<n;l+=s)o+=(r[l+a]-r[u+a])*(r[l+c]+r[u+c]),u=l;return o/2}function Da(r,t,e=2,n,i="xy"){let s=t&&t.length,o=s?t[0]*e:r.length,a=nu(r,0,o,e,!0,n&&n[0],i),c=[];if(!a||a.next===a.prev)return c;let l,u,h,d,p,g,J;if(s&&(a=zd(r,t,a,e,n,i)),r.length>80*e){d=u=r[0],p=h=r[1];for(let nt=e;nt<o;nt+=e)g=r[nt],J=r[nt+1],g<d&&(d=g),J<p&&(p=J),g>u&&(u=g),J>h&&(h=J);l=Math.max(u-d,h-p),l=l!==0?32767/l:0}return Fi(a,c,e,d,p,l,0),c}function nu(r,t,e,n,i,s,o){let a,c;s===void 0&&(s=Tn(r,{start:t,end:e,size:n,plane:o}));let l=Di[o[0]],u=Di[o[1]];if(i===s<0)for(a=t;a<e;a+=n)c=ru(a,r[a+l],r[a+u],c);else for(a=e-n;a>=t;a-=n)c=ru(a,r[a+l],r[a+u],c);return c&&po(c,c.next)&&(Ni(c),c=c.next),c}function qr(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(po(e,e.next)||ot(e.prev,e,e.next)===0)){if(Ni(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Fi(r,t,e,n,i,s,o){if(!r)return;!o&&s&&Hd(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?jd(r,n,i,s):Cd(r)){t.push(c.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Ni(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=kd(qr(r),t,e),Fi(r,t,e,n,i,s,2)):o===2&&Vd(r,t,e,n,i,s):Fi(qr(r),t,e,n,i,s,1);break}}}function Cd(r){let t=r.prev,e=r,n=r.next;if(ot(t,e,n)>=0)return!1;let i=t.x,s=e.x,o=n.x,a=t.y,c=e.y,l=n.y,u=i<s?i<o?i:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,d=i>s?i>o?i:o:s>o?s:o,p=a>c?a>l?a:l:c>l?c:l,g=n.next;for(;g!==t;){if(g.x>=u&&g.x<=d&&g.y>=h&&g.y<=p&&Nn(i,a,s,c,o,l,g.x,g.y)&&ot(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function jd(r,t,e,n){let i=r.prev,s=r,o=r.next;if(ot(i,s,o)>=0)return!1;let a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,d=o.y,p=a<c?a<l?a:l:c<l?c:l,g=u<h?u<d?u:d:h<d?h:d,J=a>c?a>l?a:l:c>l?c:l,nt=u>h?u>d?u:d:h>d?h:d,Ft=Oa(p,g,t,e,n),or=Oa(J,nt,t,e,n),z=r.prevZ,V=r.nextZ;for(;z&&z.z>=Ft&&V&&V.z<=or;){if(z.x>=p&&z.x<=J&&z.y>=g&&z.y<=nt&&z!==i&&z!==o&&Nn(a,u,c,h,l,d,z.x,z.y)&&ot(z.prev,z,z.next)>=0||(z=z.prevZ,V.x>=p&&V.x<=J&&V.y>=g&&V.y<=nt&&V!==i&&V!==o&&Nn(a,u,c,h,l,d,V.x,V.y)&&ot(V.prev,V,V.next)>=0))return!1;V=V.nextZ}for(;z&&z.z>=Ft;){if(z.x>=p&&z.x<=J&&z.y>=g&&z.y<=nt&&z!==i&&z!==o&&Nn(a,u,c,h,l,d,z.x,z.y)&&ot(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;V&&V.z<=or;){if(V.x>=p&&V.x<=J&&V.y>=g&&V.y<=nt&&V!==i&&V!==o&&Nn(a,u,c,h,l,d,V.x,V.y)&&ot(V.prev,V,V.next)>=0)return!1;V=V.nextZ}return!0}function kd(r,t,e){let n=r;do{let i=n.prev,s=n.next.next;!po(i,s)&&iu(i,n,n.next,s)&&Ti(i,s)&&Ti(s,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),Ni(n),Ni(n.next),n=r=s),n=n.next}while(n!==r);return qr(n)}function Vd(r,t,e,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Kd(o,a)){let c=su(o,a);o=qr(o,o.next),c=qr(c,c.next),Fi(o,t,e,n,i,s,0),Fi(c,t,e,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function zd(r,t,e,n,i,s){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*n,u=a<c-1?t[a+1]*n:r.length,h=nu(r,l,u,n,!1,i&&i[a+1],s),h===h.next&&(h.steiner=!0),o.push(Zd(h));for(o.sort(Wd),a=0;a<o.length;a++)e=Jd(o[a],e);return e}function Wd(r,t){return r.x-t.x}function Jd(r,t){let e=Gd(r,t);if(!e)return t;let n=su(e,r);return qr(n,n.next),qr(e,e.next)}function Gd(r,t){let e=t,n=r.x,i=r.y,s=-1/0,o;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){let d=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>s&&(s=d,o=e.x<e.next.x?e:e.next,d===n))return o}e=e.next}while(e!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;e=o;do n>=e.x&&e.x>=c&&n!==e.x&&Nn(i<l?n:s,i,c,l,i<l?s:n,i,e.x,e.y)&&(h=Math.abs(i-e.y)/(n-e.x),Ti(e,r)&&(h<u||h===u&&(e.x>o.x||e.x===o.x&&$d(o,e)))&&(o=e,u=h)),e=e.next;while(e!==a);return o}function $d(r,t){return ot(r.prev,r,t.prev)<0&&ot(t.next,r,r.next)<0}function Hd(r,t,e,n){let i=r;do i.z===0&&(i.z=Oa(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Yd(i)}function Yd(r){let t,e,n=1,i,s,o,a,c,l;do{for(s=r,r=null,l=null,i=0;s;){for(i++,a=s,o=0,e=0;e<n&&(o++,a=a.nextZ,!!a);e++);for(c=n;o>0||c>0&&a;)o!==0&&(c===0||!a||s.z<=a.z)?(t=s,s=s.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:r=t,t.prevZ=l,l=t;s=a}l.nextZ=null,n*=2}while(i>1);return r}function Oa(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Zd(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Nn(r,t,e,n,i,s,o,a){return(i-o)*(t-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(i-o)*(n-a)}function Kd(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Xd(r,t)&&(Ti(r,t)&&Ti(t,r)&&qd(r,t)&&(ot(r.prev,r,t.prev)||ot(r,t.prev,t))||po(r,t)&&ot(r.prev,r,r.next)>0&&ot(t.prev,t,t.next)>0)}function ot(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function po(r,t){return r.x===t.x&&r.y===t.y}function iu(r,t,e,n){let i=ho(ot(r,t,e)),s=ho(ot(r,t,n)),o=ho(ot(e,n,r)),a=ho(ot(e,n,t));return!!(i!==s&&o!==a||i===0&&fo(r,e,t)||s===0&&fo(r,n,t)||o===0&&fo(e,r,n)||a===0&&fo(e,t,n))}function fo(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function ho(r){return r>0?1:r<0?-1:0}function Xd(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&iu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Ti(r,t){return ot(r.prev,r,r.next)<0?ot(r,t,r.next)>=0&&ot(r,r.prev,t)>=0:ot(r,t,r.prev)<0||ot(r,r.next,t)<0}function qd(r,t){let e=r,n=!1,i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function su(r,t){let e=new Li(r.i,r.x,r.y),n=new Li(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function ru(r,t,e,n){let i=new Li(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ni(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}var Li=class{constructor(t,e,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=n}};function cu(r,t,e){let n=np(r),i=Object.keys(n).filter(s=>n[s]!==Array);return ip(r,{propArrayTypes:n,...t},{numericPropKeys:e&&e.numericPropKeys||i,PositionDataType:e?e.PositionDataType:Float32Array,triangulate:e?e.triangulate:!0})}function np(r){let t={};for(let e of r)if(e.properties)for(let n in e.properties){let i=e.properties[n];t[n]=up(i,t[n])}return t}function ip(r,t,e){let{pointPositionsCount:n,pointFeaturesCount:i,linePositionsCount:s,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:h,propArrayTypes:d,coordLength:p}=t,{numericPropKeys:g=[],PositionDataType:J=Float32Array,triangulate:nt=!0}=e,Ft=r[0]&&"id"in r[0],or=r.length>65535?Uint32Array:Uint16Array,z={type:"Point",positions:new J(n*p),globalFeatureIds:new or(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},V={type:"LineString",pathIndices:s>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new J(s*p),globalFeatureIds:new or(s),featureIds:a>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},ar={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 J(c*p),globalFeatureIds:new or(c),featureIds:h>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};nt&&(ar.triangles=[]);for(let cr of[z,V,ar])for(let wr of g){let lr=d[wr];cr.numericProps[wr]=new lr(cr.positions.length/p)}V.pathIndices[o]=s,ar.polygonIndices[l]=c,ar.primitivePolygonIndices[u]=c;let _r={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let cr of r){let wr=cr.geometry,lr=cr.properties||{};switch(wr.type){case"Point":sp(wr,z,_r,p,lr),z.properties.push(Ta(lr,g)),Ft&&z.fields.push({id:cr.id}),_r.pointFeature++;break;case"LineString":op(wr,V,_r,p,lr),V.properties.push(Ta(lr,g)),Ft&&V.fields.push({id:cr.id}),_r.lineFeature++;break;case"Polygon":ap(wr,ar,_r,p,lr),ar.properties.push(Ta(lr,g)),Ft&&ar.fields.push({id:cr.id}),_r.polygonFeature++;break;default:throw new Error("Invalid geometry type")}_r.feature++}return lp(z,V,ar,p)}function sp(r,t,e,n,i){t.positions.set(r.data,e.pointPosition*n);let s=r.data.length/n;Na(t,i,e.pointPosition,s),t.globalFeatureIds.fill(e.feature,e.pointPosition,e.pointPosition+s),t.featureIds.fill(e.pointFeature,e.pointPosition,e.pointPosition+s),e.pointPosition+=s}function op(r,t,e,n,i){t.positions.set(r.data,e.linePosition*n);let s=r.data.length/n;Na(t,i,e.linePosition,s),t.globalFeatureIds.fill(e.feature,e.linePosition,e.linePosition+s),t.featureIds.fill(e.lineFeature,e.linePosition,e.linePosition+s);for(let o=0,a=r.indices.length;o<a;++o){let c=r.indices[o],l=o===a-1?r.data.length:r.indices[o+1];t.pathIndices[e.linePath++]=e.linePosition,e.linePosition+=(l-c)/n}}function ap(r,t,e,n,i){t.positions.set(r.data,e.polygonPosition*n);let s=r.data.length/n;Na(t,i,e.polygonPosition,s),t.globalFeatureIds.fill(e.feature,e.polygonPosition,e.polygonPosition+s),t.featureIds.fill(e.polygonFeature,e.polygonPosition,e.polygonPosition+s);for(let o=0,a=r.indices.length;o<a;++o){let c=e.polygonPosition;t.polygonIndices[e.polygonObject++]=c;let l=r.areas[o],u=r.indices[o],h=r.indices[o+1];for(let p=0,g=u.length;p<g;++p){let J=u[p],nt=p===g-1?h===void 0?r.data.length:h[0]:u[p+1];t.primitivePolygonIndices[e.polygonRing++]=e.polygonPosition,e.polygonPosition+=(nt-J)/n}let d=e.polygonPosition;cp(t,l,u,{startPosition:c,endPosition:d,coordLength:n})}}function cp(r,t,e,{startPosition:n,endPosition:i,coordLength:s}){if(!r.triangles)return;let o=n*s,a=i*s,c=r.positions.subarray(o,a),l=e[0],u=e.slice(1).map(d=>(d-l)/s),h=Da(c,u,s,t);for(let d=0,p=h.length;d<p;++d)r.triangles.push(n+h[d])}function Fa(r,t){let e={};for(let n in r)e[n]={value:r[n],size:t};return e}function lp(r,t,e,n){let i={shape:"binary-feature-collection",points:{...r,positions:{value:r.positions,size:n},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Fa(r.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Fa(t.numericProps,1)},polygons:{...e,positions:{value:e.positions,size:n},polygonIndices:{value:e.polygonIndices,size:1},primitivePolygonIndices:{value:e.primitivePolygonIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Fa(e.numericProps,1)}};return i.polygons&&e.triangles&&(i.polygons.triangles={value:new Uint32Array(e.triangles),size:1}),i}function Na(r,t,e,n){for(let i in r.numericProps)if(i in t){let s=t[i];r.numericProps[i].fill(s,e,e+n)}}function Ta(r,t){let e={};for(let n in r)t.includes(n)||(e[n]=r[n]);return e}function up(r,t){return t===Array||!Number.isFinite(r)?Array:t===Float64Array||Math.fround(r)!==r?Float64Array:Float32Array}function fu(r,t={coordLength:2,fixRingWinding:!0}){return r.map(e=>fp(e,t))}function lu(r,t,e,n){e.push(t.length),t.push(...r);for(let i=r.length;i<n.coordLength;i++)t.push(0)}function La(r,t,e,n){e.push(t.length);for(let i of r){t.push(...i);for(let s=i.length;s<n.coordLength;s++)t.push(0)}}function uu(r,t,e,n,i){let s=0,o=[],a=[];for(let c of r){let l=c.map(d=>d.slice(0,2)),u=Tn(l.flat()),h=u<0;i.fixRingWinding&&(s===0&&!h||s>0&&h)&&(c.reverse(),u=-u),o.push(u),La(c,t,a,i),s++}s>0&&(n.push(o),e.push(a))}function fp(r,t){let{geometry:e}=r;if(e.type==="GeometryCollection")throw new Error("GeometryCollection type not supported");let n=[],i=[],s,o;switch(e.type){case"Point":o="Point",lu(e.coordinates,n,i,t);break;case"MultiPoint":o="Point",e.coordinates.map(a=>lu(a,n,i,t));break;case"LineString":o="LineString",La(e.coordinates,n,i,t);break;case"MultiLineString":o="LineString",e.coordinates.map(a=>La(a,n,i,t));break;case"Polygon":o="Polygon",s=[],uu(e.coordinates,n,i,s,t);break;case"MultiPolygon":o="Polygon",s=[],e.coordinates.map(a=>uu(a,n,i,s,t));break;default:throw new Error(`Unknown type: ${o}`)}return{...r,geometry:{type:o,indices:i,data:n,areas:s}}}function Ui(r,t={fixRingWinding:!0,triangulate:!0}){let e=eu(r),n=e.coordLength,{fixRingWinding:i}=t,s=fu(r,{coordLength:n,fixRingWinding:i});return cu(s,e,{numericPropKeys:t.numericPropKeys,PositionDataType:t.PositionDataType||Float32Array,triangulate:t.triangulate})}var hp="4.4.0-alpha.11",Ua={dataType:null,batchType:null,name:"GeoJSON",id:"geojson",module:"geojson",version:hp,worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"geojson-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}}},Qr={...Ua,parse:dp,parseTextSync:hu,parseInBatches:pp};async function dp(r,t){return hu(new TextDecoder().decode(r),t)}function hu(r,t){t={...Qr.options,...t},t.geojson={...Qr.options.geojson,...t.geojson},t.gis=t.gis||{};let e;try{e=JSON.parse(r)}catch{e={}}let n={shape:"geojson-table",type:"FeatureCollection",features:e?.features||[]};switch(t.gis.format){case"binary":return Ui(n.features);default:return n}}function pp(r,t){t={...Qr.options,...t},t.json={...Qr.options.json,...t.json},t.geojson={...Qr.options.geojson,...t.geojson};let e=lo(r,t);switch(t.gis.format){case"binary":return mp(e);default:return e}}async function*mp(r){for await(let t of r)t.data=Ui(t.data),yield t}function du(r){let t=r.schema?.fields.findIndex(e=>e.name==="geometry")??-1;if(t>-1)return t;if(gr(r)>0){let e=so(r,0);for(let n=0;n<no(r);n++){let i=e?.[n];if(i&&typeof i=="object")return n}}throw new Error("Failed to detect geometry column")}function pu(r,t,e=[]){let n={};for(let i=0;i<no(r);++i){let s=r.schema?.fields[i].name;s&&!e.includes(i)&&(n[s]=t[s])}return n}function mu(r,t,e,n){let i=io(r,t);if(!i)return;let s=yp(r,i,e),o=JSON.stringify(s);n.push(o)}function yp(r,t,e){let n=pu(r,t,[e]),i=r.schema?.fields[e].name,s=i&&t[i];if(!s)return{type:"Feature",geometry:null,properties:n};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:n}:{type:"Feature",geometry:s,properties:n}}var mo=class{chunkSize;strings=[];totalLength=0;textEncoder=new TextEncoder;constructor(t){this.chunkSize=t}push(...t){for(let e of t)this.strings.push(e),this.totalLength+=e.length}isFull(){return this.totalLength>=this.chunkSize}getArrayBufferBatch(){return xa(this.textEncoder.encode(this.getStringBatch()).buffer)}getStringBatch(){let t=this.strings.join("");return this.strings=[],this.totalLength=0,t}};async function*Ea(r,t={}){let e={geojson:{},chunkSize:1e4,...t},n=new mo(e.chunkSize);e.geojson.featureArray||n.push(`{
21
+ Char: ${this.c}`;let e=new Error(t);this.error=e,this.emit("onerror",e)}};function Bi(r){return r===F.carriageReturn||r===F.lineFeed||r===F.space||r===F.tab}function vd(r){let t=Math.max(Sa,10),e=0;for(let n of["textNode","numberNode"]){let i=r[n]===void 0?0:r[n].length;if(i>t)switch(n){case"text":break;default:r._error(`Max buffer length exceeded: ${n}`)}e=Math.max(e,i)}r.bufferCheckPosition=Sa-e+r.position}var Dt=class{path;constructor(t=null){this.path=Id(t)}clone(){return new Dt(this)}toString(){return Nd(this.path)}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let e=0;e<this.path.length;++e)if(this.path[e]!==t.path[e])return!1;return!0}setFieldAtPath(t,e){let n=[...this.path];n.shift();let i=n.pop();for(let s of n)t=t[s];t[i]=e}getFieldAtPath(t){let e=[...this.path];e.shift();let n=e.pop();for(let i of e)t=t[i];return t[n]}};function Id(r){return r instanceof Dt?[...r.path]:Array.isArray(r)?["$"].concat(r):typeof r=="string"?xd(r):["$"]}function xd(r){let t=r.trim();if(!t.startsWith("$"))throw new Error("JSONPath must start with $");let e=["$"],n=1,i=!1;for(;n<t.length;){let s=t[n];if(s==="."){if(i)throw new Error("JSONPath cannot select fields after array element selectors");if(n+=1,t[n]===".")throw new Error("JSONPath descendant selectors (..) are not supported");let{value:o,nextIndex:a,isWildcard:c}=Sd(t,n);if(c){if(a<t.length)throw new Error("JSONPath wildcard selectors must terminate the path");i=!0,n=a;continue}e.push(o),n=a;continue}if(s==="["){let o=Bd(t,n);if(o.type==="property"){if(i)throw new Error("JSONPath cannot select fields after array element selectors");e.push(o.value)}else i=!0;n=o.nextIndex;continue}if(s==="@")throw new Error("JSONPath current node selector (@) is not supported");if(s.trim()===""){n+=1;continue}throw new Error(`Unexpected character "${s}" in JSONPath`)}return e}function Sd(r,t){if(t>=r.length)throw new Error("JSONPath cannot end with a period");if(r[t]==="*")return{value:"*",nextIndex:t+1,isWildcard:!0};let e=r[t];if(e==="@")throw new Error("JSONPath current node selector (@) is not supported");if(!Fd(e))throw new Error("JSONPath property names after period must start with a letter, $ or _");let n=t+1;for(;n<r.length&&Dd(r[n]);)n++;if(n===t)throw new Error("JSONPath is missing a property name after period");return{value:r.slice(t,n),nextIndex:n,isWildcard:!1}}function Bd(r,t){let e=t+1;if(e>=r.length)throw new Error("JSONPath has unterminated bracket");let n=r[e];if(n==="'"||n==='"'){let{value:a,nextIndex:c}=Od(r,e);return{type:"property",value:a,nextIndex:c}}let i=r.indexOf("]",e);if(i===-1)throw new Error("JSONPath has unterminated bracket");let s=r.slice(e,i).trim(),o=Ad(s);if(o)throw new Error(o);if(s==="*")return{type:"array-selector",nextIndex:i+1};if(/^\d+$/.test(s))throw new Error("JSONPath array index selectors are not supported");if(/^\d*\s*:\s*\d*(\s*:\s*\d*)?$/.test(s))return{type:"array-selector",nextIndex:i+1};throw new Error(`Unsupported bracket selector "[${s}]" in JSONPath`)}function Ad(r){return r.length?r.startsWith("(")?"JSONPath script selectors are not supported":r.startsWith("?")?"JSONPath filter selectors are not supported":r.includes(",")?"JSONPath union selectors are not supported":r.startsWith("@")||r.includes("@.")?"JSONPath current node selector (@) is not supported":null:"JSONPath bracket selectors cannot be empty"}function Od(r,t){let e=r[t],n=t+1,i="",s=!1;for(;n<r.length;){let o=r[n];if(o==="\\"){if(n+=1,n>=r.length)break;i+=r[n],n+=1;continue}if(o===e){s=!0,n+=1;break}i+=o,n+=1}if(!s)throw new Error("JSONPath string in bracket property selector is unterminated");for(;n<r.length&&r[n].trim()==="";)n+=1;if(r[n]!=="]")throw new Error("JSONPath property selectors must end with ]");if(!i.length)throw new Error("JSONPath property selectors cannot be empty");return{value:i,nextIndex:n+1}}function Dd(r){return/[a-zA-Z0-9$_]/.test(r)}function Fd(r){return/[a-zA-Z_$]/.test(r)}function Td(r){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(r)}function Nd(r){return r.map((t,e)=>e===0?t:t==="*"?".*":Td(t)?`.${t}`:`['${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}']`).join("")}var Ai=class{parser;result=void 0;previousStates=[];currentState=Object.freeze({container:[],key:null});jsonpath=new Dt;constructor(t){this.reset(),this.parser=new Xr({onready:()=>{this.jsonpath=new Dt,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:e=>{this._openObject({}),typeof e<"u"&&this.parser.emit("onkey",e)},onkey:e=>{this.jsonpath.set(e),this.currentState.key=e},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:e=>{this._pushOrSet(e)},onerror:e=>{throw e},onend:()=>{this.result=this.currentState.container.pop()},...t})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new Dt}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){let{container:e,key:n}=this.currentState;n!==null?(e[n]=t,this.currentState.key=null):e.push(t)}_openArray(t=[]){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(t={}){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}};var Oi=class extends Ai{jsonPaths;streamingJsonPath=null;streamingArray=null;topLevelObject=null;constructor(t={}){super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath()){this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],this._openArray(this.streamingArray);return}this._openArray()},onopenobject:n=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof n<"u"&&this.parser.emit("onkey",n)}});let e=t.jsonpaths||[];this.jsonPaths=e.map(n=>new Dt(n))}write(t){super.write(t);let e=[];return this.streamingArray&&(e=[...this.streamingArray],this.streamingArray.length=0),e}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){let t=this.getJsonPath();if(this.jsonPaths.length===0)return!0;for(let e of this.jsonPaths)if(e.equals(t))return!0;return!1}};async function*lo(r,t){let e=xi(Si(r)),n=Boolean(t?.core?.metadata||t?.metadata),{jsonpaths:i}=t.json||{},s=!0,o=null,a=new br(o,t?.core),c=new Oi({jsonpaths:i});for await(let h of e){let d=c.write(h),p=d.length>0&&c.getStreamingJsonPathAsString();d.length>0&&s&&(n&&(yield{shape:t?.json?.shape||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:c.getPartialResult(),jsonpath:p}),s=!1);for(let J of d){a.addRow(J);let nt=a.getFullBatch({jsonpath:p});nt&&(yield nt)}a.chunkComplete(h);let g=a.getFullBatch({jsonpath:p});g&&(yield g)}let l=c.getStreamingJsonPathAsString(),u=a.getFinalBatch({jsonpath:l});u&&(yield u),n&&(yield{shape:"json",batchType:"final-result",container:c.getPartialResult(),jsonpath:c.getStreamingJsonPathAsString(),data:[],length:0})}function Kl(r,t){if(ba(r.batchType==="final-result"),r.jsonpath==="$")return t;if(r.jsonpath&&r.jsonpath.length>1){let e=r.container;return new Dt(r.jsonpath).setFieldAtPath(e,t),e}return r.container}var Ld="4.4.0-alpha.13",uo={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:Ld,extensions:["json","geojson"],mimeTypes:["application/json"],category:"table",text:!0,options:{json:{shape:void 0,table:!1,jsonpaths:[]}},parse:Ud,parseTextSync:Xl,parseInBatches:Ed};async function Ud(r,t){return Xl(new TextDecoder().decode(r),t)}function Xl(r,t){let e={...t,json:{...uo.options.json,...t?.json}};return zl(r,e)}function Ed(r,t){let e={...t,json:{...uo.options.json,...t?.json}};return lo(r,e)}function Ba(r){let e=r.trim().split(`
22
+ `).map((n,i)=>{try{return JSON.parse(n)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${i+1}`)}});return Ii(e)}async function*ql(r,t){let e=xi(Si(r)),n=_a(e),i=wa(n),s=null,o="row-table",a=new br(s,{...t?.core||t,shape:o});for await(let{counter:l,line:u}of i)try{let h=JSON.parse(u);a.addRow(h),a.chunkComplete(u);let d=a.getFullBatch();d&&(yield d)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${l}`)}let c=a.getFinalBatch();c&&(yield c)}var Md="4.4.0-alpha.13",Ql={dataType:null,batchType:null,name:"NDJSON",id:"ndjson",module:"json",version:Md,extensions:["ndjson","jsonl"],mimeTypes:["application/x-ndjson","application/jsonlines","application/json-seq"],category:"table",text:!0,parse:async r=>Ba(new TextDecoder().decode(r)),parseTextSync:Ba,parseInBatches:ql,options:{}};function Aa(r,t){let e=t?.json?.shape||"object-row-table",n=[],i=ya(r,e);for(let s of i)n.push(JSON.stringify(s));return`[${n.join(",")}]`}var tu={id:"json",version:"latest",module:"json",name:"JSON",extensions:["json"],mimeTypes:["application/json"],options:{},text:!0,encode:async(r,t)=>new TextEncoder().encode(Aa(r,t)).buffer,encodeTextSync:(r,t)=>Aa(r,t)};function eu(r){let t=0,e=0,n=0,i=0,s=0,o=0,a=0,c=0,l=0,u=new Set;for(let h of r){let d=h.geometry;switch(d.type){case"Point":e++,t++,u.add(d.coordinates.length);break;case"MultiPoint":e++,t+=d.coordinates.length;for(let g of d.coordinates)u.add(g.length);break;case"LineString":s++,n+=d.coordinates.length,i++;for(let g of d.coordinates)u.add(g.length);break;case"MultiLineString":s++;for(let g of d.coordinates){n+=g.length,i++;for(let J of g)u.add(J.length)}break;case"Polygon":l++,a++,c+=d.coordinates.length;let p=d.coordinates.flat();o+=p.length;for(let g of p)u.add(g.length);break;case"MultiPolygon":l++;for(let g of d.coordinates){a++,c+=g.length;let J=g.flat();o+=J.length;for(let nt of J)u.add(nt.length)}break;default:throw new Error(`Unsupported geometry type: ${d.type}`)}}return{coordLength:u.size>0?Math.max(...u):2,pointPositionsCount:t,pointFeaturesCount:e,linePositionsCount:n,linePathsCount:i,lineFeaturesCount:s,polygonPositionsCount:o,polygonObjectsCount:a,polygonRingsCount:c,polygonFeaturesCount:l}}var Di={x:0,y:1,z:2};function Tn(r,t={}){let{start:e=0,end:n=r.length,plane:i="xy"}=t,s=t.size||2,o=0,a=Di[i[0]],c=Di[i[1]];for(let l=e,u=n-s;l<n;l+=s)o+=(r[l+a]-r[u+a])*(r[l+c]+r[u+c]),u=l;return o/2}function Da(r,t,e=2,n,i="xy"){let s=t&&t.length,o=s?t[0]*e:r.length,a=nu(r,0,o,e,!0,n&&n[0],i),c=[];if(!a||a.next===a.prev)return c;let l,u,h,d,p,g,J;if(s&&(a=zd(r,t,a,e,n,i)),r.length>80*e){d=u=r[0],p=h=r[1];for(let nt=e;nt<o;nt+=e)g=r[nt],J=r[nt+1],g<d&&(d=g),J<p&&(p=J),g>u&&(u=g),J>h&&(h=J);l=Math.max(u-d,h-p),l=l!==0?32767/l:0}return Fi(a,c,e,d,p,l,0),c}function nu(r,t,e,n,i,s,o){let a,c;s===void 0&&(s=Tn(r,{start:t,end:e,size:n,plane:o}));let l=Di[o[0]],u=Di[o[1]];if(i===s<0)for(a=t;a<e;a+=n)c=ru(a,r[a+l],r[a+u],c);else for(a=e-n;a>=t;a-=n)c=ru(a,r[a+l],r[a+u],c);return c&&po(c,c.next)&&(Ni(c),c=c.next),c}function qr(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(po(e,e.next)||ot(e.prev,e,e.next)===0)){if(Ni(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Fi(r,t,e,n,i,s,o){if(!r)return;!o&&s&&Hd(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?jd(r,n,i,s):Cd(r)){t.push(c.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Ni(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=kd(qr(r),t,e),Fi(r,t,e,n,i,s,2)):o===2&&Vd(r,t,e,n,i,s):Fi(qr(r),t,e,n,i,s,1);break}}}function Cd(r){let t=r.prev,e=r,n=r.next;if(ot(t,e,n)>=0)return!1;let i=t.x,s=e.x,o=n.x,a=t.y,c=e.y,l=n.y,u=i<s?i<o?i:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,d=i>s?i>o?i:o:s>o?s:o,p=a>c?a>l?a:l:c>l?c:l,g=n.next;for(;g!==t;){if(g.x>=u&&g.x<=d&&g.y>=h&&g.y<=p&&Nn(i,a,s,c,o,l,g.x,g.y)&&ot(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function jd(r,t,e,n){let i=r.prev,s=r,o=r.next;if(ot(i,s,o)>=0)return!1;let a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,d=o.y,p=a<c?a<l?a:l:c<l?c:l,g=u<h?u<d?u:d:h<d?h:d,J=a>c?a>l?a:l:c>l?c:l,nt=u>h?u>d?u:d:h>d?h:d,Ft=Oa(p,g,t,e,n),or=Oa(J,nt,t,e,n),z=r.prevZ,V=r.nextZ;for(;z&&z.z>=Ft&&V&&V.z<=or;){if(z.x>=p&&z.x<=J&&z.y>=g&&z.y<=nt&&z!==i&&z!==o&&Nn(a,u,c,h,l,d,z.x,z.y)&&ot(z.prev,z,z.next)>=0||(z=z.prevZ,V.x>=p&&V.x<=J&&V.y>=g&&V.y<=nt&&V!==i&&V!==o&&Nn(a,u,c,h,l,d,V.x,V.y)&&ot(V.prev,V,V.next)>=0))return!1;V=V.nextZ}for(;z&&z.z>=Ft;){if(z.x>=p&&z.x<=J&&z.y>=g&&z.y<=nt&&z!==i&&z!==o&&Nn(a,u,c,h,l,d,z.x,z.y)&&ot(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;V&&V.z<=or;){if(V.x>=p&&V.x<=J&&V.y>=g&&V.y<=nt&&V!==i&&V!==o&&Nn(a,u,c,h,l,d,V.x,V.y)&&ot(V.prev,V,V.next)>=0)return!1;V=V.nextZ}return!0}function kd(r,t,e){let n=r;do{let i=n.prev,s=n.next.next;!po(i,s)&&iu(i,n,n.next,s)&&Ti(i,s)&&Ti(s,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),Ni(n),Ni(n.next),n=r=s),n=n.next}while(n!==r);return qr(n)}function Vd(r,t,e,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Kd(o,a)){let c=su(o,a);o=qr(o,o.next),c=qr(c,c.next),Fi(o,t,e,n,i,s,0),Fi(c,t,e,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function zd(r,t,e,n,i,s){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*n,u=a<c-1?t[a+1]*n:r.length,h=nu(r,l,u,n,!1,i&&i[a+1],s),h===h.next&&(h.steiner=!0),o.push(Zd(h));for(o.sort(Wd),a=0;a<o.length;a++)e=Jd(o[a],e);return e}function Wd(r,t){return r.x-t.x}function Jd(r,t){let e=Gd(r,t);if(!e)return t;let n=su(e,r);return qr(n,n.next),qr(e,e.next)}function Gd(r,t){let e=t,n=r.x,i=r.y,s=-1/0,o;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){let d=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>s&&(s=d,o=e.x<e.next.x?e:e.next,d===n))return o}e=e.next}while(e!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;e=o;do n>=e.x&&e.x>=c&&n!==e.x&&Nn(i<l?n:s,i,c,l,i<l?s:n,i,e.x,e.y)&&(h=Math.abs(i-e.y)/(n-e.x),Ti(e,r)&&(h<u||h===u&&(e.x>o.x||e.x===o.x&&$d(o,e)))&&(o=e,u=h)),e=e.next;while(e!==a);return o}function $d(r,t){return ot(r.prev,r,t.prev)<0&&ot(t.next,r,r.next)<0}function Hd(r,t,e,n){let i=r;do i.z===0&&(i.z=Oa(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Yd(i)}function Yd(r){let t,e,n=1,i,s,o,a,c,l;do{for(s=r,r=null,l=null,i=0;s;){for(i++,a=s,o=0,e=0;e<n&&(o++,a=a.nextZ,!!a);e++);for(c=n;o>0||c>0&&a;)o!==0&&(c===0||!a||s.z<=a.z)?(t=s,s=s.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:r=t,t.prevZ=l,l=t;s=a}l.nextZ=null,n*=2}while(i>1);return r}function Oa(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Zd(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Nn(r,t,e,n,i,s,o,a){return(i-o)*(t-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(i-o)*(n-a)}function Kd(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Xd(r,t)&&(Ti(r,t)&&Ti(t,r)&&qd(r,t)&&(ot(r.prev,r,t.prev)||ot(r,t.prev,t))||po(r,t)&&ot(r.prev,r,r.next)>0&&ot(t.prev,t,t.next)>0)}function ot(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function po(r,t){return r.x===t.x&&r.y===t.y}function iu(r,t,e,n){let i=ho(ot(r,t,e)),s=ho(ot(r,t,n)),o=ho(ot(e,n,r)),a=ho(ot(e,n,t));return!!(i!==s&&o!==a||i===0&&fo(r,e,t)||s===0&&fo(r,n,t)||o===0&&fo(e,r,n)||a===0&&fo(e,t,n))}function fo(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function ho(r){return r>0?1:r<0?-1:0}function Xd(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&iu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Ti(r,t){return ot(r.prev,r,r.next)<0?ot(r,t,r.next)>=0&&ot(r,r.prev,t)>=0:ot(r,t,r.prev)<0||ot(r,r.next,t)<0}function qd(r,t){let e=r,n=!1,i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function su(r,t){let e=new Li(r.i,r.x,r.y),n=new Li(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function ru(r,t,e,n){let i=new Li(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ni(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}var Li=class{constructor(t,e,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=n}};function cu(r,t,e){let n=np(r),i=Object.keys(n).filter(s=>n[s]!==Array);return ip(r,{propArrayTypes:n,...t},{numericPropKeys:e&&e.numericPropKeys||i,PositionDataType:e?e.PositionDataType:Float32Array,triangulate:e?e.triangulate:!0})}function np(r){let t={};for(let e of r)if(e.properties)for(let n in e.properties){let i=e.properties[n];t[n]=up(i,t[n])}return t}function ip(r,t,e){let{pointPositionsCount:n,pointFeaturesCount:i,linePositionsCount:s,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:h,propArrayTypes:d,coordLength:p}=t,{numericPropKeys:g=[],PositionDataType:J=Float32Array,triangulate:nt=!0}=e,Ft=r[0]&&"id"in r[0],or=r.length>65535?Uint32Array:Uint16Array,z={type:"Point",positions:new J(n*p),globalFeatureIds:new or(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},V={type:"LineString",pathIndices:s>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new J(s*p),globalFeatureIds:new or(s),featureIds:a>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},ar={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 J(c*p),globalFeatureIds:new or(c),featureIds:h>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};nt&&(ar.triangles=[]);for(let cr of[z,V,ar])for(let wr of g){let lr=d[wr];cr.numericProps[wr]=new lr(cr.positions.length/p)}V.pathIndices[o]=s,ar.polygonIndices[l]=c,ar.primitivePolygonIndices[u]=c;let _r={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let cr of r){let wr=cr.geometry,lr=cr.properties||{};switch(wr.type){case"Point":sp(wr,z,_r,p,lr),z.properties.push(Ta(lr,g)),Ft&&z.fields.push({id:cr.id}),_r.pointFeature++;break;case"LineString":op(wr,V,_r,p,lr),V.properties.push(Ta(lr,g)),Ft&&V.fields.push({id:cr.id}),_r.lineFeature++;break;case"Polygon":ap(wr,ar,_r,p,lr),ar.properties.push(Ta(lr,g)),Ft&&ar.fields.push({id:cr.id}),_r.polygonFeature++;break;default:throw new Error("Invalid geometry type")}_r.feature++}return lp(z,V,ar,p)}function sp(r,t,e,n,i){t.positions.set(r.data,e.pointPosition*n);let s=r.data.length/n;Na(t,i,e.pointPosition,s),t.globalFeatureIds.fill(e.feature,e.pointPosition,e.pointPosition+s),t.featureIds.fill(e.pointFeature,e.pointPosition,e.pointPosition+s),e.pointPosition+=s}function op(r,t,e,n,i){t.positions.set(r.data,e.linePosition*n);let s=r.data.length/n;Na(t,i,e.linePosition,s),t.globalFeatureIds.fill(e.feature,e.linePosition,e.linePosition+s),t.featureIds.fill(e.lineFeature,e.linePosition,e.linePosition+s);for(let o=0,a=r.indices.length;o<a;++o){let c=r.indices[o],l=o===a-1?r.data.length:r.indices[o+1];t.pathIndices[e.linePath++]=e.linePosition,e.linePosition+=(l-c)/n}}function ap(r,t,e,n,i){t.positions.set(r.data,e.polygonPosition*n);let s=r.data.length/n;Na(t,i,e.polygonPosition,s),t.globalFeatureIds.fill(e.feature,e.polygonPosition,e.polygonPosition+s),t.featureIds.fill(e.polygonFeature,e.polygonPosition,e.polygonPosition+s);for(let o=0,a=r.indices.length;o<a;++o){let c=e.polygonPosition;t.polygonIndices[e.polygonObject++]=c;let l=r.areas[o],u=r.indices[o],h=r.indices[o+1];for(let p=0,g=u.length;p<g;++p){let J=u[p],nt=p===g-1?h===void 0?r.data.length:h[0]:u[p+1];t.primitivePolygonIndices[e.polygonRing++]=e.polygonPosition,e.polygonPosition+=(nt-J)/n}let d=e.polygonPosition;cp(t,l,u,{startPosition:c,endPosition:d,coordLength:n})}}function cp(r,t,e,{startPosition:n,endPosition:i,coordLength:s}){if(!r.triangles)return;let o=n*s,a=i*s,c=r.positions.subarray(o,a),l=e[0],u=e.slice(1).map(d=>(d-l)/s),h=Da(c,u,s,t);for(let d=0,p=h.length;d<p;++d)r.triangles.push(n+h[d])}function Fa(r,t){let e={};for(let n in r)e[n]={value:r[n],size:t};return e}function lp(r,t,e,n){let i={shape:"binary-feature-collection",points:{...r,positions:{value:r.positions,size:n},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Fa(r.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Fa(t.numericProps,1)},polygons:{...e,positions:{value:e.positions,size:n},polygonIndices:{value:e.polygonIndices,size:1},primitivePolygonIndices:{value:e.primitivePolygonIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Fa(e.numericProps,1)}};return i.polygons&&e.triangles&&(i.polygons.triangles={value:new Uint32Array(e.triangles),size:1}),i}function Na(r,t,e,n){for(let i in r.numericProps)if(i in t){let s=t[i];r.numericProps[i].fill(s,e,e+n)}}function Ta(r,t){let e={};for(let n in r)t.includes(n)||(e[n]=r[n]);return e}function up(r,t){return t===Array||!Number.isFinite(r)?Array:t===Float64Array||Math.fround(r)!==r?Float64Array:Float32Array}function fu(r,t={coordLength:2,fixRingWinding:!0}){return r.map(e=>fp(e,t))}function lu(r,t,e,n){e.push(t.length),t.push(...r);for(let i=r.length;i<n.coordLength;i++)t.push(0)}function La(r,t,e,n){e.push(t.length);for(let i of r){t.push(...i);for(let s=i.length;s<n.coordLength;s++)t.push(0)}}function uu(r,t,e,n,i){let s=0,o=[],a=[];for(let c of r){let l=c.map(d=>d.slice(0,2)),u=Tn(l.flat()),h=u<0;i.fixRingWinding&&(s===0&&!h||s>0&&h)&&(c.reverse(),u=-u),o.push(u),La(c,t,a,i),s++}s>0&&(n.push(o),e.push(a))}function fp(r,t){let{geometry:e}=r;if(e.type==="GeometryCollection")throw new Error("GeometryCollection type not supported");let n=[],i=[],s,o;switch(e.type){case"Point":o="Point",lu(e.coordinates,n,i,t);break;case"MultiPoint":o="Point",e.coordinates.map(a=>lu(a,n,i,t));break;case"LineString":o="LineString",La(e.coordinates,n,i,t);break;case"MultiLineString":o="LineString",e.coordinates.map(a=>La(a,n,i,t));break;case"Polygon":o="Polygon",s=[],uu(e.coordinates,n,i,s,t);break;case"MultiPolygon":o="Polygon",s=[],e.coordinates.map(a=>uu(a,n,i,s,t));break;default:throw new Error(`Unknown type: ${o}`)}return{...r,geometry:{type:o,indices:i,data:n,areas:s}}}function Ui(r,t={fixRingWinding:!0,triangulate:!0}){let e=eu(r),n=e.coordLength,{fixRingWinding:i}=t,s=fu(r,{coordLength:n,fixRingWinding:i});return cu(s,e,{numericPropKeys:t.numericPropKeys,PositionDataType:t.PositionDataType||Float32Array,triangulate:t.triangulate})}var hp="4.4.0-alpha.13",Ua={dataType:null,batchType:null,name:"GeoJSON",id:"geojson",module:"geojson",version:hp,worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"geojson-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}}},Qr={...Ua,parse:dp,parseTextSync:hu,parseInBatches:pp};async function dp(r,t){return hu(new TextDecoder().decode(r),t)}function hu(r,t){t={...Qr.options,...t},t.geojson={...Qr.options.geojson,...t.geojson},t.gis=t.gis||{};let e;try{e=JSON.parse(r)}catch{e={}}let n={shape:"geojson-table",type:"FeatureCollection",features:e?.features||[]};switch(t.gis.format){case"binary":return Ui(n.features);default:return n}}function pp(r,t){t={...Qr.options,...t},t.json={...Qr.options.json,...t.json},t.geojson={...Qr.options.geojson,...t.geojson};let e=lo(r,t);switch(t.gis.format){case"binary":return mp(e);default:return e}}async function*mp(r){for await(let t of r)t.data=Ui(t.data),yield t}function du(r){let t=r.schema?.fields.findIndex(e=>e.name==="geometry")??-1;if(t>-1)return t;if(gr(r)>0){let e=so(r,0);for(let n=0;n<no(r);n++){let i=e?.[n];if(i&&typeof i=="object")return n}}throw new Error("Failed to detect geometry column")}function pu(r,t,e=[]){let n={};for(let i=0;i<no(r);++i){let s=r.schema?.fields[i].name;s&&!e.includes(i)&&(n[s]=t[s])}return n}function mu(r,t,e,n){let i=io(r,t);if(!i)return;let s=yp(r,i,e),o=JSON.stringify(s);n.push(o)}function yp(r,t,e){let n=pu(r,t,[e]),i=r.schema?.fields[e].name,s=i&&t[i];if(!s)return{type:"Feature",geometry:null,properties:n};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:n}:{type:"Feature",geometry:s,properties:n}}var mo=class{chunkSize;strings=[];totalLength=0;textEncoder=new TextEncoder;constructor(t){this.chunkSize=t}push(...t){for(let e of t)this.strings.push(e),this.totalLength+=e.length}isFull(){return this.totalLength>=this.chunkSize}getArrayBufferBatch(){return xa(this.textEncoder.encode(this.getStringBatch()).buffer)}getStringBatch(){let t=this.strings.join("");return this.strings=[],this.totalLength=0,t}};async function*Ea(r,t={}){let e={geojson:{},chunkSize:1e4,...t},n=new mo(e.chunkSize);e.geojson.featureArray||n.push(`{
23
23
  `,`"type": "FeatureCollection",
24
24
  `,`"features":
25
25
  `),n.push("[");let i=e.geojson.geometryColumn,s=!0,o=0;for await(let a of r){let c=o+gr(a);i||(i=i||du(a));for(let u=o;u<c;++u)s||n.push(","),n.push(`
@@ -6,7 +6,7 @@ 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.4.0-alpha.11" !== 'undefined' ? "4.4.0-alpha.11" : 'latest';
9
+ const VERSION = typeof "4.4.0-alpha.13" !== 'undefined' ? "4.4.0-alpha.13" : 'latest';
10
10
  /**
11
11
  * GeoJSON loader
12
12
  */
@@ -14437,7 +14437,7 @@ Char: ${this.c}`;
14437
14437
  }
14438
14438
 
14439
14439
  // src/geojson-loader.ts
14440
- var VERSION = true ? "4.4.0-alpha.11" : "latest";
14440
+ var VERSION = true ? "4.4.0-alpha.13" : "latest";
14441
14441
  var GeoJSONWorkerLoader = {
14442
14442
  dataType: null,
14443
14443
  batchType: null,
package/dist/index.cjs CHANGED
@@ -1113,7 +1113,7 @@ function rebuildJsonObject(batch, data) {
1113
1113
  }
1114
1114
 
1115
1115
  // dist/json-loader.js
1116
- var VERSION = true ? "4.4.0-alpha.11" : "latest";
1116
+ var VERSION = true ? "4.4.0-alpha.13" : "latest";
1117
1117
  var JSONLoader = {
1118
1118
  dataType: null,
1119
1119
  batchType: null,
@@ -1196,7 +1196,7 @@ async function* parseNDJSONInBatches(binaryAsyncIterator, options) {
1196
1196
  }
1197
1197
 
1198
1198
  // dist/ndjson-loader.js
1199
- var VERSION2 = true ? "4.4.0-alpha.11" : "latest";
1199
+ var VERSION2 = true ? "4.4.0-alpha.13" : "latest";
1200
1200
  var NDJSONLoader = {
1201
1201
  dataType: null,
1202
1202
  batchType: null,
@@ -1248,7 +1248,7 @@ var JSONWriter = {
1248
1248
 
1249
1249
  // dist/geojson-loader.js
1250
1250
  var import_gis = require("@loaders.gl/gis");
1251
- var VERSION3 = true ? "4.4.0-alpha.11" : "latest";
1251
+ var VERSION3 = true ? "4.4.0-alpha.13" : "latest";
1252
1252
  var GeoJSONWorkerLoader = {
1253
1253
  dataType: null,
1254
1254
  batchType: null,
@@ -5,7 +5,7 @@ import { parseJSONSync } from "./lib/parsers/parse-json.js";
5
5
  import { parseJSONInBatches } from "./lib/parsers/parse-json-in-batches.js";
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof "4.4.0-alpha.11" !== 'undefined' ? "4.4.0-alpha.11" : 'latest';
8
+ const VERSION = typeof "4.4.0-alpha.13" !== 'undefined' ? "4.4.0-alpha.13" : 'latest';
9
9
  export const JSONLoader = {
10
10
  dataType: null,
11
11
  batchType: null,
@@ -5,7 +5,7 @@ import { parseNDJSONSync } from "./lib/parsers/parse-ndjson.js";
5
5
  import { parseNDJSONInBatches } from "./lib/parsers/parse-ndjson-in-batches.js";
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof "4.4.0-alpha.11" !== 'undefined' ? "4.4.0-alpha.11" : 'latest';
8
+ const VERSION = typeof "4.4.0-alpha.13" !== 'undefined' ? "4.4.0-alpha.13" : 'latest';
9
9
  /** NDGeoJSONLoader */
10
10
  export const NDJSONLoader = {
11
11
  dataType: null,
@@ -5,7 +5,7 @@ import { parseNDJSONSync } from "./lib/parsers/parse-ndjson.js";
5
5
  import { parseNDJSONInBatches } from "./lib/parsers/parse-ndjson-in-batches.js";
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof "4.4.0-alpha.11" !== 'undefined' ? "4.4.0-alpha.11" : 'latest';
8
+ const VERSION = typeof "4.4.0-alpha.13" !== 'undefined' ? "4.4.0-alpha.13" : 'latest';
9
9
  export const NDJSONLoader = {
10
10
  dataType: null,
11
11
  batchType: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/json",
3
- "version": "4.4.0-alpha.11",
3
+ "version": "4.4.0-alpha.13",
4
4
  "description": "Framework-independent loader for JSON and streaming JSON formats",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,13 +47,13 @@
47
47
  "build-worker": "esbuild src/workers/geojson-worker.ts --bundle --outfile=dist/geojson-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
48
48
  },
49
49
  "dependencies": {
50
- "@loaders.gl/gis": "4.4.0-alpha.11",
51
- "@loaders.gl/loader-utils": "4.4.0-alpha.11",
52
- "@loaders.gl/schema": "4.4.0-alpha.11",
53
- "@loaders.gl/schema-utils": "4.4.0-alpha.11"
50
+ "@loaders.gl/gis": "4.4.0-alpha.13",
51
+ "@loaders.gl/loader-utils": "4.4.0-alpha.13",
52
+ "@loaders.gl/schema": "4.4.0-alpha.13",
53
+ "@loaders.gl/schema-utils": "4.4.0-alpha.13"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@loaders.gl/core": "4.4.0-alpha.1"
57
57
  },
58
- "gitHead": "3e9a77c2912342e8ad22db7df7517fe86e8e492d"
58
+ "gitHead": "5145c7b32353d00f414b85773caa9064af412434"
59
59
  }