@loaders.gl/pmtiles 4.3.0-alpha.1 → 4.3.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +101 -53
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +2 -2
- package/dist/pmtiles-source.d.ts +4 -2
- package/dist/pmtiles-source.d.ts.map +1 -1
- package/dist/pmtiles-source.js +3 -0
- package/package.json +6 -6
- package/src/pmtiles-source.ts +7 -2
package/dist/dist.dev.js
CHANGED
|
@@ -1399,7 +1399,16 @@ var __exports__ = (() => {
|
|
|
1399
1399
|
// ../loader-utils/src/lib/log-utils/log.ts
|
|
1400
1400
|
var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
1401
1401
|
var version = VERSION2[0] >= "0" && VERSION2[0] <= "9" ? `v${VERSION2}` : "";
|
|
1402
|
-
|
|
1402
|
+
function createLog() {
|
|
1403
|
+
const log2 = new Log({ id: "loaders.gl" });
|
|
1404
|
+
globalThis.loaders = globalThis.loaders || {};
|
|
1405
|
+
globalThis.loaders.log = log2;
|
|
1406
|
+
globalThis.loaders.version = version;
|
|
1407
|
+
globalThis.probe = globalThis.probe || {};
|
|
1408
|
+
globalThis.probe.loaders = log2;
|
|
1409
|
+
return log2;
|
|
1410
|
+
}
|
|
1411
|
+
var log = createLog();
|
|
1403
1412
|
|
|
1404
1413
|
// ../loader-utils/src/lib/path-utils/file-aliases.ts
|
|
1405
1414
|
var pathPrefix = "";
|
|
@@ -2684,6 +2693,39 @@ var __exports__ = (() => {
|
|
|
2684
2693
|
}
|
|
2685
2694
|
return sum;
|
|
2686
2695
|
}
|
|
2696
|
+
function convertToLocalCoordinates(coordinates, extent) {
|
|
2697
|
+
if (Array.isArray(coordinates[0])) {
|
|
2698
|
+
for (const subcoords of coordinates) {
|
|
2699
|
+
convertToLocalCoordinates(subcoords, extent);
|
|
2700
|
+
}
|
|
2701
|
+
return;
|
|
2702
|
+
}
|
|
2703
|
+
const p = coordinates;
|
|
2704
|
+
p[0] /= extent;
|
|
2705
|
+
p[1] /= extent;
|
|
2706
|
+
}
|
|
2707
|
+
function convertToLocalCoordinatesFlat(data, extent) {
|
|
2708
|
+
for (let i2 = 0, il = data.length; i2 < il; ++i2) {
|
|
2709
|
+
data[i2] /= extent;
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
function projectToLngLat(line, tileIndex, extent) {
|
|
2713
|
+
if (typeof line[0][0] !== "number") {
|
|
2714
|
+
for (const point of line) {
|
|
2715
|
+
projectToLngLat(point, tileIndex, extent);
|
|
2716
|
+
}
|
|
2717
|
+
return;
|
|
2718
|
+
}
|
|
2719
|
+
const size = extent * Math.pow(2, tileIndex.z);
|
|
2720
|
+
const x0 = extent * tileIndex.x;
|
|
2721
|
+
const y0 = extent * tileIndex.y;
|
|
2722
|
+
for (let j = 0; j < line.length; j++) {
|
|
2723
|
+
const p = line[j];
|
|
2724
|
+
p[0] = (p[0] + x0) * 360 / size - 180;
|
|
2725
|
+
const y2 = 180 - (p[1] + y0) * 360 / size;
|
|
2726
|
+
p[1] = 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
|
|
2727
|
+
}
|
|
2728
|
+
}
|
|
2687
2729
|
function projectToLngLatFlat(data, tileIndex, extent) {
|
|
2688
2730
|
const { x: x2, y, z } = tileIndex;
|
|
2689
2731
|
const size = extent * Math.pow(2, z);
|
|
@@ -2793,39 +2835,37 @@ var __exports__ = (() => {
|
|
|
2793
2835
|
this._geometryInfo = geometryInfo;
|
|
2794
2836
|
pbf.readFields(readFeature, this, end);
|
|
2795
2837
|
}
|
|
2796
|
-
|
|
2838
|
+
toGeoJSONFeature(coordinates, tileIndex) {
|
|
2797
2839
|
const coords = this.loadGeometry();
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
const p = line[j];
|
|
2808
|
-
p[0] = (p[0] + x0) * 360 / size - 180;
|
|
2809
|
-
const y2 = 180 - (p[1] + y0) * 360 / size;
|
|
2810
|
-
p[1] = 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90;
|
|
2811
|
-
}
|
|
2840
|
+
switch (coordinates) {
|
|
2841
|
+
case "wgs84":
|
|
2842
|
+
return _toGeoJSONFeature(
|
|
2843
|
+
this,
|
|
2844
|
+
coords,
|
|
2845
|
+
(line) => projectToLngLat(line, tileIndex, this.extent)
|
|
2846
|
+
);
|
|
2847
|
+
default:
|
|
2848
|
+
return _toGeoJSONFeature(this, coords, convertToLocalCoordinates);
|
|
2812
2849
|
}
|
|
2813
|
-
return _toGeoJSON(this, coords, project);
|
|
2814
2850
|
}
|
|
2815
2851
|
/**
|
|
2816
2852
|
*
|
|
2817
2853
|
* @param options
|
|
2818
2854
|
* @returns
|
|
2819
2855
|
*/
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2856
|
+
toBinaryFeature(coordinates, tileIndex) {
|
|
2857
|
+
const geom = this.loadFlatGeometry();
|
|
2858
|
+
switch (coordinates) {
|
|
2859
|
+
case "wgs84":
|
|
2860
|
+
return this._toBinaryCoordinates(
|
|
2861
|
+
geom,
|
|
2862
|
+
(coords) => projectToLngLatFlat(coords, tileIndex, this.extent)
|
|
2863
|
+
);
|
|
2864
|
+
default:
|
|
2865
|
+
return this._toBinaryCoordinates(geom, convertToLocalCoordinatesFlat);
|
|
2823
2866
|
}
|
|
2824
|
-
const tileIndex = options;
|
|
2825
|
-
return this._toBinaryCoordinates(
|
|
2826
|
-
(data) => projectToLngLatFlat(data, tileIndex, this.extent)
|
|
2827
|
-
);
|
|
2828
2867
|
}
|
|
2868
|
+
/** Read a bounding box from the feature */
|
|
2829
2869
|
// eslint-disable-next-line max-statements
|
|
2830
2870
|
bbox() {
|
|
2831
2871
|
const pbf = this._pbf;
|
|
@@ -2869,10 +2909,9 @@ var __exports__ = (() => {
|
|
|
2869
2909
|
* @param transform
|
|
2870
2910
|
* @returns result
|
|
2871
2911
|
*/
|
|
2872
|
-
_toBinaryCoordinates(transform) {
|
|
2873
|
-
const geom = this.loadFlatGeometry();
|
|
2912
|
+
_toBinaryCoordinates(geom, transform) {
|
|
2874
2913
|
let geometry;
|
|
2875
|
-
transform(geom.data, this);
|
|
2914
|
+
transform(geom.data, this.extent);
|
|
2876
2915
|
const coordLength = 2;
|
|
2877
2916
|
switch (this.type) {
|
|
2878
2917
|
case 1:
|
|
@@ -2949,6 +2988,28 @@ var __exports__ = (() => {
|
|
|
2949
2988
|
lines.push(line);
|
|
2950
2989
|
return lines;
|
|
2951
2990
|
}
|
|
2991
|
+
/**
|
|
2992
|
+
* Expands the protobuf data to an intermediate Flat GeoJSON
|
|
2993
|
+
* data format, which maps closely to the binary data buffers.
|
|
2994
|
+
* It is similar to GeoJSON, but rather than storing the coordinates
|
|
2995
|
+
* in multidimensional arrays, we have a 1D `data` with all the
|
|
2996
|
+
* coordinates, and then index into this using the `indices`
|
|
2997
|
+
* parameter, e.g.
|
|
2998
|
+
*
|
|
2999
|
+
* geometry: {
|
|
3000
|
+
* type: 'Point', data: [1,2], indices: [0]
|
|
3001
|
+
* }
|
|
3002
|
+
* geometry: {
|
|
3003
|
+
* type: 'LineString', data: [1,2,3,4,...], indices: [0]
|
|
3004
|
+
* }
|
|
3005
|
+
* geometry: {
|
|
3006
|
+
* type: 'Polygon', data: [1,2,3,4,...], indices: [[0, 2]]
|
|
3007
|
+
* }
|
|
3008
|
+
* Thus the indices member lets us look up the relevant range
|
|
3009
|
+
* from the data array.
|
|
3010
|
+
* The Multi* versions of the above types share the same data
|
|
3011
|
+
* structure, just with multiple elements in the indices array
|
|
3012
|
+
*/
|
|
2952
3013
|
// eslint-disable-next-line complexity, max-statements
|
|
2953
3014
|
loadFlatGeometry() {
|
|
2954
3015
|
const pbf = this._pbf;
|
|
@@ -2991,7 +3052,7 @@ var __exports__ = (() => {
|
|
|
2991
3052
|
}
|
|
2992
3053
|
};
|
|
2993
3054
|
__publicField(VectorTileFeature, "types", ["Unknown", "Point", "LineString", "Polygon"]);
|
|
2994
|
-
function
|
|
3055
|
+
function _toGeoJSONFeature(vtFeature, coords, transform) {
|
|
2995
3056
|
let type = VectorTileFeature.types[vtFeature.type];
|
|
2996
3057
|
let i2;
|
|
2997
3058
|
let j;
|
|
@@ -3003,19 +3064,19 @@ var __exports__ = (() => {
|
|
|
3003
3064
|
points[i2] = coords[i2][0];
|
|
3004
3065
|
}
|
|
3005
3066
|
coordinates = points;
|
|
3006
|
-
transform(coordinates, vtFeature);
|
|
3067
|
+
transform(coordinates, vtFeature.extent);
|
|
3007
3068
|
break;
|
|
3008
3069
|
case 2:
|
|
3009
3070
|
coordinates = coords;
|
|
3010
3071
|
for (i2 = 0; i2 < coordinates.length; i2++) {
|
|
3011
|
-
transform(coordinates[i2], vtFeature);
|
|
3072
|
+
transform(coordinates[i2], vtFeature.extent);
|
|
3012
3073
|
}
|
|
3013
3074
|
break;
|
|
3014
3075
|
case 3:
|
|
3015
3076
|
coordinates = classifyRings(coords);
|
|
3016
3077
|
for (i2 = 0; i2 < coordinates.length; i2++) {
|
|
3017
3078
|
for (j = 0; j < coordinates[i2].length; j++) {
|
|
3018
|
-
transform(coordinates[i2][j], vtFeature);
|
|
3079
|
+
transform(coordinates[i2][j], vtFeature.extent);
|
|
3019
3080
|
}
|
|
3020
3081
|
}
|
|
3021
3082
|
break;
|
|
@@ -3036,7 +3097,8 @@ var __exports__ = (() => {
|
|
|
3036
3097
|
properties: vtFeature.properties
|
|
3037
3098
|
};
|
|
3038
3099
|
if (vtFeature.id !== null) {
|
|
3039
|
-
result.
|
|
3100
|
+
result.properties ||= {};
|
|
3101
|
+
result.properties.id = vtFeature.id;
|
|
3040
3102
|
}
|
|
3041
3103
|
return result;
|
|
3042
3104
|
}
|
|
@@ -3259,9 +3321,9 @@ var __exports__ = (() => {
|
|
|
3259
3321
|
return options.mvt;
|
|
3260
3322
|
}
|
|
3261
3323
|
function getDecodedFeature(feature, options, layerName) {
|
|
3262
|
-
const decodedFeature = feature.
|
|
3263
|
-
|
|
3264
|
-
options.
|
|
3324
|
+
const decodedFeature = feature.toGeoJSONFeature(
|
|
3325
|
+
options.coordinates || "local",
|
|
3326
|
+
options.tileIndex
|
|
3265
3327
|
);
|
|
3266
3328
|
if (options.layerProperty) {
|
|
3267
3329
|
decodedFeature.properties ||= {};
|
|
@@ -3270,29 +3332,12 @@ var __exports__ = (() => {
|
|
|
3270
3332
|
return decodedFeature;
|
|
3271
3333
|
}
|
|
3272
3334
|
function getDecodedFeatureBinary(feature, options, layerName) {
|
|
3273
|
-
const decodedFeature = feature.
|
|
3274
|
-
// @ts-expect-error
|
|
3275
|
-
options.coordinates === "wgs84" ? options.tileIndex : transformToLocalCoordinatesBinary
|
|
3276
|
-
);
|
|
3335
|
+
const decodedFeature = feature.toBinaryFeature(options.coordinates || "local", options.tileIndex);
|
|
3277
3336
|
if (options.layerProperty && decodedFeature.properties) {
|
|
3278
3337
|
decodedFeature.properties[options.layerProperty] = layerName;
|
|
3279
3338
|
}
|
|
3280
3339
|
return decodedFeature;
|
|
3281
3340
|
}
|
|
3282
|
-
function transformToLocalCoordinates(line, feature) {
|
|
3283
|
-
const { extent } = feature;
|
|
3284
|
-
for (let i2 = 0; i2 < line.length; i2++) {
|
|
3285
|
-
const p = line[i2];
|
|
3286
|
-
p[0] /= extent;
|
|
3287
|
-
p[1] /= extent;
|
|
3288
|
-
}
|
|
3289
|
-
}
|
|
3290
|
-
function transformToLocalCoordinatesBinary(data, feature) {
|
|
3291
|
-
const { extent } = feature;
|
|
3292
|
-
for (let i2 = 0, il = data.length; i2 < il; ++i2) {
|
|
3293
|
-
data[i2] /= extent;
|
|
3294
|
-
}
|
|
3295
|
-
}
|
|
3296
3341
|
|
|
3297
3342
|
// ../mvt/src/mvt-loader.ts
|
|
3298
3343
|
var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
@@ -5295,6 +5340,9 @@ var __exports__ = (() => {
|
|
|
5295
5340
|
this.getTileData = this.getTileData.bind(this);
|
|
5296
5341
|
this.metadata = this.getMetadata();
|
|
5297
5342
|
}
|
|
5343
|
+
async getSchema() {
|
|
5344
|
+
return { fields: [], metadata: {} };
|
|
5345
|
+
}
|
|
5298
5346
|
async getMetadata() {
|
|
5299
5347
|
const pmtilesHeader = await this.pmtiles.getHeader();
|
|
5300
5348
|
const pmtilesMetadata = await this.pmtiles.getMetadata();
|
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 mr=Object.create;var fe=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var xr=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,vr=Object.prototype.hasOwnProperty;var Tr=(e,t,n)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ot=(e,t)=>{for(var n in t)fe(e,n,{get:t[n],enumerable:!0})},Be=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xr(t))!vr.call(e,o)&&o!==n&&fe(e,o,{get:()=>t[o],enumerable:!(r=yr(t,o))||r.enumerable});return e},Ae=(e,t,n)=>(Be(e,t,"default"),n&&Be(n,t,"default")),Gt=(e,t,n)=>(n=e!=null?mr(wr(e)):{},Be(t||!e||!e.__esModule?fe(n,"default",{value:e,enumerable:!0}):n,e)),Ir=e=>Be(fe({},"__esModule",{value:!0}),e);var zt=(e,t,n)=>(Tr(e,typeof t!="symbol"?t+"":t,n),n);var Rt=Qe((us,jt)=>{jt.exports=globalThis.loaders});var xn=Qe(yt=>{yt.read=function(e,t,n,r,o){var i,s,a=o*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,u=n?o-1:0,h=n?-1:1,d=e[t+u];for(u+=h,i=d&(1<<-f)-1,d>>=-f,f+=a;f>0;i=i*256+e[t+u],u+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=r;f>0;s=s*256+e[t+u],u+=h,f-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-c}return(d?-1:1)*s*Math.pow(2,i-r)};yt.write=function(e,t,n,r,o,i){var s,a,l,c=i*8-o-1,f=(1<<c)-1,u=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=h/l:t+=h*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(t*l-1)*Math.pow(2,o),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,o),s=0));o>=8;e[n+d]=a&255,d+=p,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+d]=s&255,d+=p,s/=256,c-=8);e[n+d-p]|=y*128}});var Fn=Qe((Vl,Pn)=>{"use strict";Pn.exports=x;var ze=xn();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 xt=(1<<16)*(1<<16),wn=1/xt,zo=12,In=typeof TextDecoder>"u"?null:new TextDecoder("utf8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),o=r>>3,i=this.pos;this.type=r&7,e(o,t,this),this.pos===i&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=je(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Tn(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=je(this.buf,this.pos)+je(this.buf,this.pos+4)*xt;return this.pos+=8,e},readSFixed64:function(){var e=je(this.buf,this.pos)+Tn(this.buf,this.pos+4)*xt;return this.pos+=8,e},readFloat:function(){var e=ze.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=ze.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,jo(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=zo&&In?ni(this.buf,t,e):ti(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==x.Bytes)return e.push(this.readVarint(t));var n=j(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=j(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=j(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=j(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=j(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=j(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=j(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=j(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=j(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===x.Varint)for(;this.buf[this.pos++]>127;);else if(t===x.Bytes)this.pos=this.readVarint()+this.pos;else if(t===x.Fixed32)this.pos+=4;else if(t===x.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),ie(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),ie(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),ie(this.buf,e&-1,this.pos),ie(this.buf,Math.floor(e*wn),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),ie(this.buf,e&-1,this.pos),ie(this.buf,Math.floor(e*wn),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Ro(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=ri(this.buf,e,this.pos);var n=this.pos-t;n>=128&&vn(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),ze.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),ze.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&vn(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,x.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,Wo,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Jo,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Yo,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Ko,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,$o,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Xo,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Qo,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,qo,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,ei,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 jo(e,t,n){var r=n.buf,o,i;if(i=r[n.pos++],o=(i&112)>>4,i<128||(i=r[n.pos++],o|=(i&127)<<3,i<128)||(i=r[n.pos++],o|=(i&127)<<10,i<128)||(i=r[n.pos++],o|=(i&127)<<17,i<128)||(i=r[n.pos++],o|=(i&127)<<24,i<128)||(i=r[n.pos++],o|=(i&1)<<31,i<128))return oe(e,o,t);throw new Error("Expected varint not more than 10 bytes")}function j(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function oe(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Ro(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),Ho(n,r,t),Zo(r,t)}function Ho(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function Zo(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function vn(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var o=n.pos-1;o>=e;o--)n.buf[o+r]=n.buf[o]}function Wo(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function Jo(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function Ko(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function $o(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function Yo(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function Xo(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function Qo(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function qo(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function ei(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function je(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function ie(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Tn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function ti(e,t,n){for(var r="",o=t;o<n;){var i=e[o],s=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a>n)break;var l,c,f;a===1?i<128&&(s=i):a===2?(l=e[o+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[o+1],c=e[o+2],(l&192)===128&&(c&192)===128&&(s=(i&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[o+1],c=e[o+2],f=e[o+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(i&15)<<18|(l&63)<<12|(c&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,r+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),r+=String.fromCharCode(s),o+=a}return r}function ni(e,t,n){return In.decode(e.subarray(t,n))}function ri(e,t,n){for(var r=0,o,i;r<t.length;r++){if(o=t.charCodeAt(r),o>55295&&o<57344)if(i)if(o<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=o;continue}else o=i-55296<<10|o-56320|65536,i=null;else{o>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=o;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);o<128?e[n++]=o:(o<2048?e[n++]=o>>6|192:(o<65536?e[n++]=o>>12|224:(e[n++]=o>>18|240,e[n++]=o>>12&63|128),e[n++]=o>>6&63|128),e[n++]=o&63|128)}return n}});var Se={};Ot(Se,{PMTilesSource:()=>Je});Ae(Se,Gt(Rt(),1));function ue(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var G={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Pr=G.self||G.window||G.global||{},Fr=G.window||G.self||G.global||{},br=G.global||G.self||G.window||{},Er=G.document||{};var qe=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Ht=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Sr=Ht&&parseFloat(Ht[1])||0;function H(e){return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(e)}function et(e,t){if(H(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(H(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tt(e){var t=et(e,"string");return H(t)==="symbol"?t:String(t)}function T(e,t,n){return t=tt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nt(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,n=e||t;return!!(n&&n.indexOf("Electron")>=0)}function N(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||nt()}var _r=globalThis.self||globalThis.window||globalThis.global,ee=globalThis.window||globalThis.self||globalThis.global,Br=globalThis.document||{},W=globalThis.process||{},Ar=globalThis.console,bs=globalThis.navigator||{};var De=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",_s=N();function Dr(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Ve=class{constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";T(this,"storage",void 0),T(this,"id",void 0),T(this,"config",void 0),this.storage=Dr(r),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function Zt(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function Wt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,n=Math.max(t-e.length,0);return"".concat(" ".repeat(n)).concat(e)}function Le(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(n=Math.min(n,r/e.width));let i=e.width*n,s=e.height*n,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(o,");"),"background-size:".concat(i,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}var Me;(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"})(Me||(Me={}));var Vr=10;function Jt(e){return typeof e!="string"?e:(e=e.toUpperCase(),Me[e]||Me.WHITE)}function Kt(e,t,n){if(!N&&typeof e=="string"){if(t){let r=Jt(t);e="\x1B[".concat(r,"m").concat(e,"\x1B[39m")}if(n){let r=Jt(n);e="\x1B[".concat(r+Vr,"m").concat(e,"\x1B[49m")}}return e}function $t(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),o=e;for(let i of r){let s=o[i];typeof s=="function"&&(t.find(a=>i===a)||(o[i]=s.bind(e)))}}function te(e,t){if(!e)throw new Error(t||"Assertion failed")}function J(){let e;if(N()&&ee.performance){var t,n;e=ee===null||ee===void 0||(t=ee.performance)===null||t===void 0||(n=t.now)===null||n===void 0?void 0:n.call(t)}else if("hrtime"in W){var r;let o=W===null||W===void 0||(r=W.hrtime)===null||r===void 0?void 0:r.call(W);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var ne={debug:N()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Lr={enabled:!0,level:0};function D(){}var Yt={},Xt={once:!0},Z=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};T(this,"id",void 0),T(this,"VERSION",De),T(this,"_startTs",J()),T(this,"_deltaTs",J()),T(this,"_storage",void 0),T(this,"userData",{}),T(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new Ve("__probe-".concat(this.id,"__"),Lr),this.timeStamp("".concat(this.id," started")),$t(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((J()-this._startTs).toPrecision(10))}getDelta(){return Number((J()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){te(t,n)}warn(t){return this._getLogFunction(0,t,ne.warn,arguments,Xt)}error(t){return this._getLogFunction(0,t,ne.error,arguments)}deprecated(t,n){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(n,"` instead"))}removed(t,n){return this.error("`".concat(t,"` has been removed. Use `").concat(n,"` instead"))}probe(t,n){return this._getLogFunction(t,n,ne.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,ne.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,ne.debug||ne.info,arguments,Xt)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||D,r&&[r],{tag:Nr(n)}):D}image(t){let{logLevel:n,priority:r,image:o,message:i="",scale:s=1}=t;return this._shouldLog(n||r)?N()?kr({image:o,message:i,scale:s}):Ur({image:o,message:i,scale:s}):D}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||D)}group(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=Qt({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||D)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=qt(t)}_getLogFunction(t,n,r,o,i){if(this._shouldLog(t)){i=Qt({logLevel:t,message:n,args:o,opts:i}),r=r||i.method,te(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=J();let s=i.tag||i.message;if(i.once&&s)if(!Yt[s])Yt[s]=J();else return D;return n=Mr(this.id,i.message,i),r.bind(console,n,...i.args)}return D}};T(Z,"VERSION",De);function qt(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 te(Number.isFinite(t)&&t>=0),t}function Qt(e){let{logLevel:t,message:n}=e;e.logLevel=qt(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return te(o==="string"||o==="object"),Object.assign(e,{args:r},e.opts)}function Mr(e,t,n){if(typeof t=="string"){let r=n.time?Wt(Zt(n.total)):"";t=n.time?"".concat(e,": ").concat(r," ").concat(t):"".concat(e,": ").concat(t),t=Kt(t,n.color,n.background)}return t}function Ur(e){let{image:t,message:n="",scale:r=1}=e;return console.warn("removed"),D}function kr(e){let{image:t,message:n="",scale:r=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let s=Le(i,n,r);console.log(...s)},i.src=t,D}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...Le(t,n,r)),D;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Le(i,n,r)),i.src=t.toDataURL(),D}return D}function Nr(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}var ta=new Z({id:"@probe.gl/log"});var rt="4.2.0",Cr=rt[0]>="0"&&rt[0]<="9"?`v${rt}`:"",ot=new Z({id:`loaders.gl ${Cr}`});var Or="",en={};function it(e){for(let t in en)if(e.startsWith(t)){let n=en[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Or}${e}`),e}var he=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Gr(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function Gr(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,o)=>t(r,o);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var tn="4.2.0";var zr=globalThis.loaders?.parseImageNode,st=typeof Image<"u",at=typeof ImageBitmap<"u",jr=Boolean(zr),lt=qe?!0:jr;function nn(e){switch(e){case"auto":return at||st||lt;case"imagebitmap":return at;case"image":return st;case"data":return lt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function rn(){if(at)return"imagebitmap";if(st)return"image";if(lt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Rr(e){let t=Hr(e);if(!t)throw new Error("Not an image");return t}function on(e){switch(Rr(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Hr(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 Zr=/^data:image\/svg\+xml/,Wr=/\.svg((\?|#).*)?$/;function Ue(e){return e&&(Zr.test(e)||Wr.test(e))}function sn(e,t){if(Ue(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return ct(e,t)}function ct(e,t){if(Ue(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ke(e,t,n){let r=sn(e,n),o=self.URL||self.webkitURL,i=typeof r!="string"&&o.createObjectURL(r);try{return await Jr(i||r,t)}finally{i&&o.revokeObjectURL(i)}}async function Jr(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,o)=>{try{n.onload=()=>r(n),n.onerror=i=>{let s=i instanceof Error?i.message:"error";o(new Error(s))}}catch(i){o(i)}})}var Kr={},an=!0;async function ln(e,t,n){let r;Ue(n)?r=await ke(e,t,n):r=ct(e,n);let o=t&&t.imagebitmap;return await $r(r,o)}async function $r(e,t=null){if((Yr(t)||!an)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),an=!1}return await createImageBitmap(e)}function Yr(e){for(let t in e||Kr)return!1;return!0}function cn(e){return!eo(e,"ftyp",4)||!(e[8]&96)?null:Xr(e)}function Xr(e){switch(Qr(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Qr(e,t,n){return String.fromCharCode(...e.slice(t,n))}function qr(e){return[...e].map(t=>t.charCodeAt(0))}function eo(e,t,n=0){let r=qr(t);for(let o=0;o<r.length;++o)if(r[o]!==e[o+n])return!1;return!0}var z=!1,de=!0;function Ne(e){let t=pe(e);return no(t)||io(t)||ro(t)||oo(t)||to(t)}function to(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=cn(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function no(e){let t=pe(e);return t.byteLength>=24&&t.getUint32(0,z)===2303741511?{mimeType:"image/png",width:t.getUint32(16,z),height:t.getUint32(20,z)}:null}function ro(e){let t=pe(e);return t.byteLength>=10&&t.getUint32(0,z)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,de),height:t.getUint16(8,de)}:null}function oo(e){let t=pe(e);return t.byteLength>=14&&t.getUint16(0,z)===16973&&t.getUint32(2,de)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,de),height:t.getUint32(22,de)}:null}function io(e){let t=pe(e);if(!(t.byteLength>=3&&t.getUint16(0,z)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:o}=so(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,z);if(o.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,z),width:t.getUint16(i+7,z)};if(!r.has(s))return null;i+=2,i+=t.getUint16(i,z)}return null}function so(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function pe(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 fn(e,t){let{mimeType:n}=Ne(e)||{},r=globalThis.loaders?.parseImageNode;return ue(r),await r(e,n)}async function un(e,t,n){t=t||{};let o=(t.image||{}).type||"auto",{url:i}=n||{},s=ao(o),a;switch(s){case"imagebitmap":a=await ln(e,t,i);break;case"image":a=await ke(e,t,i);break;case"data":a=await fn(e,t);break;default:ue(!1)}return o==="data"&&(a=on(a)),a}function ao(e){switch(e){case"auto":case"data":return rn();default:return nn(e),e}}var lo=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],co=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],fo={image:{type:"auto",decode:!0}},ft={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:tn,mimeTypes:co,extensions:lo,parse:un,tests:[e=>Boolean(Ne(new DataView(e)))],options:fo};var ge={x:0,y:1,z:2};function K(e,t={}){let{start:n=0,end:r=e.length,plane:o="xy"}=t,i=t.size||2,s=0,a=ge[o[0]],l=ge[o[1]];for(let c=n,f=r-i;c<r;c+=i)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function ht(e,t,n=2,r,o="xy"){let i=t&&t.length,s=i?t[0]*n:e.length,a=dn(e,0,s,n,!0,r&&r[0],o),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,d,p,y;if(i&&(a=xo(e,t,a,n,r,o)),e.length>80*n){h=f=e[0],d=u=e[1];for(let P=n;P<s;P+=n)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 me(a,l,n,h,d,c,0),l}function dn(e,t,n,r,o,i,s){let a,l;i===void 0&&(i=K(e,{start:t,end:n,size:r,plane:s}));let c=ge[s[0]],f=ge[s[1]];if(o===i<0)for(a=t;a<n;a+=r)l=hn(a,e[a+c],e[a+f],l);else for(a=n-r;a>=t;a-=r)l=hn(a,e[a+c],e[a+f],l);return l&&Ge(l,l.next)&&(xe(l),l=l.next),l}function $(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Ge(n,n.next)||I(n.prev,n,n.next)===0)){if(xe(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function me(e,t,n,r,o,i,s){if(!e)return;!s&&i&&Po(e,r,o,i);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,i?go(e,r,o,i):po(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(c.i/n|0),xe(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=mo($(e),t,n),me(e,t,n,r,o,i,2)):s===2&&yo(e,t,n,r,o,i):me($(e),t,n,r,o,i,1);break}}}function po(e){let t=e.prev,n=e,r=e.next;if(I(t,n,r)>=0)return!1;let o=t.x,i=n.x,s=r.x,a=t.y,l=n.y,c=r.y,f=o<i?o<s?o:s:i<s?i:s,u=a<l?a<c?a:c:l<c?l:c,h=o>i?o>s?o:s:i>s?i:s,d=a>l?a>c?a:c:l>c?l:c,p=r.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&re(o,a,i,l,s,c,p.x,p.y)&&I(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function go(e,t,n,r){let o=e.prev,i=e,s=e.next;if(I(o,i,s)>=0)return!1;let a=o.x,l=i.x,c=s.x,f=o.y,u=i.y,h=s.y,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,M=ut(d,p,t,n,r),v=ut(y,P,t,n,r),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=M&&g&&g.z<=v;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==o&&m!==s&&re(a,f,l,u,c,h,m.x,m.y)&&I(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==o&&g!==s&&re(a,f,l,u,c,h,g.x,g.y)&&I(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;m&&m.z>=M;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==o&&m!==s&&re(a,f,l,u,c,h,m.x,m.y)&&I(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!==o&&g!==s&&re(a,f,l,u,c,h,g.x,g.y)&&I(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function mo(e,t,n){let r=e;do{let o=r.prev,i=r.next.next;!Ge(o,i)&&pn(o,r,r.next,i)&&ye(o,i)&&ye(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),xe(r),xe(r.next),r=e=i),r=r.next}while(r!==e);return $(r)}function yo(e,t,n,r,o,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Eo(s,a)){let l=gn(s,a);s=$(s,s.next),l=$(l,l.next),me(s,t,n,r,o,i,0),me(l,t,n,r,o,i,0);return}a=a.next}s=s.next}while(s!==e)}function xo(e,t,n,r,o,i){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*r,f=a<l-1?t[a+1]*r:e.length,u=dn(e,c,f,r,!1,o&&o[a+1],i),u===u.next&&(u.steiner=!0),s.push(bo(u));for(s.sort(wo),a=0;a<s.length;a++)n=vo(s[a],n);return n}function wo(e,t){return e.x-t.x}function vo(e,t){let n=To(e,t);if(!n)return t;let r=gn(n,e);return $(r,r.next),$(n,n.next)}function To(e,t){let n=t,r=e.x,o=e.y,i=-1/0,s;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){let h=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>i&&(i=h,s=n.x<n.next.x?n:n.next,h===r))return s}n=n.next}while(n!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;n=s;do r>=n.x&&n.x>=l&&r!==n.x&&re(o<c?r:i,o,l,c,o<c?i:r,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(r-n.x),ye(n,e)&&(u<f||u===f&&(n.x>s.x||n.x===s.x&&Io(s,n)))&&(s=n,f=u)),n=n.next;while(n!==a);return s}function Io(e,t){return I(e.prev,e,t.prev)<0&&I(t.next,e,e.next)<0}function Po(e,t,n,r){let o=e;do o.z===0&&(o.z=ut(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,Fo(o)}function Fo(e){let t,n,r=1,o,i,s,a,l,c;do{for(i=e,e=null,c=null,o=0;i;){for(o++,a=i,s=0,n=0;n<r&&(s++,a=a.nextZ,!!a);n++);for(l=r;s>0||l>0&&a;)s!==0&&(l===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;i=a}c.nextZ=null,r*=2}while(o>1);return e}function ut(e,t,n,r,o){return e=(e-n)*o|0,t=(t-r)*o|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function bo(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function re(e,t,n,r,o,i,s,a){return(o-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(r-a)>=(n-s)*(t-a)&&(n-s)*(i-a)>=(o-s)*(r-a)}function Eo(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!So(e,t)&&(ye(e,t)&&ye(t,e)&&_o(e,t)&&(I(e.prev,e,t.prev)||I(e,t.prev,t))||Ge(e,t)&&I(e.prev,e,e.next)>0&&I(t.prev,t,t.next)>0)}function I(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ge(e,t){return e.x===t.x&&e.y===t.y}function pn(e,t,n,r){let o=Oe(I(e,t,n)),i=Oe(I(e,t,r)),s=Oe(I(n,r,e)),a=Oe(I(n,r,t));return!!(o!==i&&s!==a||o===0&&Ce(e,n,t)||i===0&&Ce(e,r,t)||s===0&&Ce(n,e,r)||a===0&&Ce(n,t,r))}function Ce(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Oe(e){return e>0?1:e<0?-1:0}function So(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&pn(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function ye(e,t){return I(e.prev,e,e.next)<0?I(e,t,e.next)>=0&&I(e,e.prev,t)>=0:I(e,t,e.prev)<0||I(e,e.next,t)<0}function _o(e,t){let n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function gn(e,t){let n=new we(e.i,e.x,e.y),r=new we(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function hn(e,t,n,r){let o=new we(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function xe(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 we=class{constructor(t,n,r){T(this,"i",void 0),T(this,"x",void 0),T(this,"y",void 0),T(this,"prev",null),T(this,"next",null),T(this,"z",0),T(this,"prevZ",null),T(this,"nextZ",null),T(this,"steiner",!1),this.i=t,this.x=n,this.y=r}};function gt(e,t,n){let r=Lo(e),o=Object.keys(r).filter(i=>r[i]!==Array);return Mo(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||o,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function Lo(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let o=n.properties[r];t[r]=Go(o,t[r])}return t}function Mo(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:o,linePositionsCount:i,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}=n,M=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(r*d),globalFeatureIds:new v(r),featureIds:o>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(i*d),globalFeatureIds:new v(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},_={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&&(_.triangles=[]);for(let U of[m,g,_])for(let b of p){let B=h[b];U.numericProps[b]=new B(U.positions.length/d)}g.pathIndices[s]=i,_.polygonIndices[c]=l,_.primitivePolygonIndices[f]=l;let O={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let U of e){let b=U.geometry,B=U.properties||{};switch(b.type){case"Point":Uo(b,m,O,d,B),m.properties.push(pt(B,p)),M&&m.fields.push({id:U.id}),O.pointFeature++;break;case"LineString":ko(b,g,O,d,B),g.properties.push(pt(B,p)),M&&g.fields.push({id:U.id}),O.lineFeature++;break;case"Polygon":No(b,_,O,d,B),_.properties.push(pt(B,p)),M&&_.fields.push({id:U.id}),O.polygonFeature++;break;default:throw new Error("Invalid geometry type")}O.feature++}return Oo(m,g,_,d)}function Uo(e,t,n,r,o){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;mt(t,o,n.pointPosition,i),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function ko(e,t,n,r,o){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;mt(t,o,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(c-l)/r}}function No(e,t,n,r,o){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;mt(t,o,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=n.polygonPosition;t.polygonIndices[n.polygonObject++]=l;let c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let 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[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(P-y)/r}let h=n.polygonPosition;Co(t,c,f,{startPosition:l,endPosition:h,coordLength:r})}}function Co(e,t,n,{startPosition:r,endPosition:o,coordLength:i}){if(!e.triangles)return;let s=r*i,a=o*i,l=e.positions.subarray(s,a),c=n[0],f=n.slice(1).map(h=>(h-c)/i),u=ht(l,f,i,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(r+u[h])}function dt(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function Oo(e,t,n,r){let o={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:dt(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:dt(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:dt(n.numericProps,1)}};return o.polygons&&n.triangles&&(o.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),o}function mt(e,t,n,r){for(let o in e.numericProps)if(o in t){let i=t[o];e.numericProps[o].fill(i,n,n+r)}}function pt(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function Go(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var vt=Gt(Fn(),1);function oi(e){let t=0;for(let n=0,r=e.length-1,o,i;n<e.length;r=n++)o=e[n],i=e[r],t+=(i[0]-o[0])*(o[1]+i[1]);return t}function bn(e,t,n){let{x:r,y:o,z:i}=t,s=n*Math.pow(2,i),a=n*r,l=n*o;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function En(e){let t=e.length;if(t<=1)return[e];let n=[],r,o;for(let i=0;i<t;i++){let s=oi(e[i]);s!==0&&(o===void 0&&(o=s<0),o===s<0?(r&&n.push(r),r=[e[i]]):r&&r.push(e[i]))}return r&&n.push(r),n}function Sn(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[K(e.data)]],indices:[e.indices]};let r=[],o=[],i=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),d=K(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&&(r.push(i),o.push(s)),s=[u],i=[d]):(i.push(d),s.push(u))}return i&&r.push(i),s.length&&o.push(s),{type:n,areas:r,indices:o,data:e.data}}var Y=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,o,i,s){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=o,this._values=i,this._geometryInfo=s,t.readFields(ii,this,n)}toGeoJSON(t){let n=this.loadGeometry();if(typeof t=="function")return _n(this,n,t);let{x:r,y:o,z:i}=t,s=this.extent*Math.pow(2,i),a=this.extent*r,l=this.extent*o;function c(f){for(let u=0;u<f.length;u++){let h=f[u];h[0]=(h[0]+a)*360/s-180;let d=180-(h[1]+l)*360/s;h[1]=360/Math.PI*Math.atan(Math.exp(d*Math.PI/180))-90}}return _n(this,n,c)}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let n=t;return this._toBinaryCoordinates(r=>bn(r,n,this.extent))}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o=0,i=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<n;){if(o<=0){let u=t.readVarint();r=u&7,o=u>>3}if(o--,r===1||r===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<c&&(c=s),s>f&&(f=s);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,c,l,f]}_toBinaryCoordinates(t){let n=this.loadFlatGeometry(),r;t(n.data,this);let o=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,r={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/o,r={type:"LineString",...n};break;case 3:r=Sn(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let s of r.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=r.data.length/o;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o=0,i=0,s=0,a=[],l;for(;t.pos<n;){if(o<=0){let c=t.readVarint();r=c&7,o=c>>3}switch(o--,r){case 1:case 2:i+=t.readSVarint(),s+=t.readSVarint(),r===1&&(l&&a.push(l),l=[]),l&&l.push([i,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${r}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o,i=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<n;)if(i<=0&&(o=t.readVarint(),r=o&7,i=o>>3),i--,r===1||r===2)s+=t.readSVarint(),a+=t.readSVarint(),r===1&&c.push(l),f.push(s,a),l+=2;else if(r===7){if(l>0){let u=c[c.length-1];f.push(f[u],f[u+1]),l+=2}}else throw new Error(`unknown command ${r}`);return{data:f,indices:c}}};zt(Y,"types",["Unknown","Point","LineString","Polygon"]);function _n(e,t,n){let r=Y.types[e.type],o,i,s;switch(e.type){case 1:let l=[];for(o=0;o<t.length;o++)l[o]=t[o][0];s=l,n(s,e);break;case 2:for(s=t,o=0;o<s.length;o++)n(s[o],e);break;case 3:for(s=En(t),o=0;o<s.length;o++)for(i=0;i<s[o].length;i++)n(s[o][i],e);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:r=`Multi${r}`;let a={type:"Feature",geometry:{type:r,coordinates:s},properties:e.properties};return e.id!==null&&(a.id=e.id),a}function ii(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?si(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function si(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],o=t._values[e.readVarint()];t.properties[r]=o}}var Re=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ai,this,n),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new Y(this._pbf,n,this.extent,this._keys,this._values)}getBinaryFeature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new Y(this._pbf,r,this.extent,this._keys,this._values,n)}};function ai(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(li(n)))}function li(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var ve=class{layers;constructor(t,n){this.layers=t.readFields(ci,{},n)}};function ci(e,t,n){if(e===3&&n){let r=new Re(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function Tt(e,t){let n=ui(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:wt(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Bn(e,n)};case"geojson":return Bn(e,n);case"binary-geometry":return wt(e,n);case"binary":return wt(e,n);default:throw new Error(r||"undefined shape")}}function wt(e,t){let[n,r]=fi(e,t),o=gt(n,r);return o.byteLength=e.byteLength,o}function fi(e,t){let n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,r];let o=new ve(new vt.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(o.layers)).forEach(s=>{let a=o.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,r),f=di(c,t,s);n.push(f)}}),[n,r]}function Bn(e,t){if(e.byteLength<=0)return[];let n=[],r=new ve(new vt.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(i=>{let s=r.layers[i];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=hi(l,t,i);n.push(c)}}),n}function ui(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&&ot.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function hi(e,t,n){let r=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:pi);return t.layerProperty&&(r.properties||={},r.properties[t.layerProperty]=n),r}function di(e,t,n){let r=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:gi);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}function pi(e,t){let{extent:n}=t;for(let r=0;r<e.length;r++){let o=e[r];o[0]/=n,o[1]/=n}}function gi(e,t){let{extent:n}=t;for(let r=0,o=e.length;r<o;++r)e[r]/=n}var mi="4.2.0",An={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:mi,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}}},It={...An,parse:async(e,t)=>Tt(e,t),parseSync:Tt,binary:!0};var Mn=e=>e!==null&&typeof e=="object";function Pt(e,t){if(!e||!Mn(e))return null;let n={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(n.generator=e.generator),typeof e.generator_options=="string"&&(n.generatorOptions=e.generator_options),n.boundingBox=Dn(e.bounds)||Dn(e.antimeridian_adjusted_bounds),n.center=Ii(e.center),n.maxZoom=Vn(e.maxzoom),n.minZoom=Vn(e.minzoom),typeof e?.json=="string")try{n.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let r=e.tilestats||n.metaJson?.tilestats,o=wi(r,t),i=yi(e.vector_layers),s=Ti(i,o);return n={...n,layers:s},n.maxZoom===null&&s.length>0&&(n.maxZoom=s[0].maxZoom||null),n.minZoom===null&&s.length>0&&(n.minZoom=s[0].minZoom||null),n}function yi(e){return Array.isArray(e)?e.map(t=>xi(t)):[]}function xi(e){let t=Object.entries(e.fields||[]).map(([r,o])=>({name:r,...Cn(String(o))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function wi(e,t){return Mn(e)&&Array.isArray(e.layers)?e.layers.map(n=>vi(n,t)):[]}function vi(e,t){let n=[],r={},o=e.attributes||[];for(let i of o){let s=i.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];r[a]=r[a]||[],r[a].push(i),console.warn("ignoring tilestats indexed field",a)}else n[s]||n.push(Fi(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function Ti(e,t){return e.map(n=>{let r=t.find(s=>s.name===n.name),o=r?.fields||[],i={...n};return delete i.fields,{...i,...r,fields:o}})}function Dn(e){let t=Nn(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(kn)&&[t[1],t[3]].every(Un))return[[t[0],t[1]],[t[2],t[3]]]}function Ii(e){let t=Nn(e);return Array.isArray(t)&&t.length===3&&kn(t[0])&&Un(t[1])&&Pi(t[2])?t:null}function Vn(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function Un(e){return Number.isFinite(e)&&e<=90&&e>=-90}function kn(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Pi(e){return Number.isFinite(e)&&e>=0&&e<=22}function Nn(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var Ln={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 Fi(e={},t){let n=Cn(e.type),r={name:e.attribute,...n};return typeof e.min=="number"&&(r.min=e.min),typeof e.max=="number"&&(r.max=e.max),typeof e.count=="number"&&(r.uniqueValueCount=e.count),e.values&&(r.values=e.values),r.values&&typeof t.maxValues=="number"&&(r.values=r.values?.slice(0,t.maxValues)),r}function Cn(e){let t=e.toLowerCase();return!t||Ln[t],Ln[t]||{type:"string"}}var bi="4.2.0",Te={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:bi,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),r=JSON.parse(n),o={...Te.options.tilejson,...t?.tilejson};return Pt(r,o)},parseTextSync:(e,t)=>{let n=JSON.parse(e),r={...Te.options.tilejson,...t?.tilejson};return Pt(n,r)}};var be={};Ot(be,{Compression:()=>tr,EtagMismatch:()=>Ze,FetchSource:()=>or,FileSource:()=>is,PMTiles:()=>_t,Protocol:()=>qi,ResolvedValueCache:()=>as,SharedPromiseCache:()=>cr,TileType:()=>nr,bytesToHeader:()=>ir,findTile:()=>rr,getUint64:()=>V,leafletRasterLayer:()=>Xi,readVarint:()=>ae,tileIdToZxy:()=>rs,zxyToTileId:()=>er});var X=Math.pow,F=(e,t,n)=>new Promise((r,o)=>{var i=l=>{try{a(n.next(l))}catch(c){o(c)}},s=l=>{try{a(n.throw(l))}catch(c){o(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,s);a((n=n.apply(e,t)).next())}),S=Uint8Array,le=Uint16Array,Ei=Int32Array,zn=new S([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]),jn=new S([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]),Si=new S([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rn=function(e,t){for(var n=new le(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new Ei(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)o[i]=i-n[r]<<5|r;return{b:n,r:o}},Hn=Rn(zn,2),Zn=Hn.b,_i=Hn.r;Zn[28]=258,_i[258]=28;var Wn=Rn(jn,0),Bi=Wn.b,ec=Wn.r,Et=new le(32768);for(w=0;w<32768;++w)R=(w&43690)>>1|(w&21845)<<1,R=(R&52428)>>2|(R&13107)<<2,R=(R&61680)>>4|(R&3855)<<4,Et[w]=((R&65280)>>8|(R&255)<<8)>>1;var R,w,Pe=function(e,t,n){for(var r=e.length,o=0,i=new le(t);o<r;++o)e[o]&&++i[e[o]-1];var s=new le(t);for(o=1;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;var a;if(n){a=new le(1<<t);var l=15-t;for(o=0;o<r;++o)if(e[o])for(var c=o<<4|e[o],f=t-e[o],u=s[e[o]-1]++<<f,h=u|(1<<f)-1;u<=h;++u)a[Et[u]>>l]=c}else for(a=new le(r),o=0;o<r;++o)e[o]&&(a[o]=Et[s[e[o]-1]++]>>15-e[o]);return a},Fe=new S(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,Jn=new S(32);for(w=0;w<32;++w)Jn[w]=5;var w,Ai=Pe(Fe,9,1),Di=Pe(Jn,5,1),Ft=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},C=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},bt=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Vi=function(e){return(e+7)/8|0},Li=function(e,t,n){(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new S(n-t);return r.set(e.subarray(t,n)),r},Mi=["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"],E=function(e,t,n){var r=new Error(t||Mi[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,E),!n)throw r;return r},Bt=function(e,t,n,r){var o=e.length,i=r?r.length:0;if(!o||t.f&&!t.l)return n||new S(0);var s=!n||t.i!=2,a=t.i;n||(n=new S(o*3));var l=function(kt){var Nt=n.length;if(kt>Nt){var Ct=new S(Math.max(Nt*2,kt));Ct.set(n),n=Ct}},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=o*8;do{if(!h){c=C(e,f,1);var M=C(e,f+1,3);if(f+=3,M)if(M==1)h=Ai,d=Di,p=9,y=5;else if(M==2){var _=C(e,f,31)+257,O=C(e,f+10,15)+4,U=_+C(e,f+5,31)+1;f+=14;for(var b=new S(U),B=new S(19),A=0;A<O;++A)B[Si[A]]=C(e,f+A*3,7);f+=O*3;for(var Dt=Ft(B),ur=(1<<Dt)-1,hr=Pe(B,Dt,1),A=0;A<U;){var Vt=hr[C(e,f,ur)];f+=Vt&15;var v=Vt>>4;if(v<16)b[A++]=v;else{var Q=0,_e=0;for(v==16?(_e=3+C(e,f,3),f+=2,Q=b[A-1]):v==17?(_e=3+C(e,f,7),f+=3):v==18&&(_e=11+C(e,f,127),f+=7);_e--;)b[A++]=Q}}var Lt=b.subarray(0,_),k=b.subarray(_);p=Ft(Lt),y=Ft(k),h=Pe(Lt,p,1),d=Pe(k,y,1)}else E(1);else{var v=Vi(f)+4,m=e[v-4]|e[v-3]<<8,g=v+m;if(g>o){a&&E(0);break}s&&l(u+m),n.set(e.subarray(v,g),u),t.b=u+=m,t.p=f=g*8,t.f=c;continue}if(f>P){a&&E(0);break}}s&&l(u+131072);for(var dr=(1<<p)-1,pr=(1<<y)-1,Ke=f;;Ke=f){var Q=h[bt(e,f)&dr],q=Q>>4;if(f+=Q&15,f>P){a&&E(0);break}if(Q||E(2),q<256)n[u++]=q;else if(q==256){Ke=f,h=null;break}else{var Mt=q-254;if(q>264){var A=q-257,ce=zn[A];Mt=C(e,f,(1<<ce)-1)+Zn[A],f+=ce}var $e=d[bt(e,f)&pr],Ye=$e>>4;$e||E(3),f+=$e&15;var k=Bi[Ye];if(Ye>3){var ce=jn[Ye];k+=bt(e,f)&(1<<ce)-1,f+=ce}if(f>P){a&&E(0);break}s&&l(u+131072);var Xe=u+Mt;if(u<k){var Ut=i-k,gr=Math.min(k,Xe);for(Ut+u<0&&E(3);u<gr;++u)n[u]=r[Ut+u]}for(;u<Xe;u+=4)n[u]=n[u-k],n[u+1]=n[u+1-k],n[u+2]=n[u+2-k],n[u+3]=n[u+3-k];u=Xe}}t.l=h,t.p=Ke,t.b=u,t.f=c,h&&(c=1,t.m=p,t.d=d,t.n=y)}while(!c);return u==n.length?n:Li(n,0,u)},Ui=new S(0),ki=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&E(6,"invalid gzip data");var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Ni=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ci=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&E(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&E(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function Oi(e,t){return Bt(e,{i:2},t&&t.out,t&&t.dictionary)}function Gi(e,t){var n=ki(e);return n+8>e.length&&E(6,"invalid gzip data"),Bt(e.subarray(n,-8),{i:2},t&&t.out||new S(Ni(e)),t&&t.dictionary)}function zi(e,t){return Bt(e.subarray(Ci(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}function St(e,t){return e[0]==31&&e[1]==139&&e[2]==8?Gi(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?Oi(e,t):zi(e,t)}var ji=typeof TextDecoder<"u"&&new TextDecoder,Ri=0;try{ji.decode(Ui,{stream:!0}),Ri=1}catch{}var Kn=(e,t)=>e*X(2,t),Ie=(e,t)=>Math.floor(e/X(2,t)),He=(e,t)=>Kn(e.getUint16(t+1,!0),8)+e.getUint8(t),$n=(e,t)=>Kn(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),Hi=(e,t,n,r,o)=>{if(e!==r.getUint8(o))return e-r.getUint8(o);let i=He(r,o+1);if(t!==i)return t-i;let s=He(r,o+4);return n!==s?n-s:0},Zi=(e,t,n,r)=>{let o=Yn(e,t|128,n,r);return o?{z:t,x:n,y:r,offset:o[0],length:o[1],isDir:!0}:null},On=(e,t,n,r)=>{let o=Yn(e,t,n,r);return o?{z:t,x:n,y:r,offset:o[0],length:o[1],isDir:!1}:null},Yn=(e,t,n,r)=>{let o=0,i=e.byteLength/17-1;for(;o<=i;){let s=i+o>>1,a=Hi(t,n,r,e,s*17);if(a>0)o=s+1;else if(a<0)i=s-1;else return[$n(e,s*17+7),e.getUint32(s*17+13,!0)]}return null},Wi=(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,Xn=(e,t)=>{let n=e.getUint8(t*17);return{z:n&127,x:He(e,t*17+1),y:He(e,t*17+4),offset:$n(e,t*17+7),length:e.getUint32(t*17+13,!0),isDir:n>>7===1}},Gn=e=>{let t=[],n=new DataView(e);for(let r=0;r<n.byteLength/17;r++)t.push(Xn(n,r));return Ji(t)},Ji=e=>{e.sort(Wi);let t=new ArrayBuffer(17*e.length),n=new Uint8Array(t);for(let r=0;r<e.length;r++){let o=e[r],i=o.z;o.isDir&&(i=i|128),n[r*17]=i,n[r*17+1]=o.x&255,n[r*17+2]=o.x>>8&255,n[r*17+3]=o.x>>16&255,n[r*17+4]=o.y&255,n[r*17+5]=o.y>>8&255,n[r*17+6]=o.y>>16&255,n[r*17+7]=o.offset&255,n[r*17+8]=Ie(o.offset,8)&255,n[r*17+9]=Ie(o.offset,16)&255,n[r*17+10]=Ie(o.offset,24)&255,n[r*17+11]=Ie(o.offset,32)&255,n[r*17+12]=Ie(o.offset,48)&255,n[r*17+13]=o.length&255,n[r*17+14]=o.length>>8&255,n[r*17+15]=o.length>>16&255,n[r*17+16]=o.length>>24&255}return t},Ki=(e,t)=>{if(e.byteLength<17)return null;let n=e.byteLength/17,r=Xn(e,n-1);if(r.isDir){let o=r.z,i=t.z-o,s=Math.trunc(t.x/(1<<i)),a=Math.trunc(t.y/(1<<i));return{z:o,x:s,y:a}}return null};function $i(e){return F(this,null,function*(){let t=yield e.getBytes(0,512e3),n=new DataView(t.data),r=n.getUint32(4,!0),o=n.getUint16(8,!0),i=new TextDecoder("utf-8"),s=JSON.parse(i.decode(new DataView(t.data,10,r))),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:n.getUint16(2,!0),rootDirectoryOffset:10+r,rootDirectoryLength:o*17,jsonMetadataOffset:10,jsonMetadataLength:r,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 Yi(e,t,n,r,o,i,s){return F(this,null,function*(){let a=yield n.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);e.specVersion===1&&(a=Gn(a));let l=On(new DataView(a),r,o,i);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=St(new Uint8Array(u))),{data:u}}let c=Ki(new DataView(a),{z:r,x:o,y:i});if(c){let f=Zi(new DataView(a),c.z,c.x,c.y);if(f){let u=yield n.getArrayBuffer(t,f.offset,f.length,e);e.specVersion===1&&(u=Gn(u));let h=On(new DataView(u),r,o,i);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=St(new Uint8Array(p))),{data:p}}}}})}var Qn={getHeader:$i,getZxy:Yi},Xi=(e,t)=>{let n=!1,r="",o=L.GridLayer.extend({createTile:(i,s)=>{let a=document.createElement("img"),l=new AbortController,c=l.signal;return a.cancel=()=>{l.abort()},n||(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?r="image/png":f.tileType===3?r="image/jpeg":f.tileType===4?r="image/webp":f.tileType===5&&(r="image/avif")}),n=!0),e.getZxy(i.z,i.x,i.y,c).then(f=>{if(f){let u=new Blob([f.data],{type:r}),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(i){let s=this._tiles[i];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[i],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(i)}))}});return new o(t)},Qi=e=>(t,n)=>{if(n instanceof AbortController)return e(t,n);let r=new AbortController;return e(t,r).then(o=>n(void 0,o.data,o.cacheControl||"",o.expires||""),o=>n(o)).catch(o=>n(o)),{cancel:()=>r.abort()}},qi=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 _t(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 n=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),r=e.url.match(n);if(!r)throw new Error("Invalid PMTiles protocol URL");let o=r[1],i=this.tiles.get(o);i||(i=new _t(o),this.tiles.set(o,i));let s=r[2],a=r[3],l=r[4],c=yield i.getHeader(),f=yield i?.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=Qi(this.tilev4),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function se(e,t){return(t>>>0)*4294967296+(e>>>0)}function es(e,t){let n=t.buf,r=n[t.pos++],o=(r&112)>>4;if(r<128||(r=n[t.pos++],o|=(r&127)<<3,r<128)||(r=n[t.pos++],o|=(r&127)<<10,r<128)||(r=n[t.pos++],o|=(r&127)<<17,r<128)||(r=n[t.pos++],o|=(r&127)<<24,r<128)||(r=n[t.pos++],o|=(r&1)<<31,r<128))return se(e,o);throw new Error("Expected varint not more than 10 bytes")}function ae(e){let t=e.buf,n=t[e.pos++],r=n&127;return n<128||(n=t[e.pos++],r|=(n&127)<<7,n<128)||(n=t[e.pos++],r|=(n&127)<<14,n<128)||(n=t[e.pos++],r|=(n&127)<<21,n<128)?r:(n=t[e.pos],r|=(n&15)<<28,es(r,e))}function qn(e,t,n,r){if(r===0){n===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let o=t[0];t[0]=t[1],t[1]=o}}function ts(e,t){let n=X(2,e),r=t,o=t,i=t,s=[0,0],a=1;for(;a<n;)r=1&i/2,o=1&(i^r),qn(a,s,r,o),s[0]+=a*r,s[1]+=a*o,i=i/4,a*=2;return[e,s[0],s[1]]}var ns=[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 er(e,t,n){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>X(2,e)-1||n>X(2,e)-1)throw Error("tile x/y outside zoom level bounds");let r=ns[e],o=X(2,e),i=0,s=0,a=0,l=[t,n],c=o/2;for(;c>0;)i=(l[0]&c)>0?1:0,s=(l[1]&c)>0?1:0,a+=c*c*(3*i^s),qn(c,l,i,s),c=c/2;return r+a}function rs(e){let t=0,n=0;for(let r=0;r<27;r++){let o=(1<<r)*(1<<r);if(t+o>e)return ts(r,e-t);t+=o}throw Error("Tile zoom level exceeds max safe number limit (26)")}var tr=(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))(tr||{});function At(e,t){return F(this,null,function*(){if(t===1||t===0)return e;if(t===2){if(typeof globalThis.DecompressionStream>"u")return St(new Uint8Array(e));let n=new Response(e).body;if(!n)throw Error("Failed to read response stream");let r=n.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(r).arrayBuffer()}throw Error("Compression method not supported")})}var nr=(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))(nr||{}),os=127;function rr(e,t){let n=0,r=e.length-1;for(;n<=r;){let o=r+n>>1,i=t-e[o].tileId;if(i>0)n=o+1;else if(i<0)r=o-1;else return e[o]}return r>=0&&(e[r].runLength===0||t-e[r].tileId<e[r].runLength)?e[r]:null}var is=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()}})}},or=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,n,r){return F(this,null,function*(){let o,i;n?i=n:(o=new AbortController,i=o.signal);let s=new Headers(this.customHeaders);s.set("range",`bytes=${e}-${e+t-1}`);let a;this.mustReload&&(a="reload");let l=yield fetch(this.url,{signal:i,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:i,cache:"reload",headers:{range:`bytes=0-${d-1}`}})}let c=l.headers.get("Etag");if(c?.startsWith("W/")&&(c=null),l.status===416||r&&c&&c!==r)throw this.mustReload=!0,new Ze(r);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 o&&o.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 V(e,t){let n=e.getUint32(t+4,!0),r=e.getUint32(t+0,!0);return n*X(2,32)+r}function ir(e,t){let n=new DataView(e),r=n.getUint8(7);if(r>3)throw Error(`Archive is spec version ${r} but this library supports up to spec version 3`);return{specVersion:r,rootDirectoryOffset:V(n,8),rootDirectoryLength:V(n,16),jsonMetadataOffset:V(n,24),jsonMetadataLength:V(n,32),leafDirectoryOffset:V(n,40),leafDirectoryLength:V(n,48),tileDataOffset:V(n,56),tileDataLength:V(n,64),numAddressedTiles:V(n,72),numTileEntries:V(n,80),numTileContents:V(n,88),clustered:n.getUint8(96)===1,internalCompression:n.getUint8(97),tileCompression:n.getUint8(98),tileType:n.getUint8(99),minZoom:n.getUint8(100),maxZoom:n.getUint8(101),minLon:n.getInt32(102,!0)/1e7,minLat:n.getInt32(106,!0)/1e7,maxLon:n.getInt32(110,!0)/1e7,maxLat:n.getInt32(114,!0)/1e7,centerZoom:n.getUint8(118),centerLon:n.getInt32(119,!0)/1e7,centerLat:n.getInt32(123,!0)/1e7,etag:t}}function sr(e){let t={buf:new Uint8Array(e),pos:0},n=ae(t),r=[],o=0;for(let i=0;i<n;i++){let s=ae(t);r.push({tileId:o+s,offset:0,length:0,runLength:1}),o+=s}for(let i=0;i<n;i++)r[i].runLength=ae(t);for(let i=0;i<n;i++)r[i].length=ae(t);for(let i=0;i<n;i++){let s=ae(t);s===0&&i>0?r[i].offset=r[i-1].offset+r[i-1].length:r[i].offset=s-1}return r}function ss(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 Ze=class extends Error{};function ar(e,t){return F(this,null,function*(){let n=yield e.getBytes(0,16384);if(new DataView(n.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(ss(n.data)<3)return[yield Qn.getHeader(e)];let o=n.data.slice(0,os),i=ir(o,n.etag),s=n.data.slice(i.rootDirectoryOffset,i.rootDirectoryOffset+i.rootDirectoryLength),a=`${e.getKey()}|${i.etag||""}|${i.rootDirectoryOffset}|${i.rootDirectoryLength}`,l=sr(yield t(s,i.internalCompression));return[i,[a,l.length,l]]})}function lr(e,t,n,r,o){return F(this,null,function*(){let i=yield e.getBytes(n,r,void 0,o.etag),s=yield t(i.data,o.internalCompression),a=sr(s);if(a.length===0)throw new Error("Empty directory is invalid");return a})}var as=class{constructor(e=100,t=!0,n=At){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=n}getHeader(e){return F(this,null,function*(){let t=e.getKey(),n=this.cache.get(t);if(n)return n.lastUsed=this.counter++,n.data;let r=yield ar(e,this.decompress);return r[1]&&this.cache.set(r[1][0],{lastUsed:this.counter++,data:r[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:r[0]}),this.prune(),r[0]})}getDirectory(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,i.data;let s=yield lr(e,this.decompress,t,n,r);return this.cache.set(o,{lastUsed:this.counter++,data:s}),this.prune(),s})}getArrayBuffer(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=yield e.getBytes(t,n,void 0,r.etag);return this.cache.set(o,{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((n,r)=>{n.lastUsed<e&&(e=n.lastUsed,t=r)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){this.cache.delete(e.getKey())})}},cr=class{constructor(e=100,t=!0,n=At){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=n}getHeader(e){return F(this,null,function*(){let t=e.getKey(),n=this.cache.get(t);if(n)return n.lastUsed=this.counter++,yield n.data;let r=new Promise((o,i)=>{ar(e,this.decompress).then(s=>{s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:Promise.resolve(s[1][2])}),o(s[0]),this.prune()}).catch(s=>{i(s)})});return this.cache.set(t,{lastUsed:this.counter++,data:r}),r})}getDirectory(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=new Promise((a,l)=>{lr(e,this.decompress,t,n,r).then(c=>{a(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=new Promise((a,l)=>{e.getBytes(t,n,void 0,r.etag).then(c=>{a(c.data),this.cache.has(o),this.prune()}).catch(c=>{l(c)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}prune(){if(this.cache.size>=this.maxCacheEntries){let e=1/0,t;this.cache.forEach((n,r)=>{n.lastUsed<e&&(e=n.lastUsed,t=r)}),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 n=new Promise((r,o)=>{this.getHeader(e).then(i=>{r(),this.invalidations.delete(t)}).catch(i=>{o(i)})});this.invalidations.set(t,n)})}},_t=class{constructor(e,t,n){typeof e=="string"?this.source=new or(e):this.source=e,n?this.decompress=n:this.decompress=At,t?this.cache=t:this.cache=new cr}getHeader(){return F(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,n,r){return F(this,null,function*(){let o=er(e,t,n),i=yield this.cache.getHeader(this.source);if(i.specVersion<3)return Qn.getZxy(i,this.source,this.cache,e,t,n,r);if(e<i.minZoom||e>i.maxZoom)return;let s=i.rootDirectoryOffset,a=i.rootDirectoryLength;for(let l=0;l<=3;l++){let c=yield this.cache.getDirectory(this.source,s,a,i),f=rr(c,o);if(f){if(f.runLength>0){let u=yield this.source.getBytes(i.tileDataOffset+f.offset,f.length,r,i.etag);return{data:yield this.decompress(u.data,i.tileCompression),cacheControl:u.cacheControl,expires:u.expires}}s=i.leafDirectoryOffset+f.offset,a=f.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(e,t,n,r){return F(this,null,function*(){try{return yield this.getZxyAttempt(e,t,n,r)}catch(o){if(o instanceof Ze)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,n,r);throw o}})}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),n=yield this.decompress(t.data,e.internalCompression),r=new TextDecoder("utf-8");return JSON.parse(r.decode(n))})}getMetadata(){return F(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof Ze)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}};var{TileType:Ee}=be;function fr(e,t,n,r){let o=t,i=null;if(o)try{let l=JSON.stringify(o);i=Te.parseTextSync?.(l,r)||null}catch(l){console.warn("PMTiles metadata could not be interpreted as TileJSON",l)}let s={};typeof i?.name=="string"&&(s.name=i.name),typeof i?.htmlAttribution=="string"&&(s.attributions=[i.htmlAttribution]);let a={...s,format:"pmtiles",formatVersion:e.specVersion,attributions:[],tileMIMEType:ls(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&&(a.tilejson=i),n?.includeFormatHeader&&(a.formatHeader=e,a.formatMetadata=a),a}function ls(e){switch(e){case Ee.Mvt:return"application/vnd.mapbox-vector-tile";case Ee.Png:return"image/png";case Ee.Jpeg:return"image/jpeg";case Ee.Webp:return"image/webp";case Ee.Avif:return"image/avif";default:return"application/octet-stream"}}var We=class{blob;key;constructor(t,n){this.blob=t,this.key=n}getKey(){return this.blob.url||""}async getBytes(t,n,r){return{data:await this.blob.slice(t,t+n).arrayBuffer()}}};var{PMTiles:cs}=be;var Je=class extends he{data;props;mimeType=null;pmtiles;metadata;constructor(t){super(t),this.props=t;let n=typeof t.url=="string"?it(t.url):new We(t.url,"pmtiles");this.data=t.url,this.pmtiles=new cs(n),this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata()}async getMetadata(){let t=await this.pmtiles.getHeader(),n=await this.pmtiles.getMetadata(),r=fr(t,n,{includeFormatHeader:!1},this.loadOptions);return this.props.attributions&&(r.attributions=[...this.props.attributions,...r.attributions||[]]),r?.tileMIMEType&&(this.mimeType=r?.tileMIMEType),r}async getTile(t){let{x:n,y:r,z:o}=t,s=(await this.pmtiles.getZxy(o,n,r))?.data;return s||null}async getTileData(t){let{x:n,y:r,z:o}=t.index;switch((await this.metadata).tileMIMEType){case"application/vnd.mapbox-vector-tile":return await this.getVectorTile({x:n,y:r,z:o,layers:[]});default:return await this.getImageTile({x:n,y:r,z:o,layers:[]})}}async getImageTile(t){let n=await this.getTile(t);return n?await ft.parse(n,this.loadOptions):null}async getVectorTile(t){let n=await this.getTile(t),r={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:t.x,y:t.y,z:t.z},...this.loadOptions?.mvt},...this.loadOptions};return n?await It.parse(n,r):null}};return Ir(Se);})();
|
|
7
|
+
"use strict";var __exports__=(()=>{var wr=Object.create;var fe=Object.defineProperty;var vr=Object.getOwnPropertyDescriptor;var Tr=Object.getOwnPropertyNames;var Ir=Object.getPrototypeOf,Pr=Object.prototype.hasOwnProperty;var Fr=(e,t,n)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Qe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),zt=(e,t)=>{for(var n in t)fe(e,n,{get:t[n],enumerable:!0})},Be=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Tr(t))!Pr.call(e,o)&&o!==n&&fe(e,o,{get:()=>t[o],enumerable:!(r=vr(t,o))||r.enumerable});return e},Ae=(e,t,n)=>(Be(e,t,"default"),n&&Be(n,t,"default")),jt=(e,t,n)=>(n=e!=null?wr(Ir(e)):{},Be(t||!e||!e.__esModule?fe(n,"default",{value:e,enumerable:!0}):n,e)),br=e=>Be(fe({},"__esModule",{value:!0}),e);var Rt=(e,t,n)=>(Fr(e,typeof t!="symbol"?t+"":t,n),n);var Zt=Qe((ds,Ht)=>{Ht.exports=globalThis.loaders});var vn=Qe(yt=>{yt.read=function(e,t,n,r,o){var i,s,a=o*8-r-1,l=(1<<a)-1,c=l>>1,f=-7,u=n?o-1:0,h=n?-1:1,d=e[t+u];for(u+=h,i=d&(1<<-f)-1,d>>=-f,f+=a;f>0;i=i*256+e[t+u],u+=h,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=r;f>0;s=s*256+e[t+u],u+=h,f-=8);if(i===0)i=1-c;else{if(i===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,r),i=i-c}return(d?-1:1)*s*Math.pow(2,i-r)};yt.write=function(e,t,n,r,o,i){var s,a,l,c=i*8-o-1,f=(1<<c)-1,u=f>>1,h=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=h/l:t+=h*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=f?(a=0,s=f):s+u>=1?(a=(t*l-1)*Math.pow(2,o),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,o),s=0));o>=8;e[n+d]=a&255,d+=p,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[n+d]=s&255,d+=p,s/=256,c-=8);e[n+d-p]|=y*128}});var En=Qe((Ml,bn)=>{"use strict";bn.exports=x;var ze=vn();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 xt=(1<<16)*(1<<16),Tn=1/xt,Zo=12,Fn=typeof TextDecoder>"u"?null:new TextDecoder("utf8");x.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var r=this.readVarint(),o=r>>3,i=this.pos;this.type=r&7,e(o,t,this),this.pos===i&&this.skip(r)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=je(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Pn(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=je(this.buf,this.pos)+je(this.buf,this.pos+4)*xt;return this.pos+=8,e},readSFixed64:function(){var e=je(this.buf,this.pos)+Pn(this.buf,this.pos+4)*xt;return this.pos+=8,e},readFloat:function(){var e=ze.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=ze.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,r;return r=t[this.pos++],n=r&127,r<128||(r=t[this.pos++],n|=(r&127)<<7,r<128)||(r=t[this.pos++],n|=(r&127)<<14,r<128)||(r=t[this.pos++],n|=(r&127)<<21,r<128)?n:(r=t[this.pos],n|=(r&15)<<28,Wo(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=Zo&&Fn?si(this.buf,t,e):ii(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==x.Bytes)return e.push(this.readVarint(t));var n=j(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==x.Bytes)return e.push(this.readSVarint());var t=j(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=j(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=j(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=j(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=j(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=j(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=j(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=j(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===x.Varint)for(;this.buf[this.pos++]>127;);else if(t===x.Bytes)this.pos=this.readVarint()+this.pos;else if(t===x.Fixed32)this.pos+=4;else if(t===x.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),ie(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),ie(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),ie(this.buf,e&-1,this.pos),ie(this.buf,Math.floor(e*Tn),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),ie(this.buf,e&-1,this.pos),ie(this.buf,Math.floor(e*Tn),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Jo(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=ai(this.buf,e,this.pos);var n=this.pos-t;n>=128&&In(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),ze.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),ze.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var r=this.pos-n;r>=128&&In(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r},writeMessage:function(e,t,n){this.writeTag(e,x.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,Yo,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Xo,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,ei,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Qo,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,qo,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ti,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,ni,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,ri,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,oi,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 Wo(e,t,n){var r=n.buf,o,i;if(i=r[n.pos++],o=(i&112)>>4,i<128||(i=r[n.pos++],o|=(i&127)<<3,i<128)||(i=r[n.pos++],o|=(i&127)<<10,i<128)||(i=r[n.pos++],o|=(i&127)<<17,i<128)||(i=r[n.pos++],o|=(i&127)<<24,i<128)||(i=r[n.pos++],o|=(i&1)<<31,i<128))return oe(e,o,t);throw new Error("Expected varint not more than 10 bytes")}function j(e){return e.type===x.Bytes?e.readVarint()+e.pos:e.pos+1}function oe(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Jo(e,t){var n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,r=r+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),Ko(n,r,t),$o(r,t)}function Ko(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function $o(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function In(e,t,n){var r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(r);for(var o=n.pos-1;o>=e;o--)n.buf[o+r]=n.buf[o]}function Yo(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function Xo(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function Qo(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function qo(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function ei(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function ti(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function ni(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function ri(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function oi(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function je(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function ie(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Pn(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function ii(e,t,n){for(var r="",o=t;o<n;){var i=e[o],s=null,a=i>239?4:i>223?3:i>191?2:1;if(o+a>n)break;var l,c,f;a===1?i<128&&(s=i):a===2?(l=e[o+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[o+1],c=e[o+2],(l&192)===128&&(c&192)===128&&(s=(i&15)<<12|(l&63)<<6|c&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[o+1],c=e[o+2],f=e[o+3],(l&192)===128&&(c&192)===128&&(f&192)===128&&(s=(i&15)<<18|(l&63)<<12|(c&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,r+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),r+=String.fromCharCode(s),o+=a}return r}function si(e,t,n){return Fn.decode(e.subarray(t,n))}function ai(e,t,n){for(var r=0,o,i;r<t.length;r++){if(o=t.charCodeAt(r),o>55295&&o<57344)if(i)if(o<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=o;continue}else o=i-55296<<10|o-56320|65536,i=null;else{o>56319||r+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=o;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);o<128?e[n++]=o:(o<2048?e[n++]=o>>6|192:(o<65536?e[n++]=o>>12|224:(e[n++]=o>>18|240,e[n++]=o>>12&63|128),e[n++]=o>>6&63|128),e[n++]=o&63|128)}return n}});var Se={};zt(Se,{PMTilesSource:()=>Je});Ae(Se,jt(Zt(),1));function ue(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var G={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Er=G.self||G.window||G.global||{},Sr=G.window||G.self||G.global||{},_r=G.global||G.self||G.window||{},Br=G.document||{};var qe=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Wt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Ar=Wt&&parseFloat(Wt[1])||0;function H(e){return H=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},H(e)}function et(e,t){if(H(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(H(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function tt(e){var t=et(e,"string");return H(t)==="symbol"?t:String(t)}function T(e,t,n){return t=tt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nt(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,n=e||t;return!!(n&&n.indexOf("Electron")>=0)}function N(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||nt()}var Dr=globalThis.self||globalThis.window||globalThis.global,ee=globalThis.window||globalThis.self||globalThis.global,Lr=globalThis.document||{},W=globalThis.process||{},Vr=globalThis.console,Ss=globalThis.navigator||{};var De=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",As=N();function Mr(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var Le=class{constructor(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";T(this,"storage",void 0),T(this,"id",void 0),T(this,"config",void 0),this.storage=Mr(r),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function Jt(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function Kt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,n=Math.max(t-e.length,0);return"".concat(" ".repeat(n)).concat(e)}function Ve(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,o=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>r&&(n=Math.min(n,r/e.width));let i=e.width*n,s=e.height*n,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(o,");"),"background-size:".concat(i,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}var Me;(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"})(Me||(Me={}));var Ur=10;function $t(e){return typeof e!="string"?e:(e=e.toUpperCase(),Me[e]||Me.WHITE)}function Yt(e,t,n){if(!N&&typeof e=="string"){if(t){let r=$t(t);e="\x1B[".concat(r,"m").concat(e,"\x1B[39m")}if(n){let r=$t(n);e="\x1B[".concat(r+Ur,"m").concat(e,"\x1B[49m")}}return e}function Xt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],n=Object.getPrototypeOf(e),r=Object.getOwnPropertyNames(n),o=e;for(let i of r){let s=o[i];typeof s=="function"&&(t.find(a=>i===a)||(o[i]=s.bind(e)))}}function te(e,t){if(!e)throw new Error(t||"Assertion failed")}function J(){let e;if(N()&&ee.performance){var t,n;e=ee===null||ee===void 0||(t=ee.performance)===null||t===void 0||(n=t.now)===null||n===void 0?void 0:n.call(t)}else if("hrtime"in W){var r;let o=W===null||W===void 0||(r=W.hrtime)===null||r===void 0?void 0:r.call(W);e=o[0]*1e3+o[1]/1e6}else e=Date.now();return e}var ne={debug:N()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},kr={enabled:!0,level:0};function D(){}var Qt={},qt={once:!0},Z=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};T(this,"id",void 0),T(this,"VERSION",De),T(this,"_startTs",J()),T(this,"_deltaTs",J()),T(this,"_storage",void 0),T(this,"userData",{}),T(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new Le("__probe-".concat(this.id,"__"),kr),this.timeStamp("".concat(this.id," started")),Xt(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((J()-this._startTs).toPrecision(10))}getDelta(){return Number((J()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){te(t,n)}warn(t){return this._getLogFunction(0,t,ne.warn,arguments,qt)}error(t){return this._getLogFunction(0,t,ne.error,arguments)}deprecated(t,n){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(n,"` instead"))}removed(t,n){return this.error("`".concat(t,"` has been removed. Use `").concat(n,"` instead"))}probe(t,n){return this._getLogFunction(t,n,ne.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,ne.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,ne.debug||ne.info,arguments,qt)}table(t,n,r){return n?this._getLogFunction(t,n,console.table||D,r&&[r],{tag:Gr(n)}):D}image(t){let{logLevel:n,priority:r,image:o,message:i="",scale:s=1}=t;return this._shouldLog(n||r)?N()?Or({image:o,message:i,scale:s}):Cr({image:o,message:i,scale:s}):D}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||D)}group(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},o=en({logLevel:t,message:n,opts:r}),{collapsed:i}=r;return o.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(o)}groupCollapsed(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,n,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||D)}withGroup(t,n,r){this.group(t,n)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=tn(t)}_getLogFunction(t,n,r,o,i){if(this._shouldLog(t)){i=en({logLevel:t,message:n,args:o,opts:i}),r=r||i.method,te(r),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=J();let s=i.tag||i.message;if(i.once&&s)if(!Qt[s])Qt[s]=J();else return D;return n=Nr(this.id,i.message,i),r.bind(console,n,...i.args)}return D}};T(Z,"VERSION",De);function tn(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 te(Number.isFinite(t)&&t>=0),t}function en(e){let{logLevel:t,message:n}=e;e.logLevel=tn(t);let r=e.args?Array.from(e.args):[];for(;r.length&&r.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&r.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let o=typeof e.message;return te(o==="string"||o==="object"),Object.assign(e,{args:r},e.opts)}function Nr(e,t,n){if(typeof t=="string"){let r=n.time?Kt(Jt(n.total)):"";t=n.time?"".concat(e,": ").concat(r," ").concat(t):"".concat(e,": ").concat(t),t=Yt(t,n.color,n.background)}return t}function Cr(e){let{image:t,message:n="",scale:r=1}=e;return console.warn("removed"),D}function Or(e){let{image:t,message:n="",scale:r=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let s=Ve(i,n,r);console.log(...s)},i.src=t,D}let o=t.nodeName||"";if(o.toLowerCase()==="img")return console.log(...Ve(t,n,r)),D;if(o.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...Ve(i,n,r)),i.src=t.toDataURL(),D}return D}function Gr(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}var ra=new Z({id:"@probe.gl/log"});var rt="4.3.0-alpha.1",zr=rt[0]>="0"&&rt[0]<="9"?`v${rt}`:"";function jr(){let e=new Z({id:"loaders.gl"});return globalThis.loaders=globalThis.loaders||{},globalThis.loaders.log=e,globalThis.loaders.version=zr,globalThis.probe=globalThis.probe||{},globalThis.probe.loaders=e,e}var ot=jr();var Rr="",nn={};function it(e){for(let t in nn)if(e.startsWith(t)){let n=nn[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Rr}${e}`),e}var he=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Hr(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function Hr(e){let t=e?.fetch;if(t&&typeof t=="function")return(r,o)=>t(r,o);let n=e?.fetch;return n&&typeof n!="function"?r=>fetch(r,n):r=>fetch(r)}var rn="4.3.0-alpha.1";var Zr=globalThis.loaders?.parseImageNode,st=typeof Image<"u",at=typeof ImageBitmap<"u",Wr=Boolean(Zr),lt=qe?!0:Wr;function on(e){switch(e){case"auto":return at||st||lt;case"imagebitmap":return at;case"image":return st;case"data":return lt;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function sn(){if(at)return"imagebitmap";if(st)return"image";if(lt)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Jr(e){let t=Kr(e);if(!t)throw new Error("Not an image");return t}function an(e){switch(Jr(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Kr(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 $r=/^data:image\/svg\+xml/,Yr=/\.svg((\?|#).*)?$/;function Ue(e){return e&&($r.test(e)||Yr.test(e))}function ln(e,t){if(Ue(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return ct(e,t)}function ct(e,t){if(Ue(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ke(e,t,n){let r=ln(e,n),o=self.URL||self.webkitURL,i=typeof r!="string"&&o.createObjectURL(r);try{return await Xr(i||r,t)}finally{i&&o.revokeObjectURL(i)}}async function Xr(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((r,o)=>{try{n.onload=()=>r(n),n.onerror=i=>{let s=i instanceof Error?i.message:"error";o(new Error(s))}}catch(i){o(i)}})}var Qr={},cn=!0;async function fn(e,t,n){let r;Ue(n)?r=await ke(e,t,n):r=ct(e,n);let o=t&&t.imagebitmap;return await qr(r,o)}async function qr(e,t=null){if((eo(t)||!cn)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),cn=!1}return await createImageBitmap(e)}function eo(e){for(let t in e||Qr)return!1;return!0}function un(e){return!oo(e,"ftyp",4)||!(e[8]&96)?null:to(e)}function to(e){switch(no(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function no(e,t,n){return String.fromCharCode(...e.slice(t,n))}function ro(e){return[...e].map(t=>t.charCodeAt(0))}function oo(e,t,n=0){let r=ro(t);for(let o=0;o<r.length;++o)if(r[o]!==e[o+n])return!1;return!0}var z=!1,de=!0;function Ne(e){let t=pe(e);return so(t)||co(t)||ao(t)||lo(t)||io(t)}function io(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=un(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function so(e){let t=pe(e);return t.byteLength>=24&&t.getUint32(0,z)===2303741511?{mimeType:"image/png",width:t.getUint32(16,z),height:t.getUint32(20,z)}:null}function ao(e){let t=pe(e);return t.byteLength>=10&&t.getUint32(0,z)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,de),height:t.getUint16(8,de)}:null}function lo(e){let t=pe(e);return t.byteLength>=14&&t.getUint16(0,z)===16973&&t.getUint32(2,de)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,de),height:t.getUint32(22,de)}:null}function co(e){let t=pe(e);if(!(t.byteLength>=3&&t.getUint16(0,z)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:o}=fo(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,z);if(o.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,z),width:t.getUint16(i+7,z)};if(!r.has(s))return null;i+=2,i+=t.getUint16(i,z)}return null}function fo(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function pe(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 hn(e,t){let{mimeType:n}=Ne(e)||{},r=globalThis.loaders?.parseImageNode;return ue(r),await r(e,n)}async function dn(e,t,n){t=t||{};let o=(t.image||{}).type||"auto",{url:i}=n||{},s=uo(o),a;switch(s){case"imagebitmap":a=await fn(e,t,i);break;case"image":a=await ke(e,t,i);break;case"data":a=await hn(e,t);break;default:ue(!1)}return o==="data"&&(a=an(a)),a}function uo(e){switch(e){case"auto":case"data":return sn();default:return on(e),e}}var ho=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],po=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],go={image:{type:"auto",decode:!0}},ft={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:rn,mimeTypes:po,extensions:ho,parse:dn,tests:[e=>Boolean(Ne(new DataView(e)))],options:go};var ge={x:0,y:1,z:2};function K(e,t={}){let{start:n=0,end:r=e.length,plane:o="xy"}=t,i=t.size||2,s=0,a=ge[o[0]],l=ge[o[1]];for(let c=n,f=r-i;c<r;c+=i)s+=(e[c+a]-e[f+a])*(e[c+l]+e[f+l]),f=c;return s/2}function ht(e,t,n=2,r,o="xy"){let i=t&&t.length,s=i?t[0]*n:e.length,a=gn(e,0,s,n,!0,r&&r[0],o),l=[];if(!a||a.next===a.prev)return l;let c,f,u,h,d,p,y;if(i&&(a=Io(e,t,a,n,r,o)),e.length>80*n){h=f=e[0],d=u=e[1];for(let P=n;P<s;P+=n)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 me(a,l,n,h,d,c,0),l}function gn(e,t,n,r,o,i,s){let a,l;i===void 0&&(i=K(e,{start:t,end:n,size:r,plane:s}));let c=ge[s[0]],f=ge[s[1]];if(o===i<0)for(a=t;a<n;a+=r)l=pn(a,e[a+c],e[a+f],l);else for(a=n-r;a>=t;a-=r)l=pn(a,e[a+c],e[a+f],l);return l&&Ge(l,l.next)&&(xe(l),l=l.next),l}function $(e,t){if(!e)return e;t||(t=e);let n=e,r;do if(r=!1,!n.steiner&&(Ge(n,n.next)||I(n.prev,n,n.next)===0)){if(xe(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function me(e,t,n,r,o,i,s){if(!e)return;!s&&i&&So(e,r,o,i);let a=e,l,c;for(;e.prev!==e.next;){if(l=e.prev,c=e.next,i?wo(e,r,o,i):xo(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(c.i/n|0),xe(e),e=c.next,a=c.next;continue}if(e=c,e===a){s?s===1?(e=vo($(e),t,n),me(e,t,n,r,o,i,2)):s===2&&To(e,t,n,r,o,i):me($(e),t,n,r,o,i,1);break}}}function xo(e){let t=e.prev,n=e,r=e.next;if(I(t,n,r)>=0)return!1;let o=t.x,i=n.x,s=r.x,a=t.y,l=n.y,c=r.y,f=o<i?o<s?o:s:i<s?i:s,u=a<l?a<c?a:c:l<c?l:c,h=o>i?o>s?o:s:i>s?i:s,d=a>l?a>c?a:c:l>c?l:c,p=r.next;for(;p!==t;){if(p.x>=f&&p.x<=h&&p.y>=u&&p.y<=d&&re(o,a,i,l,s,c,p.x,p.y)&&I(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function wo(e,t,n,r){let o=e.prev,i=e,s=e.next;if(I(o,i,s)>=0)return!1;let a=o.x,l=i.x,c=s.x,f=o.y,u=i.y,h=s.y,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,M=ut(d,p,t,n,r),v=ut(y,P,t,n,r),m=e.prevZ,g=e.nextZ;for(;m&&m.z>=M&&g&&g.z<=v;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==o&&m!==s&&re(a,f,l,u,c,h,m.x,m.y)&&I(m.prev,m,m.next)>=0||(m=m.prevZ,g.x>=d&&g.x<=y&&g.y>=p&&g.y<=P&&g!==o&&g!==s&&re(a,f,l,u,c,h,g.x,g.y)&&I(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;m&&m.z>=M;){if(m.x>=d&&m.x<=y&&m.y>=p&&m.y<=P&&m!==o&&m!==s&&re(a,f,l,u,c,h,m.x,m.y)&&I(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!==o&&g!==s&&re(a,f,l,u,c,h,g.x,g.y)&&I(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function vo(e,t,n){let r=e;do{let o=r.prev,i=r.next.next;!Ge(o,i)&&mn(o,r,r.next,i)&&ye(o,i)&&ye(i,o)&&(t.push(o.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),xe(r),xe(r.next),r=e=i),r=r.next}while(r!==e);return $(r)}function To(e,t,n,r,o,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Ao(s,a)){let l=yn(s,a);s=$(s,s.next),l=$(l,l.next),me(s,t,n,r,o,i,0),me(l,t,n,r,o,i,0);return}a=a.next}s=s.next}while(s!==e)}function Io(e,t,n,r,o,i){let s=[],a,l,c,f,u;for(a=0,l=t.length;a<l;a++)c=t[a]*r,f=a<l-1?t[a+1]*r:e.length,u=gn(e,c,f,r,!1,o&&o[a+1],i),u===u.next&&(u.steiner=!0),s.push(Bo(u));for(s.sort(Po),a=0;a<s.length;a++)n=Fo(s[a],n);return n}function Po(e,t){return e.x-t.x}function Fo(e,t){let n=bo(e,t);if(!n)return t;let r=yn(n,e);return $(r,r.next),$(n,n.next)}function bo(e,t){let n=t,r=e.x,o=e.y,i=-1/0,s;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){let h=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>i&&(i=h,s=n.x<n.next.x?n:n.next,h===r))return s}n=n.next}while(n!==t);if(!s)return null;let a=s,l=s.x,c=s.y,f=1/0,u;n=s;do r>=n.x&&n.x>=l&&r!==n.x&&re(o<c?r:i,o,l,c,o<c?i:r,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(r-n.x),ye(n,e)&&(u<f||u===f&&(n.x>s.x||n.x===s.x&&Eo(s,n)))&&(s=n,f=u)),n=n.next;while(n!==a);return s}function Eo(e,t){return I(e.prev,e,t.prev)<0&&I(t.next,e,e.next)<0}function So(e,t,n,r){let o=e;do o.z===0&&(o.z=ut(o.x,o.y,t,n,r)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==e);o.prevZ.nextZ=null,o.prevZ=null,_o(o)}function _o(e){let t,n,r=1,o,i,s,a,l,c;do{for(i=e,e=null,c=null,o=0;i;){for(o++,a=i,s=0,n=0;n<r&&(s++,a=a.nextZ,!!a);n++);for(l=r;s>0||l>0&&a;)s!==0&&(l===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,s--):(t=a,a=a.nextZ,l--),c?c.nextZ=t:e=t,t.prevZ=c,c=t;i=a}c.nextZ=null,r*=2}while(o>1);return e}function ut(e,t,n,r,o){return e=(e-n)*o|0,t=(t-r)*o|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Bo(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function re(e,t,n,r,o,i,s,a){return(o-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(r-a)>=(n-s)*(t-a)&&(n-s)*(i-a)>=(o-s)*(r-a)}function Ao(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Do(e,t)&&(ye(e,t)&&ye(t,e)&&Lo(e,t)&&(I(e.prev,e,t.prev)||I(e,t.prev,t))||Ge(e,t)&&I(e.prev,e,e.next)>0&&I(t.prev,t,t.next)>0)}function I(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ge(e,t){return e.x===t.x&&e.y===t.y}function mn(e,t,n,r){let o=Oe(I(e,t,n)),i=Oe(I(e,t,r)),s=Oe(I(n,r,e)),a=Oe(I(n,r,t));return!!(o!==i&&s!==a||o===0&&Ce(e,n,t)||i===0&&Ce(e,r,t)||s===0&&Ce(n,e,r)||a===0&&Ce(n,t,r))}function Ce(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Oe(e){return e>0?1:e<0?-1:0}function Do(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&mn(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function ye(e,t){return I(e.prev,e,e.next)<0?I(e,t,e.next)>=0&&I(e,e.prev,t)>=0:I(e,t,e.prev)<0||I(e,e.next,t)<0}function Lo(e,t){let n=e,r=!1,o=(e.x+t.x)/2,i=(e.y+t.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&o<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function yn(e,t){let n=new we(e.i,e.x,e.y),r=new we(t.i,t.x,t.y),o=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=o,o.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function pn(e,t,n,r){let o=new we(e,t,n);return r?(o.next=r.next,o.prev=r,r.next.prev=o,r.next=o):(o.prev=o,o.next=o),o}function xe(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 we=class{constructor(t,n,r){T(this,"i",void 0),T(this,"x",void 0),T(this,"y",void 0),T(this,"prev",null),T(this,"next",null),T(this,"z",0),T(this,"prevZ",null),T(this,"nextZ",null),T(this,"steiner",!1),this.i=t,this.x=n,this.y=r}};function gt(e,t,n){let r=No(e),o=Object.keys(r).filter(i=>r[i]!==Array);return Co(e,{propArrayTypes:r,...t},{numericPropKeys:n&&n.numericPropKeys||o,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function No(e){let t={};for(let n of e)if(n.properties)for(let r in n.properties){let o=n.properties[r];t[r]=Ho(o,t[r])}return t}function Co(e,t,n){let{pointPositionsCount:r,pointFeaturesCount:o,linePositionsCount:i,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}=n,M=e[0]&&"id"in e[0],v=e.length>65535?Uint32Array:Uint16Array,m={type:"Point",positions:new y(r*d),globalFeatureIds:new v(r),featureIds:o>65535?new Uint32Array(r):new Uint16Array(r),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new y(i*d),globalFeatureIds:new v(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},_={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&&(_.triangles=[]);for(let U of[m,g,_])for(let b of p){let B=h[b];U.numericProps[b]=new B(U.positions.length/d)}g.pathIndices[s]=i,_.polygonIndices[c]=l,_.primitivePolygonIndices[f]=l;let O={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let U of e){let b=U.geometry,B=U.properties||{};switch(b.type){case"Point":Oo(b,m,O,d,B),m.properties.push(pt(B,p)),M&&m.fields.push({id:U.id}),O.pointFeature++;break;case"LineString":Go(b,g,O,d,B),g.properties.push(pt(B,p)),M&&g.fields.push({id:U.id}),O.lineFeature++;break;case"Polygon":zo(b,_,O,d,B),_.properties.push(pt(B,p)),M&&_.fields.push({id:U.id}),O.polygonFeature++;break;default:throw new Error("Invalid geometry type")}O.feature++}return Ro(m,g,_,d)}function Oo(e,t,n,r,o){t.positions.set(e.data,n.pointPosition*r);let i=e.data.length/r;mt(t,o,n.pointPosition,i),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function Go(e,t,n,r,o){t.positions.set(e.data,n.linePosition*r);let i=e.data.length/r;mt(t,o,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],c=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(c-l)/r}}function zo(e,t,n,r,o){t.positions.set(e.data,n.polygonPosition*r);let i=e.data.length/r;mt(t,o,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=n.polygonPosition;t.polygonIndices[n.polygonObject++]=l;let c=e.areas[s],f=e.indices[s],u=e.indices[s+1];for(let 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[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(P-y)/r}let h=n.polygonPosition;jo(t,c,f,{startPosition:l,endPosition:h,coordLength:r})}}function jo(e,t,n,{startPosition:r,endPosition:o,coordLength:i}){if(!e.triangles)return;let s=r*i,a=o*i,l=e.positions.subarray(s,a),c=n[0],f=n.slice(1).map(h=>(h-c)/i),u=ht(l,f,i,t);for(let h=0,d=u.length;h<d;++h)e.triangles.push(r+u[h])}function dt(e,t){let n={};for(let r in e)n[r]={value:e[r],size:t};return n}function Ro(e,t,n,r){let o={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:r},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:dt(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:r},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:dt(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:r},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:dt(n.numericProps,1)}};return o.polygons&&n.triangles&&(o.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),o}function mt(e,t,n,r){for(let o in e.numericProps)if(o in t){let i=t[o];e.numericProps[o].fill(i,n,n+r)}}function pt(e,t){let n={};for(let r in e)t.includes(r)||(n[r]=e[r]);return n}function Ho(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var It=jt(En(),1);function li(e){let t=0;for(let n=0,r=e.length-1,o,i;n<e.length;r=n++)o=e[n],i=e[r],t+=(i[0]-o[0])*(o[1]+i[1]);return t}function wt(e,t){if(Array.isArray(e[0])){for(let r of e)wt(r,t);return}let n=e;n[0]/=t,n[1]/=t}function Sn(e,t){for(let n=0,r=e.length;n<r;++n)e[n]/=t}function vt(e,t,n){if(typeof e[0][0]!="number"){for(let s of e)vt(s,t,n);return}let r=n*Math.pow(2,t.z),o=n*t.x,i=n*t.y;for(let s=0;s<e.length;s++){let a=e[s];a[0]=(a[0]+o)*360/r-180;let l=180-(a[1]+i)*360/r;a[1]=360/Math.PI*Math.atan(Math.exp(l*Math.PI/180))-90}}function _n(e,t,n){let{x:r,y:o,z:i}=t,s=n*Math.pow(2,i),a=n*r,l=n*o;for(let c=0,f=e.length;c<f;c+=2){e[c]=(e[c]+a)*360/s-180;let u=180-(e[c+1]+l)*360/s;e[c+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function Bn(e){let t=e.length;if(t<=1)return[e];let n=[],r,o;for(let i=0;i<t;i++){let s=li(e[i]);s!==0&&(o===void 0&&(o=s<0),o===s<0?(r&&n.push(r),r=[e[i]]):r&&r.push(e[i]))}return r&&n.push(r),n}function An(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[K(e.data)]],indices:[e.indices]};let r=[],o=[],i=[],s=[],a,l=0;for(let c,f=0,u;f<t;f++){u=e.indices[f]-l,c=e.indices[f+1]-l||e.data.length;let h=e.data.slice(u,c),d=K(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&&(r.push(i),o.push(s)),s=[u],i=[d]):(i.push(d),s.push(u))}return i&&r.push(i),s.length&&o.push(s),{type:n,areas:r,indices:o,data:e.data}}var Y=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,r,o,i,s){this.properties={},this.extent=r,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=o,this._values=i,this._geometryInfo=s,t.readFields(ci,this,n)}toGeoJSONFeature(t,n){let r=this.loadGeometry();switch(t){case"wgs84":return Dn(this,r,o=>vt(o,n,this.extent));default:return Dn(this,r,wt)}}toBinaryFeature(t,n){let r=this.loadFlatGeometry();switch(t){case"wgs84":return this._toBinaryCoordinates(r,o=>_n(o,n,this.extent));default:return this._toBinaryCoordinates(r,Sn)}}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o=0,i=0,s=0,a=1/0,l=-1/0,c=1/0,f=-1/0;for(;t.pos<n;){if(o<=0){let u=t.readVarint();r=u&7,o=u>>3}if(o--,r===1||r===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<c&&(c=s),s>f&&(f=s);else if(r!==7)throw new Error(`unknown command ${r}`)}return[a,c,l,f]}_toBinaryCoordinates(t,n){let r;n(t.data,this.extent);let o=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=t.indices.length,r={type:"Point",...t};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=t.indices.length,this._geometryInfo.linePositionsCount+=t.data.length/o,r={type:"LineString",...t};break;case 3:r=An(t),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=r.indices.length;for(let s of r.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=r.data.length/o;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:r,properties:this.properties};return this.id!==null&&(i.id=this.id),i}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o=0,i=0,s=0,a=[],l;for(;t.pos<n;){if(o<=0){let c=t.readVarint();r=c&7,o=c>>3}switch(o--,r){case 1:case 2:i+=t.readSVarint(),s+=t.readSVarint(),r===1&&(l&&a.push(l),l=[]),l&&l.push([i,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${r}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,r=1,o,i=0,s=0,a=0,l=0,c=[],f=[];for(;t.pos<n;)if(i<=0&&(o=t.readVarint(),r=o&7,i=o>>3),i--,r===1||r===2)s+=t.readSVarint(),a+=t.readSVarint(),r===1&&c.push(l),f.push(s,a),l+=2;else if(r===7){if(l>0){let u=c[c.length-1];f.push(f[u],f[u+1]),l+=2}}else throw new Error(`unknown command ${r}`);return{data:f,indices:c}}};Rt(Y,"types",["Unknown","Point","LineString","Polygon"]);function Dn(e,t,n){let r=Y.types[e.type],o,i,s;switch(e.type){case 1:let l=[];for(o=0;o<t.length;o++)l[o]=t[o][0];s=l,n(s,e.extent);break;case 2:for(s=t,o=0;o<s.length;o++)n(s[o],e.extent);break;case 3:for(s=Bn(t),o=0;o<s.length;o++)for(i=0;i<s[o].length;i++)n(s[o][i],e.extent);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:r=`Multi${r}`;let a={type:"Feature",geometry:{type:r,coordinates:s},properties:e.properties};return e.id!==null&&(a.properties||={},a.properties.id=e.id),a}function ci(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?fi(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function fi(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let r=t._keys[e.readVarint()],o=t._values[e.readVarint()];t.properties[r]=o}}var Re=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ui,this,n),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new Y(this._pbf,n,this.extent,this._keys,this._values)}getBinaryFeature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let r=this._pbf.readVarint()+this._pbf.pos;return new Y(this._pbf,r,this.extent,this._keys,this._values,n)}};function ui(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(hi(n)))}function hi(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let r=e.readVarint()>>3;t=r===1?e.readString():r===2?e.readFloat():r===3?e.readDouble():r===4?e.readVarint64():r===5?e.readVarint():r===6?e.readSVarint():r===7?e.readBoolean():null}return t}var ve=class{layers;constructor(t,n){this.layers=t.readFields(di,{},n)}};function di(e,t,n){if(e===3&&n){let r=new Re(n,n.readVarint()+n.pos);r.length&&t&&(t[r.name]=r)}}function Pt(e,t){let n=gi(t),r=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(r){case"columnar-table":return{shape:"columnar-table",data:Tt(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Ln(e,n)};case"geojson":return Ln(e,n);case"binary-geometry":return Tt(e,n);case"binary":return Tt(e,n);default:throw new Error(r||"undefined shape")}}function Tt(e,t){let[n,r]=pi(e,t),o=gt(n,r);return o.byteLength=e.byteLength,o}function pi(e,t){let n=[],r={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,r];let o=new ve(new It.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(o.layers)).forEach(s=>{let a=o.layers[s];if(a)for(let l=0;l<a.length;l++){let c=a.getBinaryFeature(l,r),f=yi(c,t,s);n.push(f)}}),[n,r]}function Ln(e,t){if(e.byteLength<=0)return[];let n=[],r=new ve(new It.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(i=>{let s=r.layers[i];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),c=mi(l,t,i);n.push(c)}}),n}function gi(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&&ot.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function mi(e,t,n){let r=e.toGeoJSONFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&(r.properties||={},r.properties[t.layerProperty]=n),r}function yi(e,t,n){let r=e.toBinaryFeature(t.coordinates||"local",t.tileIndex);return t.layerProperty&&r.properties&&(r.properties[t.layerProperty]=n),r}var xi="4.3.0-alpha.1",Vn={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:xi,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}}},Ft={...Vn,parse:async(e,t)=>Pt(e,t),parseSync:Pt,binary:!0};var Nn=e=>e!==null&&typeof e=="object";function bt(e,t){if(!e||!Nn(e))return null;let n={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(n.generator=e.generator),typeof e.generator_options=="string"&&(n.generatorOptions=e.generator_options),n.boundingBox=Mn(e.bounds)||Mn(e.antimeridian_adjusted_bounds),n.center=Fi(e.center),n.maxZoom=Un(e.maxzoom),n.minZoom=Un(e.minzoom),typeof e?.json=="string")try{n.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let r=e.tilestats||n.metaJson?.tilestats,o=Ti(r,t),i=wi(e.vector_layers),s=Pi(i,o);return n={...n,layers:s},n.maxZoom===null&&s.length>0&&(n.maxZoom=s[0].maxZoom||null),n.minZoom===null&&s.length>0&&(n.minZoom=s[0].minZoom||null),n}function wi(e){return Array.isArray(e)?e.map(t=>vi(t)):[]}function vi(e){let t=Object.entries(e.fields||[]).map(([r,o])=>({name:r,...zn(String(o))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function Ti(e,t){return Nn(e)&&Array.isArray(e.layers)?e.layers.map(n=>Ii(n,t)):[]}function Ii(e,t){let n=[],r={},o=e.attributes||[];for(let i of o){let s=i.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];r[a]=r[a]||[],r[a].push(i),console.warn("ignoring tilestats indexed field",a)}else n[s]||n.push(Ei(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function Pi(e,t){return e.map(n=>{let r=t.find(s=>s.name===n.name),o=r?.fields||[],i={...n};return delete i.fields,{...i,...r,fields:o}})}function Mn(e){let t=Gn(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(On)&&[t[1],t[3]].every(Cn))return[[t[0],t[1]],[t[2],t[3]]]}function Fi(e){let t=Gn(e);return Array.isArray(t)&&t.length===3&&On(t[0])&&Cn(t[1])&&bi(t[2])?t:null}function Un(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function Cn(e){return Number.isFinite(e)&&e<=90&&e>=-90}function On(e){return Number.isFinite(e)&&e<=180&&e>=-180}function bi(e){return Number.isFinite(e)&&e>=0&&e<=22}function Gn(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var kn={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 Ei(e={},t){let n=zn(e.type),r={name:e.attribute,...n};return typeof e.min=="number"&&(r.min=e.min),typeof e.max=="number"&&(r.max=e.max),typeof e.count=="number"&&(r.uniqueValueCount=e.count),e.values&&(r.values=e.values),r.values&&typeof t.maxValues=="number"&&(r.values=r.values?.slice(0,t.maxValues)),r}function zn(e){let t=e.toLowerCase();return!t||kn[t],kn[t]||{type:"string"}}var Si="4.3.0-alpha.1",Te={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:Si,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),r=JSON.parse(n),o={...Te.options.tilejson,...t?.tilejson};return bt(r,o)},parseTextSync:(e,t)=>{let n=JSON.parse(e),r={...Te.options.tilejson,...t?.tilejson};return bt(n,r)}};var be={};zt(be,{Compression:()=>or,EtagMismatch:()=>Ze,FetchSource:()=>ar,FileSource:()=>as,PMTiles:()=>At,Protocol:()=>ts,ResolvedValueCache:()=>cs,SharedPromiseCache:()=>hr,TileType:()=>ir,bytesToHeader:()=>lr,findTile:()=>sr,getUint64:()=>V,leafletRasterLayer:()=>qi,readVarint:()=>ae,tileIdToZxy:()=>is,zxyToTileId:()=>rr});var X=Math.pow,F=(e,t,n)=>new Promise((r,o)=>{var i=l=>{try{a(n.next(l))}catch(c){o(c)}},s=l=>{try{a(n.throw(l))}catch(c){o(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,s);a((n=n.apply(e,t)).next())}),S=Uint8Array,le=Uint16Array,_i=Int32Array,Hn=new S([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]),Zn=new S([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]),Bi=new S([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wn=function(e,t){for(var n=new le(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new _i(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)o[i]=i-n[r]<<5|r;return{b:n,r:o}},Jn=Wn(Hn,2),Kn=Jn.b,Ai=Jn.r;Kn[28]=258,Ai[258]=28;var $n=Wn(Zn,0),Di=$n.b,oc=$n.r,_t=new le(32768);for(w=0;w<32768;++w)R=(w&43690)>>1|(w&21845)<<1,R=(R&52428)>>2|(R&13107)<<2,R=(R&61680)>>4|(R&3855)<<4,_t[w]=((R&65280)>>8|(R&255)<<8)>>1;var R,w,Pe=function(e,t,n){for(var r=e.length,o=0,i=new le(t);o<r;++o)e[o]&&++i[e[o]-1];var s=new le(t);for(o=1;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;var a;if(n){a=new le(1<<t);var l=15-t;for(o=0;o<r;++o)if(e[o])for(var c=o<<4|e[o],f=t-e[o],u=s[e[o]-1]++<<f,h=u|(1<<f)-1;u<=h;++u)a[_t[u]>>l]=c}else for(a=new le(r),o=0;o<r;++o)e[o]&&(a[o]=_t[s[e[o]-1]++]>>15-e[o]);return a},Fe=new S(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,Yn=new S(32);for(w=0;w<32;++w)Yn[w]=5;var w,Li=Pe(Fe,9,1),Vi=Pe(Yn,5,1),Et=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},C=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},St=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Mi=function(e){return(e+7)/8|0},Ui=function(e,t,n){(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new S(n-t);return r.set(e.subarray(t,n)),r},ki=["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"],E=function(e,t,n){var r=new Error(t||ki[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,E),!n)throw r;return r},Dt=function(e,t,n,r){var o=e.length,i=r?r.length:0;if(!o||t.f&&!t.l)return n||new S(0);var s=!n||t.i!=2,a=t.i;n||(n=new S(o*3));var l=function(Ct){var Ot=n.length;if(Ct>Ot){var Gt=new S(Math.max(Ot*2,Ct));Gt.set(n),n=Gt}},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=o*8;do{if(!h){c=C(e,f,1);var M=C(e,f+1,3);if(f+=3,M)if(M==1)h=Li,d=Vi,p=9,y=5;else if(M==2){var _=C(e,f,31)+257,O=C(e,f+10,15)+4,U=_+C(e,f+5,31)+1;f+=14;for(var b=new S(U),B=new S(19),A=0;A<O;++A)B[Bi[A]]=C(e,f+A*3,7);f+=O*3;for(var Vt=Et(B),pr=(1<<Vt)-1,gr=Pe(B,Vt,1),A=0;A<U;){var Mt=gr[C(e,f,pr)];f+=Mt&15;var v=Mt>>4;if(v<16)b[A++]=v;else{var Q=0,_e=0;for(v==16?(_e=3+C(e,f,3),f+=2,Q=b[A-1]):v==17?(_e=3+C(e,f,7),f+=3):v==18&&(_e=11+C(e,f,127),f+=7);_e--;)b[A++]=Q}}var Ut=b.subarray(0,_),k=b.subarray(_);p=Et(Ut),y=Et(k),h=Pe(Ut,p,1),d=Pe(k,y,1)}else E(1);else{var v=Mi(f)+4,m=e[v-4]|e[v-3]<<8,g=v+m;if(g>o){a&&E(0);break}s&&l(u+m),n.set(e.subarray(v,g),u),t.b=u+=m,t.p=f=g*8,t.f=c;continue}if(f>P){a&&E(0);break}}s&&l(u+131072);for(var mr=(1<<p)-1,yr=(1<<y)-1,Ke=f;;Ke=f){var Q=h[St(e,f)&mr],q=Q>>4;if(f+=Q&15,f>P){a&&E(0);break}if(Q||E(2),q<256)n[u++]=q;else if(q==256){Ke=f,h=null;break}else{var kt=q-254;if(q>264){var A=q-257,ce=Hn[A];kt=C(e,f,(1<<ce)-1)+Kn[A],f+=ce}var $e=d[St(e,f)&yr],Ye=$e>>4;$e||E(3),f+=$e&15;var k=Di[Ye];if(Ye>3){var ce=Zn[Ye];k+=St(e,f)&(1<<ce)-1,f+=ce}if(f>P){a&&E(0);break}s&&l(u+131072);var Xe=u+kt;if(u<k){var Nt=i-k,xr=Math.min(k,Xe);for(Nt+u<0&&E(3);u<xr;++u)n[u]=r[Nt+u]}for(;u<Xe;u+=4)n[u]=n[u-k],n[u+1]=n[u+1-k],n[u+2]=n[u+2-k],n[u+3]=n[u+3-k];u=Xe}}t.l=h,t.p=Ke,t.b=u,t.f=c,h&&(c=1,t.m=p,t.d=d,t.n=y)}while(!c);return u==n.length?n:Ui(n,0,u)},Ni=new S(0),Ci=function(e){(e[0]!=31||e[1]!=139||e[2]!=8)&&E(6,"invalid gzip data");var t=e[3],n=10;t&4&&(n+=(e[10]|e[11]<<8)+2);for(var r=(t>>3&1)+(t>>4&1);r>0;r-=!e[n++]);return n+(t&2)},Oi=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Gi=function(e,t){return((e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&E(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&E(6,"invalid zlib data: "+(e[1]&32?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function zi(e,t){return Dt(e,{i:2},t&&t.out,t&&t.dictionary)}function ji(e,t){var n=Ci(e);return n+8>e.length&&E(6,"invalid gzip data"),Dt(e.subarray(n,-8),{i:2},t&&t.out||new S(Oi(e)),t&&t.dictionary)}function Ri(e,t){return Dt(e.subarray(Gi(e,t&&t.dictionary),-4),{i:2},t&&t.out,t&&t.dictionary)}function Bt(e,t){return e[0]==31&&e[1]==139&&e[2]==8?ji(e,t):(e[0]&15)!=8||e[0]>>4>7||(e[0]<<8|e[1])%31?zi(e,t):Ri(e,t)}var Hi=typeof TextDecoder<"u"&&new TextDecoder,Zi=0;try{Hi.decode(Ni,{stream:!0}),Zi=1}catch{}var Xn=(e,t)=>e*X(2,t),Ie=(e,t)=>Math.floor(e/X(2,t)),He=(e,t)=>Xn(e.getUint16(t+1,!0),8)+e.getUint8(t),Qn=(e,t)=>Xn(e.getUint32(t+2,!0),16)+e.getUint16(t,!0),Wi=(e,t,n,r,o)=>{if(e!==r.getUint8(o))return e-r.getUint8(o);let i=He(r,o+1);if(t!==i)return t-i;let s=He(r,o+4);return n!==s?n-s:0},Ji=(e,t,n,r)=>{let o=qn(e,t|128,n,r);return o?{z:t,x:n,y:r,offset:o[0],length:o[1],isDir:!0}:null},jn=(e,t,n,r)=>{let o=qn(e,t,n,r);return o?{z:t,x:n,y:r,offset:o[0],length:o[1],isDir:!1}:null},qn=(e,t,n,r)=>{let o=0,i=e.byteLength/17-1;for(;o<=i;){let s=i+o>>1,a=Wi(t,n,r,e,s*17);if(a>0)o=s+1;else if(a<0)i=s-1;else return[Qn(e,s*17+7),e.getUint32(s*17+13,!0)]}return null},Ki=(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,er=(e,t)=>{let n=e.getUint8(t*17);return{z:n&127,x:He(e,t*17+1),y:He(e,t*17+4),offset:Qn(e,t*17+7),length:e.getUint32(t*17+13,!0),isDir:n>>7===1}},Rn=e=>{let t=[],n=new DataView(e);for(let r=0;r<n.byteLength/17;r++)t.push(er(n,r));return $i(t)},$i=e=>{e.sort(Ki);let t=new ArrayBuffer(17*e.length),n=new Uint8Array(t);for(let r=0;r<e.length;r++){let o=e[r],i=o.z;o.isDir&&(i=i|128),n[r*17]=i,n[r*17+1]=o.x&255,n[r*17+2]=o.x>>8&255,n[r*17+3]=o.x>>16&255,n[r*17+4]=o.y&255,n[r*17+5]=o.y>>8&255,n[r*17+6]=o.y>>16&255,n[r*17+7]=o.offset&255,n[r*17+8]=Ie(o.offset,8)&255,n[r*17+9]=Ie(o.offset,16)&255,n[r*17+10]=Ie(o.offset,24)&255,n[r*17+11]=Ie(o.offset,32)&255,n[r*17+12]=Ie(o.offset,48)&255,n[r*17+13]=o.length&255,n[r*17+14]=o.length>>8&255,n[r*17+15]=o.length>>16&255,n[r*17+16]=o.length>>24&255}return t},Yi=(e,t)=>{if(e.byteLength<17)return null;let n=e.byteLength/17,r=er(e,n-1);if(r.isDir){let o=r.z,i=t.z-o,s=Math.trunc(t.x/(1<<i)),a=Math.trunc(t.y/(1<<i));return{z:o,x:s,y:a}}return null};function Xi(e){return F(this,null,function*(){let t=yield e.getBytes(0,512e3),n=new DataView(t.data),r=n.getUint32(4,!0),o=n.getUint16(8,!0),i=new TextDecoder("utf-8"),s=JSON.parse(i.decode(new DataView(t.data,10,r))),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:n.getUint16(2,!0),rootDirectoryOffset:10+r,rootDirectoryLength:o*17,jsonMetadataOffset:10,jsonMetadataLength:r,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 Qi(e,t,n,r,o,i,s){return F(this,null,function*(){let a=yield n.getArrayBuffer(t,e.rootDirectoryOffset,e.rootDirectoryLength,e);e.specVersion===1&&(a=Rn(a));let l=jn(new DataView(a),r,o,i);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=Bt(new Uint8Array(u))),{data:u}}let c=Yi(new DataView(a),{z:r,x:o,y:i});if(c){let f=Ji(new DataView(a),c.z,c.x,c.y);if(f){let u=yield n.getArrayBuffer(t,f.offset,f.length,e);e.specVersion===1&&(u=Rn(u));let h=jn(new DataView(u),r,o,i);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=Bt(new Uint8Array(p))),{data:p}}}}})}var tr={getHeader:Xi,getZxy:Qi},qi=(e,t)=>{let n=!1,r="",o=L.GridLayer.extend({createTile:(i,s)=>{let a=document.createElement("img"),l=new AbortController,c=l.signal;return a.cancel=()=>{l.abort()},n||(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?r="image/png":f.tileType===3?r="image/jpeg":f.tileType===4?r="image/webp":f.tileType===5&&(r="image/avif")}),n=!0),e.getZxy(i.z,i.x,i.y,c).then(f=>{if(f){let u=new Blob([f.data],{type:r}),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(i){let s=this._tiles[i];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[i],this.fire("tileunload",{tile:s.el,coords:this._keyToTileCoords(i)}))}});return new o(t)},es=e=>(t,n)=>{if(n instanceof AbortController)return e(t,n);let r=new AbortController;return e(t,r).then(o=>n(void 0,o.data,o.cacheControl||"",o.expires||""),o=>n(o)).catch(o=>n(o)),{cancel:()=>r.abort()}},ts=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 At(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 n=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),r=e.url.match(n);if(!r)throw new Error("Invalid PMTiles protocol URL");let o=r[1],i=this.tiles.get(o);i||(i=new At(o),this.tiles.set(o,i));let s=r[2],a=r[3],l=r[4],c=yield i.getHeader(),f=yield i?.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=es(this.tilev4),this.tiles=new Map}add(e){this.tiles.set(e.source.getKey(),e)}get(e){return this.tiles.get(e)}};function se(e,t){return(t>>>0)*4294967296+(e>>>0)}function ns(e,t){let n=t.buf,r=n[t.pos++],o=(r&112)>>4;if(r<128||(r=n[t.pos++],o|=(r&127)<<3,r<128)||(r=n[t.pos++],o|=(r&127)<<10,r<128)||(r=n[t.pos++],o|=(r&127)<<17,r<128)||(r=n[t.pos++],o|=(r&127)<<24,r<128)||(r=n[t.pos++],o|=(r&1)<<31,r<128))return se(e,o);throw new Error("Expected varint not more than 10 bytes")}function ae(e){let t=e.buf,n=t[e.pos++],r=n&127;return n<128||(n=t[e.pos++],r|=(n&127)<<7,n<128)||(n=t[e.pos++],r|=(n&127)<<14,n<128)||(n=t[e.pos++],r|=(n&127)<<21,n<128)?r:(n=t[e.pos],r|=(n&15)<<28,ns(r,e))}function nr(e,t,n,r){if(r===0){n===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let o=t[0];t[0]=t[1],t[1]=o}}function rs(e,t){let n=X(2,e),r=t,o=t,i=t,s=[0,0],a=1;for(;a<n;)r=1&i/2,o=1&(i^r),nr(a,s,r,o),s[0]+=a*r,s[1]+=a*o,i=i/4,a*=2;return[e,s[0],s[1]]}var os=[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 rr(e,t,n){if(e>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(t>X(2,e)-1||n>X(2,e)-1)throw Error("tile x/y outside zoom level bounds");let r=os[e],o=X(2,e),i=0,s=0,a=0,l=[t,n],c=o/2;for(;c>0;)i=(l[0]&c)>0?1:0,s=(l[1]&c)>0?1:0,a+=c*c*(3*i^s),nr(c,l,i,s),c=c/2;return r+a}function is(e){let t=0,n=0;for(let r=0;r<27;r++){let o=(1<<r)*(1<<r);if(t+o>e)return rs(r,e-t);t+=o}throw Error("Tile zoom level exceeds max safe number limit (26)")}var or=(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))(or||{});function Lt(e,t){return F(this,null,function*(){if(t===1||t===0)return e;if(t===2){if(typeof globalThis.DecompressionStream>"u")return Bt(new Uint8Array(e));let n=new Response(e).body;if(!n)throw Error("Failed to read response stream");let r=n.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(r).arrayBuffer()}throw Error("Compression method not supported")})}var ir=(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))(ir||{}),ss=127;function sr(e,t){let n=0,r=e.length-1;for(;n<=r;){let o=r+n>>1,i=t-e[o].tileId;if(i>0)n=o+1;else if(i<0)r=o-1;else return e[o]}return r>=0&&(e[r].runLength===0||t-e[r].tileId<e[r].runLength)?e[r]:null}var as=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()}})}},ar=class{constructor(e,t=new Headers){this.url=e,this.customHeaders=t,this.mustReload=!1}getKey(){return this.url}setHeaders(e){this.customHeaders=e}getBytes(e,t,n,r){return F(this,null,function*(){let o,i;n?i=n:(o=new AbortController,i=o.signal);let s=new Headers(this.customHeaders);s.set("range",`bytes=${e}-${e+t-1}`);let a;this.mustReload&&(a="reload");let l=yield fetch(this.url,{signal:i,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:i,cache:"reload",headers:{range:`bytes=0-${d-1}`}})}let c=l.headers.get("Etag");if(c?.startsWith("W/")&&(c=null),l.status===416||r&&c&&c!==r)throw this.mustReload=!0,new Ze(r);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 o&&o.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 V(e,t){let n=e.getUint32(t+4,!0),r=e.getUint32(t+0,!0);return n*X(2,32)+r}function lr(e,t){let n=new DataView(e),r=n.getUint8(7);if(r>3)throw Error(`Archive is spec version ${r} but this library supports up to spec version 3`);return{specVersion:r,rootDirectoryOffset:V(n,8),rootDirectoryLength:V(n,16),jsonMetadataOffset:V(n,24),jsonMetadataLength:V(n,32),leafDirectoryOffset:V(n,40),leafDirectoryLength:V(n,48),tileDataOffset:V(n,56),tileDataLength:V(n,64),numAddressedTiles:V(n,72),numTileEntries:V(n,80),numTileContents:V(n,88),clustered:n.getUint8(96)===1,internalCompression:n.getUint8(97),tileCompression:n.getUint8(98),tileType:n.getUint8(99),minZoom:n.getUint8(100),maxZoom:n.getUint8(101),minLon:n.getInt32(102,!0)/1e7,minLat:n.getInt32(106,!0)/1e7,maxLon:n.getInt32(110,!0)/1e7,maxLat:n.getInt32(114,!0)/1e7,centerZoom:n.getUint8(118),centerLon:n.getInt32(119,!0)/1e7,centerLat:n.getInt32(123,!0)/1e7,etag:t}}function cr(e){let t={buf:new Uint8Array(e),pos:0},n=ae(t),r=[],o=0;for(let i=0;i<n;i++){let s=ae(t);r.push({tileId:o+s,offset:0,length:0,runLength:1}),o+=s}for(let i=0;i<n;i++)r[i].runLength=ae(t);for(let i=0;i<n;i++)r[i].length=ae(t);for(let i=0;i<n;i++){let s=ae(t);s===0&&i>0?r[i].offset=r[i-1].offset+r[i-1].length:r[i].offset=s-1}return r}function ls(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 Ze=class extends Error{};function fr(e,t){return F(this,null,function*(){let n=yield e.getBytes(0,16384);if(new DataView(n.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(ls(n.data)<3)return[yield tr.getHeader(e)];let o=n.data.slice(0,ss),i=lr(o,n.etag),s=n.data.slice(i.rootDirectoryOffset,i.rootDirectoryOffset+i.rootDirectoryLength),a=`${e.getKey()}|${i.etag||""}|${i.rootDirectoryOffset}|${i.rootDirectoryLength}`,l=cr(yield t(s,i.internalCompression));return[i,[a,l.length,l]]})}function ur(e,t,n,r,o){return F(this,null,function*(){let i=yield e.getBytes(n,r,void 0,o.etag),s=yield t(i.data,o.internalCompression),a=cr(s);if(a.length===0)throw new Error("Empty directory is invalid");return a})}var cs=class{constructor(e=100,t=!0,n=Lt){this.cache=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=n}getHeader(e){return F(this,null,function*(){let t=e.getKey(),n=this.cache.get(t);if(n)return n.lastUsed=this.counter++,n.data;let r=yield fr(e,this.decompress);return r[1]&&this.cache.set(r[1][0],{lastUsed:this.counter++,data:r[1][2]}),this.cache.set(t,{lastUsed:this.counter++,data:r[0]}),this.prune(),r[0]})}getDirectory(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,i.data;let s=yield ur(e,this.decompress,t,n,r);return this.cache.set(o,{lastUsed:this.counter++,data:s}),this.prune(),s})}getArrayBuffer(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=yield e.getBytes(t,n,void 0,r.etag);return this.cache.set(o,{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((n,r)=>{n.lastUsed<e&&(e=n.lastUsed,t=r)}),t&&this.cache.delete(t)}}invalidate(e){return F(this,null,function*(){this.cache.delete(e.getKey())})}},hr=class{constructor(e=100,t=!0,n=Lt){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=e,this.counter=1,this.decompress=n}getHeader(e){return F(this,null,function*(){let t=e.getKey(),n=this.cache.get(t);if(n)return n.lastUsed=this.counter++,yield n.data;let r=new Promise((o,i)=>{fr(e,this.decompress).then(s=>{s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:Promise.resolve(s[1][2])}),o(s[0]),this.prune()}).catch(s=>{i(s)})});return this.cache.set(t,{lastUsed:this.counter++,data:r}),r})}getDirectory(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=new Promise((a,l)=>{ur(e,this.decompress,t,n,r).then(c=>{a(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}getArrayBuffer(e,t,n,r){return F(this,null,function*(){let o=`${e.getKey()}|${r.etag||""}|${t}|${n}`,i=this.cache.get(o);if(i)return i.lastUsed=this.counter++,yield i.data;let s=new Promise((a,l)=>{e.getBytes(t,n,void 0,r.etag).then(c=>{a(c.data),this.cache.has(o),this.prune()}).catch(c=>{l(c)})});return this.cache.set(o,{lastUsed:this.counter++,data:s}),s})}prune(){if(this.cache.size>=this.maxCacheEntries){let e=1/0,t;this.cache.forEach((n,r)=>{n.lastUsed<e&&(e=n.lastUsed,t=r)}),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 n=new Promise((r,o)=>{this.getHeader(e).then(i=>{r(),this.invalidations.delete(t)}).catch(i=>{o(i)})});this.invalidations.set(t,n)})}},At=class{constructor(e,t,n){typeof e=="string"?this.source=new ar(e):this.source=e,n?this.decompress=n:this.decompress=Lt,t?this.cache=t:this.cache=new hr}getHeader(){return F(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(e,t,n,r){return F(this,null,function*(){let o=rr(e,t,n),i=yield this.cache.getHeader(this.source);if(i.specVersion<3)return tr.getZxy(i,this.source,this.cache,e,t,n,r);if(e<i.minZoom||e>i.maxZoom)return;let s=i.rootDirectoryOffset,a=i.rootDirectoryLength;for(let l=0;l<=3;l++){let c=yield this.cache.getDirectory(this.source,s,a,i),f=sr(c,o);if(f){if(f.runLength>0){let u=yield this.source.getBytes(i.tileDataOffset+f.offset,f.length,r,i.etag);return{data:yield this.decompress(u.data,i.tileCompression),cacheControl:u.cacheControl,expires:u.expires}}s=i.leafDirectoryOffset+f.offset,a=f.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(e,t,n,r){return F(this,null,function*(){try{return yield this.getZxyAttempt(e,t,n,r)}catch(o){if(o instanceof Ze)return this.cache.invalidate(this.source),yield this.getZxyAttempt(e,t,n,r);throw o}})}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),n=yield this.decompress(t.data,e.internalCompression),r=new TextDecoder("utf-8");return JSON.parse(r.decode(n))})}getMetadata(){return F(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(e){if(e instanceof Ze)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw e}})}};var{TileType:Ee}=be;function dr(e,t,n,r){let o=t,i=null;if(o)try{let l=JSON.stringify(o);i=Te.parseTextSync?.(l,r)||null}catch(l){console.warn("PMTiles metadata could not be interpreted as TileJSON",l)}let s={};typeof i?.name=="string"&&(s.name=i.name),typeof i?.htmlAttribution=="string"&&(s.attributions=[i.htmlAttribution]);let a={...s,format:"pmtiles",formatVersion:e.specVersion,attributions:[],tileMIMEType:fs(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&&(a.tilejson=i),n?.includeFormatHeader&&(a.formatHeader=e,a.formatMetadata=a),a}function fs(e){switch(e){case Ee.Mvt:return"application/vnd.mapbox-vector-tile";case Ee.Png:return"image/png";case Ee.Jpeg:return"image/jpeg";case Ee.Webp:return"image/webp";case Ee.Avif:return"image/avif";default:return"application/octet-stream"}}var We=class{blob;key;constructor(t,n){this.blob=t,this.key=n}getKey(){return this.blob.url||""}async getBytes(t,n,r){return{data:await this.blob.slice(t,t+n).arrayBuffer()}}};var{PMTiles:us}=be;var Je=class extends he{data;props;mimeType=null;pmtiles;metadata;constructor(t){super(t),this.props=t;let n=typeof t.url=="string"?it(t.url):new We(t.url,"pmtiles");this.data=t.url,this.pmtiles=new us(n),this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata()}async getSchema(){return{fields:[],metadata:{}}}async getMetadata(){let t=await this.pmtiles.getHeader(),n=await this.pmtiles.getMetadata(),r=dr(t,n,{includeFormatHeader:!1},this.loadOptions);return this.props.attributions&&(r.attributions=[...this.props.attributions,...r.attributions||[]]),r?.tileMIMEType&&(this.mimeType=r?.tileMIMEType),r}async getTile(t){let{x:n,y:r,z:o}=t,s=(await this.pmtiles.getZxy(o,n,r))?.data;return s||null}async getTileData(t){let{x:n,y:r,z:o}=t.index;switch((await this.metadata).tileMIMEType){case"application/vnd.mapbox-vector-tile":return await this.getVectorTile({x:n,y:r,z:o,layers:[]});default:return await this.getImageTile({x:n,y:r,z:o,layers:[]})}}async getImageTile(t){let n=await this.getTile(t);return n?await ft.parse(n,this.loadOptions):null}async getVectorTile(t){let n=await this.getTile(t),r={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:t.x,y:t.y,z:t.z},...this.loadOptions?.mvt},...this.loadOptions};return n?await Ft.parse(n,r):null}};return br(Se);})();
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
ieee754/index.js:
|
package/dist/index.cjs
CHANGED
|
@@ -146,6 +146,9 @@ var PMTilesSource = class extends import_loader_utils.DataSource {
|
|
|
146
146
|
this.getTileData = this.getTileData.bind(this);
|
|
147
147
|
this.metadata = this.getMetadata();
|
|
148
148
|
}
|
|
149
|
+
async getSchema() {
|
|
150
|
+
return { fields: [], metadata: {} };
|
|
151
|
+
}
|
|
149
152
|
async getMetadata() {
|
|
150
153
|
const pmtilesHeader = await this.pmtiles.getHeader();
|
|
151
154
|
const pmtilesMetadata = await this.pmtiles.getMetadata();
|
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"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { PMTilesSource } from \"./pmtiles-source.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';\nexport const PMTilesService = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n options: {\n pmtiles: {}\n },\n createSource: (props) => new PMTilesSource(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 PMTilesSource extends DataSource {\n data;\n props;\n mimeType = null;\n pmtiles;\n metadata;\n constructor(props) {\n super(props);\n this.props = props;\n const url = typeof props.url === 'string' ? resolvePath(props.url) : new BlobSource(props.url, 'pmtiles');\n this.data = props.url;\n this.pmtiles = new PMTiles(url);\n this.getTileData = this.getTileData.bind(this);\n this.metadata = this.getMetadata();\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, pmmetadata, options, loadOptions) {\n const pmtilesMetadata = pmmetadata;\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"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,YAAY,SAAS,aAAa;AAf7E;AAgBI,QAAM,kBAAkB;AAIxB,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;;;ACxEO,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;AAoBb,IAAM,gBAAN,cAA4B,+BAAW;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,YAAY,OAAO;AACf,UAAM,KAAK;AACX,SAAK,QAAQ;AACb,UAAM,MAAM,OAAO,MAAM,QAAQ,eAAW,iCAAY,MAAM,GAAG,IAAI,IAAI,WAAW,MAAM,KAAK,SAAS;AACxG,SAAK,OAAO,MAAM;AAClB,SAAK,UAAU,IAAI,QAAQ,GAAG;AAC9B,SAAK,cAAc,KAAK,YAAY,KAAK,IAAI;AAC7C,SAAK,WAAW,KAAK,YAAY;AAAA,EACrC;AAAA,EACA,MAAM,cAAc;AAChB,UAAM,gBAAgB,MAAM,KAAK,QAAQ,UAAU;AACnD,UAAM,kBAAkB,MAAM,KAAK,QAAQ,YAAY;AACvD,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;
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nexport { PMTilesSource } from \"./pmtiles-source.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';\nexport const PMTilesService = {\n name: 'PMTiles',\n id: 'pmtiles',\n module: 'pmtiles',\n version: VERSION,\n extensions: ['pmtiles'],\n mimeTypes: ['application/octet-stream'],\n options: {\n pmtiles: {}\n },\n createSource: (props) => new PMTilesSource(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 PMTilesSource extends DataSource {\n data;\n props;\n mimeType = null;\n pmtiles;\n metadata;\n constructor(props) {\n super(props);\n this.props = props;\n const url = typeof props.url === 'string' ? resolvePath(props.url) : new BlobSource(props.url, 'pmtiles');\n this.data = props.url;\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, pmmetadata, options, loadOptions) {\n const pmtilesMetadata = pmmetadata;\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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,YAAY,SAAS,aAAa;AAf7E;AAgBI,QAAM,kBAAkB;AAIxB,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;;;ACxEO,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;AAoBb,IAAM,gBAAN,cAA4B,+BAAW;AAAA,EAC1C;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,YAAY,OAAO;AACf,UAAM,KAAK;AACX,SAAK,QAAQ;AACb,UAAM,MAAM,OAAO,MAAM,QAAQ,eAAW,iCAAY,MAAM,GAAG,IAAI,IAAI,WAAW,MAAM,KAAK,SAAS;AACxG,SAAK,OAAO,MAAM;AAClB,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,kBAAkB,MAAM,KAAK,QAAQ,YAAY;AACvD,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;AAvFpC;AAwFQ,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;",
|
|
6
6
|
"names": ["import_mvt", "pmtiles", "pmtiles"]
|
|
7
7
|
}
|
package/dist/pmtiles-source.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Schema } from '@loaders.gl/schema';
|
|
2
|
+
import type { GetTileParameters, GetTileDataParameters } from '@loaders.gl/loader-utils';
|
|
2
3
|
import type { ImageType, DataSourceProps } from '@loaders.gl/loader-utils';
|
|
3
4
|
import type { ImageTileSource, VectorTileSource } from '@loaders.gl/loader-utils';
|
|
4
5
|
import { DataSource } from '@loaders.gl/loader-utils';
|
|
@@ -37,9 +38,10 @@ export declare class PMTilesSource extends DataSource implements ImageTileSource
|
|
|
37
38
|
pmtiles: pmtiles.PMTiles;
|
|
38
39
|
metadata: Promise<PMTilesMetadata>;
|
|
39
40
|
constructor(props: PMTilesSourceProps);
|
|
41
|
+
getSchema(): Promise<Schema>;
|
|
40
42
|
getMetadata(): Promise<PMTilesMetadata>;
|
|
41
43
|
getTile(tileParams: GetTileParameters): Promise<ArrayBuffer | null>;
|
|
42
|
-
getTileData(tileParams:
|
|
44
|
+
getTileData(tileParams: GetTileDataParameters): Promise<any>;
|
|
43
45
|
getImageTile(tileParams: GetTileParameters): Promise<ImageType | null>;
|
|
44
46
|
getVectorTile(tileParams: GetTileParameters): Promise<unknown | null>;
|
|
45
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pmtiles-source.d.ts","sourceRoot":"","sources":["../src/pmtiles-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"pmtiles-source.d.ts","sourceRoot":"","sources":["../src/pmtiles-source.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAC,iBAAiB,EAAE,qBAAqB,EAAC,MAAM,0BAA0B,CAAC;AACvF,OAAO,KAAK,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAC,UAAU,EAAc,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAc,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAY,gBAAgB,EAAE,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AAEnF,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,KAAK,EAAC,eAAe,EAAC,+BAA4B;AAMzD,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,OAAO,EAAE,YAAY,IAAI,OAAO,GAAG;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,YAAY,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,aAAa,EAAE,kBAAkB,CAW/E,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG;IACjD,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,qBAAqB,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;CAC7E,CAAC;AAEF;;;GAGG;AACH,qBAAa,aAAc,SAAQ,UAAW,YAAW,eAAe,EAAE,gBAAgB;IACxF,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC/B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;gBAEvB,KAAK,EAAE,kBAAkB;IAW/B,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAI5B,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC;IAoBvC,OAAO,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAcnE,WAAW,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,GAAG,CAAC;IAa5D,YAAY,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAOtE,aAAa,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;CAc5E"}
|
package/dist/pmtiles-source.js
CHANGED
|
@@ -40,6 +40,9 @@ export class PMTilesSource extends DataSource {
|
|
|
40
40
|
this.getTileData = this.getTileData.bind(this);
|
|
41
41
|
this.metadata = this.getMetadata();
|
|
42
42
|
}
|
|
43
|
+
async getSchema() {
|
|
44
|
+
return { fields: [], metadata: {} };
|
|
45
|
+
}
|
|
43
46
|
async getMetadata() {
|
|
44
47
|
const pmtilesHeader = await this.pmtiles.getHeader();
|
|
45
48
|
const pmtilesMetadata = await this.pmtiles.getMetadata();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/pmtiles",
|
|
3
|
-
"version": "4.3.0-alpha.
|
|
3
|
+
"version": "4.3.0-alpha.2",
|
|
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.0-alpha.
|
|
50
|
-
"@loaders.gl/loader-utils": "4.3.0-alpha.
|
|
51
|
-
"@loaders.gl/mvt": "4.3.0-alpha.
|
|
52
|
-
"@loaders.gl/schema": "4.3.0-alpha.
|
|
49
|
+
"@loaders.gl/images": "4.3.0-alpha.2",
|
|
50
|
+
"@loaders.gl/loader-utils": "4.3.0-alpha.2",
|
|
51
|
+
"@loaders.gl/mvt": "4.3.0-alpha.2",
|
|
52
|
+
"@loaders.gl/schema": "4.3.0-alpha.2",
|
|
53
53
|
"pmtiles": "^3.0.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@loaders.gl/core": "^4.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "77a3cb538ab7a1fbf74245f25590210451689f5c"
|
|
59
59
|
}
|
package/src/pmtiles-source.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {Schema} from '@loaders.gl/schema';
|
|
6
|
+
import type {GetTileParameters, GetTileDataParameters} from '@loaders.gl/loader-utils';
|
|
6
7
|
import type {ImageType, DataSourceProps} from '@loaders.gl/loader-utils';
|
|
7
8
|
import type {ImageTileSource, VectorTileSource} from '@loaders.gl/loader-utils';
|
|
8
9
|
import {DataSource, resolvePath} from '@loaders.gl/loader-utils';
|
|
@@ -75,6 +76,10 @@ export class PMTilesSource extends DataSource implements ImageTileSource, Vector
|
|
|
75
76
|
this.metadata = this.getMetadata();
|
|
76
77
|
}
|
|
77
78
|
|
|
79
|
+
async getSchema(): Promise<Schema> {
|
|
80
|
+
return {fields: [], metadata: {}};
|
|
81
|
+
}
|
|
82
|
+
|
|
78
83
|
async getMetadata(): Promise<PMTilesMetadata> {
|
|
79
84
|
const pmtilesHeader = await this.pmtiles.getHeader();
|
|
80
85
|
const pmtilesMetadata = await this.pmtiles.getMetadata();
|
|
@@ -109,7 +114,7 @@ export class PMTilesSource extends DataSource implements ImageTileSource, Vector
|
|
|
109
114
|
// Tile Source interface implementation: deck.gl compatible API
|
|
110
115
|
// TODO - currently only handles image tiles, not vector tiles
|
|
111
116
|
|
|
112
|
-
async getTileData(tileParams:
|
|
117
|
+
async getTileData(tileParams: GetTileDataParameters): Promise<any> {
|
|
113
118
|
const {x, y, z} = tileParams.index;
|
|
114
119
|
const metadata = await this.metadata;
|
|
115
120
|
switch (metadata.tileMIMEType) {
|