@loaders.gl/mvt 4.3.1 → 4.3.2

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
@@ -4,7 +4,7 @@
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 _n=Object.create;var X=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Bn=Object.getPrototypeOf,Mn=Object.prototype.hasOwnProperty;var Ln=(e,t,n)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Dn=(e,t)=>{for(var n in t)X(e,n,{get:t[n],enumerable:!0})},he=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of En(t))!Mn.call(e,i)&&i!==n&&X(e,i,{get:()=>t[i],enumerable:!(r=An(t,i))||r.enumerable});return e},pe=(e,t,n)=>(he(e,t,"default"),n&&he(n,t,"default")),pt=(e,t,n)=>(n=e!=null?_n(Bn(e)):{},he(t||!e||!e.__esModule?X(n,"default",{value:e,enumerable:!0}):n,e)),Vn=e=>he(X({},"__esModule",{value:!0}),e);var de=(e,t,n)=>(Ln(e,typeof t!="symbol"?t+"":t,n),n);var mt=ke((no,dt)=>{dt.exports=globalThis.loaders});var Jt=ke(We=>{We.read=function(e,t,n,r,i){var o,s,a=i*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,u=n?i-1:0,h=n?-1:1,p=e[t+u];for(u+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=o*256+e[t+u],u+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=s*256+e[t+u],u+=h,f-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-c}return(p?-1:1)*s*Math.pow(2,o-r)};We.write=function(e,t,n,r,i,o){var s,a,l,c=o*8-i-1,f=(1<<c)-1,u=f>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=h/l:t+=h*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(t*l-1)*Math.pow(2,i),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=a&255,p+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+p]=s&255,p+=d,s/=256,c-=8);e[n+p-d]|=y*128}});var Kt=ke((Ks,Xt)=>{"use strict";Xt.exports=x;var be=Jt();function x(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}x.Varint=0;x.Fixed64=1;x.Bytes=2;x.Fixed32=5;var Ye=(1<<16)*(1<<16),Ht=1/Ye,$r=12,Yt=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=r&7,e(i,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ie(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Wt(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ie(this.buf,this.pos)+Ie(this.buf,this.pos+4)*Ye;return this.pos+=8,e},readSFixed64:function(){var e=Ie(this.buf,this.pos)+Wt(this.buf,this.pos+4)*Ye;return this.pos+=8,e},readFloat:function(){var e=be.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=be.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,Jr(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=$r&&Yt?oi(this.buf,t,e):ii(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==x.Bytes)return e.push(this.readVarint(t));var n=D(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==x.Bytes)return e.push(this.readBoolean());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==x.Bytes)return e.push(this.readFloat());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==x.Bytes)return e.push(this.readDouble());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed32());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed32());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed64());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed64());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===x.Varint)for(;this.buf[this.pos++]>127;);else if(t===x.Bytes)this.pos=this.readVarint()+this.pos;else if(t===x.Fixed32)this.pos+=4;else if(t===x.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),W(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),W(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),W(this.buf,e&-1,this.pos),W(this.buf,Math.floor(e*Ht),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),W(this.buf,e&-1,this.pos),W(this.buf,Math.floor(e*Ht),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Hr(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=si(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Zt(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),be.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),be.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&Zt(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,x.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,Yr,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Xr,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,qr,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Kr,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Qr,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ei,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,ti,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,ni,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,ri,t)},writeBytesField:function(e,t){this.writeTag(e,x.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,x.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,x.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,x.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function Jr(e,t,n){var r=n.buf,i,o;if(o=r[n.pos++],i=(o&112)>>4,o<128||(o=r[n.pos++],i|=(o&127)<<3,o<128)||(o=r[n.pos++],i|=(o&127)<<10,o<128)||(o=r[n.pos++],i|=(o&127)<<17,o<128)||(o=r[n.pos++],i|=(o&127)<<24,o<128)||(o=r[n.pos++],i|=(o&1)<<31,o<128))return Z(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function D(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function Z(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Hr(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),Zr(n,r,t),Wr(r,t)}function Zr(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function Wr(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Zt(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var i=n.pos-1;i>=e;i--)n.buf[i+r]=n.buf[i]}function Yr(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function Xr(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function Kr(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function Qr(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function qr(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function ei(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function ti(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function ni(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function ri(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Ie(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function W(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Wt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function ii(e,t,n){for(var r="",i=t;i<n;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a>n)break;var l,c,f;a===1?o<128&&(s=o):a===2?(l=e[i+1],(l&192)===128&&(s=(o&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[i+1],c=e[i+2],(l&192)===128&&(c&192)===128&&(s=(o&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[i+1],c=e[i+2],f=e[i+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(o&15)<<18|(l&63)<<12|(c&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,r+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),r+=String.fromCharCode(s),i+=a}return r}function oi(e,t,n){return Yt.decode(e.subarray(t,n))}function si(e,t,n){for(var r=0,i,o;r<t.length;r++){if(i=t.charCodeAt(r),i>55295&&i<57344)if(o)if(i<56320){e[n++]=239,e[n++]=191,e[n++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):o=i;continue}else o&&(e[n++]=239,e[n++]=191,e[n++]=189,o=null);i<128?e[n++]=i:(i<2048?e[n++]=i>>6|192:(i<65536?e[n++]=i>>12|224:(e[n++]=i>>18|240,e[n++]=i>>12&63|128),e[n++]=i>>6&63|128),e[n++]=i&63|128)}return n}});var ue={};Dn(ue,{MVTLoader:()=>ve,MVTSource:()=>mn,MVTWorkerLoader:()=>qe,TableTileSource:()=>ht,TileJSONLoader:()=>z});pe(ue,pt(mt(),1));function gt(e){let t=[];if(e.fields)for(let n of e.fields)t.push({name:n.name,type:Cn(n),metadata:Nn(n)});return{metadata:kn(e),fields:t}}function kn(e){let t={};for(let[n,r]of Object.entries(e))n!=="fields"&&r&&(t[n]=JSON.stringify(r));return t}function Cn(e){switch(e.type.toLowerCase()){case"float32":return"float32";case"number":case"float64":return"float64";case"string":case"utf8":return"utf8";case"boolean":return"bool";default:return"null"}}function Nn(e){let t={};for(let[n,r]of Object.entries(e))n!=="name"&&r&&(t[n]=JSON.stringify(r));return t}var Tt=e=>e!==null&&typeof e=="object";function Ce(e,t){if(!e||!Tt(e))return null;let n={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(n.generator=e.generator),typeof e.generator_options=="string"&&(n.generatorOptions=e.generator_options),n.boundingBox=yt(e.bounds)||yt(e.antimeridian_adjusted_bounds),n.center=zn(e.center),n.maxZoom=xt(e.maxzoom),n.minZoom=xt(e.minzoom),typeof e?.json=="string")try{n.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let r=e.tilestats||n.metaJson?.tilestats,i=On(r,t),o=Un(e.vector_layers),s=Rn(o,i);return n={...n,layers:s},n.maxZoom===null&&s.length>0&&(n.maxZoom=s[0].maxZoom||null),n.minZoom===null&&s.length>0&&(n.minZoom=s[0].minZoom||null),n}function Un(e){return Array.isArray(e)?e.map(t=>Gn(t)):[]}function Gn(e){let t=Object.entries(e.fields||[]).map(([r,i])=>({name:r,...It(String(i))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function On(e,t){return Tt(e)&&Array.isArray(e.layers)?e.layers.map(n=>jn(n,t)):[]}function jn(e,t){let n=[],r={},i=e.attributes||[];for(let o of i){let s=o.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];r[a]=r[a]||[],r[a].push(o),console.warn("ignoring tilestats indexed field",a)}else n[s]||n.push(Jn(o,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function Rn(e,t){return e.map(n=>{let r=t.find(s=>s.name===n.name),i=r?.fields||n.fields||[],o={...n,...r,fields:i};return o.schema=gt(o),o})}function yt(e){let t=bt(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(Pt)&&[t[1],t[3]].every(Ft))return[[t[0],t[1]],[t[2],t[3]]]}function zn(e){let t=bt(e);return Array.isArray(t)&&t.length===3&&Pt(t[0])&&Ft(t[1])&&$n(t[2])?t:null}function xt(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function Ft(e){return Number.isFinite(e)&&e<=90&&e>=-90}function Pt(e){return Number.isFinite(e)&&e<=180&&e>=-180}function $n(e){return Number.isFinite(e)&&e>=0&&e<=22}function bt(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var wt={number:{type:"float32"},numeric:{type:"float32"},string:{type:"utf8"},vachar:{type:"utf8"},float:{type:"float32"},int:{type:"int32"},int4:{type:"int32"},boolean:{type:"boolean"},bool:{type:"boolean"}};function Jn(e={},t){let n=It(e.type),r={name:e.attribute,...n};return typeof e.min=="number"&&(r.min=e.min),typeof e.max=="number"&&(r.max=e.max),typeof e.count=="number"&&(r.uniqueValueCount=e.count),e.values&&(r.values=e.values),r.values&&typeof t.maxValues=="number"&&(r.values=r.values?.slice(0,t.maxValues)),r}function It(e){let t=e.toLowerCase();return!t||wt[t],wt[t]||{type:"string"}}var Hn="4.3.0",z={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Hn,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),r=JSON.parse(n),i={...z.options.tilejson,...t?.tilejson};return Ce(r,i)},parseTextSync:(e,t)=>{let n=JSON.parse(e),r={...z.options.tilejson,...t?.tilejson};return Ce(n,r)}};function me(e,t="float32"){return e instanceof Date?"date-millisecond":e instanceof Number?t:typeof e=="string"?"utf8":(e===null||e==="undefined","null")}function St(e){let t=Zn(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=me(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function Zn(e){switch(e.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 Ne(e){switch(e.shape){case"array-row-table":case"object-row-table":return Yn(e.data);case"geojson-table":return Xn(e.features);case"columnar-table":return Wn(e.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Wn(e){let t=[];for(let[n,r]of Object.entries(e)){let i=Kn(r,n);t.push(i)}return{fields:t,metadata:{}}}function Yn(e){if(!e.length)throw new Error("deduce from empty table");let t=[],n=e[0];for(let[r,i]of Object.entries(n))t.push(vt(i,r));return{fields:t,metadata:{}}}function Xn(e){if(!e.length)throw new Error("deduce from empty table");let t=[],n=e[0].properties||{};for(let[r,i]of Object.entries(n))t.push(vt(i,r));return{fields:t,metadata:{}}}function Kn(e,t){if(ArrayBuffer.isView(e)){let n=St(e);return{name:t,type:n.type||"null",nullable:n.nullable}}if(Array.isArray(e)&&e.length>0){let n=e[0],r=me(n);return{name:t,type:r,nullable:!0}}throw new Error("empty table")}function vt(e,t){let n=me(e);return{name:t,type:n,nullable:!0}}var K={x:0,y:1,z:2};function C(e,t={}){let{start:n=0,end:r=e.length,plane:i="xy"}=t,o=t.size||2,s=0,a=K[i[0]],l=K[i[1]];for(let c=n,f=r-o;c<r;c+=o)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function Ge(e,t,n=2,r,i="xy"){let o=t&&t.length,s=o?t[0]*n:e.length,a=At(e,0,s,n,!0,r&&r[0],i),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,p,d,y;if(o&&(a=ir(e,t,a,n,r,i)),e.length>80*n){h=f=e[0],p=u=e[1];for(let w=n;w<s;w+=n)d=e[w],y=e[w+1],d<h&&(h=d),y<p&&(p=y),d>f&&(f=d),y>u&&(u=y);c=Math.max(f-h,u-p),c=c!==0?32767/c:0}return Q(a,l,n,h,p,c,0),l}function At(e,t,n,r,i,o,s){let a,l;o===void 0&&(o=C(e,{start:t,end:n,size:r,plane:s}));let c=K[s[0]],f=K[s[1]];if(i===o<0)for(a=t;a<n;a+=r)l=_t(a,e[a+c],e[a+f],l);else for(a=n-r;a>=t;a-=r)l=_t(a,e[a+c],e[a+f],l);return l&&xe(l,l.next)&&(ee(l),l=l.next),l}function N(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(xe(n,n.next)||T(n.prev,n,n.next)===0)){if(ee(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Q(e,t,n,r,i,o,s){if(!e)return;!s&&o&&cr(e,r,i,o);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,o?tr(e,r,i,o):er(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(c.i/n|0),ee(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=nr(N(e),t,n),Q(e,t,n,r,i,o,2)):s===2&&rr(e,t,n,r,i,o):Q(N(e),t,n,r,i,o,1);break}}}function er(e){let t=e.prev,n=e,r=e.next;if(T(t,n,r)>=0)return!1;let i=t.x,o=n.x,s=r.x,a=t.y,l=n.y,c=r.y,f=i<o?i<s?i:s:o<s?o:s,u=a<l?a<c?a:c:l<c?l:c,h=i>o?i>s?i:s:o>s?o:s,p=a>l?a>c?a:c:l>c?l:c,d=r.next;for(;d!==t;){if(d.x>=f&&d.x<=h&&d.y>=u&&d.y<=p&&$(i,a,o,l,s,c,d.x,d.y)&&T(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function tr(e,t,n,r){let i=e.prev,o=e,s=e.next;if(T(i,o,s)>=0)return!1;let a=i.x,l=o.x,c=s.x,f=i.y,u=o.y,h=s.y,p=a<l?a<c?a:c:l<c?l:c,d=f<u?f<h?f:h:u<h?u:h,y=a>l?a>c?a:c:l>c?l:c,w=f>u?f>h?f:h:u>h?u:h,S=Ue(p,d,t,n,r),v=Ue(y,w,t,n,r),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=S&&g&&g.z<=v;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=w&&m!==i&&m!==s&&$(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=p&&g.x<=y&&g.y>=d&&g.y<=w&&g!==i&&g!==s&&$(a,f,l,u,c,h,g.x,g.y)&&T(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;m&&m.z>=S;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=w&&m!==i&&m!==s&&$(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=v;){if(g.x>=p&&g.x<=y&&g.y>=d&&g.y<=w&&g!==i&&g!==s&&$(a,f,l,u,c,h,g.x,g.y)&&T(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function nr(e,t,n){let r=e;do{let i=r.prev,o=r.next.next;!xe(i,o)&&Et(i,r,r.next,o)&&q(i,o)&&q(o,i)&&(t.push(i.i/n|0),t.push(r.i/n|0),t.push(o.i/n|0),ee(r),ee(r.next),r=e=o),r=r.next}while(r!==e);return N(r)}function rr(e,t,n,r,i,o){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&hr(s,a)){let l=Bt(s,a);s=N(s,s.next),l=N(l,l.next),Q(s,t,n,r,i,o,0),Q(l,t,n,r,i,o,0);return}a=a.next}s=s.next}while(s!==e)}function ir(e,t,n,r,i,o){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*r,f=a<l-1?t[a+1]*r:e.length,u=At(e,c,f,r,!1,i&&i[a+1],o),u===u.next&&(u.steiner=!0),s.push(ur(u));for(s.sort(or),a=0;a<s.length;a++)n=sr(s[a],n);return n}function or(e,t){return e.x-t.x}function sr(e,t){let n=ar(e,t);if(!n)return t;let r=Bt(n,e);return N(r,r.next),N(n,n.next)}function ar(e,t){let n=t,r=e.x,i=e.y,o=-1/0,s;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let h=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>o&&(o=h,s=n.x<n.next.x?n:n.next,h===r))return s}n=n.next}while(n!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;n=s;do r>=n.x&&n.x>=l&&r!==n.x&&$(i<c?r:o,i,l,c,i<c?o:r,i,n.x,n.y)&&(u=Math.abs(i-n.y)/(r-n.x),q(n,e)&&(u<f||u===f&&(n.x>s.x||n.x===s.x&&lr(s,n)))&&(s=n,f=u)),n=n.next;while(n!==a);return s}function lr(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function cr(e,t,n,r){let i=e;do i.z===0&&(i.z=Ue(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,fr(i)}function fr(e){let t,n,r=1,i,o,s,a,l,c;do{for(o=e,e=null,c=null,i=0;o;){for(i++,a=o,s=0,n=0;n<r&&(s++,a=a.nextZ,!!a);n++);for(l=r;s>0||l>0&&a;)s!==0&&(l===0||!a||o.z<=a.z)?(t=o,o=o.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;o=a}c.nextZ=null,r*=2}while(i>1);return e}function Ue(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function ur(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function $(e,t,n,r,i,o,s,a){return(i-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(r-a)>=(n-s)*(t-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function hr(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!pr(e,t)&&(q(e,t)&&q(t,e)&&dr(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||xe(e,t)&&T(e.prev,e,e.next)>0&&T(t.prev,t,t.next)>0)}function T(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function xe(e,t){return e.x===t.x&&e.y===t.y}function Et(e,t,n,r){let i=ye(T(e,t,n)),o=ye(T(e,t,r)),s=ye(T(n,r,e)),a=ye(T(n,r,t));return!!(i!==o&&s!==a||i===0&&ge(e,n,t)||o===0&&ge(e,r,t)||s===0&&ge(n,e,r)||a===0&&ge(n,t,r))}function ge(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ye(e){return e>0?1:e<0?-1:0}function pr(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Et(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function q(e,t){return T(e.prev,e,e.next)<0?T(e,t,e.next)>=0&&T(e,e.prev,t)>=0:T(e,t,e.prev)<0||T(e,e.next,t)<0}function dr(e,t){let n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Bt(e,t){let n=new te(e.i,e.x,e.y),r=new te(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function _t(e,t,n,r){let i=new te(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ee(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var te=class{constructor(t,n,r){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=n,this.y=r}};function Re(e,t,n){let r=wr(e),i=Object.keys(r).filter(o=>r[o]!==Array);return Tr(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||i,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function wr(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let i=n.properties[r];t[r]=vr(i,t[r])}return t}function Tr(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:i,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:p}=t,{numericPropKeys:d=[],PositionDataType:y=Float32Array,triangulate:w=!0}=n,S=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(r*p),globalFeatureIds:new v(r),featureIds:i>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(o*p),globalFeatureIds:new v(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},b={type:"Polygon",polygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:l>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new y(l*p),globalFeatureIds:new v(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};w&&(b.triangles=[]);for(let P of[m,g,b])for(let _ of d){let A=h[_];P.numericProps[_]=new A(P.positions.length/p)}g.pathIndices[s]=o,b.polygonIndices[c]=l,b.primitivePolygonIndices[f]=l;let I={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let P of e){let _=P.geometry,A=P.properties||{};switch(_.type){case"Point":Fr(_,m,I,p,A),m.properties.push(je(A,d)),S&&m.fields.push({id:P.id}),I.pointFeature++;break;case"LineString":Pr(_,g,I,p,A),g.properties.push(je(A,d)),S&&g.fields.push({id:P.id}),I.lineFeature++;break;case"Polygon":br(_,b,I,p,A),b.properties.push(je(A,d)),S&&b.fields.push({id:P.id}),I.polygonFeature++;break;default:throw new Error("Invalid geometry type")}I.feature++}return Sr(m,g,b,p)}function Fr(e,t,n,r,i){t.positions.set(e.data,n.pointPosition*r);let o=e.data.length/r;ze(t,i,n.pointPosition,o),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+o),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+o),n.pointPosition+=o}function Pr(e,t,n,r,i){t.positions.set(e.data,n.linePosition*r);let o=e.data.length/r;ze(t,i,n.linePosition,o),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+o),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(c-l)/r}}function br(e,t,n,r,i){t.positions.set(e.data,n.polygonPosition*r);let o=e.data.length/r;ze(t,i,n.polygonPosition,o),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+o),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=n.polygonPosition;t.polygonIndices[n.polygonObject++]=l;let c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let p=0,d=f.length;p<d;++p){let y=f[p],w=p===d-1?u===void 0?e.data.length:u[0]:f[p+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(w-y)/r}let h=n.polygonPosition;Ir(t,c,f,{startPosition:l,endPosition:h,coordLength:r})}}function Ir(e,t,n,{startPosition:r,endPosition:i,coordLength:o}){if(!e.triangles)return;let s=r*o,a=i*o,l=e.positions.subarray(s,a),c=n[0],f=n.slice(1).map(h=>(h-c)/o),u=Ge(l,f,o,t);for(let h=0,p=u.length;h<p;++h)e.triangles.push(r+u[h])}function Oe(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function Sr(e,t,n,r){let i={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Oe(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Oe(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:Oe(n.numericProps,1)}};return i.polygons&&n.triangles&&(i.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),i}function ze(e,t,n,r){for(let i in e.numericProps)if(i in t){let o=t[i];e.numericProps[i].fill(o,n,n+r)}}function je(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function vr(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function ne(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var M={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},_r=M.self||M.window||M.global||{},Ar=M.window||M.self||M.global||{},Er=M.global||M.self||M.window||{},Br=M.document||{};var $e=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Dt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Mr=Dt&&parseFloat(Dt[1])||0;var we=globalThis,Lr=globalThis.document||{},Te=globalThis.process||{},Dr=globalThis.console,qo=globalThis.navigator||{};function Vt(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,n=e||t;return Boolean(n&&n.indexOf("Electron")>=0)}function U(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Vt()}var Je="4.0.7";function kr(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Fe=class{constructor(t,n,r="sessionStorage"){this.storage=kr(r),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function kt(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function Ct(e,t=8){let n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}var Pe;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Pe||(Pe={}));var Cr=10;function Nt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Pe[e]||Pe.WHITE)}function Ut(e,t,n){return!U&&typeof e=="string"&&(t&&(e=`\x1B[${Nt(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${Nt(n)+Cr}m${e}\x1B[49m`)),e}function Gt(e,t=["constructor"]){let n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),i=e;for(let o of r){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}function re(e,t){if(!e)throw new Error(t||"Assertion failed")}function G(){let e;if(U()&&we.performance)e=we?.performance?.now?.();else if("hrtime"in Te){let t=Te?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var J={debug:U()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Nr={enabled:!0,level:0};function H(){}var Ot={},jt={once:!0},V=class{constructor({id:t}={id:""}){this.VERSION=Je,this._startTs=G(),this._deltaTs=G(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Fe(`__probe-${this.id}__`,Nr),this.timeStamp(`${this.id} started`),Gt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((G()-this._startTs).toPrecision(10))}getDelta(){return Number((G()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){if(!t)throw new Error(n||"Assertion failed")}warn(t){return this._getLogFunction(0,t,J.warn,arguments,jt)}error(t){return this._getLogFunction(0,t,J.error,arguments)}deprecated(t,n){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${n}\` instead`)}removed(t,n){return this.error(`\`${t}\` has been removed. Use \`${n}\` instead`)}probe(t,n){return this._getLogFunction(t,n,J.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,J.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,J.debug||J.info,arguments,jt)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||H,r&&[r],{tag:Gr(n)}):H}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||H)}group(t,n,r={collapsed:!1}){let i=Rt({logLevel:t,message:n,opts:r}),{collapsed:o}=r;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,n,r={}){return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||H)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=zt(t)}_getLogFunction(t,n,r,i,o){if(this._shouldLog(t)){o=Rt({logLevel:t,message:n,args:i,opts:o}),r=r||o.method,re(r),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=G();let s=o.tag||o.message;if(o.once&&s)if(!Ot[s])Ot[s]=G();else return H;return n=Ur(this.id,o.message,o),r.bind(console,n,...o.args)}return H}};V.VERSION=Je;function zt(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return re(Number.isFinite(t)&&t>=0),t}function Rt(e){let{logLevel:t,message:n}=e;e.logLevel=zt(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return re(i==="string"||i==="object"),Object.assign(e,{args:r},e.opts)}function Ur(e,t,n){if(typeof t=="string"){let r=n.time?Ct(kt(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=Ut(t,n.color,n.background)}return t}function Gr(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var Is=new V({id:"@probe.gl/log"});var He="4.3.0",Or=He[0]>="0"&&He[0]<="9"?`v${He}`:"";function jr(){let e=new V({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=Or,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var F=jr();function ie(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var E=class{constructor(t,n){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=n,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=ie(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(ie()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var O=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,i=this.stats[n];return i||(t instanceof E?i=t:i=new E(n,r),this.stats[n]=i),i}};var Rr="",$t={};function Ze(e){for(let t in $t)if(e.startsWith(t)){let n=$t[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Rr}${e}`),e}var oe=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=zr(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function zr(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,i)=>t(r,i);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var Ke=pt(Kt(),1);function ai(e){let t=0;for(let n=0,r=e.length-1,i,o;n<e.length;r=n++)i=e[n],o=e[r],t+=(o[0]-i[0])*(i[1]+o[1]);return t}function se(e,t){if(Array.isArray(e[0])){for(let r of e)se(r,t);return}let n=e;n[0]/=t,n[1]/=t}function Qt(e,t){for(let n=0;n<e.length;++n)e[n]/=t}function ae(e,t,n){if(typeof e[0][0]!="number"){for(let s of e)ae(s,t,n);return}let r=n*Math.pow(2,t.z),i=n*t.x,o=n*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+i)*360/r-180;let l=180-(a[1]+o)*360/r;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function qt(e,t,n){let{x:r,y:i,z:o}=t,s=n*Math.pow(2,o),a=n*r,l=n*i;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function en(e){let t=e.length;if(t<=1)return[e];let n=[],r,i;for(let o=0;o<t;o++){let s=ai(e[o]);s!==0&&(i===void 0&&(i=s<0),i===s<0?(r&&n.push(r),r=[e[o]]):r&&r.push(e[o]))}return r&&n.push(r),n}function tn(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[C(e.data)]],indices:[e.indices]};let r=[],i=[],o=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),p=C(h);if(p===0){let d=e.data.slice(0,u),y=e.data.slice(c);e.data=d.concat(y),l+=c-u;continue}a===void 0&&(a=p<0),a===p<0?(s.length&&(r.push(o),i.push(s)),s=[u],o=[p]):(o.push(p),s.push(u))}return o&&r.push(o),s.length&&i.push(s),{type:n,areas:r,indices:i,data:e.data}}var j=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,i,o,s){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=i,this._values=o,this._geometryInfo=s,t.readFields(li,this,n)}toGeoJSONFeature(t,n){let r=this.loadGeometry();switch(t){case"wgs84":return nn(this,r,i=>ae(i,n,this.extent));default:return nn(this,r,se)}}toBinaryFeature(t,n){let r=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(r,i=>qt(i,n,this.extent));default:return this._toBinaryCoordinates(r,Qt)}}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<n;){if(i<=0){let u=t.readVarint();r=u&7,i=u>>3}if(i--,r===1||r===2)o+=t.readSVarint(),s+=t.readSVarint(),o<a&&(a=o),o>l&&(l=o),s<c&&(c=s),s>f&&(f=s);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,c,l,f]}_toBinaryCoordinates(t,n){let r;n(t.data,this.extent);let i=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,r={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/i,r={type:"LineString",...t};break;case 3:r=tn(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let s of r.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=r.data.length/i;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(o.id=this.id),o}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=[],l;for(;t.pos<n;){if(i<=0){let c=t.readVarint();r=c&7,i=c>>3}switch(i--,r){case 1:case 2:o+=t.readSVarint(),s+=t.readSVarint(),r===1&&(l&&a.push(l),l=[]),l&&l.push([o,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${r}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,i,o=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<n;)if(o<=0&&(i=t.readVarint(),r=i&7,o=i>>3),o--,r===1||r===2)s+=t.readSVarint(),a+=t.readSVarint(),r===1&&c.push(l),f.push(s,a),l+=2;else if(r===7){if(l>0){let u=c[c.length-1];f.push(f[u],f[u+1]),l+=2}}else throw new Error(`unknown command ${r}`);return{data:f,indices:c}}};de(j,"types",["Unknown","Point","LineString","Polygon"]);function nn(e,t,n){let r=j.types[e.type],i,o,s;switch(e.type){case 1:let l=[];for(i=0;i<t.length;i++)l[i]=t[i][0];s=l,n(s,e.extent);break;case 2:for(s=t,i=0;i<s.length;i++)n(s[i],e.extent);break;case 3:for(s=en(t),i=0;i<s.length;i++)for(o=0;o<s[i].length;o++)n(s[i][o],e.extent);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:r=`Multi${r}`;let a={type:"Feature",geometry:{type:r,coordinates:s},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function li(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?ci(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function ci(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[r]=i}}var Se=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(fi,this,n),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new j(this._pbf,n,this.extent,this._keys,this._values)}getBinaryFeature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new j(this._pbf,r,this.extent,this._keys,this._values,n)}};function fi(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(ui(n)))}function ui(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var le=class{layers;constructor(t,n){this.layers=t.readFields(hi,{},n)}};function hi(e,t,n){if(e===3&&n){let r=new Se(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function Qe(e,t){let n=di(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:Xe(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:rn(e,n)};case"geojson":return rn(e,n);case"binary-geometry":return Xe(e,n);case"binary":return Xe(e,n);default:throw new Error(r||"undefined shape")}}function Xe(e,t){let[n,r]=pi(e,t),i=Re(n,r);return i.byteLength=e.byteLength,i}function pi(e,t){let n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,r];let i=new le(new Ke.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(i.layers)).forEach(s=>{let a=i.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,r),f=gi(c,t,s);n.push(f)}}),[n,r]}function rn(e,t){if(e.byteLength<=0)return[];let n=[],r=new le(new Ke.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(o=>{let s=r.layers[o];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=mi(l,t,o);n.push(c)}}),n}function di(e){if(!e?.mvt)throw new Error("mvt options required");if(e.mvt?.coordinates==="wgs84"&&!e.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.gis&&F.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function mi(e,t,n){let r=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(r.properties||={},r.properties[t.layerProperty]=n),r}function gi(e,t,n){let r=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}var yi="4.3.0",qe={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:yi,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},ve={...qe,parse:async(e,t)=>Qe(e,t),parseSync:Qe,binary:!0};var on="4.3.0";var xi=globalThis.loaders?.parseImageNode,et=typeof Image<"u",tt=typeof ImageBitmap<"u",wi=Boolean(xi),nt=$e?!0:wi;function sn(e){switch(e){case"auto":return tt||et||nt;case"imagebitmap":return tt;case"image":return et;case"data":return nt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function an(){if(tt)return"imagebitmap";if(et)return"image";if(nt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Ti(e){let t=Fi(e);if(!t)throw new Error("Not an image");return t}function ln(e){switch(Ti(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Fi(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var Pi=/^data:image\/svg\+xml/,bi=/\.svg((\?|#).*)?$/;function _e(e){return e&&(Pi.test(e)||bi.test(e))}function cn(e,t){if(_e(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return rt(e,t)}function rt(e,t){if(_e(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ae(e,t,n){let r=cn(e,n),i=self.URL||self.webkitURL,o=typeof r!="string"&&i.createObjectURL(r);try{return await Ii(o||r,t)}finally{o&&i.revokeObjectURL(o)}}async function Ii(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,i)=>{try{n.onload=()=>r(n),n.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var Si={},fn=!0;async function un(e,t,n){let r;_e(n)?r=await Ae(e,t,n):r=rt(e,n);let i=t&&t.imagebitmap;return await vi(r,i)}async function vi(e,t=null){if((_i(t)||!fn)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),fn=!1}return await createImageBitmap(e)}function _i(e){for(let t in e||Si)return!1;return!0}function hn(e){return!Mi(e,"ftyp",4)||!(e[8]&96)?null:Ai(e)}function Ai(e){switch(Ei(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Ei(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Bi(e){return[...e].map(t=>t.charCodeAt(0))}function Mi(e,t,n=0){let r=Bi(t);for(let i=0;i<r.length;++i)if(r[i]!==e[i+n])return!1;return!0}var L=!1,ce=!0;function R(e){let t=fe(e);return Di(t)||Ci(t)||Vi(t)||ki(t)||Li(t)}function Li(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=hn(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function Di(e){let t=fe(e);return t.byteLength>=24&&t.getUint32(0,L)===2303741511?{mimeType:"image/png",width:t.getUint32(16,L),height:t.getUint32(20,L)}:null}function Vi(e){let t=fe(e);return t.byteLength>=10&&t.getUint32(0,L)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,ce),height:t.getUint16(8,ce)}:null}function ki(e){let t=fe(e);return t.byteLength>=14&&t.getUint16(0,L)===16973&&t.getUint32(2,ce)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,ce),height:t.getUint32(22,ce)}:null}function Ci(e){let t=fe(e);if(!(t.byteLength>=3&&t.getUint16(0,L)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:i}=Ni(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,L);if(i.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,L),width:t.getUint16(o+7,L)};if(!r.has(s))return null;o+=2,o+=t.getUint16(o,L)}return null}function Ni(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function fe(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function pn(e,t){let{mimeType:n}=R(e)||{},r=globalThis.loaders?.parseImageNode;return ne(r),await r(e,n)}async function dn(e,t,n){t=t||{};let i=(t.image||{}).type||"auto",{url:o}=n||{},s=Ui(i),a;switch(s){case"imagebitmap":a=await un(e,t,o);break;case"image":a=await Ae(e,t,o);break;case"data":a=await pn(e,t);break;default:ne(!1)}return i==="data"&&(a=ln(a)),a}function Ui(e){switch(e){case"auto":case"data":return an();default:return sn(e),e}}var Gi=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Oi=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],ji={image:{type:"auto",decode:!0}},it={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:on,mimeTypes:Oi,extensions:Gi,parse:dn,tests:[e=>Boolean(R(new DataView(e)))],options:ji};var mn={name:"MVT",id:"mvt",module:"mvt",version:"0.0.0",extensions:["mvt"],mimeTypes:["application/octet-stream"],options:{mvt:{}},type:"mvt",fromUrl:!0,fromBlob:!1,testURL:e=>!0,createDataSource(e,t){return new ot(e,t)}},ot=class extends oe{props;url;metadataUrl=null;data;schema="tms";metadata;extension;mimeType=null;constructor(t,n){super(n),this.props=n,this.url=Ze(t),this.metadataUrl=n.mvt?.metadataUrl||`${this.url}/tilejson.json`,this.extension=n.mvt?.extension||".png",this.data=this.url,this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata(),Ri(this.url)&&(this.schema="template")}async getMetadata(){if(!this.metadataUrl)return null;let t;try{t=await this.fetch(this.metadataUrl)}catch(i){return console.error(i.message),null}if(!t.ok)return console.error(t.statusText),null;let n=await t.text();return z.parseTextSync?.(n)||null}getTileMIMEType(){return this.mimeType}async getTile(t){let{x:n,y:r,z:i}=t,o=this.getTileURL(n,r,i),s=await this.fetch(o);return s.ok?await s.arrayBuffer():null}async getTileData(t){let{x:n,y:r,z:i}=t.index,o=await this.getTile({x:n,y:r,z:i,layers:[]});if(o===null)return null;let s=R(o);switch(this.mimeType=this.mimeType||s?.mimeType||"application/vnd.mapbox-vector-tile",this.mimeType){case"application/vnd.mapbox-vector-tile":return await this._parseVectorTile(o,{x:n,y:r,z:i,layers:[]});default:return await this._parseImageTile(o)}}async getImageTile(t){let n=await this.getTile(t);return n?this._parseImageTile(n):null}async _parseImageTile(t){return await it.parse(t,this.loadOptions)}async getVectorTile(t){let n=await this.getTile(t);return n?this._parseVectorTile(n,t):null}async _parseVectorTile(t,n){let r={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:n.x,y:n.y,z:n.z},...this.loadOptions?.mvt},...this.loadOptions};return await ve.parse(t,r)}getMetadataUrl(){return this.metadataUrl}getTileURL(t,n,r){switch(this.schema){case"xyz":return`${this.url}/${t}/${n}/${r}${this.extension}`;case"tms":return`${this.url}/${r}/${t}/${n}${this.extension}`;case"template":return Hi(this.url,t,n,r,"0");default:throw new Error(this.schema)}}};function Ri(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(e)}var zi=new RegExp("{x}","g"),$i=new RegExp("{y}","g"),Ji=new RegExp("{z}","g");function Hi(e,t,n,r,i="0"){if(Array.isArray(e)){let s=Zi(i)%e.length;e=e[s]}let o=e;return o=o.replace(zi,String(t)),o=o.replace($i,String(n)),o=o.replace(Ji,String(r)),Number.isInteger(n)&&Number.isInteger(r)&&(o=o.replace(/\{-y\}/g,String(Math.pow(2,r)-n-1))),o}function Zi(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function gn(e,t,n,r,i){let o=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),s={protoFeatures:[],sourceFeatures:null,numPoints:0,numSimplified:0,numFeatures:e.length,x:n,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let a of e)Wi(s,a,o,i);return s}function Wi(e,t,n,r){let i=t.geometry,o=t.type,s=[];e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY);let a;switch(o){case"Point":case"MultiPoint":a=1;for(let l=0;l<i.length;l+=3)s.push(i[l],i[l+1]),e.numPoints++,e.numSimplified++;break;case"LineString":a=2,Ee(s,i,e,n,!1,!1);break;case"MultiLineString":a=2;for(let l=0;l<i.length;l++)Ee(s,i[l],e,n,!1,l===0);break;case"Polygon":a=3;for(let l=0;l<i.length;l++)Ee(s,i[l],e,n,!0,l===0);break;case"MultiPolygon":a=3;for(let l=0;l<i.length;l++){let c=i[l];for(let f=0;f<c.length;f++)Ee(s,c[f],e,n,!0,f===0)}break;default:throw new Error(`Unknown geometry type: ${o}`)}if(s.length){let l=t.tags||null;if(o==="LineString"&&r.lineMetrics){l={};for(let f in t.tags)l[f]=t.tags[f];l.mapbox_clip_start=i.start/i.size,l.mapbox_clip_end=i.end/i.size}let c={geometry:s,simplifiedType:a,tags:l};t.id!==null&&(c.id=t.id),e.protoFeatures.push(c)}}function Ee(e,t,n,r,i,o){let s=r*r;if(r>0&&t.size<(i?s:r)){n.numPoints+=t.length/3;return}let a=[];for(let l=0;l<t.length;l+=3)(r===0||t[l+2]>s)&&(n.numSimplified++,a.push(t[l],t[l+1])),n.numPoints++;i&&Yi(a,o),e.push(a)}function Yi(e,t){let n=0;for(let r=0,i=e.length-2;r<e.length;i=r,r+=2)n+=(e[r]-e[i])*(e[r+1]+e[i+1]);if(n>0===t)for(let r=0,i=e.length;r<i/2;r+=2){let o=e[r],s=e[r+1];e[r]=e[i-2-r],e[r+1]=e[i-1-r],e[i-2-r]=o,e[i-1-r]=s}}function st(e,t){if(e.transformed)return e;let n=1<<e.z,r=e.x,i=e.y;for(let o of e.protoFeatures){let s=o.geometry,a=o.simplifiedType;if(o.geometry=[],a===1)for(let l=0;l<s.length;l+=2)o.geometry.push(yn(s[l],s[l+1],t,n,r,i));else for(let l=0;l<s.length;l++){let c=[];for(let f=0;f<s[l].length;f+=2)c.push(yn(s[l][f],s[l][f+1],t,n,r,i));o.geometry.push(c)}}return e.transformed=!0,e}function yn(e,t,n,r,i,o){return[Math.round(n*(e*r-i)),Math.round(n*(t*r-o))]}function xn(e,t){let n=[];for(let i of e.protoFeatures){if(!i||!i.geometry)continue;let o,s;switch(i.simplifiedType){case 1:i.geometry.length===1?(o="Point",s=i.geometry[0]):(o="MultiPoint",s=i.geometry);break;case 2:i.geometry.length===1?(o="LineString",s=i.geometry[0]):(o="MultiLineString",s=i.geometry);break;case 3:i.geometry.length>1?(o="MultiPolygon",s=[i.geometry]):(o="Polygon",s=i.geometry);break;default:throw new Error(`${i.simplifiedType}is not a valid simplified type`)}switch(t.coordinates){case"EPSG:4326":case"wgs84":ae(s,t.tileIndex,t.extent);break;default:se(s,t.extent);break}let a={type:"Feature",geometry:{type:o,coordinates:s},properties:i.tags||{},id:i.id};n.push(a)}return n.length===0?null:{shape:"geojson-table",type:"FeatureCollection",features:n}}function k(e,t,n,r){let i={id:e??null,type:t,simplifiedType:void 0,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(t){case"Point":case"MultiPoint":case"LineString":Be(i,n);break;case"MultiLineString":for(let o of n)Be(i,o);break;case"Polygon":Be(i,n[0]);break;case"MultiPolygon":for(let o of n)Be(i,o[0]);break;default:throw new Error(String(t))}return i}function Be(e,t){for(let n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function Me(e,t,n,r){let i=r,o=n-t>>1,s=n-t,a,l=e[t],c=e[t+1],f=e[n],u=e[n+1];for(let h=t+3;h<n;h+=3){let p=Xi(e[h],e[h+1],l,c,f,u);if(p>i)a=h,i=p;else if(p===i){let d=Math.abs(h-o);d<s&&(a=h,s=d)}}i>r&&(a-t>3&&Me(e,t,a,r),e[a+2]=i,n-a>3&&Me(e,a,n,r))}function Xi(e,t,n,r,i,o){let s=i-n,a=o-r;if(s!==0||a!==0){let l=((e-n)*s+(t-r)*a)/(s*s+a*a);l>1?(n=i,r=o):l>0&&(n+=s*l,r+=a*l)}return s=e-n,a=t-r,s*s+a*a}function Tn(e,t){let n=[];switch(e.type){case"FeatureCollection":let r=0;for(let i of e.features)n.push(Le(i,t,r++));break;case"Feature":n.push(Le(e,t));break;default:n.push(Le({geometry:e},t))}return n}function Le(e,t,n){if(!e.geometry)return;let r=e.geometry.coordinates,i=e.geometry.type,o=Math.pow(t.tolerance/((1<<t.maxZoom)*t.extent),2),s=[],a=e.id;switch(t.promoteId?a=e.properties[t.promoteId]:t.generateId&&(a=n||0),i){case"Point":wn(r,s);break;case"MultiPoint":for(let l of r)wn(l,s);break;case"LineString":lt(r,s,o,!1);break;case"MultiLineString":if(t.lineMetrics){for(let l of r)s=[],lt(l,s,o,!1),features.push(k(a,"LineString",s,e.properties));return}break;case"Polygon":at(r,s,o,!0);break;case"MultiPolygon":for(let l of r){let c=[];at(l,c,o,!0),s.push(c)}break;case"GeometryCollection":for(let l of e.geometry.geometries)Le(features,{id:a,geometry:l,properties:e.properties},t,n);break;default:throw new Error("Input data is not a valid GeoJSON object.")}return k(a,i,s,e.properties)}function wn(e,t){t.push(Fn(e[0]),Pn(e[1]),0)}function lt(e,t,n,r){let i,o,s=0;for(let l=0;l<e.length;l++){let c=Fn(e[l][0]),f=Pn(e[l][1]);t.push(c,f,0),l>0&&(r?s+=(i*f-c*o)/2:s+=Math.sqrt(Math.pow(c-i,2)+Math.pow(f-o,2))),i=c,o=f}let a=t.length-3;t[2]=1,Me(t,0,a,n),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function at(e,t,n,r){for(let i=0;i<e.length;i++){let o=[];lt(e[i],o,n,r),t.push(o)}}function Fn(e){return e/360+.5}function Pn(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function B(e,t,n,r,i,o,s,a){if(n/=t,r/=t,o>=n&&s<r)return e;if(s<n||o>=r)return null;let l=[];for(let c of e){let f=c.geometry,u=c.type,h=i===0?c.minX:c.minY,p=i===0?c.maxX:c.maxY;if(h>=n&&p<r){l.push(c);continue}else if(p<n||h>=r)continue;let d=[];if(u==="Point"||u==="MultiPoint")Ki(f,d,n,r,i);else if(u==="LineString")In(f,d,n,r,i,!1,a.lineMetrics);else if(u==="MultiLineString")ct(f,d,n,r,i,!1);else if(u==="Polygon")ct(f,d,n,r,i,!0);else if(u==="MultiPolygon")for(let y of f){let w=[];ct(y,w,n,r,i,!0),w.length&&d.push(w)}if(d.length){if(a.lineMetrics&&u==="LineString"){for(let y of d)l.push(k(c.id,u,y,c.tags));continue}(u==="LineString"||u==="MultiLineString")&&(d.length===1?(u="LineString",d=d[0]):u="MultiLineString"),(u==="Point"||u==="MultiPoint")&&(u=d.length===3?"Point":"MultiPoint"),l.push(k(c.id,u,d,c.tags))}}return l.length?l:null}function Ki(e,t,n,r,i){for(let o=0;o<e.length;o+=3){let s=e[o+i];s>=n&&s<=r&&Y(t,e[o],e[o+1],e[o+2])}}function In(e,t,n,r,i,o,s){let a=bn(e),l=i===0?Qi:qi,c=e.start,f,u;for(let S=0;S<e.length-3;S+=3){let v=e[S],m=e[S+1],g=e[S+2],b=e[S+3],I=e[S+4],P=i===0?v:m,_=i===0?b:I,A=!1;s&&(f=Math.sqrt(Math.pow(v-b,2)+Math.pow(m-I,2))),P<n?_>n&&(u=l(a,v,m,b,I,n),s&&(a.start=c+f*u)):P>r?_<r&&(u=l(a,v,m,b,I,r),s&&(a.start=c+f*u)):Y(a,v,m,g),_<n&&P>=n&&(u=l(a,v,m,b,I,n),A=!0),_>r&&P<=r&&(u=l(a,v,m,b,I,r),A=!0),!o&&A&&(s&&(a.end=c+f*u),t.push(a),a=bn(e)),s&&(c+=f)}let h=e.length-3,p=e[h],d=e[h+1],y=e[h+2],w=i===0?p:d;w>=n&&w<=r&&Y(a,p,d,y),h=a.length-3,o&&h>=3&&(a[h]!==a[0]||a[h+1]!==a[1])&&Y(a,a[0],a[1],a[2]),a.length&&t.push(a)}function bn(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ct(e,t,n,r,i,o){for(let s of e)In(s,t,n,r,i,o,!1)}function Y(e,t,n,r){e.push(t,n,r)}function Qi(e,t,n,r,i,o){let s=(o-t)/(r-t);return Y(e,o,n+(i-n)*s,1),s}function qi(e,t,n,r,i,o){let s=(o-n)/(i-n);return Y(e,t+(r-t)*s,o,1),s}function vn(e,t){let n=t.buffer/t.extent,r=e,i=B(e,1,-1-n,n,0,-1,2,t),o=B(e,1,1-n,2+n,0,-1,2,t);return(i||o)&&(r=B(e,1,-n,1+n,0,-1,2,t)||[],i&&(r=Sn(i,1).concat(r)),o&&(r=r.concat(Sn(o,-1)))),r}function Sn(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=i.type,s;switch(o){case"Point":case"MultiPoint":case"LineString":s=ft(i.geometry,t);break;case"MultiLineString":case"Polygon":s=[];for(let a of i.geometry)s.push(ft(a,t));break;case"MultiPolygon":s=[];for(let a of i.geometry){let l=[];for(let c of a)l.push(ft(c,t));s.push(l)}break;default:throw new Error(String(o))}n.push(k(i.id,o,s,i.tags))}return n}function ft(e,t){let n=[];n.size=e.size,e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}var ht={name:"TableTiler",id:"table-tiler",version:"0.0.0",extensions:["mvt"],mimeTypes:["application/octet-stream"],options:{table:{coordinates:"local",promoteId:void 0,maxZoom:14,indexMaxZoom:5,maxPointsPerTile:1e4,tolerance:3,extent:4096,buffer:64,generateId:void 0}},type:"table",testURL:e=>e.endsWith(".geojson"),createDataSource(e,t){let n=typeof e=="string"||e instanceof Blob,r=t?.table?.loaders?.[0],i=n?eo(e,r):e;return new De(i,t)}};async function eo(e,t){if(typeof e=="string"){let i=await(await fetch(e)).arrayBuffer();return await t.parse(i)}let n=await e.arrayBuffer();return await t.parse(n)}var Ve=class{stats=new O({id:"table-tile-source",stats:[new E("tiles","count"),new E("features","count")]});mimeType="application/vnd.mapbox-vector-tile";localCoordinates=!0;props;schema=null;tiles={};tileCoords=[];ready;metadata;constructor(t,n){this.props={...ht.options.table,...n?.table},this.getTileData=this.getTileData.bind(this),this.ready=this.initializeTilesAsync(t),this.metadata=this.getMetadata()}async initializeTilesAsync(t){let n=await t;this.schema=Ne(n),this.createRootTiles(n)}async getMetadata(){return await this.ready,{schema:this.schema,minZoom:0,maxZoom:this.props.maxZoom}}async getSchema(){return await this.ready,this.schema}async getVectorTile(t){await this.ready;let n=this.getTileSync(t);return F.info(2,"getVectorTile",t,n)(),n}async getTile(t){return await this.ready,this.getTileSync(t)}async getTileData(t){let{x:n,y:r,z:i}=t.index;return(await this.getVectorTile({x:n,y:r,z:i}))?.features||[]}getTileSync(t){let n=this.getProtoTile(t);return n?xn(n,{coordinates:this.props.coordinates,tileIndex:t,extent:this.props.extent}):null}createRootTiles(t){if(this.props.maxZoom<0||this.props.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(this.props.promoteId&&this.props.generateId)throw new Error("promoteId and generateId cannot be used together.");F.log(1,"DynamicVectorTileSource creating root tiles",this.props)(),F.time(1,"preprocess table")();let n=Tn(t,this.props);if(F.timeEnd(1,"preprocess table")(),F.time(1,"generate tiles")(),n=vn(n,this.props),n.length===0){F.log(1,"DynamicVectorTileSource: no features generated")();return}this.splitTile(n,0,0,0);let r=this.tiles[0];F.log(1,`root tile features: ${r.numFeatures}, points: ${r.numPoints}`)(),F.timeEnd(1,"generate tiles")(),F.log(1,`DynamicVectorTileSource: tiles generated: ${this.stats.get("total").count}`,this.stats)()}getProtoTile(t){let{z:n,y:r}=t,{x:i}=t,{extent:o}=this.props;if(n<0||n>24)return null;let s=1<<n;i=i+s&s-1;let a=ut(n,i,r);if(this.tiles[a])return st(this.tiles[a],o);F.log(F,"drilling down to z%d-%d-%d",n,i,r)();let l=n,c=i,f=r,u;for(;!u&&l>0;)l--,c=c>>1,f=f>>1,u=this.tiles[ut(l,c,f)];return!u||!u.sourceFeatures?null:(F.log(1,"found parent tile z%d-%d-%d",l,c,f)(),F.time(1,"drilling down")(),this.splitTile(u.sourceFeatures,l,c,f,n,i,r),F.timeEnd(1,"drilling down")(),this.tiles[a]?st(this.tiles[a],o):null)}splitTile(t,n,r,i,o,s,a){let l=[t,n,r,i];for(;l.length;){i=l.pop(),r=l.pop(),n=l.pop(),t=l.pop();let c=1<<n,f=ut(n,r,i),u=this.tiles[f];if(!u){F.time(2,"tile creation")(),u=this.tiles[f]=gn(t,n,r,i,this.props),this.tileCoords.push({z:n,x:r,y:i});let I=`z${n}`,P=this.stats.get(I,"count");P.incrementCount(),P=this.stats.get("total"),P.incrementCount(),P=Ve.stats.get(I,"count"),P.incrementCount(),P=Ve.stats.get("total"),P.incrementCount(),F.log(2,"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,r,i,u.numFeatures,u.numPoints,u.numSimplified)(),F.timeEnd(2,"tile creation")()}if(u.sourceFeatures=t,o===void 0){if(n===this.props.indexMaxZoom||u.numPoints<=this.props.maxPointsPerTile)continue}else{if(n===this.props.maxZoom||n===o)continue;if(o!==void 0){let I=o-n;if(r!==s>>I||i!==a>>I)continue}}if(u.sourceFeatures=null,t.length===0)continue;F.time(2,"clipping tile")();let h=.5*this.props.buffer/this.props.extent,p=.5-h,d=.5+h,y=1+h,w=null,S=null,v=null,m=null,g=B(t,c,r-h,r+d,0,u.minX,u.maxX,this.props),b=B(t,c,r+p,r+y,0,u.minX,u.maxX,this.props);t=null,g&&(w=B(g,c,i-h,i+d,1,u.minY,u.maxY,this.props),S=B(g,c,i+p,i+y,1,u.minY,u.maxY,this.props),g=null),b&&(v=B(b,c,i-h,i+d,1,u.minY,u.maxY,this.props),m=B(b,c,i+p,i+y,1,u.minY,u.maxY,this.props),b=null),F.timeEnd(2,"clipping tile")(),l.push(w||[],n+1,r*2,i*2),l.push(S||[],n+1,r*2,i*2+1),l.push(v||[],n+1,r*2+1,i*2),l.push(m||[],n+1,r*2+1,i*2+1)}}},De=Ve;de(De,"stats",new O({id:"table-tile-source-all",stats:[new E("count","tiles"),new E("count","features")]}));function ut(e,t,n){return((1<<e)*n+t)*32+e}return Vn(ue);})();
7
+ "use strict";var __exports__=(()=>{var _n=Object.create;var X=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Bn=Object.getPrototypeOf,Mn=Object.prototype.hasOwnProperty;var Ln=(e,t,n)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Dn=(e,t)=>{for(var n in t)X(e,n,{get:t[n],enumerable:!0})},he=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of En(t))!Mn.call(e,i)&&i!==n&&X(e,i,{get:()=>t[i],enumerable:!(r=An(t,i))||r.enumerable});return e},pe=(e,t,n)=>(he(e,t,"default"),n&&he(n,t,"default")),pt=(e,t,n)=>(n=e!=null?_n(Bn(e)):{},he(t||!e||!e.__esModule?X(n,"default",{value:e,enumerable:!0}):n,e)),Vn=e=>he(X({},"__esModule",{value:!0}),e);var de=(e,t,n)=>(Ln(e,typeof t!="symbol"?t+"":t,n),n);var mt=ke((no,dt)=>{dt.exports=globalThis.loaders});var Jt=ke(We=>{We.read=function(e,t,n,r,i){var o,s,a=i*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,u=n?i-1:0,h=n?-1:1,p=e[t+u];for(u+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=o*256+e[t+u],u+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=s*256+e[t+u],u+=h,f-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-c}return(p?-1:1)*s*Math.pow(2,o-r)};We.write=function(e,t,n,r,i,o){var s,a,l,c=o*8-i-1,f=(1<<c)-1,u=f>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=h/l:t+=h*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(t*l-1)*Math.pow(2,i),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;e[n+p]=a&255,p+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[n+p]=s&255,p+=d,s/=256,c-=8);e[n+p-d]|=y*128}});var Kt=ke((Ks,Xt)=>{"use strict";Xt.exports=x;var be=Jt();function x(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}x.Varint=0;x.Fixed64=1;x.Bytes=2;x.Fixed32=5;var Ye=(1<<16)*(1<<16),Ht=1/Ye,$r=12,Yt=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),i=r>>3,o=this.pos;this.type=r&7,e(i,t,this),this.pos===o&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ie(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Wt(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ie(this.buf,this.pos)+Ie(this.buf,this.pos+4)*Ye;return this.pos+=8,e},readSFixed64:function(){var e=Ie(this.buf,this.pos)+Wt(this.buf,this.pos+4)*Ye;return this.pos+=8,e},readFloat:function(){var e=be.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=be.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,Jr(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=$r&&Yt?oi(this.buf,t,e):ii(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==x.Bytes)return e.push(this.readVarint(t));var n=D(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==x.Bytes)return e.push(this.readBoolean());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==x.Bytes)return e.push(this.readFloat());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==x.Bytes)return e.push(this.readDouble());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed32());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed32());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readFixed64());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==x.Bytes)return e.push(this.readSFixed64());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===x.Varint)for(;this.buf[this.pos++]>127;);else if(t===x.Bytes)this.pos=this.readVarint()+this.pos;else if(t===x.Fixed32)this.pos+=4;else if(t===x.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),W(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),W(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),W(this.buf,e&-1,this.pos),W(this.buf,Math.floor(e*Ht),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),W(this.buf,e&-1,this.pos),W(this.buf,Math.floor(e*Ht),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Hr(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=si(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Zt(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),be.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),be.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&Zt(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,x.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,Yr,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Xr,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,qr,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Kr,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Qr,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ei,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,ti,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,ni,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,ri,t)},writeBytesField:function(e,t){this.writeTag(e,x.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,x.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,x.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,x.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,x.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,x.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,x.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function Jr(e,t,n){var r=n.buf,i,o;if(o=r[n.pos++],i=(o&112)>>4,o<128||(o=r[n.pos++],i|=(o&127)<<3,o<128)||(o=r[n.pos++],i|=(o&127)<<10,o<128)||(o=r[n.pos++],i|=(o&127)<<17,o<128)||(o=r[n.pos++],i|=(o&127)<<24,o<128)||(o=r[n.pos++],i|=(o&1)<<31,o<128))return Z(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function D(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function Z(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Hr(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),Zr(n,r,t),Wr(r,t)}function Zr(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function Wr(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Zt(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var i=n.pos-1;i>=e;i--)n.buf[i+r]=n.buf[i]}function Yr(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function Xr(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function Kr(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function Qr(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function qr(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function ei(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function ti(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function ni(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function ri(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Ie(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function W(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Wt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function ii(e,t,n){for(var r="",i=t;i<n;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a>n)break;var l,c,f;a===1?o<128&&(s=o):a===2?(l=e[i+1],(l&192)===128&&(s=(o&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[i+1],c=e[i+2],(l&192)===128&&(c&192)===128&&(s=(o&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[i+1],c=e[i+2],f=e[i+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(o&15)<<18|(l&63)<<12|(c&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,r+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),r+=String.fromCharCode(s),i+=a}return r}function oi(e,t,n){return Yt.decode(e.subarray(t,n))}function si(e,t,n){for(var r=0,i,o;r<t.length;r++){if(i=t.charCodeAt(r),i>55295&&i<57344)if(o)if(i<56320){e[n++]=239,e[n++]=191,e[n++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):o=i;continue}else o&&(e[n++]=239,e[n++]=191,e[n++]=189,o=null);i<128?e[n++]=i:(i<2048?e[n++]=i>>6|192:(i<65536?e[n++]=i>>12|224:(e[n++]=i>>18|240,e[n++]=i>>12&63|128),e[n++]=i>>6&63|128),e[n++]=i&63|128)}return n}});var ue={};Dn(ue,{MVTLoader:()=>ve,MVTSource:()=>mn,MVTWorkerLoader:()=>qe,TableTileSource:()=>ht,TileJSONLoader:()=>z});pe(ue,pt(mt(),1));function gt(e){let t=[];if(e.fields)for(let n of e.fields)t.push({name:n.name,type:Cn(n),metadata:Nn(n)});return{metadata:kn(e),fields:t}}function kn(e){let t={};for(let[n,r]of Object.entries(e))n!=="fields"&&r&&(t[n]=JSON.stringify(r));return t}function Cn(e){switch(e.type.toLowerCase()){case"float32":return"float32";case"number":case"float64":return"float64";case"string":case"utf8":return"utf8";case"boolean":return"bool";default:return"null"}}function Nn(e){let t={};for(let[n,r]of Object.entries(e))n!=="name"&&r&&(t[n]=JSON.stringify(r));return t}var Tt=e=>e!==null&&typeof e=="object";function Ce(e,t){if(!e||!Tt(e))return null;let n={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(n.generator=e.generator),typeof e.generator_options=="string"&&(n.generatorOptions=e.generator_options),n.boundingBox=yt(e.bounds)||yt(e.antimeridian_adjusted_bounds),n.center=zn(e.center),n.maxZoom=xt(e.maxzoom),n.minZoom=xt(e.minzoom),typeof e?.json=="string")try{n.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let r=e.tilestats||n.metaJson?.tilestats,i=On(r,t),o=Un(e.vector_layers),s=Rn(o,i);return n={...n,layers:s},n.maxZoom===null&&s.length>0&&(n.maxZoom=s[0].maxZoom||null),n.minZoom===null&&s.length>0&&(n.minZoom=s[0].minZoom||null),n}function Un(e){return Array.isArray(e)?e.map(t=>Gn(t)):[]}function Gn(e){let t=Object.entries(e.fields||[]).map(([r,i])=>({name:r,...It(String(i))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function On(e,t){return Tt(e)&&Array.isArray(e.layers)?e.layers.map(n=>jn(n,t)):[]}function jn(e,t){let n=[],r={},i=e.attributes||[];for(let o of i){let s=o.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];r[a]=r[a]||[],r[a].push(o),console.warn("ignoring tilestats indexed field",a)}else n[s]||n.push(Jn(o,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function Rn(e,t){return e.map(n=>{let r=t.find(s=>s.name===n.name),i=r?.fields||n.fields||[],o={...n,...r,fields:i};return o.schema=gt(o),o})}function yt(e){let t=bt(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(Pt)&&[t[1],t[3]].every(Ft))return[[t[0],t[1]],[t[2],t[3]]]}function zn(e){let t=bt(e);return Array.isArray(t)&&t.length===3&&Pt(t[0])&&Ft(t[1])&&$n(t[2])?t:null}function xt(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function Ft(e){return Number.isFinite(e)&&e<=90&&e>=-90}function Pt(e){return Number.isFinite(e)&&e<=180&&e>=-180}function $n(e){return Number.isFinite(e)&&e>=0&&e<=22}function bt(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var wt={number:{type:"float32"},numeric:{type:"float32"},string:{type:"utf8"},vachar:{type:"utf8"},float:{type:"float32"},int:{type:"int32"},int4:{type:"int32"},boolean:{type:"boolean"},bool:{type:"boolean"}};function Jn(e={},t){let n=It(e.type),r={name:e.attribute,...n};return typeof e.min=="number"&&(r.min=e.min),typeof e.max=="number"&&(r.max=e.max),typeof e.count=="number"&&(r.uniqueValueCount=e.count),e.values&&(r.values=e.values),r.values&&typeof t.maxValues=="number"&&(r.values=r.values?.slice(0,t.maxValues)),r}function It(e){let t=e.toLowerCase();return!t||wt[t],wt[t]||{type:"string"}}var Hn="4.3.1",z={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Hn,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),r=JSON.parse(n),i={...z.options.tilejson,...t?.tilejson};return Ce(r,i)},parseTextSync:(e,t)=>{let n=JSON.parse(e),r={...z.options.tilejson,...t?.tilejson};return Ce(n,r)}};function me(e,t="float32"){return e instanceof Date?"date-millisecond":e instanceof Number?t:typeof e=="string"?"utf8":(e===null||e==="undefined","null")}function St(e){let t=Zn(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=me(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function Zn(e){switch(e.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 Ne(e){switch(e.shape){case"array-row-table":case"object-row-table":return Yn(e.data);case"geojson-table":return Xn(e.features);case"columnar-table":return Wn(e.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Wn(e){let t=[];for(let[n,r]of Object.entries(e)){let i=Kn(r,n);t.push(i)}return{fields:t,metadata:{}}}function Yn(e){if(!e.length)throw new Error("deduce from empty table");let t=[],n=e[0];for(let[r,i]of Object.entries(n))t.push(vt(i,r));return{fields:t,metadata:{}}}function Xn(e){if(!e.length)throw new Error("deduce from empty table");let t=[],n=e[0].properties||{};for(let[r,i]of Object.entries(n))t.push(vt(i,r));return{fields:t,metadata:{}}}function Kn(e,t){if(ArrayBuffer.isView(e)){let n=St(e);return{name:t,type:n.type||"null",nullable:n.nullable}}if(Array.isArray(e)&&e.length>0){let n=e[0],r=me(n);return{name:t,type:r,nullable:!0}}throw new Error("empty table")}function vt(e,t){let n=me(e);return{name:t,type:n,nullable:!0}}var K={x:0,y:1,z:2};function C(e,t={}){let{start:n=0,end:r=e.length,plane:i="xy"}=t,o=t.size||2,s=0,a=K[i[0]],l=K[i[1]];for(let c=n,f=r-o;c<r;c+=o)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function Ge(e,t,n=2,r,i="xy"){let o=t&&t.length,s=o?t[0]*n:e.length,a=At(e,0,s,n,!0,r&&r[0],i),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,p,d,y;if(o&&(a=ir(e,t,a,n,r,i)),e.length>80*n){h=f=e[0],p=u=e[1];for(let w=n;w<s;w+=n)d=e[w],y=e[w+1],d<h&&(h=d),y<p&&(p=y),d>f&&(f=d),y>u&&(u=y);c=Math.max(f-h,u-p),c=c!==0?32767/c:0}return Q(a,l,n,h,p,c,0),l}function At(e,t,n,r,i,o,s){let a,l;o===void 0&&(o=C(e,{start:t,end:n,size:r,plane:s}));let c=K[s[0]],f=K[s[1]];if(i===o<0)for(a=t;a<n;a+=r)l=_t(a,e[a+c],e[a+f],l);else for(a=n-r;a>=t;a-=r)l=_t(a,e[a+c],e[a+f],l);return l&&xe(l,l.next)&&(ee(l),l=l.next),l}function N(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(xe(n,n.next)||T(n.prev,n,n.next)===0)){if(ee(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Q(e,t,n,r,i,o,s){if(!e)return;!s&&o&&cr(e,r,i,o);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,o?tr(e,r,i,o):er(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(c.i/n|0),ee(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=nr(N(e),t,n),Q(e,t,n,r,i,o,2)):s===2&&rr(e,t,n,r,i,o):Q(N(e),t,n,r,i,o,1);break}}}function er(e){let t=e.prev,n=e,r=e.next;if(T(t,n,r)>=0)return!1;let i=t.x,o=n.x,s=r.x,a=t.y,l=n.y,c=r.y,f=i<o?i<s?i:s:o<s?o:s,u=a<l?a<c?a:c:l<c?l:c,h=i>o?i>s?i:s:o>s?o:s,p=a>l?a>c?a:c:l>c?l:c,d=r.next;for(;d!==t;){if(d.x>=f&&d.x<=h&&d.y>=u&&d.y<=p&&$(i,a,o,l,s,c,d.x,d.y)&&T(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function tr(e,t,n,r){let i=e.prev,o=e,s=e.next;if(T(i,o,s)>=0)return!1;let a=i.x,l=o.x,c=s.x,f=i.y,u=o.y,h=s.y,p=a<l?a<c?a:c:l<c?l:c,d=f<u?f<h?f:h:u<h?u:h,y=a>l?a>c?a:c:l>c?l:c,w=f>u?f>h?f:h:u>h?u:h,S=Ue(p,d,t,n,r),v=Ue(y,w,t,n,r),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=S&&g&&g.z<=v;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=w&&m!==i&&m!==s&&$(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=p&&g.x<=y&&g.y>=d&&g.y<=w&&g!==i&&g!==s&&$(a,f,l,u,c,h,g.x,g.y)&&T(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;m&&m.z>=S;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=w&&m!==i&&m!==s&&$(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=v;){if(g.x>=p&&g.x<=y&&g.y>=d&&g.y<=w&&g!==i&&g!==s&&$(a,f,l,u,c,h,g.x,g.y)&&T(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function nr(e,t,n){let r=e;do{let i=r.prev,o=r.next.next;!xe(i,o)&&Et(i,r,r.next,o)&&q(i,o)&&q(o,i)&&(t.push(i.i/n|0),t.push(r.i/n|0),t.push(o.i/n|0),ee(r),ee(r.next),r=e=o),r=r.next}while(r!==e);return N(r)}function rr(e,t,n,r,i,o){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&hr(s,a)){let l=Bt(s,a);s=N(s,s.next),l=N(l,l.next),Q(s,t,n,r,i,o,0),Q(l,t,n,r,i,o,0);return}a=a.next}s=s.next}while(s!==e)}function ir(e,t,n,r,i,o){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*r,f=a<l-1?t[a+1]*r:e.length,u=At(e,c,f,r,!1,i&&i[a+1],o),u===u.next&&(u.steiner=!0),s.push(ur(u));for(s.sort(or),a=0;a<s.length;a++)n=sr(s[a],n);return n}function or(e,t){return e.x-t.x}function sr(e,t){let n=ar(e,t);if(!n)return t;let r=Bt(n,e);return N(r,r.next),N(n,n.next)}function ar(e,t){let n=t,r=e.x,i=e.y,o=-1/0,s;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let h=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>o&&(o=h,s=n.x<n.next.x?n:n.next,h===r))return s}n=n.next}while(n!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;n=s;do r>=n.x&&n.x>=l&&r!==n.x&&$(i<c?r:o,i,l,c,i<c?o:r,i,n.x,n.y)&&(u=Math.abs(i-n.y)/(r-n.x),q(n,e)&&(u<f||u===f&&(n.x>s.x||n.x===s.x&&lr(s,n)))&&(s=n,f=u)),n=n.next;while(n!==a);return s}function lr(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function cr(e,t,n,r){let i=e;do i.z===0&&(i.z=Ue(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,fr(i)}function fr(e){let t,n,r=1,i,o,s,a,l,c;do{for(o=e,e=null,c=null,i=0;o;){for(i++,a=o,s=0,n=0;n<r&&(s++,a=a.nextZ,!!a);n++);for(l=r;s>0||l>0&&a;)s!==0&&(l===0||!a||o.z<=a.z)?(t=o,o=o.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;o=a}c.nextZ=null,r*=2}while(i>1);return e}function Ue(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function ur(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function $(e,t,n,r,i,o,s,a){return(i-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(r-a)>=(n-s)*(t-a)&&(n-s)*(o-a)>=(i-s)*(r-a)}function hr(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!pr(e,t)&&(q(e,t)&&q(t,e)&&dr(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||xe(e,t)&&T(e.prev,e,e.next)>0&&T(t.prev,t,t.next)>0)}function T(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function xe(e,t){return e.x===t.x&&e.y===t.y}function Et(e,t,n,r){let i=ye(T(e,t,n)),o=ye(T(e,t,r)),s=ye(T(n,r,e)),a=ye(T(n,r,t));return!!(i!==o&&s!==a||i===0&&ge(e,n,t)||o===0&&ge(e,r,t)||s===0&&ge(n,e,r)||a===0&&ge(n,t,r))}function ge(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ye(e){return e>0?1:e<0?-1:0}function pr(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Et(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function q(e,t){return T(e.prev,e,e.next)<0?T(e,t,e.next)>=0&&T(e,e.prev,t)>=0:T(e,t,e.prev)<0||T(e,e.next,t)<0}function dr(e,t){let n=e,r=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Bt(e,t){let n=new te(e.i,e.x,e.y),r=new te(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function _t(e,t,n,r){let i=new te(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ee(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var te=class{constructor(t,n,r){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=n,this.y=r}};function Re(e,t,n){let r=wr(e),i=Object.keys(r).filter(o=>r[o]!==Array);return Tr(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||i,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function wr(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let i=n.properties[r];t[r]=vr(i,t[r])}return t}function Tr(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:i,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:p}=t,{numericPropKeys:d=[],PositionDataType:y=Float32Array,triangulate:w=!0}=n,S=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(r*p),globalFeatureIds:new v(r),featureIds:i>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(o*p),globalFeatureIds:new v(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},b={type:"Polygon",polygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),primitivePolygonIndices:l>65535?new Uint32Array(f+1):new Uint16Array(f+1),positions:new y(l*p),globalFeatureIds:new v(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};w&&(b.triangles=[]);for(let P of[m,g,b])for(let _ of d){let A=h[_];P.numericProps[_]=new A(P.positions.length/p)}g.pathIndices[s]=o,b.polygonIndices[c]=l,b.primitivePolygonIndices[f]=l;let I={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let P of e){let _=P.geometry,A=P.properties||{};switch(_.type){case"Point":Fr(_,m,I,p,A),m.properties.push(je(A,d)),S&&m.fields.push({id:P.id}),I.pointFeature++;break;case"LineString":Pr(_,g,I,p,A),g.properties.push(je(A,d)),S&&g.fields.push({id:P.id}),I.lineFeature++;break;case"Polygon":br(_,b,I,p,A),b.properties.push(je(A,d)),S&&b.fields.push({id:P.id}),I.polygonFeature++;break;default:throw new Error("Invalid geometry type")}I.feature++}return Sr(m,g,b,p)}function Fr(e,t,n,r,i){t.positions.set(e.data,n.pointPosition*r);let o=e.data.length/r;ze(t,i,n.pointPosition,o),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+o),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+o),n.pointPosition+=o}function Pr(e,t,n,r,i){t.positions.set(e.data,n.linePosition*r);let o=e.data.length/r;ze(t,i,n.linePosition,o),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+o),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(c-l)/r}}function br(e,t,n,r,i){t.positions.set(e.data,n.polygonPosition*r);let o=e.data.length/r;ze(t,i,n.polygonPosition,o),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+o),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=n.polygonPosition;t.polygonIndices[n.polygonObject++]=l;let c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let p=0,d=f.length;p<d;++p){let y=f[p],w=p===d-1?u===void 0?e.data.length:u[0]:f[p+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(w-y)/r}let h=n.polygonPosition;Ir(t,c,f,{startPosition:l,endPosition:h,coordLength:r})}}function Ir(e,t,n,{startPosition:r,endPosition:i,coordLength:o}){if(!e.triangles)return;let s=r*o,a=i*o,l=e.positions.subarray(s,a),c=n[0],f=n.slice(1).map(h=>(h-c)/o),u=Ge(l,f,o,t);for(let h=0,p=u.length;h<p;++h)e.triangles.push(r+u[h])}function Oe(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function Sr(e,t,n,r){let i={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Oe(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Oe(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:Oe(n.numericProps,1)}};return i.polygons&&n.triangles&&(i.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),i}function ze(e,t,n,r){for(let i in e.numericProps)if(i in t){let o=t[i];e.numericProps[i].fill(o,n,n+r)}}function je(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function vr(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function ne(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var M={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},_r=M.self||M.window||M.global||{},Ar=M.window||M.self||M.global||{},Er=M.global||M.self||M.window||{},Br=M.document||{};var $e=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Dt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Mr=Dt&&parseFloat(Dt[1])||0;var we=globalThis,Lr=globalThis.document||{},Te=globalThis.process||{},Dr=globalThis.console,qo=globalThis.navigator||{};function Vt(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,n=e||t;return Boolean(n&&n.indexOf("Electron")>=0)}function U(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Vt()}var Je="4.0.7";function kr(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Fe=class{constructor(t,n,r="sessionStorage"){this.storage=kr(r),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function kt(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function Ct(e,t=8){let n=Math.max(t-e.length,0);return`${" ".repeat(n)}${e}`}var Pe;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Pe||(Pe={}));var Cr=10;function Nt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Pe[e]||Pe.WHITE)}function Ut(e,t,n){return!U&&typeof e=="string"&&(t&&(e=`\x1B[${Nt(t)}m${e}\x1B[39m`),n&&(e=`\x1B[${Nt(n)+Cr}m${e}\x1B[49m`)),e}function Gt(e,t=["constructor"]){let n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),i=e;for(let o of r){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}function re(e,t){if(!e)throw new Error(t||"Assertion failed")}function G(){let e;if(U()&&we.performance)e=we?.performance?.now?.();else if("hrtime"in Te){let t=Te?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var J={debug:U()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Nr={enabled:!0,level:0};function H(){}var Ot={},jt={once:!0},V=class{constructor({id:t}={id:""}){this.VERSION=Je,this._startTs=G(),this._deltaTs=G(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Fe(`__probe-${this.id}__`,Nr),this.timeStamp(`${this.id} started`),Gt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((G()-this._startTs).toPrecision(10))}getDelta(){return Number((G()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){if(!t)throw new Error(n||"Assertion failed")}warn(t){return this._getLogFunction(0,t,J.warn,arguments,jt)}error(t){return this._getLogFunction(0,t,J.error,arguments)}deprecated(t,n){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${n}\` instead`)}removed(t,n){return this.error(`\`${t}\` has been removed. Use \`${n}\` instead`)}probe(t,n){return this._getLogFunction(t,n,J.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,J.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,J.debug||J.info,arguments,jt)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||H,r&&[r],{tag:Gr(n)}):H}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||H)}group(t,n,r={collapsed:!1}){let i=Rt({logLevel:t,message:n,opts:r}),{collapsed:o}=r;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,n,r={}){return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||H)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=zt(t)}_getLogFunction(t,n,r,i,o){if(this._shouldLog(t)){o=Rt({logLevel:t,message:n,args:i,opts:o}),r=r||o.method,re(r),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=G();let s=o.tag||o.message;if(o.once&&s)if(!Ot[s])Ot[s]=G();else return H;return n=Ur(this.id,o.message,o),r.bind(console,n,...o.args)}return H}};V.VERSION=Je;function zt(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return re(Number.isFinite(t)&&t>=0),t}function Rt(e){let{logLevel:t,message:n}=e;e.logLevel=zt(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return re(i==="string"||i==="object"),Object.assign(e,{args:r},e.opts)}function Ur(e,t,n){if(typeof t=="string"){let r=n.time?Ct(kt(n.total)):"";t=n.time?`${e}: ${r} ${t}`:`${e}: ${t}`,t=Ut(t,n.color,n.background)}return t}function Gr(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}globalThis.probe={};var Is=new V({id:"@probe.gl/log"});var He="4.3.1",Or=He[0]>="0"&&He[0]<="9"?`v${He}`:"";function jr(){let e=new V({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=Or,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var F=jr();function ie(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var E=class{constructor(t,n){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=n,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=ie(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(ie()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var O=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,n="count"){return this._getOrCreate({name:t,type:n})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let n of Object.values(this.stats))t(n)}getTable(){let t={};return this.forEach(n=>{t[n.name]={time:n.time||0,count:n.count||0,average:n.getAverageTime()||0,hz:n.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(n=>this._getOrCreate(n))}_getOrCreate(t){let{name:n,type:r}=t,i=this.stats[n];return i||(t instanceof E?i=t:i=new E(n,r),this.stats[n]=i),i}};var Rr="",$t={};function Ze(e){for(let t in $t)if(e.startsWith(t)){let n=$t[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Rr}${e}`),e}var oe=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=zr(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function zr(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,i)=>t(r,i);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var Ke=pt(Kt(),1);function ai(e){let t=0;for(let n=0,r=e.length-1,i,o;n<e.length;r=n++)i=e[n],o=e[r],t+=(o[0]-i[0])*(i[1]+o[1]);return t}function se(e,t){if(Array.isArray(e[0])){for(let r of e)se(r,t);return}let n=e;n[0]/=t,n[1]/=t}function Qt(e,t){for(let n=0;n<e.length;++n)e[n]/=t}function ae(e,t,n){if(typeof e[0][0]!="number"){for(let s of e)ae(s,t,n);return}let r=n*Math.pow(2,t.z),i=n*t.x,o=n*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+i)*360/r-180;let l=180-(a[1]+o)*360/r;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function qt(e,t,n){let{x:r,y:i,z:o}=t,s=n*Math.pow(2,o),a=n*r,l=n*i;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function en(e){let t=e.length;if(t<=1)return[e];let n=[],r,i;for(let o=0;o<t;o++){let s=ai(e[o]);s!==0&&(i===void 0&&(i=s<0),i===s<0?(r&&n.push(r),r=[e[o]]):r&&r.push(e[o]))}return r&&n.push(r),n}function tn(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[C(e.data)]],indices:[e.indices]};let r=[],i=[],o=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),p=C(h);if(p===0){let d=e.data.slice(0,u),y=e.data.slice(c);e.data=d.concat(y),l+=c-u;continue}a===void 0&&(a=p<0),a===p<0?(s.length&&(r.push(o),i.push(s)),s=[u],o=[p]):(o.push(p),s.push(u))}return o&&r.push(o),s.length&&i.push(s),{type:n,areas:r,indices:i,data:e.data}}var j=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,i,o,s){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=i,this._values=o,this._geometryInfo=s,t.readFields(li,this,n)}toGeoJSONFeature(t,n){let r=this.loadGeometry();switch(t){case"wgs84":return nn(this,r,i=>ae(i,n,this.extent));default:return nn(this,r,se)}}toBinaryFeature(t,n){let r=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(r,i=>qt(i,n,this.extent));default:return this._toBinaryCoordinates(r,Qt)}}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<n;){if(i<=0){let u=t.readVarint();r=u&7,i=u>>3}if(i--,r===1||r===2)o+=t.readSVarint(),s+=t.readSVarint(),o<a&&(a=o),o>l&&(l=o),s<c&&(c=s),s>f&&(f=s);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,c,l,f]}_toBinaryCoordinates(t,n){let r;n(t.data,this.extent);let i=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,r={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/i,r={type:"LineString",...t};break;case 3:r=tn(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let s of r.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=r.data.length/i;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(o.id=this.id),o}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,i=0,o=0,s=0,a=[],l;for(;t.pos<n;){if(i<=0){let c=t.readVarint();r=c&7,i=c>>3}switch(i--,r){case 1:case 2:o+=t.readSVarint(),s+=t.readSVarint(),r===1&&(l&&a.push(l),l=[]),l&&l.push([o,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${r}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,i,o=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<n;)if(o<=0&&(i=t.readVarint(),r=i&7,o=i>>3),o--,r===1||r===2)s+=t.readSVarint(),a+=t.readSVarint(),r===1&&c.push(l),f.push(s,a),l+=2;else if(r===7){if(l>0){let u=c[c.length-1];f.push(f[u],f[u+1]),l+=2}}else throw new Error(`unknown command ${r}`);return{data:f,indices:c}}};de(j,"types",["Unknown","Point","LineString","Polygon"]);function nn(e,t,n){let r=j.types[e.type],i,o,s;switch(e.type){case 1:let l=[];for(i=0;i<t.length;i++)l[i]=t[i][0];s=l,n(s,e.extent);break;case 2:for(s=t,i=0;i<s.length;i++)n(s[i],e.extent);break;case 3:for(s=en(t),i=0;i<s.length;i++)for(o=0;o<s[i].length;o++)n(s[i][o],e.extent);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:r=`Multi${r}`;let a={type:"Feature",geometry:{type:r,coordinates:s},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function li(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?ci(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function ci(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[r]=i}}var Se=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(fi,this,n),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new j(this._pbf,n,this.extent,this._keys,this._values)}getBinaryFeature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new j(this._pbf,r,this.extent,this._keys,this._values,n)}};function fi(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(ui(n)))}function ui(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var le=class{layers;constructor(t,n){this.layers=t.readFields(hi,{},n)}};function hi(e,t,n){if(e===3&&n){let r=new Se(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function Qe(e,t){let n=di(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:Xe(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:rn(e,n)};case"geojson":return rn(e,n);case"binary-geometry":return Xe(e,n);case"binary":return Xe(e,n);default:throw new Error(r||"undefined shape")}}function Xe(e,t){let[n,r]=pi(e,t),i=Re(n,r);return i.byteLength=e.byteLength,i}function pi(e,t){let n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,r];let i=new le(new Ke.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(i.layers)).forEach(s=>{let a=i.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,r),f=gi(c,t,s);n.push(f)}}),[n,r]}function rn(e,t){if(e.byteLength<=0)return[];let n=[],r=new le(new Ke.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(o=>{let s=r.layers[o];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=mi(l,t,o);n.push(c)}}),n}function di(e){if(!e?.mvt)throw new Error("mvt options required");if(e.mvt?.coordinates==="wgs84"&&!e.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.gis&&F.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function mi(e,t,n){let r=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(r.properties||={},r.properties[t.layerProperty]=n),r}function gi(e,t,n){let r=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}var yi="4.3.1",qe={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:yi,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},ve={...qe,parse:async(e,t)=>Qe(e,t),parseSync:Qe,binary:!0};var on="4.3.1";var xi=globalThis.loaders?.parseImageNode,et=typeof Image<"u",tt=typeof ImageBitmap<"u",wi=Boolean(xi),nt=$e?!0:wi;function sn(e){switch(e){case"auto":return tt||et||nt;case"imagebitmap":return tt;case"image":return et;case"data":return nt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function an(){if(tt)return"imagebitmap";if(et)return"image";if(nt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Ti(e){let t=Fi(e);if(!t)throw new Error("Not an image");return t}function ln(e){switch(Ti(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Fi(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var Pi=/^data:image\/svg\+xml/,bi=/\.svg((\?|#).*)?$/;function _e(e){return e&&(Pi.test(e)||bi.test(e))}function cn(e,t){if(_e(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return rt(e,t)}function rt(e,t){if(_e(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ae(e,t,n){let r=cn(e,n),i=self.URL||self.webkitURL,o=typeof r!="string"&&i.createObjectURL(r);try{return await Ii(o||r,t)}finally{o&&i.revokeObjectURL(o)}}async function Ii(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,i)=>{try{n.onload=()=>r(n),n.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var Si={},fn=!0;async function un(e,t,n){let r;_e(n)?r=await Ae(e,t,n):r=rt(e,n);let i=t&&t.imagebitmap;return await vi(r,i)}async function vi(e,t=null){if((_i(t)||!fn)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),fn=!1}return await createImageBitmap(e)}function _i(e){for(let t in e||Si)return!1;return!0}function hn(e){return!Mi(e,"ftyp",4)||!(e[8]&96)?null:Ai(e)}function Ai(e){switch(Ei(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Ei(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Bi(e){return[...e].map(t=>t.charCodeAt(0))}function Mi(e,t,n=0){let r=Bi(t);for(let i=0;i<r.length;++i)if(r[i]!==e[i+n])return!1;return!0}var L=!1,ce=!0;function R(e){let t=fe(e);return Di(t)||Ci(t)||Vi(t)||ki(t)||Li(t)}function Li(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=hn(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function Di(e){let t=fe(e);return t.byteLength>=24&&t.getUint32(0,L)===2303741511?{mimeType:"image/png",width:t.getUint32(16,L),height:t.getUint32(20,L)}:null}function Vi(e){let t=fe(e);return t.byteLength>=10&&t.getUint32(0,L)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,ce),height:t.getUint16(8,ce)}:null}function ki(e){let t=fe(e);return t.byteLength>=14&&t.getUint16(0,L)===16973&&t.getUint32(2,ce)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,ce),height:t.getUint32(22,ce)}:null}function Ci(e){let t=fe(e);if(!(t.byteLength>=3&&t.getUint16(0,L)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:i}=Ni(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,L);if(i.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,L),width:t.getUint16(o+7,L)};if(!r.has(s))return null;o+=2,o+=t.getUint16(o,L)}return null}function Ni(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function fe(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function pn(e,t){let{mimeType:n}=R(e)||{},r=globalThis.loaders?.parseImageNode;return ne(r),await r(e,n)}async function dn(e,t,n){t=t||{};let i=(t.image||{}).type||"auto",{url:o}=n||{},s=Ui(i),a;switch(s){case"imagebitmap":a=await un(e,t,o);break;case"image":a=await Ae(e,t,o);break;case"data":a=await pn(e,t);break;default:ne(!1)}return i==="data"&&(a=ln(a)),a}function Ui(e){switch(e){case"auto":case"data":return an();default:return sn(e),e}}var Gi=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Oi=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],ji={image:{type:"auto",decode:!0}},it={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:on,mimeTypes:Oi,extensions:Gi,parse:dn,tests:[e=>Boolean(R(new DataView(e)))],options:ji};var mn={name:"MVT",id:"mvt",module:"mvt",version:"0.0.0",extensions:["mvt"],mimeTypes:["application/octet-stream"],options:{mvt:{}},type:"mvt",fromUrl:!0,fromBlob:!1,testURL:e=>!0,createDataSource(e,t){return new ot(e,t)}},ot=class extends oe{props;url;metadataUrl=null;data;schema="tms";metadata;extension;mimeType=null;constructor(t,n){super(n),this.props=n,this.url=Ze(t),this.metadataUrl=n.mvt?.metadataUrl||`${this.url}/tilejson.json`,this.extension=n.mvt?.extension||".png",this.data=this.url,this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata(),Ri(this.url)&&(this.schema="template")}async getMetadata(){if(!this.metadataUrl)return null;let t;try{t=await this.fetch(this.metadataUrl)}catch(i){return console.error(i.message),null}if(!t.ok)return console.error(t.statusText),null;let n=await t.text();return z.parseTextSync?.(n)||null}getTileMIMEType(){return this.mimeType}async getTile(t){let{x:n,y:r,z:i}=t,o=this.getTileURL(n,r,i),s=await this.fetch(o);return s.ok?await s.arrayBuffer():null}async getTileData(t){let{x:n,y:r,z:i}=t.index,o=await this.getTile({x:n,y:r,z:i,layers:[]});if(o===null)return null;let s=R(o);switch(this.mimeType=this.mimeType||s?.mimeType||"application/vnd.mapbox-vector-tile",this.mimeType){case"application/vnd.mapbox-vector-tile":return await this._parseVectorTile(o,{x:n,y:r,z:i,layers:[]});default:return await this._parseImageTile(o)}}async getImageTile(t){let n=await this.getTile(t);return n?this._parseImageTile(n):null}async _parseImageTile(t){return await it.parse(t,this.loadOptions)}async getVectorTile(t){let n=await this.getTile(t);return n?this._parseVectorTile(n,t):null}async _parseVectorTile(t,n){let r={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:n.x,y:n.y,z:n.z},...this.loadOptions?.mvt},...this.loadOptions};return await ve.parse(t,r)}getMetadataUrl(){return this.metadataUrl}getTileURL(t,n,r){switch(this.schema){case"xyz":return`${this.url}/${t}/${n}/${r}${this.extension}`;case"tms":return`${this.url}/${r}/${t}/${n}${this.extension}`;case"template":return Hi(this.url,t,n,r,"0");default:throw new Error(this.schema)}}};function Ri(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(e)}var zi=new RegExp("{x}","g"),$i=new RegExp("{y}","g"),Ji=new RegExp("{z}","g");function Hi(e,t,n,r,i="0"){if(Array.isArray(e)){let s=Zi(i)%e.length;e=e[s]}let o=e;return o=o.replace(zi,String(t)),o=o.replace($i,String(n)),o=o.replace(Ji,String(r)),Number.isInteger(n)&&Number.isInteger(r)&&(o=o.replace(/\{-y\}/g,String(Math.pow(2,r)-n-1))),o}function Zi(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function gn(e,t,n,r,i){let o=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),s={protoFeatures:[],sourceFeatures:null,numPoints:0,numSimplified:0,numFeatures:e.length,x:n,y:r,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let a of e)Wi(s,a,o,i);return s}function Wi(e,t,n,r){let i=t.geometry,o=t.type,s=[];e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY);let a;switch(o){case"Point":case"MultiPoint":a=1;for(let l=0;l<i.length;l+=3)s.push(i[l],i[l+1]),e.numPoints++,e.numSimplified++;break;case"LineString":a=2,Ee(s,i,e,n,!1,!1);break;case"MultiLineString":a=2;for(let l=0;l<i.length;l++)Ee(s,i[l],e,n,!1,l===0);break;case"Polygon":a=3;for(let l=0;l<i.length;l++)Ee(s,i[l],e,n,!0,l===0);break;case"MultiPolygon":a=3;for(let l=0;l<i.length;l++){let c=i[l];for(let f=0;f<c.length;f++)Ee(s,c[f],e,n,!0,f===0)}break;default:throw new Error(`Unknown geometry type: ${o}`)}if(s.length){let l=t.tags||null;if(o==="LineString"&&r.lineMetrics){l={};for(let f in t.tags)l[f]=t.tags[f];l.mapbox_clip_start=i.start/i.size,l.mapbox_clip_end=i.end/i.size}let c={geometry:s,simplifiedType:a,tags:l};t.id!==null&&(c.id=t.id),e.protoFeatures.push(c)}}function Ee(e,t,n,r,i,o){let s=r*r;if(r>0&&t.size<(i?s:r)){n.numPoints+=t.length/3;return}let a=[];for(let l=0;l<t.length;l+=3)(r===0||t[l+2]>s)&&(n.numSimplified++,a.push(t[l],t[l+1])),n.numPoints++;i&&Yi(a,o),e.push(a)}function Yi(e,t){let n=0;for(let r=0,i=e.length-2;r<e.length;i=r,r+=2)n+=(e[r]-e[i])*(e[r+1]+e[i+1]);if(n>0===t)for(let r=0,i=e.length;r<i/2;r+=2){let o=e[r],s=e[r+1];e[r]=e[i-2-r],e[r+1]=e[i-1-r],e[i-2-r]=o,e[i-1-r]=s}}function st(e,t){if(e.transformed)return e;let n=1<<e.z,r=e.x,i=e.y;for(let o of e.protoFeatures){let s=o.geometry,a=o.simplifiedType;if(o.geometry=[],a===1)for(let l=0;l<s.length;l+=2)o.geometry.push(yn(s[l],s[l+1],t,n,r,i));else for(let l=0;l<s.length;l++){let c=[];for(let f=0;f<s[l].length;f+=2)c.push(yn(s[l][f],s[l][f+1],t,n,r,i));o.geometry.push(c)}}return e.transformed=!0,e}function yn(e,t,n,r,i,o){return[Math.round(n*(e*r-i)),Math.round(n*(t*r-o))]}function xn(e,t){let n=[];for(let i of e.protoFeatures){if(!i||!i.geometry)continue;let o,s;switch(i.simplifiedType){case 1:i.geometry.length===1?(o="Point",s=i.geometry[0]):(o="MultiPoint",s=i.geometry);break;case 2:i.geometry.length===1?(o="LineString",s=i.geometry[0]):(o="MultiLineString",s=i.geometry);break;case 3:i.geometry.length>1?(o="MultiPolygon",s=[i.geometry]):(o="Polygon",s=i.geometry);break;default:throw new Error(`${i.simplifiedType}is not a valid simplified type`)}switch(t.coordinates){case"EPSG:4326":case"wgs84":ae(s,t.tileIndex,t.extent);break;default:se(s,t.extent);break}let a={type:"Feature",geometry:{type:o,coordinates:s},properties:i.tags||{},id:i.id};n.push(a)}return n.length===0?null:{shape:"geojson-table",type:"FeatureCollection",features:n}}function k(e,t,n,r){let i={id:e??null,type:t,simplifiedType:void 0,geometry:n,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(t){case"Point":case"MultiPoint":case"LineString":Be(i,n);break;case"MultiLineString":for(let o of n)Be(i,o);break;case"Polygon":Be(i,n[0]);break;case"MultiPolygon":for(let o of n)Be(i,o[0]);break;default:throw new Error(String(t))}return i}function Be(e,t){for(let n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function Me(e,t,n,r){let i=r,o=n-t>>1,s=n-t,a,l=e[t],c=e[t+1],f=e[n],u=e[n+1];for(let h=t+3;h<n;h+=3){let p=Xi(e[h],e[h+1],l,c,f,u);if(p>i)a=h,i=p;else if(p===i){let d=Math.abs(h-o);d<s&&(a=h,s=d)}}i>r&&(a-t>3&&Me(e,t,a,r),e[a+2]=i,n-a>3&&Me(e,a,n,r))}function Xi(e,t,n,r,i,o){let s=i-n,a=o-r;if(s!==0||a!==0){let l=((e-n)*s+(t-r)*a)/(s*s+a*a);l>1?(n=i,r=o):l>0&&(n+=s*l,r+=a*l)}return s=e-n,a=t-r,s*s+a*a}function Tn(e,t){let n=[];switch(e.type){case"FeatureCollection":let r=0;for(let i of e.features)n.push(Le(i,t,r++));break;case"Feature":n.push(Le(e,t));break;default:n.push(Le({geometry:e},t))}return n}function Le(e,t,n){if(!e.geometry)return;let r=e.geometry.coordinates,i=e.geometry.type,o=Math.pow(t.tolerance/((1<<t.maxZoom)*t.extent),2),s=[],a=e.id;switch(t.promoteId?a=e.properties[t.promoteId]:t.generateId&&(a=n||0),i){case"Point":wn(r,s);break;case"MultiPoint":for(let l of r)wn(l,s);break;case"LineString":lt(r,s,o,!1);break;case"MultiLineString":if(t.lineMetrics){for(let l of r)s=[],lt(l,s,o,!1),features.push(k(a,"LineString",s,e.properties));return}break;case"Polygon":at(r,s,o,!0);break;case"MultiPolygon":for(let l of r){let c=[];at(l,c,o,!0),s.push(c)}break;case"GeometryCollection":for(let l of e.geometry.geometries)Le(features,{id:a,geometry:l,properties:e.properties},t,n);break;default:throw new Error("Input data is not a valid GeoJSON object.")}return k(a,i,s,e.properties)}function wn(e,t){t.push(Fn(e[0]),Pn(e[1]),0)}function lt(e,t,n,r){let i,o,s=0;for(let l=0;l<e.length;l++){let c=Fn(e[l][0]),f=Pn(e[l][1]);t.push(c,f,0),l>0&&(r?s+=(i*f-c*o)/2:s+=Math.sqrt(Math.pow(c-i,2)+Math.pow(f-o,2))),i=c,o=f}let a=t.length-3;t[2]=1,Me(t,0,a,n),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function at(e,t,n,r){for(let i=0;i<e.length;i++){let o=[];lt(e[i],o,n,r),t.push(o)}}function Fn(e){return e/360+.5}function Pn(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function B(e,t,n,r,i,o,s,a){if(n/=t,r/=t,o>=n&&s<r)return e;if(s<n||o>=r)return null;let l=[];for(let c of e){let f=c.geometry,u=c.type,h=i===0?c.minX:c.minY,p=i===0?c.maxX:c.maxY;if(h>=n&&p<r){l.push(c);continue}else if(p<n||h>=r)continue;let d=[];if(u==="Point"||u==="MultiPoint")Ki(f,d,n,r,i);else if(u==="LineString")In(f,d,n,r,i,!1,a.lineMetrics);else if(u==="MultiLineString")ct(f,d,n,r,i,!1);else if(u==="Polygon")ct(f,d,n,r,i,!0);else if(u==="MultiPolygon")for(let y of f){let w=[];ct(y,w,n,r,i,!0),w.length&&d.push(w)}if(d.length){if(a.lineMetrics&&u==="LineString"){for(let y of d)l.push(k(c.id,u,y,c.tags));continue}(u==="LineString"||u==="MultiLineString")&&(d.length===1?(u="LineString",d=d[0]):u="MultiLineString"),(u==="Point"||u==="MultiPoint")&&(u=d.length===3?"Point":"MultiPoint"),l.push(k(c.id,u,d,c.tags))}}return l.length?l:null}function Ki(e,t,n,r,i){for(let o=0;o<e.length;o+=3){let s=e[o+i];s>=n&&s<=r&&Y(t,e[o],e[o+1],e[o+2])}}function In(e,t,n,r,i,o,s){let a=bn(e),l=i===0?Qi:qi,c=e.start,f,u;for(let S=0;S<e.length-3;S+=3){let v=e[S],m=e[S+1],g=e[S+2],b=e[S+3],I=e[S+4],P=i===0?v:m,_=i===0?b:I,A=!1;s&&(f=Math.sqrt(Math.pow(v-b,2)+Math.pow(m-I,2))),P<n?_>n&&(u=l(a,v,m,b,I,n),s&&(a.start=c+f*u)):P>r?_<r&&(u=l(a,v,m,b,I,r),s&&(a.start=c+f*u)):Y(a,v,m,g),_<n&&P>=n&&(u=l(a,v,m,b,I,n),A=!0),_>r&&P<=r&&(u=l(a,v,m,b,I,r),A=!0),!o&&A&&(s&&(a.end=c+f*u),t.push(a),a=bn(e)),s&&(c+=f)}let h=e.length-3,p=e[h],d=e[h+1],y=e[h+2],w=i===0?p:d;w>=n&&w<=r&&Y(a,p,d,y),h=a.length-3,o&&h>=3&&(a[h]!==a[0]||a[h+1]!==a[1])&&Y(a,a[0],a[1],a[2]),a.length&&t.push(a)}function bn(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ct(e,t,n,r,i,o){for(let s of e)In(s,t,n,r,i,o,!1)}function Y(e,t,n,r){e.push(t,n,r)}function Qi(e,t,n,r,i,o){let s=(o-t)/(r-t);return Y(e,o,n+(i-n)*s,1),s}function qi(e,t,n,r,i,o){let s=(o-n)/(i-n);return Y(e,t+(r-t)*s,o,1),s}function vn(e,t){let n=t.buffer/t.extent,r=e,i=B(e,1,-1-n,n,0,-1,2,t),o=B(e,1,1-n,2+n,0,-1,2,t);return(i||o)&&(r=B(e,1,-n,1+n,0,-1,2,t)||[],i&&(r=Sn(i,1).concat(r)),o&&(r=r.concat(Sn(o,-1)))),r}function Sn(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=i.type,s;switch(o){case"Point":case"MultiPoint":case"LineString":s=ft(i.geometry,t);break;case"MultiLineString":case"Polygon":s=[];for(let a of i.geometry)s.push(ft(a,t));break;case"MultiPolygon":s=[];for(let a of i.geometry){let l=[];for(let c of a)l.push(ft(c,t));s.push(l)}break;default:throw new Error(String(o))}n.push(k(i.id,o,s,i.tags))}return n}function ft(e,t){let n=[];n.size=e.size,e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}var ht={name:"TableTiler",id:"table-tiler",version:"0.0.0",extensions:["mvt"],mimeTypes:["application/octet-stream"],options:{table:{coordinates:"local",promoteId:void 0,maxZoom:14,indexMaxZoom:5,maxPointsPerTile:1e4,tolerance:3,extent:4096,buffer:64,generateId:void 0}},type:"table",testURL:e=>e.endsWith(".geojson"),createDataSource(e,t){let n=typeof e=="string"||e instanceof Blob,r=t?.table?.loaders?.[0],i=n?eo(e,r):e;return new De(i,t)}};async function eo(e,t){if(typeof e=="string"){let i=await(await fetch(e)).arrayBuffer();return await t.parse(i)}let n=await e.arrayBuffer();return await t.parse(n)}var Ve=class{stats=new O({id:"table-tile-source",stats:[new E("tiles","count"),new E("features","count")]});mimeType="application/vnd.mapbox-vector-tile";localCoordinates=!0;props;schema=null;tiles={};tileCoords=[];ready;metadata;constructor(t,n){this.props={...ht.options.table,...n?.table},this.getTileData=this.getTileData.bind(this),this.ready=this.initializeTilesAsync(t),this.metadata=this.getMetadata()}async initializeTilesAsync(t){let n=await t;this.schema=Ne(n),this.createRootTiles(n)}async getMetadata(){return await this.ready,{schema:this.schema,minZoom:0,maxZoom:this.props.maxZoom}}async getSchema(){return await this.ready,this.schema}async getVectorTile(t){await this.ready;let n=this.getTileSync(t);return F.info(2,"getVectorTile",t,n)(),n}async getTile(t){return await this.ready,this.getTileSync(t)}async getTileData(t){let{x:n,y:r,z:i}=t.index;return(await this.getVectorTile({x:n,y:r,z:i}))?.features||[]}getTileSync(t){let n=this.getProtoTile(t);return n?xn(n,{coordinates:this.props.coordinates,tileIndex:t,extent:this.props.extent}):null}createRootTiles(t){if(this.props.maxZoom<0||this.props.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(this.props.promoteId&&this.props.generateId)throw new Error("promoteId and generateId cannot be used together.");F.log(1,"DynamicVectorTileSource creating root tiles",this.props)(),F.time(1,"preprocess table")();let n=Tn(t,this.props);if(F.timeEnd(1,"preprocess table")(),F.time(1,"generate tiles")(),n=vn(n,this.props),n.length===0){F.log(1,"DynamicVectorTileSource: no features generated")();return}this.splitTile(n,0,0,0);let r=this.tiles[0];F.log(1,`root tile features: ${r.numFeatures}, points: ${r.numPoints}`)(),F.timeEnd(1,"generate tiles")(),F.log(1,`DynamicVectorTileSource: tiles generated: ${this.stats.get("total").count}`,this.stats)()}getProtoTile(t){let{z:n,y:r}=t,{x:i}=t,{extent:o}=this.props;if(n<0||n>24)return null;let s=1<<n;i=i+s&s-1;let a=ut(n,i,r);if(this.tiles[a])return st(this.tiles[a],o);F.log(F,"drilling down to z%d-%d-%d",n,i,r)();let l=n,c=i,f=r,u;for(;!u&&l>0;)l--,c=c>>1,f=f>>1,u=this.tiles[ut(l,c,f)];return!u||!u.sourceFeatures?null:(F.log(1,"found parent tile z%d-%d-%d",l,c,f)(),F.time(1,"drilling down")(),this.splitTile(u.sourceFeatures,l,c,f,n,i,r),F.timeEnd(1,"drilling down")(),this.tiles[a]?st(this.tiles[a],o):null)}splitTile(t,n,r,i,o,s,a){let l=[t,n,r,i];for(;l.length;){i=l.pop(),r=l.pop(),n=l.pop(),t=l.pop();let c=1<<n,f=ut(n,r,i),u=this.tiles[f];if(!u){F.time(2,"tile creation")(),u=this.tiles[f]=gn(t,n,r,i,this.props),this.tileCoords.push({z:n,x:r,y:i});let I=`z${n}`,P=this.stats.get(I,"count");P.incrementCount(),P=this.stats.get("total"),P.incrementCount(),P=Ve.stats.get(I,"count"),P.incrementCount(),P=Ve.stats.get("total"),P.incrementCount(),F.log(2,"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,r,i,u.numFeatures,u.numPoints,u.numSimplified)(),F.timeEnd(2,"tile creation")()}if(u.sourceFeatures=t,o===void 0){if(n===this.props.indexMaxZoom||u.numPoints<=this.props.maxPointsPerTile)continue}else{if(n===this.props.maxZoom||n===o)continue;if(o!==void 0){let I=o-n;if(r!==s>>I||i!==a>>I)continue}}if(u.sourceFeatures=null,t.length===0)continue;F.time(2,"clipping tile")();let h=.5*this.props.buffer/this.props.extent,p=.5-h,d=.5+h,y=1+h,w=null,S=null,v=null,m=null,g=B(t,c,r-h,r+d,0,u.minX,u.maxX,this.props),b=B(t,c,r+p,r+y,0,u.minX,u.maxX,this.props);t=null,g&&(w=B(g,c,i-h,i+d,1,u.minY,u.maxY,this.props),S=B(g,c,i+p,i+y,1,u.minY,u.maxY,this.props),g=null),b&&(v=B(b,c,i-h,i+d,1,u.minY,u.maxY,this.props),m=B(b,c,i+p,i+y,1,u.minY,u.maxY,this.props),b=null),F.timeEnd(2,"clipping tile")(),l.push(w||[],n+1,r*2,i*2),l.push(S||[],n+1,r*2,i*2+1),l.push(v||[],n+1,r*2+1,i*2),l.push(m||[],n+1,r*2+1,i*2+1)}}},De=Ve;de(De,"stats",new O({id:"table-tile-source-all",stats:[new E("count","tiles"),new E("count","features")]}));function ut(e,t,n){return((1<<e)*n+t)*32+e}return Vn(ue);})();
8
8
  /*! Bundled license information:
9
9
 
10
10
  ieee754/index.js:
package/dist/index.cjs CHANGED
@@ -302,7 +302,7 @@ function attributeTypeToFieldType(aType) {
302
302
  }
303
303
 
304
304
  // dist/tilejson-loader.js
305
- var VERSION = true ? "4.3.0" : "latest";
305
+ var VERSION = true ? "4.3.1" : "latest";
306
306
  var TileJSONLoader = {
307
307
  dataType: null,
308
308
  batchType: null,
@@ -980,7 +980,7 @@ function getDecodedFeatureBinary(feature, options, layerName) {
980
980
  }
981
981
 
982
982
  // dist/mvt-loader.js
983
- var VERSION2 = true ? "4.3.0" : "latest";
983
+ var VERSION2 = true ? "4.3.1" : "latest";
984
984
  var MVTWorkerLoader = {
985
985
  dataType: null,
986
986
  batchType: null,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.js", "lib/get-schemas-from-tilejson.js", "lib/parse-tilejson.js", "tilejson-loader.js", "lib/parse-mvt.js", "lib/utils/geometry-utils.js", "lib/vector-tile/vector-tile-feature.js", "lib/vector-tile/vector-tile-layer.js", "lib/vector-tile/vector-tile.js", "mvt-loader.js", "mvt-source.js", "table-tile-source.js", "lib/vector-tiler/proto-tile.js", "lib/vector-tiler/transform-tile.js", "lib/vector-tiler/tile-to-geojson.js", "lib/vector-tiler/features/proto-feature.js", "lib/vector-tiler/features/simplify-path.js", "lib/vector-tiler/features/convert-feature.js", "lib/vector-tiler/features/clip-features.js", "lib/vector-tiler/features/wrap-features.js"],
4
- "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// TileJSONLoader\nexport { TileJSONLoader } from \"./tilejson-loader.js\";\n// MVTLoader\nexport { MVTLoader, MVTWorkerLoader } from \"./mvt-loader.js\";\n// MVTSource\nexport { MVTSource } from \"./mvt-source.js\";\n// TableTileSource (dynamically tiles a table)\nexport { TableTileSource } from \"./table-tile-source.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// LAYERS\nexport function getSchemaFromTileJSONLayer(layer) {\n const fields = [];\n if (layer.fields) {\n for (const field of layer.fields) {\n fields.push({\n name: field.name,\n type: getDataTypeFromTileJSONField(field),\n metadata: getMetadataFromTileJSONField(field)\n });\n }\n }\n return {\n metadata: getMetadataFromTileJSONLayer(layer),\n fields\n };\n}\nfunction getMetadataFromTileJSONLayer(layer) {\n const metadata = {};\n for (const [key, value] of Object.entries(layer)) {\n if (key !== 'fields' && value) {\n metadata[key] = JSON.stringify(value);\n }\n }\n return metadata;\n}\n// FIELDS\nfunction getDataTypeFromTileJSONField(field) {\n switch (field.type.toLowerCase()) {\n case 'float32':\n return 'float32';\n case 'number':\n case 'float64':\n return 'float64';\n case 'string':\n case 'utf8':\n return 'utf8';\n case 'boolean':\n return 'bool';\n default:\n return 'null';\n }\n}\nfunction getMetadataFromTileJSONField(field) {\n const metadata = {};\n for (const [key, value] of Object.entries(field)) {\n if (key !== 'name' && value) {\n metadata[key] = JSON.stringify(value);\n }\n }\n return metadata;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getSchemaFromTileJSONLayer } from \"./get-schemas-from-tilejson.js\";\nconst isObject = (x) => x !== null && typeof x === 'object';\n/**\n * Parse TileJSON from metadata\n * @param jsonMetadata - metadata object\n * @param options - options\n * @returns - parsed TileJSON\n */\n// eslint-disable-next-line complexity\nexport function parseTileJSON(jsonMetadata, options) {\n if (!jsonMetadata || !isObject(jsonMetadata)) {\n return null;\n }\n let tileJSON = {\n name: jsonMetadata.name || '',\n description: jsonMetadata.description || ''\n };\n // tippecanoe\n if (typeof jsonMetadata.generator === 'string') {\n tileJSON.generator = jsonMetadata.generator;\n }\n if (typeof jsonMetadata.generator_options === 'string') {\n tileJSON.generatorOptions = jsonMetadata.generator_options;\n }\n // Tippecanoe emits `antimeridian_adjusted_bounds` instead of `bounds`\n tileJSON.boundingBox =\n parseBounds(jsonMetadata.bounds) || parseBounds(jsonMetadata.antimeridian_adjusted_bounds);\n // TODO - can be undefined - we could set to center of bounds...\n tileJSON.center = parseCenter(jsonMetadata.center);\n // TODO - can be undefined, we could extract from layers...\n tileJSON.maxZoom = safeParseFloat(jsonMetadata.maxzoom);\n // TODO - can be undefined, we could extract from layers...\n tileJSON.minZoom = safeParseFloat(jsonMetadata.minzoom);\n // Look for nested metadata embedded in .json field\n // TODO - document what source this applies to, when is this needed?\n if (typeof jsonMetadata?.json === 'string') {\n // try to parse json\n try {\n tileJSON.metaJson = JSON.parse(jsonMetadata.json);\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Failed to parse tilejson.json field', error);\n // do nothing\n }\n }\n // Look for fields in tilestats\n const tilestats = jsonMetadata.tilestats || tileJSON.metaJson?.tilestats;\n const tileStatsLayers = parseTilestatsLayers(tilestats, options);\n const tileJSONlayers = parseTileJSONLayers(jsonMetadata.vector_layers); // eslint-disable-line camelcase\n // TODO - merge in description from tilejson\n const layers = mergeLayers(tileJSONlayers, tileStatsLayers);\n tileJSON = {\n ...tileJSON,\n layers\n };\n if (tileJSON.maxZoom === null && layers.length > 0) {\n tileJSON.maxZoom = layers[0].maxZoom || null;\n }\n if (tileJSON.minZoom === null && layers.length > 0) {\n tileJSON.minZoom = layers[0].minZoom || null;\n }\n return tileJSON;\n}\nfunction parseTileJSONLayers(layers) {\n // Look for fields in vector_layers\n if (!Array.isArray(layers)) {\n return [];\n }\n return layers.map((layer) => parseTileJSONLayer(layer));\n}\nfunction parseTileJSONLayer(layer) {\n const fields = Object.entries(layer.fields || []).map(([key, datatype]) => ({\n name: key,\n ...attributeTypeToFieldType(String(datatype))\n }));\n const layer2 = { ...layer };\n delete layer2.fields;\n return {\n name: layer.id || '',\n ...layer2,\n fields\n };\n}\n/** parse Layers array from tilestats */\nfunction parseTilestatsLayers(tilestats, options) {\n if (isObject(tilestats) && Array.isArray(tilestats.layers)) {\n // we are in luck!\n return tilestats.layers.map((layer) => parseTilestatsForLayer(layer, options));\n }\n return [];\n}\nfunction parseTilestatsForLayer(layer, options) {\n const fields = [];\n const indexedAttributes = {};\n const attributes = layer.attributes || [];\n for (const attribute of attributes) {\n const name = attribute.attribute;\n if (typeof name === 'string') {\n // TODO - code copied from kepler.gl, need sample tilestats files to test\n if (name.split('|').length > 1) {\n // indexed field\n const fname = name.split('|')[0];\n indexedAttributes[fname] = indexedAttributes[fname] || [];\n indexedAttributes[fname].push(attribute);\n // eslint-disable-next-line no-console\n console.warn('ignoring tilestats indexed field', fname);\n }\n else if (!fields[name]) {\n fields.push(attributeToField(attribute, options));\n }\n else {\n // return (fields[name], attribute);\n }\n }\n }\n return {\n name: layer.layer || '',\n dominantGeometry: layer.geometry,\n fields\n };\n}\nfunction mergeLayers(layers, tilestatsLayers) {\n return layers.map((layer) => {\n const tilestatsLayer = tilestatsLayers.find((tsLayer) => tsLayer.name === layer.name);\n const fields = tilestatsLayer?.fields || layer.fields || [];\n const mergedLayer = {\n ...layer,\n ...tilestatsLayer,\n fields\n };\n mergedLayer.schema = getSchemaFromTileJSONLayer(mergedLayer);\n return mergedLayer;\n });\n}\n/**\n * bounds should be [minLng, minLat, maxLng, maxLat]\n *`[[w, s], [e, n]]`, indicates the limits of the bounding box using the axis units and order of the specified CRS.\n */\nfunction parseBounds(bounds) {\n // supported formats\n // string: \"-96.657715,40.126127,-90.140061,43.516689\",\n // array: [ -180, -85.05112877980659, 180, 85.0511287798066 ]\n const result = fromArrayOrString(bounds);\n // validate bounds\n if (Array.isArray(result) &&\n result.length === 4 &&\n [result[0], result[2]].every(isLng) &&\n [result[1], result[3]].every(isLat)) {\n return [\n [result[0], result[1]],\n [result[2], result[3]]\n ];\n }\n return undefined;\n}\nfunction parseCenter(center) {\n // supported formats\n // string: \"-96.657715,40.126127,-90.140061,43.516689\",\n // array: [-91.505127,41.615442,14]\n const result = fromArrayOrString(center);\n if (Array.isArray(result) &&\n result.length === 3 &&\n isLng(result[0]) &&\n isLat(result[1]) &&\n isZoom(result[2])) {\n return result;\n }\n return null;\n}\nfunction safeParseFloat(input) {\n const result = typeof input === 'string' ? parseFloat(input) : typeof input === 'number' ? input : null;\n return result === null || isNaN(result) ? null : result;\n}\n// https://github.com/mapbox/tilejson-spec/tree/master/2.2.0\nfunction isLat(num) {\n return Number.isFinite(num) && num <= 90 && num >= -90;\n}\nfunction isLng(num) {\n return Number.isFinite(num) && num <= 180 && num >= -180;\n}\nfunction isZoom(num) {\n return Number.isFinite(num) && num >= 0 && num <= 22;\n}\nfunction fromArrayOrString(data) {\n if (typeof data === 'string') {\n return data.split(',').map(parseFloat);\n }\n else if (Array.isArray(data)) {\n return data;\n }\n return null;\n}\n// possible types https://github.com/mapbox/tippecanoe#modifying-feature-attributes\nconst attrTypeMap = {\n number: {\n type: 'float32'\n },\n numeric: {\n type: 'float32'\n },\n string: {\n type: 'utf8'\n },\n vachar: {\n type: 'utf8'\n },\n float: {\n type: 'float32'\n },\n int: {\n type: 'int32'\n },\n int4: {\n type: 'int32'\n },\n boolean: {\n type: 'boolean'\n },\n bool: {\n type: 'boolean'\n }\n};\nfunction attributeToField(attribute = {}, options) {\n const fieldTypes = attributeTypeToFieldType(attribute.type);\n const field = {\n name: attribute.attribute,\n // what happens if attribute type is string...\n // filterProps: getFilterProps(fieldTypes.type, attribute),\n ...fieldTypes\n };\n // attribute: \"_season_peaks_color\"\n // count: 1000\n // max: 0.95\n // min: 0.24375\n // type: \"number\"\n if (typeof attribute.min === 'number') {\n field.min = attribute.min;\n }\n if (typeof attribute.max === 'number') {\n field.max = attribute.max;\n }\n if (typeof attribute.count === 'number') {\n field.uniqueValueCount = attribute.count;\n }\n if (attribute.values) {\n // Too much data? Add option?\n field.values = attribute.values;\n }\n if (field.values && typeof options.maxValues === 'number') {\n // Too much data? Add option?\n field.values = field.values?.slice(0, options.maxValues);\n }\n return field;\n}\nfunction attributeTypeToFieldType(aType) {\n const type = aType.toLowerCase();\n if (!type || !attrTypeMap[type]) {\n // console.warn(\n // `cannot convert attribute type ${type} to loaders.gl data type, use string by default`\n // );\n }\n return attrTypeMap[type] || { type: 'string' };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { parseTileJSON } from \"./lib/parse-tilejson.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.0\" !== 'undefined' ? \"4.3.0\" : 'latest';\n/**\n * Loader for TileJSON metadata\n */\nexport const TileJSONLoader = {\n dataType: null,\n batchType: null,\n name: 'TileJSON',\n id: 'tilejson',\n module: 'pmtiles',\n version: VERSION,\n worker: true,\n extensions: ['json'],\n mimeTypes: ['application/json'],\n text: true,\n options: {\n tilejson: {\n maxValues: undefined\n }\n },\n parse: async (arrayBuffer, options) => {\n const jsonString = new TextDecoder().decode(arrayBuffer);\n const json = JSON.parse(jsonString);\n const tilejsonOptions = { ...TileJSONLoader.options.tilejson, ...options?.tilejson };\n return parseTileJSON(json, tilejsonOptions);\n },\n parseTextSync: (text, options) => {\n const json = JSON.parse(text);\n const tilejsonOptions = { ...TileJSONLoader.options.tilejson, ...options?.tilejson };\n return parseTileJSON(json, tilejsonOptions);\n }\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { flatGeojsonToBinary } from '@loaders.gl/gis';\nimport { log } from '@loaders.gl/loader-utils';\nimport Protobuf from 'pbf';\nimport { VectorTile } from \"./vector-tile/vector-tile.js\";\n/**\n * Parse MVT arrayBuffer and return GeoJSON.\n *\n * @param arrayBuffer A MVT arrayBuffer\n * @param options\n * @returns A GeoJSON geometry object or a binary representation\n */\nexport function parseMVT(arrayBuffer, options) {\n const mvtOptions = checkOptions(options);\n const shape = options?.gis?.format || options?.mvt?.shape || options?.shape;\n switch (shape) {\n case 'columnar-table': // binary + some JS arrays\n return { shape: 'columnar-table', data: parseToBinary(arrayBuffer, mvtOptions) };\n case 'geojson-table': {\n const table = {\n shape: 'geojson-table',\n type: 'FeatureCollection',\n features: parseToGeojsonFeatures(arrayBuffer, mvtOptions)\n };\n return table;\n }\n case 'geojson':\n return parseToGeojsonFeatures(arrayBuffer, mvtOptions);\n case 'binary-geometry':\n return parseToBinary(arrayBuffer, mvtOptions);\n case 'binary':\n return parseToBinary(arrayBuffer, mvtOptions);\n default:\n throw new Error(shape || 'undefined shape');\n }\n}\nfunction parseToBinary(arrayBuffer, options) {\n const [flatGeoJsonFeatures, geometryInfo] = parseToFlatGeoJson(arrayBuffer, options);\n const binaryData = flatGeojsonToBinary(flatGeoJsonFeatures, geometryInfo);\n // Add the original byteLength (as a reasonable approximation of the size of the binary data)\n // TODO decide where to store extra fields like byteLength (header etc) and document\n // @ts-ignore\n binaryData.byteLength = arrayBuffer.byteLength;\n return binaryData;\n}\nfunction parseToFlatGeoJson(arrayBuffer, options) {\n const features = [];\n const geometryInfo = {\n coordLength: 2,\n pointPositionsCount: 0,\n pointFeaturesCount: 0,\n linePositionsCount: 0,\n linePathsCount: 0,\n lineFeaturesCount: 0,\n polygonPositionsCount: 0,\n polygonObjectsCount: 0,\n polygonRingsCount: 0,\n polygonFeaturesCount: 0\n };\n if (arrayBuffer.byteLength <= 0) {\n return [features, geometryInfo];\n }\n const tile = new VectorTile(new Protobuf(arrayBuffer));\n const selectedLayers = options && Array.isArray(options.layers) ? options.layers : Object.keys(tile.layers);\n selectedLayers.forEach((layerName) => {\n const vectorTileLayer = tile.layers[layerName];\n if (!vectorTileLayer) {\n return;\n }\n for (let i = 0; i < vectorTileLayer.length; i++) {\n const vectorTileFeature = vectorTileLayer.getBinaryFeature(i, geometryInfo);\n const decodedFeature = getDecodedFeatureBinary(vectorTileFeature, options, layerName);\n features.push(decodedFeature);\n }\n });\n return [features, geometryInfo];\n}\nfunction parseToGeojsonFeatures(arrayBuffer, options) {\n if (arrayBuffer.byteLength <= 0) {\n return [];\n }\n const features = [];\n const tile = new VectorTile(new Protobuf(arrayBuffer));\n const selectedLayers = Array.isArray(options.layers) ? options.layers : Object.keys(tile.layers);\n selectedLayers.forEach((layerName) => {\n const vectorTileLayer = tile.layers[layerName];\n if (!vectorTileLayer) {\n return;\n }\n for (let i = 0; i < vectorTileLayer.length; i++) {\n const vectorTileFeature = vectorTileLayer.getGeoJSONFeature(i);\n const decodedFeature = getDecodedFeature(vectorTileFeature, options, layerName);\n features.push(decodedFeature);\n }\n });\n return features;\n}\n/** Check that options are good */\nfunction checkOptions(options) {\n if (!options?.mvt) {\n throw new Error('mvt options required');\n }\n if (options.mvt?.coordinates === 'wgs84' && !options.mvt.tileIndex) {\n throw new Error('MVT Loader: WGS84 coordinates need tileIndex property');\n }\n if (options.gis) {\n log.warn('MVTLoader: \"options.gis\" is deprecated, use \"options.mvt.shape\" instead')();\n }\n return options.mvt;\n}\n/**\n * @param feature\n * @param options\n * @returns decoded feature\n */\nfunction getDecodedFeature(feature, options, layerName) {\n const decodedFeature = feature.toGeoJSONFeature(options.coordinates || 'local', options.tileIndex);\n // Add layer name to GeoJSON properties\n if (options.layerProperty) {\n decodedFeature.properties ||= {};\n decodedFeature.properties[options.layerProperty] = layerName;\n }\n return decodedFeature;\n}\n/**\n * @param feature\n * @param options\n * @returns decoded binary feature\n */\nfunction getDecodedFeatureBinary(feature, options, layerName) {\n const decodedFeature = feature.toBinaryFeature(options.coordinates || 'local', options.tileIndex);\n // Add layer name to GeoJSON properties\n if (options.layerProperty && decodedFeature.properties) {\n decodedFeature.properties[options.layerProperty] = layerName;\n }\n return decodedFeature;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { getPolygonSignedArea } from '@math.gl/polygon';\n/**\n *\n * @param ring\n * @returns sum\n */\nexport function signedArea(ring) {\n let sum = 0;\n for (let i = 0, j = ring.length - 1, p1, p2; i < ring.length; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n sum += (p2[0] - p1[0]) * (p1[1] + p2[1]);\n }\n return sum;\n}\n/**\n * This function projects local coordinates in a\n * [0 - bufferSize, this.extent + bufferSize] range to a\n * [0 - (bufferSize / this.extent), 1 + (bufferSize / this.extent)] range.\n * The resulting extent would be 1.\n * @param line\n * @param feature\n */\nexport function convertToLocalCoordinates(coordinates, extent) {\n if (Array.isArray(coordinates[0])) {\n for (const subcoords of coordinates) {\n convertToLocalCoordinates(subcoords, extent);\n }\n return;\n }\n // Just a point\n const p = coordinates;\n p[0] /= extent;\n p[1] /= extent;\n}\n/**\n * For the binary code path, the feature data is just\n * one big flat array, so we just divide each value\n * @param data\n * @param feature\n */\nexport function convertToLocalCoordinatesFlat(data, extent) {\n for (let i = 0; i < data.length; ++i) {\n data[i] /= extent;\n }\n}\n/**\n * Projects local tile coordinates to lngLat in place.\n * @param points\n * @param tileIndex\n */\nexport function projectToLngLat(line, tileIndex, extent) {\n if (typeof line[0][0] !== 'number') {\n for (const point of line) {\n // @ts-expect-error\n projectToLngLat(point, tileIndex, extent);\n }\n return;\n }\n const size = extent * Math.pow(2, tileIndex.z);\n const x0 = extent * tileIndex.x;\n const y0 = extent * tileIndex.y;\n for (let j = 0; j < line.length; j++) {\n const p = line[j];\n p[0] = ((p[0] + x0) * 360) / size - 180;\n const y2 = 180 - ((p[1] + y0) * 360) / size;\n p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;\n }\n}\n/**\n * Projects local tile coordinates to lngLat in place.\n * @param points\n * @param tileIndex\nexport function projectTileCoordinatesToLngLat(\n points: number[][],\n tileIndex: {x: number; y: number; z: number},\n extent: number\n): void {\n const {x, y, z} = tileIndex;\n const size = extent * Math.pow(2, z);\n const x0 = extent * x;\n const y0 = extent * y;\n\n for (const p of points) {\n p[0] = ((p[0] + x0) * 360) / size - 180;\n const y2 = 180 - ((p[1] + y0) * 360) / size;\n p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;\n }\n}\n */\n/**\n *\n * @param data\n * @param x0\n * @param y0\n * @param size\n */\nexport function projectToLngLatFlat(data, tileIndex, extent) {\n const { x, y, z } = tileIndex;\n const size = extent * Math.pow(2, z);\n const x0 = extent * x;\n const y0 = extent * y;\n for (let j = 0, jl = data.length; j < jl; j += 2) {\n data[j] = ((data[j] + x0) * 360) / size - 180;\n const y2 = 180 - ((data[j + 1] + y0) * 360) / size;\n data[j + 1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;\n }\n}\n/**\n * Classifies an array of rings into polygons with outer rings and holes\n * @param rings\n * @returns polygons\n */\nexport function classifyRings(rings) {\n const len = rings.length;\n if (len <= 1)\n return [rings];\n const polygons = [];\n let polygon;\n let ccw;\n for (let i = 0; i < len; i++) {\n const area = signedArea(rings[i]);\n if (area === 0)\n continue; // eslint-disable-line no-continue\n if (ccw === undefined)\n ccw = area < 0;\n if (ccw === area < 0) {\n if (polygon)\n polygons.push(polygon);\n polygon = [rings[i]];\n }\n else if (polygon)\n polygon.push(rings[i]);\n }\n if (polygon)\n polygons.push(polygon);\n return polygons;\n}\n/**\n * Classifies an array of rings into polygons with outer rings and holes\n * The function also detects holes which have zero area and\n * removes them. In doing so it modifies the input\n * `geom.data` array to remove the unneeded data\n *\n * @param geometry\n * @returns object\n */\n// eslint-disable-next-line max-statements\nexport function classifyRingsFlat(geom) {\n const len = geom.indices.length;\n const type = 'Polygon';\n if (len <= 1) {\n return {\n type,\n data: geom.data,\n areas: [[getPolygonSignedArea(geom.data)]],\n indices: [geom.indices]\n };\n }\n const areas = [];\n const polygons = [];\n let ringAreas = [];\n let polygon = [];\n let ccw;\n let offset = 0;\n for (let endIndex, i = 0, startIndex; i < len; i++) {\n startIndex = geom.indices[i] - offset;\n endIndex = geom.indices[i + 1] - offset || geom.data.length;\n const shape = geom.data.slice(startIndex, endIndex);\n const area = getPolygonSignedArea(shape);\n if (area === 0) {\n // This polygon has no area, so remove it from the shape\n // Remove the section from the data array\n const before = geom.data.slice(0, startIndex);\n const after = geom.data.slice(endIndex);\n geom.data = before.concat(after);\n // Need to offset any remaining indices as we have\n // modified the data buffer\n offset += endIndex - startIndex;\n // Do not add this index to the output and process next shape\n continue; // eslint-disable-line no-continue\n }\n if (ccw === undefined)\n ccw = area < 0;\n if (ccw === area < 0) {\n if (polygon.length) {\n areas.push(ringAreas);\n polygons.push(polygon);\n }\n polygon = [startIndex];\n ringAreas = [area];\n }\n else {\n ringAreas.push(area);\n polygon.push(startIndex);\n }\n }\n if (ringAreas)\n areas.push(ringAreas);\n if (polygon.length)\n polygons.push(polygon);\n return { type, areas, indices: polygons, data: geom.data };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { classifyRings, classifyRingsFlat, projectToLngLat, projectToLngLatFlat, convertToLocalCoordinates, convertToLocalCoordinatesFlat } from \"../utils/geometry-utils.js\";\nexport class VectorTileFeature {\n properties;\n extent;\n type;\n id;\n _pbf;\n _geometry;\n _keys;\n _values;\n _geometryInfo;\n static types = ['Unknown', 'Point', 'LineString', 'Polygon'];\n // eslint-disable-next-line max-params\n constructor(pbf, end, extent, keys, values, geometryInfo) {\n // Public\n this.properties = {};\n this.extent = extent;\n this.type = 0;\n this.id = null;\n // Private\n this._pbf = pbf;\n this._geometry = -1;\n this._keys = keys;\n this._values = values;\n // Only used by binary tiles\n this._geometryInfo = geometryInfo;\n pbf.readFields(readFeature, this, end);\n }\n toGeoJSONFeature(coordinates, tileIndex) {\n const coords = this.loadGeometry();\n switch (coordinates) {\n case 'wgs84':\n return _toGeoJSONFeature(this, coords, (line) => projectToLngLat(line, tileIndex, this.extent));\n default:\n return _toGeoJSONFeature(this, coords, convertToLocalCoordinates);\n }\n }\n /**\n *\n * @param options\n * @returns\n */\n toBinaryFeature(coordinates, tileIndex) {\n const geom = this.loadFlatGeometry();\n switch (coordinates) {\n case 'wgs84':\n return this._toBinaryCoordinates(geom, (coords) => projectToLngLatFlat(coords, tileIndex, this.extent));\n default:\n return this._toBinaryCoordinates(geom, convertToLocalCoordinatesFlat);\n }\n }\n /** Read a bounding box from the feature */\n // eslint-disable-next-line max-statements\n bbox() {\n const pbf = this._pbf;\n pbf.pos = this._geometry;\n const end = pbf.readVarint() + pbf.pos;\n let cmd = 1;\n let length = 0;\n let x = 0;\n let y = 0;\n let x1 = Infinity;\n let x2 = -Infinity;\n let y1 = Infinity;\n let y2 = -Infinity;\n while (pbf.pos < end) {\n if (length <= 0) {\n const cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n length--;\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n if (x < x1)\n x1 = x;\n if (x > x2)\n x2 = x;\n if (y < y1)\n y1 = y;\n if (y > y2)\n y2 = y;\n }\n else if (cmd !== 7) {\n throw new Error(`unknown command ${cmd}`);\n }\n }\n return [x1, y1, x2, y2];\n }\n // BINARY HELPERS\n /**\n *\n * @param transform\n * @returns result\n */\n _toBinaryCoordinates(geom, transform) {\n let geometry;\n // Apply the supplied transformation to data\n transform(geom.data, this.extent);\n const coordLength = 2;\n // eslint-disable-next-line default-case\n switch (this.type) {\n case 1: // Point\n this._geometryInfo.pointFeaturesCount++;\n this._geometryInfo.pointPositionsCount += geom.indices.length;\n geometry = { type: 'Point', ...geom };\n break;\n case 2: // LineString\n this._geometryInfo.lineFeaturesCount++;\n this._geometryInfo.linePathsCount += geom.indices.length;\n this._geometryInfo.linePositionsCount += geom.data.length / coordLength;\n geometry = { type: 'LineString', ...geom };\n break;\n case 3: // Polygon\n geometry = classifyRingsFlat(geom);\n // Unlike Point & LineString geom.indices is a 2D array, thanks\n // to the classifyRings method\n this._geometryInfo.polygonFeaturesCount++;\n this._geometryInfo.polygonObjectsCount += geometry.indices.length;\n for (const indices of geometry.indices) {\n this._geometryInfo.polygonRingsCount += indices.length;\n }\n this._geometryInfo.polygonPositionsCount += geometry.data.length / coordLength;\n break;\n default:\n throw new Error(`Invalid geometry type: ${this.type}`);\n }\n const result = { type: 'Feature', geometry, properties: this.properties };\n if (this.id !== null) {\n result.id = this.id;\n }\n return result;\n }\n // GEOJSON HELPER\n // eslint-disable-next-line complexity, max-statements\n loadGeometry() {\n const pbf = this._pbf;\n pbf.pos = this._geometry;\n const end = pbf.readVarint() + pbf.pos;\n let cmd = 1;\n let length = 0;\n let x = 0;\n let y = 0;\n const lines = [];\n let line;\n while (pbf.pos < end) {\n if (length <= 0) {\n const cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n length--;\n switch (cmd) {\n case 1:\n case 2:\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n if (cmd === 1) {\n // moveTo\n if (line)\n lines.push(line);\n line = [];\n }\n if (line)\n line.push([x, y]);\n break;\n case 7:\n // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90\n if (line) {\n line.push(line[0].slice()); // closePolygon\n }\n break;\n default:\n throw new Error(`unknown command ${cmd}`);\n }\n }\n if (line)\n lines.push(line);\n return lines;\n }\n /**\n * Expands the protobuf data to an intermediate Flat GeoJSON\n * data format, which maps closely to the binary data buffers.\n * It is similar to GeoJSON, but rather than storing the coordinates\n * in multidimensional arrays, we have a 1D `data` with all the\n * coordinates, and then index into this using the `indices`\n * parameter, e.g.\n *\n * geometry: {\n * type: 'Point', data: [1,2], indices: [0]\n * }\n * geometry: {\n * type: 'LineString', data: [1,2,3,4,...], indices: [0]\n * }\n * geometry: {\n * type: 'Polygon', data: [1,2,3,4,...], indices: [[0, 2]]\n * }\n * Thus the indices member lets us look up the relevant range\n * from the data array.\n * The Multi* versions of the above types share the same data\n * structure, just with multiple elements in the indices array\n */\n // eslint-disable-next-line complexity, max-statements\n loadFlatGeometry() {\n const pbf = this._pbf;\n pbf.pos = this._geometry;\n const endPos = pbf.readVarint() + pbf.pos;\n let cmd = 1;\n let cmdLen;\n let length = 0;\n let x = 0;\n let y = 0;\n let i = 0;\n // Note: I attempted to replace the `data` array with a\n // Float32Array, but performance was worse, both using\n // `set()` and direct index access. Also, we cannot\n // know how large the buffer should be, so it would\n // increase memory usage\n const indices = []; // Indices where geometries start\n const data = []; // Flat array of coordinate data\n while (pbf.pos < endPos) {\n if (length <= 0) {\n cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n length--;\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n if (cmd === 1) {\n // New line\n indices.push(i);\n }\n data.push(x, y);\n i += 2;\n }\n else if (cmd === 7) {\n // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90\n if (i > 0) {\n const start = indices[indices.length - 1]; // start index of polygon\n data.push(data[start], data[start + 1]); // closePolygon\n i += 2;\n }\n }\n else {\n throw new Error(`unknown command ${cmd}`);\n }\n }\n return { data, indices };\n }\n}\nfunction _toGeoJSONFeature(vtFeature, coords, transform) {\n let type = VectorTileFeature.types[vtFeature.type];\n let i;\n let j;\n let coordinates;\n switch (vtFeature.type) {\n case 1:\n const points = [];\n for (i = 0; i < coords.length; i++) {\n points[i] = coords[i][0];\n }\n coordinates = points;\n transform(coordinates, vtFeature.extent);\n break;\n case 2:\n coordinates = coords;\n for (i = 0; i < coordinates.length; i++) {\n transform(coordinates[i], vtFeature.extent);\n }\n break;\n case 3:\n coordinates = classifyRings(coords);\n for (i = 0; i < coordinates.length; i++) {\n for (j = 0; j < coordinates[i].length; j++) {\n transform(coordinates[i][j], vtFeature.extent);\n }\n }\n break;\n default:\n throw new Error('illegal vector tile type');\n }\n if (coordinates.length === 1) {\n // @ts-expect-error\n coordinates = coordinates[0];\n }\n else {\n type = `Multi${type}`;\n }\n const result = {\n type: 'Feature',\n geometry: {\n type: type,\n coordinates: coordinates\n },\n properties: vtFeature.properties\n };\n if (vtFeature.id !== null) {\n result.properties ||= {};\n result.properties.id = vtFeature.id;\n }\n return result;\n}\n// PBF READER UTILS\n/**\n *\n * @param tag\n * @param feature\n * @param pbf\n */\nfunction readFeature(tag, feature, pbf) {\n if (feature && pbf) {\n if (tag === 1)\n feature.id = pbf.readVarint();\n else if (tag === 2)\n readTag(pbf, feature);\n else if (tag === 3)\n feature.type = pbf.readVarint();\n else if (tag === 4)\n feature._geometry = pbf.pos;\n }\n}\n/**\n *\n * @param pbf\n * @param feature\n */\nfunction readTag(pbf, feature) {\n const end = pbf.readVarint() + pbf.pos;\n while (pbf.pos < end) {\n const key = feature._keys[pbf.readVarint()];\n const value = feature._values[pbf.readVarint()];\n feature.properties[key] = value;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { VectorTileFeature } from \"./vector-tile-feature.js\";\nexport class VectorTileLayer {\n version;\n name;\n extent;\n length;\n _pbf;\n _keys;\n _values;\n _features;\n constructor(pbf, end) {\n // Public\n this.version = 1;\n this.name = '';\n this.extent = 4096;\n this.length = 0;\n // Private\n this._pbf = pbf;\n this._keys = [];\n this._values = [];\n this._features = [];\n pbf.readFields(readLayer, this, end);\n this.length = this._features.length;\n }\n /**\n * return feature `i` from this layer as a `VectorTileFeature`\n * @param index\n * @returns feature\n */\n getGeoJSONFeature(i) {\n if (i < 0 || i >= this._features.length) {\n throw new Error('feature index out of bounds');\n }\n this._pbf.pos = this._features[i];\n const end = this._pbf.readVarint() + this._pbf.pos;\n return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);\n }\n /**\n * return binary feature `i` from this layer as a `VectorTileFeature`\n *\n * @param index\n * @param geometryInfo\n * @returns binary feature\n */\n getBinaryFeature(i, geometryInfo) {\n if (i < 0 || i >= this._features.length) {\n throw new Error('feature index out of bounds');\n }\n this._pbf.pos = this._features[i];\n const end = this._pbf.readVarint() + this._pbf.pos;\n return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values, geometryInfo);\n }\n}\n/**\n *\n * @param tag\n * @param layer\n * @param pbf\n */\nfunction readLayer(tag, layer, pbf) {\n if (layer && pbf) {\n if (tag === 15)\n layer.version = pbf.readVarint();\n else if (tag === 1)\n layer.name = pbf.readString();\n else if (tag === 5)\n layer.extent = pbf.readVarint();\n else if (tag === 2)\n layer._features.push(pbf.pos);\n else if (tag === 3)\n layer._keys.push(pbf.readString());\n else if (tag === 4)\n layer._values.push(readValueMessage(pbf));\n }\n}\n/**\n *\n * @param pbf\n * @returns value\n */\nfunction readValueMessage(pbf) {\n let value = null;\n const end = pbf.readVarint() + pbf.pos;\n while (pbf.pos < end) {\n const tag = pbf.readVarint() >> 3;\n value =\n tag === 1\n ? pbf.readString()\n : tag === 2\n ? pbf.readFloat()\n : tag === 3\n ? pbf.readDouble()\n : tag === 4\n ? pbf.readVarint64()\n : tag === 5\n ? pbf.readVarint()\n : tag === 6\n ? pbf.readSVarint()\n : tag === 7\n ? pbf.readBoolean()\n : null;\n }\n return value;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// This code is forked from https://github.com/mapbox/vector-tile-js under BSD 3-clause license.\nimport { VectorTileLayer } from \"./vector-tile-layer.js\";\nexport class VectorTile {\n layers;\n constructor(pbf, end) {\n this.layers = pbf.readFields(readTile, {}, end);\n }\n}\n/**\n *\n * @param tag\n * @param layers\n * @param pbf\n */\nfunction readTile(tag, layers, pbf) {\n if (tag === 3) {\n if (pbf) {\n const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);\n if (layer.length && layers) {\n layers[layer.name] = layer;\n }\n }\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// import type {MVTOptions} from './lib/types';\nimport { parseMVT } from \"./lib/parse-mvt.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.0\" !== 'undefined' ? \"4.3.0\" : 'latest';\n/**\n * Worker loader for the Mapbox Vector Tile format\n */\nexport const MVTWorkerLoader = {\n dataType: null,\n batchType: null,\n name: 'Mapbox Vector Tile',\n id: 'mvt',\n module: 'mvt',\n version: VERSION,\n // Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'\n extensions: ['mvt', 'pbf'],\n mimeTypes: [\n // https://www.iana.org/assignments/media-types/application/vnd.mapbox-vector-tile\n 'application/vnd.mapbox-vector-tile',\n 'application/x-protobuf'\n // 'application/octet-stream'\n ],\n worker: true,\n category: 'geometry',\n options: {\n mvt: {\n shape: 'geojson',\n coordinates: 'local',\n layerProperty: 'layerName',\n layers: undefined,\n tileIndex: undefined\n }\n }\n};\n/**\n * Loader for the Mapbox Vector Tile format\n */\nexport const MVTLoader = {\n ...MVTWorkerLoader,\n parse: async (arrayBuffer, options) => parseMVT(arrayBuffer, options),\n parseSync: parseMVT,\n binary: true\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { DataSource, resolvePath } from '@loaders.gl/loader-utils';\nimport { ImageLoader, getBinaryImageMetadata } from '@loaders.gl/images';\nimport { MVTLoader, TileJSONLoader } from '@loaders.gl/mvt';\n/** Creates an MVTTileSource */\nexport const MVTSource = {\n name: 'MVT',\n id: 'mvt',\n module: 'mvt',\n version: '0.0.0',\n extensions: ['mvt'],\n mimeTypes: ['application/octet-stream'],\n options: {\n mvt: {\n // TODO - add options here\n }\n },\n type: 'mvt',\n fromUrl: true,\n fromBlob: false,\n testURL: (url) => true,\n createDataSource(url, props) {\n return new MVTTileSource(url, props);\n }\n};\n/**\n * MVT data source for Mapbox Vector Tiles v1.\n */\n/**\n * A PMTiles data source\n * @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.\n */\nexport class MVTTileSource extends DataSource {\n props;\n url;\n metadataUrl = null;\n data;\n schema = 'tms';\n metadata;\n extension;\n mimeType = null;\n constructor(url, props) {\n super(props);\n this.props = props;\n this.url = resolvePath(url);\n this.metadataUrl = props.mvt?.metadataUrl || `${this.url}/tilejson.json`;\n this.extension = props.mvt?.extension || '.png';\n this.data = this.url;\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\n if (isURLTemplate(this.url)) {\n this.schema = 'template';\n }\n }\n // @ts-ignore - Metadata type misalignment\n async getMetadata() {\n if (!this.metadataUrl) {\n return null;\n }\n let response;\n try {\n // Annoyingly, on CORS errors, fetch doesn't use the response status/ok mechanism but instead throws\n // CORS errors are common when requesting an unavailable sub resource such as a metadata file or an unavailable tile)\n response = await this.fetch(this.metadataUrl);\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.error(error.message);\n return null;\n }\n if (!response.ok) {\n // eslint-disable-next-line no-console\n console.error(response.statusText);\n return null;\n }\n const tileJSON = await response.text();\n const metadata = TileJSONLoader.parseTextSync?.(tileJSON) || null;\n // TODO add metadata attributions\n // metadata.attributions = [...this.props.attributions, ...(metadata.attributions || [])];\n // if (metadata?.mimeType) {\n // this.mimeType = metadata?.tileMIMEType;\n // }\n return metadata;\n }\n getTileMIMEType() {\n return this.mimeType;\n }\n async getTile(parameters) {\n const { x, y, z } = parameters;\n const tileUrl = this.getTileURL(x, y, z);\n const response = await this.fetch(tileUrl);\n if (!response.ok) {\n return null;\n }\n const arrayBuffer = await response.arrayBuffer();\n return arrayBuffer;\n }\n // Tile Source interface implementation: deck.gl compatible API\n // TODO - currently only handles image tiles, not vector tiles\n async getTileData(parameters) {\n const { x, y, z } = parameters.index;\n // const metadata = await this.metadata;\n // mimeType = metadata?.tileMIMEType || 'application/vnd.mapbox-vector-tile';\n const arrayBuffer = await this.getTile({ x, y, z, layers: [] });\n if (arrayBuffer === null) {\n return null;\n }\n const imageMetadata = getBinaryImageMetadata(arrayBuffer);\n this.mimeType =\n this.mimeType || imageMetadata?.mimeType || 'application/vnd.mapbox-vector-tile';\n switch (this.mimeType) {\n case 'application/vnd.mapbox-vector-tile':\n return await this._parseVectorTile(arrayBuffer, { x, y, z, layers: [] });\n default:\n return await this._parseImageTile(arrayBuffer);\n }\n }\n // ImageTileSource interface implementation\n async getImageTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n return arrayBuffer ? this._parseImageTile(arrayBuffer) : null;\n }\n async _parseImageTile(arrayBuffer) {\n return await ImageLoader.parse(arrayBuffer, this.loadOptions);\n }\n // VectorTileSource interface implementation\n async getVectorTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n return arrayBuffer ? this._parseVectorTile(arrayBuffer, tileParams) : null;\n }\n async _parseVectorTile(arrayBuffer, tileParams) {\n const loadOptions = {\n shape: 'geojson-table',\n mvt: {\n coordinates: 'wgs84',\n tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },\n ...this.loadOptions?.mvt\n },\n ...this.loadOptions\n };\n return await MVTLoader.parse(arrayBuffer, loadOptions);\n }\n getMetadataUrl() {\n return this.metadataUrl;\n }\n getTileURL(x, y, z) {\n switch (this.schema) {\n case 'xyz':\n return `${this.url}/${x}/${y}/${z}${this.extension}`;\n case 'tms':\n return `${this.url}/${z}/${x}/${y}${this.extension}`;\n case 'template':\n return getURLFromTemplate(this.url, x, y, z, '0');\n default:\n throw new Error(this.schema);\n }\n }\n}\nexport function isURLTemplate(s) {\n return /(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(s);\n}\nconst xRegex = new RegExp('{x}', 'g');\nconst yRegex = new RegExp('{y}', 'g');\nconst zRegex = new RegExp('{z}', 'g');\n/**\n * Get a URL from a URL template\n * @note copied from deck.gl/modules/geo-layers/src/tileset-2d/utils.ts\n * @param template - URL template\n * @param x - tile x coordinate\n * @param y - tile y coordinate\n * @param z - tile z coordinate\n * @param id - tile id\n * @returns URL\n */\nexport function getURLFromTemplate(template, x, y, z, id = '0') {\n if (Array.isArray(template)) {\n const i = stringHash(id) % template.length;\n template = template[i];\n }\n let url = template;\n url = url.replace(xRegex, String(x));\n url = url.replace(yRegex, String(y));\n url = url.replace(zRegex, String(z));\n // Back-compatible support for {-y}\n if (Number.isInteger(y) && Number.isInteger(z)) {\n url = url.replace(/\\{-y\\}/g, String(Math.pow(2, z) - y - 1));\n }\n return url;\n}\nfunction stringHash(s) {\n return Math.abs(s.split('').reduce((a, b) => ((a << 5) - a + b.charCodeAt(0)) | 0, 0));\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND ISC\n// Copyright (c) vis.gl contributors\n// Based on https://github.com/mapbox/geojson-vt under compatible ISC license\nimport { log } from '@loaders.gl/loader-utils';\nimport { deduceTableSchema } from '@loaders.gl/schema';\nimport { Stats, Stat } from '@probe.gl/stats';\nimport { createProtoTile } from \"./lib/vector-tiler/proto-tile.js\";\nimport { transformTile } from \"./lib/vector-tiler/transform-tile.js\"; // coordinate transformation\nimport { convertTileToGeoJSON } from \"./lib/vector-tiler/tile-to-geojson.js\"; // tile clipping and wrapping\nimport { convertFeaturesToProtoFeature } from \"./lib/vector-tiler/features/convert-feature.js\";\nimport { clipFeatures } from \"./lib/vector-tiler/features/clip-features.js\"; // stripe clipping algorithm\nimport { wrapFeatures } from \"./lib/vector-tiler/features/wrap-features.js\"; // date line processing\n/** Options to configure tiling */\nexport const TableTileSource = {\n name: 'TableTiler',\n id: 'table-tiler',\n version: '0.0.0',\n extensions: ['mvt'],\n mimeTypes: ['application/octet-stream'],\n options: {\n table: {\n coordinates: 'local',\n promoteId: undefined,\n maxZoom: 14,\n indexMaxZoom: 5,\n maxPointsPerTile: 10000,\n tolerance: 3,\n extent: 4096,\n buffer: 64,\n generateId: undefined\n }\n },\n type: 'table',\n testURL: (url) => url.endsWith('.geojson'),\n createDataSource(url, options) {\n const needsLoading = typeof url === 'string' || url instanceof Blob;\n const loader = options?.table?.loaders?.[0];\n const tablePromise = needsLoading ? loadTable(url, loader) : url;\n return new DynamicVectorTileSource(tablePromise, options);\n }\n // @ts-expect-error\n};\nasync function loadTable(url, loader) {\n if (typeof url === 'string') {\n const response = await fetch(url);\n const data = await response.arrayBuffer();\n return (await loader.parse(data));\n }\n const data = await url.arrayBuffer();\n return (await loader.parse(data)); // options.loaders, options.loadOptions)\n}\n/**\n * Dynamically vector tiles a table (the table needs a geometry column)\n * - Tiles are generated when requested.\n * - Each tile contains a tables of clipped features.\n *\n * @note - Currently only accepts `GeoJSONTable` tables\n * @note - Currently only outputs `GeoJSONTable`\n * @note - (can be initialized with a promise that resolves to GeoJSONTable).\n *\n * @todo - metadata should scan all rows to determine schema\n * @todo - metadata scan all rows to determine tilestats (field values[] etc).\n * @todo - handle binary input tables\n * @todo - generate binary output tables\n * @todo - how does TileSourceLayer specify coordinates / decided which layer to render with\n */\nexport class DynamicVectorTileSource {\n /** Global stats for all DynamicVectorTileSources */\n static stats = new Stats({\n id: 'table-tile-source-all',\n stats: [new Stat('count', 'tiles'), new Stat('count', 'features')]\n });\n /** Stats for this DynamicVectorTileSource */\n stats = new Stats({\n id: 'table-tile-source',\n stats: [new Stat('tiles', 'count'), new Stat('features', 'count')]\n });\n /** MIME type of the tiles emitted by this tile source */\n mimeType = 'application/vnd.mapbox-vector-tile';\n localCoordinates = true;\n /** The props that this tile source was created with */\n // @ts-expect-error\n props;\n /* Schema of the data */\n schema = null;\n /** Map of generated tiles, indexed by stringified tile coordinates */\n tiles = {};\n /** Array of tile coordinates */\n tileCoords = [];\n /** Input data has loaded, initial top-level tiling is done, sync methods can now be called */\n ready;\n /** Metadata for the tile source (generated TileJSON/tilestats */\n metadata;\n constructor(table, props) {\n // @ts-expect-error\n this.props = { ...TableTileSource.options.table, ...props?.table };\n this.getTileData = this.getTileData.bind(this);\n this.ready = this.initializeTilesAsync(table);\n this.metadata = this.getMetadata();\n }\n async initializeTilesAsync(tablePromise) {\n const table = await tablePromise;\n this.schema = deduceTableSchema(table);\n this.createRootTiles(table);\n }\n async getMetadata() {\n await this.ready;\n return { schema: this.schema, minZoom: 0, maxZoom: this.props.maxZoom };\n }\n async getSchema() {\n await this.ready;\n return this.schema;\n }\n /**\n * Get a tile at the specified index\n * @param tileIndex z, x, y of tile\n * @returns\n */\n async getVectorTile(tileIndex) {\n await this.ready;\n const table = this.getTileSync(tileIndex);\n log.info(2, 'getVectorTile', tileIndex, table)();\n return table;\n }\n async getTile(tileIndex) {\n await this.ready;\n return this.getTileSync(tileIndex);\n }\n async getTileData(tileParams) {\n const { x, y, z } = tileParams.index;\n const tile = await this.getVectorTile({ x, y, z });\n return tile?.features || [];\n }\n // Implementation\n /**\n * Synchronously request a tile\n * @note Application must await `source.ready` before calling sync methods.\n */\n getTileSync(tileIndex) {\n const protoTile = this.getProtoTile(tileIndex);\n if (!protoTile) {\n return null;\n }\n return convertTileToGeoJSON(protoTile, {\n coordinates: this.props.coordinates,\n tileIndex,\n extent: this.props.extent\n });\n }\n /**\n * Create the initial tiles\n * @note the tiles stores all the features together with additional data\n */\n createRootTiles(table) {\n if (this.props.maxZoom < 0 || this.props.maxZoom > 24) {\n throw new Error('maxZoom should be in the 0-24 range');\n }\n if (this.props.promoteId && this.props.generateId) {\n throw new Error('promoteId and generateId cannot be used together.');\n }\n log.log(1, 'DynamicVectorTileSource creating root tiles', this.props)();\n // projects and adds simplification info\n log.time(1, 'preprocess table')();\n let features = convertFeaturesToProtoFeature(table, this.props);\n log.timeEnd(1, 'preprocess table')();\n // wraps features (ie extreme west and extreme east)\n log.time(1, 'generate tiles')();\n features = wrapFeatures(features, this.props);\n // start slicing from the top tile down\n if (features.length === 0) {\n log.log(1, 'DynamicVectorTileSource: no features generated')();\n return;\n }\n this.splitTile(features, 0, 0, 0);\n const rootTile = this.tiles[0];\n log.log(1, `root tile features: ${rootTile.numFeatures}, points: ${rootTile.numPoints}`)();\n log.timeEnd(1, 'generate tiles')();\n log.log(1, `DynamicVectorTileSource: tiles generated: ${this.stats.get('total').count}`, this.stats)();\n }\n /**\n * Return geojsonvt-style \"half formed\" vector tile\n * @note Application must await `source.ready` before calling sync methods.\n */\n // eslint-disable-next-line complexity, max-statements\n getProtoTile(tileIndex) {\n const { z, y } = tileIndex;\n let { x } = tileIndex;\n // z = +z;\n // x = +x;\n // y = +y;\n const { extent } = this.props;\n if (z < 0 || z > 24) {\n return null;\n }\n const z2 = 1 << z;\n x = (x + z2) & (z2 - 1); // wrapFeatures tile x coordinate\n const id = toID(z, x, y);\n if (this.tiles[id]) {\n return transformTile(this.tiles[id], extent);\n }\n log.log(log, 'drilling down to z%d-%d-%d', z, x, y)();\n let z0 = z;\n let x0 = x;\n let y0 = y;\n let parent;\n while (!parent && z0 > 0) {\n z0--;\n x0 = x0 >> 1;\n y0 = y0 >> 1;\n parent = this.tiles[toID(z0, x0, y0)];\n }\n if (!parent || !parent.sourceFeatures) {\n return null;\n }\n // if we found a parent tile containing the original geometry, we can drill down from it\n log.log(1, 'found parent tile z%d-%d-%d', z0, x0, y0)();\n log.time(1, 'drilling down')();\n this.splitTile(parent.sourceFeatures, z0, x0, y0, z, x, y);\n log.timeEnd(1, 'drilling down')();\n return this.tiles[id] ? transformTile(this.tiles[id], extent) : null;\n }\n /**\n * splits features from a parent tile to sub-tiles.\n * @param z, x, and y are the coordinates of the parent tile\n * @param cz, cx, and cy are the coordinates of the target tile\n *\n * If no target tile is specified, splitting stops when we reach the maximum\n * zoom or the number of points is low as specified in the props.\n */\n // eslint-disable-next-line max-params, max-statements, complexity\n splitTile(features, z, x, y, cz, cx, cy) {\n const stack = [features, z, x, y];\n // avoid recursion by using a processing queue\n while (stack.length) {\n y = stack.pop();\n x = stack.pop();\n z = stack.pop();\n features = stack.pop();\n const z2 = 1 << z;\n const id = toID(z, x, y);\n let tile = this.tiles[id];\n if (!tile) {\n log.time(2, 'tile creation')();\n tile = this.tiles[id] = createProtoTile(features, z, x, y, this.props);\n this.tileCoords.push({ z, x, y });\n const key = `z${z}`;\n let stat = this.stats.get(key, 'count');\n stat.incrementCount();\n stat = this.stats.get('total');\n stat.incrementCount();\n stat = DynamicVectorTileSource.stats.get(key, 'count');\n stat.incrementCount();\n stat = DynamicVectorTileSource.stats.get('total');\n stat.incrementCount();\n log.log(2, 'tile z%d-%d-%d (features: %d, points: %d, simplified: %d)', z, x, y, tile.numFeatures, tile.numPoints, tile.numSimplified)();\n log.timeEnd(2, 'tile creation')();\n }\n // save reference to original geometry in tile so that we can drill down later if we stop now\n tile.sourceFeatures = features;\n /* eslint-disable no-continue */\n // if it's the first-pass tiling\n if (cz === undefined) {\n // stop tiling if we reached max zoom, or if the tile is too simple\n if (z === this.props.indexMaxZoom || tile.numPoints <= this.props.maxPointsPerTile) {\n continue;\n }\n // if a drilldown to a specific tile\n }\n else if (z === this.props.maxZoom || z === cz) {\n // stop tiling if we reached base zoom or our target tile zoom\n continue;\n }\n else if (cz !== undefined) {\n // stop tiling if it's not an ancestor of the target tile\n const zoomSteps = cz - z;\n // @ts-expect-error TODO fix the types of cx cy\n if (x !== cx >> zoomSteps || y !== cy >> zoomSteps) {\n continue;\n }\n }\n // if we slice further down, no need to keep source geometry\n tile.sourceFeatures = null;\n if (features.length === 0)\n continue;\n log.time(2, 'clipping tile')();\n // values we'll use for clipping\n const k1 = (0.5 * this.props.buffer) / this.props.extent;\n const k2 = 0.5 - k1;\n const k3 = 0.5 + k1;\n const k4 = 1 + k1;\n let tl = null;\n let bl = null;\n let tr = null;\n let br = null;\n let left = clipFeatures(features, z2, x - k1, x + k3, 0, tile.minX, tile.maxX, this.props);\n let right = clipFeatures(features, z2, x + k2, x + k4, 0, tile.minX, tile.maxX, this.props);\n // @ts-expect-error - unclear why this is needed?\n features = null;\n if (left) {\n tl = clipFeatures(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, this.props);\n bl = clipFeatures(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, this.props);\n left = null;\n }\n if (right) {\n tr = clipFeatures(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, this.props);\n br = clipFeatures(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, this.props);\n right = null;\n }\n log.timeEnd(2, 'clipping tile')();\n stack.push(tl || [], z + 1, x * 2, y * 2);\n stack.push(bl || [], z + 1, x * 2, y * 2 + 1);\n stack.push(tr || [], z + 1, x * 2 + 1, y * 2);\n stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1);\n }\n }\n}\nfunction toID(z, x, y) {\n return ((1 << z) * y + x) * 32 + z;\n}\n/*\n\n// eslint-disable-next-line max-statements, complexity\nfunction convertToGeoJSONTable(\n vtTile: ProtoTile,\n props: {\n coordinates: 'local' | 'wgs84' | 'EPSG:4326';\n tileIndex: {x: number; y: number; z: number};\n extent: number;\n }\n): GeoJSONTable | null {\n const features: Feature[] = [];\n for (const rawFeature of vtTile.features) {\n if (!rawFeature || !rawFeature.geometry) {\n continue;\n }\n\n let type:\n | 'Point'\n | 'MultiPoint'\n | 'LineString'\n | 'MultiLineString'\n | 'Polygon'\n | 'MultiPolygon';\n\n let coordinates: any;\n\n // raw geometry\n switch (rawFeature.type) {\n case 1:\n if (rawFeature.geometry.length === 1) {\n type = 'Point';\n coordinates = rawFeature.geometry[0];\n } else {\n type = 'MultiPoint';\n coordinates = rawFeature.geometry;\n }\n break;\n case 2:\n if (rawFeature.geometry.length === 1) {\n type = 'LineString';\n coordinates = rawFeature.geometry[0];\n } else {\n type = 'MultiLineString';\n coordinates = rawFeature.geometry;\n }\n break;\n case 3:\n if (rawFeature.geometry.length > 1) {\n type = 'MultiPolygon';\n coordinates = [rawFeature.geometry];\n } else {\n type = 'Polygon';\n coordinates = rawFeature.geometry;\n }\n break;\n default:\n continue;\n }\n\n switch (props.coordinates) {\n case 'EPSG:4326':\n case 'wgs84':\n projectToLngLat(coordinates, props.tileIndex, props.extent);\n break;\n\n case 'local':\n convertToLocalCoordinates(coordinates, props.extent);\n break;\n\n default:\n throw new Error(`Unsupported CRS ${props.coordinates}`);\n }\n\n const feature: Feature = {\n type: 'Feature',\n geometry: {\n type,\n coordinates\n },\n properties: rawFeature.tags || {},\n id: rawFeature.id\n };\n\n features.push(feature);\n }\n\n if (features.length === 0) {\n return null;\n }\n\n const table: GeoJSONTable = {\n shape: 'geojson-table',\n type: 'FeatureCollection',\n features\n };\n\n return table;\n}\n*/\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n/**\n * Create a tile from features and tile index\n */\nexport function createProtoTile(features, z, tx, ty, options) {\n const tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);\n const tile = {\n protoFeatures: [],\n sourceFeatures: null,\n numPoints: 0,\n numSimplified: 0,\n numFeatures: features.length,\n x: tx,\n y: ty,\n z,\n transformed: false,\n minX: 2,\n minY: 1,\n maxX: -1,\n maxY: 0\n };\n for (const feature of features) {\n addProtoFeature(tile, feature, tolerance, options);\n }\n return tile;\n}\n// eslint-disable-next-line complexity, max-statements\nfunction addProtoFeature(tile, feature, tolerance, options) {\n const geometry = feature.geometry;\n const type = feature.type;\n const simplifiedGeometry = [];\n tile.minX = Math.min(tile.minX, feature.minX);\n tile.minY = Math.min(tile.minY, feature.minY);\n tile.maxX = Math.max(tile.maxX, feature.maxX);\n tile.maxY = Math.max(tile.maxY, feature.maxY);\n let simplifiedType;\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n simplifiedType = 1;\n for (let i = 0; i < geometry.length; i += 3) {\n simplifiedGeometry.push(geometry[i], geometry[i + 1]);\n tile.numPoints++;\n tile.numSimplified++;\n }\n break;\n case 'LineString':\n simplifiedType = 2;\n addProtoLine(simplifiedGeometry, geometry, tile, tolerance, false, false);\n break;\n case 'MultiLineString':\n simplifiedType = 2;\n for (let i = 0; i < geometry.length; i++) {\n addProtoLine(simplifiedGeometry, geometry[i], tile, tolerance, false, i === 0);\n }\n break;\n case 'Polygon':\n simplifiedType = 3;\n for (let i = 0; i < geometry.length; i++) {\n addProtoLine(simplifiedGeometry, geometry[i], tile, tolerance, true, i === 0);\n }\n break;\n case 'MultiPolygon':\n simplifiedType = 3;\n for (let k = 0; k < geometry.length; k++) {\n const polygon = geometry[k];\n for (let i = 0; i < polygon.length; i++) {\n addProtoLine(simplifiedGeometry, polygon[i], tile, tolerance, true, i === 0);\n }\n }\n break;\n default:\n throw new Error(`Unknown geometry type: ${type}`);\n }\n if (simplifiedGeometry.length) {\n let tags = feature.tags || null;\n if (type === 'LineString' && options.lineMetrics) {\n tags = {};\n for (const key in feature.tags) {\n tags[key] = feature.tags[key];\n }\n // @ts-expect-error adding fields to arrays\n // eslint-disable-next-line camelcase\n tags.mapbox_clip_start = geometry.start / geometry.size;\n // @ts-expect-error adding fields to arrays\n // eslint-disable-next-line camelcase\n tags.mapbox_clip_end = geometry.end / geometry.size;\n }\n const tileFeature = {\n geometry: simplifiedGeometry,\n simplifiedType,\n // @ts-expect-error\n tags\n };\n if (feature.id !== null) {\n tileFeature.id = feature.id;\n }\n tile.protoFeatures.push(tileFeature);\n }\n}\n// eslint-disable-next-line max-params, max-statements\nfunction addProtoLine(result, geometry, tile, tolerance, isPolygon, isOuter) {\n const sqTolerance = tolerance * tolerance;\n if (tolerance > 0 && geometry.size < (isPolygon ? sqTolerance : tolerance)) {\n tile.numPoints += geometry.length / 3;\n return;\n }\n const ring = [];\n for (let i = 0; i < geometry.length; i += 3) {\n if (tolerance === 0 || geometry[i + 2] > sqTolerance) {\n tile.numSimplified++;\n ring.push(geometry[i], geometry[i + 1]);\n }\n tile.numPoints++;\n }\n if (isPolygon)\n rewind(ring, isOuter);\n result.push(ring);\n}\nfunction rewind(ring, clockwise) {\n let area = 0;\n for (let i = 0, j = ring.length - 2; i < ring.length; j = i, i += 2) {\n area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]);\n }\n if (area > 0 === clockwise) {\n for (let i = 0, len = ring.length; i < len / 2; i += 2) {\n const x = ring[i];\n const y = ring[i + 1];\n ring[i] = ring[len - 2 - i];\n ring[i + 1] = ring[len - 1 - i];\n ring[len - 2 - i] = x;\n ring[len - 1 - i] = y;\n }\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n/**\n * Transforms the coordinates of each protoFeature in the given protoTile from\n * mercator-projected space into (extent x extent) protoTile space.\n */\nexport function transformTile(protoTile, extent) {\n if (protoTile.transformed) {\n return protoTile;\n }\n const z2 = 1 << protoTile.z;\n const tx = protoTile.x;\n const ty = protoTile.y;\n for (const protoFeature of protoTile.protoFeatures) {\n const geom = protoFeature.geometry;\n const simplifiedType = protoFeature.simplifiedType;\n protoFeature.geometry = [];\n if (simplifiedType === 1) {\n for (let j = 0; j < geom.length; j += 2) {\n protoFeature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));\n }\n }\n else {\n for (let j = 0; j < geom.length; j++) {\n const ring = [];\n for (let k = 0; k < geom[j].length; k += 2) {\n ring.push(transformPoint(geom[j][k], geom[j][k + 1], extent, z2, tx, ty));\n }\n protoFeature.geometry.push(ring);\n }\n }\n }\n protoTile.transformed = true;\n return protoTile;\n}\n// eslint-disable-next-line max-params\nfunction transformPoint(x, y, extent, z2, tx, ty) {\n return [Math.round(extent * (x * z2 - tx)), Math.round(extent * (y * z2 - ty))];\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\nimport { projectToLngLat, convertToLocalCoordinates } from \"../utils/geometry-utils.js\";\n// eslint-disable-next-line max-statements, complexity\nexport function convertTileToGeoJSON(protoTile, props) {\n const features = [];\n for (const rawFeature of protoTile.protoFeatures) {\n if (!rawFeature || !rawFeature.geometry) {\n // eslint-disable-next-line no-continue\n continue;\n }\n let type;\n let coordinates;\n // raw geometry\n switch (rawFeature.simplifiedType) {\n case 1:\n if (rawFeature.geometry.length === 1) {\n type = 'Point';\n coordinates = rawFeature.geometry[0];\n }\n else {\n type = 'MultiPoint';\n coordinates = rawFeature.geometry;\n }\n break;\n case 2:\n if (rawFeature.geometry.length === 1) {\n type = 'LineString';\n coordinates = rawFeature.geometry[0];\n }\n else {\n type = 'MultiLineString';\n coordinates = rawFeature.geometry;\n }\n break;\n case 3:\n if (rawFeature.geometry.length > 1) {\n type = 'MultiPolygon';\n coordinates = [rawFeature.geometry];\n }\n else {\n type = 'Polygon';\n coordinates = rawFeature.geometry;\n }\n break;\n default:\n throw new Error(`${rawFeature.simplifiedType}is not a valid simplified type`);\n }\n switch (props.coordinates) {\n case 'EPSG:4326':\n case 'wgs84':\n projectToLngLat(coordinates, props.tileIndex, props.extent);\n break;\n default:\n convertToLocalCoordinates(coordinates, props.extent);\n break;\n }\n const feature = {\n type: 'Feature',\n geometry: {\n type,\n coordinates\n },\n properties: rawFeature.tags || {},\n id: rawFeature.id\n };\n features.push(feature);\n }\n if (features.length === 0) {\n return null;\n }\n const table = {\n shape: 'geojson-table',\n type: 'FeatureCollection',\n features\n };\n return table;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\nexport function createProtoFeature(id, type, geometry, tags) {\n const feature = {\n // eslint-disable-next-line\n id: id == null ? null : id,\n type,\n simplifiedType: undefined, // TODO\n geometry,\n tags,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n };\n // TODO break out into separate function\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n case 'LineString':\n calcLineBBox(feature, geometry);\n break;\n case 'MultiLineString':\n for (const line of geometry) {\n calcLineBBox(feature, line);\n }\n break;\n case 'Polygon':\n // the outer ring (ie [0]) contains all inner rings\n calcLineBBox(feature, geometry[0]);\n break;\n case 'MultiPolygon':\n for (const polygon of geometry) {\n // the outer ring (ie [0]) contains all inner rings\n calcLineBBox(feature, polygon[0]);\n }\n break;\n default:\n throw new Error(String(type));\n }\n return feature;\n}\nfunction calcLineBBox(feature, geometry) {\n for (let i = 0; i < geometry.length; i += 3) {\n feature.minX = Math.min(feature.minX, geometry[i]);\n feature.minY = Math.min(feature.minY, geometry[i + 1]);\n feature.maxX = Math.max(feature.maxX, geometry[i]);\n feature.maxY = Math.max(feature.maxY, geometry[i + 1]);\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n/**\n * Calculate simplification data using optimized Douglas-Peucker algorithm\n *\n * @param coords contiguous list of coordinates\n * @param first first coord to simplify\n * @param last last coord to simplify\n * @param sqTolerance tolerance (square distance)\n */\nexport function simplifyPath(coords, first, last, sqTolerance) {\n let maxSqDist = sqTolerance;\n const mid = (last - first) >> 1;\n let minPosToMid = last - first;\n let index;\n const ax = coords[first];\n const ay = coords[first + 1];\n const bx = coords[last];\n const by = coords[last + 1];\n for (let i = first + 3; i < last; i += 3) {\n const d = getSqSegDist(coords[i], coords[i + 1], ax, ay, bx, by);\n if (d > maxSqDist) {\n index = i;\n maxSqDist = d;\n }\n else if (d === maxSqDist) {\n // a workaround to ensure we choose a pivot close to the middle of the list,\n // reducing recursion depth, for certain degenerate inputs\n // https://github.com/mapbox/geojson-vt/issues/104\n const posToMid = Math.abs(i - mid);\n if (posToMid < minPosToMid) {\n index = i;\n minPosToMid = posToMid;\n }\n }\n }\n if (maxSqDist > sqTolerance) {\n if (index - first > 3)\n simplifyPath(coords, first, index, sqTolerance);\n coords[index + 2] = maxSqDist;\n if (last - index > 3)\n simplifyPath(coords, index, last, sqTolerance);\n }\n}\n/** square distance from a point to a segment */\n// eslint-disable-next-line max-params\nfunction getSqSegDist(px, py, x, y, bx, by) {\n let dx = bx - x;\n let dy = by - y;\n if (dx !== 0 || dy !== 0) {\n const t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n x = bx;\n y = by;\n }\n else if (t > 0) {\n x += dx * t;\n y += dy * t;\n }\n }\n dx = px - x;\n dy = py - y;\n return dx * dx + dy * dy;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\nimport { createProtoFeature } from \"./proto-feature.js\";\nimport { simplifyPath } from \"./simplify-path.js\";\n/**\n * converts a GeoJSON feature into an intermediate projected JSON vector format\n * with simplification data\n */\nexport function convertFeaturesToProtoFeature(data, options) {\n const protoFeatures = [];\n switch (data.type) {\n case 'FeatureCollection':\n let i = 0;\n for (const feature of data.features) {\n protoFeatures.push(convertFeature(feature, options, i++));\n }\n break;\n case 'Feature':\n protoFeatures.push(convertFeature(data, options));\n break;\n default:\n // single geometry or a geometry collection\n protoFeatures.push(convertFeature({ geometry: data }, options));\n }\n return protoFeatures;\n}\n/**\n * converts a GeoJSON feature into an intermediate projected JSON vector format\n * with simplification data\n */\nfunction convertFeature(geojson, options, index) {\n // GeoJSON geometries can be null, but no vector tile will include them.\n if (!geojson.geometry) {\n return;\n }\n const coords = geojson.geometry.coordinates;\n const type = geojson.geometry.type;\n const tolerance = Math.pow(options.tolerance / ((1 << options.maxZoom) * options.extent), 2);\n let geometry = [];\n let id = geojson.id;\n if (options.promoteId) {\n id = geojson.properties[options.promoteId];\n }\n else if (options.generateId) {\n id = index || 0;\n }\n switch (type) {\n case 'Point':\n convertPoint(coords, geometry);\n break;\n case 'MultiPoint':\n for (const p of coords) {\n convertPoint(p, geometry);\n }\n break;\n case 'LineString':\n convertLine(coords, geometry, tolerance, false);\n break;\n case 'MultiLineString':\n if (options.lineMetrics) {\n // explode into linestrings to be able to track metrics\n for (const line of coords) {\n geometry = [];\n convertLine(line, geometry, tolerance, false);\n features.push(createProtoFeature(id, 'LineString', geometry, geojson.properties));\n }\n return;\n convertLines(coords, geometry, tolerance, false);\n }\n break;\n case 'Polygon':\n convertLines(coords, geometry, tolerance, true);\n break;\n case 'MultiPolygon':\n for (const polygon of coords) {\n const newPolygon = [];\n convertLines(polygon, newPolygon, tolerance, true);\n geometry.push(newPolygon);\n }\n break;\n case 'GeometryCollection':\n for (const singleGeometry of geojson.geometry.geometries) {\n convertFeature(features, {\n id,\n geometry: singleGeometry,\n properties: geojson.properties\n }, options, index);\n }\n break;\n default:\n throw new Error('Input data is not a valid GeoJSON object.');\n }\n return createProtoFeature(id, type, geometry, geojson.properties);\n}\nfunction convertPoint(coords, out) {\n out.push(projectX(coords[0]), projectY(coords[1]), 0);\n}\nfunction convertLine(ring, out, tolerance, isPolygon) {\n let x0, y0;\n let size = 0;\n for (let j = 0; j < ring.length; j++) {\n const x = projectX(ring[j][0]);\n const y = projectY(ring[j][1]);\n out.push(x, y, 0);\n if (j > 0) {\n if (isPolygon) {\n size += (x0 * y - x * y0) / 2; // area\n }\n else {\n size += Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2)); // length\n }\n }\n x0 = x;\n y0 = y;\n }\n const last = out.length - 3;\n out[2] = 1;\n simplifyPath(out, 0, last, tolerance);\n out[last + 2] = 1;\n out.size = Math.abs(size);\n out.start = 0;\n out.end = out.size;\n}\nfunction convertLines(rings, out, tolerance, isPolygon) {\n for (let i = 0; i < rings.length; i++) {\n const geom = [];\n convertLine(rings[i], geom, tolerance, isPolygon);\n out.push(geom);\n }\n}\nfunction projectX(x) {\n return x / 360 + 0.5;\n}\nfunction projectY(y) {\n const sin = Math.sin((y * Math.PI) / 180);\n const y2 = 0.5 - (0.25 * Math.log((1 + sin) / (1 - sin))) / Math.PI;\n return y2 < 0 ? 0 : y2 > 1 ? 1 : y2;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\nimport { createProtoFeature } from \"./proto-feature.js\";\n/* eslint-disable no-continue */\n/**\n * Clip features between two vertical or horizontal axis-parallel lines:\n * | |\n * ___|___ | /\n * / | \\____|____/\n * | |\n *\n * @param k1 and k2 are the line coordinates\n * @param axis: 0 for x, 1 for y\n * @param minAll and maxAll: minimum and maximum coordinate value for all features\n */\n// eslint-disable-next-line max-params, complexity, max-statements\nexport function clipFeatures(features, scale, k1, k2, axis, minAll, maxAll, options) {\n k1 /= scale;\n k2 /= scale;\n if (minAll >= k1 && maxAll < k2) {\n return features;\n }\n // trivial accept\n else if (maxAll < k1 || minAll >= k2) {\n return null; // trivial reject\n }\n const clipped = [];\n for (const feature of features) {\n const geometry = feature.geometry;\n let type = feature.type;\n const min = axis === 0 ? feature.minX : feature.minY;\n const max = axis === 0 ? feature.maxX : feature.maxY;\n if (min >= k1 && max < k2) {\n // trivial accept\n clipped.push(feature);\n continue;\n }\n else if (max < k1 || min >= k2) {\n // trivial reject\n continue;\n }\n let newGeometry = [];\n if (type === 'Point' || type === 'MultiPoint') {\n clipPoints(geometry, newGeometry, k1, k2, axis);\n }\n else if (type === 'LineString') {\n clipLine(geometry, newGeometry, k1, k2, axis, false, options.lineMetrics);\n }\n else if (type === 'MultiLineString') {\n clipLines(geometry, newGeometry, k1, k2, axis, false);\n }\n else if (type === 'Polygon') {\n clipLines(geometry, newGeometry, k1, k2, axis, true);\n }\n else if (type === 'MultiPolygon') {\n for (const polygon of geometry) {\n const newPolygon = [];\n clipLines(polygon, newPolygon, k1, k2, axis, true);\n if (newPolygon.length) {\n newGeometry.push(newPolygon);\n }\n }\n }\n if (newGeometry.length) {\n if (options.lineMetrics && type === 'LineString') {\n for (const line of newGeometry) {\n clipped.push(createProtoFeature(feature.id, type, line, feature.tags));\n }\n continue;\n }\n if (type === 'LineString' || type === 'MultiLineString') {\n if (newGeometry.length === 1) {\n type = 'LineString';\n // @ts-expect-error TODO - use proper GeoJSON geometry types\n newGeometry = newGeometry[0];\n }\n else {\n type = 'MultiLineString';\n }\n }\n if (type === 'Point' || type === 'MultiPoint') {\n type = newGeometry.length === 3 ? 'Point' : 'MultiPoint';\n }\n clipped.push(createProtoFeature(feature.id, type, newGeometry, feature.tags));\n }\n }\n return clipped.length ? clipped : null;\n}\nfunction clipPoints(geom, newGeom, k1, k2, axis) {\n for (let i = 0; i < geom.length; i += 3) {\n const a = geom[i + axis];\n if (a >= k1 && a <= k2) {\n addPoint(newGeom, geom[i], geom[i + 1], geom[i + 2]);\n }\n }\n}\n// eslint-disable-next-line max-params, complexity, max-statements\nfunction clipLine(geom, newGeom, k1, k2, axis, isPolygon, trackMetrics) {\n let slice = newSlice(geom);\n const intersect = axis === 0 ? intersectX : intersectY;\n let len = geom.start;\n let segLen;\n let t;\n for (let i = 0; i < geom.length - 3; i += 3) {\n const ax = geom[i];\n const ay = geom[i + 1];\n const az = geom[i + 2];\n const bx = geom[i + 3];\n const by = geom[i + 4];\n const a = axis === 0 ? ax : ay;\n const b = axis === 0 ? bx : by;\n let exited = false;\n if (trackMetrics) {\n segLen = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2));\n }\n if (a < k1) {\n // ---|--> | (line enters the clip region from the left)\n if (b > k1) {\n t = intersect(slice, ax, ay, bx, by, k1);\n if (trackMetrics) {\n slice.start = len + segLen * t;\n }\n }\n }\n else if (a > k2) {\n // | <--|--- (line enters the clip region from the right)\n if (b < k2) {\n t = intersect(slice, ax, ay, bx, by, k2);\n if (trackMetrics) {\n slice.start = len + segLen * t;\n }\n }\n }\n else {\n addPoint(slice, ax, ay, az);\n }\n if (b < k1 && a >= k1) {\n // <--|--- | or <--|-----|--- (line exits the clip region on the left)\n t = intersect(slice, ax, ay, bx, by, k1);\n exited = true;\n }\n if (b > k2 && a <= k2) {\n // | ---|--> or ---|-----|--> (line exits the clip region on the right)\n t = intersect(slice, ax, ay, bx, by, k2);\n exited = true;\n }\n if (!isPolygon && exited) {\n if (trackMetrics) {\n slice.end = len + segLen * t;\n }\n newGeom.push(slice);\n slice = newSlice(geom);\n }\n if (trackMetrics) {\n len += segLen;\n }\n }\n // add the last point\n let last = geom.length - 3;\n const ax = geom[last];\n const ay = geom[last + 1];\n const az = geom[last + 2];\n const a = axis === 0 ? ax : ay;\n if (a >= k1 && a <= k2)\n addPoint(slice, ax, ay, az);\n // close the polygon if its endpoints are not the same after clipping\n last = slice.length - 3;\n if (isPolygon && last >= 3 && (slice[last] !== slice[0] || slice[last + 1] !== slice[1])) {\n addPoint(slice, slice[0], slice[1], slice[2]);\n }\n // add the final slice\n if (slice.length) {\n newGeom.push(slice);\n }\n}\nclass Slice extends Array {\n size;\n start;\n end;\n}\nfunction newSlice(line) {\n const slice = [];\n slice.size = line.size;\n slice.start = line.start;\n slice.end = line.end;\n return slice;\n}\n// eslint-disable-next-line max-params\nfunction clipLines(geom, newGeom, k1, k2, axis, isPolygon) {\n for (const line of geom) {\n clipLine(line, newGeom, k1, k2, axis, isPolygon, false);\n }\n}\nfunction addPoint(out, x, y, z) {\n out.push(x, y, z);\n}\n// eslint-disable-next-line max-params\nfunction intersectX(out, ax, ay, bx, by, x) {\n const t = (x - ax) / (bx - ax);\n addPoint(out, x, ay + (by - ay) * t, 1);\n return t;\n}\n// eslint-disable-next-line max-params\nfunction intersectY(out, ax, ay, bx, by, y) {\n const t = (y - ay) / (by - ay);\n addPoint(out, ax + (bx - ax) * t, y, 1);\n return t;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\nimport { createProtoFeature } from \"./proto-feature.js\";\nimport { clipFeatures } from \"./clip-features.js\";\n/**\n * Wrap across antemeridian, by clipping into two tiles, shifting the overflowing x coordinates\n * @param list of features to be wrapped\n * @param options buffer and extent\n * @returns\n */\nexport function wrapFeatures(features, options) {\n const buffer = options.buffer / options.extent;\n let merged = features;\n const left = clipFeatures(features, 1, -1 - buffer, buffer, 0, -1, 2, options); // left world copy\n const right = clipFeatures(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options); // right world copy\n if (left || right) {\n merged = clipFeatures(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || []; // center world copy\n if (left) {\n merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center\n }\n if (right) {\n merged = merged.concat(shiftFeatureCoords(right, -1)); // merge right into center\n }\n }\n return merged;\n}\n/**\n * Shift the x coordinates of a list of features\n * @param features list of features to shift x coordinates for\n * @param offset\n * @returns\n */\nfunction shiftFeatureCoords(features, offset) {\n const newFeatures = [];\n for (let i = 0; i < features.length; i++) {\n const feature = features[i];\n const type = feature.type;\n let newGeometry;\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n case 'LineString':\n newGeometry = shiftCoords(feature.geometry, offset);\n break;\n case 'MultiLineString':\n case 'Polygon':\n newGeometry = [];\n for (const line of feature.geometry) {\n newGeometry.push(shiftCoords(line, offset));\n }\n break;\n case 'MultiPolygon':\n newGeometry = [];\n for (const polygon of feature.geometry) {\n const newPolygon = [];\n for (const line of polygon) {\n // @ts-expect-error TODO\n newPolygon.push(shiftCoords(line, offset));\n }\n newGeometry.push(newPolygon);\n }\n break;\n default:\n throw new Error(String(type));\n }\n newFeatures.push(createProtoFeature(feature.id, type, newGeometry, feature.tags));\n }\n return newFeatures;\n}\nclass Points extends Array {\n size;\n start;\n end;\n}\n/**\n * Shift the x coordinate of every point\n * @param points\n * @param offset\n * @returns\n */\nfunction shiftCoords(points, offset) {\n const newPoints = [];\n newPoints.size = points.size;\n if (points.start !== undefined) {\n newPoints.start = points.start;\n newPoints.end = points.end;\n }\n for (let i = 0; i < points.length; i += 3) {\n newPoints.push(points[i] + offset, points[i + 1], points[i + 2]);\n }\n return newPoints;\n}\n"],
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// TileJSONLoader\nexport { TileJSONLoader } from \"./tilejson-loader.js\";\n// MVTLoader\nexport { MVTLoader, MVTWorkerLoader } from \"./mvt-loader.js\";\n// MVTSource\nexport { MVTSource } from \"./mvt-source.js\";\n// TableTileSource (dynamically tiles a table)\nexport { TableTileSource } from \"./table-tile-source.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// LAYERS\nexport function getSchemaFromTileJSONLayer(layer) {\n const fields = [];\n if (layer.fields) {\n for (const field of layer.fields) {\n fields.push({\n name: field.name,\n type: getDataTypeFromTileJSONField(field),\n metadata: getMetadataFromTileJSONField(field)\n });\n }\n }\n return {\n metadata: getMetadataFromTileJSONLayer(layer),\n fields\n };\n}\nfunction getMetadataFromTileJSONLayer(layer) {\n const metadata = {};\n for (const [key, value] of Object.entries(layer)) {\n if (key !== 'fields' && value) {\n metadata[key] = JSON.stringify(value);\n }\n }\n return metadata;\n}\n// FIELDS\nfunction getDataTypeFromTileJSONField(field) {\n switch (field.type.toLowerCase()) {\n case 'float32':\n return 'float32';\n case 'number':\n case 'float64':\n return 'float64';\n case 'string':\n case 'utf8':\n return 'utf8';\n case 'boolean':\n return 'bool';\n default:\n return 'null';\n }\n}\nfunction getMetadataFromTileJSONField(field) {\n const metadata = {};\n for (const [key, value] of Object.entries(field)) {\n if (key !== 'name' && value) {\n metadata[key] = JSON.stringify(value);\n }\n }\n return metadata;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getSchemaFromTileJSONLayer } from \"./get-schemas-from-tilejson.js\";\nconst isObject = (x) => x !== null && typeof x === 'object';\n/**\n * Parse TileJSON from metadata\n * @param jsonMetadata - metadata object\n * @param options - options\n * @returns - parsed TileJSON\n */\n// eslint-disable-next-line complexity\nexport function parseTileJSON(jsonMetadata, options) {\n if (!jsonMetadata || !isObject(jsonMetadata)) {\n return null;\n }\n let tileJSON = {\n name: jsonMetadata.name || '',\n description: jsonMetadata.description || ''\n };\n // tippecanoe\n if (typeof jsonMetadata.generator === 'string') {\n tileJSON.generator = jsonMetadata.generator;\n }\n if (typeof jsonMetadata.generator_options === 'string') {\n tileJSON.generatorOptions = jsonMetadata.generator_options;\n }\n // Tippecanoe emits `antimeridian_adjusted_bounds` instead of `bounds`\n tileJSON.boundingBox =\n parseBounds(jsonMetadata.bounds) || parseBounds(jsonMetadata.antimeridian_adjusted_bounds);\n // TODO - can be undefined - we could set to center of bounds...\n tileJSON.center = parseCenter(jsonMetadata.center);\n // TODO - can be undefined, we could extract from layers...\n tileJSON.maxZoom = safeParseFloat(jsonMetadata.maxzoom);\n // TODO - can be undefined, we could extract from layers...\n tileJSON.minZoom = safeParseFloat(jsonMetadata.minzoom);\n // Look for nested metadata embedded in .json field\n // TODO - document what source this applies to, when is this needed?\n if (typeof jsonMetadata?.json === 'string') {\n // try to parse json\n try {\n tileJSON.metaJson = JSON.parse(jsonMetadata.json);\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Failed to parse tilejson.json field', error);\n // do nothing\n }\n }\n // Look for fields in tilestats\n const tilestats = jsonMetadata.tilestats || tileJSON.metaJson?.tilestats;\n const tileStatsLayers = parseTilestatsLayers(tilestats, options);\n const tileJSONlayers = parseTileJSONLayers(jsonMetadata.vector_layers); // eslint-disable-line camelcase\n // TODO - merge in description from tilejson\n const layers = mergeLayers(tileJSONlayers, tileStatsLayers);\n tileJSON = {\n ...tileJSON,\n layers\n };\n if (tileJSON.maxZoom === null && layers.length > 0) {\n tileJSON.maxZoom = layers[0].maxZoom || null;\n }\n if (tileJSON.minZoom === null && layers.length > 0) {\n tileJSON.minZoom = layers[0].minZoom || null;\n }\n return tileJSON;\n}\nfunction parseTileJSONLayers(layers) {\n // Look for fields in vector_layers\n if (!Array.isArray(layers)) {\n return [];\n }\n return layers.map((layer) => parseTileJSONLayer(layer));\n}\nfunction parseTileJSONLayer(layer) {\n const fields = Object.entries(layer.fields || []).map(([key, datatype]) => ({\n name: key,\n ...attributeTypeToFieldType(String(datatype))\n }));\n const layer2 = { ...layer };\n delete layer2.fields;\n return {\n name: layer.id || '',\n ...layer2,\n fields\n };\n}\n/** parse Layers array from tilestats */\nfunction parseTilestatsLayers(tilestats, options) {\n if (isObject(tilestats) && Array.isArray(tilestats.layers)) {\n // we are in luck!\n return tilestats.layers.map((layer) => parseTilestatsForLayer(layer, options));\n }\n return [];\n}\nfunction parseTilestatsForLayer(layer, options) {\n const fields = [];\n const indexedAttributes = {};\n const attributes = layer.attributes || [];\n for (const attribute of attributes) {\n const name = attribute.attribute;\n if (typeof name === 'string') {\n // TODO - code copied from kepler.gl, need sample tilestats files to test\n if (name.split('|').length > 1) {\n // indexed field\n const fname = name.split('|')[0];\n indexedAttributes[fname] = indexedAttributes[fname] || [];\n indexedAttributes[fname].push(attribute);\n // eslint-disable-next-line no-console\n console.warn('ignoring tilestats indexed field', fname);\n }\n else if (!fields[name]) {\n fields.push(attributeToField(attribute, options));\n }\n else {\n // return (fields[name], attribute);\n }\n }\n }\n return {\n name: layer.layer || '',\n dominantGeometry: layer.geometry,\n fields\n };\n}\nfunction mergeLayers(layers, tilestatsLayers) {\n return layers.map((layer) => {\n const tilestatsLayer = tilestatsLayers.find((tsLayer) => tsLayer.name === layer.name);\n const fields = tilestatsLayer?.fields || layer.fields || [];\n const mergedLayer = {\n ...layer,\n ...tilestatsLayer,\n fields\n };\n mergedLayer.schema = getSchemaFromTileJSONLayer(mergedLayer);\n return mergedLayer;\n });\n}\n/**\n * bounds should be [minLng, minLat, maxLng, maxLat]\n *`[[w, s], [e, n]]`, indicates the limits of the bounding box using the axis units and order of the specified CRS.\n */\nfunction parseBounds(bounds) {\n // supported formats\n // string: \"-96.657715,40.126127,-90.140061,43.516689\",\n // array: [ -180, -85.05112877980659, 180, 85.0511287798066 ]\n const result = fromArrayOrString(bounds);\n // validate bounds\n if (Array.isArray(result) &&\n result.length === 4 &&\n [result[0], result[2]].every(isLng) &&\n [result[1], result[3]].every(isLat)) {\n return [\n [result[0], result[1]],\n [result[2], result[3]]\n ];\n }\n return undefined;\n}\nfunction parseCenter(center) {\n // supported formats\n // string: \"-96.657715,40.126127,-90.140061,43.516689\",\n // array: [-91.505127,41.615442,14]\n const result = fromArrayOrString(center);\n if (Array.isArray(result) &&\n result.length === 3 &&\n isLng(result[0]) &&\n isLat(result[1]) &&\n isZoom(result[2])) {\n return result;\n }\n return null;\n}\nfunction safeParseFloat(input) {\n const result = typeof input === 'string' ? parseFloat(input) : typeof input === 'number' ? input : null;\n return result === null || isNaN(result) ? null : result;\n}\n// https://github.com/mapbox/tilejson-spec/tree/master/2.2.0\nfunction isLat(num) {\n return Number.isFinite(num) && num <= 90 && num >= -90;\n}\nfunction isLng(num) {\n return Number.isFinite(num) && num <= 180 && num >= -180;\n}\nfunction isZoom(num) {\n return Number.isFinite(num) && num >= 0 && num <= 22;\n}\nfunction fromArrayOrString(data) {\n if (typeof data === 'string') {\n return data.split(',').map(parseFloat);\n }\n else if (Array.isArray(data)) {\n return data;\n }\n return null;\n}\n// possible types https://github.com/mapbox/tippecanoe#modifying-feature-attributes\nconst attrTypeMap = {\n number: {\n type: 'float32'\n },\n numeric: {\n type: 'float32'\n },\n string: {\n type: 'utf8'\n },\n vachar: {\n type: 'utf8'\n },\n float: {\n type: 'float32'\n },\n int: {\n type: 'int32'\n },\n int4: {\n type: 'int32'\n },\n boolean: {\n type: 'boolean'\n },\n bool: {\n type: 'boolean'\n }\n};\nfunction attributeToField(attribute = {}, options) {\n const fieldTypes = attributeTypeToFieldType(attribute.type);\n const field = {\n name: attribute.attribute,\n // what happens if attribute type is string...\n // filterProps: getFilterProps(fieldTypes.type, attribute),\n ...fieldTypes\n };\n // attribute: \"_season_peaks_color\"\n // count: 1000\n // max: 0.95\n // min: 0.24375\n // type: \"number\"\n if (typeof attribute.min === 'number') {\n field.min = attribute.min;\n }\n if (typeof attribute.max === 'number') {\n field.max = attribute.max;\n }\n if (typeof attribute.count === 'number') {\n field.uniqueValueCount = attribute.count;\n }\n if (attribute.values) {\n // Too much data? Add option?\n field.values = attribute.values;\n }\n if (field.values && typeof options.maxValues === 'number') {\n // Too much data? Add option?\n field.values = field.values?.slice(0, options.maxValues);\n }\n return field;\n}\nfunction attributeTypeToFieldType(aType) {\n const type = aType.toLowerCase();\n if (!type || !attrTypeMap[type]) {\n // console.warn(\n // `cannot convert attribute type ${type} to loaders.gl data type, use string by default`\n // );\n }\n return attrTypeMap[type] || { type: 'string' };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { parseTileJSON } from \"./lib/parse-tilejson.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.1\" !== 'undefined' ? \"4.3.1\" : 'latest';\n/**\n * Loader for TileJSON metadata\n */\nexport const TileJSONLoader = {\n dataType: null,\n batchType: null,\n name: 'TileJSON',\n id: 'tilejson',\n module: 'pmtiles',\n version: VERSION,\n worker: true,\n extensions: ['json'],\n mimeTypes: ['application/json'],\n text: true,\n options: {\n tilejson: {\n maxValues: undefined\n }\n },\n parse: async (arrayBuffer, options) => {\n const jsonString = new TextDecoder().decode(arrayBuffer);\n const json = JSON.parse(jsonString);\n const tilejsonOptions = { ...TileJSONLoader.options.tilejson, ...options?.tilejson };\n return parseTileJSON(json, tilejsonOptions);\n },\n parseTextSync: (text, options) => {\n const json = JSON.parse(text);\n const tilejsonOptions = { ...TileJSONLoader.options.tilejson, ...options?.tilejson };\n return parseTileJSON(json, tilejsonOptions);\n }\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { flatGeojsonToBinary } from '@loaders.gl/gis';\nimport { log } from '@loaders.gl/loader-utils';\nimport Protobuf from 'pbf';\nimport { VectorTile } from \"./vector-tile/vector-tile.js\";\n/**\n * Parse MVT arrayBuffer and return GeoJSON.\n *\n * @param arrayBuffer A MVT arrayBuffer\n * @param options\n * @returns A GeoJSON geometry object or a binary representation\n */\nexport function parseMVT(arrayBuffer, options) {\n const mvtOptions = checkOptions(options);\n const shape = options?.gis?.format || options?.mvt?.shape || options?.shape;\n switch (shape) {\n case 'columnar-table': // binary + some JS arrays\n return { shape: 'columnar-table', data: parseToBinary(arrayBuffer, mvtOptions) };\n case 'geojson-table': {\n const table = {\n shape: 'geojson-table',\n type: 'FeatureCollection',\n features: parseToGeojsonFeatures(arrayBuffer, mvtOptions)\n };\n return table;\n }\n case 'geojson':\n return parseToGeojsonFeatures(arrayBuffer, mvtOptions);\n case 'binary-geometry':\n return parseToBinary(arrayBuffer, mvtOptions);\n case 'binary':\n return parseToBinary(arrayBuffer, mvtOptions);\n default:\n throw new Error(shape || 'undefined shape');\n }\n}\nfunction parseToBinary(arrayBuffer, options) {\n const [flatGeoJsonFeatures, geometryInfo] = parseToFlatGeoJson(arrayBuffer, options);\n const binaryData = flatGeojsonToBinary(flatGeoJsonFeatures, geometryInfo);\n // Add the original byteLength (as a reasonable approximation of the size of the binary data)\n // TODO decide where to store extra fields like byteLength (header etc) and document\n // @ts-ignore\n binaryData.byteLength = arrayBuffer.byteLength;\n return binaryData;\n}\nfunction parseToFlatGeoJson(arrayBuffer, options) {\n const features = [];\n const geometryInfo = {\n coordLength: 2,\n pointPositionsCount: 0,\n pointFeaturesCount: 0,\n linePositionsCount: 0,\n linePathsCount: 0,\n lineFeaturesCount: 0,\n polygonPositionsCount: 0,\n polygonObjectsCount: 0,\n polygonRingsCount: 0,\n polygonFeaturesCount: 0\n };\n if (arrayBuffer.byteLength <= 0) {\n return [features, geometryInfo];\n }\n const tile = new VectorTile(new Protobuf(arrayBuffer));\n const selectedLayers = options && Array.isArray(options.layers) ? options.layers : Object.keys(tile.layers);\n selectedLayers.forEach((layerName) => {\n const vectorTileLayer = tile.layers[layerName];\n if (!vectorTileLayer) {\n return;\n }\n for (let i = 0; i < vectorTileLayer.length; i++) {\n const vectorTileFeature = vectorTileLayer.getBinaryFeature(i, geometryInfo);\n const decodedFeature = getDecodedFeatureBinary(vectorTileFeature, options, layerName);\n features.push(decodedFeature);\n }\n });\n return [features, geometryInfo];\n}\nfunction parseToGeojsonFeatures(arrayBuffer, options) {\n if (arrayBuffer.byteLength <= 0) {\n return [];\n }\n const features = [];\n const tile = new VectorTile(new Protobuf(arrayBuffer));\n const selectedLayers = Array.isArray(options.layers) ? options.layers : Object.keys(tile.layers);\n selectedLayers.forEach((layerName) => {\n const vectorTileLayer = tile.layers[layerName];\n if (!vectorTileLayer) {\n return;\n }\n for (let i = 0; i < vectorTileLayer.length; i++) {\n const vectorTileFeature = vectorTileLayer.getGeoJSONFeature(i);\n const decodedFeature = getDecodedFeature(vectorTileFeature, options, layerName);\n features.push(decodedFeature);\n }\n });\n return features;\n}\n/** Check that options are good */\nfunction checkOptions(options) {\n if (!options?.mvt) {\n throw new Error('mvt options required');\n }\n if (options.mvt?.coordinates === 'wgs84' && !options.mvt.tileIndex) {\n throw new Error('MVT Loader: WGS84 coordinates need tileIndex property');\n }\n if (options.gis) {\n log.warn('MVTLoader: \"options.gis\" is deprecated, use \"options.mvt.shape\" instead')();\n }\n return options.mvt;\n}\n/**\n * @param feature\n * @param options\n * @returns decoded feature\n */\nfunction getDecodedFeature(feature, options, layerName) {\n const decodedFeature = feature.toGeoJSONFeature(options.coordinates || 'local', options.tileIndex);\n // Add layer name to GeoJSON properties\n if (options.layerProperty) {\n decodedFeature.properties ||= {};\n decodedFeature.properties[options.layerProperty] = layerName;\n }\n return decodedFeature;\n}\n/**\n * @param feature\n * @param options\n * @returns decoded binary feature\n */\nfunction getDecodedFeatureBinary(feature, options, layerName) {\n const decodedFeature = feature.toBinaryFeature(options.coordinates || 'local', options.tileIndex);\n // Add layer name to GeoJSON properties\n if (options.layerProperty && decodedFeature.properties) {\n decodedFeature.properties[options.layerProperty] = layerName;\n }\n return decodedFeature;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { getPolygonSignedArea } from '@math.gl/polygon';\n/**\n *\n * @param ring\n * @returns sum\n */\nexport function signedArea(ring) {\n let sum = 0;\n for (let i = 0, j = ring.length - 1, p1, p2; i < ring.length; j = i++) {\n p1 = ring[i];\n p2 = ring[j];\n sum += (p2[0] - p1[0]) * (p1[1] + p2[1]);\n }\n return sum;\n}\n/**\n * This function projects local coordinates in a\n * [0 - bufferSize, this.extent + bufferSize] range to a\n * [0 - (bufferSize / this.extent), 1 + (bufferSize / this.extent)] range.\n * The resulting extent would be 1.\n * @param line\n * @param feature\n */\nexport function convertToLocalCoordinates(coordinates, extent) {\n if (Array.isArray(coordinates[0])) {\n for (const subcoords of coordinates) {\n convertToLocalCoordinates(subcoords, extent);\n }\n return;\n }\n // Just a point\n const p = coordinates;\n p[0] /= extent;\n p[1] /= extent;\n}\n/**\n * For the binary code path, the feature data is just\n * one big flat array, so we just divide each value\n * @param data\n * @param feature\n */\nexport function convertToLocalCoordinatesFlat(data, extent) {\n for (let i = 0; i < data.length; ++i) {\n data[i] /= extent;\n }\n}\n/**\n * Projects local tile coordinates to lngLat in place.\n * @param points\n * @param tileIndex\n */\nexport function projectToLngLat(line, tileIndex, extent) {\n if (typeof line[0][0] !== 'number') {\n for (const point of line) {\n // @ts-expect-error\n projectToLngLat(point, tileIndex, extent);\n }\n return;\n }\n const size = extent * Math.pow(2, tileIndex.z);\n const x0 = extent * tileIndex.x;\n const y0 = extent * tileIndex.y;\n for (let j = 0; j < line.length; j++) {\n const p = line[j];\n p[0] = ((p[0] + x0) * 360) / size - 180;\n const y2 = 180 - ((p[1] + y0) * 360) / size;\n p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;\n }\n}\n/**\n * Projects local tile coordinates to lngLat in place.\n * @param points\n * @param tileIndex\nexport function projectTileCoordinatesToLngLat(\n points: number[][],\n tileIndex: {x: number; y: number; z: number},\n extent: number\n): void {\n const {x, y, z} = tileIndex;\n const size = extent * Math.pow(2, z);\n const x0 = extent * x;\n const y0 = extent * y;\n\n for (const p of points) {\n p[0] = ((p[0] + x0) * 360) / size - 180;\n const y2 = 180 - ((p[1] + y0) * 360) / size;\n p[1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;\n }\n}\n */\n/**\n *\n * @param data\n * @param x0\n * @param y0\n * @param size\n */\nexport function projectToLngLatFlat(data, tileIndex, extent) {\n const { x, y, z } = tileIndex;\n const size = extent * Math.pow(2, z);\n const x0 = extent * x;\n const y0 = extent * y;\n for (let j = 0, jl = data.length; j < jl; j += 2) {\n data[j] = ((data[j] + x0) * 360) / size - 180;\n const y2 = 180 - ((data[j + 1] + y0) * 360) / size;\n data[j + 1] = (360 / Math.PI) * Math.atan(Math.exp((y2 * Math.PI) / 180)) - 90;\n }\n}\n/**\n * Classifies an array of rings into polygons with outer rings and holes\n * @param rings\n * @returns polygons\n */\nexport function classifyRings(rings) {\n const len = rings.length;\n if (len <= 1)\n return [rings];\n const polygons = [];\n let polygon;\n let ccw;\n for (let i = 0; i < len; i++) {\n const area = signedArea(rings[i]);\n if (area === 0)\n continue; // eslint-disable-line no-continue\n if (ccw === undefined)\n ccw = area < 0;\n if (ccw === area < 0) {\n if (polygon)\n polygons.push(polygon);\n polygon = [rings[i]];\n }\n else if (polygon)\n polygon.push(rings[i]);\n }\n if (polygon)\n polygons.push(polygon);\n return polygons;\n}\n/**\n * Classifies an array of rings into polygons with outer rings and holes\n * The function also detects holes which have zero area and\n * removes them. In doing so it modifies the input\n * `geom.data` array to remove the unneeded data\n *\n * @param geometry\n * @returns object\n */\n// eslint-disable-next-line max-statements\nexport function classifyRingsFlat(geom) {\n const len = geom.indices.length;\n const type = 'Polygon';\n if (len <= 1) {\n return {\n type,\n data: geom.data,\n areas: [[getPolygonSignedArea(geom.data)]],\n indices: [geom.indices]\n };\n }\n const areas = [];\n const polygons = [];\n let ringAreas = [];\n let polygon = [];\n let ccw;\n let offset = 0;\n for (let endIndex, i = 0, startIndex; i < len; i++) {\n startIndex = geom.indices[i] - offset;\n endIndex = geom.indices[i + 1] - offset || geom.data.length;\n const shape = geom.data.slice(startIndex, endIndex);\n const area = getPolygonSignedArea(shape);\n if (area === 0) {\n // This polygon has no area, so remove it from the shape\n // Remove the section from the data array\n const before = geom.data.slice(0, startIndex);\n const after = geom.data.slice(endIndex);\n geom.data = before.concat(after);\n // Need to offset any remaining indices as we have\n // modified the data buffer\n offset += endIndex - startIndex;\n // Do not add this index to the output and process next shape\n continue; // eslint-disable-line no-continue\n }\n if (ccw === undefined)\n ccw = area < 0;\n if (ccw === area < 0) {\n if (polygon.length) {\n areas.push(ringAreas);\n polygons.push(polygon);\n }\n polygon = [startIndex];\n ringAreas = [area];\n }\n else {\n ringAreas.push(area);\n polygon.push(startIndex);\n }\n }\n if (ringAreas)\n areas.push(ringAreas);\n if (polygon.length)\n polygons.push(polygon);\n return { type, areas, indices: polygons, data: geom.data };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { classifyRings, classifyRingsFlat, projectToLngLat, projectToLngLatFlat, convertToLocalCoordinates, convertToLocalCoordinatesFlat } from \"../utils/geometry-utils.js\";\nexport class VectorTileFeature {\n properties;\n extent;\n type;\n id;\n _pbf;\n _geometry;\n _keys;\n _values;\n _geometryInfo;\n static types = ['Unknown', 'Point', 'LineString', 'Polygon'];\n // eslint-disable-next-line max-params\n constructor(pbf, end, extent, keys, values, geometryInfo) {\n // Public\n this.properties = {};\n this.extent = extent;\n this.type = 0;\n this.id = null;\n // Private\n this._pbf = pbf;\n this._geometry = -1;\n this._keys = keys;\n this._values = values;\n // Only used by binary tiles\n this._geometryInfo = geometryInfo;\n pbf.readFields(readFeature, this, end);\n }\n toGeoJSONFeature(coordinates, tileIndex) {\n const coords = this.loadGeometry();\n switch (coordinates) {\n case 'wgs84':\n return _toGeoJSONFeature(this, coords, (line) => projectToLngLat(line, tileIndex, this.extent));\n default:\n return _toGeoJSONFeature(this, coords, convertToLocalCoordinates);\n }\n }\n /**\n *\n * @param options\n * @returns\n */\n toBinaryFeature(coordinates, tileIndex) {\n const geom = this.loadFlatGeometry();\n switch (coordinates) {\n case 'wgs84':\n return this._toBinaryCoordinates(geom, (coords) => projectToLngLatFlat(coords, tileIndex, this.extent));\n default:\n return this._toBinaryCoordinates(geom, convertToLocalCoordinatesFlat);\n }\n }\n /** Read a bounding box from the feature */\n // eslint-disable-next-line max-statements\n bbox() {\n const pbf = this._pbf;\n pbf.pos = this._geometry;\n const end = pbf.readVarint() + pbf.pos;\n let cmd = 1;\n let length = 0;\n let x = 0;\n let y = 0;\n let x1 = Infinity;\n let x2 = -Infinity;\n let y1 = Infinity;\n let y2 = -Infinity;\n while (pbf.pos < end) {\n if (length <= 0) {\n const cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n length--;\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n if (x < x1)\n x1 = x;\n if (x > x2)\n x2 = x;\n if (y < y1)\n y1 = y;\n if (y > y2)\n y2 = y;\n }\n else if (cmd !== 7) {\n throw new Error(`unknown command ${cmd}`);\n }\n }\n return [x1, y1, x2, y2];\n }\n // BINARY HELPERS\n /**\n *\n * @param transform\n * @returns result\n */\n _toBinaryCoordinates(geom, transform) {\n let geometry;\n // Apply the supplied transformation to data\n transform(geom.data, this.extent);\n const coordLength = 2;\n // eslint-disable-next-line default-case\n switch (this.type) {\n case 1: // Point\n this._geometryInfo.pointFeaturesCount++;\n this._geometryInfo.pointPositionsCount += geom.indices.length;\n geometry = { type: 'Point', ...geom };\n break;\n case 2: // LineString\n this._geometryInfo.lineFeaturesCount++;\n this._geometryInfo.linePathsCount += geom.indices.length;\n this._geometryInfo.linePositionsCount += geom.data.length / coordLength;\n geometry = { type: 'LineString', ...geom };\n break;\n case 3: // Polygon\n geometry = classifyRingsFlat(geom);\n // Unlike Point & LineString geom.indices is a 2D array, thanks\n // to the classifyRings method\n this._geometryInfo.polygonFeaturesCount++;\n this._geometryInfo.polygonObjectsCount += geometry.indices.length;\n for (const indices of geometry.indices) {\n this._geometryInfo.polygonRingsCount += indices.length;\n }\n this._geometryInfo.polygonPositionsCount += geometry.data.length / coordLength;\n break;\n default:\n throw new Error(`Invalid geometry type: ${this.type}`);\n }\n const result = { type: 'Feature', geometry, properties: this.properties };\n if (this.id !== null) {\n result.id = this.id;\n }\n return result;\n }\n // GEOJSON HELPER\n // eslint-disable-next-line complexity, max-statements\n loadGeometry() {\n const pbf = this._pbf;\n pbf.pos = this._geometry;\n const end = pbf.readVarint() + pbf.pos;\n let cmd = 1;\n let length = 0;\n let x = 0;\n let y = 0;\n const lines = [];\n let line;\n while (pbf.pos < end) {\n if (length <= 0) {\n const cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n length--;\n switch (cmd) {\n case 1:\n case 2:\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n if (cmd === 1) {\n // moveTo\n if (line)\n lines.push(line);\n line = [];\n }\n if (line)\n line.push([x, y]);\n break;\n case 7:\n // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90\n if (line) {\n line.push(line[0].slice()); // closePolygon\n }\n break;\n default:\n throw new Error(`unknown command ${cmd}`);\n }\n }\n if (line)\n lines.push(line);\n return lines;\n }\n /**\n * Expands the protobuf data to an intermediate Flat GeoJSON\n * data format, which maps closely to the binary data buffers.\n * It is similar to GeoJSON, but rather than storing the coordinates\n * in multidimensional arrays, we have a 1D `data` with all the\n * coordinates, and then index into this using the `indices`\n * parameter, e.g.\n *\n * geometry: {\n * type: 'Point', data: [1,2], indices: [0]\n * }\n * geometry: {\n * type: 'LineString', data: [1,2,3,4,...], indices: [0]\n * }\n * geometry: {\n * type: 'Polygon', data: [1,2,3,4,...], indices: [[0, 2]]\n * }\n * Thus the indices member lets us look up the relevant range\n * from the data array.\n * The Multi* versions of the above types share the same data\n * structure, just with multiple elements in the indices array\n */\n // eslint-disable-next-line complexity, max-statements\n loadFlatGeometry() {\n const pbf = this._pbf;\n pbf.pos = this._geometry;\n const endPos = pbf.readVarint() + pbf.pos;\n let cmd = 1;\n let cmdLen;\n let length = 0;\n let x = 0;\n let y = 0;\n let i = 0;\n // Note: I attempted to replace the `data` array with a\n // Float32Array, but performance was worse, both using\n // `set()` and direct index access. Also, we cannot\n // know how large the buffer should be, so it would\n // increase memory usage\n const indices = []; // Indices where geometries start\n const data = []; // Flat array of coordinate data\n while (pbf.pos < endPos) {\n if (length <= 0) {\n cmdLen = pbf.readVarint();\n cmd = cmdLen & 0x7;\n length = cmdLen >> 3;\n }\n length--;\n if (cmd === 1 || cmd === 2) {\n x += pbf.readSVarint();\n y += pbf.readSVarint();\n if (cmd === 1) {\n // New line\n indices.push(i);\n }\n data.push(x, y);\n i += 2;\n }\n else if (cmd === 7) {\n // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90\n if (i > 0) {\n const start = indices[indices.length - 1]; // start index of polygon\n data.push(data[start], data[start + 1]); // closePolygon\n i += 2;\n }\n }\n else {\n throw new Error(`unknown command ${cmd}`);\n }\n }\n return { data, indices };\n }\n}\nfunction _toGeoJSONFeature(vtFeature, coords, transform) {\n let type = VectorTileFeature.types[vtFeature.type];\n let i;\n let j;\n let coordinates;\n switch (vtFeature.type) {\n case 1:\n const points = [];\n for (i = 0; i < coords.length; i++) {\n points[i] = coords[i][0];\n }\n coordinates = points;\n transform(coordinates, vtFeature.extent);\n break;\n case 2:\n coordinates = coords;\n for (i = 0; i < coordinates.length; i++) {\n transform(coordinates[i], vtFeature.extent);\n }\n break;\n case 3:\n coordinates = classifyRings(coords);\n for (i = 0; i < coordinates.length; i++) {\n for (j = 0; j < coordinates[i].length; j++) {\n transform(coordinates[i][j], vtFeature.extent);\n }\n }\n break;\n default:\n throw new Error('illegal vector tile type');\n }\n if (coordinates.length === 1) {\n // @ts-expect-error\n coordinates = coordinates[0];\n }\n else {\n type = `Multi${type}`;\n }\n const result = {\n type: 'Feature',\n geometry: {\n type: type,\n coordinates: coordinates\n },\n properties: vtFeature.properties\n };\n if (vtFeature.id !== null) {\n result.properties ||= {};\n result.properties.id = vtFeature.id;\n }\n return result;\n}\n// PBF READER UTILS\n/**\n *\n * @param tag\n * @param feature\n * @param pbf\n */\nfunction readFeature(tag, feature, pbf) {\n if (feature && pbf) {\n if (tag === 1)\n feature.id = pbf.readVarint();\n else if (tag === 2)\n readTag(pbf, feature);\n else if (tag === 3)\n feature.type = pbf.readVarint();\n else if (tag === 4)\n feature._geometry = pbf.pos;\n }\n}\n/**\n *\n * @param pbf\n * @param feature\n */\nfunction readTag(pbf, feature) {\n const end = pbf.readVarint() + pbf.pos;\n while (pbf.pos < end) {\n const key = feature._keys[pbf.readVarint()];\n const value = feature._values[pbf.readVarint()];\n feature.properties[key] = value;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nimport { VectorTileFeature } from \"./vector-tile-feature.js\";\nexport class VectorTileLayer {\n version;\n name;\n extent;\n length;\n _pbf;\n _keys;\n _values;\n _features;\n constructor(pbf, end) {\n // Public\n this.version = 1;\n this.name = '';\n this.extent = 4096;\n this.length = 0;\n // Private\n this._pbf = pbf;\n this._keys = [];\n this._values = [];\n this._features = [];\n pbf.readFields(readLayer, this, end);\n this.length = this._features.length;\n }\n /**\n * return feature `i` from this layer as a `VectorTileFeature`\n * @param index\n * @returns feature\n */\n getGeoJSONFeature(i) {\n if (i < 0 || i >= this._features.length) {\n throw new Error('feature index out of bounds');\n }\n this._pbf.pos = this._features[i];\n const end = this._pbf.readVarint() + this._pbf.pos;\n return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);\n }\n /**\n * return binary feature `i` from this layer as a `VectorTileFeature`\n *\n * @param index\n * @param geometryInfo\n * @returns binary feature\n */\n getBinaryFeature(i, geometryInfo) {\n if (i < 0 || i >= this._features.length) {\n throw new Error('feature index out of bounds');\n }\n this._pbf.pos = this._features[i];\n const end = this._pbf.readVarint() + this._pbf.pos;\n return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values, geometryInfo);\n }\n}\n/**\n *\n * @param tag\n * @param layer\n * @param pbf\n */\nfunction readLayer(tag, layer, pbf) {\n if (layer && pbf) {\n if (tag === 15)\n layer.version = pbf.readVarint();\n else if (tag === 1)\n layer.name = pbf.readString();\n else if (tag === 5)\n layer.extent = pbf.readVarint();\n else if (tag === 2)\n layer._features.push(pbf.pos);\n else if (tag === 3)\n layer._keys.push(pbf.readString());\n else if (tag === 4)\n layer._values.push(readValueMessage(pbf));\n }\n}\n/**\n *\n * @param pbf\n * @returns value\n */\nfunction readValueMessage(pbf) {\n let value = null;\n const end = pbf.readVarint() + pbf.pos;\n while (pbf.pos < end) {\n const tag = pbf.readVarint() >> 3;\n value =\n tag === 1\n ? pbf.readString()\n : tag === 2\n ? pbf.readFloat()\n : tag === 3\n ? pbf.readDouble()\n : tag === 4\n ? pbf.readVarint64()\n : tag === 5\n ? pbf.readVarint()\n : tag === 6\n ? pbf.readSVarint()\n : tag === 7\n ? pbf.readBoolean()\n : null;\n }\n return value;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// This code is forked from https://github.com/mapbox/vector-tile-js under BSD 3-clause license.\nimport { VectorTileLayer } from \"./vector-tile-layer.js\";\nexport class VectorTile {\n layers;\n constructor(pbf, end) {\n this.layers = pbf.readFields(readTile, {}, end);\n }\n}\n/**\n *\n * @param tag\n * @param layers\n * @param pbf\n */\nfunction readTile(tag, layers, pbf) {\n if (tag === 3) {\n if (pbf) {\n const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);\n if (layer.length && layers) {\n layers[layer.name] = layer;\n }\n }\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\n// import type {MVTOptions} from './lib/types';\nimport { parseMVT } from \"./lib/parse-mvt.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.3.1\" !== 'undefined' ? \"4.3.1\" : 'latest';\n/**\n * Worker loader for the Mapbox Vector Tile format\n */\nexport const MVTWorkerLoader = {\n dataType: null,\n batchType: null,\n name: 'Mapbox Vector Tile',\n id: 'mvt',\n module: 'mvt',\n version: VERSION,\n // Note: ArcGIS uses '.pbf' extension and 'application/octet-stream'\n extensions: ['mvt', 'pbf'],\n mimeTypes: [\n // https://www.iana.org/assignments/media-types/application/vnd.mapbox-vector-tile\n 'application/vnd.mapbox-vector-tile',\n 'application/x-protobuf'\n // 'application/octet-stream'\n ],\n worker: true,\n category: 'geometry',\n options: {\n mvt: {\n shape: 'geojson',\n coordinates: 'local',\n layerProperty: 'layerName',\n layers: undefined,\n tileIndex: undefined\n }\n }\n};\n/**\n * Loader for the Mapbox Vector Tile format\n */\nexport const MVTLoader = {\n ...MVTWorkerLoader,\n parse: async (arrayBuffer, options) => parseMVT(arrayBuffer, options),\n parseSync: parseMVT,\n binary: true\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { DataSource, resolvePath } from '@loaders.gl/loader-utils';\nimport { ImageLoader, getBinaryImageMetadata } from '@loaders.gl/images';\nimport { MVTLoader, TileJSONLoader } from '@loaders.gl/mvt';\n/** Creates an MVTTileSource */\nexport const MVTSource = {\n name: 'MVT',\n id: 'mvt',\n module: 'mvt',\n version: '0.0.0',\n extensions: ['mvt'],\n mimeTypes: ['application/octet-stream'],\n options: {\n mvt: {\n // TODO - add options here\n }\n },\n type: 'mvt',\n fromUrl: true,\n fromBlob: false,\n testURL: (url) => true,\n createDataSource(url, props) {\n return new MVTTileSource(url, props);\n }\n};\n/**\n * MVT data source for Mapbox Vector Tiles v1.\n */\n/**\n * A PMTiles data source\n * @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.\n */\nexport class MVTTileSource extends DataSource {\n props;\n url;\n metadataUrl = null;\n data;\n schema = 'tms';\n metadata;\n extension;\n mimeType = null;\n constructor(url, props) {\n super(props);\n this.props = props;\n this.url = resolvePath(url);\n this.metadataUrl = props.mvt?.metadataUrl || `${this.url}/tilejson.json`;\n this.extension = props.mvt?.extension || '.png';\n this.data = this.url;\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\n if (isURLTemplate(this.url)) {\n this.schema = 'template';\n }\n }\n // @ts-ignore - Metadata type misalignment\n async getMetadata() {\n if (!this.metadataUrl) {\n return null;\n }\n let response;\n try {\n // Annoyingly, on CORS errors, fetch doesn't use the response status/ok mechanism but instead throws\n // CORS errors are common when requesting an unavailable sub resource such as a metadata file or an unavailable tile)\n response = await this.fetch(this.metadataUrl);\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.error(error.message);\n return null;\n }\n if (!response.ok) {\n // eslint-disable-next-line no-console\n console.error(response.statusText);\n return null;\n }\n const tileJSON = await response.text();\n const metadata = TileJSONLoader.parseTextSync?.(tileJSON) || null;\n // TODO add metadata attributions\n // metadata.attributions = [...this.props.attributions, ...(metadata.attributions || [])];\n // if (metadata?.mimeType) {\n // this.mimeType = metadata?.tileMIMEType;\n // }\n return metadata;\n }\n getTileMIMEType() {\n return this.mimeType;\n }\n async getTile(parameters) {\n const { x, y, z } = parameters;\n const tileUrl = this.getTileURL(x, y, z);\n const response = await this.fetch(tileUrl);\n if (!response.ok) {\n return null;\n }\n const arrayBuffer = await response.arrayBuffer();\n return arrayBuffer;\n }\n // Tile Source interface implementation: deck.gl compatible API\n // TODO - currently only handles image tiles, not vector tiles\n async getTileData(parameters) {\n const { x, y, z } = parameters.index;\n // const metadata = await this.metadata;\n // mimeType = metadata?.tileMIMEType || 'application/vnd.mapbox-vector-tile';\n const arrayBuffer = await this.getTile({ x, y, z, layers: [] });\n if (arrayBuffer === null) {\n return null;\n }\n const imageMetadata = getBinaryImageMetadata(arrayBuffer);\n this.mimeType =\n this.mimeType || imageMetadata?.mimeType || 'application/vnd.mapbox-vector-tile';\n switch (this.mimeType) {\n case 'application/vnd.mapbox-vector-tile':\n return await this._parseVectorTile(arrayBuffer, { x, y, z, layers: [] });\n default:\n return await this._parseImageTile(arrayBuffer);\n }\n }\n // ImageTileSource interface implementation\n async getImageTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n return arrayBuffer ? this._parseImageTile(arrayBuffer) : null;\n }\n async _parseImageTile(arrayBuffer) {\n return await ImageLoader.parse(arrayBuffer, this.loadOptions);\n }\n // VectorTileSource interface implementation\n async getVectorTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n return arrayBuffer ? this._parseVectorTile(arrayBuffer, tileParams) : null;\n }\n async _parseVectorTile(arrayBuffer, tileParams) {\n const loadOptions = {\n shape: 'geojson-table',\n mvt: {\n coordinates: 'wgs84',\n tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },\n ...this.loadOptions?.mvt\n },\n ...this.loadOptions\n };\n return await MVTLoader.parse(arrayBuffer, loadOptions);\n }\n getMetadataUrl() {\n return this.metadataUrl;\n }\n getTileURL(x, y, z) {\n switch (this.schema) {\n case 'xyz':\n return `${this.url}/${x}/${y}/${z}${this.extension}`;\n case 'tms':\n return `${this.url}/${z}/${x}/${y}${this.extension}`;\n case 'template':\n return getURLFromTemplate(this.url, x, y, z, '0');\n default:\n throw new Error(this.schema);\n }\n }\n}\nexport function isURLTemplate(s) {\n return /(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(s);\n}\nconst xRegex = new RegExp('{x}', 'g');\nconst yRegex = new RegExp('{y}', 'g');\nconst zRegex = new RegExp('{z}', 'g');\n/**\n * Get a URL from a URL template\n * @note copied from deck.gl/modules/geo-layers/src/tileset-2d/utils.ts\n * @param template - URL template\n * @param x - tile x coordinate\n * @param y - tile y coordinate\n * @param z - tile z coordinate\n * @param id - tile id\n * @returns URL\n */\nexport function getURLFromTemplate(template, x, y, z, id = '0') {\n if (Array.isArray(template)) {\n const i = stringHash(id) % template.length;\n template = template[i];\n }\n let url = template;\n url = url.replace(xRegex, String(x));\n url = url.replace(yRegex, String(y));\n url = url.replace(zRegex, String(z));\n // Back-compatible support for {-y}\n if (Number.isInteger(y) && Number.isInteger(z)) {\n url = url.replace(/\\{-y\\}/g, String(Math.pow(2, z) - y - 1));\n }\n return url;\n}\nfunction stringHash(s) {\n return Math.abs(s.split('').reduce((a, b) => ((a << 5) - a + b.charCodeAt(0)) | 0, 0));\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT AND ISC\n// Copyright (c) vis.gl contributors\n// Based on https://github.com/mapbox/geojson-vt under compatible ISC license\nimport { log } from '@loaders.gl/loader-utils';\nimport { deduceTableSchema } from '@loaders.gl/schema';\nimport { Stats, Stat } from '@probe.gl/stats';\nimport { createProtoTile } from \"./lib/vector-tiler/proto-tile.js\";\nimport { transformTile } from \"./lib/vector-tiler/transform-tile.js\"; // coordinate transformation\nimport { convertTileToGeoJSON } from \"./lib/vector-tiler/tile-to-geojson.js\"; // tile clipping and wrapping\nimport { convertFeaturesToProtoFeature } from \"./lib/vector-tiler/features/convert-feature.js\";\nimport { clipFeatures } from \"./lib/vector-tiler/features/clip-features.js\"; // stripe clipping algorithm\nimport { wrapFeatures } from \"./lib/vector-tiler/features/wrap-features.js\"; // date line processing\n/** Options to configure tiling */\nexport const TableTileSource = {\n name: 'TableTiler',\n id: 'table-tiler',\n version: '0.0.0',\n extensions: ['mvt'],\n mimeTypes: ['application/octet-stream'],\n options: {\n table: {\n coordinates: 'local',\n promoteId: undefined,\n maxZoom: 14,\n indexMaxZoom: 5,\n maxPointsPerTile: 10000,\n tolerance: 3,\n extent: 4096,\n buffer: 64,\n generateId: undefined\n }\n },\n type: 'table',\n testURL: (url) => url.endsWith('.geojson'),\n createDataSource(url, options) {\n const needsLoading = typeof url === 'string' || url instanceof Blob;\n const loader = options?.table?.loaders?.[0];\n const tablePromise = needsLoading ? loadTable(url, loader) : url;\n return new DynamicVectorTileSource(tablePromise, options);\n }\n // @ts-expect-error\n};\nasync function loadTable(url, loader) {\n if (typeof url === 'string') {\n const response = await fetch(url);\n const data = await response.arrayBuffer();\n return (await loader.parse(data));\n }\n const data = await url.arrayBuffer();\n return (await loader.parse(data)); // options.loaders, options.loadOptions)\n}\n/**\n * Dynamically vector tiles a table (the table needs a geometry column)\n * - Tiles are generated when requested.\n * - Each tile contains a tables of clipped features.\n *\n * @note - Currently only accepts `GeoJSONTable` tables\n * @note - Currently only outputs `GeoJSONTable`\n * @note - (can be initialized with a promise that resolves to GeoJSONTable).\n *\n * @todo - metadata should scan all rows to determine schema\n * @todo - metadata scan all rows to determine tilestats (field values[] etc).\n * @todo - handle binary input tables\n * @todo - generate binary output tables\n * @todo - how does TileSourceLayer specify coordinates / decided which layer to render with\n */\nexport class DynamicVectorTileSource {\n /** Global stats for all DynamicVectorTileSources */\n static stats = new Stats({\n id: 'table-tile-source-all',\n stats: [new Stat('count', 'tiles'), new Stat('count', 'features')]\n });\n /** Stats for this DynamicVectorTileSource */\n stats = new Stats({\n id: 'table-tile-source',\n stats: [new Stat('tiles', 'count'), new Stat('features', 'count')]\n });\n /** MIME type of the tiles emitted by this tile source */\n mimeType = 'application/vnd.mapbox-vector-tile';\n localCoordinates = true;\n /** The props that this tile source was created with */\n // @ts-expect-error\n props;\n /* Schema of the data */\n schema = null;\n /** Map of generated tiles, indexed by stringified tile coordinates */\n tiles = {};\n /** Array of tile coordinates */\n tileCoords = [];\n /** Input data has loaded, initial top-level tiling is done, sync methods can now be called */\n ready;\n /** Metadata for the tile source (generated TileJSON/tilestats */\n metadata;\n constructor(table, props) {\n // @ts-expect-error\n this.props = { ...TableTileSource.options.table, ...props?.table };\n this.getTileData = this.getTileData.bind(this);\n this.ready = this.initializeTilesAsync(table);\n this.metadata = this.getMetadata();\n }\n async initializeTilesAsync(tablePromise) {\n const table = await tablePromise;\n this.schema = deduceTableSchema(table);\n this.createRootTiles(table);\n }\n async getMetadata() {\n await this.ready;\n return { schema: this.schema, minZoom: 0, maxZoom: this.props.maxZoom };\n }\n async getSchema() {\n await this.ready;\n return this.schema;\n }\n /**\n * Get a tile at the specified index\n * @param tileIndex z, x, y of tile\n * @returns\n */\n async getVectorTile(tileIndex) {\n await this.ready;\n const table = this.getTileSync(tileIndex);\n log.info(2, 'getVectorTile', tileIndex, table)();\n return table;\n }\n async getTile(tileIndex) {\n await this.ready;\n return this.getTileSync(tileIndex);\n }\n async getTileData(tileParams) {\n const { x, y, z } = tileParams.index;\n const tile = await this.getVectorTile({ x, y, z });\n return tile?.features || [];\n }\n // Implementation\n /**\n * Synchronously request a tile\n * @note Application must await `source.ready` before calling sync methods.\n */\n getTileSync(tileIndex) {\n const protoTile = this.getProtoTile(tileIndex);\n if (!protoTile) {\n return null;\n }\n return convertTileToGeoJSON(protoTile, {\n coordinates: this.props.coordinates,\n tileIndex,\n extent: this.props.extent\n });\n }\n /**\n * Create the initial tiles\n * @note the tiles stores all the features together with additional data\n */\n createRootTiles(table) {\n if (this.props.maxZoom < 0 || this.props.maxZoom > 24) {\n throw new Error('maxZoom should be in the 0-24 range');\n }\n if (this.props.promoteId && this.props.generateId) {\n throw new Error('promoteId and generateId cannot be used together.');\n }\n log.log(1, 'DynamicVectorTileSource creating root tiles', this.props)();\n // projects and adds simplification info\n log.time(1, 'preprocess table')();\n let features = convertFeaturesToProtoFeature(table, this.props);\n log.timeEnd(1, 'preprocess table')();\n // wraps features (ie extreme west and extreme east)\n log.time(1, 'generate tiles')();\n features = wrapFeatures(features, this.props);\n // start slicing from the top tile down\n if (features.length === 0) {\n log.log(1, 'DynamicVectorTileSource: no features generated')();\n return;\n }\n this.splitTile(features, 0, 0, 0);\n const rootTile = this.tiles[0];\n log.log(1, `root tile features: ${rootTile.numFeatures}, points: ${rootTile.numPoints}`)();\n log.timeEnd(1, 'generate tiles')();\n log.log(1, `DynamicVectorTileSource: tiles generated: ${this.stats.get('total').count}`, this.stats)();\n }\n /**\n * Return geojsonvt-style \"half formed\" vector tile\n * @note Application must await `source.ready` before calling sync methods.\n */\n // eslint-disable-next-line complexity, max-statements\n getProtoTile(tileIndex) {\n const { z, y } = tileIndex;\n let { x } = tileIndex;\n // z = +z;\n // x = +x;\n // y = +y;\n const { extent } = this.props;\n if (z < 0 || z > 24) {\n return null;\n }\n const z2 = 1 << z;\n x = (x + z2) & (z2 - 1); // wrapFeatures tile x coordinate\n const id = toID(z, x, y);\n if (this.tiles[id]) {\n return transformTile(this.tiles[id], extent);\n }\n log.log(log, 'drilling down to z%d-%d-%d', z, x, y)();\n let z0 = z;\n let x0 = x;\n let y0 = y;\n let parent;\n while (!parent && z0 > 0) {\n z0--;\n x0 = x0 >> 1;\n y0 = y0 >> 1;\n parent = this.tiles[toID(z0, x0, y0)];\n }\n if (!parent || !parent.sourceFeatures) {\n return null;\n }\n // if we found a parent tile containing the original geometry, we can drill down from it\n log.log(1, 'found parent tile z%d-%d-%d', z0, x0, y0)();\n log.time(1, 'drilling down')();\n this.splitTile(parent.sourceFeatures, z0, x0, y0, z, x, y);\n log.timeEnd(1, 'drilling down')();\n return this.tiles[id] ? transformTile(this.tiles[id], extent) : null;\n }\n /**\n * splits features from a parent tile to sub-tiles.\n * @param z, x, and y are the coordinates of the parent tile\n * @param cz, cx, and cy are the coordinates of the target tile\n *\n * If no target tile is specified, splitting stops when we reach the maximum\n * zoom or the number of points is low as specified in the props.\n */\n // eslint-disable-next-line max-params, max-statements, complexity\n splitTile(features, z, x, y, cz, cx, cy) {\n const stack = [features, z, x, y];\n // avoid recursion by using a processing queue\n while (stack.length) {\n y = stack.pop();\n x = stack.pop();\n z = stack.pop();\n features = stack.pop();\n const z2 = 1 << z;\n const id = toID(z, x, y);\n let tile = this.tiles[id];\n if (!tile) {\n log.time(2, 'tile creation')();\n tile = this.tiles[id] = createProtoTile(features, z, x, y, this.props);\n this.tileCoords.push({ z, x, y });\n const key = `z${z}`;\n let stat = this.stats.get(key, 'count');\n stat.incrementCount();\n stat = this.stats.get('total');\n stat.incrementCount();\n stat = DynamicVectorTileSource.stats.get(key, 'count');\n stat.incrementCount();\n stat = DynamicVectorTileSource.stats.get('total');\n stat.incrementCount();\n log.log(2, 'tile z%d-%d-%d (features: %d, points: %d, simplified: %d)', z, x, y, tile.numFeatures, tile.numPoints, tile.numSimplified)();\n log.timeEnd(2, 'tile creation')();\n }\n // save reference to original geometry in tile so that we can drill down later if we stop now\n tile.sourceFeatures = features;\n /* eslint-disable no-continue */\n // if it's the first-pass tiling\n if (cz === undefined) {\n // stop tiling if we reached max zoom, or if the tile is too simple\n if (z === this.props.indexMaxZoom || tile.numPoints <= this.props.maxPointsPerTile) {\n continue;\n }\n // if a drilldown to a specific tile\n }\n else if (z === this.props.maxZoom || z === cz) {\n // stop tiling if we reached base zoom or our target tile zoom\n continue;\n }\n else if (cz !== undefined) {\n // stop tiling if it's not an ancestor of the target tile\n const zoomSteps = cz - z;\n // @ts-expect-error TODO fix the types of cx cy\n if (x !== cx >> zoomSteps || y !== cy >> zoomSteps) {\n continue;\n }\n }\n // if we slice further down, no need to keep source geometry\n tile.sourceFeatures = null;\n if (features.length === 0)\n continue;\n log.time(2, 'clipping tile')();\n // values we'll use for clipping\n const k1 = (0.5 * this.props.buffer) / this.props.extent;\n const k2 = 0.5 - k1;\n const k3 = 0.5 + k1;\n const k4 = 1 + k1;\n let tl = null;\n let bl = null;\n let tr = null;\n let br = null;\n let left = clipFeatures(features, z2, x - k1, x + k3, 0, tile.minX, tile.maxX, this.props);\n let right = clipFeatures(features, z2, x + k2, x + k4, 0, tile.minX, tile.maxX, this.props);\n // @ts-expect-error - unclear why this is needed?\n features = null;\n if (left) {\n tl = clipFeatures(left, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, this.props);\n bl = clipFeatures(left, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, this.props);\n left = null;\n }\n if (right) {\n tr = clipFeatures(right, z2, y - k1, y + k3, 1, tile.minY, tile.maxY, this.props);\n br = clipFeatures(right, z2, y + k2, y + k4, 1, tile.minY, tile.maxY, this.props);\n right = null;\n }\n log.timeEnd(2, 'clipping tile')();\n stack.push(tl || [], z + 1, x * 2, y * 2);\n stack.push(bl || [], z + 1, x * 2, y * 2 + 1);\n stack.push(tr || [], z + 1, x * 2 + 1, y * 2);\n stack.push(br || [], z + 1, x * 2 + 1, y * 2 + 1);\n }\n }\n}\nfunction toID(z, x, y) {\n return ((1 << z) * y + x) * 32 + z;\n}\n/*\n\n// eslint-disable-next-line max-statements, complexity\nfunction convertToGeoJSONTable(\n vtTile: ProtoTile,\n props: {\n coordinates: 'local' | 'wgs84' | 'EPSG:4326';\n tileIndex: {x: number; y: number; z: number};\n extent: number;\n }\n): GeoJSONTable | null {\n const features: Feature[] = [];\n for (const rawFeature of vtTile.features) {\n if (!rawFeature || !rawFeature.geometry) {\n continue;\n }\n\n let type:\n | 'Point'\n | 'MultiPoint'\n | 'LineString'\n | 'MultiLineString'\n | 'Polygon'\n | 'MultiPolygon';\n\n let coordinates: any;\n\n // raw geometry\n switch (rawFeature.type) {\n case 1:\n if (rawFeature.geometry.length === 1) {\n type = 'Point';\n coordinates = rawFeature.geometry[0];\n } else {\n type = 'MultiPoint';\n coordinates = rawFeature.geometry;\n }\n break;\n case 2:\n if (rawFeature.geometry.length === 1) {\n type = 'LineString';\n coordinates = rawFeature.geometry[0];\n } else {\n type = 'MultiLineString';\n coordinates = rawFeature.geometry;\n }\n break;\n case 3:\n if (rawFeature.geometry.length > 1) {\n type = 'MultiPolygon';\n coordinates = [rawFeature.geometry];\n } else {\n type = 'Polygon';\n coordinates = rawFeature.geometry;\n }\n break;\n default:\n continue;\n }\n\n switch (props.coordinates) {\n case 'EPSG:4326':\n case 'wgs84':\n projectToLngLat(coordinates, props.tileIndex, props.extent);\n break;\n\n case 'local':\n convertToLocalCoordinates(coordinates, props.extent);\n break;\n\n default:\n throw new Error(`Unsupported CRS ${props.coordinates}`);\n }\n\n const feature: Feature = {\n type: 'Feature',\n geometry: {\n type,\n coordinates\n },\n properties: rawFeature.tags || {},\n id: rawFeature.id\n };\n\n features.push(feature);\n }\n\n if (features.length === 0) {\n return null;\n }\n\n const table: GeoJSONTable = {\n shape: 'geojson-table',\n type: 'FeatureCollection',\n features\n };\n\n return table;\n}\n*/\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n/**\n * Create a tile from features and tile index\n */\nexport function createProtoTile(features, z, tx, ty, options) {\n const tolerance = z === options.maxZoom ? 0 : options.tolerance / ((1 << z) * options.extent);\n const tile = {\n protoFeatures: [],\n sourceFeatures: null,\n numPoints: 0,\n numSimplified: 0,\n numFeatures: features.length,\n x: tx,\n y: ty,\n z,\n transformed: false,\n minX: 2,\n minY: 1,\n maxX: -1,\n maxY: 0\n };\n for (const feature of features) {\n addProtoFeature(tile, feature, tolerance, options);\n }\n return tile;\n}\n// eslint-disable-next-line complexity, max-statements\nfunction addProtoFeature(tile, feature, tolerance, options) {\n const geometry = feature.geometry;\n const type = feature.type;\n const simplifiedGeometry = [];\n tile.minX = Math.min(tile.minX, feature.minX);\n tile.minY = Math.min(tile.minY, feature.minY);\n tile.maxX = Math.max(tile.maxX, feature.maxX);\n tile.maxY = Math.max(tile.maxY, feature.maxY);\n let simplifiedType;\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n simplifiedType = 1;\n for (let i = 0; i < geometry.length; i += 3) {\n simplifiedGeometry.push(geometry[i], geometry[i + 1]);\n tile.numPoints++;\n tile.numSimplified++;\n }\n break;\n case 'LineString':\n simplifiedType = 2;\n addProtoLine(simplifiedGeometry, geometry, tile, tolerance, false, false);\n break;\n case 'MultiLineString':\n simplifiedType = 2;\n for (let i = 0; i < geometry.length; i++) {\n addProtoLine(simplifiedGeometry, geometry[i], tile, tolerance, false, i === 0);\n }\n break;\n case 'Polygon':\n simplifiedType = 3;\n for (let i = 0; i < geometry.length; i++) {\n addProtoLine(simplifiedGeometry, geometry[i], tile, tolerance, true, i === 0);\n }\n break;\n case 'MultiPolygon':\n simplifiedType = 3;\n for (let k = 0; k < geometry.length; k++) {\n const polygon = geometry[k];\n for (let i = 0; i < polygon.length; i++) {\n addProtoLine(simplifiedGeometry, polygon[i], tile, tolerance, true, i === 0);\n }\n }\n break;\n default:\n throw new Error(`Unknown geometry type: ${type}`);\n }\n if (simplifiedGeometry.length) {\n let tags = feature.tags || null;\n if (type === 'LineString' && options.lineMetrics) {\n tags = {};\n for (const key in feature.tags) {\n tags[key] = feature.tags[key];\n }\n // @ts-expect-error adding fields to arrays\n // eslint-disable-next-line camelcase\n tags.mapbox_clip_start = geometry.start / geometry.size;\n // @ts-expect-error adding fields to arrays\n // eslint-disable-next-line camelcase\n tags.mapbox_clip_end = geometry.end / geometry.size;\n }\n const tileFeature = {\n geometry: simplifiedGeometry,\n simplifiedType,\n // @ts-expect-error\n tags\n };\n if (feature.id !== null) {\n tileFeature.id = feature.id;\n }\n tile.protoFeatures.push(tileFeature);\n }\n}\n// eslint-disable-next-line max-params, max-statements\nfunction addProtoLine(result, geometry, tile, tolerance, isPolygon, isOuter) {\n const sqTolerance = tolerance * tolerance;\n if (tolerance > 0 && geometry.size < (isPolygon ? sqTolerance : tolerance)) {\n tile.numPoints += geometry.length / 3;\n return;\n }\n const ring = [];\n for (let i = 0; i < geometry.length; i += 3) {\n if (tolerance === 0 || geometry[i + 2] > sqTolerance) {\n tile.numSimplified++;\n ring.push(geometry[i], geometry[i + 1]);\n }\n tile.numPoints++;\n }\n if (isPolygon)\n rewind(ring, isOuter);\n result.push(ring);\n}\nfunction rewind(ring, clockwise) {\n let area = 0;\n for (let i = 0, j = ring.length - 2; i < ring.length; j = i, i += 2) {\n area += (ring[i] - ring[j]) * (ring[i + 1] + ring[j + 1]);\n }\n if (area > 0 === clockwise) {\n for (let i = 0, len = ring.length; i < len / 2; i += 2) {\n const x = ring[i];\n const y = ring[i + 1];\n ring[i] = ring[len - 2 - i];\n ring[i + 1] = ring[len - 1 - i];\n ring[len - 2 - i] = x;\n ring[len - 1 - i] = y;\n }\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n/**\n * Transforms the coordinates of each protoFeature in the given protoTile from\n * mercator-projected space into (extent x extent) protoTile space.\n */\nexport function transformTile(protoTile, extent) {\n if (protoTile.transformed) {\n return protoTile;\n }\n const z2 = 1 << protoTile.z;\n const tx = protoTile.x;\n const ty = protoTile.y;\n for (const protoFeature of protoTile.protoFeatures) {\n const geom = protoFeature.geometry;\n const simplifiedType = protoFeature.simplifiedType;\n protoFeature.geometry = [];\n if (simplifiedType === 1) {\n for (let j = 0; j < geom.length; j += 2) {\n protoFeature.geometry.push(transformPoint(geom[j], geom[j + 1], extent, z2, tx, ty));\n }\n }\n else {\n for (let j = 0; j < geom.length; j++) {\n const ring = [];\n for (let k = 0; k < geom[j].length; k += 2) {\n ring.push(transformPoint(geom[j][k], geom[j][k + 1], extent, z2, tx, ty));\n }\n protoFeature.geometry.push(ring);\n }\n }\n }\n protoTile.transformed = true;\n return protoTile;\n}\n// eslint-disable-next-line max-params\nfunction transformPoint(x, y, extent, z2, tx, ty) {\n return [Math.round(extent * (x * z2 - tx)), Math.round(extent * (y * z2 - ty))];\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\nimport { projectToLngLat, convertToLocalCoordinates } from \"../utils/geometry-utils.js\";\n// eslint-disable-next-line max-statements, complexity\nexport function convertTileToGeoJSON(protoTile, props) {\n const features = [];\n for (const rawFeature of protoTile.protoFeatures) {\n if (!rawFeature || !rawFeature.geometry) {\n // eslint-disable-next-line no-continue\n continue;\n }\n let type;\n let coordinates;\n // raw geometry\n switch (rawFeature.simplifiedType) {\n case 1:\n if (rawFeature.geometry.length === 1) {\n type = 'Point';\n coordinates = rawFeature.geometry[0];\n }\n else {\n type = 'MultiPoint';\n coordinates = rawFeature.geometry;\n }\n break;\n case 2:\n if (rawFeature.geometry.length === 1) {\n type = 'LineString';\n coordinates = rawFeature.geometry[0];\n }\n else {\n type = 'MultiLineString';\n coordinates = rawFeature.geometry;\n }\n break;\n case 3:\n if (rawFeature.geometry.length > 1) {\n type = 'MultiPolygon';\n coordinates = [rawFeature.geometry];\n }\n else {\n type = 'Polygon';\n coordinates = rawFeature.geometry;\n }\n break;\n default:\n throw new Error(`${rawFeature.simplifiedType}is not a valid simplified type`);\n }\n switch (props.coordinates) {\n case 'EPSG:4326':\n case 'wgs84':\n projectToLngLat(coordinates, props.tileIndex, props.extent);\n break;\n default:\n convertToLocalCoordinates(coordinates, props.extent);\n break;\n }\n const feature = {\n type: 'Feature',\n geometry: {\n type,\n coordinates\n },\n properties: rawFeature.tags || {},\n id: rawFeature.id\n };\n features.push(feature);\n }\n if (features.length === 0) {\n return null;\n }\n const table = {\n shape: 'geojson-table',\n type: 'FeatureCollection',\n features\n };\n return table;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\nexport function createProtoFeature(id, type, geometry, tags) {\n const feature = {\n // eslint-disable-next-line\n id: id == null ? null : id,\n type,\n simplifiedType: undefined, // TODO\n geometry,\n tags,\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity\n };\n // TODO break out into separate function\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n case 'LineString':\n calcLineBBox(feature, geometry);\n break;\n case 'MultiLineString':\n for (const line of geometry) {\n calcLineBBox(feature, line);\n }\n break;\n case 'Polygon':\n // the outer ring (ie [0]) contains all inner rings\n calcLineBBox(feature, geometry[0]);\n break;\n case 'MultiPolygon':\n for (const polygon of geometry) {\n // the outer ring (ie [0]) contains all inner rings\n calcLineBBox(feature, polygon[0]);\n }\n break;\n default:\n throw new Error(String(type));\n }\n return feature;\n}\nfunction calcLineBBox(feature, geometry) {\n for (let i = 0; i < geometry.length; i += 3) {\n feature.minX = Math.min(feature.minX, geometry[i]);\n feature.minY = Math.min(feature.minY, geometry[i + 1]);\n feature.maxX = Math.max(feature.maxX, geometry[i]);\n feature.maxY = Math.max(feature.maxY, geometry[i + 1]);\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\n/**\n * Calculate simplification data using optimized Douglas-Peucker algorithm\n *\n * @param coords contiguous list of coordinates\n * @param first first coord to simplify\n * @param last last coord to simplify\n * @param sqTolerance tolerance (square distance)\n */\nexport function simplifyPath(coords, first, last, sqTolerance) {\n let maxSqDist = sqTolerance;\n const mid = (last - first) >> 1;\n let minPosToMid = last - first;\n let index;\n const ax = coords[first];\n const ay = coords[first + 1];\n const bx = coords[last];\n const by = coords[last + 1];\n for (let i = first + 3; i < last; i += 3) {\n const d = getSqSegDist(coords[i], coords[i + 1], ax, ay, bx, by);\n if (d > maxSqDist) {\n index = i;\n maxSqDist = d;\n }\n else if (d === maxSqDist) {\n // a workaround to ensure we choose a pivot close to the middle of the list,\n // reducing recursion depth, for certain degenerate inputs\n // https://github.com/mapbox/geojson-vt/issues/104\n const posToMid = Math.abs(i - mid);\n if (posToMid < minPosToMid) {\n index = i;\n minPosToMid = posToMid;\n }\n }\n }\n if (maxSqDist > sqTolerance) {\n if (index - first > 3)\n simplifyPath(coords, first, index, sqTolerance);\n coords[index + 2] = maxSqDist;\n if (last - index > 3)\n simplifyPath(coords, index, last, sqTolerance);\n }\n}\n/** square distance from a point to a segment */\n// eslint-disable-next-line max-params\nfunction getSqSegDist(px, py, x, y, bx, by) {\n let dx = bx - x;\n let dy = by - y;\n if (dx !== 0 || dy !== 0) {\n const t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy);\n if (t > 1) {\n x = bx;\n y = by;\n }\n else if (t > 0) {\n x += dx * t;\n y += dy * t;\n }\n }\n dx = px - x;\n dy = py - y;\n return dx * dx + dy * dy;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\nimport { createProtoFeature } from \"./proto-feature.js\";\nimport { simplifyPath } from \"./simplify-path.js\";\n/**\n * converts a GeoJSON feature into an intermediate projected JSON vector format\n * with simplification data\n */\nexport function convertFeaturesToProtoFeature(data, options) {\n const protoFeatures = [];\n switch (data.type) {\n case 'FeatureCollection':\n let i = 0;\n for (const feature of data.features) {\n protoFeatures.push(convertFeature(feature, options, i++));\n }\n break;\n case 'Feature':\n protoFeatures.push(convertFeature(data, options));\n break;\n default:\n // single geometry or a geometry collection\n protoFeatures.push(convertFeature({ geometry: data }, options));\n }\n return protoFeatures;\n}\n/**\n * converts a GeoJSON feature into an intermediate projected JSON vector format\n * with simplification data\n */\nfunction convertFeature(geojson, options, index) {\n // GeoJSON geometries can be null, but no vector tile will include them.\n if (!geojson.geometry) {\n return;\n }\n const coords = geojson.geometry.coordinates;\n const type = geojson.geometry.type;\n const tolerance = Math.pow(options.tolerance / ((1 << options.maxZoom) * options.extent), 2);\n let geometry = [];\n let id = geojson.id;\n if (options.promoteId) {\n id = geojson.properties[options.promoteId];\n }\n else if (options.generateId) {\n id = index || 0;\n }\n switch (type) {\n case 'Point':\n convertPoint(coords, geometry);\n break;\n case 'MultiPoint':\n for (const p of coords) {\n convertPoint(p, geometry);\n }\n break;\n case 'LineString':\n convertLine(coords, geometry, tolerance, false);\n break;\n case 'MultiLineString':\n if (options.lineMetrics) {\n // explode into linestrings to be able to track metrics\n for (const line of coords) {\n geometry = [];\n convertLine(line, geometry, tolerance, false);\n features.push(createProtoFeature(id, 'LineString', geometry, geojson.properties));\n }\n return;\n convertLines(coords, geometry, tolerance, false);\n }\n break;\n case 'Polygon':\n convertLines(coords, geometry, tolerance, true);\n break;\n case 'MultiPolygon':\n for (const polygon of coords) {\n const newPolygon = [];\n convertLines(polygon, newPolygon, tolerance, true);\n geometry.push(newPolygon);\n }\n break;\n case 'GeometryCollection':\n for (const singleGeometry of geojson.geometry.geometries) {\n convertFeature(features, {\n id,\n geometry: singleGeometry,\n properties: geojson.properties\n }, options, index);\n }\n break;\n default:\n throw new Error('Input data is not a valid GeoJSON object.');\n }\n return createProtoFeature(id, type, geometry, geojson.properties);\n}\nfunction convertPoint(coords, out) {\n out.push(projectX(coords[0]), projectY(coords[1]), 0);\n}\nfunction convertLine(ring, out, tolerance, isPolygon) {\n let x0, y0;\n let size = 0;\n for (let j = 0; j < ring.length; j++) {\n const x = projectX(ring[j][0]);\n const y = projectY(ring[j][1]);\n out.push(x, y, 0);\n if (j > 0) {\n if (isPolygon) {\n size += (x0 * y - x * y0) / 2; // area\n }\n else {\n size += Math.sqrt(Math.pow(x - x0, 2) + Math.pow(y - y0, 2)); // length\n }\n }\n x0 = x;\n y0 = y;\n }\n const last = out.length - 3;\n out[2] = 1;\n simplifyPath(out, 0, last, tolerance);\n out[last + 2] = 1;\n out.size = Math.abs(size);\n out.start = 0;\n out.end = out.size;\n}\nfunction convertLines(rings, out, tolerance, isPolygon) {\n for (let i = 0; i < rings.length; i++) {\n const geom = [];\n convertLine(rings[i], geom, tolerance, isPolygon);\n out.push(geom);\n }\n}\nfunction projectX(x) {\n return x / 360 + 0.5;\n}\nfunction projectY(y) {\n const sin = Math.sin((y * Math.PI) / 180);\n const y2 = 0.5 - (0.25 * Math.log((1 + sin) / (1 - sin))) / Math.PI;\n return y2 < 0 ? 0 : y2 > 1 ? 1 : y2;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\nimport { createProtoFeature } from \"./proto-feature.js\";\n/* eslint-disable no-continue */\n/**\n * Clip features between two vertical or horizontal axis-parallel lines:\n * | |\n * ___|___ | /\n * / | \\____|____/\n * | |\n *\n * @param k1 and k2 are the line coordinates\n * @param axis: 0 for x, 1 for y\n * @param minAll and maxAll: minimum and maximum coordinate value for all features\n */\n// eslint-disable-next-line max-params, complexity, max-statements\nexport function clipFeatures(features, scale, k1, k2, axis, minAll, maxAll, options) {\n k1 /= scale;\n k2 /= scale;\n if (minAll >= k1 && maxAll < k2) {\n return features;\n }\n // trivial accept\n else if (maxAll < k1 || minAll >= k2) {\n return null; // trivial reject\n }\n const clipped = [];\n for (const feature of features) {\n const geometry = feature.geometry;\n let type = feature.type;\n const min = axis === 0 ? feature.minX : feature.minY;\n const max = axis === 0 ? feature.maxX : feature.maxY;\n if (min >= k1 && max < k2) {\n // trivial accept\n clipped.push(feature);\n continue;\n }\n else if (max < k1 || min >= k2) {\n // trivial reject\n continue;\n }\n let newGeometry = [];\n if (type === 'Point' || type === 'MultiPoint') {\n clipPoints(geometry, newGeometry, k1, k2, axis);\n }\n else if (type === 'LineString') {\n clipLine(geometry, newGeometry, k1, k2, axis, false, options.lineMetrics);\n }\n else if (type === 'MultiLineString') {\n clipLines(geometry, newGeometry, k1, k2, axis, false);\n }\n else if (type === 'Polygon') {\n clipLines(geometry, newGeometry, k1, k2, axis, true);\n }\n else if (type === 'MultiPolygon') {\n for (const polygon of geometry) {\n const newPolygon = [];\n clipLines(polygon, newPolygon, k1, k2, axis, true);\n if (newPolygon.length) {\n newGeometry.push(newPolygon);\n }\n }\n }\n if (newGeometry.length) {\n if (options.lineMetrics && type === 'LineString') {\n for (const line of newGeometry) {\n clipped.push(createProtoFeature(feature.id, type, line, feature.tags));\n }\n continue;\n }\n if (type === 'LineString' || type === 'MultiLineString') {\n if (newGeometry.length === 1) {\n type = 'LineString';\n // @ts-expect-error TODO - use proper GeoJSON geometry types\n newGeometry = newGeometry[0];\n }\n else {\n type = 'MultiLineString';\n }\n }\n if (type === 'Point' || type === 'MultiPoint') {\n type = newGeometry.length === 3 ? 'Point' : 'MultiPoint';\n }\n clipped.push(createProtoFeature(feature.id, type, newGeometry, feature.tags));\n }\n }\n return clipped.length ? clipped : null;\n}\nfunction clipPoints(geom, newGeom, k1, k2, axis) {\n for (let i = 0; i < geom.length; i += 3) {\n const a = geom[i + axis];\n if (a >= k1 && a <= k2) {\n addPoint(newGeom, geom[i], geom[i + 1], geom[i + 2]);\n }\n }\n}\n// eslint-disable-next-line max-params, complexity, max-statements\nfunction clipLine(geom, newGeom, k1, k2, axis, isPolygon, trackMetrics) {\n let slice = newSlice(geom);\n const intersect = axis === 0 ? intersectX : intersectY;\n let len = geom.start;\n let segLen;\n let t;\n for (let i = 0; i < geom.length - 3; i += 3) {\n const ax = geom[i];\n const ay = geom[i + 1];\n const az = geom[i + 2];\n const bx = geom[i + 3];\n const by = geom[i + 4];\n const a = axis === 0 ? ax : ay;\n const b = axis === 0 ? bx : by;\n let exited = false;\n if (trackMetrics) {\n segLen = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2));\n }\n if (a < k1) {\n // ---|--> | (line enters the clip region from the left)\n if (b > k1) {\n t = intersect(slice, ax, ay, bx, by, k1);\n if (trackMetrics) {\n slice.start = len + segLen * t;\n }\n }\n }\n else if (a > k2) {\n // | <--|--- (line enters the clip region from the right)\n if (b < k2) {\n t = intersect(slice, ax, ay, bx, by, k2);\n if (trackMetrics) {\n slice.start = len + segLen * t;\n }\n }\n }\n else {\n addPoint(slice, ax, ay, az);\n }\n if (b < k1 && a >= k1) {\n // <--|--- | or <--|-----|--- (line exits the clip region on the left)\n t = intersect(slice, ax, ay, bx, by, k1);\n exited = true;\n }\n if (b > k2 && a <= k2) {\n // | ---|--> or ---|-----|--> (line exits the clip region on the right)\n t = intersect(slice, ax, ay, bx, by, k2);\n exited = true;\n }\n if (!isPolygon && exited) {\n if (trackMetrics) {\n slice.end = len + segLen * t;\n }\n newGeom.push(slice);\n slice = newSlice(geom);\n }\n if (trackMetrics) {\n len += segLen;\n }\n }\n // add the last point\n let last = geom.length - 3;\n const ax = geom[last];\n const ay = geom[last + 1];\n const az = geom[last + 2];\n const a = axis === 0 ? ax : ay;\n if (a >= k1 && a <= k2)\n addPoint(slice, ax, ay, az);\n // close the polygon if its endpoints are not the same after clipping\n last = slice.length - 3;\n if (isPolygon && last >= 3 && (slice[last] !== slice[0] || slice[last + 1] !== slice[1])) {\n addPoint(slice, slice[0], slice[1], slice[2]);\n }\n // add the final slice\n if (slice.length) {\n newGeom.push(slice);\n }\n}\nclass Slice extends Array {\n size;\n start;\n end;\n}\nfunction newSlice(line) {\n const slice = [];\n slice.size = line.size;\n slice.start = line.start;\n slice.end = line.end;\n return slice;\n}\n// eslint-disable-next-line max-params\nfunction clipLines(geom, newGeom, k1, k2, axis, isPolygon) {\n for (const line of geom) {\n clipLine(line, newGeom, k1, k2, axis, isPolygon, false);\n }\n}\nfunction addPoint(out, x, y, z) {\n out.push(x, y, z);\n}\n// eslint-disable-next-line max-params\nfunction intersectX(out, ax, ay, bx, by, x) {\n const t = (x - ax) / (bx - ax);\n addPoint(out, x, ay + (by - ay) * t, 1);\n return t;\n}\n// eslint-disable-next-line max-params\nfunction intersectY(out, ax, ay, bx, by, y) {\n const t = (y - ay) / (by - ay);\n addPoint(out, ax + (bx - ax) * t, y, 1);\n return t;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://github.com/mapbox/geojson-vt under compatible ISC license\nimport { createProtoFeature } from \"./proto-feature.js\";\nimport { clipFeatures } from \"./clip-features.js\";\n/**\n * Wrap across antemeridian, by clipping into two tiles, shifting the overflowing x coordinates\n * @param list of features to be wrapped\n * @param options buffer and extent\n * @returns\n */\nexport function wrapFeatures(features, options) {\n const buffer = options.buffer / options.extent;\n let merged = features;\n const left = clipFeatures(features, 1, -1 - buffer, buffer, 0, -1, 2, options); // left world copy\n const right = clipFeatures(features, 1, 1 - buffer, 2 + buffer, 0, -1, 2, options); // right world copy\n if (left || right) {\n merged = clipFeatures(features, 1, -buffer, 1 + buffer, 0, -1, 2, options) || []; // center world copy\n if (left) {\n merged = shiftFeatureCoords(left, 1).concat(merged); // merge left into center\n }\n if (right) {\n merged = merged.concat(shiftFeatureCoords(right, -1)); // merge right into center\n }\n }\n return merged;\n}\n/**\n * Shift the x coordinates of a list of features\n * @param features list of features to shift x coordinates for\n * @param offset\n * @returns\n */\nfunction shiftFeatureCoords(features, offset) {\n const newFeatures = [];\n for (let i = 0; i < features.length; i++) {\n const feature = features[i];\n const type = feature.type;\n let newGeometry;\n switch (type) {\n case 'Point':\n case 'MultiPoint':\n case 'LineString':\n newGeometry = shiftCoords(feature.geometry, offset);\n break;\n case 'MultiLineString':\n case 'Polygon':\n newGeometry = [];\n for (const line of feature.geometry) {\n newGeometry.push(shiftCoords(line, offset));\n }\n break;\n case 'MultiPolygon':\n newGeometry = [];\n for (const polygon of feature.geometry) {\n const newPolygon = [];\n for (const line of polygon) {\n // @ts-expect-error TODO\n newPolygon.push(shiftCoords(line, offset));\n }\n newGeometry.push(newPolygon);\n }\n break;\n default:\n throw new Error(String(type));\n }\n newFeatures.push(createProtoFeature(feature.id, type, newGeometry, feature.tags));\n }\n return newFeatures;\n}\nclass Points extends Array {\n size;\n start;\n end;\n}\n/**\n * Shift the x coordinate of every point\n * @param points\n * @param offset\n * @returns\n */\nfunction shiftCoords(points, offset) {\n const newPoints = [];\n newPoints.size = points.size;\n if (points.start !== undefined) {\n newPoints.start = points.start;\n newPoints.end = points.end;\n }\n for (let i = 0; i < points.length; i += 3) {\n newPoints.push(points[i] + offset, points[i + 1], points[i + 2]);\n }\n return newPoints;\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIO,SAAS,2BAA2B,OAAO;AAC9C,QAAM,SAAS,CAAC;AAChB,MAAI,MAAM,QAAQ;AACd,eAAW,SAAS,MAAM,QAAQ;AAC9B,aAAO,KAAK;AAAA,QACR,MAAM,MAAM;AAAA,QACZ,MAAM,6BAA6B,KAAK;AAAA,QACxC,UAAU,6BAA6B,KAAK;AAAA,MAChD,CAAC;AAAA,IACL;AAAA,EACJ;AACA,SAAO;AAAA,IACH,UAAU,6BAA6B,KAAK;AAAA,IAC5C;AAAA,EACJ;AACJ;AACA,SAAS,6BAA6B,OAAO;AACzC,QAAM,WAAW,CAAC;AAClB,aAAW,CAAC,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features", "ax", "ay", "az", "a", "features", "data", "features"]
7
7
  }
@@ -5,7 +5,7 @@
5
5
  import { parseMVT } from "./lib/parse-mvt.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.3.0" !== 'undefined' ? "4.3.0" : 'latest';
8
+ const VERSION = typeof "4.3.1" !== 'undefined' ? "4.3.1" : 'latest';
9
9
  /**
10
10
  * Worker loader for the Mapbox Vector Tile format
11
11
  */
@@ -1995,7 +1995,7 @@
1995
1995
  var dist_default = new Log({ id: "@probe.gl/log" });
1996
1996
 
1997
1997
  // ../loader-utils/src/lib/log-utils/log.ts
1998
- var VERSION2 = true ? "4.3.0" : "latest";
1998
+ var VERSION2 = true ? "4.3.1" : "latest";
1999
1999
  var version = VERSION2[0] >= "0" && VERSION2[0] <= "9" ? `v${VERSION2}` : "";
2000
2000
  function createLog() {
2001
2001
  const log2 = new Log({ id: "loaders.gl" });
@@ -2867,7 +2867,7 @@
2867
2867
  }
2868
2868
 
2869
2869
  // src/mvt-loader.ts
2870
- var VERSION3 = true ? "4.3.0" : "latest";
2870
+ var VERSION3 = true ? "4.3.1" : "latest";
2871
2871
  var MVTWorkerLoader = {
2872
2872
  dataType: null,
2873
2873
  batchType: null,
@@ -4,7 +4,7 @@
4
4
  import { parseTileJSON } from "./lib/parse-tilejson.js";
5
5
  // __VERSION__ is injected by babel-plugin-version-inline
6
6
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
- const VERSION = typeof "4.3.0" !== 'undefined' ? "4.3.0" : 'latest';
7
+ const VERSION = typeof "4.3.1" !== 'undefined' ? "4.3.1" : 'latest';
8
8
  /**
9
9
  * Loader for TileJSON metadata
10
10
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loaders.gl/mvt",
3
3
  "description": "Loader for Mapbox Vector Tiles",
4
- "version": "4.3.1",
4
+ "version": "4.3.2",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "publishConfig": {
@@ -44,10 +44,10 @@
44
44
  "build-worker": "esbuild src/workers/mvt-worker.ts --bundle --outfile=dist/mvt-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
45
45
  },
46
46
  "dependencies": {
47
- "@loaders.gl/gis": "4.3.1",
48
- "@loaders.gl/images": "4.3.1",
49
- "@loaders.gl/loader-utils": "4.3.1",
50
- "@loaders.gl/schema": "4.3.1",
47
+ "@loaders.gl/gis": "4.3.2",
48
+ "@loaders.gl/images": "4.3.2",
49
+ "@loaders.gl/loader-utils": "4.3.2",
50
+ "@loaders.gl/schema": "4.3.2",
51
51
  "@math.gl/polygon": "^4.1.0",
52
52
  "@probe.gl/stats": "^4.0.0",
53
53
  "pbf": "^3.2.1"
@@ -58,5 +58,5 @@
58
58
  "peerDependencies": {
59
59
  "@loaders.gl/core": "^4.3.0"
60
60
  },
61
- "gitHead": "70a883ab6bc84647c49963215dd6ff62d4d61de3"
61
+ "gitHead": "b4203b8703f64a38d6f79a3113bc7bb51d45c93a"
62
62
  }