@loaders.gl/mvt 4.4.0-alpha.1 → 4.4.0-alpha.9
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/README.md +14 -1
- package/dist/dist.dev.js +412 -39
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +414 -26
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/encode-mvt.d.ts +19 -0
- package/dist/lib/encode-mvt.d.ts.map +1 -0
- package/dist/lib/encode-mvt.js +15 -0
- package/dist/lib/encode-mvt.js.map +1 -0
- package/dist/lib/get-schemas-from-tilejson.js +1 -0
- package/dist/lib/get-schemas-from-tilejson.js.map +1 -0
- package/dist/lib/mapbox-vt-pbf/geojson-wrapper.d.ts +25 -0
- package/dist/lib/mapbox-vt-pbf/geojson-wrapper.d.ts.map +1 -0
- package/dist/lib/mapbox-vt-pbf/geojson-wrapper.js +73 -0
- package/dist/lib/mapbox-vt-pbf/geojson-wrapper.js.map +1 -0
- package/dist/lib/mapbox-vt-pbf/to-vector-tile.d.ts +52 -0
- package/dist/lib/mapbox-vt-pbf/to-vector-tile.d.ts.map +1 -0
- package/dist/lib/mapbox-vt-pbf/to-vector-tile.js +162 -0
- package/dist/lib/mapbox-vt-pbf/to-vector-tile.js.map +1 -0
- package/dist/lib/mvt-pbf/mvt-constants.d.ts.map +1 -0
- package/dist/lib/{pojo-parser → mvt-pbf}/mvt-constants.js +1 -0
- package/dist/lib/mvt-pbf/mvt-constants.js.map +1 -0
- package/dist/lib/mvt-pbf/mvt-types.d.ts.map +1 -0
- package/dist/lib/{pojo-parser → mvt-pbf}/mvt-types.js +1 -0
- package/dist/lib/mvt-pbf/mvt-types.js.map +1 -0
- package/dist/lib/mvt-pbf/parse-geometry-from-pbf.d.ts.map +1 -0
- package/dist/lib/{pojo-parser → mvt-pbf}/parse-geometry-from-pbf.js +1 -0
- package/dist/lib/mvt-pbf/parse-geometry-from-pbf.js.map +1 -0
- package/dist/lib/mvt-pbf/parse-mvt-from-pbf.d.ts.map +1 -0
- package/dist/lib/{pojo-parser → mvt-pbf}/parse-mvt-from-pbf.js +1 -0
- package/dist/lib/mvt-pbf/parse-mvt-from-pbf.js.map +1 -0
- package/dist/lib/mvt-pbf/write-mvt-to-pbf.d.ts +4 -0
- package/dist/lib/mvt-pbf/write-mvt-to-pbf.d.ts.map +1 -0
- package/dist/lib/mvt-pbf/write-mvt-to-pbf.js +130 -0
- package/dist/lib/mvt-pbf/write-mvt-to-pbf.js.map +1 -0
- package/dist/lib/parse-mvt.d.ts.map +1 -1
- package/dist/lib/parse-mvt.js +4 -1
- package/dist/lib/parse-mvt.js.map +1 -0
- package/dist/lib/parse-tilejson.js +1 -0
- package/dist/lib/parse-tilejson.js.map +1 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils/geometry-utils.js +1 -0
- package/dist/lib/utils/geometry-utils.js.map +1 -0
- package/dist/lib/vector-tile/vector-tile-feature.js +1 -0
- package/dist/lib/vector-tile/vector-tile-feature.js.map +1 -0
- package/dist/lib/vector-tile/vector-tile-layer.js +1 -0
- package/dist/lib/vector-tile/vector-tile-layer.js.map +1 -0
- package/dist/lib/vector-tile/vector-tile.js +1 -0
- package/dist/lib/vector-tile/vector-tile.js.map +1 -0
- package/dist/lib/vector-tiler/features/clip-features.js +1 -0
- package/dist/lib/vector-tiler/features/clip-features.js.map +1 -0
- package/dist/lib/vector-tiler/features/convert-feature.js +1 -0
- package/dist/lib/vector-tiler/features/convert-feature.js.map +1 -0
- package/dist/lib/vector-tiler/features/proto-feature.js +1 -0
- package/dist/lib/vector-tiler/features/proto-feature.js.map +1 -0
- package/dist/lib/vector-tiler/features/simplify-path.js +1 -0
- package/dist/lib/vector-tiler/features/simplify-path.js.map +1 -0
- package/dist/lib/vector-tiler/features/wrap-features.js +1 -0
- package/dist/lib/vector-tiler/features/wrap-features.js.map +1 -0
- package/dist/lib/vector-tiler/proto-tile.js +1 -0
- package/dist/lib/vector-tiler/proto-tile.js.map +1 -0
- package/dist/lib/vector-tiler/tile-to-geojson.js +1 -0
- package/dist/lib/vector-tiler/tile-to-geojson.js.map +1 -0
- package/dist/lib/vector-tiler/transform-tile.js +1 -0
- package/dist/lib/vector-tiler/transform-tile.js.map +1 -0
- package/dist/mvt-format.js +1 -0
- package/dist/mvt-format.js.map +1 -0
- package/dist/mvt-loader.js +2 -1
- package/dist/mvt-loader.js.map +1 -0
- package/dist/mvt-source.js +2 -1
- package/dist/mvt-source.js.map +1 -0
- package/dist/mvt-worker.js +6 -3
- package/dist/mvt-writer.d.ts +26 -0
- package/dist/mvt-writer.d.ts.map +1 -0
- package/dist/mvt-writer.js +32 -0
- package/dist/mvt-writer.js.map +1 -0
- package/dist/table-tile-source.js +1 -0
- package/dist/table-tile-source.js.map +1 -0
- package/dist/tilejson-loader.js +2 -1
- package/dist/tilejson-loader.js.map +1 -0
- package/dist/workers/mvt-worker.js +1 -0
- package/dist/workers/mvt-worker.js.map +1 -0
- package/package.json +7 -7
- package/src/index.ts +5 -0
- package/src/lib/encode-mvt.ts +31 -0
- package/src/lib/mapbox-vt-pbf/geojson-to-vt.ts.disabled +76 -0
- package/src/lib/mapbox-vt-pbf/geojson-wrapper.ts +89 -0
- package/src/lib/mapbox-vt-pbf/to-vector-tile.ts +229 -0
- package/src/lib/mvt-pbf/write-mvt-to-pbf.ts +158 -0
- package/src/lib/parse-mvt.ts +3 -1
- package/src/mvt-source.ts +1 -1
- package/src/mvt-writer.ts +35 -0
- package/dist/lib/pojo-parser/mvt-constants.d.ts.map +0 -1
- package/dist/lib/pojo-parser/mvt-types.d.ts.map +0 -1
- package/dist/lib/pojo-parser/parse-geometry-from-pbf.d.ts.map +0 -1
- package/dist/lib/pojo-parser/parse-mvt-from-pbf.d.ts.map +0 -1
- /package/dist/lib/{pojo-parser → mvt-pbf}/mvt-constants.d.ts +0 -0
- /package/dist/lib/{pojo-parser → mvt-pbf}/mvt-types.d.ts +0 -0
- /package/dist/lib/{pojo-parser → mvt-pbf}/parse-geometry-from-pbf.d.ts +0 -0
- /package/dist/lib/{pojo-parser → mvt-pbf}/parse-mvt-from-pbf.d.ts +0 -0
- /package/src/lib/{pojo-parser → mvt-pbf}/mvt-constants.ts +0 -0
- /package/src/lib/{pojo-parser → mvt-pbf}/mvt-types.ts +0 -0
- /package/src/lib/{pojo-parser → mvt-pbf}/parse-geometry-from-pbf.ts +0 -0
- /package/src/lib/{pojo-parser → mvt-pbf}/parse-mvt-from-pbf.ts +0 -0
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 Er=Object.create;var Q=Object.defineProperty;var Mr=Object.getOwnPropertyDescriptor;var Cr=Object.getOwnPropertyNames;var Lr=Object.getPrototypeOf,Vr=Object.prototype.hasOwnProperty;var kr=(e,t,r)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var De=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Nr=(e,t)=>{for(var r in t)Q(e,r,{get:t[r],enumerable:!0})},pe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Cr(t))!Vr.call(e,o)&&o!==r&&Q(e,o,{get:()=>t[o],enumerable:!(n=Mr(t,o))||n.enumerable});return e},de=(e,t,r)=>(pe(e,t,"default"),r&&pe(r,t,"default")),mt=(e,t,r)=>(r=e!=null?Er(Lr(e)):{},pe(t||!e||!e.__esModule?Q(r,"default",{value:e,enumerable:!0}):r,e)),Dr=e=>pe(Q({},"__esModule",{value:!0}),e);var W=(e,t,r)=>(kr(e,typeof t!="symbol"?t+"":t,r),r);var yt=De((ai,gt)=>{gt.exports=globalThis.loaders});var Kt=De(Ye=>{Ye.read=function(e,t,r,n,o){var i,s,a=o*8-n-1,l=(1<<a)-1,c=l>>1,f=-7,u=r?o-1:0,h=r?-1:1,p=e[t+u];for(u+=h,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=i*256+e[t+u],u+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=s*256+e[t+u],u+=h,f-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,n),i=i-c}return(p?-1:1)*s*Math.pow(2,i-n)};Ye.write=function(e,t,r,n,o,i){var s,a,l,c=i*8-o-1,f=(1<<c)-1,u=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?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,o),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,o),s=0));o>=8;e[r+p]=a&255,p+=d,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[r+p]=s&255,p+=d,s/=256,c-=8);e[r+p-d]|=y*128}});var rr=De((ra,tr)=>{"use strict";tr.exports=x;var Ie=Kt();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 Ke=(1<<16)*(1<<16),Xt=1/Ke,Zn=12,er=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),o=n>>3,i=this.pos;this.type=n&7,e(o,t,this),this.pos===i&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Se(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=qt(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Se(this.buf,this.pos)+Se(this.buf,this.pos+4)*Ke;return this.pos+=8,e},readSFixed64:function(){var e=Se(this.buf,this.pos)+qt(this.buf,this.pos+4)*Ke;return this.pos+=8,e},readFloat:function(){var e=Ie.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Ie.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,Yn(r,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>=Zn&&er?co(this.buf,t,e):lo(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 r=L(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=L(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=L(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=L(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=L(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=L(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=L(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=L(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=L(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 r=new Uint8Array(t);r.set(this.buf),this.buf=r,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),K(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),K(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),K(this.buf,e&-1,this.pos),K(this.buf,Math.floor(e*Xt),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),K(this.buf,e&-1,this.pos),K(this.buf,Math.floor(e*Xt),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Kn(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=fo(this.buf,e,this.pos);var r=this.pos-t;r>=128&&Qt(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Ie.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Ie.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 r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&Qt(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,x.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,qn,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,eo,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,no,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,to,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,ro,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,oo,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,io,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,so,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,ao,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 Yn(e,t,r){var n=r.buf,o,i;if(i=n[r.pos++],o=(i&112)>>4,i<128||(i=n[r.pos++],o|=(i&127)<<3,i<128)||(i=n[r.pos++],o|=(i&127)<<10,i<128)||(i=n[r.pos++],o|=(i&127)<<17,i<128)||(i=n[r.pos++],o|=(i&127)<<24,i<128)||(i=n[r.pos++],o|=(i&1)<<31,i<128))return Y(e,o,t);throw new Error("Expected varint not more than 10 bytes")}function L(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function Y(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Kn(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),Xn(r,n,t),Qn(n,t)}function Xn(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function Qn(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((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 Qt(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var o=r.pos-1;o>=e;o--)r.buf[o+n]=r.buf[o]}function qn(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function eo(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function to(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function ro(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function no(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function oo(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function io(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function so(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function ao(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Se(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function K(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function qt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function lo(e,t,r){for(var n="",o=t;o<r;){var i=e[o],s=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a>r)break;var l,c,f;a===1?i<128&&(s=i):a===2?(l=e[o+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[o+1],c=e[o+2],(l&192)===128&&(c&192)===128&&(s=(i&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[o+1],c=e[o+2],f=e[o+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(i&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,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),n+=String.fromCharCode(s),o+=a}return n}function co(e,t,r){return er.decode(e.subarray(t,r))}function fo(e,t,r){for(var n=0,o,i;n<t.length;n++){if(o=t.charCodeAt(n),o>55295&&o<57344)if(i)if(o<56320){e[r++]=239,e[r++]=191,e[r++]=189,i=o;continue}else o=i-55296<<10|o-56320|65536,i=null;else{o>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):i=o;continue}else i&&(e[r++]=239,e[r++]=191,e[r++]=189,i=null);o<128?e[r++]=o:(o<2048?e[r++]=o>>6|192:(o<65536?e[r++]=o>>12|224:(e[r++]=o>>18|240,e[r++]=o>>12&63|128),e[r++]=o>>6&63|128),e[r++]=o&63|128)}return r}});var he={};Nr(he,{MVTLoader:()=>_e,MVTSource:()=>at,MVTWorkerLoader:()=>et,TableTileSource:()=>dt,TileJSONLoader:()=>$});de(he,mt(yt(),1));function xt(e){let t=[];if(e.fields)for(let r of e.fields)t.push({name:r.name,type:Gr(r),metadata:jr(r)});return{metadata:Or(e),fields:t}}function Or(e){let t={};for(let[r,n]of Object.entries(e))r!=="fields"&&n&&(t[r]=JSON.stringify(n));return t}function Gr(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 jr(e){let t={};for(let[r,n]of Object.entries(e))r!=="name"&&n&&(t[r]=JSON.stringify(n));return t}var bt=e=>e!==null&&typeof e=="object";function Oe(e,t){if(!e||!bt(e))return null;let r={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(r.generator=e.generator),typeof e.generator_options=="string"&&(r.generatorOptions=e.generator_options),r.boundingBox=wt(e.bounds)||wt(e.antimeridian_adjusted_bounds),r.center=Hr(e.center),r.maxZoom=Tt(e.maxzoom),r.minZoom=Tt(e.minzoom),typeof e?.json=="string")try{r.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let n=e.tilestats||r.metaJson?.tilestats,o=zr(n,t),i=Ur(e.vector_layers),s=$r(i,o);return r={...r,layers:s},r.maxZoom===null&&s.length>0&&(r.maxZoom=s[0].maxZoom||null),r.minZoom===null&&s.length>0&&(r.minZoom=s[0].minZoom||null),r}function Ur(e){return Array.isArray(e)?e.map(t=>Rr(t)):[]}function Rr(e){let t=Object.entries(e.fields||[]).map(([n,o])=>({name:n,...vt(String(o))})),r={...e};return delete r.fields,{name:e.id||"",...r,fields:t}}function zr(e,t){return bt(e)&&Array.isArray(e.layers)?e.layers.map(r=>Wr(r,t)):[]}function Wr(e,t){let r=[],n={},o=e.attributes||[];for(let i of o){let s=i.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];n[a]=n[a]||[],n[a].push(i),console.warn("ignoring tilestats indexed field",a)}else r[s]||r.push(Zr(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:r}}function $r(e,t){return e.map(r=>{let n=t.find(s=>s.name===r.name),o=n?.fields||r.fields||[],i={...r,...n,fields:o};return i.schema=xt(i),i})}function wt(e){let t=St(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(It)&&[t[1],t[3]].every(Pt))return[[t[0],t[1]],[t[2],t[3]]]}function Hr(e){let t=St(e);return Array.isArray(t)&&t.length===3&&It(t[0])&&Pt(t[1])&&Jr(t[2])?t:null}function Tt(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function Pt(e){return Number.isFinite(e)&&e<=90&&e>=-90}function It(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Jr(e){return Number.isFinite(e)&&e>=0&&e<=22}function St(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var Ft={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 Zr(e={},t){let r=vt(e.type),n={name:e.attribute,...r};return typeof e.min=="number"&&(n.min=e.min),typeof e.max=="number"&&(n.max=e.max),typeof e.count=="number"&&(n.uniqueValueCount=e.count),e.values&&(n.values=e.values),n.values&&typeof t.maxValues=="number"&&(n.values=n.values?.slice(0,t.maxValues)),n}function vt(e){let t=e.toLowerCase();return!t||Ft[t],Ft[t]||{type:"string"}}var Yr="4.4.0-alpha.0",$={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Yr,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let r=new TextDecoder().decode(e),n=JSON.parse(r),o={...$.options.tilejson,...t?.tilejson};return Oe(n,o)},parseTextSync:(e,t)=>{let r=JSON.parse(e),n={...$.options.tilejson,...t?.tilejson};return Oe(r,n)}};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 At(e){let t=Kr(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=me(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function Kr(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 Ge(e){switch(e.shape){case"array-row-table":case"object-row-table":return Qr(e.data);case"geojson-table":return qr(e.features);case"columnar-table":return Xr(e.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Xr(e){let t=[];for(let[r,n]of Object.entries(e)){let o=en(n,r);t.push(o)}return{fields:t,metadata:{}}}function Qr(e){if(!e.length)throw new Error("deduce from empty table");let t=[],r=e[0];for(let[n,o]of Object.entries(r))t.push(_t(o,n));return{fields:t,metadata:{}}}function qr(e){if(!e.length)throw new Error("deduce from empty table");let t=[],r=e[0].properties||{};for(let[n,o]of Object.entries(r))t.push(_t(o,n));return{fields:t,metadata:{}}}function en(e,t){if(ArrayBuffer.isView(e)){let r=At(e);return{name:t,type:r.type||"null",nullable:r.nullable}}if(Array.isArray(e)&&e.length>0){let r=e[0],n=me(r);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function _t(e,t){let r=me(e);return{name:t,type:r,nullable:!0}}var q={x:0,y:1,z:2};function D(e,t={}){let{start:r=0,end:n=e.length,plane:o="xy"}=t,i=t.size||2,s=0,a=q[o[0]],l=q[o[1]];for(let c=r,f=n-i;c<n;c+=i)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function Ue(e,t,r=2,n,o="xy"){let i=t&&t.length,s=i?t[0]*r:e.length,a=Et(e,0,s,r,!0,n&&n[0],o),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,p,d,y;if(i&&(a=ln(e,t,a,r,n,o)),e.length>80*r){h=f=e[0],p=u=e[1];for(let w=r;w<s;w+=r)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 ee(a,l,r,h,p,c,0),l}function Et(e,t,r,n,o,i,s){let a,l;i===void 0&&(i=D(e,{start:t,end:r,size:n,plane:s}));let c=q[s[0]],f=q[s[1]];if(o===i<0)for(a=t;a<r;a+=n)l=Bt(a,e[a+c],e[a+f],l);else for(a=r-n;a>=t;a-=n)l=Bt(a,e[a+c],e[a+f],l);return l&&xe(l,l.next)&&(re(l),l=l.next),l}function O(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(xe(r,r.next)||T(r.prev,r,r.next)===0)){if(re(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function ee(e,t,r,n,o,i,s){if(!e)return;!s&&i&&pn(e,n,o,i);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,i?on(e,n,o,i):nn(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(c.i/r|0),re(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=sn(O(e),t,r),ee(e,t,r,n,o,i,2)):s===2&&an(e,t,r,n,o,i):ee(O(e),t,r,n,o,i,1);break}}}function nn(e){let t=e.prev,r=e,n=e.next;if(T(t,r,n)>=0)return!1;let o=t.x,i=r.x,s=n.x,a=t.y,l=r.y,c=n.y,f=o<i?o<s?o:s:i<s?i:s,u=a<l?a<c?a:c:l<c?l:c,h=o>i?o>s?o:s:i>s?i:s,p=a>l?a>c?a:c:l>c?l:c,d=n.next;for(;d!==t;){if(d.x>=f&&d.x<=h&&d.y>=u&&d.y<=p&&H(o,a,i,l,s,c,d.x,d.y)&&T(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function on(e,t,r,n){let o=e.prev,i=e,s=e.next;if(T(o,i,s)>=0)return!1;let a=o.x,l=i.x,c=s.x,f=o.y,u=i.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=je(p,d,t,r,n),v=je(y,w,t,r,n),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!==o&&m!==s&&H(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!==o&&g!==s&&H(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!==o&&m!==s&&H(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!==o&&g!==s&&H(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 sn(e,t,r){let n=e;do{let o=n.prev,i=n.next.next;!xe(o,i)&&Mt(o,n,n.next,i)&&te(o,i)&&te(i,o)&&(t.push(o.i/r|0),t.push(n.i/r|0),t.push(i.i/r|0),re(n),re(n.next),n=e=i),n=n.next}while(n!==e);return O(n)}function an(e,t,r,n,o,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&gn(s,a)){let l=Ct(s,a);s=O(s,s.next),l=O(l,l.next),ee(s,t,r,n,o,i,0),ee(l,t,r,n,o,i,0);return}a=a.next}s=s.next}while(s!==e)}function ln(e,t,r,n,o,i){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*n,f=a<l-1?t[a+1]*n:e.length,u=Et(e,c,f,n,!1,o&&o[a+1],i),u===u.next&&(u.steiner=!0),s.push(mn(u));for(s.sort(cn),a=0;a<s.length;a++)r=fn(s[a],r);return r}function cn(e,t){return e.x-t.x}function fn(e,t){let r=un(e,t);if(!r)return t;let n=Ct(r,e);return O(n,n.next),O(r,r.next)}function un(e,t){let r=t,n=e.x,o=e.y,i=-1/0,s;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){let h=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>i&&(i=h,s=r.x<r.next.x?r:r.next,h===n))return s}r=r.next}while(r!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;r=s;do n>=r.x&&r.x>=l&&n!==r.x&&H(o<c?n:i,o,l,c,o<c?i:n,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(n-r.x),te(r,e)&&(u<f||u===f&&(r.x>s.x||r.x===s.x&&hn(s,r)))&&(s=r,f=u)),r=r.next;while(r!==a);return s}function hn(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function pn(e,t,r,n){let o=e;do o.z===0&&(o.z=je(o.x,o.y,t,r,n)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,dn(o)}function dn(e){let t,r,n=1,o,i,s,a,l,c;do{for(i=e,e=null,c=null,o=0;i;){for(o++,a=i,s=0,r=0;r<n&&(s++,a=a.nextZ,!!a);r++);for(l=n;s>0||l>0&&a;)s!==0&&(l===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;i=a}c.nextZ=null,n*=2}while(o>1);return e}function je(e,t,r,n,o){return e=(e-r)*o|0,t=(t-n)*o|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 mn(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function H(e,t,r,n,o,i,s,a){return(o-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(n-a)>=(r-s)*(t-a)&&(r-s)*(i-a)>=(o-s)*(n-a)}function gn(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!yn(e,t)&&(te(e,t)&&te(t,e)&&xn(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,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function xe(e,t){return e.x===t.x&&e.y===t.y}function Mt(e,t,r,n){let o=ye(T(e,t,r)),i=ye(T(e,t,n)),s=ye(T(r,n,e)),a=ye(T(r,n,t));return!!(o!==i&&s!==a||o===0&&ge(e,r,t)||i===0&&ge(e,n,t)||s===0&&ge(r,e,n)||a===0&&ge(r,t,n))}function ge(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function ye(e){return e>0?1:e<0?-1:0}function yn(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Mt(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function te(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 xn(e,t){let r=e,n=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do r.y>i!=r.next.y>i&&r.next.y!==r.y&&o<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Ct(e,t){let r=new ne(e.i,e.x,e.y),n=new ne(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,r.next=o,o.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function Bt(e,t,r,n){let o=new ne(e,t,r);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function re(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 ne=class{constructor(t,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=n}};function we(e,t,r){let n=Pn(e),o=Object.keys(n).filter(i=>n[i]!==Array);return In(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||o,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Pn(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let o=r.properties[n];t[n]=En(o,t[n])}return t}function In(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:o,linePositionsCount:i,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}=r,S=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(n*p),globalFeatureIds:new v(n),featureIds:o>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(i*p),globalFeatureIds:new v(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},P={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&&(P.triangles=[]);for(let b of[m,g,P])for(let A of d){let _=h[A];b.numericProps[A]=new _(b.positions.length/p)}g.pathIndices[s]=i,P.polygonIndices[c]=l,P.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 b of e){let A=b.geometry,_=b.properties||{};switch(A.type){case"Point":Sn(A,m,I,p,_),m.properties.push(ze(_,d)),S&&m.fields.push({id:b.id}),I.pointFeature++;break;case"LineString":vn(A,g,I,p,_),g.properties.push(ze(_,d)),S&&g.fields.push({id:b.id}),I.lineFeature++;break;case"Polygon":An(A,P,I,p,_),P.properties.push(ze(_,d)),S&&P.fields.push({id:b.id}),I.polygonFeature++;break;default:throw new Error("Invalid geometry type")}I.feature++}return Bn(m,g,P,p)}function Sn(e,t,r,n,o){t.positions.set(e.data,r.pointPosition*n);let i=e.data.length/n;We(t,o,r.pointPosition,i),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+i),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+i),r.pointPosition+=i}function vn(e,t,r,n,o){t.positions.set(e.data,r.linePosition*n);let i=e.data.length/n;We(t,o,r.linePosition,i),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+i),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+i);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[r.linePath++]=r.linePosition,r.linePosition+=(c-l)/n}}function An(e,t,r,n,o){t.positions.set(e.data,r.polygonPosition*n);let i=e.data.length/n;We(t,o,r.polygonPosition,i),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+i),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=r.polygonPosition;t.polygonIndices[r.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[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(w-y)/n}let h=r.polygonPosition;_n(t,c,f,{startPosition:l,endPosition:h,coordLength:n})}}function _n(e,t,r,{startPosition:n,endPosition:o,coordLength:i}){if(!e.triangles)return;let s=n*i,a=o*i,l=e.positions.subarray(s,a),c=r[0],f=r.slice(1).map(h=>(h-c)/i),u=Ue(l,f,i,t);for(let h=0,p=u.length;h<p;++h)e.triangles.push(n+u[h])}function Re(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function Bn(e,t,r,n){let o={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Re(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Re(t.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Re(r.numericProps,1)}};return o.polygons&&r.triangles&&(o.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),o}function We(e,t,r,n){for(let o in e.numericProps)if(o in t){let i=t[o];e.numericProps[o].fill(i,r,r+n)}}function ze(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function En(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function oe(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},Mn=M.self||M.window||M.global||{},Cn=M.window||M.self||M.global||{},Ln=M.global||M.self||M.window||{},Vn=M.document||{};var $e=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var kt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),kn=kt&&parseFloat(kt[1])||0;var Te=globalThis,Nn=globalThis.document||{},Fe=globalThis.process||{},Dn=globalThis.console,ns=globalThis.navigator||{};function Nt(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,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function G(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Nt()}var He="4.0.7";function Gn(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var be=class{constructor(t,r,n="sessionStorage"){this.storage=Gn(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Dt(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 Ot(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${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 jn=10;function Gt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Pe[e]||Pe.WHITE)}function jt(e,t,r){return!G&&typeof e=="string"&&(t&&(e=`\x1B[${Gt(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Gt(r)+jn}m${e}\x1B[49m`)),e}function Ut(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),o=e;for(let i of n){let s=o[i];typeof s=="function"&&(t.find(a=>i===a)||(o[i]=s.bind(e)))}}function ie(e,t){if(!e)throw new Error(t||"Assertion failed")}function j(){let e;if(G()&&Te.performance)e=Te?.performance?.now?.();else if("hrtime"in Fe){let t=Fe?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var J={debug:G()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Un={enabled:!0,level:0};function Z(){}var Rt={},zt={once:!0},V=class{constructor({id:t}={id:""}){this.VERSION=He,this._startTs=j(),this._deltaTs=j(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new be(`__probe-${this.id}__`,Un),this.timeStamp(`${this.id} started`),Ut(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((j()-this._startTs).toPrecision(10))}getDelta(){return Number((j()-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,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,J.warn,arguments,zt)}error(t){return this._getLogFunction(0,t,J.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,J.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,J.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,J.debug||J.info,arguments,zt)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||Z,n&&[n],{tag:zn(r)}):Z}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||Z)}group(t,r,n={collapsed:!1}){let o=Wt({logLevel:t,message:r,opts:n}),{collapsed:i}=n;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Z)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=$t(t)}_getLogFunction(t,r,n,o,i){if(this._shouldLog(t)){i=Wt({logLevel:t,message:r,args:o,opts:i}),n=n||i.method,ie(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=j();let s=i.tag||i.message;if(i.once&&s)if(!Rt[s])Rt[s]=j();else return Z;return r=Rn(this.id,i.message,i),n.bind(console,r,...i.args)}return Z}};V.VERSION=He;function $t(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 ie(Number.isFinite(t)&&t>=0),t}function Wt(e){let{logLevel:t,message:r}=e;e.logLevel=$t(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return ie(o==="string"||o==="object"),Object.assign(e,{args:n},e.opts)}function Rn(e,t,r){if(typeof t=="string"){let n=r.time?Ot(Dt(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=jt(t,r.color,r.background)}return t}function zn(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var _s=new V({id:"@probe.gl/log"});var Je="4.4.0-alpha.0",Wn=Je[0]>="0"&&Je[0]<="9"?`v${Je}`:"";function $n(){let e=new V({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=Wn,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var F=$n();function Ht(e,t){return Jt(e||{},t)}function Jt(e,t,r=0){if(r>3)return t;let n={...e};for(let[o,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?n[o]=Jt(n[o]||{},t[o],r+1):n[o]=t[o];return n}function se(){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 B=class{constructor(t,r){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=r,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=se(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(se()-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 U=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}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 r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,o=this.stats[r];return o||(t instanceof B?o=t:o=new B(r,n),this.stats[r]=o),o}};var Hn="",Zt={};function Yt(e){for(let t in Zt)if(e.startsWith(t)){let r=Zt[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Hn}${e}`),e}var Ze=class{optionsType;options;data;url;loadOptions;fetch;_needsRefresh=!0;constructor(t,r,n){n?this.options=Ht({...n,core:Ze.defaultOptions},r):this.options={...r},this.data=t,this.url=typeof t=="string"?Yt(t):"",this.loadOptions={...this.options.core?.loadOptions},this.fetch=Jn(this.loadOptions)}setProps(t){this.options=Object.assign(this.options,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}},k=Ze;W(k,"defaultOptions",{core:{type:"auto",attributions:[],loadOptions:{},loaders:[]}});function Jn(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,o)=>t(n,o);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var Qe=mt(rr(),1);function uo(e){let t=0;for(let r=0,n=e.length-1,o,i;r<e.length;n=r++)o=e[r],i=e[n],t+=(i[0]-o[0])*(o[1]+i[1]);return t}function ae(e,t){if(Array.isArray(e[0])){for(let n of e)ae(n,t);return}let r=e;r[0]/=t,r[1]/=t}function nr(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function le(e,t,r){if(typeof e[0][0]!="number"){for(let s of e)le(s,t,r);return}let n=r*Math.pow(2,t.z),o=r*t.x,i=r*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+o)*360/n-180;let l=180-(a[1]+i)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function or(e,t,r){let{x:n,y:o,z:i}=t,s=r*Math.pow(2,i),a=r*n,l=r*o;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 ir(e){let t=e.length;if(t<=1)return[e];let r=[],n,o;for(let i=0;i<t;i++){let s=uo(e[i]);s!==0&&(o===void 0&&(o=s<0),o===s<0?(n&&r.push(n),n=[e[i]]):n&&n.push(e[i]))}return n&&r.push(n),r}function sr(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[D(e.data)]],indices:[e.indices]};let n=[],o=[],i=[],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=D(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&&(n.push(i),o.push(s)),s=[u],i=[p]):(i.push(p),s.push(u))}return i&&n.push(i),s.length&&o.push(s),{type:r,areas:n,indices:o,data:e.data}}var R=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,r,n,o,i,s){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=o,this._values=i,this._geometryInfo=s,t.readFields(ho,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return ar(this,n,o=>le(o,r,this.extent));default:return ar(this,n,ae)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,o=>or(o,r,this.extent));default:return this._toBinaryCoordinates(n,nr)}}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o=0,i=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<r;){if(o<=0){let u=t.readVarint();n=u&7,o=u>>3}if(o--,n===1||n===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<c&&(c=s),s>f&&(f=s);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let o=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,n={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/o,n={type:"LineString",...t};break;case 3:n=sr(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let s of n.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=n.data.length/o;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(i.id=this.id),i}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o=0,i=0,s=0,a=[],l;for(;t.pos<r;){if(o<=0){let c=t.readVarint();n=c&7,o=c>>3}switch(o--,n){case 1:case 2:i+=t.readSVarint(),s+=t.readSVarint(),n===1&&(l&&a.push(l),l=[]),l&&l.push([i,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o,i=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<r;)if(i<=0&&(o=t.readVarint(),n=o&7,i=o>>3),i--,n===1||n===2)s+=t.readSVarint(),a+=t.readSVarint(),n===1&&c.push(l),f.push(s,a),l+=2;else if(n===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 ${n}`);return{data:f,indices:c}}};W(R,"types",["Unknown","Point","LineString","Polygon"]);function ar(e,t,r){let n=R.types[e.type],o,i,s;switch(e.type){case 1:let l=[];for(o=0;o<t.length;o++)l[o]=t[o][0];s=l,r(s,e.extent);break;case 2:for(s=t,o=0;o<s.length;o++)r(s[o],e.extent);break;case 3:for(s=ir(t),o=0;o<s.length;o++)for(i=0;i<s[o].length;i++)r(s[o][i],e.extent);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:n=`Multi${n}`;let a={type:"Feature",geometry:{type:n,coordinates:s},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function ho(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?po(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function po(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],o=t._values[e.readVarint()];t.properties[n]=o}}var ve=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(mo,this,r),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 r=this._pbf.readVarint()+this._pbf.pos;return new R(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(t,r){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 R(this._pbf,n,this.extent,this._keys,this._values,r)}};function mo(e,t,r){t&&r&&(e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(go(r)))}function go(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}var ce=class{layers;constructor(t,r){this.layers=t.readFields(yo,{},r)}};function yo(e,t,r){if(e===3&&r){let n=new ve(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function qe(e,t){let r=wo(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:Xe(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:lr(e,r)};case"geojson":return lr(e,r);case"binary-geometry":return Xe(e,r);case"binary":return Xe(e,r);default:throw new Error(n||"undefined shape")}}function Xe(e,t){let[r,n]=xo(e,t),o=we(r,n);return o.byteLength=e.byteLength,o}function xo(e,t){let r=[],n={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[r,n];let o=new ce(new Qe.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(o.layers)).forEach(s=>{let a=o.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,n),f=Fo(c,t,s);r.push(f)}}),[r,n]}function lr(e,t){if(e.byteLength<=0)return[];let r=[],n=new ce(new Qe.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(i=>{let s=n.layers[i];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=To(l,t,i);r.push(c)}}),r}function wo(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 To(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function Fo(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var Ae={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],category:"geometry"};var bo="4.4.0-alpha.0",et={...Ae,dataType:null,batchType:null,version:bo,worker:!0,options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},_e={...et,parse:async(e,t)=>qe(e,t),parseSync:qe,binary:!0};var cr="4.4.0-alpha.0";var Po=globalThis.loaders?.parseImageNode,tt=typeof Image<"u",rt=typeof ImageBitmap<"u",Io=Boolean(Po),nt=$e?!0:Io;function fr(e){switch(e){case"auto":return rt||tt||nt;case"imagebitmap":return rt;case"image":return tt;case"data":return nt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function ur(){if(rt)return"imagebitmap";if(tt)return"image";if(nt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function So(e){let t=vo(e);if(!t)throw new Error("Not an image");return t}function hr(e){switch(So(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function vo(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 Ao=/^data:image\/svg\+xml/,_o=/\.svg((\?|#).*)?$/;function Be(e){return e&&(Ao.test(e)||_o.test(e))}function pr(e,t){if(Be(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return ot(e,t)}function ot(e,t){if(Be(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ee(e,t,r){let n=pr(e,r),o=self.URL||self.webkitURL,i=typeof n!="string"&&o.createObjectURL(n);try{return await Bo(i||n,t)}finally{i&&o.revokeObjectURL(i)}}async function Bo(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,o)=>{try{r.onload=()=>n(r),r.onerror=i=>{let s=i instanceof Error?i.message:"error";o(new Error(s))}}catch(i){o(i)}})}var Eo={},dr=!0;async function mr(e,t,r){let n;Be(r)?n=await Ee(e,t,r):n=ot(e,r);let o=t&&t.imagebitmap;return await Mo(n,o)}async function Mo(e,t=null){if((Co(t)||!dr)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),dr=!1}return await createImageBitmap(e)}function Co(e){for(let t in e||Eo)return!1;return!0}function gr(e){return!No(e,"ftyp",4)||!(e[8]&96)?null:Lo(e)}function Lo(e){switch(Vo(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Vo(e,t,r){return String.fromCharCode(...e.slice(t,r))}function ko(e){return[...e].map(t=>t.charCodeAt(0))}function No(e,t,r=0){let n=ko(t);for(let o=0;o<n.length;++o)if(n[o]!==e[o+r])return!1;return!0}var C=!1,fe=!0;function z(e){let t=ue(e);return Oo(t)||Uo(t)||Go(t)||jo(t)||Do(t)}function Do(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=gr(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function Oo(e){let t=ue(e);return t.byteLength>=24&&t.getUint32(0,C)===2303741511?{mimeType:"image/png",width:t.getUint32(16,C),height:t.getUint32(20,C)}:null}function Go(e){let t=ue(e);return t.byteLength>=10&&t.getUint32(0,C)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,fe),height:t.getUint16(8,fe)}:null}function jo(e){let t=ue(e);return t.byteLength>=14&&t.getUint16(0,C)===16973&&t.getUint32(2,fe)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,fe),height:t.getUint32(22,fe)}:null}function Uo(e){let t=ue(e);if(!(t.byteLength>=3&&t.getUint16(0,C)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:o}=Ro(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,C);if(o.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,C),width:t.getUint16(i+7,C)};if(!n.has(s))return null;i+=2,i+=t.getUint16(i,C)}return null}function Ro(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function ue(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 yr(e,t){let{mimeType:r}=z(e)||{},n=globalThis.loaders?.parseImageNode;return oe(n),await n(e,r)}async function xr(e,t,r){t=t||{};let o=(t.image||{}).type||"auto",{url:i}=r||{},s=zo(o),a;switch(s){case"imagebitmap":a=await mr(e,t,i);break;case"image":a=await Ee(e,t,i);break;case"data":a=await yr(e,t);break;default:oe(!1)}return o==="data"&&(a=hr(a)),a}function zo(e){switch(e){case"auto":case"data":return ur();default:return fr(e),e}}var Wo=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],$o=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Ho={image:{type:"auto",decode:!0}},it={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:cr,mimeTypes:$o,extensions:Wo,parse:xr,tests:[e=>Boolean(z(new DataView(e)))],options:Ho};var at={...Ae,version:"0.0.0",type:"mvt",fromUrl:!0,fromBlob:!1,defaultOptions:{mvt:{}},testURL:e=>!0,createDataSource(e,t){return new st(e,t)}},st=class extends k{metadataUrl=null;schema="tms";metadata;extension;mimeType=null;constructor(t,r){super(t,r,at.defaultOptions),this.metadataUrl=r.mvt?.metadataUrl||`${this.url}/tilejson.json`,this.extension=r.mvt?.extension||".png",this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata(),Jo(this.url)&&(this.schema="template")}async getMetadata(){if(!this.metadataUrl)return null;let t;try{t=await this.fetch(this.metadataUrl)}catch(o){return console.error(o.message),null}if(!t.ok)return console.error(t.statusText),null;let r=await t.text();return $.parseTextSync?.(r)||null}getTileMIMEType(){return this.mimeType}async getTile(t){let{x:r,y:n,z:o}=t,i=this.getTileURL(r,n,o),s=await this.fetch(i);return s.ok?await s.arrayBuffer():null}async getTileData(t){let{x:r,y:n,z:o}=t.index,i=await this.getTile({x:r,y:n,z:o,layers:[]});if(i===null)return null;let s=z(i);switch(this.mimeType=this.mimeType||s?.mimeType||"application/vnd.mapbox-vector-tile",this.mimeType){case"application/vnd.mapbox-vector-tile":return await this._parseVectorTile(i,{x:r,y:n,z:o,layers:[]});default:return await this._parseImageTile(i)}}async getImageTile(t){let r=await this.getTile(t);return r?this._parseImageTile(r):null}async _parseImageTile(t){return await it.parse(t,this.loadOptions)}async getVectorTile(t){let r=await this.getTile(t);return r?this._parseVectorTile(r,t):null}async _parseVectorTile(t,r){let n={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:r.x,y:r.y,z:r.z},...this.loadOptions?.mvt},...this.loadOptions};return await _e.parse(t,n)}getMetadataUrl(){return this.metadataUrl}getTileURL(t,r,n){switch(this.schema){case"xyz":return`${this.url}/${t}/${r}/${n}${this.extension}`;case"tms":return`${this.url}/${n}/${t}/${r}${this.extension}`;case"template":return Xo(this.url,t,r,n,"0");default:throw new Error(this.schema)}}};function Jo(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(e)}var Zo=new RegExp("{x}","g"),Yo=new RegExp("{y}","g"),Ko=new RegExp("{z}","g");function Xo(e,t,r,n,o="0"){if(Array.isArray(e)){let s=Qo(o)%e.length;e=e[s]}let i=e;return i=i.replace(Zo,String(t)),i=i.replace(Yo,String(r)),i=i.replace(Ko,String(n)),Number.isInteger(r)&&Number.isInteger(n)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,n)-r-1))),i}function Qo(e){return Math.abs(e.split("").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function wr(e,t,r,n,o){let i=t===o.maxZoom?0:o.tolerance/((1<<t)*o.extent),s={protoFeatures:[],sourceFeatures:null,numPoints:0,numSimplified:0,numFeatures:e.length,x:r,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let a of e)qo(s,a,i,o);return s}function qo(e,t,r,n){let o=t.geometry,i=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(i){case"Point":case"MultiPoint":a=1;for(let l=0;l<o.length;l+=3)s.push(o[l],o[l+1]),e.numPoints++,e.numSimplified++;break;case"LineString":a=2,Me(s,o,e,r,!1,!1);break;case"MultiLineString":a=2;for(let l=0;l<o.length;l++)Me(s,o[l],e,r,!1,l===0);break;case"Polygon":a=3;for(let l=0;l<o.length;l++)Me(s,o[l],e,r,!0,l===0);break;case"MultiPolygon":a=3;for(let l=0;l<o.length;l++){let c=o[l];for(let f=0;f<c.length;f++)Me(s,c[f],e,r,!0,f===0)}break;default:throw new Error(`Unknown geometry type: ${i}`)}if(s.length){let l=t.tags||null;if(i==="LineString"&&n.lineMetrics){l={};for(let f in t.tags)l[f]=t.tags[f];l.mapbox_clip_start=o.start/o.size,l.mapbox_clip_end=o.end/o.size}let c={geometry:s,simplifiedType:a,tags:l};t.id!==null&&(c.id=t.id),e.protoFeatures.push(c)}}function Me(e,t,r,n,o,i){let s=n*n;if(n>0&&t.size<(o?s:n)){r.numPoints+=t.length/3;return}let a=[];for(let l=0;l<t.length;l+=3)(n===0||t[l+2]>s)&&(r.numSimplified++,a.push(t[l],t[l+1])),r.numPoints++;o&&ei(a,i),e.push(a)}function ei(e,t){let r=0;for(let n=0,o=e.length-2;n<e.length;o=n,n+=2)r+=(e[n]-e[o])*(e[n+1]+e[o+1]);if(r>0===t)for(let n=0,o=e.length;n<o/2;n+=2){let i=e[n],s=e[n+1];e[n]=e[o-2-n],e[n+1]=e[o-1-n],e[o-2-n]=i,e[o-1-n]=s}}function lt(e,t){if(e.transformed)return e;let r=1<<e.z,n=e.x,o=e.y;for(let i of e.protoFeatures){let s=i.geometry,a=i.simplifiedType;if(i.geometry=[],a===1)for(let l=0;l<s.length;l+=2)i.geometry.push(Tr(s[l],s[l+1],t,r,n,o));else for(let l=0;l<s.length;l++){let c=[];for(let f=0;f<s[l].length;f+=2)c.push(Tr(s[l][f],s[l][f+1],t,r,n,o));i.geometry.push(c)}}return e.transformed=!0,e}function Tr(e,t,r,n,o,i){return[Math.round(r*(e*n-o)),Math.round(r*(t*n-i))]}function Fr(e,t){let r=[];for(let o of e.protoFeatures){if(!o||!o.geometry)continue;let i,s;switch(o.simplifiedType){case 1:o.geometry.length===1?(i="Point",s=o.geometry[0]):(i="MultiPoint",s=o.geometry);break;case 2:o.geometry.length===1?(i="LineString",s=o.geometry[0]):(i="MultiLineString",s=o.geometry);break;case 3:o.geometry.length>1?(i="MultiPolygon",s=[o.geometry]):(i="Polygon",s=o.geometry);break;default:throw new Error(`${o.simplifiedType}is not a valid simplified type`)}switch(t.coordinates){case"EPSG:4326":case"wgs84":le(s,t.tileIndex,t.extent);break;default:ae(s,t.extent);break}let a={type:"Feature",geometry:{type:i,coordinates:s},properties:o.tags||{},id:o.id};r.push(a)}return r.length===0?null:{shape:"geojson-table",type:"FeatureCollection",features:r}}function N(e,t,r,n){let o={id:e??null,type:t,simplifiedType:void 0,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(t){case"Point":case"MultiPoint":case"LineString":Ce(o,r);break;case"MultiLineString":for(let i of r)Ce(o,i);break;case"Polygon":Ce(o,r[0]);break;case"MultiPolygon":for(let i of r)Ce(o,i[0]);break;default:throw new Error(String(t))}return o}function Ce(e,t){for(let r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function Le(e,t,r,n){let o=n,i=r-t>>1,s=r-t,a,l=e[t],c=e[t+1],f=e[r],u=e[r+1];for(let h=t+3;h<r;h+=3){let p=ti(e[h],e[h+1],l,c,f,u);if(p>o)a=h,o=p;else if(p===o){let d=Math.abs(h-i);d<s&&(a=h,s=d)}}o>n&&(a-t>3&&Le(e,t,a,n),e[a+2]=o,r-a>3&&Le(e,a,r,n))}function ti(e,t,r,n,o,i){let s=o-r,a=i-n;if(s!==0||a!==0){let l=((e-r)*s+(t-n)*a)/(s*s+a*a);l>1?(r=o,n=i):l>0&&(r+=s*l,n+=a*l)}return s=e-r,a=t-n,s*s+a*a}function Pr(e,t){let r=[];switch(e.type){case"FeatureCollection":let n=0;for(let o of e.features)r.push(Ve(o,t,n++));break;case"Feature":r.push(Ve(e,t));break;default:r.push(Ve({geometry:e},t))}return r}function Ve(e,t,r){if(!e.geometry)return;let n=e.geometry.coordinates,o=e.geometry.type,i=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=r||0),o){case"Point":br(n,s);break;case"MultiPoint":for(let l of n)br(l,s);break;case"LineString":ft(n,s,i,!1);break;case"MultiLineString":if(t.lineMetrics){for(let l of n)s=[],ft(l,s,i,!1),features.push(N(a,"LineString",s,e.properties));return}break;case"Polygon":ct(n,s,i,!0);break;case"MultiPolygon":for(let l of n){let c=[];ct(l,c,i,!0),s.push(c)}break;case"GeometryCollection":for(let l of e.geometry.geometries)Ve(features,{id:a,geometry:l,properties:e.properties},t,r);break;default:throw new Error("Input data is not a valid GeoJSON object.")}return N(a,o,s,e.properties)}function br(e,t){t.push(Ir(e[0]),Sr(e[1]),0)}function ft(e,t,r,n){let o,i,s=0;for(let l=0;l<e.length;l++){let c=Ir(e[l][0]),f=Sr(e[l][1]);t.push(c,f,0),l>0&&(n?s+=(o*f-c*i)/2:s+=Math.sqrt(Math.pow(c-o,2)+Math.pow(f-i,2))),o=c,i=f}let a=t.length-3;t[2]=1,Le(t,0,a,r),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function ct(e,t,r,n){for(let o=0;o<e.length;o++){let i=[];ft(e[o],i,r,n),t.push(i)}}function Ir(e){return e/360+.5}function Sr(e){let t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function E(e,t,r,n,o,i,s,a){if(r/=t,n/=t,i>=r&&s<n)return e;if(s<r||i>=n)return null;let l=[];for(let c of e){let f=c.geometry,u=c.type,h=o===0?c.minX:c.minY,p=o===0?c.maxX:c.maxY;if(h>=r&&p<n){l.push(c);continue}else if(p<r||h>=n)continue;let d=[];if(u==="Point"||u==="MultiPoint")ri(f,d,r,n,o);else if(u==="LineString")Ar(f,d,r,n,o,!1,a.lineMetrics);else if(u==="MultiLineString")ut(f,d,r,n,o,!1);else if(u==="Polygon")ut(f,d,r,n,o,!0);else if(u==="MultiPolygon")for(let y of f){let w=[];ut(y,w,r,n,o,!0),w.length&&d.push(w)}if(d.length){if(a.lineMetrics&&u==="LineString"){for(let y of d)l.push(N(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(N(c.id,u,d,c.tags))}}return l.length?l:null}function ri(e,t,r,n,o){for(let i=0;i<e.length;i+=3){let s=e[i+o];s>=r&&s<=n&&X(t,e[i],e[i+1],e[i+2])}}function Ar(e,t,r,n,o,i,s){let a=vr(e),l=o===0?ni:oi,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],P=e[S+3],I=e[S+4],b=o===0?v:m,A=o===0?P:I,_=!1;s&&(f=Math.sqrt(Math.pow(v-P,2)+Math.pow(m-I,2))),b<r?A>r&&(u=l(a,v,m,P,I,r),s&&(a.start=c+f*u)):b>n?A<n&&(u=l(a,v,m,P,I,n),s&&(a.start=c+f*u)):X(a,v,m,g),A<r&&b>=r&&(u=l(a,v,m,P,I,r),_=!0),A>n&&b<=n&&(u=l(a,v,m,P,I,n),_=!0),!i&&_&&(s&&(a.end=c+f*u),t.push(a),a=vr(e)),s&&(c+=f)}let h=e.length-3,p=e[h],d=e[h+1],y=e[h+2],w=o===0?p:d;w>=r&&w<=n&&X(a,p,d,y),h=a.length-3,i&&h>=3&&(a[h]!==a[0]||a[h+1]!==a[1])&&X(a,a[0],a[1],a[2]),a.length&&t.push(a)}function vr(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ut(e,t,r,n,o,i){for(let s of e)Ar(s,t,r,n,o,i,!1)}function X(e,t,r,n){e.push(t,r,n)}function ni(e,t,r,n,o,i){let s=(i-t)/(n-t);return X(e,i,r+(o-r)*s,1),s}function oi(e,t,r,n,o,i){let s=(i-r)/(o-r);return X(e,t+(n-t)*s,i,1),s}function Br(e,t){let r=t.buffer/t.extent,n=e,o=E(e,1,-1-r,r,0,-1,2,t),i=E(e,1,1-r,2+r,0,-1,2,t);return(o||i)&&(n=E(e,1,-r,1+r,0,-1,2,t)||[],o&&(n=_r(o,1).concat(n)),i&&(n=n.concat(_r(i,-1)))),n}function _r(e,t){let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=o.type,s;switch(i){case"Point":case"MultiPoint":case"LineString":s=ht(o.geometry,t);break;case"MultiLineString":case"Polygon":s=[];for(let a of o.geometry)s.push(ht(a,t));break;case"MultiPolygon":s=[];for(let a of o.geometry){let l=[];for(let c of a)l.push(ht(c,t));s.push(l)}break;default:throw new Error(String(i))}r.push(N(o.id,i,s,o.tags))}return r}function ht(e,t){let r=[];r.size=e.size,e.start!==void 0&&(r.start=e.start,r.end=e.end);for(let n=0;n<e.length;n+=3)r.push(e[n]+t,e[n+1],e[n+2]);return r}var dt={name:"TableTiler",id:"table-tiler",module:"mvt",version:"0.0.0",extensions:["mvt"],mimeTypes:["application/octet-stream"],type:"table",fromUrl:!1,fromBlob:!1,defaultOptions:{table:{coordinates:"local",promoteId:void 0,maxZoom:14,indexMaxZoom:5,maxPointsPerTile:1e4,tolerance:3,extent:4096,buffer:64,generateId:void 0}},testURL:e=>e.endsWith(".geojson"),createDataSource(e,t){let r=typeof e=="string"||e instanceof Blob,n=t?.core?.loaders?.[0],o=r?ii(e,n):e;return new ke(o,t)}},Ne=class extends k{stats=new U({id:"table-tile-source",stats:[new B("tiles","count"),new B("features","count")]});mimeType="application/vnd.mapbox-vector-tile";localCoordinates=!0;tableOptions;schema=null;tiles={};tileCoords=[];ready;metadata;constructor(t,r){super(t,r,dt.defaultOptions),this.tableOptions=this.options.table,this.getTileData=this.getTileData.bind(this),this.ready=this.initializeTilesAsync(t),this.metadata=this.getMetadata()}async initializeTilesAsync(t){let r=await t;this.schema=Ge(r),this.createRootTiles(r)}async getMetadata(){return await this.ready,{schema:this.schema,minZoom:0,maxZoom:this.tableOptions.maxZoom}}async getSchema(){return await this.ready,this.schema}async getVectorTile(t){await this.ready;let r=this.getTileSync(t);return F.info(2,"getVectorTile",t,r)(),r}async getTile(t){return await this.ready,this.getTileSync(t)}async getTileData(t){let{x:r,y:n,z:o}=t.index;return(await this.getVectorTile({x:r,y:n,z:o}))?.features||[]}getTileSync(t){let r=this.getProtoTile(t);return r?Fr(r,{coordinates:this.tableOptions.coordinates,tileIndex:t,extent:this.tableOptions.extent}):null}createRootTiles(t){if(this.tableOptions.maxZoom<0||this.tableOptions.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(this.tableOptions.promoteId&&this.tableOptions.generateId)throw new Error("promoteId and generateId cannot be used together.");F.log(1,"TableVectorTileSource creating root tiles",this.tableOptions)(),F.time(1,"preprocess table")();let r=Pr(t,this.tableOptions);if(F.timeEnd(1,"preprocess table")(),F.time(1,"generate tiles")(),r=Br(r,this.tableOptions),r.length===0){F.log(1,"TableVectorTileSource: no features generated")();return}this.splitTile(r,0,0,0);let n=this.tiles[0];F.log(1,`root tile features: ${n.numFeatures}, points: ${n.numPoints}`)(),F.timeEnd(1,"generate tiles")(),F.log(1,`TableVectorTileSource: tiles generated: ${this.stats.get("total").count}`,this.stats)()}getProtoTile(t){let{z:r,y:n}=t,{x:o}=t,{extent:i}=this.tableOptions;if(r<0||r>24)return null;let s=1<<r;o=o+s&s-1;let a=pt(r,o,n);if(this.tiles[a])return lt(this.tiles[a],i);F.log(F,"drilling down to z%d-%d-%d",r,o,n)();let l=r,c=o,f=n,u;for(;!u&&l>0;)l--,c=c>>1,f=f>>1,u=this.tiles[pt(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,r,o,n),F.timeEnd(1,"drilling down")(),this.tiles[a]?lt(this.tiles[a],i):null)}splitTile(t,r,n,o,i,s,a){let l=[t,r,n,o];for(;l.length;){o=l.pop(),n=l.pop(),r=l.pop(),t=l.pop();let c=1<<r,f=pt(r,n,o),u=this.tiles[f];if(!u){F.time(2,"tile creation")(),u=this.tiles[f]=wr(t,r,n,o,this.tableOptions),this.tileCoords.push({z:r,x:n,y:o});let I=`z${r}`,b=this.stats.get(I,"count");b.incrementCount(),b=this.stats.get("total"),b.incrementCount(),b=Ne.stats.get(I,"count"),b.incrementCount(),b=Ne.stats.get("total"),b.incrementCount(),F.log(2,"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,o,u.numFeatures,u.numPoints,u.numSimplified)(),F.timeEnd(2,"tile creation")()}if(u.sourceFeatures=t,i===void 0){if(r===this.tableOptions.indexMaxZoom||u.numPoints<=this.tableOptions.maxPointsPerTile)continue}else{if(r===this.tableOptions.maxZoom||r===i)continue;if(i!==void 0){let I=i-r;if(n!==s>>I||o!==a>>I)continue}}if(u.sourceFeatures=null,t.length===0)continue;F.time(2,"clipping tile")();let h=.5*this.tableOptions.buffer/this.tableOptions.extent,p=.5-h,d=.5+h,y=1+h,w=null,S=null,v=null,m=null,g=E(t,c,n-h,n+d,0,u.minX,u.maxX,this.tableOptions),P=E(t,c,n+p,n+y,0,u.minX,u.maxX,this.tableOptions);t=null,g&&(w=E(g,c,o-h,o+d,1,u.minY,u.maxY,this.tableOptions),S=E(g,c,o+p,o+y,1,u.minY,u.maxY,this.tableOptions),g=null),P&&(v=E(P,c,o-h,o+d,1,u.minY,u.maxY,this.tableOptions),m=E(P,c,o+p,o+y,1,u.minY,u.maxY,this.tableOptions),P=null),F.timeEnd(2,"clipping tile")(),l.push(w||[],r+1,n*2,o*2),l.push(S||[],r+1,n*2,o*2+1),l.push(v||[],r+1,n*2+1,o*2),l.push(m||[],r+1,n*2+1,o*2+1)}}},ke=Ne;W(ke,"stats",new U({id:"table-tile-source-all",stats:[new B("count","tiles"),new B("count","features")]}));function pt(e,t,r){return((1<<e)*r+t)*32+e}async function ii(e,t){if(typeof e=="string"){let o=await(await fetch(e)).arrayBuffer();return await t.parse(o)}let r=await e.arrayBuffer();return await t.parse(r)}return Dr(he);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var Zr=Object.create;var re=Object.defineProperty;var Yr=Object.getOwnPropertyDescriptor;var Kr=Object.getOwnPropertyNames;var Xr=Object.getPrototypeOf,Qr=Object.prototype.hasOwnProperty;var qr=(e,t,r)=>t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Re=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),en=(e,t)=>{for(var r in t)re(e,r,{get:t[r],enumerable:!0})},xe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kr(t))!Qr.call(e,o)&&o!==r&&re(e,o,{get:()=>t[o],enumerable:!(n=Yr(t,o))||n.enumerable});return e},we=(e,t,r)=>(xe(e,t,"default"),r&&xe(r,t,"default")),ze=(e,t,r)=>(r=e!=null?Zr(Xr(e)):{},xe(t||!e||!e.__esModule?re(r,"default",{value:e,enumerable:!0}):r,e)),tn=e=>xe(re({},"__esModule",{value:!0}),e);var J=(e,t,r)=>(qr(e,typeof t!="symbol"?t+"":t,r),r);var _t=Re((Ui,At)=>{At.exports=globalThis.loaders});var ar=Re(rt=>{rt.read=function(e,t,r,n,o){var i,s,a=o*8-n-1,l=(1<<a)-1,c=l>>1,f=-7,u=r?o-1:0,h=r?-1:1,p=e[t+u];for(u+=h,i=p&(1<<-f)-1,p>>=-f,f+=a;f>0;i=i*256+e[t+u],u+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=s*256+e[t+u],u+=h,f-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,n),i=i-c}return(p?-1:1)*s*Math.pow(2,i-n)};rt.write=function(e,t,r,n,o,i){var s,a,l,c=i*8-o-1,f=(1<<c)-1,u=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?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,o),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,o),s=0));o>=8;e[r+p]=a&255,p+=d,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[r+p]=s&255,p+=d,s/=256,c-=8);e[r+p-d]|=y*128}});var ot=Re((za,hr)=>{"use strict";hr.exports=x;var Be=ar();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 nt=(1<<16)*(1<<16),lr=1/nt,ho=12,ur=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),o=n>>3,i=this.pos;this.type=n&7,e(o,t,this),this.pos===i&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Me(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=fr(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Me(this.buf,this.pos)+Me(this.buf,this.pos+4)*nt;return this.pos+=8,e},readSFixed64:function(){var e=Me(this.buf,this.pos)+fr(this.buf,this.pos+4)*nt;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,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,po(r,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>=ho&&ur?_o(this.buf,t,e):Ao(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 r=L(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=L(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=L(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=L(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=L(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=L(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=L(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=L(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=L(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 r=new Uint8Array(t);r.set(this.buf),this.buf=r,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),Q(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Q(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Q(this.buf,e&-1,this.pos),Q(this.buf,Math.floor(e*lr),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Q(this.buf,e&-1,this.pos),Q(this.buf,Math.floor(e*lr),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){mo(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=Bo(this.buf,e,this.pos);var r=this.pos-t;r>=128&&cr(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},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 r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&cr(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,x.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,xo,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,wo,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,bo,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,To,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Fo,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Po,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,vo,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Io,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,So,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 po(e,t,r){var n=r.buf,o,i;if(i=n[r.pos++],o=(i&112)>>4,i<128||(i=n[r.pos++],o|=(i&127)<<3,i<128)||(i=n[r.pos++],o|=(i&127)<<10,i<128)||(i=n[r.pos++],o|=(i&127)<<17,i<128)||(i=n[r.pos++],o|=(i&127)<<24,i<128)||(i=n[r.pos++],o|=(i&1)<<31,i<128))return X(e,o,t);throw new Error("Expected varint not more than 10 bytes")}function L(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function X(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function mo(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),go(r,n,t),yo(n,t)}function go(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function yo(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((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 cr(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var o=r.pos-1;o>=e;o--)r.buf[o+n]=r.buf[o]}function xo(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function wo(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function To(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function Fo(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function bo(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function Po(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function vo(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function Io(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function So(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Me(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Q(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function fr(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Ao(e,t,r){for(var n="",o=t;o<r;){var i=e[o],s=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a>r)break;var l,c,f;a===1?i<128&&(s=i):a===2?(l=e[o+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[o+1],c=e[o+2],(l&192)===128&&(c&192)===128&&(s=(i&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[o+1],c=e[o+2],f=e[o+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(i&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,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),n+=String.fromCharCode(s),o+=a}return n}function _o(e,t,r){return ur.decode(e.subarray(t,r))}function Bo(e,t,r){for(var n=0,o,i;n<t.length;n++){if(o=t.charCodeAt(n),o>55295&&o<57344)if(i)if(o<56320){e[r++]=239,e[r++]=191,e[r++]=189,i=o;continue}else o=i-55296<<10|o-56320|65536,i=null;else{o>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):i=o;continue}else i&&(e[r++]=239,e[r++]=191,e[r++]=189,i=null);o<128?e[r++]=o:(o<2048?e[r++]=o>>6|192:(o<65536?e[r++]=o>>12|224:(e[r++]=o>>18|240,e[r++]=o>>12&63|128),e[r++]=o>>6&63|128),e[r++]=o&63|128)}return r}});var ye={};en(ye,{MVTLoader:()=>Ee,MVTSource:()=>wt,MVTWorkerLoader:()=>lt,MVTWriter:()=>Sr,TableTileSource:()=>St,TileJSONLoader:()=>H});we(ye,ze(_t(),1));function Bt(e){let t=[];if(e.fields)for(let r of e.fields)t.push({name:r.name,type:nn(r),metadata:on(r)});return{metadata:rn(e),fields:t}}function rn(e){let t={};for(let[r,n]of Object.entries(e))r!=="fields"&&n&&(t[r]=JSON.stringify(n));return t}function nn(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 on(e){let t={};for(let[r,n]of Object.entries(e))r!=="name"&&n&&(t[r]=JSON.stringify(n));return t}var Lt=e=>e!==null&&typeof e=="object";function We(e,t){if(!e||!Lt(e))return null;let r={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(r.generator=e.generator),typeof e.generator_options=="string"&&(r.generatorOptions=e.generator_options),r.boundingBox=Mt(e.bounds)||Mt(e.antimeridian_adjusted_bounds),r.center=un(e.center),r.maxZoom=Vt(e.maxzoom),r.minZoom=Vt(e.minzoom),typeof e?.json=="string")try{r.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let n=e.tilestats||r.metaJson?.tilestats,o=ln(n,t),i=sn(e.vector_layers),s=fn(i,o);return r={...r,layers:s},r.maxZoom===null&&s.length>0&&(r.maxZoom=s[0].maxZoom||null),r.minZoom===null&&s.length>0&&(r.minZoom=s[0].minZoom||null),r}function sn(e){return Array.isArray(e)?e.map(t=>an(t)):[]}function an(e){let t=Object.entries(e.fields||[]).map(([n,o])=>({name:n,...Ot(String(o))})),r={...e};return delete r.fields,{name:e.id||"",...r,fields:t}}function ln(e,t){return Lt(e)&&Array.isArray(e.layers)?e.layers.map(r=>cn(r,t)):[]}function cn(e,t){let r=[],n={},o=e.attributes||[];for(let i of o){let s=i.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];n[a]=n[a]||[],n[a].push(i),console.warn("ignoring tilestats indexed field",a)}else r[s]||r.push(pn(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:r}}function fn(e,t){return e.map(r=>{let n=t.find(s=>s.name===r.name),o=n?.fields||r.fields||[],i={...r,...n,fields:o};return i.schema=Bt(i),i})}function Mt(e){let t=Ct(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(kt)&&[t[1],t[3]].every(Nt))return[[t[0],t[1]],[t[2],t[3]]]}function un(e){let t=Ct(e);return Array.isArray(t)&&t.length===3&&kt(t[0])&&Nt(t[1])&&hn(t[2])?t:null}function Vt(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function Nt(e){return Number.isFinite(e)&&e<=90&&e>=-90}function kt(e){return Number.isFinite(e)&&e<=180&&e>=-180}function hn(e){return Number.isFinite(e)&&e>=0&&e<=22}function Ct(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var Et={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 pn(e={},t){let r=Ot(e.type),n={name:e.attribute,...r};return typeof e.min=="number"&&(n.min=e.min),typeof e.max=="number"&&(n.max=e.max),typeof e.count=="number"&&(n.uniqueValueCount=e.count),e.values&&(n.values=e.values),n.values&&typeof t.maxValues=="number"&&(n.values=n.values?.slice(0,t.maxValues)),n}function Ot(e){let t=e.toLowerCase();return!t||Et[t],Et[t]||{type:"string"}}var dn="4.4.0-alpha.9",H={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:dn,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let r=new TextDecoder().decode(e),n=JSON.parse(r),o={...H.options.tilejson,...t?.tilejson};return We(n,o)},parseTextSync:(e,t)=>{let r=JSON.parse(e),n={...H.options.tilejson,...t?.tilejson};return We(r,n)}};function Te(e,t="float32"){return e instanceof Date?"date-millisecond":e instanceof Number?t:typeof e=="string"?"utf8":(e===null||e==="undefined","null")}function Dt(e){let t=mn(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=Te(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function mn(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 $e(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 gn(e.data);case"arrow-table":default:throw new Error("Deduce schema")}}function gn(e){let t=[];for(let[r,n]of Object.entries(e)){let o=wn(n,r);t.push(o)}return{fields:t,metadata:{}}}function yn(e){if(!e.length)throw new Error("deduce from empty table");let t=[],r=e[0];for(let[n,o]of Object.entries(r))t.push(Gt(o,n));return{fields:t,metadata:{}}}function xn(e){if(!e.length)throw new Error("deduce from empty table");let t=[],r=e[0].properties||{};for(let[n,o]of Object.entries(r))t.push(Gt(o,n));return{fields:t,metadata:{}}}function wn(e,t){if(ArrayBuffer.isView(e)){let r=Dt(e);return{name:t,type:r.type||"null",nullable:r.nullable}}if(Array.isArray(e)&&e.length>0){let r=e[0],n=Te(r);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function Gt(e,t){let r=Te(e);return{name:t,type:r,nullable:!0}}var ne={x:0,y:1,z:2};function D(e,t={}){let{start:r=0,end:n=e.length,plane:o="xy"}=t,i=t.size||2,s=0,a=ne[o[0]],l=ne[o[1]];for(let c=r,f=n-i;c<n;c+=i)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function He(e,t,r=2,n,o="xy"){let i=t&&t.length,s=i?t[0]*r:e.length,a=Ut(e,0,s,r,!0,n&&n[0],o),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,p,d,y;if(i&&(a=Sn(e,t,a,r,n,o)),e.length>80*r){h=f=e[0],p=u=e[1];for(let w=r;w<s;w+=r)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 oe(a,l,r,h,p,c,0),l}function Ut(e,t,r,n,o,i,s){let a,l;i===void 0&&(i=D(e,{start:t,end:r,size:n,plane:s}));let c=ne[s[0]],f=ne[s[1]];if(o===i<0)for(a=t;a<r;a+=n)l=jt(a,e[a+c],e[a+f],l);else for(a=r-n;a>=t;a-=n)l=jt(a,e[a+c],e[a+f],l);return l&&Pe(l,l.next)&&(se(l),l=l.next),l}function G(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Pe(r,r.next)||T(r.prev,r,r.next)===0)){if(se(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function oe(e,t,r,n,o,i,s){if(!e)return;!s&&i&&Vn(e,n,o,i);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,i?Pn(e,n,o,i):bn(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(c.i/r|0),se(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=vn(G(e),t,r),oe(e,t,r,n,o,i,2)):s===2&&In(e,t,r,n,o,i):oe(G(e),t,r,n,o,i,1);break}}}function bn(e){let t=e.prev,r=e,n=e.next;if(T(t,r,n)>=0)return!1;let o=t.x,i=r.x,s=n.x,a=t.y,l=r.y,c=n.y,f=o<i?o<s?o:s:i<s?i:s,u=a<l?a<c?a:c:l<c?l:c,h=o>i?o>s?o:s:i>s?i:s,p=a>l?a>c?a:c:l>c?l:c,d=n.next;for(;d!==t;){if(d.x>=f&&d.x<=h&&d.y>=u&&d.y<=p&&Z(o,a,i,l,s,c,d.x,d.y)&&T(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Pn(e,t,r,n){let o=e.prev,i=e,s=e.next;if(T(o,i,s)>=0)return!1;let a=o.x,l=i.x,c=s.x,f=o.y,u=i.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,I=Je(p,d,t,r,n),S=Je(y,w,t,r,n),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=I&&g&&g.z<=S;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=w&&m!==o&&m!==s&&Z(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!==o&&g!==s&&Z(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>=I;){if(m.x>=p&&m.x<=y&&m.y>=d&&m.y<=w&&m!==o&&m!==s&&Z(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<=S;){if(g.x>=p&&g.x<=y&&g.y>=d&&g.y<=w&&g!==o&&g!==s&&Z(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 vn(e,t,r){let n=e;do{let o=n.prev,i=n.next.next;!Pe(o,i)&&Rt(o,n,n.next,i)&&ie(o,i)&&ie(i,o)&&(t.push(o.i/r|0),t.push(n.i/r|0),t.push(i.i/r|0),se(n),se(n.next),n=e=i),n=n.next}while(n!==e);return G(n)}function In(e,t,r,n,o,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Nn(s,a)){let l=zt(s,a);s=G(s,s.next),l=G(l,l.next),oe(s,t,r,n,o,i,0),oe(l,t,r,n,o,i,0);return}a=a.next}s=s.next}while(s!==e)}function Sn(e,t,r,n,o,i){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*n,f=a<l-1?t[a+1]*n:e.length,u=Ut(e,c,f,n,!1,o&&o[a+1],i),u===u.next&&(u.steiner=!0),s.push(Ln(u));for(s.sort(An),a=0;a<s.length;a++)r=_n(s[a],r);return r}function An(e,t){return e.x-t.x}function _n(e,t){let r=Bn(e,t);if(!r)return t;let n=zt(r,e);return G(n,n.next),G(r,r.next)}function Bn(e,t){let r=t,n=e.x,o=e.y,i=-1/0,s;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){let h=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>i&&(i=h,s=r.x<r.next.x?r:r.next,h===n))return s}r=r.next}while(r!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;r=s;do n>=r.x&&r.x>=l&&n!==r.x&&Z(o<c?n:i,o,l,c,o<c?i:n,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(n-r.x),ie(r,e)&&(u<f||u===f&&(r.x>s.x||r.x===s.x&&Mn(s,r)))&&(s=r,f=u)),r=r.next;while(r!==a);return s}function Mn(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function Vn(e,t,r,n){let o=e;do o.z===0&&(o.z=Je(o.x,o.y,t,r,n)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,En(o)}function En(e){let t,r,n=1,o,i,s,a,l,c;do{for(i=e,e=null,c=null,o=0;i;){for(o++,a=i,s=0,r=0;r<n&&(s++,a=a.nextZ,!!a);r++);for(l=n;s>0||l>0&&a;)s!==0&&(l===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;i=a}c.nextZ=null,n*=2}while(o>1);return e}function Je(e,t,r,n,o){return e=(e-r)*o|0,t=(t-n)*o|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 Ln(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Z(e,t,r,n,o,i,s,a){return(o-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(n-a)>=(r-s)*(t-a)&&(r-s)*(i-a)>=(o-s)*(n-a)}function Nn(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!kn(e,t)&&(ie(e,t)&&ie(t,e)&&Cn(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||Pe(e,t)&&T(e.prev,e,e.next)>0&&T(t.prev,t,t.next)>0)}function T(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Pe(e,t){return e.x===t.x&&e.y===t.y}function Rt(e,t,r,n){let o=be(T(e,t,r)),i=be(T(e,t,n)),s=be(T(r,n,e)),a=be(T(r,n,t));return!!(o!==i&&s!==a||o===0&&Fe(e,r,t)||i===0&&Fe(e,n,t)||s===0&&Fe(r,e,n)||a===0&&Fe(r,t,n))}function Fe(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function be(e){return e>0?1:e<0?-1:0}function kn(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Rt(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function ie(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 Cn(e,t){let r=e,n=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do r.y>i!=r.next.y>i&&r.next.y!==r.y&&o<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function zt(e,t){let r=new ae(e.i,e.x,e.y),n=new ae(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,r.next=o,o.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function jt(e,t,r,n){let o=new ae(e,t,r);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function se(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 ae=class{constructor(t,r,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=r,this.y=n}};function ve(e,t,r){let n=Un(e),o=Object.keys(n).filter(i=>n[i]!==Array);return Rn(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||o,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Un(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let o=r.properties[n];t[n]=Zn(o,t[n])}return t}function Rn(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:o,linePositionsCount:i,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}=r,I=e[0]&&"id"in e[0],S=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(n*p),globalFeatureIds:new S(n),featureIds:o>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(i*p),globalFeatureIds:new S(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},P={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 S(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};w&&(P.triangles=[]);for(let b of[m,g,P])for(let A of d){let _=h[A];b.numericProps[A]=new _(b.positions.length/p)}g.pathIndices[s]=i,P.polygonIndices[c]=l,P.primitivePolygonIndices[f]=l;let v={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let b of e){let A=b.geometry,_=b.properties||{};switch(A.type){case"Point":zn(A,m,v,p,_),m.properties.push(Ye(_,d)),I&&m.fields.push({id:b.id}),v.pointFeature++;break;case"LineString":Wn(A,g,v,p,_),g.properties.push(Ye(_,d)),I&&g.fields.push({id:b.id}),v.lineFeature++;break;case"Polygon":$n(A,P,v,p,_),P.properties.push(Ye(_,d)),I&&P.fields.push({id:b.id}),v.polygonFeature++;break;default:throw new Error("Invalid geometry type")}v.feature++}return Hn(m,g,P,p)}function zn(e,t,r,n,o){t.positions.set(e.data,r.pointPosition*n);let i=e.data.length/n;Ke(t,o,r.pointPosition,i),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+i),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+i),r.pointPosition+=i}function Wn(e,t,r,n,o){t.positions.set(e.data,r.linePosition*n);let i=e.data.length/n;Ke(t,o,r.linePosition,i),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+i),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+i);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[r.linePath++]=r.linePosition,r.linePosition+=(c-l)/n}}function $n(e,t,r,n,o){t.positions.set(e.data,r.polygonPosition*n);let i=e.data.length/n;Ke(t,o,r.polygonPosition,i),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+i),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=r.polygonPosition;t.polygonIndices[r.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[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(w-y)/n}let h=r.polygonPosition;Jn(t,c,f,{startPosition:l,endPosition:h,coordLength:n})}}function Jn(e,t,r,{startPosition:n,endPosition:o,coordLength:i}){if(!e.triangles)return;let s=n*i,a=o*i,l=e.positions.subarray(s,a),c=r[0],f=r.slice(1).map(h=>(h-c)/i),u=He(l,f,i,t);for(let h=0,p=u.length;h<p;++h)e.triangles.push(n+u[h])}function Ze(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function Hn(e,t,r,n){let o={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:n},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Ze(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Ze(t.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:n},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Ze(r.numericProps,1)}};return o.polygons&&r.triangles&&(o.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),o}function Ke(e,t,r,n){for(let o in e.numericProps)if(o in t){let i=t[o];e.numericProps[o].fill(i,r,r+n)}}function Ye(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function Zn(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function le(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var V={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Yn=V.self||V.window||V.global||{},Kn=V.window||V.self||V.global||{},Xn=V.global||V.self||V.window||{},Qn=V.document||{};var Xe=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Jt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),qn=Jt&&parseFloat(Jt[1])||0;var Ie=globalThis,eo=globalThis.document||{},Se=globalThis.process||{},to=globalThis.console,Os=globalThis.navigator||{};function Ht(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,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}function j(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Ht()}var Qe="4.0.7";function no(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var Ae=class{constructor(t,r,n="sessionStorage"){this.storage=no(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}};function Zt(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 Yt(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var _e;(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"})(_e||(_e={}));var oo=10;function Kt(e){return typeof e!="string"?e:(e=e.toUpperCase(),_e[e]||_e.WHITE)}function Xt(e,t,r){return!j&&typeof e=="string"&&(t&&(e=`\x1B[${Kt(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Kt(r)+oo}m${e}\x1B[49m`)),e}function Qt(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),o=e;for(let i of n){let s=o[i];typeof s=="function"&&(t.find(a=>i===a)||(o[i]=s.bind(e)))}}function ce(e,t){if(!e)throw new Error(t||"Assertion failed")}function U(){let e;if(j()&&Ie.performance)e=Ie?.performance?.now?.();else if("hrtime"in Se){let t=Se?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Y={debug:j()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},io={enabled:!0,level:0};function K(){}var qt={},er={once:!0},k=class{constructor({id:t}={id:""}){this.VERSION=Qe,this._startTs=U(),this._deltaTs=U(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Ae(`__probe-${this.id}__`,io),this.timeStamp(`${this.id} started`),Qt(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((U()-this._startTs).toPrecision(10))}getDelta(){return Number((U()-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,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,Y.warn,arguments,er)}error(t){return this._getLogFunction(0,t,Y.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,Y.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Y.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Y.debug||Y.info,arguments,er)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||K,n&&[n],{tag:ao(r)}):K}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||K)}group(t,r,n={collapsed:!1}){let o=tr({logLevel:t,message:r,opts:n}),{collapsed:i}=n;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||K)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=rr(t)}_getLogFunction(t,r,n,o,i){if(this._shouldLog(t)){i=tr({logLevel:t,message:r,args:o,opts:i}),n=n||i.method,ce(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=U();let s=i.tag||i.message;if(i.once&&s)if(!qt[s])qt[s]=U();else return K;return r=so(this.id,i.message,i),n.bind(console,r,...i.args)}return K}};k.VERSION=Qe;function rr(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 ce(Number.isFinite(t)&&t>=0),t}function tr(e){let{logLevel:t,message:r}=e;e.logLevel=rr(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return ce(o==="string"||o==="object"),Object.assign(e,{args:n},e.opts)}function so(e,t,r){if(typeof t=="string"){let n=r.time?Yt(Zt(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=Xt(t,r.color,r.background)}return t}function ao(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}globalThis.probe={};var la=new k({id:"@probe.gl/log"});var qe="4.4.0-alpha.9",lo=qe[0]>="0"&&qe[0]<="9"?`v${qe}`:"";function co(){let e=new k({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=lo,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var F=co();function nr(e,t){return or(e||{},t)}function or(e,t,r=0){if(r>3)return t;let n={...e};for(let[o,i]of Object.entries(t))i&&typeof i=="object"&&!Array.isArray(i)?n[o]=or(n[o]||{},t[o],r+1):n[o]=t[o];return n}function fe(){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 B=class{constructor(t,r){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=r,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=fe(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(fe()-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 R=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}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 r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,o=this.stats[r];return o||(t instanceof B?o=t:o=new B(r,n),this.stats[r]=o),o}};var fo="",ir={};function sr(e){for(let t in ir)if(e.startsWith(t)){let r=ir[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${fo}${e}`),e}function et(e,t=0,r=e.byteLength-t){let n=new Uint8Array(e,t,r),o=new Uint8Array(n.length);return o.set(n),o.buffer}var tt=class{optionsType;options;data;url;loadOptions;fetch;_needsRefresh=!0;constructor(t,r,n){n?this.options=nr({...n,core:tt.defaultOptions},r):this.options={...r},this.data=t,this.url=typeof t=="string"?sr(t):"",this.loadOptions={...this.options.core?.loadOptions},this.fetch=uo(this.loadOptions)}setProps(t){this.options=Object.assign(this.options,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}},C=tt;J(C,"defaultOptions",{core:{type:"auto",attributions:[],loadOptions:{},loaders:[]}});function uo(e){let t=e?.core?.fetch;if(t&&typeof t=="function")return(n,o)=>t(n,o);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var st=ze(ot(),1);function Mo(e){let t=0;for(let r=0,n=e.length-1,o,i;r<e.length;n=r++)o=e[r],i=e[n],t+=(i[0]-o[0])*(o[1]+i[1]);return t}function ue(e,t){if(Array.isArray(e[0])){for(let n of e)ue(n,t);return}let r=e;r[0]/=t,r[1]/=t}function pr(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function he(e,t,r){if(typeof e[0][0]!="number"){for(let s of e)he(s,t,r);return}let n=r*Math.pow(2,t.z),o=r*t.x,i=r*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+o)*360/n-180;let l=180-(a[1]+i)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function dr(e,t,r){let{x:n,y:o,z:i}=t,s=r*Math.pow(2,i),a=r*n,l=r*o;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 mr(e){let t=e.length;if(t<=1)return[e];let r=[],n,o;for(let i=0;i<t;i++){let s=Mo(e[i]);s!==0&&(o===void 0&&(o=s<0),o===s<0?(n&&r.push(n),n=[e[i]]):n&&n.push(e[i]))}return n&&r.push(n),r}function gr(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[D(e.data)]],indices:[e.indices]};let n=[],o=[],i=[],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=D(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&&(n.push(i),o.push(s)),s=[u],i=[p]):(i.push(p),s.push(u))}return i&&n.push(i),s.length&&o.push(s),{type:r,areas:n,indices:o,data:e.data}}var z=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,r,n,o,i,s){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=o,this._values=i,this._geometryInfo=s,t.readFields(Vo,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return yr(this,n,o=>he(o,r,this.extent));default:return yr(this,n,ue)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,o=>dr(o,r,this.extent));default:return this._toBinaryCoordinates(n,pr)}}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o=0,i=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<r;){if(o<=0){let u=t.readVarint();n=u&7,o=u>>3}if(o--,n===1||n===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<c&&(c=s),s>f&&(f=s);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let o=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,n={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/o,n={type:"LineString",...t};break;case 3:n=gr(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=n.indices.length;for(let s of n.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=n.data.length/o;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(i.id=this.id),i}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o=0,i=0,s=0,a=[],l;for(;t.pos<r;){if(o<=0){let c=t.readVarint();n=c&7,o=c>>3}switch(o--,n){case 1:case 2:i+=t.readSVarint(),s+=t.readSVarint(),n===1&&(l&&a.push(l),l=[]),l&&l.push([i,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,o,i=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<r;)if(i<=0&&(o=t.readVarint(),n=o&7,i=o>>3),i--,n===1||n===2)s+=t.readSVarint(),a+=t.readSVarint(),n===1&&c.push(l),f.push(s,a),l+=2;else if(n===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 ${n}`);return{data:f,indices:c}}};J(z,"types",["Unknown","Point","LineString","Polygon"]);function yr(e,t,r){let n=z.types[e.type],o,i,s;switch(e.type){case 1:let l=[];for(o=0;o<t.length;o++)l[o]=t[o][0];s=l,r(s,e.extent);break;case 2:for(s=t,o=0;o<s.length;o++)r(s[o],e.extent);break;case 3:for(s=mr(t),o=0;o<s.length;o++)for(i=0;i<s[o].length;i++)r(s[o][i],e.extent);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:n=`Multi${n}`;let a={type:"Feature",geometry:{type:n,coordinates:s},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function Vo(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?Eo(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function Eo(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],o=t._values[e.readVarint()];t.properties[n]=o}}var Ve=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Lo,this,r),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 r=this._pbf.readVarint()+this._pbf.pos;return new z(this._pbf,r,this.extent,this._keys,this._values)}getBinaryFeature(t,r){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 z(this._pbf,n,this.extent,this._keys,this._values,r)}};function Lo(e,t,r){t&&r&&(e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(No(r)))}function No(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}var pe=class{layers;constructor(t,r){this.layers=t.readFields(ko,{},r)}};function ko(e,t,r){if(e===3&&r){let n=new Ve(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function at(e,t){let r=Oo(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:it(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:xr(e,r)};case"geojson":return xr(e,r);case"binary-geometry":return it(e,r);case"binary":return it(e,r);default:throw new Error(n||"undefined shape")}}function it(e,t){let[r,n]=Co(e,t),o=ve(r,n);return o.byteLength=e.byteLength,o}function Co(e,t){let r=[],n={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[r,n];let o=new pe(new st.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(o.layers)).forEach(s=>{let a=o.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,n),f=Go(c,t,s);r.push(f)}}),[r,n]}function xr(e,t){if(e.byteLength<=0)return[];let r=[],n=new pe(new st.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(i=>{let s=n.layers[i];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=Do(l,t,i);r.push(c)}}),r}function Oo(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 Do(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function Go(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var q={name:"Mapbox Vector Tile",id:"mvt",module:"mvt",extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],category:"geometry"};var jo="4.4.0-alpha.9",lt={...q,dataType:null,batchType:null,version:jo,worker:!0,options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},Ee={...lt,parse:async(e,t)=>at(e,t),parseSync:at,binary:!0};var vr=ze(ot(),1);var Le;(function(e){e[e.layers=3]="layers"})(Le||(Le={}));var N;(function(e){e[e.version=15]="version",e[e.name=1]="name",e[e.features=2]="features",e[e.keys=3]="keys",e[e.values=4]="values",e[e.extent=5]="extent"})(N||(N={}));var W;(function(e){e[e.id=1]="id",e[e.tags=2]="tags",e[e.type=3]="type",e[e.geometry=4]="geometry"})(W||(W={}));var wr;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.POINT=1]="POINT",e[e.LINESTRING=2]="LINESTRING",e[e.POLYGON=3]="POLYGON"})(wr||(wr={}));var Tr;(function(e){e[e.string_value=1]="string_value",e[e.float_value=2]="float_value",e[e.double_value=3]="double_value",e[e.int_value=4]="int_value",e[e.uint_value=5]="uint_value",e[e.sint_value=6]="sint_value",e[e.bool_value=7]="bool_value"})(Tr||(Tr={}));var Fr;(function(e){e[e.MoveTo=1]="MoveTo",e[e.LineTo=2]="LineTo",e[e.ClosePath=7]="ClosePath"})(Fr||(Fr={}));function Pr(e,t){for(let r in e.layers){let n={layer:e.layers[r],keys:[],values:[],keycache:{},valuecache:{}};t.writeMessage(Le.layers,Ro,n)}}function Ro(e,t){let{layer:r}=e;t.writeVarintField(N.version,r.version||1),t.writeStringField(N.name,r.name||""),t.writeVarintField(N.extent,r.extent||4096);for(let i=0;i<r.length;i++)e.feature=r.feature(i),t.writeMessage(N.features,zo,e);let n=e.keys;for(let i=0;i<n.length;i++)t.writeStringField(N.keys,n[i]);let o=e.values;for(let i=0;i<o.length;i++)t.writeMessage(N.values,Jo,o[i])}function zo(e,t){let r=e.feature;r.id!==void 0&&t.writeVarintField(W.id,r.id),t.writeMessage(W.tags,Wo,e),t.writeVarintField(W.type,r.type),t.writeMessage(W.geometry,$o,r)}function Wo(e,t){let r=e.feature,{keys:n,values:o,keycache:i,valuecache:s}=e;for(let a in r.properties){let l=i[a];typeof l>"u"&&(n.push(a),l=n.length-1,i[a]=l),t.writeVarint(l);let c=r.properties[a],f=typeof c;f!=="string"&&f!=="boolean"&&f!=="number"&&(c=JSON.stringify(c));let u=`${f}:${c}`,h=s[u];typeof h>"u"&&(o.push(c),h=o.length-1,s[u]=h),t.writeVarint(h)}}function ct(e,t){return(t<<3)+(e&7)}function br(e){return e<<1^e>>31}function $o(e,t){let r=e.loadGeometry(),n=e.type,o=0,i=0,s=r.length;for(let a=0;a<s;a++){let l=r[a],c=1;n===1&&(c=l.length),t.writeVarint(ct(1,c));let f=n===3?l.length-1:l.length;for(let u=0;u<f;u++){u===1&&n!==1&&t.writeVarint(ct(2,f-1));let h=l[u].x-o,p=l[u].y-i;t.writeVarint(br(h)),t.writeVarint(br(p)),o+=h,i+=p}n===3&&t.writeVarint(ct(7,1))}}function Jo(e,t){switch(typeof e){case"string":t.writeStringField(1,e);break;case"boolean":t.writeBooleanField(7,e);break;case"number":e%1!==0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e);break;default:}}var ft=class{x;y;constructor(t,r){this.x=t,this.y=r}},de=class{options;features;length;constructor(t,r={}){this.options=r,this.features=t,this.length=t.length}feature(t){return new ut(this.features[t],this.options.extent)}},ut=class{id;type;rawGeometry;properties;extent;geometry=[];constructor(t,r){this.id=typeof t.id=="number"?t.id:void 0,this.type=t.type,this.rawGeometry=t.type===1?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=r||4096}loadGeometry(){let t=this.rawGeometry;this.geometry=[];for(let r of t){let n=[];for(let o of r)n.push(new ft(o[0],o[1]));this.geometry.push(n)}return this.geometry}bbox(){this.geometry||this.loadGeometry();let t=this.geometry,r=1/0,n=-1/0,o=1/0,i=-1/0;for(let s of t)for(let a of s)r=Math.min(r,a.x),n=Math.max(n,a.x),o=Math.min(o,a.y),i=Math.max(i,a.y);return[r,o,n,i]}};function Ir(e,t){t=t||{},e=Zo(e);let r=t.extent||4096,n=Yo(e.features,r,t.tileIndex),o=new de(n,{...t,extent:r});return o.name=t.layerName||"geojsonLayer",o.version=t.version||1,o.extent=t.extent||4096,Ho({layers:{[o.name]:o}})}function Ho(e){let t=new vr.default;Pr(e,t);let r=t.finish();return et(r.buffer,r.byteOffset,r.byteOffset+r.byteLength)}function Zo(e){if(Array.isArray(e))return{type:"FeatureCollection",features:e};if(e.type==="Feature")return{type:"FeatureCollection",features:[e]};throw new Error("Invalid GeoJSON object")}function Yo(e,t,r){return e.every(ti)?e:e.map(n=>Ko(n,t,r))}function Ko(e,t,r){let n=e.geometry,o=ri(n.type);return{id:typeof e.id=="number"?e.id:void 0,type:o,geometry:Xo(n,t,r),tags:e.properties||{}}}function Xo(e,t,r){switch(e.type){case"Point":return[ee(e.coordinates,t,r)];case"MultiPoint":return e.coordinates.map(n=>ee(n,t,r));case"LineString":return[e.coordinates.map(n=>ee(n,t,r))];case"MultiLineString":return e.coordinates.map(n=>n.map(o=>ee(o,t,r)));case"Polygon":return e.coordinates.map(n=>n.map(o=>ee(o,t,r)));case"MultiPolygon":return e.coordinates.flatMap(n=>n.map(o=>o.map(i=>ee(i,t,r))));default:throw new Error(`Unsupported geometry type: ${e.type}`)}}function ee(e,t,r){return Qo(e)?[Math.round(e[0]*t),Math.round(e[1]*t)]:r&&qo(e)?ei(e,r,t):[Math.round(e[0]),Math.round(e[1])]}function Qo(e){return Math.abs(e[0])<=1&&Math.abs(e[1])<=1}function qo(e){return Math.abs(e[0])<=180&&Math.abs(e[1])<=90}function ei(e,t,r){let[n,o]=e,{x:i,y:s,z:a}=t,l=r*Math.pow(2,a),c=r*i,f=r*s,u=(n+180)/360*l,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/180/2)))*l/360;return[Math.round(u-c),Math.round(h-f)]}function ti(e){return typeof e?.type=="number"&&Array.isArray(e.geometry)}function ri(e){switch(e){case"Point":case"MultiPoint":return 1;case"LineString":case"MultiLineString":return 2;case"Polygon":case"MultiPolygon":return 3;default:throw new Error(`Unknown geometry type: ${e}`)}}function ht(e,t){let{mvt:r}=t||{},n={layerName:r?.layerName||"geojsonLayer",version:r?.version||1,extent:r?.extent||4096,tileIndex:r?.tileIndex};return Ir(e,n)}var ni="4.4.0-alpha.9",Sr={...q,version:ni,binary:!0,options:{mvt:{layerName:"geojsonLayer",version:1,extent:4096}},async encode(e,t){return ht(e,t)},encodeSync(e,t){return ht(e,t)}};var Ar="4.4.0-alpha.9";var oi=globalThis.loaders?.parseImageNode,pt=typeof Image<"u",dt=typeof ImageBitmap<"u",ii=Boolean(oi),mt=Xe?!0:ii;function _r(e){switch(e){case"auto":return dt||pt||mt;case"imagebitmap":return dt;case"image":return pt;case"data":return mt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function Br(){if(dt)return"imagebitmap";if(pt)return"image";if(mt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function si(e){let t=ai(e);if(!t)throw new Error("Not an image");return t}function Mr(e){switch(si(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function ai(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 li=/^data:image\/svg\+xml/,ci=/\.svg((\?|#).*)?$/;function Ne(e){return e&&(li.test(e)||ci.test(e))}function Vr(e,t){if(Ne(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return gt(e,t)}function gt(e,t){if(Ne(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ke(e,t,r){let n=Vr(e,r),o=self.URL||self.webkitURL,i=typeof n!="string"&&o.createObjectURL(n);try{return await fi(i||n,t)}finally{i&&o.revokeObjectURL(i)}}async function fi(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,o)=>{try{r.onload=()=>n(r),r.onerror=i=>{let s=i instanceof Error?i.message:"error";o(new Error(s))}}catch(i){o(i)}})}var Er=!0;async function Lr(e,t,r){let n;Ne(r)?n=await ke(e,t,r):n=gt(e,r);let o=t&&t.imagebitmap;return await ui(n,o)}async function ui(e,t=null){if((hi(t)||!Er)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),Er=!1}return await createImageBitmap(e)}function hi(e){if(!e)return!0;for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Nr(e){return!gi(e,"ftyp",4)||!(e[8]&96)?null:pi(e)}function pi(e){switch(di(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function di(e,t,r){return String.fromCharCode(...e.slice(t,r))}function mi(e){return[...e].map(t=>t.charCodeAt(0))}function gi(e,t,r=0){let n=mi(t);for(let o=0;o<n.length;++o)if(n[o]!==e[o+r])return!1;return!0}var E=!1,me=!0;function $(e){let t=ge(e);return xi(t)||Fi(t)||wi(t)||Ti(t)||yi(t)}function yi(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=Nr(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function xi(e){let t=ge(e);return t.byteLength>=24&&t.getUint32(0,E)===2303741511?{mimeType:"image/png",width:t.getUint32(16,E),height:t.getUint32(20,E)}:null}function wi(e){let t=ge(e);return t.byteLength>=10&&t.getUint32(0,E)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,me),height:t.getUint16(8,me)}:null}function Ti(e){let t=ge(e);return t.byteLength>=14&&t.getUint16(0,E)===16973&&t.getUint32(2,me)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,me),height:t.getUint32(22,me)}:null}function Fi(e){let t=ge(e);if(!(t.byteLength>=3&&t.getUint16(0,E)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:o}=bi(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,E);if(o.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,E),width:t.getUint16(i+7,E)};if(!n.has(s))return null;i+=2,i+=t.getUint16(i,E)}return null}function bi(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function ge(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 kr(e,t){let{mimeType:r}=$(e)||{},n=globalThis.loaders?.parseImageNode;return le(n),await n(e,r)}async function Cr(e,t,r){t=t||{};let o=(t.image||{}).type||"auto",{url:i}=r||{},s=Pi(o),a;switch(s){case"imagebitmap":a=await Lr(e,t,i);break;case"image":a=await ke(e,t,i);break;case"data":a=await kr(e,t);break;default:le(!1)}return o==="data"&&(a=Mr(a)),a}function Pi(e){switch(e){case"auto":case"data":return Br();default:return _r(e),e}}var vi=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Ii=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Si={image:{type:"auto",decode:!0}},yt={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Ar,mimeTypes:Ii,extensions:vi,parse:Cr,tests:[e=>Boolean($(new DataView(e)))],options:Si};var wt={...q,version:"0.0.0",type:"mvt",fromUrl:!0,fromBlob:!1,defaultOptions:{mvt:{}},testURL:e=>!0,createDataSource(e,t){return new xt(e,t)}},xt=class extends C{metadataUrl=null;schema="tms";metadata;extension;mimeType=null;constructor(t,r){super(t,r,wt.defaultOptions),this.metadataUrl=r.mvt?.metadataUrl||`${this.url}/tilejson.json`,this.extension=r.mvt?.extension||".png",this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata(),Ai(this.url)&&(this.schema="template")}async getMetadata(){if(!this.metadataUrl)return null;let t;try{t=await this.fetch(this.metadataUrl)}catch(o){return console.error(o.message),null}if(!t.ok)return console.error(t.statusText),null;let r=await t.text();return H.parseTextSync?.(r)||null}getTileMIMEType(){return this.mimeType}async getTile(t){let{x:r,y:n,z:o}=t,i=this.getTileURL(r,n,o),s=await this.fetch(i);return s.ok?await s.arrayBuffer():null}async getTileData(t){let{x:r,y:n,z:o}=t.index,i=await this.getTile({x:r,y:n,z:o,layers:[]});if(i===null)return null;let s=$(i);switch(this.mimeType=this.mimeType||s?.mimeType||"application/vnd.mapbox-vector-tile",this.mimeType){case"application/vnd.mapbox-vector-tile":return await this._parseVectorTile(i,{x:r,y:n,z:o,layers:[]});default:return await this._parseImageTile(i)}}async getImageTile(t){let r=await this.getTile(t);return r?this._parseImageTile(r):null}async _parseImageTile(t){return await yt.parse(t,this.loadOptions)}async getVectorTile(t){let r=await this.getTile(t);return r?this._parseVectorTile(r,t):null}async _parseVectorTile(t,r){let n={mvt:{shape:"geojson-table",coordinates:"wgs84",tileIndex:{x:r.x,y:r.y,z:r.z},...this.loadOptions?.mvt},...this.loadOptions};return await Ee.parse(t,n)}getMetadataUrl(){return this.metadataUrl}getTileURL(t,r,n){switch(this.schema){case"xyz":return`${this.url}/${t}/${r}/${n}${this.extension}`;case"tms":return`${this.url}/${n}/${t}/${r}${this.extension}`;case"template":return Vi(this.url,t,r,n,"0");default:throw new Error(this.schema)}}};function Ai(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(e)}var _i=new RegExp("{x}","g"),Bi=new RegExp("{y}","g"),Mi=new RegExp("{z}","g");function Vi(e,t,r,n,o="0"){if(Array.isArray(e)){let s=Ei(o)%e.length;e=e[s]}let i=e;return i=i.replace(_i,String(t)),i=i.replace(Bi,String(r)),i=i.replace(Mi,String(n)),Number.isInteger(r)&&Number.isInteger(n)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,n)-r-1))),i}function Ei(e){return Math.abs(e.split("").reduce((t,r)=>(t<<5)-t+r.charCodeAt(0)|0,0))}function Or(e,t,r,n,o){let i=t===o.maxZoom?0:o.tolerance/((1<<t)*o.extent),s={protoFeatures:[],sourceFeatures:null,numPoints:0,numSimplified:0,numFeatures:e.length,x:r,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let a of e)Li(s,a,i,o);return s}function Li(e,t,r,n){let o=t.geometry,i=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(i){case"Point":case"MultiPoint":a=1;for(let l=0;l<o.length;l+=3)s.push(o[l],o[l+1]),e.numPoints++,e.numSimplified++;break;case"LineString":a=2,Ce(s,o,e,r,!1,!1);break;case"MultiLineString":a=2;for(let l=0;l<o.length;l++)Ce(s,o[l],e,r,!1,l===0);break;case"Polygon":a=3;for(let l=0;l<o.length;l++)Ce(s,o[l],e,r,!0,l===0);break;case"MultiPolygon":a=3;for(let l=0;l<o.length;l++){let c=o[l];for(let f=0;f<c.length;f++)Ce(s,c[f],e,r,!0,f===0)}break;default:throw new Error(`Unknown geometry type: ${i}`)}if(s.length){let l=t.tags||null;if(i==="LineString"&&n.lineMetrics){l={};for(let f in t.tags)l[f]=t.tags[f];l.mapbox_clip_start=o.start/o.size,l.mapbox_clip_end=o.end/o.size}let c={geometry:s,simplifiedType:a,tags:l};t.id!==null&&(c.id=t.id),e.protoFeatures.push(c)}}function Ce(e,t,r,n,o,i){let s=n*n;if(n>0&&t.size<(o?s:n)){r.numPoints+=t.length/3;return}let a=[];for(let l=0;l<t.length;l+=3)(n===0||t[l+2]>s)&&(r.numSimplified++,a.push(t[l],t[l+1])),r.numPoints++;o&&Ni(a,i),e.push(a)}function Ni(e,t){let r=0;for(let n=0,o=e.length-2;n<e.length;o=n,n+=2)r+=(e[n]-e[o])*(e[n+1]+e[o+1]);if(r>0===t)for(let n=0,o=e.length;n<o/2;n+=2){let i=e[n],s=e[n+1];e[n]=e[o-2-n],e[n+1]=e[o-1-n],e[o-2-n]=i,e[o-1-n]=s}}function Tt(e,t){if(e.transformed)return e;let r=1<<e.z,n=e.x,o=e.y;for(let i of e.protoFeatures){let s=i.geometry,a=i.simplifiedType;if(i.geometry=[],a===1)for(let l=0;l<s.length;l+=2)i.geometry.push(Dr(s[l],s[l+1],t,r,n,o));else for(let l=0;l<s.length;l++){let c=[];for(let f=0;f<s[l].length;f+=2)c.push(Dr(s[l][f],s[l][f+1],t,r,n,o));i.geometry.push(c)}}return e.transformed=!0,e}function Dr(e,t,r,n,o,i){return[Math.round(r*(e*n-o)),Math.round(r*(t*n-i))]}function Gr(e,t){let r=[];for(let o of e.protoFeatures){if(!o||!o.geometry)continue;let i,s;switch(o.simplifiedType){case 1:o.geometry.length===1?(i="Point",s=o.geometry[0]):(i="MultiPoint",s=o.geometry);break;case 2:o.geometry.length===1?(i="LineString",s=o.geometry[0]):(i="MultiLineString",s=o.geometry);break;case 3:o.geometry.length>1?(i="MultiPolygon",s=[o.geometry]):(i="Polygon",s=o.geometry);break;default:throw new Error(`${o.simplifiedType}is not a valid simplified type`)}switch(t.coordinates){case"EPSG:4326":case"wgs84":he(s,t.tileIndex,t.extent);break;default:ue(s,t.extent);break}let a={type:"Feature",geometry:{type:i,coordinates:s},properties:o.tags||{},id:o.id};r.push(a)}return r.length===0?null:{shape:"geojson-table",type:"FeatureCollection",features:r}}function O(e,t,r,n){let o={id:e??null,type:t,simplifiedType:void 0,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(t){case"Point":case"MultiPoint":case"LineString":Oe(o,r);break;case"MultiLineString":for(let i of r)Oe(o,i);break;case"Polygon":Oe(o,r[0]);break;case"MultiPolygon":for(let i of r)Oe(o,i[0]);break;default:throw new Error(String(t))}return o}function Oe(e,t){for(let r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function De(e,t,r,n){let o=n,i=r-t>>1,s=r-t,a,l=e[t],c=e[t+1],f=e[r],u=e[r+1];for(let h=t+3;h<r;h+=3){let p=ki(e[h],e[h+1],l,c,f,u);if(p>o)a=h,o=p;else if(p===o){let d=Math.abs(h-i);d<s&&(a=h,s=d)}}o>n&&(a-t>3&&De(e,t,a,n),e[a+2]=o,r-a>3&&De(e,a,r,n))}function ki(e,t,r,n,o,i){let s=o-r,a=i-n;if(s!==0||a!==0){let l=((e-r)*s+(t-n)*a)/(s*s+a*a);l>1?(r=o,n=i):l>0&&(r+=s*l,n+=a*l)}return s=e-r,a=t-n,s*s+a*a}function Ur(e,t){let r=[];switch(e.type){case"FeatureCollection":let n=0;for(let o of e.features)r.push(Ge(o,t,n++));break;case"Feature":r.push(Ge(e,t));break;default:r.push(Ge({geometry:e},t))}return r}function Ge(e,t,r){if(!e.geometry)return;let n=e.geometry.coordinates,o=e.geometry.type,i=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=r||0),o){case"Point":jr(n,s);break;case"MultiPoint":for(let l of n)jr(l,s);break;case"LineString":bt(n,s,i,!1);break;case"MultiLineString":if(t.lineMetrics){for(let l of n)s=[],bt(l,s,i,!1),features.push(O(a,"LineString",s,e.properties));return}break;case"Polygon":Ft(n,s,i,!0);break;case"MultiPolygon":for(let l of n){let c=[];Ft(l,c,i,!0),s.push(c)}break;case"GeometryCollection":for(let l of e.geometry.geometries)Ge(features,{id:a,geometry:l,properties:e.properties},t,r);break;default:throw new Error("Input data is not a valid GeoJSON object.")}return O(a,o,s,e.properties)}function jr(e,t){t.push(Rr(e[0]),zr(e[1]),0)}function bt(e,t,r,n){let o,i,s=0;for(let l=0;l<e.length;l++){let c=Rr(e[l][0]),f=zr(e[l][1]);t.push(c,f,0),l>0&&(n?s+=(o*f-c*i)/2:s+=Math.sqrt(Math.pow(c-o,2)+Math.pow(f-i,2))),o=c,i=f}let a=t.length-3;t[2]=1,De(t,0,a,r),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function Ft(e,t,r,n){for(let o=0;o<e.length;o++){let i=[];bt(e[o],i,r,n),t.push(i)}}function Rr(e){return e/360+.5}function zr(e){let t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function M(e,t,r,n,o,i,s,a){if(r/=t,n/=t,i>=r&&s<n)return e;if(s<r||i>=n)return null;let l=[];for(let c of e){let f=c.geometry,u=c.type,h=o===0?c.minX:c.minY,p=o===0?c.maxX:c.maxY;if(h>=r&&p<n){l.push(c);continue}else if(p<r||h>=n)continue;let d=[];if(u==="Point"||u==="MultiPoint")Ci(f,d,r,n,o);else if(u==="LineString")$r(f,d,r,n,o,!1,a.lineMetrics);else if(u==="MultiLineString")Pt(f,d,r,n,o,!1);else if(u==="Polygon")Pt(f,d,r,n,o,!0);else if(u==="MultiPolygon")for(let y of f){let w=[];Pt(y,w,r,n,o,!0),w.length&&d.push(w)}if(d.length){if(a.lineMetrics&&u==="LineString"){for(let y of d)l.push(O(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(O(c.id,u,d,c.tags))}}return l.length?l:null}function Ci(e,t,r,n,o){for(let i=0;i<e.length;i+=3){let s=e[i+o];s>=r&&s<=n&&te(t,e[i],e[i+1],e[i+2])}}function $r(e,t,r,n,o,i,s){let a=Wr(e),l=o===0?Oi:Di,c=e.start,f,u;for(let I=0;I<e.length-3;I+=3){let S=e[I],m=e[I+1],g=e[I+2],P=e[I+3],v=e[I+4],b=o===0?S:m,A=o===0?P:v,_=!1;s&&(f=Math.sqrt(Math.pow(S-P,2)+Math.pow(m-v,2))),b<r?A>r&&(u=l(a,S,m,P,v,r),s&&(a.start=c+f*u)):b>n?A<n&&(u=l(a,S,m,P,v,n),s&&(a.start=c+f*u)):te(a,S,m,g),A<r&&b>=r&&(u=l(a,S,m,P,v,r),_=!0),A>n&&b<=n&&(u=l(a,S,m,P,v,n),_=!0),!i&&_&&(s&&(a.end=c+f*u),t.push(a),a=Wr(e)),s&&(c+=f)}let h=e.length-3,p=e[h],d=e[h+1],y=e[h+2],w=o===0?p:d;w>=r&&w<=n&&te(a,p,d,y),h=a.length-3,i&&h>=3&&(a[h]!==a[0]||a[h+1]!==a[1])&&te(a,a[0],a[1],a[2]),a.length&&t.push(a)}function Wr(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Pt(e,t,r,n,o,i){for(let s of e)$r(s,t,r,n,o,i,!1)}function te(e,t,r,n){e.push(t,r,n)}function Oi(e,t,r,n,o,i){let s=(i-t)/(n-t);return te(e,i,r+(o-r)*s,1),s}function Di(e,t,r,n,o,i){let s=(i-r)/(o-r);return te(e,t+(n-t)*s,i,1),s}function Hr(e,t){let r=t.buffer/t.extent,n=e,o=M(e,1,-1-r,r,0,-1,2,t),i=M(e,1,1-r,2+r,0,-1,2,t);return(o||i)&&(n=M(e,1,-r,1+r,0,-1,2,t)||[],o&&(n=Jr(o,1).concat(n)),i&&(n=n.concat(Jr(i,-1)))),n}function Jr(e,t){let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=o.type,s;switch(i){case"Point":case"MultiPoint":case"LineString":s=vt(o.geometry,t);break;case"MultiLineString":case"Polygon":s=[];for(let a of o.geometry)s.push(vt(a,t));break;case"MultiPolygon":s=[];for(let a of o.geometry){let l=[];for(let c of a)l.push(vt(c,t));s.push(l)}break;default:throw new Error(String(i))}r.push(O(o.id,i,s,o.tags))}return r}function vt(e,t){let r=[];r.size=e.size,e.start!==void 0&&(r.start=e.start,r.end=e.end);for(let n=0;n<e.length;n+=3)r.push(e[n]+t,e[n+1],e[n+2]);return r}var St={name:"TableTiler",id:"table-tiler",module:"mvt",version:"0.0.0",extensions:["mvt"],mimeTypes:["application/octet-stream"],type:"table",fromUrl:!1,fromBlob:!1,defaultOptions:{table:{coordinates:"local",promoteId:void 0,maxZoom:14,indexMaxZoom:5,maxPointsPerTile:1e4,tolerance:3,extent:4096,buffer:64,generateId:void 0}},testURL:e=>e.endsWith(".geojson"),createDataSource(e,t){let r=typeof e=="string"||e instanceof Blob,n=t?.core?.loaders?.[0],o=r?Gi(e,n):e;return new je(o,t)}},Ue=class extends C{stats=new R({id:"table-tile-source",stats:[new B("tiles","count"),new B("features","count")]});mimeType="application/vnd.mapbox-vector-tile";localCoordinates=!0;tableOptions;schema=null;tiles={};tileCoords=[];ready;metadata;constructor(t,r){super(t,r,St.defaultOptions),this.tableOptions=this.options.table,this.getTileData=this.getTileData.bind(this),this.ready=this.initializeTilesAsync(t),this.metadata=this.getMetadata()}async initializeTilesAsync(t){let r=await t;this.schema=$e(r),this.createRootTiles(r)}async getMetadata(){return await this.ready,{schema:this.schema,minZoom:0,maxZoom:this.tableOptions.maxZoom}}async getSchema(){return await this.ready,this.schema}async getVectorTile(t){await this.ready;let r=this.getTileSync(t);return F.info(2,"getVectorTile",t,r)(),r}async getTile(t){return await this.ready,this.getTileSync(t)}async getTileData(t){let{x:r,y:n,z:o}=t.index;return(await this.getVectorTile({x:r,y:n,z:o}))?.features||[]}getTileSync(t){let r=this.getProtoTile(t);return r?Gr(r,{coordinates:this.tableOptions.coordinates,tileIndex:t,extent:this.tableOptions.extent}):null}createRootTiles(t){if(this.tableOptions.maxZoom<0||this.tableOptions.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(this.tableOptions.promoteId&&this.tableOptions.generateId)throw new Error("promoteId and generateId cannot be used together.");F.log(1,"TableVectorTileSource creating root tiles",this.tableOptions)(),F.time(1,"preprocess table")();let r=Ur(t,this.tableOptions);if(F.timeEnd(1,"preprocess table")(),F.time(1,"generate tiles")(),r=Hr(r,this.tableOptions),r.length===0){F.log(1,"TableVectorTileSource: no features generated")();return}this.splitTile(r,0,0,0);let n=this.tiles[0];F.log(1,`root tile features: ${n.numFeatures}, points: ${n.numPoints}`)(),F.timeEnd(1,"generate tiles")(),F.log(1,`TableVectorTileSource: tiles generated: ${this.stats.get("total").count}`,this.stats)()}getProtoTile(t){let{z:r,y:n}=t,{x:o}=t,{extent:i}=this.tableOptions;if(r<0||r>24)return null;let s=1<<r;o=o+s&s-1;let a=It(r,o,n);if(this.tiles[a])return Tt(this.tiles[a],i);F.log(F,"drilling down to z%d-%d-%d",r,o,n)();let l=r,c=o,f=n,u;for(;!u&&l>0;)l--,c=c>>1,f=f>>1,u=this.tiles[It(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,r,o,n),F.timeEnd(1,"drilling down")(),this.tiles[a]?Tt(this.tiles[a],i):null)}splitTile(t,r,n,o,i,s,a){let l=[t,r,n,o];for(;l.length;){o=l.pop(),n=l.pop(),r=l.pop(),t=l.pop();let c=1<<r,f=It(r,n,o),u=this.tiles[f];if(!u){F.time(2,"tile creation")(),u=this.tiles[f]=Or(t,r,n,o,this.tableOptions),this.tileCoords.push({z:r,x:n,y:o});let v=`z${r}`,b=this.stats.get(v,"count");b.incrementCount(),b=this.stats.get("total"),b.incrementCount(),b=Ue.stats.get(v,"count"),b.incrementCount(),b=Ue.stats.get("total"),b.incrementCount(),F.log(2,"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,n,o,u.numFeatures,u.numPoints,u.numSimplified)(),F.timeEnd(2,"tile creation")()}if(u.sourceFeatures=t,i===void 0){if(r===this.tableOptions.indexMaxZoom||u.numPoints<=this.tableOptions.maxPointsPerTile)continue}else{if(r===this.tableOptions.maxZoom||r===i)continue;if(i!==void 0){let v=i-r;if(n!==s>>v||o!==a>>v)continue}}if(u.sourceFeatures=null,t.length===0)continue;F.time(2,"clipping tile")();let h=.5*this.tableOptions.buffer/this.tableOptions.extent,p=.5-h,d=.5+h,y=1+h,w=null,I=null,S=null,m=null,g=M(t,c,n-h,n+d,0,u.minX,u.maxX,this.tableOptions),P=M(t,c,n+p,n+y,0,u.minX,u.maxX,this.tableOptions);t=null,g&&(w=M(g,c,o-h,o+d,1,u.minY,u.maxY,this.tableOptions),I=M(g,c,o+p,o+y,1,u.minY,u.maxY,this.tableOptions),g=null),P&&(S=M(P,c,o-h,o+d,1,u.minY,u.maxY,this.tableOptions),m=M(P,c,o+p,o+y,1,u.minY,u.maxY,this.tableOptions),P=null),F.timeEnd(2,"clipping tile")(),l.push(w||[],r+1,n*2,o*2),l.push(I||[],r+1,n*2,o*2+1),l.push(S||[],r+1,n*2+1,o*2),l.push(m||[],r+1,n*2+1,o*2+1)}}},je=Ue;J(je,"stats",new R({id:"table-tile-source-all",stats:[new B("count","tiles"),new B("count","features")]}));function It(e,t,r){return((1<<e)*r+t)*32+e}async function Gi(e,t){if(typeof e=="string"){let o=await(await fetch(e)).arrayBuffer();return await t.parse(o)}let r=await e.arrayBuffer();return await t.parse(r)}return tn(ye);})();
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
ieee754/index.js:
|