@loaders.gl/pmtiles 4.3.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +2 -2
- package/dist/lib/version.js +1 -1
- package/package.json +7 -7
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 Tn=Object.create;var se=Object.defineProperty;var Fn=Object.getOwnPropertyDescriptor;var Pn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty;var En=(e,t,r)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kt=(e,t)=>{for(var r in t)se(e,r,{get:t[r],enumerable:!0})},Se=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Pn(t))!bn.call(e,i)&&i!==r&&se(e,i,{get:()=>t[i],enumerable:!(n=Fn(t,i))||n.enumerable});return e},Be=(e,t,r)=>(Se(e,t,"default"),r&&Se(r,t,"default")),Nt=(e,t,r)=>(r=e!=null?Tn(In(e)):{},Se(t||!e||!e.__esModule?se(r,"default",{value:e,enumerable:!0}):r,e)),Sn=e=>Se(se({},"__esModule",{value:!0}),e);var Ct=(e,t,r)=>(En(e,typeof t!="symbol"?t+"":t,r),r);var zt=Ke((ys,Ot)=>{Ot.exports=globalThis.loaders});var Ir=Ke(dt=>{dt.read=function(e,t,r,n,i){var o,s,a=i*8-n-1,l=(1<<a)-1,c=l>>1,f=-7,u=r?i-1:0,h=r?-1:1,d=e[t+u];for(u+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=o*256+e[t+u],u+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=s*256+e[t+u],u+=h,f-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-c}return(d?-1:1)*s*Math.pow(2,o-n)};dt.write=function(e,t,r,n,i,o){var s,a,l,c=o*8-i-1,f=(1<<c)-1,u=f>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=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,i),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=a&255,d+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+d]=s&255,d+=p,s/=256,c-=8);e[r+d-p]|=y*128}});var _r=Ke((Bl,Ar)=>{"use strict";Ar.exports=x;var Oe=Ir();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 pt=(1<<16)*(1<<16),br=1/pt,ro=12,Br=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(),i=n>>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=ze(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Sr(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=ze(this.buf,this.pos)+ze(this.buf,this.pos+4)*pt;return this.pos+=8,e},readSFixed64:function(){var e=ze(this.buf,this.pos)+Sr(this.buf,this.pos+4)*pt;return this.pos+=8,e},readFloat:function(){var e=Oe.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Oe.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,no(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>=ro&&Br?xo(this.buf,t,e):yo(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=O(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=O(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=O(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=O(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=O(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=O(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=O(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=O(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=O(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),te(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),te(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),te(this.buf,e&-1,this.pos),te(this.buf,Math.floor(e*br),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),te(this.buf,e&-1,this.pos),te(this.buf,Math.floor(e*br),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){io(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=wo(this.buf,e,this.pos);var r=this.pos-t;r>=128&&Er(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Oe.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Oe.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&&Er(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,ao,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,lo,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,uo,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,co,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,fo,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ho,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,po,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,go,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,mo,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 no(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return ee(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function O(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function ee(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function io(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),oo(r,n,t),so(n,t)}function oo(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 so(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 Er(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 i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function ao(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function lo(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function co(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 uo(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function ho(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function po(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function go(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function mo(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function ze(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function te(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function Sr(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function yo(e,t,r){for(var n="",i=t;i<r;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a>r)break;var l,c,f;a===1?o<128&&(s=o):a===2?(l=e[i+1],(l&192)===128&&(s=(o&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[i+1],c=e[i+2],(l&192)===128&&(c&192)===128&&(s=(o&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[i+1],c=e[i+2],f=e[i+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(o&15)<<18|(l&63)<<12|(c&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),n+=String.fromCharCode(s),i+=a}return n}function xo(e,t,r){return Br.decode(e.subarray(t,r))}function wo(e,t,r){for(var n=0,i,o;n<t.length;n++){if(i=t.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}});var be={};kt(be,{PMTilesSource:()=>hn,PMTilesTileSource:()=>W,_PMTilesLoader:()=>gn});Be(be,Nt(zt(),1));function ae(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var N={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Bn=N.self||N.window||N.global||{},An=N.window||N.self||N.global||{},_n=N.global||N.self||N.window||{},Dn=N.document||{};var Ye=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Gt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Ln=Gt&&parseFloat(Gt[1])||0;var Ae=globalThis,Mn=globalThis.document||{},_e=globalThis.process||{},Vn=globalThis.console,vs=globalThis.navigator||{};function jt(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)||jt()}var Xe="4.0.7";function kn(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var De=class{constructor(t,r,n="sessionStorage"){this.storage=kn(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 Rt(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 Ht(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var Le;(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"})(Le||(Le={}));var Nn=10;function Zt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Le[e]||Le.WHITE)}function $t(e,t,r){return!j&&typeof e=="string"&&(t&&(e=`\x1B[${Zt(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Zt(r)+Nn}m${e}\x1B[49m`)),e}function Jt(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}function le(e,t){if(!e)throw new Error(t||"Assertion failed")}function R(){let e;if(j()&&Ae.performance)e=Ae?.performance?.now?.();else if("hrtime"in _e){let t=_e?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var X={debug:j()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Cn={enabled:!0,level:0};function Q(){}var Wt={},Kt={once:!0},G=class{constructor({id:t}={id:""}){this.VERSION=Xe,this._startTs=R(),this._deltaTs=R(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new De(`__probe-${this.id}__`,Cn),this.timeStamp(`${this.id} started`),Jt(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((R()-this._startTs).toPrecision(10))}getDelta(){return Number((R()-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,X.warn,arguments,Kt)}error(t){return this._getLogFunction(0,t,X.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,X.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,X.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,X.debug||X.info,arguments,Kt)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||Q,n&&[n],{tag:zn(r)}):Q}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||Q)}group(t,r,n={collapsed:!1}){let i=Yt({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Q)}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()>=Xt(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=Yt({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,le(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=R();let s=o.tag||o.message;if(o.once&&s)if(!Wt[s])Wt[s]=R();else return Q;return r=On(this.id,o.message,o),n.bind(console,r,...o.args)}return Q}};G.VERSION=Xe;function Xt(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 le(Number.isFinite(t)&&t>=0),t}function Yt(e){let{logLevel:t,message:r}=e;e.logLevel=Xt(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 i=typeof e.message;return le(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function On(e,t,r){if(typeof t=="string"){let n=r.time?Ht(Rt(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=$t(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 Zs=new G({id:"@probe.gl/log"});var Qe="4.3.0-beta.3",Gn=Qe[0]>="0"&&Qe[0]<="9"?`v${Qe}`:"";function jn(){let e=new G({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=Gn,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var qe=jn();var Rn="",Qt={};function et(e){for(let t in Qt)if(e.startsWith(t)){let r=Qt[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Rn}${e}`),e}var ce=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r){return await this.handle.slice(t,t+r).arrayBuffer()}};var fe=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Hn(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function Hn(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,i)=>t(n,i);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var qt="4.3.0-beta.3";var Zn=globalThis.loaders?.parseImageNode,tt=typeof Image<"u",rt=typeof ImageBitmap<"u",$n=Boolean(Zn),nt=Ye?!0:$n;function er(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 tr(){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 Jn(e){let t=Wn(e);if(!t)throw new Error("Not an image");return t}function rr(e){switch(Jn(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 Wn(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 Kn=/^data:image\/svg\+xml/,Yn=/\.svg((\?|#).*)?$/;function Me(e){return e&&(Kn.test(e)||Yn.test(e))}function nr(e,t){if(Me(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return it(e,t)}function it(e,t){if(Me(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ve(e,t,r){let n=nr(e,r),i=self.URL||self.webkitURL,o=typeof n!="string"&&i.createObjectURL(n);try{return await Xn(o||n,t)}finally{o&&i.revokeObjectURL(o)}}async function Xn(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,i)=>{try{r.onload=()=>n(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var Qn={},ir=!0;async function or(e,t,r){let n;Me(r)?n=await Ve(e,t,r):n=it(e,r);let i=t&&t.imagebitmap;return await qn(n,i)}async function qn(e,t=null){if((ei(t)||!ir)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),ir=!1}return await createImageBitmap(e)}function ei(e){for(let t in e||Qn)return!1;return!0}function sr(e){return!ii(e,"ftyp",4)||!(e[8]&96)?null:ti(e)}function ti(e){switch(ri(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ri(e,t,r){return String.fromCharCode(...e.slice(t,r))}function ni(e){return[...e].map(t=>t.charCodeAt(0))}function ii(e,t,r=0){let n=ni(t);for(let i=0;i<n.length;++i)if(n[i]!==e[i+r])return!1;return!0}var C=!1,ue=!0;function Ue(e){let t=he(e);return si(t)||ci(t)||ai(t)||li(t)||oi(t)}function oi(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=sr(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function si(e){let t=he(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 ai(e){let t=he(e);return t.byteLength>=10&&t.getUint32(0,C)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,ue),height:t.getUint16(8,ue)}:null}function li(e){let t=he(e);return t.byteLength>=14&&t.getUint16(0,C)===16973&&t.getUint32(2,ue)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,ue),height:t.getUint32(22,ue)}:null}function ci(e){let t=he(e);if(!(t.byteLength>=3&&t.getUint16(0,C)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=fi(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,C);if(i.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,C),width:t.getUint16(o+7,C)};if(!n.has(s))return null;o+=2,o+=t.getUint16(o,C)}return null}function fi(){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 he(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 ar(e,t){let{mimeType:r}=Ue(e)||{},n=globalThis.loaders?.parseImageNode;return ae(n),await n(e,r)}async function lr(e,t,r){t=t||{};let i=(t.image||{}).type||"auto",{url:o}=r||{},s=ui(i),a;switch(s){case"imagebitmap":a=await or(e,t,o);break;case"image":a=await Ve(e,t,o);break;case"data":a=await ar(e,t);break;default:ae(!1)}return i==="data"&&(a=rr(a)),a}function ui(e){switch(e){case"auto":case"data":return tr();default:return er(e),e}}var hi=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],di=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],pi={image:{type:"auto",decode:!0}},ot={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:qt,mimeTypes:di,extensions:hi,parse:lr,tests:[e=>Boolean(Ue(new DataView(e)))],options:pi};function cr(e){let t=[];if(e.fields)for(let r of e.fields)t.push({name:r.name,type:mi(r),metadata:yi(r)});return{metadata:gi(e),fields:t}}function gi(e){let t={};for(let[r,n]of Object.entries(e))r!=="fields"&&n&&(t[r]=JSON.stringify(n));return t}function mi(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 yi(e){let t={};for(let[r,n]of Object.entries(e))r!=="name"&&n&&(t[r]=JSON.stringify(n));return t}var dr=e=>e!==null&&typeof e=="object";function st(e,t){if(!e||!dr(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=fr(e.bounds)||fr(e.antimeridian_adjusted_bounds),r.center=Pi(e.center),r.maxZoom=ur(e.maxzoom),r.minZoom=ur(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,i=vi(n,t),o=xi(e.vector_layers),s=Fi(o,i);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 xi(e){return Array.isArray(e)?e.map(t=>wi(t)):[]}function wi(e){let t=Object.entries(e.fields||[]).map(([n,i])=>({name:n,...yr(String(i))})),r={...e};return delete r.fields,{name:e.id||"",...r,fields:t}}function vi(e,t){return dr(e)&&Array.isArray(e.layers)?e.layers.map(r=>Ti(r,t)):[]}function Ti(e,t){let r=[],n={},i=e.attributes||[];for(let o of i){let s=o.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];n[a]=n[a]||[],n[a].push(o),console.warn("ignoring tilestats indexed field",a)}else r[s]||r.push(bi(o,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:r}}function Fi(e,t){return e.map(r=>{let n=t.find(s=>s.name===r.name),i=n?.fields||r.fields||[],o={...r,...n,fields:i};return o.schema=cr(o),o})}function fr(e){let t=mr(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(gr)&&[t[1],t[3]].every(pr))return[[t[0],t[1]],[t[2],t[3]]]}function Pi(e){let t=mr(e);return Array.isArray(t)&&t.length===3&&gr(t[0])&&pr(t[1])&&Ii(t[2])?t:null}function ur(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function pr(e){return Number.isFinite(e)&&e<=90&&e>=-90}function gr(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Ii(e){return Number.isFinite(e)&&e>=0&&e<=22}function mr(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var hr={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 bi(e={},t){let r=yr(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 yr(e){let t=e.toLowerCase();return!t||hr[t],hr[t]||{type:"string"}}var Ei="4.3.0-beta.3",de={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Ei,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),i={...de.options.tilejson,...t?.tilejson};return st(n,i)},parseTextSync:(e,t)=>{let r=JSON.parse(e),n={...de.options.tilejson,...t?.tilejson};return st(r,n)}};var pe={x:0,y:1,z:2};function H(e,t={}){let{start:r=0,end:n=e.length,plane:i="xy"}=t,o=t.size||2,s=0,a=pe[i[0]],l=pe[i[1]];for(let c=r,f=n-o;c<n;c+=o)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function lt(e,t,r=2,n,i="xy"){let o=t&&t.length,s=o?t[0]*r:e.length,a=wr(e,0,s,r,!0,n&&n[0],i),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,d,p,y;if(o&&(a=Mi(e,t,a,r,n,i)),e.length>80*r){h=f=e[0],d=u=e[1];for(let P=r;P<s;P+=r)p=e[P],y=e[P+1],p<h&&(h=p),y<d&&(d=y),p>f&&(f=p),y>u&&(u=y);c=Math.max(f-h,u-d),c=c!==0?32767/c:0}return ge(a,l,r,h,d,c,0),l}function wr(e,t,r,n,i,o,s){let a,l;o===void 0&&(o=H(e,{start:t,end:r,size:n,plane:s}));let c=pe[s[0]],f=pe[s[1]];if(i===o<0)for(a=t;a<r;a+=n)l=xr(a,e[a+c],e[a+f],l);else for(a=r-n;a>=t;a-=n)l=xr(a,e[a+c],e[a+f],l);return l&&Ce(l,l.next)&&(ye(l),l=l.next),l}function Z(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Ce(r,r.next)||T(r.prev,r,r.next)===0)){if(ye(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function ge(e,t,r,n,i,o,s){if(!e)return;!s&&o&&Ci(e,n,i,o);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,o?_i(e,n,i,o):Ai(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(c.i/r|0),ye(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=Di(Z(e),t,r),ge(e,t,r,n,i,o,2)):s===2&&Li(e,t,r,n,i,o):ge(Z(e),t,r,n,i,o,1);break}}}function Ai(e){let t=e.prev,r=e,n=e.next;if(T(t,r,n)>=0)return!1;let i=t.x,o=r.x,s=n.x,a=t.y,l=r.y,c=n.y,f=i<o?i<s?i:s:o<s?o:s,u=a<l?a<c?a:c:l<c?l:c,h=i>o?i>s?i:s:o>s?o:s,d=a>l?a>c?a:c:l>c?l:c,p=n.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&q(i,a,o,l,s,c,p.x,p.y)&&T(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function _i(e,t,r,n){let i=e.prev,o=e,s=e.next;if(T(i,o,s)>=0)return!1;let a=i.x,l=o.x,c=s.x,f=i.y,u=o.y,h=s.y,d=a<l?a<c?a:c:l<c?l:c,p=f<u?f<h?f:h:u<h?u:h,y=a>l?a>c?a:c:l>c?l:c,P=f>u?f>h?f:h:u>h?u:h,D=at(d,p,t,r,n),v=at(y,P,t,r,n),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=D&&g&&g.z<=v;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==i&&m!==s&&q(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==i&&g!==s&&q(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>=D;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==i&&m!==s&&q(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>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==i&&g!==s&&q(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 Di(e,t,r){let n=e;do{let i=n.prev,o=n.next.next;!Ce(i,o)&&vr(i,n,n.next,o)&&me(i,o)&&me(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),ye(n),ye(n.next),n=e=o),n=n.next}while(n!==e);return Z(n)}function Li(e,t,r,n,i,o){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Gi(s,a)){let l=Tr(s,a);s=Z(s,s.next),l=Z(l,l.next),ge(s,t,r,n,i,o,0),ge(l,t,r,n,i,o,0);return}a=a.next}s=s.next}while(s!==e)}function Mi(e,t,r,n,i,o){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=wr(e,c,f,n,!1,i&&i[a+1],o),u===u.next&&(u.steiner=!0),s.push(zi(u));for(s.sort(Vi),a=0;a<s.length;a++)r=Ui(s[a],r);return r}function Vi(e,t){return e.x-t.x}function Ui(e,t){let r=ki(e,t);if(!r)return t;let n=Tr(r,e);return Z(n,n.next),Z(r,r.next)}function ki(e,t){let r=t,n=e.x,i=e.y,o=-1/0,s;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){let h=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>o&&(o=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&&q(i<c?n:o,i,l,c,i<c?o:n,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(n-r.x),me(r,e)&&(u<f||u===f&&(r.x>s.x||r.x===s.x&&Ni(s,r)))&&(s=r,f=u)),r=r.next;while(r!==a);return s}function Ni(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function Ci(e,t,r,n){let i=e;do i.z===0&&(i.z=at(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Oi(i)}function Oi(e){let t,r,n=1,i,o,s,a,l,c;do{for(o=e,e=null,c=null,i=0;o;){for(i++,a=o,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||o.z<=a.z)?(t=o,o=o.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;o=a}c.nextZ=null,n*=2}while(i>1);return e}function at(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function zi(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 q(e,t,r,n,i,o,s,a){return(i-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(n-a)>=(r-s)*(t-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function Gi(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ji(e,t)&&(me(e,t)&&me(t,e)&&Ri(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||Ce(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 Ce(e,t){return e.x===t.x&&e.y===t.y}function vr(e,t,r,n){let i=Ne(T(e,t,r)),o=Ne(T(e,t,n)),s=Ne(T(r,n,e)),a=Ne(T(r,n,t));return!!(i!==o&&s!==a||i===0&&ke(e,r,t)||o===0&&ke(e,n,t)||s===0&&ke(r,e,n)||a===0&&ke(r,t,n))}function ke(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 Ne(e){return e>0?1:e<0?-1:0}function ji(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&&vr(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function me(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 Ri(e,t){let r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Tr(e,t){let r=new xe(e.i,e.x,e.y),n=new xe(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function xr(e,t,r,n){let i=new xe(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ye(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 xe=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 ut(e,t,r){let n=Wi(e),i=Object.keys(n).filter(o=>n[o]!==Array);return Ki(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||i,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Wi(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let i=r.properties[n];t[n]=to(i,t[n])}return t}function Ki(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:i,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:y=Float32Array,triangulate:P=!0}=r,D=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(n*d),globalFeatureIds:new v(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(o*d),globalFeatureIds:new v(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},S={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*d),globalFeatureIds:new v(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};P&&(S.triangles=[]);for(let M of[m,g,S])for(let I of p){let B=h[I];M.numericProps[I]=new B(M.positions.length/d)}g.pathIndices[s]=o,S.polygonIndices[c]=l,S.primitivePolygonIndices[f]=l;let k={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let M of e){let I=M.geometry,B=M.properties||{};switch(I.type){case"Point":Yi(I,m,k,d,B),m.properties.push(ft(B,p)),D&&m.fields.push({id:M.id}),k.pointFeature++;break;case"LineString":Xi(I,g,k,d,B),g.properties.push(ft(B,p)),D&&g.fields.push({id:M.id}),k.lineFeature++;break;case"Polygon":Qi(I,S,k,d,B),S.properties.push(ft(B,p)),D&&S.fields.push({id:M.id}),k.polygonFeature++;break;default:throw new Error("Invalid geometry type")}k.feature++}return eo(m,g,S,d)}function Yi(e,t,r,n,i){t.positions.set(e.data,r.pointPosition*n);let o=e.data.length/n;ht(t,i,r.pointPosition,o),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function Xi(e,t,r,n,i){t.positions.set(e.data,r.linePosition*n);let o=e.data.length/n;ht(t,i,r.linePosition,o),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(c-l)/n}}function Qi(e,t,r,n,i){t.positions.set(e.data,r.polygonPosition*n);let o=e.data.length/n;ht(t,i,r.polygonPosition,o),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);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 d=0,p=f.length;d<p;++d){let y=f[d],P=d===p-1?u===void 0?e.data.length:u[0]:f[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(P-y)/n}let h=r.polygonPosition;qi(t,c,f,{startPosition:l,endPosition:h,coordLength:n})}}function qi(e,t,r,{startPosition:n,endPosition:i,coordLength:o}){if(!e.triangles)return;let s=n*o,a=i*o,l=e.positions.subarray(s,a),c=r[0],f=r.slice(1).map(h=>(h-c)/o),u=lt(l,f,o,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(n+u[h])}function ct(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function eo(e,t,r,n){let i={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:ct(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:ct(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:ct(r.numericProps,1)}};return i.polygons&&r.triangles&&(i.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),i}function ht(e,t,r,n){for(let i in e.numericProps)if(i in t){let o=t[i];e.numericProps[i].fill(o,r,r+n)}}function ft(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function to(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var xt=Nt(_r(),1);function vo(e){let t=0;for(let r=0,n=e.length-1,i,o;r<e.length;n=r++)i=e[r],o=e[n],t+=(o[0]-i[0])*(i[1]+o[1]);return t}function gt(e,t){if(Array.isArray(e[0])){for(let n of e)gt(n,t);return}let r=e;r[0]/=t,r[1]/=t}function Dr(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function mt(e,t,r){if(typeof e[0][0]!="number"){for(let s of e)mt(s,t,r);return}let n=r*Math.pow(2,t.z),i=r*t.x,o=r*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+i)*360/n-180;let l=180-(a[1]+o)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function Lr(e,t,r){let{x:n,y:i,z:o}=t,s=r*Math.pow(2,o),a=r*n,l=r*i;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function Mr(e){let t=e.length;if(t<=1)return[e];let r=[],n,i;for(let o=0;o<t;o++){let s=vo(e[o]);s!==0&&(i===void 0&&(i=s<0),i===s<0?(n&&r.push(n),n=[e[o]]):n&&n.push(e[o]))}return n&&r.push(n),r}function Vr(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[H(e.data)]],indices:[e.indices]};let n=[],i=[],o=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),d=H(h);if(d===0){let p=e.data.slice(0,u),y=e.data.slice(c);e.data=p.concat(y),l+=c-u;continue}a===void 0&&(a=d<0),a===d<0?(s.length&&(n.push(o),i.push(s)),s=[u],o=[d]):(o.push(d),s.push(u))}return o&&n.push(o),s.length&&i.push(s),{type:r,areas:n,indices:i,data:e.data}}var $=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,r,n,i,o,s){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=i,this._values=o,this._geometryInfo=s,t.readFields(To,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return Ur(this,n,i=>mt(i,r,this.extent));default:return Ur(this,n,gt)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,i=>Lr(i,r,this.extent));default:return this._toBinaryCoordinates(n,Dr)}}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i=0,o=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<r;){if(i<=0){let u=t.readVarint();n=u&7,i=u>>3}if(i--,n===1||n===2)o+=t.readSVarint(),s+=t.readSVarint(),o<a&&(a=o),o>l&&(l=o),s<c&&(c=s),s>f&&(f=s);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let i=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/i,n={type:"LineString",...t};break;case 3:n=Vr(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/i;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(o.id=this.id),o}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i=0,o=0,s=0,a=[],l;for(;t.pos<r;){if(i<=0){let c=t.readVarint();n=c&7,i=c>>3}switch(i--,n){case 1:case 2:o+=t.readSVarint(),s+=t.readSVarint(),n===1&&(l&&a.push(l),l=[]),l&&l.push([o,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i,o=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<r;)if(o<=0&&(i=t.readVarint(),n=i&7,o=i>>3),o--,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}}};Ct($,"types",["Unknown","Point","LineString","Polygon"]);function Ur(e,t,r){let n=$.types[e.type],i,o,s;switch(e.type){case 1:let l=[];for(i=0;i<t.length;i++)l[i]=t[i][0];s=l,r(s,e.extent);break;case 2:for(s=t,i=0;i<s.length;i++)r(s[i],e.extent);break;case 3:for(s=Mr(t),i=0;i<s.length;i++)for(o=0;o<s[i].length;o++)r(s[i][o],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 To(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?Fo(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function Fo(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}var Ge=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(Po,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 $(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 $(this._pbf,n,this.extent,this._keys,this._values,r)}};function Po(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(Io(r)))}function Io(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 we=class{layers;constructor(t,r){this.layers=t.readFields(bo,{},r)}};function bo(e,t,r){if(e===3&&r){let n=new Ge(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function wt(e,t){let r=So(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:yt(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:kr(e,r)};case"geojson":return kr(e,r);case"binary-geometry":return yt(e,r);case"binary":return yt(e,r);default:throw new Error(n||"undefined shape")}}function yt(e,t){let[r,n]=Eo(e,t),i=ut(r,n);return i.byteLength=e.byteLength,i}function Eo(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 i=new we(new xt.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(i.layers)).forEach(s=>{let a=i.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,n),f=Ao(c,t,s);r.push(f)}}),[r,n]}function kr(e,t){if(e.byteLength<=0)return[];let r=[],n=new we(new xt.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(o=>{let s=n.layers[o];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=Bo(l,t,o);r.push(c)}}),r}function So(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&&qe.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function Bo(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function Ao(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var _o="4.3.0-beta.3",Nr={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:_o,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},vt={...Nr,parse:async(e,t)=>wt(e,t),parseSync:wt,binary:!0};var Pe={};kt(Pe,{Compression:()=>en,EtagMismatch:()=>Re,FetchSource:()=>on,FileSource:()=>fs,PMTiles:()=>bt,Protocol:()=>is,ResolvedValueCache:()=>hs,SharedPromiseCache:()=>fn,TileType:()=>tn,bytesToHeader:()=>sn,findTile:()=>nn,getUint64:()=>_,leafletRasterLayer:()=>rs,readVarint:()=>ne,tileIdToZxy:()=>ls,tileTypeExt:()=>rn,zxyToTileId:()=>qr});var J=Math.pow,F=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{a(r.next(l))}catch(c){i(c)}},s=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,s);a((r=r.apply(e,t)).next())}),E=Uint8Array,ie=Uint16Array,Do=Int32Array,zr=new E([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Gr=new E([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Lo=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jr=function(e,t){for(var r=new ie(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new Do(r[30]),n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return{b:r,r:i}},Rr=jr(zr,2),Hr=Rr.b,Mo=Rr.r;Hr[28]=258,Mo[258]=28;var Zr=jr(Gr,0),Vo=Zr.b,Jl=Zr.r,Pt=new ie(32768);for(w=0;w<32768;++w)z=(w&43690)>>1|(w&21845)<<1,z=(z&52428)>>2|(z&13107)<<2,z=(z&61680)>>4|(z&3855)<<4,Pt[w]=((z&65280)>>8|(z&255)<<8)>>1;var z,w,Te=function(e,t,r){for(var n=e.length,i=0,o=new ie(t);i<n;++i)e[i]&&++o[e[i]-1];var s=new ie(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(r){a=new ie(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var c=i<<4|e[i],f=t-e[i],u=s[e[i]-1]++<<f,h=u|(1<<f)-1;u<=h;++u)a[Pt[u]>>l]=c}else for(a=new ie(n),i=0;i<n;++i)e[i]&&(a[i]=Pt[s[e[i]-1]++]>>15-e[i]);return a},Fe=new E(288);for(w=0;w<144;++w)Fe[w]=8;var w;for(w=144;w<256;++w)Fe[w]=9;var w;for(w=256;w<280;++w)Fe[w]=7;var w;for(w=280;w<288;++w)Fe[w]=8;var w,$r=new E(32);for(w=0;w<32;++w)$r[w]=5;var w,Uo=Te(Fe,9,1),ko=Te($r,5,1),Tt=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},U=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&r},Ft=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},No=function(e){return(e+7)/8|0},Co=function(e,t,r){(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new E(r-t);return n.set(e.subarray(t,r)),n},Oo=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],b=function(e,t,r){var n=new Error(t||Oo[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,b),!r)throw n;return n},Et=function(e,t,r,n){var i=e.length,o=n?n.length:0;if(!i||t.f&&!t.l)return r||new E(0);var s=!r||t.i!=2,a=t.i;r||(r=new E(i*3));var l=function(Mt){var Vt=r.length;if(Mt>Vt){var Ut=new E(Math.max(Vt*2,Mt));Ut.set(r),r=Ut}},c=t.f||0,f=t.p||0,u=t.b||0,h=t.l,d=t.d,p=t.m,y=t.n,P=i*8;do{if(!h){c=U(e,f,1);var D=U(e,f+1,3);if(f+=3,D)if(D==1)h=Uo,d=ko,p=9,y=5;else if(D==2){var S=U(e,f,31)+257,k=U(e,f+10,15)+4,M=S+U(e,f+5,31)+1;f+=14;for(var I=new E(M),B=new E(19),A=0;A<k;++A)B[Lo[A]]=U(e,f+A*3,7);f+=k*3;for(var Bt=Tt(B),mn=(1<<Bt)-1,yn=Te(B,Bt,1),A=0;A<M;){var At=yn[U(e,f,mn)];f+=At&15;var v=At>>4;if(v<16)I[A++]=v;else{var K=0,Ee=0;for(v==16?(Ee=3+U(e,f,3),f+=2,K=I[A-1]):v==17?(Ee=3+U(e,f,7),f+=3):v==18&&(Ee=11+U(e,f,127),f+=7);Ee--;)I[A++]=K}}var _t=I.subarray(0,S),V=I.subarray(S);p=Tt(_t),y=Tt(V),h=Te(_t,p,1),d=Te(V,y,1)}else b(1);else{var v=No(f)+4,m=e[v-4]|e[v-3]<<8,g=v+m;if(g>i){a&&b(0);break}s&&l(u+m),r.set(e.subarray(v,g),u),t.b=u+=m,t.p=f=g*8,t.f=c;continue}if(f>P){a&&b(0);break}}s&&l(u+131072);for(var xn=(1<<p)-1,wn=(1<<y)-1,Ze=f;;Ze=f){var K=h[Ft(e,f)&xn],Y=K>>4;if(f+=K&15,f>P){a&&b(0);break}if(K||b(2),Y<256)r[u++]=Y;else if(Y==256){Ze=f,h=null;break}else{var Dt=Y-254;if(Y>264){var A=Y-257,oe=zr[A];Dt=U(e,f,(1<<oe)-1)+Hr[A],f+=oe}var $e=d[Ft(e,f)&wn],Je=$e>>4;$e||b(3),f+=$e&15;var V=Vo[Je];if(Je>3){var oe=Gr[Je];V+=Ft(e,f)&(1<<oe)-1,f+=oe}if(f>P){a&&b(0);break}s&&l(u+131072);var We=u+Dt;if(u<V){var Lt=o-V,vn=Math.min(V,We);for(Lt+u<0&&b(3);u<vn;++u)r[u]=n[Lt+u]}for(;u<We;u+=4)r[u]=r[u-V],r[u+1]=r[u+1-V],r[u+2]=r[u+2-V],r[u+3]=r[u+3-V];u=We}}t.l=h,t.p=Ze,t.b=u,t.f=c,h&&(c=1,t.m=p,t.d=d,t.n=y)}while(!c);return u==r.length?r:Co(r,0,u)},zo=new E(0),Go=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&b(6,"invalid gzip data");var t=e[3],r=10;t&4&&(r+=(e[10]|e[11]<<8)+2);for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[r++]);return r+(t&2)},jo=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ro=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&b(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&b(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function Ho(e,t){return Et(e,{i:2},t&&t.out,t&&t.dictionary)}function Zo(e,t){var r=Go(e);return r+8>e.length&&b(6,"invalid gzip data"),Et(e.subarray(r,-8),{i:2},t&&t.out||new E(jo(e)),t&&t.dictionary)}function $o(e,t){return Et(e.subarray(Ro(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}function It(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Zo(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Ho(e,t):$o(e,t)}var Jo=typeof TextDecoder<"u"&&new TextDecoder,Wo=0;try{Jo.decode(zo,{stream:!0}),Wo=1}catch{}var Jr=(e,t)=>e*J(2,t),ve=(e,t)=>Math.floor(e/J(2,t)),je=(e,t)=>Jr(e.getUint16(t+1,!0),8)+e.getUint8(t),Wr=(e,t)=>Jr(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),Ko=(e,t,r,n,i)=>{if(e!==n.getUint8(i))return e-n.getUint8(i);let o=je(n,i+1);if(t!==o)return t-o;let s=je(n,i+4);return r!==s?r-s:0},Yo=(e,t,r,n)=>{let i=Kr(e,t|128,r,n);return i?{z:t,x:r,y:n,offset:i[0],length:i[1],isDir:!0}:null},Cr=(e,t,r,n)=>{let i=Kr(e,t,r,n);return i?{z:t,x:r,y:n,offset:i[0],length:i[1],isDir:!1}:null},Kr=(e,t,r,n)=>{let i=0,o=e.byteLength/17-1;for(;i<=o;){let s=o+i>>1,a=Ko(t,r,n,e,s*17);if(a>0)i=s+1;else if(a<0)o=s-1;else return[Wr(e,s*17+7),e.getUint32(s*17+13,!0)]}return null},Xo=(e,t)=>e.isDir&&!t.isDir?1:!e.isDir&&t.isDir?-1:e.z!==t.z?e.z-t.z:e.x!==t.x?e.x-t.x:e.y-t.y,Yr=(e,t)=>{let r=e.getUint8(t*17);return{z:r&127,x:je(e,t*17+1),y:je(e,t*17+4),offset:Wr(e,t*17+7),length:e.getUint32(t*17+13,!0),isDir:r>>7===1}},Or=e=>{let t=[],r=new DataView(e);for(let n=0;n<r.byteLength/17;n++)t.push(Yr(r,n));return Qo(t)},Qo=e=>{e.sort(Xo);let t=new ArrayBuffer(17*e.length),r=new Uint8Array(t);for(let n=0;n<e.length;n++){let i=e[n],o=i.z;i.isDir&&(o=o|128),r[n*17]=o,r[n*17+1]=i.x&255,r[n*17+2]=i.x>>8&255,r[n*17+3]=i.x>>16&255,r[n*17+4]=i.y&255,r[n*17+5]=i.y>>8&255,r[n*17+6]=i.y>>16&255,r[n*17+7]=i.offset&255,r[n*17+8]=ve(i.offset,8)&255,r[n*17+9]=ve(i.offset,16)&255,r[n*17+10]=ve(i.offset,24)&255,r[n*17+11]=ve(i.offset,32)&255,r[n*17+12]=ve(i.offset,48)&255,r[n*17+13]=i.length&255,r[n*17+14]=i.length>>8&255,r[n*17+15]=i.length>>16&255,r[n*17+16]=i.length>>24&255}return t},qo=(e,t)=>{if(e.byteLength<17)return null;let r=e.byteLength/17,n=Yr(e,r-1);if(n.isDir){let i=n.z,o=t.z-i,s=Math.trunc(t.x/(1<<o)),a=Math.trunc(t.y/(1<<o));return{z:i,x:s,y:a}}return null};function es(e){return F(this,null,function*(){let t=yield e.getBytes(0,512e3),r=new DataView(t.data),n=r.getUint32(4,!0),i=r.getUint16(8,!0),o=new TextDecoder("utf-8"),s=JSON.parse(o.decode(new DataView(t.data,10,n))),a=0;s.compression==="gzip"&&(a=2);let l=0;"minzoom"in s&&(l=+s.minzoom);let c=0;"maxzoom"in s&&(c=+s.maxzoom);let f=0,u=0,h=0,d=-180,p=-85,y=180,P=85;if(s.bounds){let v=s.bounds.split(",");d=+v[0],p=+v[1],y=+v[2],P=+v[3]}if(s.center){let v=s.center.split(",");f=+v[0],u=+v[1],h=+v[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+n,rootDirectoryLength:i*17,jsonMetadataOffset:10,jsonMetadataLength:n,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:a,tileType:1,minZoom:l,maxZoom:c,minLon:d,minLat:p,maxLon:y,maxLat:P,centerZoom:h,centerLon:f,centerLat:u,etag:t.etag}})}function ts(e,t,r,n,i,o,s){return F(this,null,function*(){let a=yield r.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);e.specVersion===1&&(a=Or(a));let l=Cr(new DataView(a),n,i,o);if(l){let u=(yield t.getBytes(l.offset,l.length,s)).data,h=new DataView(u);return h.getUint8(0)===31&&h.getUint8(1)===139&&(u=It(new Uint8Array(u))),{data:u}}let c=qo(new DataView(a),{z:n,x:i,y:o});if(c){let f=Yo(new DataView(a),c.z,c.x,c.y);if(f){let u=yield r.getArrayBuffer(t,f.offset,f.length,e);e.specVersion===1&&(u=Or(u));let h=Cr(new DataView(u),n,i,o);if(h){let p=(yield t.getBytes(h.offset,h.length,s)).data,y=new DataView(p);return y.getUint8(0)===31&&y.getUint8(1)===139&&(p=It(new Uint8Array(p))),{data:p}}}}})}var Xr={getHeader:es,getZxy:ts},rs=(e,t)=>{let r=!1,n="",i=L.GridLayer.extend({createTile:(o,s)=>{let a=document.createElement("img"),l=new AbortController,c=l.signal;return a.cancel=()=>{l.abort()},r||(e.getHeader().then(f=>{f.tileType===1?console.error("Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):f.tileType===2?n="image/png":f.tileType===3?n="image/jpeg":f.tileType===4?n="image/webp":f.tileType===5&&(n="image/avif")}),r=!0),e.getZxy(o.z,o.x,o.y,c).then(f=>{if(f){let u=new Blob([f.data],{type:n}),h=window.URL.createObjectURL(u);a.src=h,a.cancel=void 0,s(void 0,a)}}).catch(f=>{if(f.name!=="AbortError")throw f}),a},_removeTile:function(o){let s=this._tiles[o];s&&(s.el.cancel&&s.el.cancel(),s.el.width=0,s.el.height=0,s.el.deleted=!0,L.DomUtil.remove(s.el),delete this._tiles[o],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(o)}))}});return new i(t)},ns=e=>(t,r)=>{if(r instanceof AbortController)return e(t,r);let n=new AbortController;return e(t,n).then(i=>r(void 0,i.data,i.cacheControl||"",i.expires||""),i=>r(i)).catch(i=>r(i)),{cancel:()=>n.abort()}},is=class{constructor(){this.tilev4=(e,t)=>F(this,null,function*(){if(e.type==="json"){let u=e.url.substr(10),h=this.tiles.get(u);h||(h=new bt(u),this.tiles.set(u,h));let d=yield h.getHeader();return{data:{tiles:[`${e.url}/{z}/{x}/{y}`],minzoom:d.minZoom,maxzoom:d.maxZoom,bounds:[d.minLon,d.minLat,d.maxLon,d.maxLat]}}}let r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),n=e.url.match(r);if(!n)throw new Error("Invalid PMTiles protocol URL");let i=n[1],o=this.tiles.get(i);o||(o=new bt(i),this.tiles.set(i,o));let s=n[2],a=n[3],l=n[4],c=yield o.getHeader(),f=yield o?.getZxy(+s,+a,+l,t.signal);return f?{data:new Uint8Array(f.data),cacheControl:f.cacheControl,expires:f.expires}:c.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=ns(this.tilev4),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function re(e,t){return(t>>>0)*4294967296+(e>>>0)}function os(e,t){let r=t.buf,n=r[t.pos++],i=(n&112)>>4;if(n<128||(n=r[t.pos++],i|=(n&127)<<3,n<128)||(n=r[t.pos++],i|=(n&127)<<10,n<128)||(n=r[t.pos++],i|=(n&127)<<17,n<128)||(n=r[t.pos++],i|=(n&127)<<24,n<128)||(n=r[t.pos++],i|=(n&1)<<31,n<128))return re(e,i);throw new Error("Expected varint not more than 10 bytes")}function ne(e){let t=e.buf,r=t[e.pos++],n=r&127;return r<128||(r=t[e.pos++],n|=(r&127)<<7,r<128)||(r=t[e.pos++],n|=(r&127)<<14,r<128)||(r=t[e.pos++],n|=(r&127)<<21,r<128)?n:(r=t[e.pos],n|=(r&15)<<28,os(n,e))}function Qr(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function ss(e,t){let r=J(2,e),n=t,i=t,o=t,s=[0,0],a=1;for(;a<r;)n=1&o/2,i=1&(o^n),Qr(a,s,n,i),s[0]+=a*n,s[1]+=a*i,o=o/4,a*=2;return[e,s[0],s[1]]}var as=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function qr(e,t,r){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>J(2,e)-1||r>J(2,e)-1)throw Error("tile x/y outside zoom level bounds");let n=as[e],i=J(2,e),o=0,s=0,a=0,l=[t,r],c=i/2;for(;c>0;)o=(l[0]&c)>0?1:0,s=(l[1]&c)>0?1:0,a+=c*c*(3*o^s),Qr(c,l,o,s),c=c/2;return n+a}function ls(e){let t=0,r=0;for(let n=0;n<27;n++){let i=(1<<n)*(1<<n);if(t+i>e)return ss(n,e-t);t+=i}throw Error("Tile zoom level exceeds max safe number limit (26)")}var en=(e=>(e[e.Unknown=0]="Unknown",e[e.None=1]="None",e[e.Gzip=2]="Gzip",e[e.Brotli=3]="Brotli",e[e.Zstd=4]="Zstd",e))(en||{});function St(e,t){return F(this,null,function*(){if(t===1||t===0)return e;if(t===2){if(typeof globalThis.DecompressionStream>"u")return It(new Uint8Array(e));let r=new Response(e).body;if(!r)throw Error("Failed to read response stream");let n=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(n).arrayBuffer()}throw Error("Compression method not supported")})}var tn=(e=>(e[e.Unknown=0]="Unknown",e[e.Mvt=1]="Mvt",e[e.Png=2]="Png",e[e.Jpeg=3]="Jpeg",e[e.Webp=4]="Webp",e[e.Avif=5]="Avif",e))(tn||{});function rn(e){return e===1?".mvt":e===2?".png":e===3?".jpg":e===4?".webp":e===5?".avif":""}var cs=127;function nn(e,t){let r=0,n=e.length-1;for(;r<=n;){let i=n+r>>1,o=t-e[i].tileId;if(o>0)r=i+1;else if(o<0)n=i-1;else return e[i]}return n>=0&&(e[n].runLength===0||t-e[n].tileId<e[n].runLength)?e[n]:null}var fs=class{constructor(e){this.file=e}getKey(){return this.file.name}getBytes(e,t){return F(this,null,function*(){return{data:yield this.file.slice(e,e+t).arrayBuffer()}})}},on=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1;let r="";"navigator"in globalThis&&(r=globalThis.navigator.userAgent||"");let n=r.indexOf("Windows")>-1,i=/Chrome|Chromium|Edg|OPR|Brave/.test(r);this.chromeWindowsNoCache=!1,n&&i&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,r,n){return F(this,null,function*(){let i,o;r?o=r:(i=new AbortController,o=i.signal);let s=new Headers(this.customHeaders);s.set("range",`bytes=${e}-${e+t-1}`);let a;this.mustReload?a="reload":this.chromeWindowsNoCache&&(a="no-store");let l=yield fetch(this.url,{signal:o,cache:a,headers:s});if(e===0&&l.status===416){let h=l.headers.get("Content-Range");if(!h||!h.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let d=+h.substr(8);l=yield fetch(this.url,{signal:o,cache:"reload",headers:{range:`bytes=0-${d-1}`}})}let c=l.headers.get("Etag");if(c?.startsWith("W/")&&(c=null),l.status===416||n&&c&&c!==n)throw this.mustReload=!0,new Re(`Server returned non-matching ETag ${n} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);let f=l.headers.get("Content-Length");if(l.status===200&&(!f||+f>t))throw i&&i.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:c||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function _(e,t){let r=e.getUint32(t+4,!0),n=e.getUint32(t+0,!0);return r*J(2,32)+n}function sn(e,t){let r=new DataView(e),n=r.getUint8(7);if(n>3)throw Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:_(r,8),rootDirectoryLength:_(r,16),jsonMetadataOffset:_(r,24),jsonMetadataLength:_(r,32),leafDirectoryOffset:_(r,40),leafDirectoryLength:_(r,48),tileDataOffset:_(r,56),tileDataLength:_(r,64),numAddressedTiles:_(r,72),numTileEntries:_(r,80),numTileContents:_(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:t}}function an(e){let t={buf:new Uint8Array(e),pos:0},r=ne(t),n=[],i=0;for(let o=0;o<r;o++){let s=ne(t);n.push({tileId:i+s,offset:0,length:0,runLength:1}),i+=s}for(let o=0;o<r;o++)n[o].runLength=ne(t);for(let o=0;o<r;o++)n[o].length=ne(t);for(let o=0;o<r;o++){let s=ne(t);s===0&&o>0?n[o].offset=n[o-1].offset+n[o-1].length:n[o].offset=s-1}return n}function us(e){let t=new DataView(e);return t.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):t.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var Re=class extends Error{};function ln(e,t){return F(this,null,function*(){let r=yield e.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(us(r.data)<3)return[yield Xr.getHeader(e)];let i=r.data.slice(0,cs),o=sn(i,r.etag),s=r.data.slice(o.rootDirectoryOffset,o.rootDirectoryOffset+o.rootDirectoryLength),a=`${e.getKey()}|${o.etag||""}|${o.rootDirectoryOffset}|${o.rootDirectoryLength}`,l=an(yield t(s,o.internalCompression));return[o,[a,l.length,l]]})}function cn(e,t,r,n,i){return F(this,null,function*(){let o=yield e.getBytes(r,n,void 0,i.etag),s=yield t(o.data,i.internalCompression),a=an(s);if(a.length===0)throw new Error("Empty directory is invalid");return a})}var hs=class{constructor(e=100,t=!0,r=St){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return F(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,r.data;let n=yield ln(e,this.decompress);return n[1]&&this.cache.set(n[1][0],{lastUsed:this.counter++,data:n[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:n[0]}),this.prune(),n[0]})}getDirectory(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,o.data;let s=yield cn(e,this.decompress,t,r,n);return this.cache.set(i,{lastUsed:this.counter++,data:s}),this.prune(),s})}getArrayBuffer(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=yield e.getBytes(t,r,void 0,n.etag);return this.cache.set(i,{lastUsed:this.counter++,data:s.data}),this.prune(),s.data})}prune(){if(this.cache.size>this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){this.cache.delete(e.getKey())})}},fn=class{constructor(e=100,t=!0,r=St){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return F(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,yield r.data;let n=new Promise((i,o)=>{ln(e,this.decompress).then(s=>{s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:Promise.resolve(s[1][2])}),i(s[0]),this.prune()}).catch(s=>{o(s)})});return this.cache.set(t,{lastUsed:this.counter++,data:n}),n})}getDirectory(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=new Promise((a,l)=>{cn(e,this.decompress,t,r,n).then(c=>{a(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=new Promise((a,l)=>{e.getBytes(t,r,void 0,n.etag).then(c=>{a(c.data),this.cache.has(i),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:s}),s})}prune(){if(this.cache.size>=this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){let t=e.getKey();if(this.invalidations.get(t))return yield this.invalidations.get(t);this.cache.delete(e.getKey());let r=new Promise((n,i)=>{this.getHeader(e).then(o=>{n(),this.invalidations.delete(t)}).catch(o=>{i(o)})});this.invalidations.set(t,r)})}},bt=class{constructor(e,t,r){typeof e=="string"?this.source=new on(e):this.source=e,r?this.decompress=r:this.decompress=St,t?this.cache=t:this.cache=new fn}getHeader(){return F(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,r,n){return F(this,null,function*(){let i=qr(e,t,r),o=yield this.cache.getHeader(this.source);if(o.specVersion<3)return Xr.getZxy(o,this.source,this.cache,e,t,r,n);if(e<o.minZoom||e>o.maxZoom)return;let s=o.rootDirectoryOffset,a=o.rootDirectoryLength;for(let l=0;l<=3;l++){let c=yield this.cache.getDirectory(this.source,s,a,o),f=nn(c,i);if(f){if(f.runLength>0){let u=yield this.source.getBytes(o.tileDataOffset+f.offset,f.length,n,o.etag);return{data:yield this.decompress(u.data,o.tileCompression),cacheControl:u.cacheControl,expires:u.expires}}s=o.leafDirectoryOffset+f.offset,a=f.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(e,t,r,n){return F(this,null,function*(){try{return yield this.getZxyAttempt(e,t,r,n)}catch(i){if(i instanceof Re)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,r,n);throw i}})}getMetadataAttempt(){return F(this,null,function*(){let e=yield this.cache.getHeader(this.source),t=yield this.source.getBytes(e.jsonMetadataOffset,e.jsonMetadataLength,void 0,e.etag),r=yield this.decompress(t.data,e.internalCompression),n=new TextDecoder("utf-8");return JSON.parse(n.decode(r))})}getMetadata(){return F(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof Re)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}getTileJson(e){return F(this,null,function*(){let t=yield this.getHeader(),r=yield this.getMetadata(),n=rn(t.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${e}/{z}/{x}/{y}${n}`],vector_layers:r.vector_layers,attribution:r.attribution,description:r.description,name:r.name,version:r.version,bounds:[t.minLon,t.minLat,t.maxLon,t.maxLat],center:[t.centerLon,t.centerLat,t.centerZoom],minzoom:t.minZoom,maxzoom:t.maxZoom}})}};var{TileType:Ie}=Pe;function un(e,t,r,n){let i=null;if(t)try{let a=JSON.stringify(t);i=de.parseTextSync?.(a,n)||null}catch(a){console.warn("PMTiles metadata could not be interpreted as TileJSON",a)}let o={};typeof i?.name=="string"&&(o.name=i.name),typeof i?.htmlAttribution=="string"&&(o.attributions=[i.htmlAttribution]);let s={...o,format:"pmtiles",formatVersion:e.specVersion,attributions:[],tileMIMEType:ds(e.tileType),minZoom:e.minZoom,maxZoom:e.maxZoom,boundingBox:[[e.minLon,e.minLat],[e.maxLon,e.maxLat]],center:[e.centerLon,e.centerLat],centerZoom:e.centerZoom,etag:e.etag};return i&&(s.tilejson=i),r?.includeFormatHeader&&(s.formatHeader=e,s.formatMetadata=s),s}function ds(e){switch(e){case Ie.Mvt:return"application/vnd.mapbox-vector-tile";case Ie.Png:return"image/png";case Ie.Jpeg:return"image/jpeg";case Ie.Webp:return"image/webp";case Ie.Avif:return"image/avif";default:return"application/octet-stream"}}var He=class{blob;key;constructor(t,r){this.blob=t,this.key=r}getKey(){return this.blob.url||""}async getBytes(t,r,n){return{data:await this.blob.slice(t,t+r).arrayBuffer()}}};var{PMTiles:ps}=Pe,gs="1.0.0",hn={name:"PMTiles",id:"pmtiles",module:"pmtiles",version:gs,extensions:["pmtiles"],mimeTypes:["application/octet-stream"],options:{url:void 0,pmtiles:{}},type:"pmtiles",fromUrl:!0,fromBlob:!0,testURL:e=>e.endsWith(".pmtiles"),createDataSource:(e,t)=>new W(e,t)},W=class extends fe{data;props;mimeType=null;pmtiles;metadata;constructor(t,r){super(r),this.props=r;let n=typeof t=="string"?et(t):new He(t,"pmtiles");this.data=t,this.pmtiles=new ps(n),this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata()}async getSchema(){return{fields:[],metadata:{}}}async getMetadata(){let t=await this.pmtiles.getHeader(),r=await this.pmtiles.getMetadata()||{},n=un(t,r,{includeFormatHeader:!1},this.loadOptions);return this.props.attributions&&(n.attributions=[...this.props.attributions,...n.attributions||[]]),n?.tileMIMEType&&(this.mimeType=n?.tileMIMEType),n}async getTile(t){let{x:r,y:n,z:i}=t,s=(await this.pmtiles.getZxy(i,r,n))?.data;return s||null}async getTileData(t){let{x:r,y:n,z:i}=t.index;switch((await this.metadata).tileMIMEType){case"application/vnd.mapbox-vector-tile":return await this.getVectorTile({x:r,y:n,z:i,layers:[]});default:return await this.getImageTile({x:r,y:n,z:i,layers:[]})}}async getImageTile(t){let r=await this.getTile(t);return r?await ot.parse(r,this.loadOptions):null}async getVectorTile(t){let r=await this.getTile(t),n={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:t.x,y:t.y,z:t.z},...this.loadOptions?.mvt},...this.loadOptions};return r?await vt.parse(r,n):null}};var dn="4.3.0-beta.3";var gn={name:"PMTiles",id:"pmtiles",module:"pmtiles",version:dn,extensions:["pmtiles"],mimeTypes:["application/octet-stream"],tests:["PMTiles"],options:{pmtiles:{}},parse:async(e,t)=>pn(new ce(new Blob([e])),t),parseFile:pn};async function pn(e,t){let n=await new W(e.handle,{pmtiles:t?.pmtiles||{}}).getMetadata(),{tileMIMEType:i,tilejson:o={}}=n,{layers:s=[]}=o;switch(i){case"application/vnd.mapbox-vector-tile":return{shape:"vector-source",layers:s.map(a=>({name:a.name,schema:a.schema})),tables:[],formatSpecificMetadata:n};case"image/png":case"image/jpeg":return{shape:"image-source",formatSpecificMetadata:n};default:throw new Error(`PMTilesLoader: Unsupported tile MIME type ${i}`)}}return Sn(be);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var Tn=Object.create;var se=Object.defineProperty;var Fn=Object.getOwnPropertyDescriptor;var Pn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty;var En=(e,t,r)=>t in e?se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ke=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kt=(e,t)=>{for(var r in t)se(e,r,{get:t[r],enumerable:!0})},Se=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Pn(t))!bn.call(e,i)&&i!==r&&se(e,i,{get:()=>t[i],enumerable:!(n=Fn(t,i))||n.enumerable});return e},Be=(e,t,r)=>(Se(e,t,"default"),r&&Se(r,t,"default")),Nt=(e,t,r)=>(r=e!=null?Tn(In(e)):{},Se(t||!e||!e.__esModule?se(r,"default",{value:e,enumerable:!0}):r,e)),Sn=e=>Se(se({},"__esModule",{value:!0}),e);var Ct=(e,t,r)=>(En(e,typeof t!="symbol"?t+"":t,r),r);var zt=Ke((ys,Ot)=>{Ot.exports=globalThis.loaders});var Ir=Ke(dt=>{dt.read=function(e,t,r,n,i){var o,s,a=i*8-n-1,l=(1<<a)-1,c=l>>1,f=-7,u=r?i-1:0,h=r?-1:1,d=e[t+u];for(u+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=o*256+e[t+u],u+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=s*256+e[t+u],u+=h,f-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-c}return(d?-1:1)*s*Math.pow(2,o-n)};dt.write=function(e,t,r,n,i,o){var s,a,l,c=o*8-i-1,f=(1<<c)-1,u=f>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=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,i),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=a&255,d+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;e[r+d]=s&255,d+=p,s/=256,c-=8);e[r+d-p]|=y*128}});var _r=Ke((Bl,Ar)=>{"use strict";Ar.exports=x;var Oe=Ir();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 pt=(1<<16)*(1<<16),br=1/pt,ro=12,Br=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(),i=n>>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=ze(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Sr(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=ze(this.buf,this.pos)+ze(this.buf,this.pos+4)*pt;return this.pos+=8,e},readSFixed64:function(){var e=ze(this.buf,this.pos)+Sr(this.buf,this.pos+4)*pt;return this.pos+=8,e},readFloat:function(){var e=Oe.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Oe.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,no(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>=ro&&Br?xo(this.buf,t,e):yo(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=O(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=O(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=O(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=O(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=O(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=O(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=O(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=O(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=O(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),te(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),te(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),te(this.buf,e&-1,this.pos),te(this.buf,Math.floor(e*br),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),te(this.buf,e&-1,this.pos),te(this.buf,Math.floor(e*br),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){io(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=wo(this.buf,e,this.pos);var r=this.pos-t;r>=128&&Er(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Oe.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Oe.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&&Er(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,ao,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,lo,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,uo,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,co,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,fo,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ho,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,po,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,go,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,mo,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 no(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return ee(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function O(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function ee(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function io(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),oo(r,n,t),so(n,t)}function oo(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 so(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 Er(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 i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function ao(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function lo(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function co(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 uo(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function ho(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function po(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function go(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function mo(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function ze(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function te(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function Sr(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function yo(e,t,r){for(var n="",i=t;i<r;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a>r)break;var l,c,f;a===1?o<128&&(s=o):a===2?(l=e[i+1],(l&192)===128&&(s=(o&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[i+1],c=e[i+2],(l&192)===128&&(c&192)===128&&(s=(o&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[i+1],c=e[i+2],f=e[i+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(o&15)<<18|(l&63)<<12|(c&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,n+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),n+=String.fromCharCode(s),i+=a}return n}function xo(e,t,r){return Br.decode(e.subarray(t,r))}function wo(e,t,r){for(var n=0,i,o;n<t.length;n++){if(i=t.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}});var be={};kt(be,{PMTilesSource:()=>hn,PMTilesTileSource:()=>W,_PMTilesLoader:()=>gn});Be(be,Nt(zt(),1));function ae(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var N={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Bn=N.self||N.window||N.global||{},An=N.window||N.self||N.global||{},_n=N.global||N.self||N.window||{},Dn=N.document||{};var Ye=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Gt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Ln=Gt&&parseFloat(Gt[1])||0;var Ae=globalThis,Mn=globalThis.document||{},_e=globalThis.process||{},Vn=globalThis.console,vs=globalThis.navigator||{};function jt(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)||jt()}var Xe="4.0.7";function kn(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var De=class{constructor(t,r,n="sessionStorage"){this.storage=kn(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 Rt(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 Ht(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var Le;(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"})(Le||(Le={}));var Nn=10;function Zt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Le[e]||Le.WHITE)}function $t(e,t,r){return!j&&typeof e=="string"&&(t&&(e=`\x1B[${Zt(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Zt(r)+Nn}m${e}\x1B[49m`)),e}function Jt(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}function le(e,t){if(!e)throw new Error(t||"Assertion failed")}function R(){let e;if(j()&&Ae.performance)e=Ae?.performance?.now?.();else if("hrtime"in _e){let t=_e?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var X={debug:j()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Cn={enabled:!0,level:0};function Q(){}var Wt={},Kt={once:!0},G=class{constructor({id:t}={id:""}){this.VERSION=Xe,this._startTs=R(),this._deltaTs=R(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new De(`__probe-${this.id}__`,Cn),this.timeStamp(`${this.id} started`),Jt(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((R()-this._startTs).toPrecision(10))}getDelta(){return Number((R()-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,X.warn,arguments,Kt)}error(t){return this._getLogFunction(0,t,X.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,X.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,X.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,X.debug||X.info,arguments,Kt)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||Q,n&&[n],{tag:zn(r)}):Q}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||Q)}group(t,r,n={collapsed:!1}){let i=Yt({logLevel:t,message:r,opts:n}),{collapsed:o}=n;return i.method=(o?console.groupCollapsed:console.group)||console.info,this._getLogFunction(i)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Q)}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()>=Xt(t)}_getLogFunction(t,r,n,i,o){if(this._shouldLog(t)){o=Yt({logLevel:t,message:r,args:i,opts:o}),n=n||o.method,le(n),o.total=this.getTotal(),o.delta=this.getDelta(),this._deltaTs=R();let s=o.tag||o.message;if(o.once&&s)if(!Wt[s])Wt[s]=R();else return Q;return r=On(this.id,o.message,o),n.bind(console,r,...o.args)}return Q}};G.VERSION=Xe;function Xt(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 le(Number.isFinite(t)&&t>=0),t}function Yt(e){let{logLevel:t,message:r}=e;e.logLevel=Xt(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 i=typeof e.message;return le(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}function On(e,t,r){if(typeof t=="string"){let n=r.time?Ht(Rt(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=$t(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 Zs=new G({id:"@probe.gl/log"});var Qe="4.3.0",Gn=Qe[0]>="0"&&Qe[0]<="9"?`v${Qe}`:"";function jn(){let e=new G({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=Gn,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var qe=jn();var Rn="",Qt={};function et(e){for(let t in Qt)if(e.startsWith(t)){let r=Qt[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Rn}${e}`),e}var ce=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r){return await this.handle.slice(t,t+r).arrayBuffer()}};var fe=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Hn(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function Hn(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,i)=>t(n,i);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var qt="4.3.0";var Zn=globalThis.loaders?.parseImageNode,tt=typeof Image<"u",rt=typeof ImageBitmap<"u",$n=Boolean(Zn),nt=Ye?!0:$n;function er(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 tr(){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 Jn(e){let t=Wn(e);if(!t)throw new Error("Not an image");return t}function rr(e){switch(Jn(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 Wn(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 Kn=/^data:image\/svg\+xml/,Yn=/\.svg((\?|#).*)?$/;function Me(e){return e&&(Kn.test(e)||Yn.test(e))}function nr(e,t){if(Me(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return it(e,t)}function it(e,t){if(Me(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function Ve(e,t,r){let n=nr(e,r),i=self.URL||self.webkitURL,o=typeof n!="string"&&i.createObjectURL(n);try{return await Xn(o||n,t)}finally{o&&i.revokeObjectURL(o)}}async function Xn(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,i)=>{try{r.onload=()=>n(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var Qn={},ir=!0;async function or(e,t,r){let n;Me(r)?n=await Ve(e,t,r):n=it(e,r);let i=t&&t.imagebitmap;return await qn(n,i)}async function qn(e,t=null){if((ei(t)||!ir)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),ir=!1}return await createImageBitmap(e)}function ei(e){for(let t in e||Qn)return!1;return!0}function sr(e){return!ii(e,"ftyp",4)||!(e[8]&96)?null:ti(e)}function ti(e){switch(ri(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function ri(e,t,r){return String.fromCharCode(...e.slice(t,r))}function ni(e){return[...e].map(t=>t.charCodeAt(0))}function ii(e,t,r=0){let n=ni(t);for(let i=0;i<n.length;++i)if(n[i]!==e[i+r])return!1;return!0}var C=!1,ue=!0;function Ue(e){let t=he(e);return si(t)||ci(t)||ai(t)||li(t)||oi(t)}function oi(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=sr(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function si(e){let t=he(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 ai(e){let t=he(e);return t.byteLength>=10&&t.getUint32(0,C)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,ue),height:t.getUint16(8,ue)}:null}function li(e){let t=he(e);return t.byteLength>=14&&t.getUint16(0,C)===16973&&t.getUint32(2,ue)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,ue),height:t.getUint32(22,ue)}:null}function ci(e){let t=he(e);if(!(t.byteLength>=3&&t.getUint16(0,C)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=fi(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,C);if(i.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,C),width:t.getUint16(o+7,C)};if(!n.has(s))return null;o+=2,o+=t.getUint16(o,C)}return null}function fi(){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 he(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 ar(e,t){let{mimeType:r}=Ue(e)||{},n=globalThis.loaders?.parseImageNode;return ae(n),await n(e,r)}async function lr(e,t,r){t=t||{};let i=(t.image||{}).type||"auto",{url:o}=r||{},s=ui(i),a;switch(s){case"imagebitmap":a=await or(e,t,o);break;case"image":a=await Ve(e,t,o);break;case"data":a=await ar(e,t);break;default:ae(!1)}return i==="data"&&(a=rr(a)),a}function ui(e){switch(e){case"auto":case"data":return tr();default:return er(e),e}}var hi=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],di=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],pi={image:{type:"auto",decode:!0}},ot={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:qt,mimeTypes:di,extensions:hi,parse:lr,tests:[e=>Boolean(Ue(new DataView(e)))],options:pi};function cr(e){let t=[];if(e.fields)for(let r of e.fields)t.push({name:r.name,type:mi(r),metadata:yi(r)});return{metadata:gi(e),fields:t}}function gi(e){let t={};for(let[r,n]of Object.entries(e))r!=="fields"&&n&&(t[r]=JSON.stringify(n));return t}function mi(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 yi(e){let t={};for(let[r,n]of Object.entries(e))r!=="name"&&n&&(t[r]=JSON.stringify(n));return t}var dr=e=>e!==null&&typeof e=="object";function st(e,t){if(!e||!dr(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=fr(e.bounds)||fr(e.antimeridian_adjusted_bounds),r.center=Pi(e.center),r.maxZoom=ur(e.maxzoom),r.minZoom=ur(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,i=vi(n,t),o=xi(e.vector_layers),s=Fi(o,i);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 xi(e){return Array.isArray(e)?e.map(t=>wi(t)):[]}function wi(e){let t=Object.entries(e.fields||[]).map(([n,i])=>({name:n,...yr(String(i))})),r={...e};return delete r.fields,{name:e.id||"",...r,fields:t}}function vi(e,t){return dr(e)&&Array.isArray(e.layers)?e.layers.map(r=>Ti(r,t)):[]}function Ti(e,t){let r=[],n={},i=e.attributes||[];for(let o of i){let s=o.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];n[a]=n[a]||[],n[a].push(o),console.warn("ignoring tilestats indexed field",a)}else r[s]||r.push(bi(o,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:r}}function Fi(e,t){return e.map(r=>{let n=t.find(s=>s.name===r.name),i=n?.fields||r.fields||[],o={...r,...n,fields:i};return o.schema=cr(o),o})}function fr(e){let t=mr(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(gr)&&[t[1],t[3]].every(pr))return[[t[0],t[1]],[t[2],t[3]]]}function Pi(e){let t=mr(e);return Array.isArray(t)&&t.length===3&&gr(t[0])&&pr(t[1])&&Ii(t[2])?t:null}function ur(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function pr(e){return Number.isFinite(e)&&e<=90&&e>=-90}function gr(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Ii(e){return Number.isFinite(e)&&e>=0&&e<=22}function mr(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var hr={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 bi(e={},t){let r=yr(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 yr(e){let t=e.toLowerCase();return!t||hr[t],hr[t]||{type:"string"}}var Ei="4.3.0",de={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Ei,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),i={...de.options.tilejson,...t?.tilejson};return st(n,i)},parseTextSync:(e,t)=>{let r=JSON.parse(e),n={...de.options.tilejson,...t?.tilejson};return st(r,n)}};var pe={x:0,y:1,z:2};function H(e,t={}){let{start:r=0,end:n=e.length,plane:i="xy"}=t,o=t.size||2,s=0,a=pe[i[0]],l=pe[i[1]];for(let c=r,f=n-o;c<n;c+=o)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function lt(e,t,r=2,n,i="xy"){let o=t&&t.length,s=o?t[0]*r:e.length,a=wr(e,0,s,r,!0,n&&n[0],i),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,d,p,y;if(o&&(a=Mi(e,t,a,r,n,i)),e.length>80*r){h=f=e[0],d=u=e[1];for(let P=r;P<s;P+=r)p=e[P],y=e[P+1],p<h&&(h=p),y<d&&(d=y),p>f&&(f=p),y>u&&(u=y);c=Math.max(f-h,u-d),c=c!==0?32767/c:0}return ge(a,l,r,h,d,c,0),l}function wr(e,t,r,n,i,o,s){let a,l;o===void 0&&(o=H(e,{start:t,end:r,size:n,plane:s}));let c=pe[s[0]],f=pe[s[1]];if(i===o<0)for(a=t;a<r;a+=n)l=xr(a,e[a+c],e[a+f],l);else for(a=r-n;a>=t;a-=n)l=xr(a,e[a+c],e[a+f],l);return l&&Ce(l,l.next)&&(ye(l),l=l.next),l}function Z(e,t){if(!e)return e;t||(t=e);let r=e,n;do if(n=!1,!r.steiner&&(Ce(r,r.next)||T(r.prev,r,r.next)===0)){if(ye(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function ge(e,t,r,n,i,o,s){if(!e)return;!s&&o&&Ci(e,n,i,o);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,o?_i(e,n,i,o):Ai(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(c.i/r|0),ye(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=Di(Z(e),t,r),ge(e,t,r,n,i,o,2)):s===2&&Li(e,t,r,n,i,o):ge(Z(e),t,r,n,i,o,1);break}}}function Ai(e){let t=e.prev,r=e,n=e.next;if(T(t,r,n)>=0)return!1;let i=t.x,o=r.x,s=n.x,a=t.y,l=r.y,c=n.y,f=i<o?i<s?i:s:o<s?o:s,u=a<l?a<c?a:c:l<c?l:c,h=i>o?i>s?i:s:o>s?o:s,d=a>l?a>c?a:c:l>c?l:c,p=n.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&q(i,a,o,l,s,c,p.x,p.y)&&T(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function _i(e,t,r,n){let i=e.prev,o=e,s=e.next;if(T(i,o,s)>=0)return!1;let a=i.x,l=o.x,c=s.x,f=i.y,u=o.y,h=s.y,d=a<l?a<c?a:c:l<c?l:c,p=f<u?f<h?f:h:u<h?u:h,y=a>l?a>c?a:c:l>c?l:c,P=f>u?f>h?f:h:u>h?u:h,D=at(d,p,t,r,n),v=at(y,P,t,r,n),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=D&&g&&g.z<=v;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==i&&m!==s&&q(a,f,l,u,c,h,m.x,m.y)&&T(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==i&&g!==s&&q(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>=D;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==i&&m!==s&&q(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>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==i&&g!==s&&q(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 Di(e,t,r){let n=e;do{let i=n.prev,o=n.next.next;!Ce(i,o)&&vr(i,n,n.next,o)&&me(i,o)&&me(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),ye(n),ye(n.next),n=e=o),n=n.next}while(n!==e);return Z(n)}function Li(e,t,r,n,i,o){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Gi(s,a)){let l=Tr(s,a);s=Z(s,s.next),l=Z(l,l.next),ge(s,t,r,n,i,o,0),ge(l,t,r,n,i,o,0);return}a=a.next}s=s.next}while(s!==e)}function Mi(e,t,r,n,i,o){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=wr(e,c,f,n,!1,i&&i[a+1],o),u===u.next&&(u.steiner=!0),s.push(zi(u));for(s.sort(Vi),a=0;a<s.length;a++)r=Ui(s[a],r);return r}function Vi(e,t){return e.x-t.x}function Ui(e,t){let r=ki(e,t);if(!r)return t;let n=Tr(r,e);return Z(n,n.next),Z(r,r.next)}function ki(e,t){let r=t,n=e.x,i=e.y,o=-1/0,s;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){let h=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(h<=n&&h>o&&(o=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&&q(i<c?n:o,i,l,c,i<c?o:n,i,r.x,r.y)&&(u=Math.abs(i-r.y)/(n-r.x),me(r,e)&&(u<f||u===f&&(r.x>s.x||r.x===s.x&&Ni(s,r)))&&(s=r,f=u)),r=r.next;while(r!==a);return s}function Ni(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function Ci(e,t,r,n){let i=e;do i.z===0&&(i.z=at(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Oi(i)}function Oi(e){let t,r,n=1,i,o,s,a,l,c;do{for(o=e,e=null,c=null,i=0;o;){for(i++,a=o,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||o.z<=a.z)?(t=o,o=o.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;o=a}c.nextZ=null,n*=2}while(i>1);return e}function at(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function zi(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 q(e,t,r,n,i,o,s,a){return(i-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(n-a)>=(r-s)*(t-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function Gi(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!ji(e,t)&&(me(e,t)&&me(t,e)&&Ri(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||Ce(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 Ce(e,t){return e.x===t.x&&e.y===t.y}function vr(e,t,r,n){let i=Ne(T(e,t,r)),o=Ne(T(e,t,n)),s=Ne(T(r,n,e)),a=Ne(T(r,n,t));return!!(i!==o&&s!==a||i===0&&ke(e,r,t)||o===0&&ke(e,n,t)||s===0&&ke(r,e,n)||a===0&&ke(r,t,n))}function ke(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 Ne(e){return e>0?1:e<0?-1:0}function ji(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&&vr(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function me(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 Ri(e,t){let r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Tr(e,t){let r=new xe(e.i,e.x,e.y),n=new xe(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function xr(e,t,r,n){let i=new xe(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ye(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 xe=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 ut(e,t,r){let n=Wi(e),i=Object.keys(n).filter(o=>n[o]!==Array);return Ki(e,{propArrayTypes:n,...t},{numericPropKeys:r&&r.numericPropKeys||i,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function Wi(e){let t={};for(let r of e)if(r.properties)for(let n in r.properties){let i=r.properties[n];t[n]=to(i,t[n])}return t}function Ki(e,t,r){let{pointPositionsCount:n,pointFeaturesCount:i,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:c,polygonRingsCount:f,polygonFeaturesCount:u,propArrayTypes:h,coordLength:d}=t,{numericPropKeys:p=[],PositionDataType:y=Float32Array,triangulate:P=!0}=r,D=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(n*d),globalFeatureIds:new v(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(o*d),globalFeatureIds:new v(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},S={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*d),globalFeatureIds:new v(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};P&&(S.triangles=[]);for(let M of[m,g,S])for(let I of p){let B=h[I];M.numericProps[I]=new B(M.positions.length/d)}g.pathIndices[s]=o,S.polygonIndices[c]=l,S.primitivePolygonIndices[f]=l;let k={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let M of e){let I=M.geometry,B=M.properties||{};switch(I.type){case"Point":Yi(I,m,k,d,B),m.properties.push(ft(B,p)),D&&m.fields.push({id:M.id}),k.pointFeature++;break;case"LineString":Xi(I,g,k,d,B),g.properties.push(ft(B,p)),D&&g.fields.push({id:M.id}),k.lineFeature++;break;case"Polygon":Qi(I,S,k,d,B),S.properties.push(ft(B,p)),D&&S.fields.push({id:M.id}),k.polygonFeature++;break;default:throw new Error("Invalid geometry type")}k.feature++}return eo(m,g,S,d)}function Yi(e,t,r,n,i){t.positions.set(e.data,r.pointPosition*n);let o=e.data.length/n;ht(t,i,r.pointPosition,o),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+o),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+o),r.pointPosition+=o}function Xi(e,t,r,n,i){t.positions.set(e.data,r.linePosition*n);let o=e.data.length/n;ht(t,i,r.linePosition,o),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+o),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(c-l)/n}}function Qi(e,t,r,n,i){t.positions.set(e.data,r.polygonPosition*n);let o=e.data.length/n;ht(t,i,r.polygonPosition,o),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+o),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+o);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 d=0,p=f.length;d<p;++d){let y=f[d],P=d===p-1?u===void 0?e.data.length:u[0]:f[d+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(P-y)/n}let h=r.polygonPosition;qi(t,c,f,{startPosition:l,endPosition:h,coordLength:n})}}function qi(e,t,r,{startPosition:n,endPosition:i,coordLength:o}){if(!e.triangles)return;let s=n*o,a=i*o,l=e.positions.subarray(s,a),c=r[0],f=r.slice(1).map(h=>(h-c)/o),u=lt(l,f,o,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(n+u[h])}function ct(e,t){let r={};for(let n in e)r[n]={value:e[n],size:t};return r}function eo(e,t,r,n){let i={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:ct(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:ct(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:ct(r.numericProps,1)}};return i.polygons&&r.triangles&&(i.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),i}function ht(e,t,r,n){for(let i in e.numericProps)if(i in t){let o=t[i];e.numericProps[i].fill(o,r,r+n)}}function ft(e,t){let r={};for(let n in e)t.includes(n)||(r[n]=e[n]);return r}function to(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var xt=Nt(_r(),1);function vo(e){let t=0;for(let r=0,n=e.length-1,i,o;r<e.length;n=r++)i=e[r],o=e[n],t+=(o[0]-i[0])*(i[1]+o[1]);return t}function gt(e,t){if(Array.isArray(e[0])){for(let n of e)gt(n,t);return}let r=e;r[0]/=t,r[1]/=t}function Dr(e,t){for(let r=0;r<e.length;++r)e[r]/=t}function mt(e,t,r){if(typeof e[0][0]!="number"){for(let s of e)mt(s,t,r);return}let n=r*Math.pow(2,t.z),i=r*t.x,o=r*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+i)*360/n-180;let l=180-(a[1]+o)*360/n;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function Lr(e,t,r){let{x:n,y:i,z:o}=t,s=r*Math.pow(2,o),a=r*n,l=r*i;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function Mr(e){let t=e.length;if(t<=1)return[e];let r=[],n,i;for(let o=0;o<t;o++){let s=vo(e[o]);s!==0&&(i===void 0&&(i=s<0),i===s<0?(n&&r.push(n),n=[e[o]]):n&&n.push(e[o]))}return n&&r.push(n),r}function Vr(e){let t=e.indices.length,r="Polygon";if(t<=1)return{type:r,data:e.data,areas:[[H(e.data)]],indices:[e.indices]};let n=[],i=[],o=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),d=H(h);if(d===0){let p=e.data.slice(0,u),y=e.data.slice(c);e.data=p.concat(y),l+=c-u;continue}a===void 0&&(a=d<0),a===d<0?(s.length&&(n.push(o),i.push(s)),s=[u],o=[d]):(o.push(d),s.push(u))}return o&&n.push(o),s.length&&i.push(s),{type:r,areas:n,indices:i,data:e.data}}var $=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,r,n,i,o,s){this.properties={},this.extent=n,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=i,this._values=o,this._geometryInfo=s,t.readFields(To,this,r)}toGeoJSONFeature(t,r){let n=this.loadGeometry();switch(t){case"wgs84":return Ur(this,n,i=>mt(i,r,this.extent));default:return Ur(this,n,gt)}}toBinaryFeature(t,r){let n=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(n,i=>Lr(i,r,this.extent));default:return this._toBinaryCoordinates(n,Dr)}}bbox(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i=0,o=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<r;){if(i<=0){let u=t.readVarint();n=u&7,i=u>>3}if(i--,n===1||n===2)o+=t.readSVarint(),s+=t.readSVarint(),o<a&&(a=o),o>l&&(l=o),s<c&&(c=s),s>f&&(f=s);else if(n!==7)throw new Error(`unknown command ${n}`)}return[a,c,l,f]}_toBinaryCoordinates(t,r){let n;r(t.data,this.extent);let i=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/i,n={type:"LineString",...t};break;case 3:n=Vr(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/i;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:n,properties:this.properties};return this.id!==null&&(o.id=this.id),o}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i=0,o=0,s=0,a=[],l;for(;t.pos<r;){if(i<=0){let c=t.readVarint();n=c&7,i=c>>3}switch(i--,n){case 1:case 2:o+=t.readSVarint(),s+=t.readSVarint(),n===1&&(l&&a.push(l),l=[]),l&&l.push([o,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${n}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let r=t.readVarint()+t.pos,n=1,i,o=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<r;)if(o<=0&&(i=t.readVarint(),n=i&7,o=i>>3),o--,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}}};Ct($,"types",["Unknown","Point","LineString","Polygon"]);function Ur(e,t,r){let n=$.types[e.type],i,o,s;switch(e.type){case 1:let l=[];for(i=0;i<t.length;i++)l[i]=t[i][0];s=l,r(s,e.extent);break;case 2:for(s=t,i=0;i<s.length;i++)r(s[i],e.extent);break;case 3:for(s=Mr(t),i=0;i<s.length;i++)for(o=0;o<s[i].length;o++)r(s[i][o],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 To(e,t,r){t&&r&&(e===1?t.id=r.readVarint():e===2?Fo(r,t):e===3?t.type=r.readVarint():e===4&&(t._geometry=r.pos))}function Fo(e,t){let r=e.readVarint()+e.pos;for(;e.pos<r;){let n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}var Ge=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(Po,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 $(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 $(this._pbf,n,this.extent,this._keys,this._values,r)}};function Po(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(Io(r)))}function Io(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 we=class{layers;constructor(t,r){this.layers=t.readFields(bo,{},r)}};function bo(e,t,r){if(e===3&&r){let n=new Ge(r,r.readVarint()+r.pos);n.length&&t&&(t[n.name]=n)}}function wt(e,t){let r=So(t),n=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(n){case"columnar-table":return{shape:"columnar-table",data:yt(e,r)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:kr(e,r)};case"geojson":return kr(e,r);case"binary-geometry":return yt(e,r);case"binary":return yt(e,r);default:throw new Error(n||"undefined shape")}}function yt(e,t){let[r,n]=Eo(e,t),i=ut(r,n);return i.byteLength=e.byteLength,i}function Eo(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 i=new we(new xt.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(i.layers)).forEach(s=>{let a=i.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,n),f=Ao(c,t,s);r.push(f)}}),[r,n]}function kr(e,t){if(e.byteLength<=0)return[];let r=[],n=new we(new xt.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(n.layers)).forEach(o=>{let s=n.layers[o];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=Bo(l,t,o);r.push(c)}}),r}function So(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&&qe.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function Bo(e,t,r){let n=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(n.properties||={},n.properties[t.layerProperty]=r),n}function Ao(e,t,r){let n=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&n.properties&&(n.properties[t.layerProperty]=r),n}var _o="4.3.0",Nr={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:_o,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},vt={...Nr,parse:async(e,t)=>wt(e,t),parseSync:wt,binary:!0};var Pe={};kt(Pe,{Compression:()=>en,EtagMismatch:()=>Re,FetchSource:()=>on,FileSource:()=>fs,PMTiles:()=>bt,Protocol:()=>is,ResolvedValueCache:()=>hs,SharedPromiseCache:()=>fn,TileType:()=>tn,bytesToHeader:()=>sn,findTile:()=>nn,getUint64:()=>_,leafletRasterLayer:()=>rs,readVarint:()=>ne,tileIdToZxy:()=>ls,tileTypeExt:()=>rn,zxyToTileId:()=>qr});var J=Math.pow,F=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{a(r.next(l))}catch(c){i(c)}},s=l=>{try{a(r.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,s);a((r=r.apply(e,t)).next())}),E=Uint8Array,ie=Uint16Array,Do=Int32Array,zr=new E([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Gr=new E([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Lo=new E([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jr=function(e,t){for(var r=new ie(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new Do(r[30]),n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return{b:r,r:i}},Rr=jr(zr,2),Hr=Rr.b,Mo=Rr.r;Hr[28]=258,Mo[258]=28;var Zr=jr(Gr,0),Vo=Zr.b,Jl=Zr.r,Pt=new ie(32768);for(w=0;w<32768;++w)z=(w&43690)>>1|(w&21845)<<1,z=(z&52428)>>2|(z&13107)<<2,z=(z&61680)>>4|(z&3855)<<4,Pt[w]=((z&65280)>>8|(z&255)<<8)>>1;var z,w,Te=function(e,t,r){for(var n=e.length,i=0,o=new ie(t);i<n;++i)e[i]&&++o[e[i]-1];var s=new ie(t);for(i=1;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;var a;if(r){a=new ie(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var c=i<<4|e[i],f=t-e[i],u=s[e[i]-1]++<<f,h=u|(1<<f)-1;u<=h;++u)a[Pt[u]>>l]=c}else for(a=new ie(n),i=0;i<n;++i)e[i]&&(a[i]=Pt[s[e[i]-1]++]>>15-e[i]);return a},Fe=new E(288);for(w=0;w<144;++w)Fe[w]=8;var w;for(w=144;w<256;++w)Fe[w]=9;var w;for(w=256;w<280;++w)Fe[w]=7;var w;for(w=280;w<288;++w)Fe[w]=8;var w,$r=new E(32);for(w=0;w<32;++w)$r[w]=5;var w,Uo=Te(Fe,9,1),ko=Te($r,5,1),Tt=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},U=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(t&7)&r},Ft=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(t&7)},No=function(e){return(e+7)/8|0},Co=function(e,t,r){(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new E(r-t);return n.set(e.subarray(t,r)),n},Oo=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],b=function(e,t,r){var n=new Error(t||Oo[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,b),!r)throw n;return n},Et=function(e,t,r,n){var i=e.length,o=n?n.length:0;if(!i||t.f&&!t.l)return r||new E(0);var s=!r||t.i!=2,a=t.i;r||(r=new E(i*3));var l=function(Mt){var Vt=r.length;if(Mt>Vt){var Ut=new E(Math.max(Vt*2,Mt));Ut.set(r),r=Ut}},c=t.f||0,f=t.p||0,u=t.b||0,h=t.l,d=t.d,p=t.m,y=t.n,P=i*8;do{if(!h){c=U(e,f,1);var D=U(e,f+1,3);if(f+=3,D)if(D==1)h=Uo,d=ko,p=9,y=5;else if(D==2){var S=U(e,f,31)+257,k=U(e,f+10,15)+4,M=S+U(e,f+5,31)+1;f+=14;for(var I=new E(M),B=new E(19),A=0;A<k;++A)B[Lo[A]]=U(e,f+A*3,7);f+=k*3;for(var Bt=Tt(B),mn=(1<<Bt)-1,yn=Te(B,Bt,1),A=0;A<M;){var At=yn[U(e,f,mn)];f+=At&15;var v=At>>4;if(v<16)I[A++]=v;else{var K=0,Ee=0;for(v==16?(Ee=3+U(e,f,3),f+=2,K=I[A-1]):v==17?(Ee=3+U(e,f,7),f+=3):v==18&&(Ee=11+U(e,f,127),f+=7);Ee--;)I[A++]=K}}var _t=I.subarray(0,S),V=I.subarray(S);p=Tt(_t),y=Tt(V),h=Te(_t,p,1),d=Te(V,y,1)}else b(1);else{var v=No(f)+4,m=e[v-4]|e[v-3]<<8,g=v+m;if(g>i){a&&b(0);break}s&&l(u+m),r.set(e.subarray(v,g),u),t.b=u+=m,t.p=f=g*8,t.f=c;continue}if(f>P){a&&b(0);break}}s&&l(u+131072);for(var xn=(1<<p)-1,wn=(1<<y)-1,Ze=f;;Ze=f){var K=h[Ft(e,f)&xn],Y=K>>4;if(f+=K&15,f>P){a&&b(0);break}if(K||b(2),Y<256)r[u++]=Y;else if(Y==256){Ze=f,h=null;break}else{var Dt=Y-254;if(Y>264){var A=Y-257,oe=zr[A];Dt=U(e,f,(1<<oe)-1)+Hr[A],f+=oe}var $e=d[Ft(e,f)&wn],Je=$e>>4;$e||b(3),f+=$e&15;var V=Vo[Je];if(Je>3){var oe=Gr[Je];V+=Ft(e,f)&(1<<oe)-1,f+=oe}if(f>P){a&&b(0);break}s&&l(u+131072);var We=u+Dt;if(u<V){var Lt=o-V,vn=Math.min(V,We);for(Lt+u<0&&b(3);u<vn;++u)r[u]=n[Lt+u]}for(;u<We;u+=4)r[u]=r[u-V],r[u+1]=r[u+1-V],r[u+2]=r[u+2-V],r[u+3]=r[u+3-V];u=We}}t.l=h,t.p=Ze,t.b=u,t.f=c,h&&(c=1,t.m=p,t.d=d,t.n=y)}while(!c);return u==r.length?r:Co(r,0,u)},zo=new E(0),Go=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&b(6,"invalid gzip data");var t=e[3],r=10;t&4&&(r+=(e[10]|e[11]<<8)+2);for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[r++]);return r+(t&2)},jo=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ro=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&b(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&b(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function Ho(e,t){return Et(e,{i:2},t&&t.out,t&&t.dictionary)}function Zo(e,t){var r=Go(e);return r+8>e.length&&b(6,"invalid gzip data"),Et(e.subarray(r,-8),{i:2},t&&t.out||new E(jo(e)),t&&t.dictionary)}function $o(e,t){return Et(e.subarray(Ro(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}function It(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Zo(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Ho(e,t):$o(e,t)}var Jo=typeof TextDecoder<"u"&&new TextDecoder,Wo=0;try{Jo.decode(zo,{stream:!0}),Wo=1}catch{}var Jr=(e,t)=>e*J(2,t),ve=(e,t)=>Math.floor(e/J(2,t)),je=(e,t)=>Jr(e.getUint16(t+1,!0),8)+e.getUint8(t),Wr=(e,t)=>Jr(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),Ko=(e,t,r,n,i)=>{if(e!==n.getUint8(i))return e-n.getUint8(i);let o=je(n,i+1);if(t!==o)return t-o;let s=je(n,i+4);return r!==s?r-s:0},Yo=(e,t,r,n)=>{let i=Kr(e,t|128,r,n);return i?{z:t,x:r,y:n,offset:i[0],length:i[1],isDir:!0}:null},Cr=(e,t,r,n)=>{let i=Kr(e,t,r,n);return i?{z:t,x:r,y:n,offset:i[0],length:i[1],isDir:!1}:null},Kr=(e,t,r,n)=>{let i=0,o=e.byteLength/17-1;for(;i<=o;){let s=o+i>>1,a=Ko(t,r,n,e,s*17);if(a>0)i=s+1;else if(a<0)o=s-1;else return[Wr(e,s*17+7),e.getUint32(s*17+13,!0)]}return null},Xo=(e,t)=>e.isDir&&!t.isDir?1:!e.isDir&&t.isDir?-1:e.z!==t.z?e.z-t.z:e.x!==t.x?e.x-t.x:e.y-t.y,Yr=(e,t)=>{let r=e.getUint8(t*17);return{z:r&127,x:je(e,t*17+1),y:je(e,t*17+4),offset:Wr(e,t*17+7),length:e.getUint32(t*17+13,!0),isDir:r>>7===1}},Or=e=>{let t=[],r=new DataView(e);for(let n=0;n<r.byteLength/17;n++)t.push(Yr(r,n));return Qo(t)},Qo=e=>{e.sort(Xo);let t=new ArrayBuffer(17*e.length),r=new Uint8Array(t);for(let n=0;n<e.length;n++){let i=e[n],o=i.z;i.isDir&&(o=o|128),r[n*17]=o,r[n*17+1]=i.x&255,r[n*17+2]=i.x>>8&255,r[n*17+3]=i.x>>16&255,r[n*17+4]=i.y&255,r[n*17+5]=i.y>>8&255,r[n*17+6]=i.y>>16&255,r[n*17+7]=i.offset&255,r[n*17+8]=ve(i.offset,8)&255,r[n*17+9]=ve(i.offset,16)&255,r[n*17+10]=ve(i.offset,24)&255,r[n*17+11]=ve(i.offset,32)&255,r[n*17+12]=ve(i.offset,48)&255,r[n*17+13]=i.length&255,r[n*17+14]=i.length>>8&255,r[n*17+15]=i.length>>16&255,r[n*17+16]=i.length>>24&255}return t},qo=(e,t)=>{if(e.byteLength<17)return null;let r=e.byteLength/17,n=Yr(e,r-1);if(n.isDir){let i=n.z,o=t.z-i,s=Math.trunc(t.x/(1<<o)),a=Math.trunc(t.y/(1<<o));return{z:i,x:s,y:a}}return null};function es(e){return F(this,null,function*(){let t=yield e.getBytes(0,512e3),r=new DataView(t.data),n=r.getUint32(4,!0),i=r.getUint16(8,!0),o=new TextDecoder("utf-8"),s=JSON.parse(o.decode(new DataView(t.data,10,n))),a=0;s.compression==="gzip"&&(a=2);let l=0;"minzoom"in s&&(l=+s.minzoom);let c=0;"maxzoom"in s&&(c=+s.maxzoom);let f=0,u=0,h=0,d=-180,p=-85,y=180,P=85;if(s.bounds){let v=s.bounds.split(",");d=+v[0],p=+v[1],y=+v[2],P=+v[3]}if(s.center){let v=s.center.split(",");f=+v[0],u=+v[1],h=+v[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+n,rootDirectoryLength:i*17,jsonMetadataOffset:10,jsonMetadataLength:n,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:a,tileType:1,minZoom:l,maxZoom:c,minLon:d,minLat:p,maxLon:y,maxLat:P,centerZoom:h,centerLon:f,centerLat:u,etag:t.etag}})}function ts(e,t,r,n,i,o,s){return F(this,null,function*(){let a=yield r.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);e.specVersion===1&&(a=Or(a));let l=Cr(new DataView(a),n,i,o);if(l){let u=(yield t.getBytes(l.offset,l.length,s)).data,h=new DataView(u);return h.getUint8(0)===31&&h.getUint8(1)===139&&(u=It(new Uint8Array(u))),{data:u}}let c=qo(new DataView(a),{z:n,x:i,y:o});if(c){let f=Yo(new DataView(a),c.z,c.x,c.y);if(f){let u=yield r.getArrayBuffer(t,f.offset,f.length,e);e.specVersion===1&&(u=Or(u));let h=Cr(new DataView(u),n,i,o);if(h){let p=(yield t.getBytes(h.offset,h.length,s)).data,y=new DataView(p);return y.getUint8(0)===31&&y.getUint8(1)===139&&(p=It(new Uint8Array(p))),{data:p}}}}})}var Xr={getHeader:es,getZxy:ts},rs=(e,t)=>{let r=!1,n="",i=L.GridLayer.extend({createTile:(o,s)=>{let a=document.createElement("img"),l=new AbortController,c=l.signal;return a.cancel=()=>{l.abort()},r||(e.getHeader().then(f=>{f.tileType===1?console.error("Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):f.tileType===2?n="image/png":f.tileType===3?n="image/jpeg":f.tileType===4?n="image/webp":f.tileType===5&&(n="image/avif")}),r=!0),e.getZxy(o.z,o.x,o.y,c).then(f=>{if(f){let u=new Blob([f.data],{type:n}),h=window.URL.createObjectURL(u);a.src=h,a.cancel=void 0,s(void 0,a)}}).catch(f=>{if(f.name!=="AbortError")throw f}),a},_removeTile:function(o){let s=this._tiles[o];s&&(s.el.cancel&&s.el.cancel(),s.el.width=0,s.el.height=0,s.el.deleted=!0,L.DomUtil.remove(s.el),delete this._tiles[o],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(o)}))}});return new i(t)},ns=e=>(t,r)=>{if(r instanceof AbortController)return e(t,r);let n=new AbortController;return e(t,n).then(i=>r(void 0,i.data,i.cacheControl||"",i.expires||""),i=>r(i)).catch(i=>r(i)),{cancel:()=>n.abort()}},is=class{constructor(){this.tilev4=(e,t)=>F(this,null,function*(){if(e.type==="json"){let u=e.url.substr(10),h=this.tiles.get(u);h||(h=new bt(u),this.tiles.set(u,h));let d=yield h.getHeader();return{data:{tiles:[`${e.url}/{z}/{x}/{y}`],minzoom:d.minZoom,maxzoom:d.maxZoom,bounds:[d.minLon,d.minLat,d.maxLon,d.maxLat]}}}let r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),n=e.url.match(r);if(!n)throw new Error("Invalid PMTiles protocol URL");let i=n[1],o=this.tiles.get(i);o||(o=new bt(i),this.tiles.set(i,o));let s=n[2],a=n[3],l=n[4],c=yield o.getHeader(),f=yield o?.getZxy(+s,+a,+l,t.signal);return f?{data:new Uint8Array(f.data),cacheControl:f.cacheControl,expires:f.expires}:c.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=ns(this.tilev4),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function re(e,t){return(t>>>0)*4294967296+(e>>>0)}function os(e,t){let r=t.buf,n=r[t.pos++],i=(n&112)>>4;if(n<128||(n=r[t.pos++],i|=(n&127)<<3,n<128)||(n=r[t.pos++],i|=(n&127)<<10,n<128)||(n=r[t.pos++],i|=(n&127)<<17,n<128)||(n=r[t.pos++],i|=(n&127)<<24,n<128)||(n=r[t.pos++],i|=(n&1)<<31,n<128))return re(e,i);throw new Error("Expected varint not more than 10 bytes")}function ne(e){let t=e.buf,r=t[e.pos++],n=r&127;return r<128||(r=t[e.pos++],n|=(r&127)<<7,r<128)||(r=t[e.pos++],n|=(r&127)<<14,r<128)||(r=t[e.pos++],n|=(r&127)<<21,r<128)?n:(r=t[e.pos],n|=(r&15)<<28,os(n,e))}function Qr(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function ss(e,t){let r=J(2,e),n=t,i=t,o=t,s=[0,0],a=1;for(;a<r;)n=1&o/2,i=1&(o^n),Qr(a,s,n,i),s[0]+=a*n,s[1]+=a*i,o=o/4,a*=2;return[e,s[0],s[1]]}var as=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function qr(e,t,r){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>J(2,e)-1||r>J(2,e)-1)throw Error("tile x/y outside zoom level bounds");let n=as[e],i=J(2,e),o=0,s=0,a=0,l=[t,r],c=i/2;for(;c>0;)o=(l[0]&c)>0?1:0,s=(l[1]&c)>0?1:0,a+=c*c*(3*o^s),Qr(c,l,o,s),c=c/2;return n+a}function ls(e){let t=0,r=0;for(let n=0;n<27;n++){let i=(1<<n)*(1<<n);if(t+i>e)return ss(n,e-t);t+=i}throw Error("Tile zoom level exceeds max safe number limit (26)")}var en=(e=>(e[e.Unknown=0]="Unknown",e[e.None=1]="None",e[e.Gzip=2]="Gzip",e[e.Brotli=3]="Brotli",e[e.Zstd=4]="Zstd",e))(en||{});function St(e,t){return F(this,null,function*(){if(t===1||t===0)return e;if(t===2){if(typeof globalThis.DecompressionStream>"u")return It(new Uint8Array(e));let r=new Response(e).body;if(!r)throw Error("Failed to read response stream");let n=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(n).arrayBuffer()}throw Error("Compression method not supported")})}var tn=(e=>(e[e.Unknown=0]="Unknown",e[e.Mvt=1]="Mvt",e[e.Png=2]="Png",e[e.Jpeg=3]="Jpeg",e[e.Webp=4]="Webp",e[e.Avif=5]="Avif",e))(tn||{});function rn(e){return e===1?".mvt":e===2?".png":e===3?".jpg":e===4?".webp":e===5?".avif":""}var cs=127;function nn(e,t){let r=0,n=e.length-1;for(;r<=n;){let i=n+r>>1,o=t-e[i].tileId;if(o>0)r=i+1;else if(o<0)n=i-1;else return e[i]}return n>=0&&(e[n].runLength===0||t-e[n].tileId<e[n].runLength)?e[n]:null}var fs=class{constructor(e){this.file=e}getKey(){return this.file.name}getBytes(e,t){return F(this,null,function*(){return{data:yield this.file.slice(e,e+t).arrayBuffer()}})}},on=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1;let r="";"navigator"in globalThis&&(r=globalThis.navigator.userAgent||"");let n=r.indexOf("Windows")>-1,i=/Chrome|Chromium|Edg|OPR|Brave/.test(r);this.chromeWindowsNoCache=!1,n&&i&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,r,n){return F(this,null,function*(){let i,o;r?o=r:(i=new AbortController,o=i.signal);let s=new Headers(this.customHeaders);s.set("range",`bytes=${e}-${e+t-1}`);let a;this.mustReload?a="reload":this.chromeWindowsNoCache&&(a="no-store");let l=yield fetch(this.url,{signal:o,cache:a,headers:s});if(e===0&&l.status===416){let h=l.headers.get("Content-Range");if(!h||!h.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let d=+h.substr(8);l=yield fetch(this.url,{signal:o,cache:"reload",headers:{range:`bytes=0-${d-1}`}})}let c=l.headers.get("Etag");if(c?.startsWith("W/")&&(c=null),l.status===416||n&&c&&c!==n)throw this.mustReload=!0,new Re(`Server returned non-matching ETag ${n} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);let f=l.headers.get("Content-Length");if(l.status===200&&(!f||+f>t))throw i&&i.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:c||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function _(e,t){let r=e.getUint32(t+4,!0),n=e.getUint32(t+0,!0);return r*J(2,32)+n}function sn(e,t){let r=new DataView(e),n=r.getUint8(7);if(n>3)throw Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:_(r,8),rootDirectoryLength:_(r,16),jsonMetadataOffset:_(r,24),jsonMetadataLength:_(r,32),leafDirectoryOffset:_(r,40),leafDirectoryLength:_(r,48),tileDataOffset:_(r,56),tileDataLength:_(r,64),numAddressedTiles:_(r,72),numTileEntries:_(r,80),numTileContents:_(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:t}}function an(e){let t={buf:new Uint8Array(e),pos:0},r=ne(t),n=[],i=0;for(let o=0;o<r;o++){let s=ne(t);n.push({tileId:i+s,offset:0,length:0,runLength:1}),i+=s}for(let o=0;o<r;o++)n[o].runLength=ne(t);for(let o=0;o<r;o++)n[o].length=ne(t);for(let o=0;o<r;o++){let s=ne(t);s===0&&o>0?n[o].offset=n[o-1].offset+n[o-1].length:n[o].offset=s-1}return n}function us(e){let t=new DataView(e);return t.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):t.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var Re=class extends Error{};function ln(e,t){return F(this,null,function*(){let r=yield e.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(us(r.data)<3)return[yield Xr.getHeader(e)];let i=r.data.slice(0,cs),o=sn(i,r.etag),s=r.data.slice(o.rootDirectoryOffset,o.rootDirectoryOffset+o.rootDirectoryLength),a=`${e.getKey()}|${o.etag||""}|${o.rootDirectoryOffset}|${o.rootDirectoryLength}`,l=an(yield t(s,o.internalCompression));return[o,[a,l.length,l]]})}function cn(e,t,r,n,i){return F(this,null,function*(){let o=yield e.getBytes(r,n,void 0,i.etag),s=yield t(o.data,i.internalCompression),a=an(s);if(a.length===0)throw new Error("Empty directory is invalid");return a})}var hs=class{constructor(e=100,t=!0,r=St){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return F(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,r.data;let n=yield ln(e,this.decompress);return n[1]&&this.cache.set(n[1][0],{lastUsed:this.counter++,data:n[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:n[0]}),this.prune(),n[0]})}getDirectory(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,o.data;let s=yield cn(e,this.decompress,t,r,n);return this.cache.set(i,{lastUsed:this.counter++,data:s}),this.prune(),s})}getArrayBuffer(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=yield e.getBytes(t,r,void 0,n.etag);return this.cache.set(i,{lastUsed:this.counter++,data:s.data}),this.prune(),s.data})}prune(){if(this.cache.size>this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){this.cache.delete(e.getKey())})}},fn=class{constructor(e=100,t=!0,r=St){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=r}getHeader(e){return F(this,null,function*(){let t=e.getKey(),r=this.cache.get(t);if(r)return r.lastUsed=this.counter++,yield r.data;let n=new Promise((i,o)=>{ln(e,this.decompress).then(s=>{s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:Promise.resolve(s[1][2])}),i(s[0]),this.prune()}).catch(s=>{o(s)})});return this.cache.set(t,{lastUsed:this.counter++,data:n}),n})}getDirectory(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=new Promise((a,l)=>{cn(e,this.decompress,t,r,n).then(c=>{a(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(e,t,r,n){return F(this,null,function*(){let i=`${e.getKey()}|${n.etag||""}|${t}|${r}`,o=this.cache.get(i);if(o)return o.lastUsed=this.counter++,yield o.data;let s=new Promise((a,l)=>{e.getBytes(t,r,void 0,n.etag).then(c=>{a(c.data),this.cache.has(i),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:s}),s})}prune(){if(this.cache.size>=this.maxCacheEntries){let e=1/0,t;this.cache.forEach((r,n)=>{r.lastUsed<e&&(e=r.lastUsed,t=n)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){let t=e.getKey();if(this.invalidations.get(t))return yield this.invalidations.get(t);this.cache.delete(e.getKey());let r=new Promise((n,i)=>{this.getHeader(e).then(o=>{n(),this.invalidations.delete(t)}).catch(o=>{i(o)})});this.invalidations.set(t,r)})}},bt=class{constructor(e,t,r){typeof e=="string"?this.source=new on(e):this.source=e,r?this.decompress=r:this.decompress=St,t?this.cache=t:this.cache=new fn}getHeader(){return F(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,r,n){return F(this,null,function*(){let i=qr(e,t,r),o=yield this.cache.getHeader(this.source);if(o.specVersion<3)return Xr.getZxy(o,this.source,this.cache,e,t,r,n);if(e<o.minZoom||e>o.maxZoom)return;let s=o.rootDirectoryOffset,a=o.rootDirectoryLength;for(let l=0;l<=3;l++){let c=yield this.cache.getDirectory(this.source,s,a,o),f=nn(c,i);if(f){if(f.runLength>0){let u=yield this.source.getBytes(o.tileDataOffset+f.offset,f.length,n,o.etag);return{data:yield this.decompress(u.data,o.tileCompression),cacheControl:u.cacheControl,expires:u.expires}}s=o.leafDirectoryOffset+f.offset,a=f.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(e,t,r,n){return F(this,null,function*(){try{return yield this.getZxyAttempt(e,t,r,n)}catch(i){if(i instanceof Re)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,r,n);throw i}})}getMetadataAttempt(){return F(this,null,function*(){let e=yield this.cache.getHeader(this.source),t=yield this.source.getBytes(e.jsonMetadataOffset,e.jsonMetadataLength,void 0,e.etag),r=yield this.decompress(t.data,e.internalCompression),n=new TextDecoder("utf-8");return JSON.parse(n.decode(r))})}getMetadata(){return F(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof Re)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}getTileJson(e){return F(this,null,function*(){let t=yield this.getHeader(),r=yield this.getMetadata(),n=rn(t.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${e}/{z}/{x}/{y}${n}`],vector_layers:r.vector_layers,attribution:r.attribution,description:r.description,name:r.name,version:r.version,bounds:[t.minLon,t.minLat,t.maxLon,t.maxLat],center:[t.centerLon,t.centerLat,t.centerZoom],minzoom:t.minZoom,maxzoom:t.maxZoom}})}};var{TileType:Ie}=Pe;function un(e,t,r,n){let i=null;if(t)try{let a=JSON.stringify(t);i=de.parseTextSync?.(a,n)||null}catch(a){console.warn("PMTiles metadata could not be interpreted as TileJSON",a)}let o={};typeof i?.name=="string"&&(o.name=i.name),typeof i?.htmlAttribution=="string"&&(o.attributions=[i.htmlAttribution]);let s={...o,format:"pmtiles",formatVersion:e.specVersion,attributions:[],tileMIMEType:ds(e.tileType),minZoom:e.minZoom,maxZoom:e.maxZoom,boundingBox:[[e.minLon,e.minLat],[e.maxLon,e.maxLat]],center:[e.centerLon,e.centerLat],centerZoom:e.centerZoom,etag:e.etag};return i&&(s.tilejson=i),r?.includeFormatHeader&&(s.formatHeader=e,s.formatMetadata=s),s}function ds(e){switch(e){case Ie.Mvt:return"application/vnd.mapbox-vector-tile";case Ie.Png:return"image/png";case Ie.Jpeg:return"image/jpeg";case Ie.Webp:return"image/webp";case Ie.Avif:return"image/avif";default:return"application/octet-stream"}}var He=class{blob;key;constructor(t,r){this.blob=t,this.key=r}getKey(){return this.blob.url||""}async getBytes(t,r,n){return{data:await this.blob.slice(t,t+r).arrayBuffer()}}};var{PMTiles:ps}=Pe,gs="1.0.0",hn={name:"PMTiles",id:"pmtiles",module:"pmtiles",version:gs,extensions:["pmtiles"],mimeTypes:["application/octet-stream"],options:{url:void 0,pmtiles:{}},type:"pmtiles",fromUrl:!0,fromBlob:!0,testURL:e=>e.endsWith(".pmtiles"),createDataSource:(e,t)=>new W(e,t)},W=class extends fe{data;props;mimeType=null;pmtiles;metadata;constructor(t,r){super(r),this.props=r;let n=typeof t=="string"?et(t):new He(t,"pmtiles");this.data=t,this.pmtiles=new ps(n),this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata()}async getSchema(){return{fields:[],metadata:{}}}async getMetadata(){let t=await this.pmtiles.getHeader(),r=await this.pmtiles.getMetadata()||{},n=un(t,r,{includeFormatHeader:!1},this.loadOptions);return this.props.attributions&&(n.attributions=[...this.props.attributions,...n.attributions||[]]),n?.tileMIMEType&&(this.mimeType=n?.tileMIMEType),n}async getTile(t){let{x:r,y:n,z:i}=t,s=(await this.pmtiles.getZxy(i,r,n))?.data;return s||null}async getTileData(t){let{x:r,y:n,z:i}=t.index;switch((await this.metadata).tileMIMEType){case"application/vnd.mapbox-vector-tile":return await this.getVectorTile({x:r,y:n,z:i,layers:[]});default:return await this.getImageTile({x:r,y:n,z:i,layers:[]})}}async getImageTile(t){let r=await this.getTile(t);return r?await ot.parse(r,this.loadOptions):null}async getVectorTile(t){let r=await this.getTile(t),n={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:t.x,y:t.y,z:t.z},...this.loadOptions?.mvt},...this.loadOptions};return r?await vt.parse(r,n):null}};var dn="4.3.0";var gn={name:"PMTiles",id:"pmtiles",module:"pmtiles",version:dn,extensions:["pmtiles"],mimeTypes:["application/octet-stream"],tests:["PMTiles"],options:{pmtiles:{}},parse:async(e,t)=>pn(new ce(new Blob([e])),t),parseFile:pn};async function pn(e,t){let n=await new W(e.handle,{pmtiles:t?.pmtiles||{}}).getMetadata(),{tileMIMEType:i,tilejson:o={}}=n,{layers:s=[]}=o;switch(i){case"application/vnd.mapbox-vector-tile":return{shape:"vector-source",layers:s.map(a=>({name:a.name,schema:a.schema})),tables:[],formatSpecificMetadata:n};case"image/png":case"image/jpeg":return{shape:"image-source",formatSpecificMetadata:n};default:throw new Error(`PMTilesLoader: Unsupported tile MIME type ${i}`)}}return Sn(be);})();
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
ieee754/index.js:
|
package/dist/index.cjs
CHANGED
|
@@ -224,7 +224,7 @@ var PMTilesTileSource = class extends import_loader_utils.DataSource {
|
|
|
224
224
|
var import_loader_utils2 = require("@loaders.gl/loader-utils");
|
|
225
225
|
|
|
226
226
|
// dist/lib/version.js
|
|
227
|
-
var VERSION2 = true ? "4.3.0
|
|
227
|
+
var VERSION2 = true ? "4.3.0" : "latest";
|
|
228
228
|
|
|
229
229
|
// dist/pmtiles-loader.js
|
|
230
230
|
var PMTilesLoader = {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.js", "pmtiles-source.js", "lib/parse-pmtiles.js", "lib/blob-source.js", "pmtiles-loader.js", "lib/version.js"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { PMTilesSource } from \"./pmtiles-source.js\";\nexport { PMTilesTileSource } from \"./pmtiles-source.js\";\nexport { PMTilesLoader as _PMTilesLoader } from \"./pmtiles-loader.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { DataSource, resolvePath } from '@loaders.gl/loader-utils';\nimport { ImageLoader } from '@loaders.gl/images';\nimport { MVTLoader } from '@loaders.gl/mvt';\nimport * as pmtiles from 'pmtiles';\nconst { PMTiles } = pmtiles;\nimport { parsePMTilesHeader } from \"./lib/parse-pmtiles.js\";\nimport { BlobSource } from \"./lib/blob-source.js\";\nconst VERSION = '1.0.0';\n/**\n * Creates vector tile data sources for PMTiles urls or blobs\n */\nexport const PMTilesSource = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n options: { url: undefined, pmtiles: {} },\n type: 'pmtiles',\n fromUrl: true,\n fromBlob: true,\n testURL: (url) => url.endsWith('.pmtiles'),\n createDataSource: (url, props) => new PMTilesTileSource(url, props)\n};\n/**\n * A PMTiles data source\n * @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.\n */\nexport class PMTilesTileSource extends DataSource {\n data;\n props;\n mimeType = null;\n pmtiles;\n metadata;\n constructor(data, props) {\n super(props);\n this.props = props;\n const url = typeof data === 'string' ? resolvePath(data) : new BlobSource(data, 'pmtiles');\n this.data = data;\n this.pmtiles = new PMTiles(url);\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\n }\n async getSchema() {\n return { fields: [], metadata: {} };\n }\n async getMetadata() {\n const pmtilesHeader = await this.pmtiles.getHeader();\n const pmtilesMetadata = (await this.pmtiles.getMetadata()) || {};\n const metadata = parsePMTilesHeader(pmtilesHeader, pmtilesMetadata, { includeFormatHeader: false }, this.loadOptions);\n // Add additional attribution if necessary\n if (this.props.attributions) {\n metadata.attributions = [...this.props.attributions, ...(metadata.attributions || [])];\n }\n if (metadata?.tileMIMEType) {\n this.mimeType = metadata?.tileMIMEType;\n }\n // TODO - do we need to allow tileSize to be overridden? Some PMTiles examples seem to suggest it.\n return metadata;\n }\n async getTile(tileParams) {\n const { x, y, z } = tileParams;\n const rangeResponse = await this.pmtiles.getZxy(z, x, y);\n const arrayBuffer = rangeResponse?.data;\n if (!arrayBuffer) {\n // console.error('No arrayBuffer', tileParams);\n return null;\n }\n return arrayBuffer;\n }\n // Tile Source interface implementation: deck.gl compatible API\n // TODO - currently only handles image tiles, not vector tiles\n async getTileData(tileParams) {\n const { x, y, z } = tileParams.index;\n const metadata = await this.metadata;\n switch (metadata.tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return await this.getVectorTile({ x, y, z, layers: [] });\n default:\n return await this.getImageTile({ x, y, z, layers: [] });\n }\n }\n // ImageTileSource interface implementation\n async getImageTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n return arrayBuffer ? await ImageLoader.parse(arrayBuffer, this.loadOptions) : null;\n }\n // VectorTileSource interface implementation\n async getVectorTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n const loadOptions = {\n shape: 'geojson-table',\n mvt: {\n coordinates: 'wgs84',\n tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },\n ...this.loadOptions?.mvt\n },\n ...this.loadOptions\n };\n return arrayBuffer ? await MVTLoader.parse(arrayBuffer, loadOptions) : null;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { TileJSONLoader } from '@loaders.gl/mvt';\n// import {Source, PMTiles, Header, TileType} from 'pmtiles';\nimport * as pmtiles from 'pmtiles';\nconst { TileType } = pmtiles;\n/**\n * Parse PMTiles metdata from a PMTiles file\n * @param header\n * @param tilejsonMetadata\n * @param options\n * @param loadOptions\n * @returns\n */\nexport function parsePMTilesHeader(header, pmtilesMetadata, options, loadOptions) {\n // Ironically, to use the TileJSON loader we need to stringify the metadata again.\n // This is the price of integrating with the existing pmtiles library.\n // TODO - provide a non-standard TileJSONLoader parsers that accepts a JSON object?\n let tilejson = null;\n if (pmtilesMetadata) {\n try {\n const string = JSON.stringify(pmtilesMetadata);\n tilejson = TileJSONLoader.parseTextSync?.(string, loadOptions) || null;\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.warn('PMTiles metadata could not be interpreted as TileJSON', error);\n }\n }\n const partialMetadata = {};\n if (typeof tilejson?.name === 'string') {\n partialMetadata.name = tilejson.name;\n }\n if (typeof tilejson?.htmlAttribution === 'string') {\n partialMetadata.attributions = [tilejson.htmlAttribution];\n }\n const metadata = {\n ...partialMetadata,\n format: 'pmtiles',\n formatVersion: header.specVersion,\n attributions: [],\n tileMIMEType: decodeTileType(header.tileType),\n minZoom: header.minZoom,\n maxZoom: header.maxZoom,\n boundingBox: [\n [header.minLon, header.minLat],\n [header.maxLon, header.maxLat]\n ],\n center: [header.centerLon, header.centerLat],\n centerZoom: header.centerZoom,\n etag: header.etag\n };\n if (tilejson) {\n metadata.tilejson = tilejson;\n }\n // Application can optionally include the raw header and metadata.\n if (options?.includeFormatHeader) {\n metadata.formatHeader = header;\n metadata.formatMetadata = metadata;\n }\n return metadata;\n}\n/** Extract a MIME type for tiles from vector tile header */\nfunction decodeTileType(tileType) {\n switch (tileType) {\n case TileType.Mvt:\n return 'application/vnd.mapbox-vector-tile';\n case TileType.Png:\n return 'image/png';\n case TileType.Jpeg:\n return 'image/jpeg';\n case TileType.Webp:\n return 'image/webp';\n case TileType.Avif:\n return 'image/avif';\n default:\n return 'application/octet-stream';\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * A PMTiles library compatible source that reads from blobs\n * @deprecated TODO - reimplement as ReadableFileSource\n * Use loaders.gl HTTP range requests instead\n */\nexport class BlobSource {\n blob;\n key;\n constructor(blob, key) {\n this.blob = blob;\n this.key = key;\n }\n // TODO - how is this used?\n getKey() {\n // @ts-expect-error url is only defined on File subclass\n return this.blob.url || '';\n }\n async getBytes(offset, length, signal) {\n const slice = this.blob.slice(offset, offset + length);\n const data = await slice.arrayBuffer();\n return {\n data\n // etag: response.headers.get('ETag') || undefined,\n // cacheControl: response.headers.get('Cache-Control') || undefined,\n // expires: response.headers.get('Expires') || undefined\n };\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { BlobFile } from '@loaders.gl/loader-utils';\nimport { VERSION } from \"./lib/version.js\";\nimport { PMTilesTileSource } from \"./pmtiles-source.js\";\n/**\n * Loader for PMTiles metadata\n * @note This loader is intended to allow PMTiles to be treated like other file types in top-level loading logic.\n * @note For actual access to the tile data, use the PMTilesSource class.\n */\nexport const PMTilesLoader = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n tests: ['PMTiles'],\n options: {\n pmtiles: {}\n },\n parse: async (arrayBuffer, options) => parseFileAsPMTiles(new BlobFile(new Blob([arrayBuffer])), options),\n parseFile: parseFileAsPMTiles\n};\nasync function parseFileAsPMTiles(file, options) {\n const source = new PMTilesTileSource(file.handle, {\n pmtiles: options?.pmtiles || {}\n });\n const formatSpecificMetadata = await source.getMetadata();\n const { tileMIMEType, tilejson = {} } = formatSpecificMetadata;\n const { layers = [] } = tilejson;\n switch (tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return {\n shape: 'vector-source',\n layers: layers.map((layer) => ({ name: layer.name, schema: layer.schema })),\n tables: [],\n formatSpecificMetadata\n };\n case 'image/png':\n case 'image/jpeg':\n return { shape: 'image-source', formatSpecificMetadata };\n default:\n throw new Error(`PMTilesLoader: Unsupported tile MIME type ${tileMIMEType}`);\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.0-beta.3\" !== 'undefined' ? \"4.3.0-beta.3\" : 'latest';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,0BAAwC;AACxC,oBAA4B;AAC5B,IAAAA,cAA0B;AAC1B,IAAAC,WAAyB;;;ACHzB,iBAA+B;AAE/B,cAAyB;AACzB,IAAM,EAAE,SAAS,IAAI;AASd,SAAS,mBAAmB,QAAQ,iBAAiB,SAAS,aAAa;AAflF;AAmBI,MAAI,WAAW;AACf,MAAI,iBAAiB;AACjB,QAAI;AACA,YAAM,SAAS,KAAK,UAAU,eAAe;AAC7C,mBAAW,sCAAe,kBAAf,4BAA+B,QAAQ,iBAAgB;AAAA,IACtE,SACO,OAAP;AAEI,cAAQ,KAAK,yDAAyD,KAAK;AAAA,IAC/E;AAAA,EACJ;AACA,QAAM,kBAAkB,CAAC;AACzB,MAAI,QAAO,qCAAU,UAAS,UAAU;AACpC,oBAAgB,OAAO,SAAS;AAAA,EACpC;AACA,MAAI,QAAO,qCAAU,qBAAoB,UAAU;AAC/C,oBAAgB,eAAe,CAAC,SAAS,eAAe;AAAA,EAC5D;AACA,QAAM,WAAW;AAAA,IACb,GAAG;AAAA,IACH,QAAQ;AAAA,IACR,eAAe,OAAO;AAAA,IACtB,cAAc,CAAC;AAAA,IACf,cAAc,eAAe,OAAO,QAAQ;AAAA,IAC5C,SAAS,OAAO;AAAA,IAChB,SAAS,OAAO;AAAA,IAChB,aAAa;AAAA,MACT,CAAC,OAAO,QAAQ,OAAO,MAAM;AAAA,MAC7B,CAAC,OAAO,QAAQ,OAAO,MAAM;AAAA,IACjC;AAAA,IACA,QAAQ,CAAC,OAAO,WAAW,OAAO,SAAS;AAAA,IAC3C,YAAY,OAAO;AAAA,IACnB,MAAM,OAAO;AAAA,EACjB;AACA,MAAI,UAAU;AACV,aAAS,WAAW;AAAA,EACxB;AAEA,MAAI,mCAAS,qBAAqB;AAC9B,aAAS,eAAe;AACxB,aAAS,iBAAiB;AAAA,EAC9B;AACA,SAAO;AACX;AAEA,SAAS,eAAe,UAAU;AAC9B,UAAQ,UAAU;AAAA,IACd,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX,KAAK,SAAS;AACV,aAAO;AAAA,IACX;AACI,aAAO;AAAA,EACf;AACJ;;;ACvEO,IAAM,aAAN,MAAiB;AAAA,EACpB;AAAA,EACA;AAAA,EACA,YAAY,MAAM,KAAK;AACnB,SAAK,OAAO;AACZ,SAAK,MAAM;AAAA,EACf;AAAA;AAAA,EAEA,SAAS;AAEL,WAAO,KAAK,KAAK,OAAO;AAAA,EAC5B;AAAA,EACA,MAAM,SAAS,QAAQ,QAAQ,QAAQ;AACnC,UAAM,QAAQ,KAAK,KAAK,MAAM,QAAQ,SAAS,MAAM;AACrD,UAAM,OAAO,MAAM,MAAM,YAAY;AACrC,WAAO;AAAA,MACH;AAAA;AAAA;AAAA;AAAA,IAIJ;AAAA,EACJ;AACJ;;;AFvBA,IAAM,EAAE,QAAQ,IAAIC;AAGpB,IAAM,UAAU;AAIT,IAAM,gBAAgB;AAAA,EACzB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,YAAY,CAAC,SAAS;AAAA,EACtB,WAAW,CAAC,0BAA0B;AAAA,EACtC,SAAS,EAAE,KAAK,QAAW,SAAS,CAAC,EAAE;AAAA,EACvC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,QAAQ,IAAI,SAAS,UAAU;AAAA,EACzC,kBAAkB,CAAC,KAAK,UAAU,IAAI,kBAAkB,KAAK,KAAK;AACtE;AAKO,IAAM,oBAAN,cAAgC,+BAAW;AAAA,EAC9C;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,YAAY,MAAM,OAAO;AACrB,UAAM,KAAK;AACX,SAAK,QAAQ;AACb,UAAM,MAAM,OAAO,SAAS,eAAW,iCAAY,IAAI,IAAI,IAAI,WAAW,MAAM,SAAS;AACzF,SAAK,OAAO;AACZ,SAAK,UAAU,IAAI,QAAQ,GAAG;AAC9B,SAAK,cAAc,KAAK,YAAY,KAAK,IAAI;AAC7C,SAAK,WAAW,KAAK,YAAY;AAAA,EACrC;AAAA,EACA,MAAM,YAAY;AACd,WAAO,EAAE,QAAQ,CAAC,GAAG,UAAU,CAAC,EAAE;AAAA,EACtC;AAAA,EACA,MAAM,cAAc;AAChB,UAAM,gBAAgB,MAAM,KAAK,QAAQ,UAAU;AACnD,UAAM,kBAAmB,MAAM,KAAK,QAAQ,YAAY,KAAM,CAAC;AAC/D,UAAM,WAAW,mBAAmB,eAAe,iBAAiB,EAAE,qBAAqB,MAAM,GAAG,KAAK,WAAW;AAEpH,QAAI,KAAK,MAAM,cAAc;AACzB,eAAS,eAAe,CAAC,GAAG,KAAK,MAAM,cAAc,GAAI,SAAS,gBAAgB,CAAC,CAAE;AAAA,IACzF;AACA,QAAI,qCAAU,cAAc;AACxB,WAAK,WAAW,qCAAU;AAAA,IAC9B;AAEA,WAAO;AAAA,EACX;AAAA,EACA,MAAM,QAAQ,YAAY;AACtB,UAAM,EAAE,GAAG,GAAG,EAAE,IAAI;AACpB,UAAM,gBAAgB,MAAM,KAAK,QAAQ,OAAO,GAAG,GAAG,CAAC;AACvD,UAAM,cAAc,+CAAe;AACnC,QAAI,CAAC,aAAa;AAEd,aAAO;AAAA,IACX;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA,EAGA,MAAM,YAAY,YAAY;AAC1B,UAAM,EAAE,GAAG,GAAG,EAAE,IAAI,WAAW;AAC/B,UAAM,WAAW,MAAM,KAAK;AAC5B,YAAQ,SAAS,cAAc;AAAA,MAC3B,KAAK;AACD,eAAO,MAAM,KAAK,cAAc,EAAE,GAAG,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC;AAAA,MAC3D;AACI,eAAO,MAAM,KAAK,aAAa,EAAE,GAAG,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC;AAAA,IAC9D;AAAA,EACJ;AAAA;AAAA,EAEA,MAAM,aAAa,YAAY;AAC3B,UAAM,cAAc,MAAM,KAAK,QAAQ,UAAU;AACjD,WAAO,cAAc,MAAM,0BAAY,MAAM,aAAa,KAAK,WAAW,IAAI;AAAA,EAClF;AAAA;AAAA,EAEA,MAAM,cAAc,YAAY;AA5FpC;AA6FQ,UAAM,cAAc,MAAM,KAAK,QAAQ,UAAU;AACjD,UAAM,cAAc;AAAA,MAChB,OAAO;AAAA,MACP,KAAK;AAAA,QACD,aAAa;AAAA,QACb,WAAW,EAAE,GAAG,WAAW,GAAG,GAAG,WAAW,GAAG,GAAG,WAAW,EAAE;AAAA,QAC/D,IAAG,UAAK,gBAAL,mBAAkB;AAAA,MACzB;AAAA,MACA,GAAG,KAAK;AAAA,IACZ;AACA,WAAO,cAAc,MAAM,sBAAU,MAAM,aAAa,WAAW,IAAI;AAAA,EAC3E;AACJ;;;AGtGA,IAAAC,uBAAyB;;;ACGlB,IAAMC,WAAU,
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { PMTilesSource } from \"./pmtiles-source.js\";\nexport { PMTilesTileSource } from \"./pmtiles-source.js\";\nexport { PMTilesLoader as _PMTilesLoader } from \"./pmtiles-loader.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { DataSource, resolvePath } from '@loaders.gl/loader-utils';\nimport { ImageLoader } from '@loaders.gl/images';\nimport { MVTLoader } from '@loaders.gl/mvt';\nimport * as pmtiles from 'pmtiles';\nconst { PMTiles } = pmtiles;\nimport { parsePMTilesHeader } from \"./lib/parse-pmtiles.js\";\nimport { BlobSource } from \"./lib/blob-source.js\";\nconst VERSION = '1.0.0';\n/**\n * Creates vector tile data sources for PMTiles urls or blobs\n */\nexport const PMTilesSource = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n options: { url: undefined, pmtiles: {} },\n type: 'pmtiles',\n fromUrl: true,\n fromBlob: true,\n testURL: (url) => url.endsWith('.pmtiles'),\n createDataSource: (url, props) => new PMTilesTileSource(url, props)\n};\n/**\n * A PMTiles data source\n * @note Can be either a raster or vector tile source depending on the contents of the PMTiles file.\n */\nexport class PMTilesTileSource extends DataSource {\n data;\n props;\n mimeType = null;\n pmtiles;\n metadata;\n constructor(data, props) {\n super(props);\n this.props = props;\n const url = typeof data === 'string' ? resolvePath(data) : new BlobSource(data, 'pmtiles');\n this.data = data;\n this.pmtiles = new PMTiles(url);\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\n }\n async getSchema() {\n return { fields: [], metadata: {} };\n }\n async getMetadata() {\n const pmtilesHeader = await this.pmtiles.getHeader();\n const pmtilesMetadata = (await this.pmtiles.getMetadata()) || {};\n const metadata = parsePMTilesHeader(pmtilesHeader, pmtilesMetadata, { includeFormatHeader: false }, this.loadOptions);\n // Add additional attribution if necessary\n if (this.props.attributions) {\n metadata.attributions = [...this.props.attributions, ...(metadata.attributions || [])];\n }\n if (metadata?.tileMIMEType) {\n this.mimeType = metadata?.tileMIMEType;\n }\n // TODO - do we need to allow tileSize to be overridden? Some PMTiles examples seem to suggest it.\n return metadata;\n }\n async getTile(tileParams) {\n const { x, y, z } = tileParams;\n const rangeResponse = await this.pmtiles.getZxy(z, x, y);\n const arrayBuffer = rangeResponse?.data;\n if (!arrayBuffer) {\n // console.error('No arrayBuffer', tileParams);\n return null;\n }\n return arrayBuffer;\n }\n // Tile Source interface implementation: deck.gl compatible API\n // TODO - currently only handles image tiles, not vector tiles\n async getTileData(tileParams) {\n const { x, y, z } = tileParams.index;\n const metadata = await this.metadata;\n switch (metadata.tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return await this.getVectorTile({ x, y, z, layers: [] });\n default:\n return await this.getImageTile({ x, y, z, layers: [] });\n }\n }\n // ImageTileSource interface implementation\n async getImageTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n return arrayBuffer ? await ImageLoader.parse(arrayBuffer, this.loadOptions) : null;\n }\n // VectorTileSource interface implementation\n async getVectorTile(tileParams) {\n const arrayBuffer = await this.getTile(tileParams);\n const loadOptions = {\n shape: 'geojson-table',\n mvt: {\n coordinates: 'wgs84',\n tileIndex: { x: tileParams.x, y: tileParams.y, z: tileParams.z },\n ...this.loadOptions?.mvt\n },\n ...this.loadOptions\n };\n return arrayBuffer ? await MVTLoader.parse(arrayBuffer, loadOptions) : null;\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { TileJSONLoader } from '@loaders.gl/mvt';\n// import {Source, PMTiles, Header, TileType} from 'pmtiles';\nimport * as pmtiles from 'pmtiles';\nconst { TileType } = pmtiles;\n/**\n * Parse PMTiles metdata from a PMTiles file\n * @param header\n * @param tilejsonMetadata\n * @param options\n * @param loadOptions\n * @returns\n */\nexport function parsePMTilesHeader(header, pmtilesMetadata, options, loadOptions) {\n // Ironically, to use the TileJSON loader we need to stringify the metadata again.\n // This is the price of integrating with the existing pmtiles library.\n // TODO - provide a non-standard TileJSONLoader parsers that accepts a JSON object?\n let tilejson = null;\n if (pmtilesMetadata) {\n try {\n const string = JSON.stringify(pmtilesMetadata);\n tilejson = TileJSONLoader.parseTextSync?.(string, loadOptions) || null;\n }\n catch (error) {\n // eslint-disable-next-line no-console\n console.warn('PMTiles metadata could not be interpreted as TileJSON', error);\n }\n }\n const partialMetadata = {};\n if (typeof tilejson?.name === 'string') {\n partialMetadata.name = tilejson.name;\n }\n if (typeof tilejson?.htmlAttribution === 'string') {\n partialMetadata.attributions = [tilejson.htmlAttribution];\n }\n const metadata = {\n ...partialMetadata,\n format: 'pmtiles',\n formatVersion: header.specVersion,\n attributions: [],\n tileMIMEType: decodeTileType(header.tileType),\n minZoom: header.minZoom,\n maxZoom: header.maxZoom,\n boundingBox: [\n [header.minLon, header.minLat],\n [header.maxLon, header.maxLat]\n ],\n center: [header.centerLon, header.centerLat],\n centerZoom: header.centerZoom,\n etag: header.etag\n };\n if (tilejson) {\n metadata.tilejson = tilejson;\n }\n // Application can optionally include the raw header and metadata.\n if (options?.includeFormatHeader) {\n metadata.formatHeader = header;\n metadata.formatMetadata = metadata;\n }\n return metadata;\n}\n/** Extract a MIME type for tiles from vector tile header */\nfunction decodeTileType(tileType) {\n switch (tileType) {\n case TileType.Mvt:\n return 'application/vnd.mapbox-vector-tile';\n case TileType.Png:\n return 'image/png';\n case TileType.Jpeg:\n return 'image/jpeg';\n case TileType.Webp:\n return 'image/webp';\n case TileType.Avif:\n return 'image/avif';\n default:\n return 'application/octet-stream';\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * A PMTiles library compatible source that reads from blobs\n * @deprecated TODO - reimplement as ReadableFileSource\n * Use loaders.gl HTTP range requests instead\n */\nexport class BlobSource {\n blob;\n key;\n constructor(blob, key) {\n this.blob = blob;\n this.key = key;\n }\n // TODO - how is this used?\n getKey() {\n // @ts-expect-error url is only defined on File subclass\n return this.blob.url || '';\n }\n async getBytes(offset, length, signal) {\n const slice = this.blob.slice(offset, offset + length);\n const data = await slice.arrayBuffer();\n return {\n data\n // etag: response.headers.get('ETag') || undefined,\n // cacheControl: response.headers.get('Cache-Control') || undefined,\n // expires: response.headers.get('Expires') || undefined\n };\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { BlobFile } from '@loaders.gl/loader-utils';\nimport { VERSION } from \"./lib/version.js\";\nimport { PMTilesTileSource } from \"./pmtiles-source.js\";\n/**\n * Loader for PMTiles metadata\n * @note This loader is intended to allow PMTiles to be treated like other file types in top-level loading logic.\n * @note For actual access to the tile data, use the PMTilesSource class.\n */\nexport const PMTilesLoader = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n tests: ['PMTiles'],\n options: {\n pmtiles: {}\n },\n parse: async (arrayBuffer, options) => parseFileAsPMTiles(new BlobFile(new Blob([arrayBuffer])), options),\n parseFile: parseFileAsPMTiles\n};\nasync function parseFileAsPMTiles(file, options) {\n const source = new PMTilesTileSource(file.handle, {\n pmtiles: options?.pmtiles || {}\n });\n const formatSpecificMetadata = await source.getMetadata();\n const { tileMIMEType, tilejson = {} } = formatSpecificMetadata;\n const { layers = [] } = tilejson;\n switch (tileMIMEType) {\n case 'application/vnd.mapbox-vector-tile':\n return {\n shape: 'vector-source',\n layers: layers.map((layer) => ({ name: layer.name, schema: layer.schema })),\n tables: [],\n formatSpecificMetadata\n };\n case 'image/png':\n case 'image/jpeg':\n return { shape: 'image-source', formatSpecificMetadata };\n default:\n throw new Error(`PMTilesLoader: Unsupported tile MIME type ${tileMIMEType}`);\n }\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Version constant cannot be imported, it needs to correspond to the build version of **this** module.\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nexport const VERSION = typeof \"4.3.0\" !== 'undefined' ? \"4.3.0\" : 'latest';\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["import_mvt", "pmtiles", "pmtiles", "import_loader_utils", "VERSION", "VERSION"]
|
|
7
7
|
}
|
package/dist/lib/version.js
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// Version constant cannot be imported, it needs to correspond to the build version of **this** module.
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
export const VERSION = typeof "4.3.0
|
|
7
|
+
export const VERSION = typeof "4.3.0" !== 'undefined' ? "4.3.0" : 'latest';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/pmtiles",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "Framework-independent loader for the pmtiles format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@loaders.gl/images": "4.3.
|
|
50
|
-
"@loaders.gl/loader-utils": "4.3.
|
|
51
|
-
"@loaders.gl/mvt": "4.3.
|
|
52
|
-
"@loaders.gl/schema": "4.3.
|
|
49
|
+
"@loaders.gl/images": "4.3.1",
|
|
50
|
+
"@loaders.gl/loader-utils": "4.3.1",
|
|
51
|
+
"@loaders.gl/mvt": "4.3.1",
|
|
52
|
+
"@loaders.gl/schema": "4.3.1",
|
|
53
53
|
"pmtiles": "^3.0.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@loaders.gl/core": "^4.
|
|
56
|
+
"@loaders.gl/core": "^4.3.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "70a883ab6bc84647c49963215dd6ff62d4d61de3"
|
|
59
59
|
}
|