node-red-contrib-web-worldmap
Version:
A Node-RED node to provide a web page of a world map for plotting things on.
1 lines • 99.5 kB
JavaScript
"use strict";var protomapsL=(()=>{var Zr=Object.create;var He=Object.defineProperty;var Jr=Object.getOwnPropertyDescriptor;var Kr=Object.getOwnPropertyNames;var Gr=Object.getPrototypeOf,Qr=Object.prototype.hasOwnProperty;var B=Math.pow;var se=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),en=(t,e)=>{for(var r in e)He(t,r,{get:e[r],enumerable:!0})},Et=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Kr(e))!Qr.call(t,i)&&i!==r&&He(t,i,{get:()=>e[i],enumerable:!(n=Jr(e,i))||n.enumerable});return t};var W=(t,e,r)=>(r=t!=null?Zr(Gr(t)):{},Et(e||!t||!t.__esModule?He(r,"default",{value:t,enumerable:!0}):r,t)),tn=t=>Et(He({},"__esModule",{value:!0}),t);var R=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{o(r.next(l))}catch(c){i(c)}},a=l=>{try{o(r.throw(l))}catch(c){i(c)}},o=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,a);o((r=r.apply(t,e)).next())});var Q=se((Ki,Ut)=>{"use strict";Ut.exports=fe;function fe(t,e){this.x=t,this.y=e}fe.prototype={clone:function(){return new fe(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),s=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};fe.convert=function(t){return t instanceof fe?t:Array.isArray(t)?new fe(t[0],t[1]):t}});var mt=se((is,Zt)=>{"use strict";var pn=Q();Zt.exports=pe;function pe(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(gn,this,e)}function gn(t,e,r){t==1?e.id=r.readVarint():t==2?bn(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function bn(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}pe.types=["Unknown","Point","LineString","Polygon"];pe.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=[],o;t.pos<e;){if(n<=0){var l=t.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=t.readSVarint(),s+=t.readSVarint(),r===1&&(o&&a.push(o),o=[]),o.push(new pn(i,s));else if(r===7)o&&o.push(o[0].clone());else throw new Error("unknown command "+r)}return o&&a.push(o),a};pe.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,c=-1/0;t.pos<e;){if(n<=0){var u=t.readVarint();r=u&7,n=u>>3}if(n--,r===1||r===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>o&&(o=i),s<l&&(l=s),s>c&&(c=s);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,o,c]};pe.prototype.toGeoJSON=function(t,e,r){var n=this.extent*Math.pow(2,r),i=this.extent*t,s=this.extent*e,a=this.loadGeometry(),o=pe.types[this.type],l,c;function u(y){for(var _=0;_<y.length;_++){var k=y[_],f=180-(k.y+s)*360/n;y[_]=[(k.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(f*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(l=0;l<a.length;l++)h[l]=a[l][0];a=h,u(a);break;case 2:for(l=0;l<a.length;l++)u(a[l]);break;case 3:for(a=xn(a),l=0;l<a.length;l++)for(c=0;c<a[l].length;c++)u(a[l][c]);break}a.length===1?a=a[0]:o="Multi"+o;var p={type:"Feature",geometry:{type:o,coordinates:a},properties:this.properties};return"id"in this&&(p.id=this.id),p};function xn(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,s=0;s<e;s++){var a=yn(t[s]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[t[s]]):n.push(t[s]))}return n&&r.push(n),r}function yn(t){for(var e=0,r=0,n=t.length,i=n-1,s,a;r<n;i=r++)s=t[r],a=t[i],e+=(a.x-s.x)*(s.y+a.y);return e}});var pt=se((ss,Kt)=>{"use strict";var wn=mt();Kt.exports=Jt;function Jt(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(_n,this,e),this.length=this._features.length}function _n(t,e,r){t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(vn(r))}function vn(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}Jt.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new wn(this._pbf,e,this.extent,this._keys,this._values)}});var Qt=se((as,Gt)=>{"use strict";var kn=pt();Gt.exports=zn;function zn(t,e){this.layers=t.readFields(Tn,{},e)}function Tn(t,e,r){if(t===3){var n=new kn(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var er=se((os,Ze)=>{Ze.exports.VectorTile=Qt();Ze.exports.VectorTileFeature=mt();Ze.exports.VectorTileLayer=pt()});var tr=se(gt=>{gt.read=function(t,e,r,n,i){var s,a,o=i*8-n-1,l=(1<<o)-1,c=l>>1,u=-7,h=r?i-1:0,p=r?-1:1,y=t[e+h];for(h+=p,s=y&(1<<-u)-1,y>>=-u,u+=o;u>0;s=s*256+t[e+h],h+=p,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=n;u>0;a=a*256+t[e+h],h+=p,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-c}return(y?-1:1)*a*Math.pow(2,s-n)};gt.write=function(t,e,r,n,i,s){var a,o,l,c=s*8-i-1,u=(1<<c)-1,h=u>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,_=n?1:-1,k=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+h>=1?e+=p/l:e+=p*Math.pow(2,1-h),e*l>=2&&(a++,l/=2),a+h>=u?(o=0,a=u):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a=a+h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+y]=o&255,y+=_,o/=256,i-=8);for(a=a<<i|o,c+=i;c>0;t[r+y]=a&255,y+=_,a/=256,c-=8);t[r+y-_]|=k*128}});var or=se((cs,ar)=>{"use strict";ar.exports=P;var Je=tr();function P(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}P.Varint=0;P.Fixed64=1;P.Bytes=2;P.Fixed32=5;var bt=(1<<16)*(1<<16),rr=1/bt,Mn=12,sr=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");P.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=n&7,t(i,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Ke(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=ir(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ke(this.buf,this.pos)+Ke(this.buf,this.pos+4)*bt;return this.pos+=8,t},readSFixed64:function(){var t=Ke(this.buf,this.pos)+ir(this.buf,this.pos+4)*bt;return this.pos+=8,t},readFloat:function(){var t=Je.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Je.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,Pn(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Mn&&sr?Vn(this.buf,e,t):Yn(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==P.Bytes)return t.push(this.readVarint(e));var r=ee(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==P.Bytes)return t.push(this.readSVarint());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==P.Bytes)return t.push(this.readBoolean());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==P.Bytes)return t.push(this.readFloat());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==P.Bytes)return t.push(this.readDouble());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==P.Bytes)return t.push(this.readFixed32());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==P.Bytes)return t.push(this.readSFixed32());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==P.Bytes)return t.push(this.readFixed64());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==P.Bytes)return t.push(this.readSFixed64());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===P.Varint)for(;this.buf[this.pos++]>127;);else if(e===P.Bytes)this.pos=this.readVarint()+this.pos;else if(e===P.Fixed32)this.pos+=4;else if(e===P.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),be(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),be(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),be(this.buf,t&-1,this.pos),be(this.buf,Math.floor(t*rr),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),be(this.buf,t&-1,this.pos),be(this.buf,Math.floor(t*rr),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Ln(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=En(this.buf,t,this.pos);var r=this.pos-e;r>=128&&nr(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Je.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Je.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&nr(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,P.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Cn,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Dn,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Rn,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,An,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Bn,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,jn,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,On,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Xn,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,In,e)},writeBytesField:function(t,e){this.writeTag(t,P.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,P.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,P.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,P.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,P.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,P.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,P.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,P.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,P.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,P.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function Pn(t,e,r){var n=r.buf,i,s;if(s=n[r.pos++],i=(s&112)>>4,s<128||(s=n[r.pos++],i|=(s&127)<<3,s<128)||(s=n[r.pos++],i|=(s&127)<<10,s<128)||(s=n[r.pos++],i|=(s&127)<<17,s<128)||(s=n[r.pos++],i|=(s&127)<<24,s<128)||(s=n[r.pos++],i|=(s&1)<<31,s<128))return ge(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function ee(t){return t.type===P.Bytes?t.readVarint()+t.pos:t.pos+1}function ge(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Ln(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Fn(r,n,e),Sn(n,e)}function Fn(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Sn(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function nr(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Cn(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Dn(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function An(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Bn(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Rn(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function jn(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function On(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Xn(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function In(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Ke(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function be(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function ir(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Yn(t,e,r){for(var n="",i=e;i<r;){var s=t[i],a=null,o=s>239?4:s>223?3:s>191?2:1;if(i+o>r)break;var l,c,u;o===1?s<128&&(a=s):o===2?(l=t[i+1],(l&192)===128&&(a=(s&31)<<6|l&63,a<=127&&(a=null))):o===3?(l=t[i+1],c=t[i+2],(l&192)===128&&(c&192)===128&&(a=(s&15)<<12|(l&63)<<6|c&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):o===4&&(l=t[i+1],c=t[i+2],u=t[i+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(a=(s&15)<<18|(l&63)<<12|(c&63)<<6|u&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,o=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=o}return n}function Vn(t,e,r){return sr.decode(t.subarray(e,r))}function En(t,e,r){for(var n=0,i,s;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(s)if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,s=i;continue}else i=s-55296<<10|i-56320|65536,s=null;else{i>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):s=i;continue}else s&&(t[r++]=239,t[r++]=191,t[r++]=189,s=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=i&63|128)}return r}});var Ir=se((Ct,Dt)=>{(function(t,e){typeof Ct=="object"&&typeof Dt!="undefined"?Dt.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self).RBush=e()})(Ct,function(){"use strict";function t(f,d,m,x,g){(function b(v,w,z,T,M){for(;T>z;){if(T-z>600){var S=T-z+1,A=w-z+1,ae=Math.log(S),G=.5*Math.exp(2*ae/3),Y=.5*Math.sqrt(ae*G*(S-G)/S)*(A-S/2<0?-1:1),q=Math.max(z,Math.floor(w-A*G/S+Y)),Ne=Math.min(T,Math.floor(w+(S-A)*G/S+Y));b(v,w,q,Ne,M)}var X=v[w],oe=z,V=T;for(e(v,z,w),M(v[T],X)>0&&e(v,z,T);oe<V;){for(e(v,oe,V),oe++,V--;M(v[oe],X)<0;)oe++;for(;M(v[V],X)>0;)V--}M(v[z],X)===0?e(v,z,V):e(v,++V,T),V<=w&&(z=V+1),w<=V&&(T=V-1)}})(f,d,m||0,x||f.length-1,g||r)}function e(f,d,m){var x=f[d];f[d]=f[m],f[m]=x}function r(f,d){return f<d?-1:f>d?1:0}var n=function(f){f===void 0&&(f=9),this._maxEntries=Math.max(4,f),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(f,d,m){if(!m)return d.indexOf(f);for(var x=0;x<d.length;x++)if(m(f,d[x]))return x;return-1}function s(f,d){a(f,0,f.children.length,d,f)}function a(f,d,m,x,g){g||(g=_(null)),g.minX=1/0,g.minY=1/0,g.maxX=-1/0,g.maxY=-1/0;for(var b=d;b<m;b++){var v=f.children[b];o(g,f.leaf?x(v):v)}return g}function o(f,d){return f.minX=Math.min(f.minX,d.minX),f.minY=Math.min(f.minY,d.minY),f.maxX=Math.max(f.maxX,d.maxX),f.maxY=Math.max(f.maxY,d.maxY),f}function l(f,d){return f.minX-d.minX}function c(f,d){return f.minY-d.minY}function u(f){return(f.maxX-f.minX)*(f.maxY-f.minY)}function h(f){return f.maxX-f.minX+(f.maxY-f.minY)}function p(f,d){return f.minX<=d.minX&&f.minY<=d.minY&&d.maxX<=f.maxX&&d.maxY<=f.maxY}function y(f,d){return d.minX<=f.maxX&&d.minY<=f.maxY&&d.maxX>=f.minX&&d.maxY>=f.minY}function _(f){return{children:f,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function k(f,d,m,x,g){for(var b=[d,m];b.length;)if(!((m=b.pop())-(d=b.pop())<=x)){var v=d+Math.ceil((m-d)/x/2)*x;t(f,v,d,m,g),b.push(d,v,v,m)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(f){var d=this.data,m=[];if(!y(f,d))return m;for(var x=this.toBBox,g=[];d;){for(var b=0;b<d.children.length;b++){var v=d.children[b],w=d.leaf?x(v):v;y(f,w)&&(d.leaf?m.push(v):p(f,w)?this._all(v,m):g.push(v))}d=g.pop()}return m},n.prototype.collides=function(f){var d=this.data;if(!y(f,d))return!1;for(var m=[];d;){for(var x=0;x<d.children.length;x++){var g=d.children[x],b=d.leaf?this.toBBox(g):g;if(y(f,b)){if(d.leaf||p(f,b))return!0;m.push(g)}}d=m.pop()}return!1},n.prototype.load=function(f){if(!f||!f.length)return this;if(f.length<this._minEntries){for(var d=0;d<f.length;d++)this.insert(f[d]);return this}var m=this._build(f.slice(),0,f.length-1,0);if(this.data.children.length)if(this.data.height===m.height)this._splitRoot(this.data,m);else{if(this.data.height<m.height){var x=this.data;this.data=m,m=x}this._insert(m,this.data.height-m.height-1,!0)}else this.data=m;return this},n.prototype.insert=function(f){return f&&this._insert(f,this.data.height-1),this},n.prototype.clear=function(){return this.data=_([]),this},n.prototype.remove=function(f,d){if(!f)return this;for(var m,x,g,b=this.data,v=this.toBBox(f),w=[],z=[];b||w.length;){if(b||(b=w.pop(),x=w[w.length-1],m=z.pop(),g=!0),b.leaf){var T=i(f,b.children,d);if(T!==-1)return b.children.splice(T,1),w.push(b),this._condense(w),this}g||b.leaf||!p(b,v)?x?(m++,b=x.children[m],g=!1):b=null:(w.push(b),z.push(m),m=0,x=b,b=b.children[0])}return this},n.prototype.toBBox=function(f){return f},n.prototype.compareMinX=function(f,d){return f.minX-d.minX},n.prototype.compareMinY=function(f,d){return f.minY-d.minY},n.prototype.toJSON=function(){return this.data},n.prototype.fromJSON=function(f){return this.data=f,this},n.prototype._all=function(f,d){for(var m=[];f;)f.leaf?d.push.apply(d,f.children):m.push.apply(m,f.children),f=m.pop();return d},n.prototype._build=function(f,d,m,x){var g,b=m-d+1,v=this._maxEntries;if(b<=v)return s(g=_(f.slice(d,m+1)),this.toBBox),g;x||(x=Math.ceil(Math.log(b)/Math.log(v)),v=Math.ceil(b/Math.pow(v,x-1))),(g=_([])).leaf=!1,g.height=x;var w=Math.ceil(b/v),z=w*Math.ceil(Math.sqrt(v));k(f,d,m,z,this.compareMinX);for(var T=d;T<=m;T+=z){var M=Math.min(T+z-1,m);k(f,T,M,w,this.compareMinY);for(var S=T;S<=M;S+=w){var A=Math.min(S+w-1,M);g.children.push(this._build(f,S,A,x-1))}}return s(g,this.toBBox),g},n.prototype._chooseSubtree=function(f,d,m,x){for(;x.push(d),!d.leaf&&x.length-1!==m;){for(var g=1/0,b=1/0,v=void 0,w=0;w<d.children.length;w++){var z=d.children[w],T=u(z),M=(S=f,A=z,(Math.max(A.maxX,S.maxX)-Math.min(A.minX,S.minX))*(Math.max(A.maxY,S.maxY)-Math.min(A.minY,S.minY))-T);M<b?(b=M,g=T<g?T:g,v=z):M===b&&T<g&&(g=T,v=z)}d=v||d.children[0]}var S,A;return d},n.prototype._insert=function(f,d,m){var x=m?f:this.toBBox(f),g=[],b=this._chooseSubtree(x,this.data,d,g);for(b.children.push(f),o(b,x);d>=0&&g[d].children.length>this._maxEntries;)this._split(g,d),d--;this._adjustParentBBoxes(x,g,d)},n.prototype._split=function(f,d){var m=f[d],x=m.children.length,g=this._minEntries;this._chooseSplitAxis(m,g,x);var b=this._chooseSplitIndex(m,g,x),v=_(m.children.splice(b,m.children.length-b));v.height=m.height,v.leaf=m.leaf,s(m,this.toBBox),s(v,this.toBBox),d?f[d-1].children.push(v):this._splitRoot(m,v)},n.prototype._splitRoot=function(f,d){this.data=_([f,d]),this.data.height=f.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(f,d,m){for(var x,g,b,v,w,z,T,M=1/0,S=1/0,A=d;A<=m-d;A++){var ae=a(f,0,A,this.toBBox),G=a(f,A,m,this.toBBox),Y=(g=ae,b=G,v=void 0,w=void 0,z=void 0,T=void 0,v=Math.max(g.minX,b.minX),w=Math.max(g.minY,b.minY),z=Math.min(g.maxX,b.maxX),T=Math.min(g.maxY,b.maxY),Math.max(0,z-v)*Math.max(0,T-w)),q=u(ae)+u(G);Y<M?(M=Y,x=A,S=q<S?q:S):Y===M&&q<S&&(S=q,x=A)}return x||m-d},n.prototype._chooseSplitAxis=function(f,d,m){var x=f.leaf?this.compareMinX:l,g=f.leaf?this.compareMinY:c;this._allDistMargin(f,d,m,x)<this._allDistMargin(f,d,m,g)&&f.children.sort(x)},n.prototype._allDistMargin=function(f,d,m,x){f.children.sort(x);for(var g=this.toBBox,b=a(f,0,d,g),v=a(f,m-d,m,g),w=h(b)+h(v),z=d;z<m-d;z++){var T=f.children[z];o(b,f.leaf?g(T):T),w+=h(b)}for(var M=m-d-1;M>=d;M--){var S=f.children[M];o(v,f.leaf?g(S):S),w+=h(v)}return w},n.prototype._adjustParentBBoxes=function(f,d,m){for(var x=m;x>=0;x--)o(d[x],f)},n.prototype._condense=function(f){for(var d=f.length-1,m=void 0;d>=0;d--)f[d].children.length===0?d>0?(m=f[d-1].children).splice(m.indexOf(f[d]),1):this.clear():s(f[d],this.toBBox)},n})});var Zi={};en(Zi,{CenteredSymbolizer:()=>tt,CenteredTextSymbolizer:()=>ne,CircleSymbolizer:()=>Be,FlexSymbolizer:()=>Ft,Font:()=>qi,GeomType:()=>Mt,GroupSymbolizer:()=>Re,IconSymbolizer:()=>Pt,Index:()=>at,Justify:()=>Br,Labeler:()=>ke,Labelers:()=>ze,LineLabelPlacement:()=>Or,LineLabelSymbolizer:()=>le,LineSymbolizer:()=>O,OffsetSymbolizer:()=>rt,OffsetTextSymbolizer:()=>Oe,Padding:()=>St,PmtilesSource:()=>ve,PolygonSymbolizer:()=>D,Sheet:()=>jt,ShieldSymbolizer:()=>Lt,Static:()=>Bt,TextPlacements:()=>Rr,TextSymbolizer:()=>je,TileCache:()=>Ae,View:()=>st,ZxySource:()=>De,arr:()=>Si,covering:()=>Er,createPattern:()=>Fi,exp:()=>$,getZoom:()=>At,isCcw:()=>Sr,isInRing:()=>Tt,labelRules:()=>Ie,leafletLayer:()=>Hi,linear:()=>nt,paint:()=>Ue,paintRules:()=>Xe,pointInPolygon:()=>Cr,pointMinDistToLines:()=>Ar,pointMinDistToPoints:()=>Dr,sourcesToViews:()=>Ee,step:()=>Bi,toIndex:()=>re,transformGeom:()=>Ve,wrap:()=>Ye});var ie=W(Q(),1);function he(t,e,r){return Math.min(Math.max(t,r),e)}var ft=class extends Error{constructor(e){super(`Failed to parse color: "${e}"`)}},Me=ft;function $t(t){if(typeof t!="string")throw new Me(t);if(t.trim().toLowerCase()==="transparent")return[0,0,0,0];let e=t.trim();e=un.test(t)?sn(t):t;let r=an.exec(e);if(r){let a=Array.from(r).slice(1);return[...a.slice(0,3).map(o=>parseInt(Pe(o,2),16)),parseInt(Pe(a[3]||"f",2),16)/255]}let n=on.exec(e);if(n){let a=Array.from(n).slice(1);return[...a.slice(0,3).map(o=>parseInt(o,16)),parseInt(a[3]||"ff",16)/255]}let i=ln.exec(e);if(i){let a=Array.from(i).slice(1);return[...a.slice(0,3).map(o=>parseInt(o,10)),parseFloat(a[3]||"1")]}let s=cn.exec(e);if(s){let[a,o,l,c]=Array.from(s).slice(1).map(parseFloat);if(he(0,100,o)!==o)throw new Me(t);if(he(0,100,l)!==l)throw new Me(t);return[...fn(a,o,l),Number.isNaN(c)?1:c]}throw new Me(t)}function rn(t){let e=5381,r=t.length;for(;r;)e=e*33^t.charCodeAt(--r);return(e>>>0)%2341}var Nt=t=>parseInt(t.replace(/_/g,""),36),nn="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((t,e)=>{let r=Nt(e.substring(0,3)),n=Nt(e.substring(3)).toString(16),i="";for(let s=0;s<6-n.length;s++)i+="0";return t[r]=`${i}${n}`,t},{});function sn(t){let e=t.toLowerCase().trim(),r=nn[rn(e)];if(!r)throw new Me(t);return`#${r}`}var Pe=(t,e)=>Array.from(Array(e)).map(()=>t).join(""),an=new RegExp(`^#${Pe("([a-f0-9])",3)}([a-f0-9])?$`,"i"),on=new RegExp(`^#${Pe("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),ln=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Pe(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),cn=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,un=/^[a-z]+$/i,Ht=t=>Math.round(t*255),fn=(t,e,r)=>{let n=r/100;if(e===0)return[n,n,n].map(Ht);let i=(t%360+360)%360/60,s=(1-Math.abs(2*n-1))*(e/100),a=s*(1-Math.abs(i%2-1)),o=0,l=0,c=0;i>=0&&i<1?(o=s,l=a):i>=1&&i<2?(o=a,l=s):i>=2&&i<3?(l=s,c=a):i>=3&&i<4?(l=a,c=s):i>=4&&i<5?(o=a,c=s):i>=5&&i<6&&(o=s,c=a);let u=n-s/2,h=o+u,p=l+u,y=c+u;return[h,p,y].map(Ht)};function hn(t,e,r,n){return`rgba(${he(0,255,t).toFixed()}, ${he(0,255,e).toFixed()}, ${he(0,255,r).toFixed()}, ${parseFloat(he(0,1,n).toFixed(3))})`}function qe(t,e,r){let n=(b,v)=>v===3?b:b/255,[i,s,a,o]=$t(t).map(n),[l,c,u,h]=$t(e).map(n),p=h-o,y=r*2-1,k=((y*p===-1?y:y+p/(1+y*p))+1)/2,f=1-k,d=(i*f+l*k)*255,m=(s*f+c*k)*255,x=(a*f+u*k)*255,g=h*r+o*(1-r);return hn(d,m,x,g)}var K=W(Q(),1);var j=class{constructor(e,r){this.str=e!=null?e:r,this.perFeature=typeof this.str=="function"&&this.str.length===2}get(e,r){return typeof this.str=="function"?this.str(e,r):this.str}},C=class{constructor(e,r=1){this.value=e!=null?e:r,this.perFeature=typeof this.value=="function"&&this.value.length===2}get(e,r){return typeof this.value=="function"?this.value(e,r):this.value}},de=class{constructor(e){var r;this.labelProps=(r=e==null?void 0:e.labelProps)!=null?r:["name"],this.textTransform=e==null?void 0:e.textTransform}get(e,r){let n,i;typeof this.labelProps=="function"?i=this.labelProps(e,r):i=this.labelProps;for(let a of i)if(Object.prototype.hasOwnProperty.call(r.props,a)&&typeof r.props[a]=="string"){n=r.props[a];break}let s;return typeof this.textTransform=="function"?s=this.textTransform(e,r):s=this.textTransform,n&&s==="uppercase"?n=n.toUpperCase():n&&s==="lowercase"?n=n.toLowerCase():n&&s==="capitalize"&&(n=n.toLowerCase().split(" ").map(l=>l[0].toUpperCase()+l.slice(1)).join(" ")),n}},me=class{constructor(e){var r,n;e!=null&&e.font?this.font=e.font:(this.family=(r=e==null?void 0:e.fontFamily)!=null?r:"sans-serif",this.size=(n=e==null?void 0:e.fontSize)!=null?n:12,this.weight=e==null?void 0:e.fontWeight,this.style=e==null?void 0:e.fontStyle)}get(e,r){if(this.font)return typeof this.font=="function"?this.font(e,r):this.font;let n="";this.style&&(typeof this.style=="function"?n=`${this.style(e,r)} `:n=`${this.style} `);let i="";this.weight&&(typeof this.weight=="function"?i=`${this.weight(e,r)} `:i=`${this.weight} `);let s;typeof this.size=="function"?s=this.size(e,r):s=this.size;let a;return typeof this.family=="function"?a=this.family(e,r):a=this.family,`${n}${i}${s}px ${a}`}},We=class{constructor(e,r=[]){this.value=e!=null?e:r,this.perFeature=typeof this.value=="function"&&this.value.length===2}get(e,r){return typeof this.value=="function"?this.value(e,r):this.value}};var ht=W(Q(),1);var dn=(t,e,r)=>{let n=[],i,s,a,o=0,l=0,c=0,u=0,h=0,p=0,y=0,_=0,k=0,f=0,d=0,m=0;if(t.length<2)return[];if(t.length===2)return c=Math.sqrt(B(t[1].x-t[0].x,2)+B(t[1].y-t[0].y,2)),[{length:c,beginIndex:0,beginDistance:0,endIndex:2,endDistance:c}];for(u=Math.sqrt(B(t[1].x-t[0].x,2)+B(t[1].y-t[0].y,2)),o=1,l=t.length-1;o<l;o++)i=t[o-1],s=t[o],a=t[o+1],p=s.x-i.x,y=s.y-i.y,_=a.x-s.x,k=a.y-s.y,h=Math.sqrt(_*_+k*k),c+=u,f=Math.acos((p*_+y*k)/(u*h)),(f>e||c-m>r)&&(n.push({length:c-m,beginDistance:m,beginIndex:d,endIndex:o+1,endDistance:c}),d=o,m=c),u=h;return o-d>0&&n.push({length:c-m+h,beginIndex:d,beginDistance:m,endIndex:o+1,endDistance:c+h}),n};function qt(t,e,r,n){let i=[];for(let s of t){let a=dn(s,Math.PI/45,e);for(let o of a)if(o.length>=e+n){let l=new ht.default(s[o.beginIndex].x,s[o.beginIndex].y),c=s[o.endIndex-1],u=new ht.default((c.x-l.x)/o.length,(c.y-l.y)/o.length);for(let h=n;h<o.length-e;h+=r)i.push({start:l.add(u.mult(h)),end:l.add(u.mult(h+e))})}}return i}function Wt(t,e,r,n){let i=e.x-t.x,s=e.y-t.y,a=Math.sqrt(B(e.x-t.x,2)+B(e.y-t.y,2)),o=[];for(let l=0;l<r+n;l+=2*n){let c=l*1/a;o.push({x:t.x+c*i,y:t.y+c*s})}return o}function dt(t,e){if(t.length<=e)return[t];let r=e-1,n=t.lastIndexOf(" ",r),i=t.indexOf(" ",r);if(n===-1&&i===-1)return[t];let s,a;return i===-1||n>=0&&r-n<i-r?(s=t.substring(0,n),a=t.substring(n+1,t.length)):(s=t.substring(0,i),a=t.substring(i+1,t.length)),[s,...dt(a,e)]}var mn="\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DB5\u4E00-\u9FEA\uF900-\uFA6D\uFA70-\uFAD9\u2000",rs=new RegExp(`^[${mn}]+$`);var _e=W(Q(),1),Pr=W(er(),1),Lr=W(or(),1);var we=Math.pow,I=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{o(r.next(l))}catch(c){i(c)}},a=l=>{try{o(r.throw(l))}catch(c){i(c)}},o=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,a);o((r=r.apply(t,e)).next())}),U=Uint8Array,ye=Uint16Array,Un=Int32Array,ur=new U([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]),fr=new U([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]),$n=new U([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hr=function(t,e){for(var r=new ye(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];for(var i=new Un(r[30]),n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return{b:r,r:i}},dr=hr(ur,2),mr=dr.b,Nn=dr.r;mr[28]=258,Nn[258]=28;var pr=hr(fr,0),Hn=pr.b,us=pr.r,wt=new ye(32768);for(F=0;F<32768;++F)te=(F&43690)>>1|(F&21845)<<1,te=(te&52428)>>2|(te&13107)<<2,te=(te&61680)>>4|(te&3855)<<4,wt[F]=((te&65280)>>8|(te&255)<<8)>>1;var te,F,Se=function(t,e,r){for(var n=t.length,i=0,s=new ye(e);i<n;++i)t[i]&&++s[t[i]-1];var a=new ye(e);for(i=1;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(r){o=new ye(1<<e);var l=15-e;for(i=0;i<n;++i)if(t[i])for(var c=i<<4|t[i],u=e-t[i],h=a[t[i]-1]++<<u,p=h|(1<<u)-1;h<=p;++h)o[wt[h]>>l]=c}else for(o=new ye(n),i=0;i<n;++i)t[i]&&(o[i]=wt[a[t[i]-1]++]>>15-t[i]);return o},Ce=new U(288);for(F=0;F<144;++F)Ce[F]=8;var F;for(F=144;F<256;++F)Ce[F]=9;var F;for(F=256;F<280;++F)Ce[F]=7;var F;for(F=280;F<288;++F)Ce[F]=8;var F,gr=new U(32);for(F=0;F<32;++F)gr[F]=5;var F,qn=Se(Ce,9,1),Wn=Se(gr,5,1),xt=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},Z=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(e&7)&r},yt=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},Zn=function(t){return(t+7)/8|0},Jn=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var n=new U(r-e);return n.set(t.subarray(e,r)),n},Kn=["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(t,e,r){var n=new Error(e||Kn[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,E),!r)throw n;return n},kt=function(t,e,r,n){var i=t.length,s=n?n.length:0;if(!i||e.f&&!e.l)return r||new U(0);var a=!r||e.i!=2,o=e.i;r||(r=new U(i*3));var l=function(It){var Yt=r.length;if(It>Yt){var Vt=new U(Math.max(Yt*2,It));Vt.set(r),r=Vt}},c=e.f||0,u=e.p||0,h=e.b||0,p=e.l,y=e.d,_=e.m,k=e.n,f=i*8;do{if(!p){c=Z(t,u,1);var d=Z(t,u+1,3);if(u+=3,d)if(d==1)p=qn,y=Wn,_=9,k=5;else if(d==2){var b=Z(t,u,31)+257,v=Z(t,u+10,15)+4,w=b+Z(t,u+5,31)+1;u+=14;for(var z=new U(w),T=new U(19),M=0;M<v;++M)T[$n[M]]=Z(t,u+M*3,7);u+=v*3;for(var S=xt(T),A=(1<<S)-1,ae=Se(T,S,1),M=0;M<w;){var G=ae[Z(t,u,A)];u+=G&15;var m=G>>4;if(m<16)z[M++]=m;else{var Y=0,q=0;for(m==16?(q=3+Z(t,u,3),u+=2,Y=z[M-1]):m==17?(q=3+Z(t,u,7),u+=3):m==18&&(q=11+Z(t,u,127),u+=7);q--;)z[M++]=Y}}var Ne=z.subarray(0,b),X=z.subarray(b);_=xt(Ne),k=xt(X),p=Se(Ne,_,1),y=Se(X,k,1)}else E(1);else{var m=Zn(u)+4,x=t[m-4]|t[m-3]<<8,g=m+x;if(g>i){o&&E(0);break}a&&l(h+x),r.set(t.subarray(m,g),h),e.b=h+=x,e.p=u=g*8,e.f=c;continue}if(u>f){o&&E(0);break}}a&&l(h+131072);for(var oe=(1<<_)-1,V=(1<<k)-1,ot=u;;ot=u){var Y=p[yt(t,u)&oe],ue=Y>>4;if(u+=Y&15,u>f){o&&E(0);break}if(Y||E(2),ue<256)r[h++]=ue;else if(ue==256){ot=u,p=null;break}else{var Ot=ue-254;if(ue>264){var M=ue-257,Te=ur[M];Ot=Z(t,u,(1<<Te)-1)+mr[M],u+=Te}var lt=y[yt(t,u)&V],ct=lt>>4;lt||E(3),u+=lt&15;var X=Hn[ct];if(ct>3){var Te=fr[ct];X+=yt(t,u)&(1<<Te)-1,u+=Te}if(u>f){o&&E(0);break}a&&l(h+131072);var ut=h+Ot;if(h<X){var Xt=s-X,Wr=Math.min(X,ut);for(Xt+h<0&&E(3);h<Wr;++h)r[h]=n[Xt+h]}for(;h<ut;h+=4)r[h]=r[h-X],r[h+1]=r[h+1-X],r[h+2]=r[h+2-X],r[h+3]=r[h+3-X];h=ut}}e.l=p,e.p=ot,e.b=h,e.f=c,p&&(c=1,e.m=_,e.d=y,e.n=k)}while(!c);return h==r.length?r:Jn(r,0,h)},Gn=new U(0),Qn=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&E(6,"invalid gzip data");var e=t[3],r=10;e&4&&(r+=(t[10]|t[11]<<8)+2);for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!t[r++]);return r+(e&2)},ei=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},ti=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&E(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&E(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function ri(t,e){return kt(t,{i:2},e&&e.out,e&&e.dictionary)}function ni(t,e){var r=Qn(t);return r+8>t.length&&E(6,"invalid gzip data"),kt(t.subarray(r,-8),{i:2},e&&e.out||new U(ei(t)),e&&e.dictionary)}function ii(t,e){return kt(t.subarray(ti(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function _t(t,e){return t[0]==31&&t[1]==139&&t[2]==8?ni(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?ri(t,e):ii(t,e)}var si=typeof TextDecoder!="undefined"&&new TextDecoder,ai=0;try{si.decode(Gn,{stream:!0}),ai=1}catch(t){}var br=(t,e)=>t*we(2,e),Le=(t,e)=>Math.floor(t/we(2,e)),Ge=(t,e)=>br(t.getUint16(e+1,!0),8)+t.getUint8(e),xr=(t,e)=>br(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),oi=(t,e,r,n,i)=>{if(t!==n.getUint8(i))return t-n.getUint8(i);let s=Ge(n,i+1);if(e!==s)return e-s;let a=Ge(n,i+4);return r!==a?r-a:0},li=(t,e,r,n)=>{let i=yr(t,e|128,r,n);return i?{z:e,x:r,y:n,offset:i[0],length:i[1],isDir:!0}:null},lr=(t,e,r,n)=>{let i=yr(t,e,r,n);return i?{z:e,x:r,y:n,offset:i[0],length:i[1],isDir:!1}:null},yr=(t,e,r,n)=>{let i=0,s=t.byteLength/17-1;for(;i<=s;){let a=s+i>>1,o=oi(e,r,n,t,a*17);if(o>0)i=a+1;else if(o<0)s=a-1;else return[xr(t,a*17+7),t.getUint32(a*17+13,!0)]}return null},ci=(t,e)=>t.isDir&&!e.isDir?1:!t.isDir&&e.isDir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,wr=(t,e)=>{let r=t.getUint8(e*17);return{z:r&127,x:Ge(t,e*17+1),y:Ge(t,e*17+4),offset:xr(t,e*17+7),length:t.getUint32(e*17+13,!0),isDir:r>>7===1}},cr=t=>{let e=[],r=new DataView(t);for(let n=0;n<r.byteLength/17;n++)e.push(wr(r,n));return ui(e)},ui=t=>{t.sort(ci);let e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let n=0;n<t.length;n++){let i=t[n],s=i.z;i.isDir&&(s=s|128),r[n*17]=s,r[n*17+1]=i.x&255,r[n*17+2]=i.x>>8&255,r[n*17+3]=i.x>>16&255,r[n*17+4]=i.y&255,r[n*17+5]=i.y>>8&255,r[n*17+6]=i.y>>16&255,r[n*17+7]=i.offset&255,r[n*17+8]=Le(i.offset,8)&255,r[n*17+9]=Le(i.offset,16)&255,r[n*17+10]=Le(i.offset,24)&255,r[n*17+11]=Le(i.offset,32)&255,r[n*17+12]=Le(i.offset,48)&255,r[n*17+13]=i.length&255,r[n*17+14]=i.length>>8&255,r[n*17+15]=i.length>>16&255,r[n*17+16]=i.length>>24&255}return e},fi=(t,e)=>{if(t.byteLength<17)return null;let r=t.byteLength/17,n=wr(t,r-1);if(n.isDir){let i=n.z,s=e.z-i,a=Math.trunc(e.x/(1<<s)),o=Math.trunc(e.y/(1<<s));return{z:i,x:a,y:o}}return null};function hi(t){return I(this,null,function*(){let e=yield t.getBytes(0,512e3),r=new DataView(e.data),n=r.getUint32(4,!0),i=r.getUint16(8,!0),s=new TextDecoder("utf-8"),a=JSON.parse(s.decode(new DataView(e.data,10,n))),o=0;a.compression==="gzip"&&(o=2);let l=0;"minzoom"in a&&(l=+a.minzoom);let c=0;"maxzoom"in a&&(c=+a.maxzoom);let u=0,h=0,p=0,y=-180,_=-85,k=180,f=85;if(a.bounds){let m=a.bounds.split(",");y=+m[0],_=+m[1],k=+m[2],f=+m[3]}if(a.center){let m=a.center.split(",");u=+m[0],h=+m[1],p=+m[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+n,rootDirectoryLength:i*17,jsonMetadataOffset:10,jsonMetadataLength:n,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:o,tileType:1,minZoom:l,maxZoom:c,minLon:y,minLat:_,maxLon:k,maxLat:f,centerZoom:p,centerLon:u,centerLat:h,etag:e.etag}})}function di(t,e,r,n,i,s,a){return I(this,null,function*(){let o=yield r.getArrayBuffer(e,t.rootDirectoryOffset,t.rootDirectoryLength,t);t.specVersion===1&&(o=cr(o));let l=lr(new DataView(o),n,i,s);if(l){let h=(yield e.getBytes(l.offset,l.length,a)).data,p=new DataView(h);return p.getUint8(0)===31&&p.getUint8(1)===139&&(h=_t(new Uint8Array(h))),{data:h}}let c=fi(new DataView(o),{z:n,x:i,y:s});if(c){let u=li(new DataView(o),c.z,c.x,c.y);if(u){let h=yield r.getArrayBuffer(e,u.offset,u.length,t);t.specVersion===1&&(h=cr(h));let p=lr(new DataView(h),n,i,s);if(p){let _=(yield e.getBytes(p.offset,p.length,a)).data,k=new DataView(_);return k.getUint8(0)===31&&k.getUint8(1)===139&&(_=_t(new Uint8Array(_))),{data:_}}}}})}var _r={getHeader:hi,getZxy:di};function xe(t,e){return(e>>>0)*4294967296+(t>>>0)}function mi(t,e){let r=e.buf,n=r[e.pos++],i=(n&112)>>4;if(n<128||(n=r[e.pos++],i|=(n&127)<<3,n<128)||(n=r[e.pos++],i|=(n&127)<<10,n<128)||(n=r[e.pos++],i|=(n&127)<<17,n<128)||(n=r[e.pos++],i|=(n&127)<<24,n<128)||(n=r[e.pos++],i|=(n&1)<<31,n<128))return xe(t,i);throw new Error("Expected varint not more than 10 bytes")}function Fe(t){let e=t.buf,r=e[t.pos++],n=r&127;return r<128||(r=e[t.pos++],n|=(r&127)<<7,r<128)||(r=e[t.pos++],n|=(r&127)<<14,r<128)||(r=e[t.pos++],n|=(r&127)<<21,r<128)?n:(r=e[t.pos],n|=(r&15)<<28,mi(n,t))}function pi(t,e,r,n){if(n===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let i=e[0];e[0]=e[1],e[1]=i}}var gi=[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 bi(t,e,r){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>we(2,t)-1||r>we(2,t)-1)throw Error("tile x/y outside zoom level bounds");let n=gi[t],i=we(2,t),s=0,a=0,o=0,l=[e,r],c=i/2;for(;c>0;)s=(l[0]&c)>0?1:0,a=(l[1]&c)>0?1:0,o+=c*c*(3*s^a),pi(c,l,s,a),c=c/2;return n+o}function vr(t,e){return I(this,null,function*(){if(e===1||e===0)return t;if(e===2){if(typeof globalThis.DecompressionStream=="undefined")return _t(new Uint8Array(t));let r=new Response(t).body;if(!r)throw Error("Failed to read response stream");let n=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(n).arrayBuffer()}throw Error("Compression method not supported")})}var xi=127;function yi(t,e){let r=0,n=t.length-1;for(;r<=n;){let i=n+r>>1,s=e-t[i].tileId;if(s>0)r=i+1;else if(s<0)n=i-1;else return t[i]}return n>=0&&(t[n].runLength===0||e-t[n].tileId<t[n].runLength)?t[n]:null}var wi=class{constructor(t,e=new Headers){this.url=t,this.customHeaders=e,this.mustReload=!1}getKey(){return this.url}setHeaders(t){this.customHeaders=t}getBytes(t,e,r,n){return I(this,null,function*(){let i,s;r?s=r:(i=new AbortController,s=i.signal);let a=new Headers(this.customHeaders);a.set("range",`bytes=${t}-${t+e-1}`);let o;this.mustReload&&(o="reload");let l=yield fetch(this.url,{signal:s,cache:o,headers:a});if(t===0&&l.status===416){let p=l.headers.get("Content-Range");if(!p||!p.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let y=+p.substr(8);l=yield fetch(this.url,{signal:s,cache:"reload",headers:{range:`bytes=0-${y-1}`}})}let c=l.headers.get("Etag");if(c!=null&&c.startsWith("W/")&&(c=null),l.status===416||n&&c&&c!==n)throw this.mustReload=!0,new vt(n);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);let u=l.headers.get("Content-Length");if(l.status===200&&(!u||+u>e))throw i&&i.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:c||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function J(t,e){let r=t.getUint32(e+4,!0),n=t.getUint32(e+0,!0);return r*we(2,32)+n}function _i(t,e){let r=new DataView(t),n=r.getUint8(7);if(n>3)throw Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:J(r,8),rootDirectoryLength:J(r,16),jsonMetadataOffset:J(r,24),jsonMetadataLength:J(r,32),leafDirectoryOffset:J(r,40),leafDirectoryLength:J(r,48),tileDataOffset:J(r,56),tileDataLength:J(r,64),numAddressedTiles:J(r,72),numTileEntries:J(r,80),numTileContents:J(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:e}}function kr(t){let e={buf:new Uint8Array(t),pos:0},r=Fe(e),n=[],i=0;for(let s=0;s<r;s++){let a=Fe(e);n.push({tileId:i+a,offset:0,length:0,runLength:1}),i+=a}for(let s=0;s<r;s++)n[s].runLength=Fe(e);for(let s=0;s<r;s++)n[s].length=Fe(e);for(let s=0;s<r;s++){let a=Fe(e);a===0&&s>0?n[s].offset=n[s-1].offset+n[s-1].length:n[s].offset=a-1}return n}function vi(t){let e=new DataView(t);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.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 vt=class extends Error{};function ki(t,e){return I(this,null,function*(){let r=yield t.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(vi(r.data)<3)return[yield _r.getHeader(t)];let i=r.data.slice(0,xi),s=_i(i,r.etag),a=r.data.slice(s.rootDirectoryOffset,s.rootDirectoryOffset+s.rootDirectoryLength),o=`${t.getKey()}|${s.etag||""}|${s.rootDirectoryOffset}|${s.rootDirectoryLength}`,l=kr(yield e(a,s.internalCompression));return[s,[o,l.length,l]]})}function zi(t,e,r,n,i){return I(this,null,function*(){let s=yield t.getBytes(r,n,void 0,i.etag),a=yield e(s.data,i.internalCompression),o=kr(a);if(o.length===0)throw new Error("Empty directory is invalid");return o})}var Ti=class{constructor(t=100,e=!0,r=vr){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=r}getHeader(t){return I(this,null,function*(){let e=t.getKey(),r=this.cache.get(e);if(r)return r.lastUsed=this.counter++,yield r.data;let n=new Promise((i,s)=>{ki(t,this.decompress).then(a=>{a[1]&&this.cache.set(a[1][0],{lastUsed:this.counter++,data:Promise.resolve(a[1][2])}),i(a[0]),this.prune()}).catch(a=>{s(a)})});return this.cache.set(e,{lastUsed:this.counter++,data:n}),n})}getDirectory(t,e,r,n){return I(this,null,function*(){let i=`${t.getKey()}|${n.etag||""}|${e}|${r}`,s=this.cache.get(i);if(s)return s.lastUsed=this.counter++,yield s.data;let a=new Promise((o,l)=>{zi(t,this.decompress,e,r,n).then(c=>{o(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:a}),a})}getArrayBuffer(t,e,r,n){return I(this,null,function*(){let i=`${t.getKey()}|${n.etag||""}|${e}|${r}`,s=this.cache.get(i);if(s)return s.lastUsed=this.counter++,yield s.data;let a=new Promise((o,l)=>{t.getBytes(e,r,void 0,n.etag).then(c=>{o(c.data),this.cache.has(i),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:a}),a})}prune(){if(this.cache.size>=this.maxCacheEntries){let t=1/0,e;this.cache.forEach((r,n)=>{r.lastUsed<t&&(t=r.lastUsed,e=n)}),e&&this.cache.delete(e)}}invalidate(t){return I(this,null,function*(){let e=t.getKey();if(this.invalidations.get(e))return yield this.invalidations.get(e);this.cache.delete(t.getKey());let r=new Promise((n,i)=>{this.getHeader(t).then(s=>{n(),this.invalidations.delete(e)}).catch(s=>{i(s)})});this.invalidations.set(e,r)})}},zr=class{constructor(t,e,r){typeof t=="string"?this.source=new wi(t):this.source=t,r?this.decompress=r:this.decompress=vr,e?this.cache=e:this.cache=new Ti}getHeader(){return I(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,r,n){return I(this,null,function*(){let i=bi(t,e,r),s=yield this.cache.getHeader(this.source);if(s.specVersion<3)return _r.getZxy(s,this.source,this.cache,t,e,r,n);if(t<s.minZoom||t>s.maxZoom)return;let a=s.rootDirectoryOffset,o=s.rootDirectoryLength;for(let l=0;l<=3;l++){let c=yield this.cache.getDirectory(this.source,a,o,s),u=yi(c,i);if(u){if(u.runLength>0){let h=yield this.source.getBytes(s.tileDataOffset+u.offset,u.length,n,s.etag);return{data:yield this.decompress(h.data,s.tileCompression),cacheControl:h.cacheControl,expires:h.expires}}a=s.leafDirectoryOffset+u.offset,o=u.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,r,n){return I(this,null,function*(){try{return yield this.getZxyAttempt(t,e,r,n)}catch(i){if(i instanceof vt)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,r,n);throw i}})}getMetadataAttempt(){return I(this,null,function*(){let t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength,void 0,t.etag),r=yield this.decompress(e.data,t.internalCompression),n=new TextDecoder("utf-8");return JSON.parse(n.decode(r))})}getMetadata(){return I(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof vt)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}})}};var Mt=(n=>(n[n.Point=1]="Point",n[n.Line=2]="Line",n[n.Polygon=3]="Polygon",n))(Mt||{});function re(t){return`${t.x}:${t.y}:${t.z}`}var Mi=(t,e,r)=>{t.pos=e;let n=t.readVarint()+t.pos,i=1,s=0,a=0,o=0,l=1/0,c=-1/0,u=1/0,h=-1/0,p=[],y=[];for(;t.pos<n;){if(s<=0){let _=t.readVarint();i=_&7,s=_>>3}if(s--,i===1||i===2)a+=t.readSVarint()*r,o+=t.readSVarint()*r,a<l&&(l=a),a>c&&(c=a),o<u&&(u=o),o>h&&(h=o),i===1&&(y.length>0&&p.push(y),y=[]),y.push(new _e.default(a,o));else if(i===7)y&&y.push(y[0].clone(