UNPKG

@loaders.gl/mvt

Version:

Loader for Mapbox Vector Tiles

7 lines 68.3 kB
(function webpackUniversalModuleDefinition(root, factory) { if (typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if (typeof define === 'function' && define.amd) define([], factory); else if (typeof exports === 'object') exports['loaders'] = factory(); else root['loaders'] = factory();})(globalThis, function () { "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.2",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.2",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.2",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.2";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