From 01d5c5610b65c862d937401643d62e108b1d86c1 Mon Sep 17 00:00:00 2001 From: Helena Rasche Date: Fri, 24 May 2024 11:32:36 +0200 Subject: [PATCH] After geocoding, self-host pmtiles --- _layouts/event.html | 12 ++++-------- assets/js/protomaps-leaflet.min.js | 9 +++++++++ bin/geocode.rb | 13 +++++++++++++ 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 assets/js/protomaps-leaflet.min.js diff --git a/_layouts/event.html b/_layouts/event.html index a0359a2b6400b3..232d3cec3596c1 100644 --- a/_layouts/event.html +++ b/_layouts/event.html @@ -71,15 +71,14 @@

Requirements

Event Location

+
diff --git a/assets/js/protomaps-leaflet.min.js b/assets/js/protomaps-leaflet.min.js new file mode 100644 index 00000000000000..bbe32bb85b036d --- /dev/null +++ b/assets/js/protomaps-leaflet.min.js @@ -0,0 +1,9 @@ +"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>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>3}if(n--,r===1||r===2)i+=t.readSVarint(),s+=t.readSVarint(),io&&(o=i),sc&&(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;_{"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>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<>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<>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<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>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.pos127;);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;e268435455||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=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>>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;i239?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;n55295&&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);oe0;)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 fd?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=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=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=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;oe||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=0&&r-nnew 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<>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>l]=c}else for(o=new ye(n),i=0;i>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;re&&(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>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<>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<>4;lt||E(3),u+=lt&15;var X=Hn[ct];if(ct>3){var Te=fr[ct];X+=yt(t,u)&(1<f){o&&E(0);break}a&&l(h+131072);var ut=h+Ot;if(h>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{t.sort(ci);let e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let n=0;n>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<>>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=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;s0?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{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(ts.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>3}if(s--,i===1||i===2)a+=t.readSVarint()*r,o+=t.readSVarint()*r,ac&&(c=a),oh&&(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());else throw new Error(`unknown command ${i}`)}return y&&p.push(y),{geom:p,bbox:{minX:l,minY:u,maxX:c,maxY:h}}};function Fr(t,e){let r=new Pr.VectorTile(new Lr.default(t)),n=new Map;for(let[i,s]of Object.entries(r.layers)){let a=[],o=s;for(let l=0;la.z!==e.z?(a.controller.abort(),!1):!0));let n=new AbortController;this.zoomaborts.push({z:e.z,controller:n});let i=n.signal,s=yield this.p.getZxy(e.z,e.x,e.y,i);return s?Fr(s.data,r):new Map})}},De=class{constructor(e,r){this.url=e,this.zoomaborts=[],this.shouldCancelZooms=r}get(e,r){return R(this,null,function*(){this.shouldCancelZooms&&(this.zoomaborts=this.zoomaborts.filter(a=>a.z!==e.z?(a.controller.abort(),!1):!0));let n=this.url.replace("{z}",e.z.toString()).replace("{x}",e.x.toString()).replace("{y}",e.y.toString()),i=new AbortController;this.zoomaborts.push({z:e.z,controller:i});let s=i.signal;return new Promise((a,o)=>{fetch(n,{signal:s}).then(l=>l.arrayBuffer()).then(l=>{let c=Fr(l,r);a(c)}).catch(l=>{o(l)})})})}},zt=6378137,Tr=85.0511287798,Qe=zt*Math.PI,Pi=t=>{let e=Math.PI/180,r=Math.max(Math.min(Tr,t[0]),-Tr),n=Math.sin(r*e);return new _e.default(zt*t[1]*e,zt*Math.log((1+n)/(1-n))/2)};function Mr(t){return t*t}function et(t,e){return Mr(t.x-e.x)+Mr(t.y-e.y)}function Li(t,e,r){let n=et(e,r);if(n===0)return et(t,e);let i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return i=Math.max(0,Math.min(1,i)),et(t,new _e.default(e.x+i*(r.x-e.x),e.y+i*(r.y-e.y)))}function Tt(t,e){let r=!1;for(let n=0,i=e.length-1;nt.y!=l>t.y&&t.x<(o-s)*(t.y-a)/(l-a)+s&&(r=!r)}return r}function Sr(t){let e=0;for(let r=0;r{let s=this.cache.get(r);if(s)s.used=performance.now(),n(s.data);else{let a=this.inflight.get(r);a?a.push({resolve:n,reject:i}):(this.inflight.set(r,[]),this.source.get(e,this.tileSize).then(o=>{this.cache.set(r,{used:performance.now(),data:o});let l=this.inflight.get(r);if(l)for(let c of l)c.resolve(o);if(this.inflight.delete(r),n(o),this.cache.size>=64){let c=1/0,u;this.cache.forEach((h,p)=>{h.used{let l=this.inflight.get(r);if(l)for(let c of l)c.reject(o);this.inflight.delete(r),i(o)}))}})})}queryFeatures(e,r,n,i){let s=Pi([r,e]),a=new _e.default((s.x+Qe)/(Qe*2),1-(s.y+Qe)/(Qe*2));a.x>1&&(a.x=a.x-Math.floor(a.x));let o=a.mult(1<(n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=3]="Right",n))(Br||{}),Rr=(l=>(l[l.N=1]="N",l[l.Ne=2]="Ne",l[l.E=3]="E",l[l.Se=4]="Se",l[l.S=5]="S",l[l.Sw=6]="Sw",l[l.W=7]="W",l[l.Nw=8]="Nw",l))(Rr||{}),Fi=(t,e,r)=>{let n=document.createElement("canvas"),i=n.getContext("2d");return n.width=t,n.height=e,i!==null&&r(n,i),n},D=class{constructor(e){var r;this.pattern=e.pattern,this.fill=new j(e.fill,"black"),this.opacity=new C(e.opacity,1),this.stroke=new j(e.stroke,"black"),this.width=new C(e.width,0),this.perFeature=(r=this.fill.perFeature||this.opacity.perFeature||this.stroke.perFeature||this.width.perFeature||e.perFeature)!=null?r:!1,this.doStroke=!1}before(e,r){if(!this.perFeature){e.globalAlpha=this.opacity.get(r),e.fillStyle=this.fill.get(r),e.strokeStyle=this.stroke.get(r);let n=this.width.get(r);n>0&&(this.doStroke=!0),e.lineWidth=n}if(this.pattern){let n=e.createPattern(this.pattern,"repeat");n&&(e.fillStyle=n)}}draw(e,r,n,i){let s=!1;if(this.perFeature){e.globalAlpha=this.opacity.get(n,i),e.fillStyle=this.fill.get(n,i);let o=this.width.get(n,i);o&&(s=!0,e.strokeStyle=this.stroke.get(n,i),e.lineWidth=o)}let a=()=>{e.fill(),(s||this.doStroke)&&e.stroke()};e.beginPath();for(let o of r)for(let l=0;l{let n=r-t;return n>=0&&n{if(e.length<1)return 0;if(r<=e[0][0])return e[0][1];if(r>=e[e.length-1][0])return e[e.length-1][1];let n=Ci(r,e),i=Ai(r,n,t,e);return Di(i,e[n][1],e[n+1][1])}}function Bi(t,e){return r=>{if(e.length<1)return 0;let n=t;for(let i=0;i=e[i][0]&&(n=e[i][1]);return n}}function nt(t){return $(1,t)}var O=class{constructor(e){var r;this.color=new j(e.color,"black"),this.width=new C(e.width),this.opacity=new C(e.opacity),this.dash=e.dash?new We(e.dash):null,this.dashColor=new j(e.dashColor,"black"),this.dashWidth=new C(e.dashWidth,1),this.lineCap=new j(e.lineCap,"butt"),this.lineJoin=new j(e.lineJoin,"miter"),this.skip=!1,this.perFeature=!!(((r=this.dash)==null?void 0:r.perFeature)||this.color.perFeature||this.opacity.perFeature||this.width.perFeature||this.lineCap.perFeature||this.lineJoin.perFeature||e.perFeature)}before(e,r){this.perFeature||(e.strokeStyle=this.color.get(r),e.lineWidth=this.width.get(r),e.globalAlpha=this.opacity.get(r),e.lineCap=this.lineCap.get(r),e.lineJoin=this.lineJoin.get(r))}draw(e,r,n,i){if(this.skip)return;let s=()=>{this.perFeature&&(e.globalAlpha=this.opacity.get(n,i),e.lineCap=this.lineCap.get(n,i),e.lineJoin=this.lineJoin.get(n,i)),this.dash?(e.save(),this.perFeature?(e.lineWidth=this.dashWidth.get(n,i),e.strokeStyle=this.dashColor.get(n,i),e.setLineDash(this.dash.get(n,i))):e.setLineDash(this.dash.get(n)),e.stroke(),e.restore()):(e.save(),this.perFeature&&(e.lineWidth=this.width.get(n,i),e.strokeStyle=this.color.get(n,i)),e.stroke(),e.restore())};e.beginPath();for(let a of r)for(let o=0;o{h.globalAlpha=1,h.drawImage(this.sheet.canvas,a.x,a.y,a.w,a.h,-a.w/2/this.dpr,-a.h/2/this.dpr,a.w/2,a.h/2)}}]}},Be=class{constructor(e){this.radius=new C(e.radius,3),this.fill=new j(e.fill,"black"),this.stroke=new j(e.stroke,"white"),this.width=new C(e.width,0),this.opacity=new C(e.opacity)}draw(e,r,n,i){e.globalAlpha=this.opacity.get(n,i);let s=this.radius.get(n,i),a=this.width.get(n,i);a>0&&(e.strokeStyle=this.stroke.get(n,i),e.lineWidth=a,e.beginPath(),e.arc(r[0][0].x,r[0][0].y,s+a/2,0,2*Math.PI),e.stroke()),e.fillStyle=this.fill.get(n,i),e.beginPath(),e.arc(r[0][0].x,r[0][0].y,s,0,2*Math.PI),e.fill()}place(e,r,n){let i=r[0],s=new K.default(r[0][0].x,r[0][0].y),a=this.radius.get(e.zoom,n),o={minX:s.x-a,minY:s.y-a,maxX:s.x+a,maxY:s.y+a};return[{anchor:s,bboxes:[o],draw:c=>{this.draw(c,[[new K.default(0,0)]],e.zoom,n)}}]}},Lt=class{constructor(e){this.font=new me(e),this.text=new de(e),this.fill=new j(e.fill,"black"),this.background=new j(e.background,"white"),this.padding=new C(e.padding,0)}place(e,r,n){let i=this.text.get(e.zoom,n);if(!i)return;let s=this.font.get(e.zoom,n);e.scratch.font=s;let a=e.scratch.measureText(i),o=a.width,l=a.actualBoundingBoxAscent,c=a.actualBoundingBoxDescent,u=r[0],h=new K.default(r[0][0].x,r[0][0].y),p=this.padding.get(e.zoom,n),y={minX:h.x-o/2-p,minY:h.y-l-p,maxX:h.x+o/2+p,maxY:h.y+c+p};return[{anchor:h,bboxes:[y],draw:k=>{k.globalAlpha=1,k.fillStyle=this.background.get(e.zoom,n),k.fillRect(-o/2-p,-l-p,o+2*p,l+c+2*p),k.fillStyle=this.fill.get(e.zoom,n),k.font=s,k.fillText(i,-o/2,0)}}]}},Ft=class{constructor(e){this.list=e}place(e,r,n){let i=this.list[0].place(e,r,n);if(!i)return;let s=i[0],a=s.anchor,o=s.bboxes[0],l=o.maxY-o.minY,c=[{draw:s.draw,translate:{x:0,y:0}}],u=[[new K.default(r[0][0].x,r[0][0].y+l)]];for(let p=1;p{for(let y of c)p.save(),p.translate(y.translate.x,y.translate.y),y.draw(p),p.restore()}}]}},jr=(t,e)=>({minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}),Re=class{constructor(e){this.list=e}place(e,r,n){let i=this.list[0];if(!i)return;let s=i.place(e,r,n);if(!s)return;let a=s[0],o=a.anchor,l=a.bboxes[0],c=[a.draw];for(let h=1;h{for(let p of c)p(h)}}]}},tt=class{constructor(e){this.symbolizer=e}place(e,r,n){let i=r[0][0],s=this.symbolizer.place(e,[[new K.default(0,0)]],n);if(!s||s.length===0)return;let a=s[0],o=a.bboxes[0],l=o.maxX-o.minX,c=o.maxY-o.minY,u={minX:i.x-l/2,maxX:i.x+l/2,minY:i.y-c/2,maxY:i.y+c/2};return[{anchor:i,bboxes:[u],draw:p=>{p.translate(-l/2,c/2-o.maxY),a.draw(p,{justify:2})}}]}},St=class{constructor(e,r){this.padding=new C(e,0),this.symbolizer=r}place(e,r,n){let i=this.symbolizer.place(e,r,n);if(!i||i.length===0)return;let s=this.padding.get(e.zoom,n);for(let a of i)for(let o of a.bboxes)o.minX-=s,o.minY-=s,o.maxX+=s,o.maxY+=s;return i}},je=class{constructor(e){this.font=new me(e),this.text=new de(e),this.fill=new j(e.fill,"black"),this.stroke=new j(e.stroke,"black"),this.width=new C(e.width,0),this.lineHeight=new C(e.lineHeight,1),this.letterSpacing=new C(e.letterSpacing,0),this.maxLineCodeUnits=new C(e.maxLineChars,15),this.justify=e.justify}place(e,r,n){let i=this.text.get(e.zoom,n);if(!i)return;let s=this.font.get(e.zoom,n);e.scratch.font=s;let a=this.letterSpacing.get(e.zoom,n),o=dt(i,this.maxLineCodeUnits.get(e.zoom,n)),l="",c=0;for(let m of o)m.length>c&&(c=m.length,l=m);let u=e.scratch.measureText(l),h=u.width+a*(c-1),p=u.actualBoundingBoxAscent,y=u.actualBoundingBoxDescent,_=(p+y)*this.lineHeight.get(e.zoom,n),k=new K.default(r[0][0].x,r[0][0].y),f={minX:k.x,minY:k.y-p,maxX:k.x+h,maxY:k.y+y+(o.length-1)*_};return[{anchor:k,bboxes:[f],draw:(m,x)=>{m.globalAlpha=1,m.font=s,m.fillStyle=this.fill.get(e.zoom,n);let g=this.width.get(e.zoom,n),b=0;for(let v of o){let w=0;if(this.justify===2||x&&x.justify===2?w=(h-m.measureText(v).width)/2:(this.justify===3||x&&x.justify===3)&&(w=h-m.measureText(v).width),g)if(m.lineWidth=g*2,m.strokeStyle=this.stroke.get(e.zoom,n),a>0){let z=w;for(let T of v)m.strokeText(T,z,b),z+=m.measureText(T).width+a}else m.strokeText(v,w,b);if(a>0){let z=w;for(let T of v)m.fillText(T,z,b),z+=m.measureText(T).width+a}else m.fillText(v,w,b);b+=_}}}]}},ne=class{constructor(e){this.centered=new tt(new je(e))}place(e,r,n){return this.centered.place(e,r,n)}},rt=class{constructor(e,r){var n,i,s;this.symbolizer=e,this.offsetX=new C(r.offsetX,0),this.offsetY=new C(r.offsetY,0),this.justify=(n=r.justify)!=null?n:void 0,this.placements=(i=r.placements)!=null?i:[2,6,8,4,1,3,5,7],this.ddValues=(s=r.ddValues)!=null?s:()=>({})}place(e,r,n){if(n.geomType!==1)return;let i=r[0][0],s=this.symbolizer.place(e,[[new K.default(0,0)]],n);if(!s||s.length===0)return;let a=s[0],o=a.bboxes[0],l=this.offsetX,c=this.offsetY,u=this.justify,h=this.placements,{offsetX:p,offsetY:y,justify:_,placements:k}=this.ddValues(e.zoom,n)||{};p&&(l=new C(p,0)),y&&(c=new C(y,0)),_&&(u=_),k&&(h=k);let f=l.get(e.zoom,n),d=c.get(e.zoom,n),m=(w,z)=>({minX:w.x+z.x+o.minX,minY:w.y+z.y+o.minY,maxX:w.x+z.x+o.maxX,maxY:w.y+z.y+o.maxY}),x=new K.default(f,d),g,b=w=>{w.translate(x.x,x.y),a.draw(w,{justify:g})},v=(w,z)=>{let T=m(w,z);if(!e.index.bboxCollides(T,e.order))return[{anchor:i,bboxes:[T],draw:b}]};for(let w of h){let z=this.computeXaxisOffset(f,o,w),T=this.computeYaxisOffset(d,o,w);return g=this.computeJustify(u,w),x=new K.default(z,T),v(i,x)}}computeXaxisOffset(e,r,n){let i=r.maxX,s=i/2;return[1,5].includes(n)?e-s:[8,7,6].includes(n)?e-i:e}computeYaxisOffset(e,r,n){let i=Math.abs(r.minY),s=r.maxY,a=(r.minY+r.maxY)/2;return[3,7].includes(n)?e-a:[8,2,1].includes(n)?e-s:[6,4,5].includes(n)?e+i:e}computeJustify(e,r){return e||([1,5].includes(r)?2:[2,3,4].includes(r)?1:3)}},Oe=class{constructor(e){this.symbolizer=new rt(new je(e),e)}place(e,r,n){return this.symbolizer.place(e,r,n)}},Or=(n=>(n[n.Above=1]="Above",n[n.Center=2]="Center",n[n.Below=3]="Below",n))(Or||{}),le=class{constructor(e){var r;this.font=new me(e),this.text=new de(e),this.fill=new j(e.fill,"black"),this.stroke=new j(e.stroke,"black"),this.width=new C(e.width,0),this.offset=new C(e.offset,0),this.position=(r=e.position)!=null?r:1,this.maxLabelCodeUnits=new C(e.maxLabelChars,40),this.repeatDistance=new C(e.repeatDistance,250)}place(e,r,n){let i=this.text.get(e.zoom,n);if(!i||i.length>this.maxLabelCodeUnits.get(e.zoom,n))return;let s=20,a=n.bbox;if(a.maxY-a.minY4&&(h*=1<({minX:b.x-p/2,minY:b.y-p/2,maxX:b.x+p/2,maxY:b.y+p/2})),g=b=>{b.globalAlpha=1,b.rotate(Math.atan2(d,f)),f<0&&(b.scale(-1,-1),b.translate(-c,0));let v=0;this.position===3?v+=u:this.position===2&&(v+=u/2),b.translate(0,v-this.offset.get(e.zoom,n)),b.font=o;let w=this.width.get(e.zoom,n);w&&(b.lineWidth=w,b.strokeStyle=this.stroke.get(e.zoom,n),b.strokeText(i,0,0)),b.fillStyle=this.fill.get(e.zoom,n),b.fillText(i,0,0)};_.push({anchor:k.start,bboxes:x,draw:g,deduplicationKey:i,deduplicationDistance:h})}return _}};var N=(t,e)=>{let r=t[e];return typeof r=="string"?r:""},Xr=(t,e)=>{let r=t[e];return typeof r=="number"?r:0},Xe=t=>[{dataLayer:"earth",symbolizer:new D({fill:t.earth})},{dataLayer:"landuse",symbolizer:new D({fill:(e,r)=>qe(t.park_a,t.park_b,Math.min(Math.max(e/12,12),0))}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["allotments","village_green","playground"].includes(n)}},{dataLayer:"landuse",symbolizer:new D({fill:t.park_b,opacity:.7}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course"].includes(n)}},{dataLayer:"landuse",symbolizer:new D({fill:t.hospital}),filter:(e,r)=>r.props["pmap:kind"]==="hospital"},{dataLayer:"landuse",symbolizer:new D({fill:t.industrial}),filter:(e,r)=>r.props["pmap:kind"]==="industrial"},{dataLayer:"landuse",symbolizer:new D({fill:t.school}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["school","university","college"].includes(n)}},{dataLayer:"landuse",symbolizer:new D({fill:t.beach}),filter:(e,r)=>r.props["pmap:kind"]==="beach"},{dataLayer:"landuse",symbolizer:new D({fill:t.zoo}),filter:(e,r)=>r.props["pmap:kind"]==="zoo"},{dataLayer:"landuse",symbolizer:new D({fill:t.zoo}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["military","naval_base","airfield"].includes(n)}},{dataLayer:"natural",symbolizer:new D({fill:(e,r)=>qe(t.wood_a,t.wood_b,Math.min(Math.max(e/12,12),0))}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["wood","nature_reserve","forest"].includes(n)}},{dataLayer:"natural",symbolizer:new D({fill:(e,r)=>qe(t.scrub_a,t.scrub_b,Math.min(Math.max(e/12,12),0))}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["scrub","grassland","grass"].includes(n)}},{dataLayer:"natural",symbolizer:new D({fill:t.scrub_b}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["scrub","grassland","grass"].includes(n)}},{dataLayer:"natural",symbolizer:new D({fill:t.glacier}),filter:(e,r)=>r.props["pmap:kind"]==="glacier"},{dataLayer:"natural",symbolizer:new D({fill:t.sand}),filter:(e,r)=>r.props["pmap:kind"]==="sand"},{dataLayer:"landuse",symbolizer:new D({fill:t.aerodrome}),filter:(e,r)=>r.props["pmap:kind"]==="aerodrome"},{dataLayer:"water",symbolizer:new D({fill:t.water})},{dataLayer:"transit",symbolizer:new O({color:t.runway,width:(e,r)=>$(1.6,[[11,0],[13,4],[19,30]])(e)}),filter:(e,r)=>r.props["pmap:kind_detail"]==="runway"},{dataLayer:"transit",symbolizer:new O({color:t.runway,width:(e,r)=>$(1.6,[[14,0],[14.5,1],[16,6]])(e)}),filter:(e,r)=>r.props["pmap:kind_detail"]==="taxiway"},{dataLayer:"transit",symbolizer:new O({color:t.pier,width:(e,r)=>$(1.6,[[13,0],[13.5,0,5],[21,16]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="pier"},{dataLayer:"physical_line",minzoom:14,symbolizer:new O({color:t.water,width:(e,r)=>$(1.6,[[9,0],[9.5,1],[18,12]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="river"},{dataLayer:"physical_line",minzoom:14,symbolizer:new O({color:t.water,width:.5}),filter:(e,r)=>r.props["pmap:kind"]==="stream"},{dataLayer:"landuse",symbolizer:new D({fill:t.pedestrian}),filter:(e,r)=>r.props["pmap:kind"]==="pedestrian"},{dataLayer:"landuse",symbolizer:new D({fill:t.pier}),filter:(e,r)=>r.props["pmap:kind"]==="pier"},{dataLayer:"buildings",symbolizer:new D({fill:t.buildings,opacity:.5})},{dataLayer:"roads",symbolizer:new O({color:t.major,width:(e,r)=>$(1.6,[[14,0],[20,7]])(e)}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["other","path"].includes(n)}},{dataLayer:"roads",symbolizer:new O({color:t.major,width:(e,r)=>$(1.6,[[13,0],[18,8]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="minor_road"},{dataLayer:"roads",symbolizer:new O({color:t.major,width:(e,r)=>$(1.6,[[7,0],[12,1.2],[15,3],[18,13]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="medium_road"},{dataLayer:"roads",symbolizer:new O({color:t.major,width:(e,r)=>$(1.6,[[6,0],[12,1.6],[15,3],[18,13]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="major_road"},{dataLayer:"roads",symbolizer:new O({color:t.major,width:(e,r)=>$(1.6,[[3,0],[6,1.1],[12,1.6],[15,5],[18,15]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="highway"},{dataLayer:"boundaries",symbolizer:new O({dash:[3,2],color:t.boundaries,width:1}),filter:(e,r)=>{let n=r.props["pmap:min_admin_level"];return typeof n=="number"&&n<=2}},{dataLayer:"transit",symbolizer:new O({dash:[.3,.75],color:t.railway,dashWidth:(e,r)=>$(1.6,[[4,0],[7,.15],[19,9]])(e),opacity:.5}),filter:(e,r)=>r.props["pmap:kind"]==="rail"},{dataLayer:"boundaries",symbolizer:new O({dash:[3,2],color:t.boundaries,width:.5}),filter:(e,r)=>{let n=r.props["pmap:min_admin_level"];return typeof n=="number"&&n>2}}],Ie=t=>{let e=["name"];return[{dataLayer:"roads",symbolizer:new le({labelProps:e,fill:t.roads_label_minor,font:"400 12px sans-serif",width:2,stroke:t.roads_label_minor_halo}),minzoom:16,filter:(r,n)=>{let i=N(n.props,"pmap:kind");return["minor_road","other","path"].includes(i)}},{dataLayer:"roads",symbolizer:new le({labelProps:e,fill:t.roads_label_major,font:"400 12px sans-serif",width:2,stroke:t.roads_label_major_halo}),minzoom:12,filter:(r,n)=>{let i=N(n.props,"pmap:kind");return["highway","major_road","medium_road"].includes(i)}},{dataLayer:"roads",symbolizer:new le({labelProps:e,fill:t.roads_label_major,font:"400 12px sans-serif",width:2,stroke:t.roads_label_major_halo}),minzoom:12,filter:(r,n)=>{let i=N(n.props,"pmap:kind");return["highway","major_road","medium_road"].includes(i)}},{dataLayer:"physical_point",symbolizer:new ne({labelProps:e,fill:t.ocean_label,lineHeight:1.5,letterSpacing:1,font:(r,n)=>`400 ${nt([[3,10],[10,12]])(r)}px sans-serif`,textTransform:"uppercase"}),filter:(r,n)=>{let i=N(n.props,"pmap:kind");return["ocean","bay","strait","fjord"].includes(i)}},{dataLayer:"physical_point",symbolizer:new ne({labelProps:e,fill:t.ocean_label,lineHeight:1.5,letterSpacing:1,font:(r,n)=>`400 ${nt([[3,0],[6,12],[10,12]])(r)}px sans-serif`}),filter:(r,n)=>{let i=N(n.props,"pmap:kind");return["sea","lake","water"].includes(i)}},{dataLayer:"places",symbolizer:new ne({labelProps:(r,n)=>r<6?["name:short"]:e,fill:t.state_label,stroke:t.state_label_halo,width:1,lineHeight:1.5,font:(r,n)=>r<6?"400 16px sans-serif":"400 12px sans-serif",textTransform:"uppercase"}),filter:(r,n)=>n.props["pmap:kind"]==="region"},{dataLayer:"places",symbolizer:new ne({labelProps:e,fill:t.country_label,lineHeight:1.5,font:(r,n)=>(r<6,"600 12px sans-serif"),textTransform:"uppercase"}),filter:(r,n)=>n.props["pmap:kind"]==="country"},{dataLayer:"places",minzoom:9,symbolizer:new ne({labelProps:e,fill:t.city_label,lineHeight:1.5,font:(r,n)=>{if(!n)return"400 12px sans-serif";let i=n.props["pmap:min_zoom"],s=400;i&&i<=5&&(s=600);let a=12,o=n.props["pmap:population_rank"];return o&&o>9&&(a=16),`${s} ${a}px sans-serif`}}),sort:(r,n)=>{let i=Xr(r,"pmap:population_rank"),s=Xr(n,"pmap:population_rank");return i-s},filter:(r,n)=>n.props["pmap:kind"]==="locality"},{dataLayer:"places",maxzoom:8,symbolizer:new Re([new Be({radius:2,fill:t.city_circle,stroke:t.city_circle_stroke,width:1.5}),new Oe({labelProps:e,fill:t.city_label,stroke:t.city_label_halo,width:1,offsetX:6,offsetY:4.5,font:(r,n)=>"400 12px sans-serif"})]),filter:(r,n)=>n.props["pmap:kind"]==="locality"}]};var Ri={background:"#cccccc",earth:"#e0e0e0",park_a:"#cfddd5",park_b:"#9cd3b4",hospital:"#e4dad9",industrial:"#d1dde1",school:"#e4ded7",wood_a:"#d0ded0",wood_b:"#a0d9a0",pedestrian:"#e3e0d4",scrub_a:"#cedcd7",scrub_b:"#99d2bb",glacier:"#e7e7e7",sand:"#e2e0d7",beach:"#e8e4d0",aerodrome:"#dadbdf",runway:"#e9e9ed",water:"#80deea",pier:"#e0e0e0",zoo:"#c6dcdc",military:"#dcdcdc",tunnel_other_casing:"#e0e0e0",tunnel_minor_casing:"#e0e0e0",tunnel_link_casing:"#e0e0e0",tunnel_medium_casing:"#e0e0e0",tunnel_major_casing:"#e0e0e0",tunnel_highway_casing:"#e0e0e0",tunnel_other:"#d5d5d5",tunnel_minor:"#d5d5d5",tunnel_link:"#d5d5d5",tunnel_medium:"#d5d5d5",tunnel_major:"#d5d5d5",tunnel_highway:"#d5d5d5",transit_pier:"#e0e0e0",buildings:"#cccccc",minor_service_casing:"#e0e0e0",minor_casing:"#e0e0e0",link_casing:"#e0e0e0",medium_casing:"#e0e0e0",major_casing_late:"#e0e0e0",highway_casing_late:"#e0e0e0",other:"#ebebeb",minor_service:"#ebebeb",minor_a:"#ebebeb",minor_b:"#ffffff",link:"#ffffff",medium:"#f5f5f5",major_casing_early:"#e0e0e0",major:"#ffffff",highway_casing_early:"#e0e0e0",highway:"#ffffff",railway:"#a7b1b3",boundaries:"#adadad",waterway_label:"#ffffff",bridges_other_casing:"#e0e0e0",bridges_minor_casing:"#e0e0e0",bridges_link_casing:"#e0e0e0",bridges_medium_casing:"#e0e0e0",bridges_major_casing:"#e0e0e0",bridges_highway_casing:"#e0e0e0",bridges_other:"#ebebeb",bridges_minor:"#ffffff",bridges_link:"#ffffff",bridges_medium:"#f0eded",bridges_major:"#f5f5f5",bridges_highway:"#ffffff",roads_label_minor:"#91888b",roads_label_minor_halo:"#ffffff",roads_label_major:"#938a8d",roads_label_major_halo:"#ffffff",ocean_label:"#ffffff",peak_label:"#7e9aa0",subplace_label:"#8f8f8f",subplace_label_halo:"#e0e0e0",city_circle:"#ffffff",city_circle_stroke:"#a3a3a3",city_label:"#5c5c5c",city_label_halo:"#e0e0e0",state_label:"#b3b3b3",state_label_halo:"#e0e0e0",country_label:"#a3a3a3"},ji={background:"#34373d",earth:"#1f1f1f",park_a:"#232325",park_b:"#232325",hospital:"#252424",industrial:"#222222",school:"#262323",wood_a:"#202121",wood_b:"#202121",pedestrian:"#1e1e1e",scrub_a:"#222323",scrub_b:"#222323",glacier:"#1c1c1c",sand:"#212123",beach:"#28282a",aerodrome:"#1e1e1e",runway:"#333333",water:"#34373d",pier:"#222222",zoo:"#222323",military:"#242323",tunnel_other_casing:"#141414",tunnel_minor_casing:"#141414",tunnel_link_casing:"#141414",tunnel_medium_casing:"#141414",tunnel_major_casing:"#141414",tunnel_highway_casing:"#141414",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_medium:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",transit_pier:"#333333",buildings:"#111111",minor_service_casing:"#1f1f1f",minor_casing:"#1f1f1f",link_casing:"#1f1f1f",medium_casing:"#1f1f1f",major_casing_late:"#1f1f1f",highway_casing_late:"#1f1f1f",other:"#333333",minor_service:"#333333",minor_a:"#3d3d3d",minor_b:"#333333",link:"#3d3d3d",medium:"#3d3d3d",major_casing_early:"#1f1f1f",major:"#3d3d3d",highway_casing_early:"#1f1f1f",highway:"#474747",railway:"#000000",boundaries:"#5b6374",waterway_label:"#717784",bridges_other_casing:"#2b2b2b",bridges_minor_casing:"#1f1f1f",bridges_link_casing:"#1f1f1f",bridges_medium_casing:"#1f1f1f",bridges_major_casing:"#1f1f1f",bridges_highway_casing:"#1f1f1f",bridges_other:"#333333",bridges_minor:"#333333",bridges_link:"#3d3d3d",bridges_medium:"#3d3d3d",bridges_major:"#3d3d3d",bridges_highway:"#474747",roads_label_minor:"#525252",roads_label_minor_halo:"#1f1f1f",roads_label_major:"#666666",roads_label_major_halo:"#1f1f1f",ocean_label:"#717784",peak_label:"#898080",subplace_label:"#525252",subplace_label_halo:"#1f1f1f",city_circle:"#000000",city_circle_stroke:"#7a7a7a",city_label:"#7a7a7a",city_label_halo:"#212121",state_label:"#3d3d3d",state_label_halo:"#1f1f1f",country_label:"#5c5c5c"},Oi={background:"#ffffff",earth:"#ffffff",park_a:"#fcfcfc",park_b:"#fcfcfc",hospital:"#f8f8f8",industrial:"#fcfcfc",school:"#f8f8f8",wood_a:"#fafafa",wood_b:"#fafafa",pedestrian:"#fdfdfd",scrub_a:"#fafafa",scrub_b:"#fafafa",glacier:"#fcfcfc",sand:"#fafafa",beach:"#f6f6f6",aerodrome:"#fdfdfd",runway:"#efefef",water:"#dcdcdc",pier:"#f5f5f5",zoo:"#f7f7f7",military:"#fcfcfc",tunnel_other_casing:"#d6d6d6",tunnel_minor_casing:"#fcfcfc",tunnel_link_casing:"#fcfcfc",tunnel_medium_casing:"#fcfcfc",tunnel_major_casing:"#fcfcfc",tunnel_highway_casing:"#fcfcfc",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_medium:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",transit_pier:"#efefef",buildings:"#efefef",minor_service_casing:"#ffffff",minor_casing:"#ffffff",link_casing:"#ffffff",medium_casing:"#ffffff",major_casing_late:"#ffffff",highway_casing_late:"#ffffff",other:"#f5f5f5",minor_service:"#f5f5f5",minor_a:"#ebebeb",minor_b:"#f5f5f5",link:"#ebebeb",medium:"#ebebeb",major_casing_early:"#ffffff",major:"#ebebeb",highway_casing_early:"#ffffff",highway:"#ebebeb",railway:"#d6d6d6",boundaries:"#adadad",waterway_label:"#adadad",bridges_other_casing:"#ffffff",bridges_minor_casing:"#ffffff",bridges_link_casing:"#ffffff",bridges_medium_casing:"#ffffff",bridges_major_casing:"#ffffff",bridges_highway_casing:"#ffffff",bridges_other:"#f5f5f5",bridges_minor:"#f5f5f5",bridges_link:"#ebebeb",bridges_medium:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#adadad",roads_label_minor_halo:"#ffffff",roads_label_major:"#999999",roads_label_major_halo:"#ffffff",ocean_label:"#adadad",peak_label:"#adadad",subplace_label:"#8f8f8f",subplace_label_halo:"#ffffff",city_circle:"#ffffff",city_circle_stroke:"#adadad",city_label:"#5c5c5c",city_label_halo:"#ffffff",state_label:"#b3b3b3",state_label_halo:"#ffffff",country_label:"#b8b8b8"},Xi={background:"#a3a3a3",earth:"#cccccc",park_a:"#c2c2c2",park_b:"#c2c2c2",hospital:"#d0d0d0",industrial:"#c6c6c6",school:"#d0d0d0",wood_a:"#c2c2c2",wood_b:"#c2c2c2",pedestrian:"#c4c4c4",scrub_a:"#c2c2c2",scrub_b:"#c2c2c2",glacier:"#d2d2d2",sand:"#d2d2d2",beach:"#d2d2d2",aerodrome:"#c9c9c9",runway:"#f5f5f5",water:"#a3a3a3",pier:"#b8b8b8",zoo:"#c7c7c7",military:"#bfbfbf",tunnel_other_casing:"#b8b8b8",tunnel_minor_casing:"#b8b8b8",tunnel_link_casing:"#b8b8b8",tunnel_medium_casing:"#b8b8b8",tunnel_major_casing:"#b8b8b8",tunnel_highway_casing:"#b8b8b8",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_medium:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",transit_pier:"#b8b8b8",buildings:"#e0e0e0",minor_service_casing:"#cccccc",minor_casing:"#cccccc",link_casing:"#cccccc",medium_casing:"#cccccc",major_casing_late:"#cccccc",highway_casing_late:"#cccccc",other:"#e0e0e0",minor_service:"#e0e0e0",minor_a:"#ebebeb",minor_b:"#e0e0e0",link:"#ebebeb",medium:"#ebebeb",major_casing_early:"#cccccc",major:"#ebebeb",highway_casing_early:"#cccccc",highway:"#ebebeb",railway:"#f5f5f5",boundaries:"#5c5c5c",waterway_label:"#7a7a7a",bridges_other_casing:"#cccccc",bridges_minor_casing:"#cccccc",bridges_link_casing:"#cccccc",bridges_medium_casing:"#cccccc",bridges_major_casing:"#cccccc",bridges_highway_casing:"#cccccc",bridges_other:"#e0e0e0",bridges_minor:"#e0e0e0",bridges_link:"#ebebeb",bridges_medium:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#999999",roads_label_minor_halo:"#e0e0e0",roads_label_major:"#8f8f8f",roads_label_major_halo:"#ebebeb",ocean_label:"#7a7a7a",peak_label:"#5c5c5c",subplace_label:"#7a7a7a",subplace_label_halo:"#cccccc",city_circle:"#c2c2c2",city_circle_stroke:"#7a7a7a",city_label:"#474747",city_label_halo:"#cccccc",state_label:"#999999",state_label_halo:"#cccccc",country_label:"#858585"},Ii={background:"#2b2b2b",earth:"#141414",park_a:"#181818",park_b:"#181818",hospital:"#1d1d1d",industrial:"#101010",school:"#111111",wood_a:"#1a1a1a",wood_b:"#1a1a1a",pedestrian:"#191919",scrub_a:"#1c1c1c",scrub_b:"#1c1c1c",glacier:"#191919",sand:"#161616",beach:"#1f1f1f",aerodrome:"#191919",runway:"#323232",water:"#333333",pier:"#0a0a0a",zoo:"#191919",military:"#121212",tunnel_other_casing:"#101010",tunnel_minor_casing:"#101010",tunnel_link_casing:"#101010",tunnel_medium_casing:"#101010",tunnel_major_casing:"#101010",tunnel_highway_casing:"#101010",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_medium:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",transit_pier:"#0a0a0a",buildings:"#0a0a0a",minor_service_casing:"#141414",minor_casing:"#141414",link_casing:"#141414",medium_casing:"#141414",major_casing_late:"#141414",highway_casing_late:"#141414",other:"#1f1f1f",minor_service:"#1f1f1f",minor_a:"#292929",minor_b:"#1f1f1f",link:"#1f1f1f",medium:"#292929",major_casing_early:"#141414",major:"#292929",highway_casing_early:"#141414",highway:"#292929",railway:"#292929",boundaries:"#707070",waterway_label:"#707070",bridges_other_casing:"#141414",bridges_minor_casing:"#141414",bridges_link_casing:"#141414",bridges_medium_casing:"#141414",bridges_major_casing:"#141414",bridges_highway_casing:"#141414",bridges_other:"#1f1f1f",bridges_minor:"#1f1f1f",bridges_link:"#292929",bridges_medium:"#292929",bridges_major:"#292929",bridges_highway:"#292929",roads_label_minor:"#525252",roads_label_minor_halo:"#141414",roads_label_major:"#5c5c5c",roads_label_major_halo:"#141414",ocean_label:"#707070",peak_label:"#707070",subplace_label:"#5c5c5c",subplace_label_halo:"#141414",city_circle:"#000000",city_circle_stroke:"#666666",city_label:"#999999",city_label_halo:"#141414",state_label:"#3d3d3d",state_label_halo:"#141414",country_label:"#707070"},Yi={light:Ri,dark:ji,white:Oi,grayscale:Xi,black:Ii},it=Yi;var Yr=W(Q(),1),Vr=W(Ir(),1);var ce=W(Q(),1);var Ve=(t,e,r)=>{let n=[];for(let i of t){let s=[];for(let a of i)s.push(a.clone().mult(e).add(r));n.push(s)}return n},Ye=(t,e)=>{let r=1<=r?t%r:t},st=class{constructor(e,r,n){this.tileCache=e,this.maxDataLevel=r,this.levelDiff=n}dataTilesForBounds(e,r){let n=B(2,e)/B(2,Math.ceil(e)),i=[],s=1,a=this.tileCache.tileSize;if(ethis.tileCache.get(s.dataTile)))).map((s,a)=>{let o=n[a];return{data:s,z:e,dataTile:o.dataTile,scale:o.scale,dim:o.dim,origin:o.origin}})})}getDisplayTile(e){return R(this,null,function*(){let r=this.dataTileForDisplayTile(e);return{data:yield this.tileCache.get(r.dataTile),z:e.z,dataTile:r.dataTile,scale:r.scale,origin:r.origin,dim:r.dim}})}queryFeatures(e,r,n,i){let s=Math.round(n),a=Math.min(s-this.levelDiff,this.maxDataLevel),o=i/(1<{let e=n=>{let i=n.levelDiff===void 0?1:n.levelDiff,s=n.maxDataZoom||15,a;if(typeof n.url=="string")new URL(n.url,"http://example.com").pathname.endsWith(".pmtiles")?a=new ve(n.url,!0):a=new De(n.url,!0);else if(n.url)a=new ve(n.url,!0);else throw new Error(`Invalid source ${n.url}`);let o=new Ae(a,256*1<{let i=e/256,s=Math.floor(r.minX/256),a=Math.floor(r.minY/256),o=Math.floor(r.maxX/256),l=Math.floor(r.maxY/256),c=Math.log2(i),u=[];for(let h=s;h<=o;h++){let p=h%(1<this.dim&&(o=!0);if(a||o){let l=a?this.dim:-this.dim,c=[];for(let p of e.bboxes)c.push({minX:p.minX+l,minY:p.minY,maxX:p.maxX+l,maxY:p.maxY});let u={anchor:new Yr.default(e.anchor.x+l,e.anchor.y),bboxes:c,draw:e.draw,order:r,tileKey:n},h=this.current.get(n);h&&h.add(u);for(let p of c)this.tree.insert({minX:p.minX,minY:p.minY,maxX:p.maxX,maxY:p.maxY,indexedLabel:u})}}pruneOrNoop(e){let r=e.split(":"),n,i=0,s=0;for(let a of this.current.keys()){let o=a.split(":");if(o[3]===r[3]){s++;let l=Math.sqrt(B(+o[0]-+r[0],2)+B(+o[1]-+r[1],2));l>i&&(i=l,n=a)}n&&s>this.maxLabeledTiles&&this.pruneKey(n)}}pruneKey(e){let r=this.current.get(e);if(!r)return;let n=[];for(let i of this.tree.all())r.has(i.indexedLabel)&&n.push(i);for(let i of n)this.tree.remove(i);this.current.delete(e)}removeLabel(e){let r=[];for(let i of this.tree.all())e===i.indexedLabel&&r.push(i);for(let i of r)this.tree.remove(i);let n=this.current.get(e.tileKey);n&&n.delete(e)}},ke=class{constructor(e,r,n,i,s){this.index=new at(256*1<a.maxzoom)continue;let o=a.dataSource||"",l=e.get(o);if(!!l)for(let c of l){let u=`${re(c.dataTile)}:${o}`;if(!n.has(u))continue;let h=c.data.get(a.dataLayer);if(h===void 0)continue;let p=h;a.sort&&p.sort((_,k)=>a.sort?a.sort(_.props,k.props):0);let y={index:this.index,zoom:this.z,scratch:this.scratch,order:s,overzoom:this.z-c.dataTile.z};for(let _ of p){if(a.filter&&!a.filter(this.z,_))continue;let k=Ve(_.geom,c.scale,c.origin),f=a.symbolizer.place(y,k,_);if(!!f)for(let d of f){let m=!1;if(!(d.deduplicationKey&&this.index.deduplicationCollides(d))){if(this.index.labelCollides(d,1/0)){if(!this.index.labelCollides(d,s)){let x=this.index.searchLabel(d,1/0);for(let g of x){this.index.removeLabel(g);for(let b of g.bboxes)this.findInvalidatedTiles(i,c.dim,b,u)}this.index.insert(d,s,u),m=!0}}else this.index.insert(d,s,u),m=!0;if(m)for(let x of d.bboxes)(x.maxX>c.origin.x+c.dim||x.minXc.origin.y+c.dim)&&this.findInvalidatedTiles(i,c.dim,x,u)}}}}}for(let s of n)this.index.pruneOrNoop(s);return i.size>0&&this.callback&&this.callback(i),performance.now()-r}findInvalidatedTiles(e,r,n,i){let s=Er(this.z,r,n);for(let a of s)a.key!==i&&this.index.hasPrefix(a.key)&&e.add(a.display)}add(e){let r=!0;for(let[i,s]of e)for(let a of s)this.index.has(`${re(a.dataTile)}:${i}`)||(r=!1);return r?0:this.layout(e)}},ze=class{constructor(e,r,n,i){this.labelers=new Map,this.scratch=e,this.labelRules=r,this.maxLabeledTiles=n,this.callback=i}add(e,r){let n=this.labelers.get(e);return n||(n=new ke(e,this.scratch,this.labelRules,this.maxLabeledTiles,this.callback),this.labelers.set(e,n)),n.add(r)}getIndex(e){let r=this.labelers.get(e);if(r)return r.index}};var Ur=W(Q(),1);function Ue(t,e,r,n,i,s,a,o,l){let c=performance.now();t.save(),t.miterLimit=2;for(let u of i){if(u.minzoom&&eu.maxzoom)continue;let h=r.get(u.dataSource||"");if(!!h)for(let p of h){let y=p.data.get(u.dataLayer);if(y===void 0)continue;u.symbolizer.before&&u.symbolizer.before(t,p.z);let _=p.origin,k=p.dim,f=p.scale;if(t.save(),o){t.beginPath();let d=Math.max(_.x-a.x,s.minX-a.x),m=Math.max(_.y-a.y,s.minY-a.y),x=Math.min(_.x-a.x+k,s.maxX-a.x),g=Math.min(_.y-a.y+k,s.maxY-a.y);t.rect(d,m,x-d,g-m),t.clip()}t.translate(_.x-a.x,_.y-a.y);for(let d of y){let m=d.geom,x=d.bbox;x.maxX*f+_.xs.maxX||x.minY*f+_.y>s.maxY||x.maxY*f+_.y{let e=Math.PI/180,r=Math.max(Math.min($r,t.y),-$r),n=Math.sin(r*e);return new ie.default($e*t.x*e,$e*Math.log((1+n)/(1-n))/2)},Vi=t=>{let e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(t.y/$e))-Math.PI/2)*e,lng:t.x*e/$e}},Ei=(t,e)=>r=>{let n=Nr(r);return new ie.default((n.x+H)/(H*2),1-(n.y+H)/(H*2)).mult((1<r=>{let n=new ie.default(r.x,r.y).add(t).div((1<{let r=e*(360/t);return Math.log2(r/256)},Bt=class{constructor(e){if(e.theme){let r=it[e.theme];this.paintRules=Xe(r),this.labelRules=Ie(r),this.backgroundColor=r.background}else this.paintRules=e.paintRules||[],this.labelRules=e.labelRules||[],this.backgroundColor=e.backgroundColor;this.views=Ee(e),this.debug=e.debug||""}drawContext(e,r,n,i,s){return R(this,null,function*(){let a=Nr(i),l=new ie.default((a.x+H)/(H*2),1-(a.y+H)/(H*2)).clone().mult(B(2,s)*256).sub(new ie.default(r/2,n/2)),c={minX:l.x,minY:l.y,maxX:l.x+r,maxY:l.y+n},u=[];for(let[m,x]of this.views){let g=x.getBbox(s,c);u.push({key:m,promise:g})}let h=yield Promise.all(u.map(m=>m.promise.then(x=>({status:"fulfilled",value:x,key:m.key}),x=>({status:"rejected",value:[],reason:x,key:m.key})))),p=new Map;for(let m of h)m.status==="fulfilled"&&p.set(m.key,m.value);let y=performance.now(),_=new ke(s,e,this.labelRules,16,void 0),k=_.add(p);this.backgroundColor&&(e.save(),e.fillStyle=this.backgroundColor,e.fillRect(0,0,r,n),e.restore());let f=this.paintRules,d=Ue(e,s,p,_.index,f,c,l,!0,this.debug);if(this.debug){e.save(),e.translate(-l.x,-l.y),e.strokeStyle=this.debug,e.fillStyle=this.debug,e.font="12px sans-serif";let m=0;for(let[x,g]of p){for(let b of g){e.strokeRect(b.origin.x,b.origin.y,b.dim,b.dim);let v=b.dataTile;e.fillText(`${x+(x?" ":"")+v.z} ${v.x} ${v.y}`,b.origin.x+4,b.origin.y+14*(1+m))}m++}e.restore()}return{elapsed:performance.now()-y,project:Ei(l,s),unproject:Ui(l,s)}})}drawCanvas(s,a,o){return R(this,arguments,function*(e,r,n,i={}){let l=window.devicePixelRatio,c=e.clientWidth,u=e.clientHeight;e.width===c*l&&e.height===u*l||(e.width=c*l,e.height=u*l),i.lang&&(e.lang=i.lang);let h=e.getContext("2d");if(!h){console.error("Failed to initialize canvas2d context.");return}return h.setTransform(l,0,0,l,0,0),this.drawContext(h,c,u,r,n)})}drawContextBounds(e,r,n,i,s){return R(this,null,function*(){let a=n.x-r.x,o=new ie.default((r.x+n.x)/2,(r.y+n.y)/2);return this.drawContext(e,i,s,o,At(a,i))})}drawCanvasBounds(a,o,l,c){return R(this,arguments,function*(e,r,n,i,s={}){let u=n.x-r.x,h=new ie.default((r.x+n.x)/2,(r.y+n.y)/2);return this.drawCanvas(e,h,At(u,i),s)})}};var Hr=W(Q(),1);var $i=t=>new Promise(e=>{setTimeout(()=>{e()},t)}),Ni=t=>t.then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e})),Hi=(t={})=>{class e extends L.GridLayer{constructor(n={}){if(n.noWrap&&!n.bounds&&(n.bounds=[[-90,-180],[90,180]]),n.attribution==null&&(n.attribution='Protomaps \xA9 OpenStreetMap'),super(n),n.theme){let s=it[n.theme];this.paintRules=Xe(s),this.labelRules=Ie(s),this.backgroundColor=s.background}else this.paintRules=n.paintRules||[],this.labelRules=n.labelRules||[],this.backgroundColor=n.backgroundColor;this.lastRequestedZ=void 0,this.tasks=n.tasks||[],this.views=Ee(n),this.debug=n.debug;let i=document.createElement("canvas").getContext("2d");this.scratch=i,this.onTilesInvalidated=s=>{for(let a of s)this.rerenderTile(a)},this.labelers=new ze(this.scratch,this.labelRules,16,this.onTilesInvalidated),this.tileSize=256*window.devicePixelRatio,this.tileDelay=n.tileDelay||3,this.lang=n.lang}renderTile(n,i,s,a=()=>{}){return R(this,null,function*(){this.lastRequestedZ=n.z;let o=[];for(let[w,z]of this.views){let T=z.getDisplayTile(n);o.push({key:w,promise:T})}let l=yield Promise.all(o.map(w=>w.promise.then(z=>({status:"fulfilled",value:z,key:w.key}),z=>({status:"rejected",reason:z,key:w.key})))),c=new Map;for(let w of l)w.status==="fulfilled"?c.set(w.key,[w.value]):w.reason.name==="AbortError"||console.error(w.reason);if(i.key!==s||this.lastRequestedZ!==n.z||(yield Promise.all(this.tasks.map(Ni)),i.key!==s)||this.lastRequestedZ!==n.z)return;let u=this.labelers.add(n.z,c);if(i.key!==s||this.lastRequestedZ!==n.z)return;let h=this.labelers.getIndex(n.z);if(!this._map)return;let p=this._map.getCenter().wrap(),y=this._getTiledPixelBounds(p),k=this._pxBoundsToTileRange(y).getCenter(),f=n.distanceTo(k)*this.tileDelay;if(yield $i(f),i.key!==s||this.lastRequestedZ!==n.z)return;let d=16,m={minX:256*n.x-d,minY:256*n.y-d,maxX:256*(n.x+1)+d,maxY:256*(n.y+1)+d},x=new Hr.default(256*n.x,256*n.y);i.width=this.tileSize,i.height=this.tileSize;let g=i.getContext("2d");if(!g){console.error("Failed to get Canvas context");return}g.setTransform(this.tileSize/256,0,0,this.tileSize/256,0,0),g.clearRect(0,0,256,256),this.backgroundColor&&(g.save(),g.fillStyle=this.backgroundColor,g.fillRect(0,0,256,256),g.restore());let b=0,v=this.paintRules;if(b=Ue(g,n.z,c,this.xray?null:h,v,m,x,!1,this.debug),this.debug){g.save(),g.fillStyle=this.debug,g.font="600 12px sans-serif",g.fillText(`${n.z} ${n.x} ${n.y}`,4,14),g.font="12px sans-serif";let w=28;for(let[z,T]of c){let M=T[0].dataTile;g.fillText(`${z+(z?" ":"")+M.z} ${M.x} ${M.y}`,4,w),w+=14}g.font="600 10px sans-serif",b>8&&(g.fillText(`${b.toFixed()} ms paint`,4,w),w+=14),u>8&&g.fillText(`${u.toFixed()} ms layout`,4,w),g.strokeStyle=this.debug,g.lineWidth=.5,g.beginPath(),g.moveTo(0,0),g.lineTo(0,256),g.stroke(),g.lineWidth=.5,g.beginPath(),g.moveTo(0,0),g.lineTo(256,0),g.stroke(),g.restore()}a()})}rerenderTile(n){for(let i in this._tiles){let s=this._wrapCoords(this._keyToTileCoords(i));n===this._tileCoordsToKey(s)&&this.renderTile(s,this._tiles[i].el,n)}}queryTileFeaturesDebug(n,i,s=16){let a=new Map;for(let[o,l]of this.views)a.set(o,l.queryFeatures(n,i,this._map.getZoom(),s));return a}clearLayout(){this.labelers=new ze(this.scratch,this.labelRules,16,this.onTilesInvalidated)}rerenderTiles(){for(let n in this._tiles){let i=this._wrapCoords(this._keyToTileCoords(n)),s=this._tileCoordsToKey(i);this.renderTile(i,this._tiles[n].el,s)}}createTile(n,i){let s=L.DomUtil.create("canvas","leaflet-tile");s.lang=this.lang;let a=this._tileCoordsToKey(n);return s.key=a,this.renderTile(n,s,a,()=>{i(void 0,s)}),s}_removeTile(n){let i=this._tiles[n];!i||(i.el.removed=!0,i.el.key=void 0,L.DomUtil.removeClass(i.el,"leaflet-tile-loaded"),i.el.width=i.el.height=0,L.DomUtil.remove(i.el),delete this._tiles[n],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(n)}))}}return new e(t)};function Rt(t){let e=0,r=0;for(let o of t)e+=o.w*o.h,r=Math.max(r,o.w);t.sort((o,l)=>l.h-o.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],s=0,a=0;for(let o of t)for(let l=i.length-1;l>=0;l--){let c=i[l];if(!(o.w>c.w||o.h>c.h)){if(o.x=c.x,o.y=c.y,a=Math.max(a,o.y+o.h),s=Math.max(s,o.x+o.w),o.w===c.w&&o.h===c.h){let u=i.pop();l{let n=new FontFace(t,`url(${e})`,{weight:r});return document.fonts.add(n),n.load()},qr=t=>R(void 0,null,function*(){return new Promise((e,r)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>r("Invalid SVG"),n.src=t})}),Wi=` + + + + + + +`,jt=class{constructor(e){this.src=e,this.canvas=document.createElement("canvas"),this.mapping=new Map,this.missingBox={x:0,y:0,w:0,h:0}}load(){return R(this,null,function*(){let e=this.src,r=window.devicePixelRatio;e.endsWith(".html")&&(e=yield(yield fetch(e)).text());let n=new window.DOMParser().parseFromString(e,"text/html"),i=Array.from(n.body.children),s=yield qr(`data:image/svg+xml;base64,${btoa(Wi)}`),a=[{w:s.width*r,h:s.height*r,img:s,id:""}],o=new XMLSerializer;for(let u of i){let p=`data:image/svg+xml;base64,${btoa(o.serializeToString(u))}`,y=yield qr(p);a.push({w:y.width*r,h:y.height*r,img:y,id:u.id})}let l=Rt(a);this.canvas.width=l.w,this.canvas.height=l.h;let c=this.canvas.getContext("2d");if(c)for(let u of a)u.x!==void 0&&u.y!==void 0&&(c.drawImage(u.img,u.x,u.y,u.w,u.h),u.id?this.mapping.set(u.id,{x:u.x,y:u.y,w:u.w,h:u.h}):this.missingBox={x:u.x,y:u.y,w:u.w,h:u.h});return this})}get(e){let r=this.mapping.get(e);return r||(r=this.missingBox),r}};return tn(Zi);})(); +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ diff --git a/bin/geocode.rb b/bin/geocode.rb index cf63eae6c627eb..f94b20b74faee6 100755 --- a/bin/geocode.rb +++ b/bin/geocode.rb @@ -64,4 +64,17 @@ def request(url) File.open(event, 'w') { |file| file.puts contents } end end + + # Now it has a geocode + pmtiles_output = event.gsub(/md$/, 'pmtiles') + bbox = [ + event_data['location']['geo']['lon'].to_f - 0.03, + event_data['location']['geo']['lat'].to_f - 0.01, + event_data['location']['geo']['lon'].to_f + 0.03, + event_data['location']['geo']['lat'].to_f + 0.01, + ].join(',') + # if ! File.exist?(pmtiles_output) + puts "./pmtiles extract https://build.protomaps.com/20240520.pmtiles #{pmtiles_output} --bbox=#{bbox} --maxzoom=15 --minzoom=10" + puts `./pmtiles extract https://build.protomaps.com/20240520.pmtiles #{pmtiles_output} --bbox=#{bbox} --maxzoom=15 --minzoom=10` + # end end