@loaders.gl/mvt 4.2.1 → 4.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/dist.dev.js +1311 -767
  2. package/dist/dist.min.js +1 -1
  3. package/dist/geojson-tile-source.d.ts +79 -0
  4. package/dist/geojson-tile-source.d.ts.map +1 -0
  5. package/dist/{lib/geojson-tiler/geojson-tiler.js → geojson-tile-source.js} +137 -27
  6. package/dist/index.cjs +568 -558
  7. package/dist/index.cjs.map +4 -4
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/lib/geojsonvt/clip.d.ts.map +1 -0
  12. package/dist/lib/geojsonvt/convert.d.ts +10 -0
  13. package/dist/lib/geojsonvt/convert.d.ts.map +1 -0
  14. package/dist/lib/geojsonvt/feature.d.ts.map +1 -0
  15. package/dist/lib/geojsonvt/simplify.d.ts.map +1 -0
  16. package/dist/lib/geojsonvt/tile.d.ts.map +1 -0
  17. package/dist/lib/geojsonvt/transform.d.ts.map +1 -0
  18. package/dist/lib/geojsonvt/wrap.d.ts.map +1 -0
  19. package/dist/lib/parse-mvt.d.ts +3 -2
  20. package/dist/lib/parse-mvt.d.ts.map +1 -1
  21. package/dist/lib/parse-mvt.js +13 -15
  22. package/dist/lib/types.d.ts +1 -39
  23. package/dist/lib/types.d.ts.map +1 -1
  24. package/dist/lib/utils/geometry-utils.d.ts +46 -0
  25. package/dist/lib/utils/geometry-utils.d.ts.map +1 -0
  26. package/dist/{helpers/binary-util-functions.js → lib/utils/geometry-utils.js} +79 -46
  27. package/dist/lib/{binary-vector-tile → vector-tile}/vector-tile-feature.d.ts +27 -15
  28. package/dist/lib/vector-tile/vector-tile-feature.d.ts.map +1 -0
  29. package/dist/lib/vector-tile/vector-tile-feature.js +345 -0
  30. package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile-layer.d.ts +10 -1
  31. package/dist/lib/vector-tile/vector-tile-layer.d.ts.map +1 -0
  32. package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile-layer.js +16 -1
  33. package/dist/lib/vector-tile/vector-tile.d.ts.map +1 -0
  34. package/dist/mvt-loader.d.ts +20 -9
  35. package/dist/mvt-loader.d.ts.map +1 -1
  36. package/dist/mvt-loader.js +2 -1
  37. package/dist/mvt-source.js +4 -4
  38. package/dist/mvt-worker.js +1172 -735
  39. package/package.json +6 -6
  40. package/src/{lib/geojson-tiler/geojson-tiler.ts → geojson-tile-source.ts} +172 -33
  41. package/src/index.ts +3 -3
  42. package/src/lib/{geojson-tiler → geojsonvt}/convert.ts +2 -2
  43. package/src/lib/{geojson-tiler → geojsonvt}/tile.ts +2 -2
  44. package/src/lib/parse-mvt.ts +24 -33
  45. package/src/lib/types.ts +1 -39
  46. package/src/{helpers/binary-util-functions.ts → lib/utils/geometry-utils.ts} +92 -48
  47. package/src/lib/vector-tile/vector-tile-feature.ts +407 -0
  48. package/src/lib/{mapbox-vector-tile → vector-tile}/vector-tile-layer.ts +28 -2
  49. package/src/mvt-loader.ts +14 -6
  50. package/src/mvt-source.ts +4 -4
  51. package/dist/helpers/binary-util-functions.d.ts +0 -35
  52. package/dist/helpers/binary-util-functions.d.ts.map +0 -1
  53. package/dist/helpers/mapbox-util-functions.d.ts +0 -29
  54. package/dist/helpers/mapbox-util-functions.d.ts.map +0 -1
  55. package/dist/helpers/mapbox-util-functions.js +0 -78
  56. package/dist/lib/binary-vector-tile/vector-tile-feature.d.ts.map +0 -1
  57. package/dist/lib/binary-vector-tile/vector-tile-feature.js +0 -163
  58. package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts +0 -23
  59. package/dist/lib/binary-vector-tile/vector-tile-layer.d.ts.map +0 -1
  60. package/dist/lib/binary-vector-tile/vector-tile-layer.js +0 -96
  61. package/dist/lib/binary-vector-tile/vector-tile.d.ts +0 -9
  62. package/dist/lib/binary-vector-tile/vector-tile.d.ts.map +0 -1
  63. package/dist/lib/binary-vector-tile/vector-tile.js +0 -27
  64. package/dist/lib/geojson-tiler/clip.d.ts.map +0 -1
  65. package/dist/lib/geojson-tiler/convert.d.ts +0 -10
  66. package/dist/lib/geojson-tiler/convert.d.ts.map +0 -1
  67. package/dist/lib/geojson-tiler/feature.d.ts.map +0 -1
  68. package/dist/lib/geojson-tiler/geojson-tiler.d.ts +0 -44
  69. package/dist/lib/geojson-tiler/geojson-tiler.d.ts.map +0 -1
  70. package/dist/lib/geojson-tiler/simplify.d.ts.map +0 -1
  71. package/dist/lib/geojson-tiler/tile.d.ts.map +0 -1
  72. package/dist/lib/geojson-tiler/transform.d.ts.map +0 -1
  73. package/dist/lib/geojson-tiler/wrap.d.ts.map +0 -1
  74. package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts +0 -27
  75. package/dist/lib/mapbox-vector-tile/vector-tile-feature.d.ts.map +0 -1
  76. package/dist/lib/mapbox-vector-tile/vector-tile-feature.js +0 -178
  77. package/dist/lib/mapbox-vector-tile/vector-tile-layer.d.ts.map +0 -1
  78. package/dist/lib/mapbox-vector-tile/vector-tile.d.ts.map +0 -1
  79. package/src/helpers/mapbox-util-functions.ts +0 -82
  80. package/src/lib/binary-vector-tile/vector-tile-feature.ts +0 -203
  81. package/src/lib/binary-vector-tile/vector-tile-layer.ts +0 -113
  82. package/src/lib/binary-vector-tile/vector-tile.ts +0 -36
  83. package/src/lib/mapbox-vector-tile/LICENSE.txt +0 -31
  84. package/src/lib/mapbox-vector-tile/vector-tile-feature.ts +0 -207
  85. /package/dist/lib/{geojson-tiler → geojsonvt}/clip.d.ts +0 -0
  86. /package/dist/lib/{geojson-tiler → geojsonvt}/clip.js +0 -0
  87. /package/dist/lib/{geojson-tiler → geojsonvt}/convert.js +0 -0
  88. /package/dist/lib/{geojson-tiler → geojsonvt}/feature.d.ts +0 -0
  89. /package/dist/lib/{geojson-tiler → geojsonvt}/feature.js +0 -0
  90. /package/dist/lib/{geojson-tiler → geojsonvt}/simplify.d.ts +0 -0
  91. /package/dist/lib/{geojson-tiler → geojsonvt}/simplify.js +0 -0
  92. /package/dist/lib/{geojson-tiler → geojsonvt}/tile.d.ts +0 -0
  93. /package/dist/lib/{geojson-tiler → geojsonvt}/tile.js +0 -0
  94. /package/dist/lib/{geojson-tiler → geojsonvt}/transform.d.ts +0 -0
  95. /package/dist/lib/{geojson-tiler → geojsonvt}/transform.js +0 -0
  96. /package/dist/lib/{geojson-tiler → geojsonvt}/wrap.d.ts +0 -0
  97. /package/dist/lib/{geojson-tiler → geojsonvt}/wrap.js +0 -0
  98. /package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile.d.ts +0 -0
  99. /package/dist/lib/{mapbox-vector-tile → vector-tile}/vector-tile.js +0 -0
  100. /package/src/lib/{geojson-tiler → geojsonvt}/LICENSE +0 -0
  101. /package/src/lib/{geojson-tiler → geojsonvt}/clip.ts +0 -0
  102. /package/src/lib/{geojson-tiler → geojsonvt}/feature.ts +0 -0
  103. /package/src/lib/{geojson-tiler → geojsonvt}/simplify.ts +0 -0
  104. /package/src/lib/{geojson-tiler → geojsonvt}/transform.ts +0 -0
  105. /package/src/lib/{geojson-tiler → geojsonvt}/wrap.ts +0 -0
  106. /package/src/lib/{binary-vector-tile → vector-tile}/LICENSE.txt +0 -0
  107. /package/src/lib/{mapbox-vector-tile → vector-tile}/vector-tile.ts +0 -0
package/dist/dist.min.js CHANGED
@@ -4,7 +4,7 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['loaders'] = factory();
6
6
  else root['loaders'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var nn=Object.create;var ie=Object.defineProperty;var rn=Object.getOwnPropertyDescriptor;var on=Object.getOwnPropertyNames;var sn=Object.getPrototypeOf,an=Object.prototype.hasOwnProperty;var Te=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ln=(e,t)=>{for(var n in t)ie(e,n,{get:t[n],enumerable:!0})},ne=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of on(t))!an.call(e,r)&&r!==n&&ie(e,r,{get:()=>t[r],enumerable:!(i=rn(t,r))||i.enumerable});return e},re=(e,t,n)=>(ne(e,t,"default"),n&&ne(n,t,"default")),it=(e,t,n)=>(n=e!=null?nn(sn(e)):{},ne(t||!e||!e.__esModule?ie(n,"default",{value:e,enumerable:!0}):n,e)),fn=e=>ne(ie({},"__esModule",{value:!0}),e);var ot=Te((yr,rt)=>{rt.exports=globalThis.loaders});var ht=Te(be=>{be.read=function(e,t,n,i,r){var o,s,a=r*8-i-1,l=(1<<a)-1,f=l>>1,c=-7,u=n?r-1:0,p=n?-1:1,h=e[t+u];for(u+=p,o=h&(1<<-c)-1,h>>=-c,c+=a;c>0;o=o*256+e[t+u],u+=p,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=i;c>0;s=s*256+e[t+u],u+=p,c-=8);if(o===0)o=1-f;else{if(o===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-f}return(h?-1:1)*s*Math.pow(2,o-i)};be.write=function(e,t,n,i,r,o){var s,a,l,f=o*8-r-1,c=(1<<f)-1,u=c>>1,p=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:o-1,d=i?1:-1,x=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=p/l:t+=p*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=c?(a=0,s=c):s+u>=1?(a=(t*l-1)*Math.pow(2,r),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,r),s=0));r>=8;e[n+h]=a&255,h+=d,a/=256,r-=8);for(s=s<<r|a,f+=r;f>0;e[n+h]=s&255,h+=d,s/=256,f-=8);e[n+h-d]|=x*128}});var yt=Te((po,xt)=>{"use strict";xt.exports=y;var le=ht();function y(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}y.Varint=0;y.Fixed64=1;y.Bytes=2;y.Fixed32=5;var Le=(1<<16)*(1<<16),pt=1/Le,Un=12,mt=typeof TextDecoder>"u"?null:new TextDecoder("utf8");y.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var i=this.readVarint(),r=i>>3,o=this.pos;this.type=i&7,e(r,t,this),this.pos===o&&this.skip(i)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=fe(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=gt(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=fe(this.buf,this.pos)+fe(this.buf,this.pos+4)*Le;return this.pos+=8,e},readSFixed64:function(){var e=fe(this.buf,this.pos)+gt(this.buf,this.pos+4)*Le;return this.pos+=8,e},readFloat:function(){var e=le.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=le.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,i;return i=t[this.pos++],n=i&127,i<128||(i=t[this.pos++],n|=(i&127)<<7,i<128)||(i=t[this.pos++],n|=(i&127)<<14,i<128)||(i=t[this.pos++],n|=(i&127)<<21,i<128)?n:(i=t[this.pos],n|=(i&15)<<28,Gn(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=Un&&mt?ei(this.buf,t,e):qn(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==y.Bytes)return e.push(this.readVarint(t));var n=D(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==y.Bytes)return e.push(this.readSVarint());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==y.Bytes)return e.push(this.readBoolean());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==y.Bytes)return e.push(this.readFloat());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==y.Bytes)return e.push(this.readDouble());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==y.Bytes)return e.push(this.readFixed32());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==y.Bytes)return e.push(this.readSFixed32());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==y.Bytes)return e.push(this.readFixed64());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==y.Bytes)return e.push(this.readSFixed64());var t=D(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===y.Varint)for(;this.buf[this.pos++]>127;);else if(t===y.Bytes)this.pos=this.readVarint()+this.pos;else if(t===y.Fixed32)this.pos+=4;else if(t===y.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),R(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),R(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),R(this.buf,e&-1,this.pos),R(this.buf,Math.floor(e*pt),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),R(this.buf,e&-1,this.pos),R(this.buf,Math.floor(e*pt),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Rn(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=ti(this.buf,e,this.pos);var n=this.pos-t;n>=128&&dt(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),le.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),le.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var i=this.pos-n;i>=128&&dt(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeMessage:function(e,t,n){this.writeTag(e,y.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,zn,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Jn,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Xn,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Wn,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Yn,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,$n,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Hn,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Kn,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Qn,t)},writeBytesField:function(e,t){this.writeTag(e,y.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,y.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,y.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,y.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,y.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,y.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,y.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,y.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,y.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,y.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function Gn(e,t,n){var i=n.buf,r,o;if(o=i[n.pos++],r=(o&112)>>4,o<128||(o=i[n.pos++],r|=(o&127)<<3,o<128)||(o=i[n.pos++],r|=(o&127)<<10,o<128)||(o=i[n.pos++],r|=(o&127)<<17,o<128)||(o=i[n.pos++],r|=(o&127)<<24,o<128)||(o=i[n.pos++],r|=(o&1)<<31,o<128))return G(e,r,t);throw new Error("Expected varint not more than 10 bytes")}function D(e){return e.type===y.Bytes?e.readVarint()+e.pos:e.pos+1}function G(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Rn(e,t){var n,i;if(e>=0?(n=e%4294967296|0,i=e/4294967296|0):(n=~(-e%4294967296),i=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,i=i+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),jn(n,i,t),Zn(i,t)}function jn(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function Zn(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function dt(e,t,n){var i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(i);for(var r=n.pos-1;r>=e;r--)n.buf[r+i]=n.buf[r]}function zn(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function Jn(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function Wn(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function Yn(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function Xn(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function $n(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function Hn(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function Kn(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function Qn(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function fe(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function R(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function gt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function qn(e,t,n){for(var i="",r=t;r<n;){var o=e[r],s=null,a=o>239?4:o>223?3:o>191?2:1;if(r+a>n)break;var l,f,c;a===1?o<128&&(s=o):a===2?(l=e[r+1],(l&192)===128&&(s=(o&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[r+1],f=e[r+2],(l&192)===128&&(f&192)===128&&(s=(o&15)<<12|(l&63)<<6|f&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[r+1],f=e[r+2],c=e[r+3],(l&192)===128&&(f&192)===128&&(c&192)===128&&(s=(o&15)<<18|(l&63)<<12|(f&63)<<6|c&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),r+=a}return i}function ei(e,t,n){return mt.decode(e.subarray(t,n))}function ti(e,t,n){for(var i=0,r,o;i<t.length;i++){if(r=t.charCodeAt(i),r>55295&&r<57344)if(o)if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,o=r;continue}else r=o-55296<<10|r-56320|65536,o=null;else{r>56319||i+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):o=r;continue}else o&&(e[n++]=239,e[n++]=191,e[n++]=189,o=null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=r&63|128)}return n}});var te={};ln(te,{GeoJSONTiler:()=>ve,MVTLoader:()=>me,MVTSource:()=>we,MVTWorkerLoader:()=>Re,TileJSONLoader:()=>Z});re(te,it(ot(),1));function b(e){return b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(e)}function Se(e,t){if(b(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t||"default");if(b(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _e(e){var t=Se(e,"string");return b(t)==="symbol"?t:String(t)}function V(e,t,n){return t=_e(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var J={x:0,y:1,z:2};function C(e,t={}){let{start:n=0,end:i=e.length,plane:r="xy"}=t,o=t.size||2,s=0,a=J[r[0]],l=J[r[1]];for(let f=n,c=i-o;f<i;f+=o)s+=(e[f+a]-e[c+a])*(e[f+l]+e[c+l]),c=f;return s/2}function Ve(e,t,n=2,i,r="xy"){let o=t&&t.length,s=o?t[0]*n:e.length,a=at(e,0,s,n,!0,i&&i[0],r),l=[];if(!a||a.next===a.prev)return l;let f,c,u,p,h,d,x;if(o&&(a=mn(e,t,a,n,i,r)),e.length>80*n){p=c=e[0],h=u=e[1];for(let w=n;w<s;w+=n)d=e[w],x=e[w+1],d<p&&(p=d),x<h&&(h=x),d>c&&(c=d),x>u&&(u=x);f=Math.max(c-p,u-h),f=f!==0?32767/f:0}return W(a,l,n,p,h,f,0),l}function at(e,t,n,i,r,o,s){let a,l;o===void 0&&(o=C(e,{start:t,end:n,size:i,plane:s}));let f=J[s[0]],c=J[s[1]];if(r===o<0)for(a=t;a<n;a+=i)l=st(a,e[a+f],e[a+c],l);else for(a=n-i;a>=t;a-=i)l=st(a,e[a+f],e[a+c],l);return l&&ae(l,l.next)&&(X(l),l=l.next),l}function O(e,t){if(!e)return e;t||(t=e);let n=e,i;do if(i=!1,!n.steiner&&(ae(n,n.next)||P(n.prev,n,n.next)===0)){if(X(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function W(e,t,n,i,r,o,s){if(!e)return;!s&&o&&Fn(e,i,r,o);let a=e,l,f;for(;e.prev!==e.next;){if(l=e.prev,f=e.next,o?pn(e,i,r,o):hn(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(f.i/n|0),X(e),e=f.next,a=f.next;continue}if(e=f,e===a){s?s===1?(e=dn(O(e),t,n),W(e,t,n,i,r,o,2)):s===2&&gn(e,t,n,i,r,o):W(O(e),t,n,i,r,o,1);break}}}function hn(e){let t=e.prev,n=e,i=e.next;if(P(t,n,i)>=0)return!1;let r=t.x,o=n.x,s=i.x,a=t.y,l=n.y,f=i.y,c=r<o?r<s?r:s:o<s?o:s,u=a<l?a<f?a:f:l<f?l:f,p=r>o?r>s?r:s:o>s?o:s,h=a>l?a>f?a:f:l>f?l:f,d=i.next;for(;d!==t;){if(d.x>=c&&d.x<=p&&d.y>=u&&d.y<=h&&U(r,a,o,l,s,f,d.x,d.y)&&P(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function pn(e,t,n,i){let r=e.prev,o=e,s=e.next;if(P(r,o,s)>=0)return!1;let a=r.x,l=o.x,f=s.x,c=r.y,u=o.y,p=s.y,h=a<l?a<f?a:f:l<f?l:f,d=c<u?c<p?c:p:u<p?u:p,x=a>l?a>f?a:f:l>f?l:f,w=c>u?c>p?c:p:u>p?u:p,I=Me(h,d,t,n,i),_=Me(x,w,t,n,i),g=e.prevZ,m=e.nextZ;for(;g&&g.z>=I&&m&&m.z<=_;){if(g.x>=h&&g.x<=x&&g.y>=d&&g.y<=w&&g!==r&&g!==s&&U(a,c,l,u,f,p,g.x,g.y)&&P(g.prev,g,g.next)>=0||(g=g.prevZ,m.x>=h&&m.x<=x&&m.y>=d&&m.y<=w&&m!==r&&m!==s&&U(a,c,l,u,f,p,m.x,m.y)&&P(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;g&&g.z>=I;){if(g.x>=h&&g.x<=x&&g.y>=d&&g.y<=w&&g!==r&&g!==s&&U(a,c,l,u,f,p,g.x,g.y)&&P(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;m&&m.z<=_;){if(m.x>=h&&m.x<=x&&m.y>=d&&m.y<=w&&m!==r&&m!==s&&U(a,c,l,u,f,p,m.x,m.y)&&P(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function dn(e,t,n){let i=e;do{let r=i.prev,o=i.next.next;!ae(r,o)&&lt(r,i,i.next,o)&&Y(r,o)&&Y(o,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(o.i/n|0),X(i),X(i.next),i=e=o),i=i.next}while(i!==e);return O(i)}function gn(e,t,n,i,r,o){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Tn(s,a)){let l=ft(s,a);s=O(s,s.next),l=O(l,l.next),W(s,t,n,i,r,o,0),W(l,t,n,i,r,o,0);return}a=a.next}s=s.next}while(s!==e)}function mn(e,t,n,i,r,o){let s=[],a,l,f,c,u;for(a=0,l=t.length;a<l;a++)f=t[a]*i,c=a<l-1?t[a+1]*i:e.length,u=at(e,f,c,i,!1,r&&r[a+1],o),u===u.next&&(u.steiner=!0),s.push(vn(u));for(s.sort(xn),a=0;a<s.length;a++)n=yn(s[a],n);return n}function xn(e,t){return e.x-t.x}function yn(e,t){let n=wn(e,t);if(!n)return t;let i=ft(n,e);return O(i,i.next),O(n,n.next)}function wn(e,t){let n=t,i=e.x,r=e.y,o=-1/0,s;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){let p=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=i&&p>o&&(o=p,s=n.x<n.next.x?n:n.next,p===i))return s}n=n.next}while(n!==t);if(!s)return null;let a=s,l=s.x,f=s.y,c=1/0,u;n=s;do i>=n.x&&n.x>=l&&i!==n.x&&U(r<f?i:o,r,l,f,r<f?o:i,r,n.x,n.y)&&(u=Math.abs(r-n.y)/(i-n.x),Y(n,e)&&(u<c||u===c&&(n.x>s.x||n.x===s.x&&Pn(s,n)))&&(s=n,c=u)),n=n.next;while(n!==a);return s}function Pn(e,t){return P(e.prev,e,t.prev)<0&&P(t.next,e,e.next)<0}function Fn(e,t,n,i){let r=e;do r.z===0&&(r.z=Me(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,In(r)}function In(e){let t,n,i=1,r,o,s,a,l,f;do{for(o=e,e=null,f=null,r=0;o;){for(r++,a=o,s=0,n=0;n<i&&(s++,a=a.nextZ,!!a);n++);for(l=i;s>0||l>0&&a;)s!==0&&(l===0||!a||o.z<=a.z)?(t=o,o=o.nextZ,s--):(t=a,a=a.nextZ,l--),f?f.nextZ=t:e=t,t.prevZ=f,f=t;o=a}f.nextZ=null,i*=2}while(r>1);return e}function Me(e,t,n,i,r){return e=(e-n)*r|0,t=(t-i)*r|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function vn(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function U(e,t,n,i,r,o,s,a){return(r-s)*(t-a)>=(e-s)*(o-a)&&(e-s)*(i-a)>=(n-s)*(t-a)&&(n-s)*(o-a)>=(r-s)*(i-a)}function Tn(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Sn(e,t)&&(Y(e,t)&&Y(t,e)&&_n(e,t)&&(P(e.prev,e,t.prev)||P(e,t.prev,t))||ae(e,t)&&P(e.prev,e,e.next)>0&&P(t.prev,t,t.next)>0)}function P(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function ae(e,t){return e.x===t.x&&e.y===t.y}function lt(e,t,n,i){let r=se(P(e,t,n)),o=se(P(e,t,i)),s=se(P(n,i,e)),a=se(P(n,i,t));return!!(r!==o&&s!==a||r===0&&oe(e,n,t)||o===0&&oe(e,i,t)||s===0&&oe(n,e,i)||a===0&&oe(n,t,i))}function oe(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function se(e){return e>0?1:e<0?-1:0}function Sn(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&lt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Y(e,t){return P(e.prev,e,e.next)<0?P(e,t,e.next)>=0&&P(e,e.prev,t)>=0:P(e,t,e.prev)<0||P(e,e.next,t)<0}function _n(e,t){let n=e,i=!1,r=(e.x+t.x)/2,o=(e.y+t.y)/2;do n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function ft(e,t){let n=new $(e.i,e.x,e.y),i=new $(t.i,t.x,t.y),r=e.next,o=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function st(e,t,n,i){let r=new $(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function X(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var $=class{constructor(t,n,i){V(this,"i",void 0),V(this,"x",void 0),V(this,"y",void 0),V(this,"prev",null),V(this,"next",null),V(this,"z",0),V(this,"prevZ",null),V(this,"nextZ",null),V(this,"steiner",!1),this.i=t,this.x=n,this.y=i}};function Ee(e,t,n){let i=En(e),r=Object.keys(i).filter(o=>i[o]!==Array);return Dn(e,{propArrayTypes:i,...t},{numericPropKeys:n&&n.numericPropKeys||r,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function En(e){let t={};for(let n of e)if(n.properties)for(let i in n.properties){let r=n.properties[i];t[i]=kn(r,t[i])}return t}function Dn(e,t,n){let{pointPositionsCount:i,pointFeaturesCount:r,linePositionsCount:o,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:f,polygonRingsCount:c,polygonFeaturesCount:u,propArrayTypes:p,coordLength:h}=t,{numericPropKeys:d=[],PositionDataType:x=Float32Array,triangulate:w=!0}=n,I=e[0]&&"id"in e[0],_=e.length>65535?Uint32Array:Uint16Array,g={type:"Point",positions:new x(i*h),globalFeatureIds:new _(i),featureIds:r>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},m={type:"LineString",pathIndices:o>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new x(o*h),globalFeatureIds:new _(o),featureIds:a>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},v={type:"Polygon",polygonIndices:l>65535?new Uint32Array(f+1):new Uint16Array(f+1),primitivePolygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),positions:new x(l*h),globalFeatureIds:new _(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};w&&(v.triangles=[]);for(let T of[g,m,v])for(let S of d){let M=p[S];T.numericProps[S]=new M(T.positions.length/h)}m.pathIndices[s]=o,v.polygonIndices[f]=l,v.primitivePolygonIndices[c]=l;let F={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let T of e){let S=T.geometry,M=T.properties||{};switch(S.type){case"Point":bn(S,g,F,h,M),g.properties.push(Ae(M,d)),I&&g.fields.push({id:T.id}),F.pointFeature++;break;case"LineString":Ln(S,m,F,h,M),m.properties.push(Ae(M,d)),I&&m.fields.push({id:T.id}),F.lineFeature++;break;case"Polygon":Cn(S,v,F,h,M),v.properties.push(Ae(M,d)),I&&v.fields.push({id:T.id}),F.polygonFeature++;break;default:throw new Error("Invalid geometry type")}F.feature++}return Nn(g,m,v,h)}function bn(e,t,n,i,r){t.positions.set(e.data,n.pointPosition*i);let o=e.data.length/i;De(t,r,n.pointPosition,o),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+o),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+o),n.pointPosition+=o}function Ln(e,t,n,i,r){t.positions.set(e.data,n.linePosition*i);let o=e.data.length/i;De(t,r,n.linePosition,o),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+o),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],f=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(f-l)/i}}function Cn(e,t,n,i,r){t.positions.set(e.data,n.polygonPosition*i);let o=e.data.length/i;De(t,r,n.polygonPosition,o),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+o),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+o);for(let s=0,a=e.indices.length;s<a;++s){let l=n.polygonPosition;t.polygonIndices[n.polygonObject++]=l;let f=e.areas[s],c=e.indices[s],u=e.indices[s+1];for(let h=0,d=c.length;h<d;++h){let x=c[h],w=h===d-1?u===void 0?e.data.length:u[0]:c[h+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(w-x)/i}let p=n.polygonPosition;On(t,f,c,{startPosition:l,endPosition:p,coordLength:i})}}function On(e,t,n,{startPosition:i,endPosition:r,coordLength:o}){if(!e.triangles)return;let s=i*o,a=r*o,l=e.positions.subarray(s,a),f=n[0],c=n.slice(1).map(p=>(p-f)/o),u=Ve(l,c,o,t);for(let p=0,h=u.length;p<h;++p)e.triangles.push(i+u[p])}function Be(e,t){let n={};for(let i in e)n[i]={value:e[i],size:t};return n}function Nn(e,t,n,i){let r={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:i},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Be(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:i},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Be(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:i},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:Be(n.numericProps,1)}};return r.polygons&&n.triangles&&(r.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),r}function De(e,t,n,i){for(let r in e.numericProps)if(r in t){let o=t[r];e.numericProps[r].fill(o,n,n+i)}}function Ae(e,t){let n={};for(let i in e)t.includes(i)||(n[i]=e[i]);return n}function kn(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}var Ue=it(yt(),1);function wt(e){let t=e.length;if(t<=1)return[e];let n=[],i,r;for(let o=0;o<t;o++){let s=ni(e[o]);s!==0&&(r===void 0&&(r=s<0),r===s<0?(i&&n.push(i),i=[e[o]]):i&&i.push(e[o]))}return i&&n.push(i),n}function ni(e){let t=0;for(let n=0,i=e.length-1,r,o;n<e.length;i=n++)r=e[n],o=e[i],t+=(o[0]-r[0])*(r[1]+o[1]);return t}function Pt(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?ii(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function ii(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let i=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[i]=r}}var j=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;static get types(){return["Unknown","Point","LineString","Polygon"]}constructor(t,n,i,r,o){this.properties={},this.extent=i,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=r,this._values=o,t.readFields(Pt,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,i=1,r=0,o=0,s=0,a=[],l;for(;t.pos<n;){if(r<=0){let f=t.readVarint();i=f&7,r=f>>3}if(r--,i===1||i===2)o+=t.readSVarint(),s+=t.readSVarint(),i===1&&(l&&a.push(l),l=[]),l&&l.push([o,s]);else if(i===7)l&&l.push(l[0].slice());else throw new Error(`unknown command ${i}`)}return l&&a.push(l),a}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,i=1,r=0,o=0,s=0,a=1/0,l=-1/0,f=1/0,c=-1/0;for(;t.pos<n;){if(r<=0){let u=t.readVarint();i=u&7,r=u>>3}if(r--,i===1||i===2)o+=t.readSVarint(),s+=t.readSVarint(),o<a&&(a=o),o>l&&(l=o),s<f&&(f=s),s>c&&(c=s);else if(i!==7)throw new Error(`unknown command ${i}`)}return[a,f,l,c]}_toGeoJSON(t){let n=this.loadGeometry(),i=j.types[this.type],r,o;switch(this.type){case 1:let a=[];for(r=0;r<n.length;r++)a[r]=n[r][0];n=a,t(n,this);break;case 2:for(r=0;r<n.length;r++)t(n[r],this);break;case 3:for(n=wt(n),r=0;r<n.length;r++)for(o=0;o<n[r].length;o++)t(n[r][o],this);break}n.length===1?n=n[0]:i=`Multi${i}`;let s={type:"Feature",geometry:{type:i,coordinates:n},properties:this.properties};return this.id!==null&&(s.id=this.id),s}toGeoJSON(t){if(typeof t=="function")return this._toGeoJSON(t);let{x:n,y:i,z:r}=t,o=this.extent*Math.pow(2,r),s=this.extent*n,a=this.extent*i;function l(f){for(let c=0;c<f.length;c++){let u=f[c];u[0]=(u[0]+s)*360/o-180;let p=180-(u[1]+a)*360/o;u[1]=360/Math.PI*Math.atan(Math.exp(p*Math.PI/180))-90}}return this._toGeoJSON(l)}};var ce=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(ri,this,n),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new j(this._pbf,n,this.extent,this._keys,this._values)}};function ri(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(oi(n)))}function oi(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let i=e.readVarint()>>3;t=i===1?e.readString():i===2?e.readFloat():i===3?e.readDouble():i===4?e.readVarint64():i===5?e.readVarint():i===6?e.readSVarint():i===7?e.readBoolean():null}return t}var ue=class{layers;constructor(t,n){this.layers=t.readFields(si,{},n)}};function si(e,t,n){if(e===3&&n){let i=new ce(n,n.readVarint()+n.pos);i.length&&t&&(t[i.name]=i)}}function Ft(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[C(e.data)]],indices:[e.indices]};let i=[],r=[],o=[],s=[],a,l=0;for(let f,c=0,u;c<t;c++){u=e.indices[c]-l,f=e.indices[c+1]-l||e.data.length;let p=e.data.slice(u,f),h=C(p);if(h===0){let d=e.data.slice(0,u),x=e.data.slice(f);e.data=d.concat(x),l+=f-u;continue}a===void 0&&(a=h<0),a===h<0?(s.length&&(i.push(o),r.push(s)),s=[u],o=[h]):(o.push(h),s.push(u))}return o&&i.push(o),s.length&&r.push(s),{type:n,areas:i,indices:r,data:e.data}}function It(e,t,n,i){for(let r=0,o=e.length;r<o;r+=2){e[r]=(e[r]+t)*360/i-180;let s=180-(e[r+1]+n)*360/i;e[r+1]=360/Math.PI*Math.atan(Math.exp(s*Math.PI/180))-90}}function vt(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?ai(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function ai(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let i=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[i]=r}}var Tt,N,Ce,he,Oe,Ne,H;var pe=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,i,r,o,s){this.properties={},this.extent=i,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=r,this._values=o,this._geometryInfo=s,t.readFields(vt,this,n)}loadGeometry(){let t=this._pbf;t.pos=this._geometry,Tt=t.readVarint()+t.pos,N=1,he=0,Oe=0,Ne=0,H=0;let n=[],i=[];for(;t.pos<Tt;)if(he<=0&&(Ce=t.readVarint(),N=Ce&7,he=Ce>>3),he--,N===1||N===2)Oe+=t.readSVarint(),Ne+=t.readSVarint(),N===1&&n.push(H),i.push(Oe,Ne),H+=2;else if(N===7){if(H>0){let r=n[n.length-1];i.push(i[r],i[r+1]),H+=2}}else throw new Error(`unknown command ${N}`);return{data:i,indices:n}}_toBinaryCoordinates(t){let n=this.loadGeometry(),i;t(n.data,this);let r=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,i={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/r,i={type:"LineString",...n};break;case 3:i=Ft(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=i.indices.length;for(let s of i.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=i.data.length/r;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let o={type:"Feature",geometry:i,properties:this.properties};return this.id!==null&&(o.id=this.id),o}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let{x:n,y:i,z:r}=t,o=this.extent*Math.pow(2,r),s=this.extent*n,a=this.extent*i;return this._toBinaryCoordinates(l=>It(l,s,a,o))}};var de=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(li,this,n),this.length=this._features.length}feature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let i=this._pbf.readVarint()+this._pbf.pos;return new pe(this._pbf,i,this.extent,this._keys,this._values,n)}};function li(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(fi(n)))}function fi(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let i=e.readVarint()>>3;t=i===1?e.readString():i===2?e.readFloat():i===3?e.readDouble():i===4?e.readVarint64():i===5?e.readVarint():i===6?e.readSVarint():i===7?e.readBoolean():null}return t}var ge=class{layers;constructor(t,n){this.layers=t.readFields(ci,{},n)}};function ci(e,t,n){if(e===3&&n){let i=new de(n,n.readVarint()+n.pos);i.length&&t&&(t[i.name]=i)}}function Ge(e,t){let n=hi(t),i=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(i){case"columnar-table":return{shape:"columnar-table",data:ke(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:St(e,n)};case"geojson":return St(e,n);case"binary-geometry":return ke(e,n);case"binary":return ke(e,n);default:throw new Error(i||"undefined shape")}}function ke(e,t){let[n,i]=ui(e,t),r=Ee(n,i);return r.byteLength=e.byteLength,r}function ui(e,t){let n=[],i={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,i];let r=new ge(new Ue.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(s=>{let a=r.layers[s];if(a)for(let l=0;l<a.length;l++){let f=a.feature(l,i),c=di(f,t,s);n.push(c)}}),[n,i]}function St(e,t){if(e.byteLength<=0)return[];let n=[],i=new ue(new Ue.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(i.layers)).forEach(o=>{let s=i.layers[o];if(s)for(let a=0;a<s.length;a++){let l=s.feature(a),f=pi(l,t,o);n.push(f)}}),n}function hi(e){if(!e?.mvt)throw new Error("mvt options required");let t=e.mvt?.coordinates==="wgs84",{tileIndex:n}=e.mvt,i=n&&Number.isFinite(n.x)&&Number.isFinite(n.y)&&Number.isFinite(n.z);if(t&&!i)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.mvt}function pi(e,t,n){let i=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:gi);return t.layerProperty&&(i.properties[t.layerProperty]=n),i}function di(e,t,n){let i=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:mi);return t.layerProperty&&i.properties&&(i.properties[t.layerProperty]=n),i}function gi(e,t){let{extent:n}=t;for(let i=0;i<e.length;i++){let r=e[i];r[0]/=n,r[1]/=n}}function mi(e,t){let{extent:n}=t;for(let i=0,r=e.length;i<r;++i)e[i]/=n}var xi="4.2.0",Re={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:xi,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:null}}},me={...Re,parse:async(e,t)=>Ge(e,t),parseSync:Ge,binary:!0};var Bt=e=>e!==null&&typeof e=="object";function je(e,t){if(!e||!Bt(e))return null;let n={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(n.generator=e.generator),typeof e.generator_options=="string"&&(n.generatorOptions=e.generator_options),n.boundingBox=_t(e.bounds)||_t(e.antimeridian_adjusted_bounds),n.center=vi(e.center),n.maxZoom=Mt(e.maxzoom),n.minZoom=Mt(e.minzoom),typeof e?.json=="string")try{n.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let i=e.tilestats||n.metaJson?.tilestats,r=Pi(i,t),o=yi(e.vector_layers),s=Ii(o,r);return n={...n,layers:s},n.maxZoom===null&&s.length>0&&(n.maxZoom=s[0].maxZoom||null),n.minZoom===null&&s.length>0&&(n.minZoom=s[0].minZoom||null),n}function yi(e){return Array.isArray(e)?e.map(t=>wi(t)):[]}function wi(e){let t=Object.entries(e.fields||[]).map(([i,r])=>({name:i,...bt(String(r))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function Pi(e,t){return Bt(e)&&Array.isArray(e.layers)?e.layers.map(n=>Fi(n,t)):[]}function Fi(e,t){let n=[],i={},r=e.attributes||[];for(let o of r){let s=o.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];i[a]=i[a]||[],i[a].push(o),console.warn("ignoring tilestats indexed field",a)}else n[s]||n.push(Si(o,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function Ii(e,t){return e.map(n=>{let i=t.find(s=>s.name===n.name),r=i?.fields||[],o={...n};return delete o.fields,{...o,...i,fields:r}})}function _t(e){let t=Dt(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(Et)&&[t[1],t[3]].every(At))return[[t[0],t[1]],[t[2],t[3]]]}function vi(e){let t=Dt(e);return Array.isArray(t)&&t.length===3&&Et(t[0])&&At(t[1])&&Ti(t[2])?t:null}function Mt(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function At(e){return Number.isFinite(e)&&e<=90&&e>=-90}function Et(e){return Number.isFinite(e)&&e<=180&&e>=-180}function Ti(e){return Number.isFinite(e)&&e>=0&&e<=22}function Dt(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var Vt={number:{type:"float32"},numeric:{type:"float32"},string:{type:"utf8"},vachar:{type:"utf8"},float:{type:"float32"},int:{type:"int32"},int4:{type:"int32"},boolean:{type:"boolean"},bool:{type:"boolean"}};function Si(e={},t){let n=bt(e.type),i={name:e.attribute,...n};return typeof e.min=="number"&&(i.min=e.min),typeof e.max=="number"&&(i.max=e.max),typeof e.count=="number"&&(i.uniqueValueCount=e.count),e.values&&(i.values=e.values),i.values&&typeof t.maxValues=="number"&&(i.values=i.values?.slice(0,t.maxValues)),i}function bt(e){let t=e.toLowerCase();return!t||Vt[t],Vt[t]||{type:"string"}}var _i="4.2.0",Z={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:_i,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),i=JSON.parse(n),r={...Z.options.tilejson,...t?.tilejson};return je(i,r)},parseTextSync:(e,t)=>{let n=JSON.parse(e),i={...Z.options.tilejson,...t?.tilejson};return je(n,i)}};function K(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var A={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},Mi=A.self||A.window||A.global||{},Vi=A.window||A.self||A.global||{},Bi=A.global||A.self||A.window||{},Ai=A.document||{};var Ze=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Lt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),Ei=Lt&&parseFloat(Lt[1])||0;var Di="",Ct={};function ze(e){for(let t in Ct)if(e.startsWith(t)){let n=Ct[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Di}${e}`),e}var Q=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=bi(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function bi(e){let t=e?.fetch;if(t&&typeof t=="function")return(i,r)=>t(i,r);let n=e?.fetch;return n&&typeof n!="function"?i=>fetch(i,n):i=>fetch(i)}var Ot="4.2.0";var Li=globalThis.loaders?.parseImageNode,Je=typeof Image<"u",We=typeof ImageBitmap<"u",Ci=Boolean(Li),Ye=Ze?!0:Ci;function Nt(e){switch(e){case"auto":return We||Je||Ye;case"imagebitmap":return We;case"image":return Je;case"data":return Ye;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function kt(){if(We)return"imagebitmap";if(Je)return"image";if(Ye)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Oi(e){let t=Ni(e);if(!t)throw new Error("Not an image");return t}function Ut(e){switch(Oi(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function Ni(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var ki=/^data:image\/svg\+xml/,Ui=/\.svg((\?|#).*)?$/;function xe(e){return e&&(ki.test(e)||Ui.test(e))}function Gt(e,t){if(xe(t)){let i=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return Xe(e,t)}function Xe(e,t){if(xe(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ye(e,t,n){let i=Gt(e,n),r=self.URL||self.webkitURL,o=typeof i!="string"&&r.createObjectURL(i);try{return await Gi(o||i,t)}finally{o&&r.revokeObjectURL(o)}}async function Gi(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((i,r)=>{try{n.onload=()=>i(n),n.onerror=o=>{let s=o instanceof Error?o.message:"error";r(new Error(s))}}catch(o){r(o)}})}var Ri={},Rt=!0;async function jt(e,t,n){let i;xe(n)?i=await ye(e,t,n):i=Xe(e,n);let r=t&&t.imagebitmap;return await ji(i,r)}async function ji(e,t=null){if((Zi(t)||!Rt)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),Rt=!1}return await createImageBitmap(e)}function Zi(e){for(let t in e||Ri)return!1;return!0}function Zt(e){return!Yi(e,"ftyp",4)||!(e[8]&96)?null:zi(e)}function zi(e){switch(Ji(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Ji(e,t,n){return String.fromCharCode(...e.slice(t,n))}function Wi(e){return[...e].map(t=>t.charCodeAt(0))}function Yi(e,t,n=0){let i=Wi(t);for(let r=0;r<i.length;++r)if(i[r]!==e[r+n])return!1;return!0}var E=!1,q=!0;function k(e){let t=ee(e);return $i(t)||Qi(t)||Hi(t)||Ki(t)||Xi(t)}function Xi(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=Zt(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function $i(e){let t=ee(e);return t.byteLength>=24&&t.getUint32(0,E)===2303741511?{mimeType:"image/png",width:t.getUint32(16,E),height:t.getUint32(20,E)}:null}function Hi(e){let t=ee(e);return t.byteLength>=10&&t.getUint32(0,E)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,q),height:t.getUint16(8,q)}:null}function Ki(e){let t=ee(e);return t.byteLength>=14&&t.getUint16(0,E)===16973&&t.getUint32(2,q)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,q),height:t.getUint32(22,q)}:null}function Qi(e){let t=ee(e);if(!(t.byteLength>=3&&t.getUint16(0,E)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:r}=qi(),o=2;for(;o+9<t.byteLength;){let s=t.getUint16(o,E);if(r.has(s))return{mimeType:"image/jpeg",height:t.getUint16(o+5,E),width:t.getUint16(o+7,E)};if(!i.has(s))return null;o+=2,o+=t.getUint16(o,E)}return null}function qi(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function ee(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function zt(e,t){let{mimeType:n}=k(e)||{},i=globalThis.loaders?.parseImageNode;return K(i),await i(e,n)}async function Jt(e,t,n){t=t||{};let r=(t.image||{}).type||"auto",{url:o}=n||{},s=er(r),a;switch(s){case"imagebitmap":a=await jt(e,t,o);break;case"image":a=await ye(e,t,o);break;case"data":a=await zt(e,t);break;default:K(!1)}return r==="data"&&(a=Ut(a)),a}function er(e){switch(e){case"auto":case"data":return kt();default:return Nt(e),e}}var tr=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],nr=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],ir={image:{type:"auto",decode:!0}},$e={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Ot,mimeTypes:nr,extensions:tr,parse:Jt,tests:[e=>Boolean(k(new DataView(e)))],options:ir};var we=class extends Q{props;url;metadataUrl=null;data;schema="tms";metadata;extension;mimeType=null;constructor(t){super(t),this.props=t,this.url=ze(t.url),this.metadataUrl=t.metadataUrl===void 0?`${this.url}/tilejson.json`:t.metadataUrl,this.extension=t.extension||".png",this.data=this.url,this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata(),rr(this.url)&&(this.schema="template")}async getMetadata(){if(!this.metadataUrl)return null;let t;try{t=await this.fetch(this.metadataUrl)}catch(r){return console.error(r.message),null}if(!t.ok)return console.error(t.statusText),null;let n=await t.text();return Z.parseTextSync?.(n)||null}getTileMIMEType(){return this.mimeType}async getTile(t){let{x:n,y:i,zoom:r}=t,o=this.getTileURL(n,i,r),s=await this.fetch(o);return s.ok?await s.arrayBuffer():null}async getTileData(t){let{x:n,y:i,z:r}=t.index,o=await this.getTile({x:n,y:i,zoom:r,layers:[]});if(o===null)return null;let s=k(o);switch(this.mimeType=this.mimeType||s?.mimeType||"application/vnd.mapbox-vector-tile",this.mimeType){case"application/vnd.mapbox-vector-tile":return await this._parseVectorTile(o,{x:n,y:i,zoom:r,layers:[]});default:return await this._parseImageTile(o)}}async getImageTile(t){let n=await this.getTile(t);return n?this._parseImageTile(n):null}async _parseImageTile(t){return await $e.parse(t,this.loadOptions)}async getVectorTile(t){let n=await this.getTile(t);return n?this._parseVectorTile(n,t):null}async _parseVectorTile(t,n){let i={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:n.x,y:n.y,z:n.zoom},...this.loadOptions?.mvt},...this.loadOptions};return await me.parse(t,i)}getMetadataUrl(){return this.metadataUrl}getTileURL(t,n,i){switch(this.schema){case"xyz":return`${this.url}/${t}/${n}/${i}${this.extension}`;case"tms":return`${this.url}/${i}/${t}/${n}${this.extension}`;case"template":return lr(this.url,t,n,i,"0");default:throw new Error(this.schema)}}};function rr(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(e)}var or=new RegExp("{x}","g"),sr=new RegExp("{y}","g"),ar=new RegExp("{z}","g");function lr(e,t,n,i,r="0"){if(Array.isArray(e)){let s=fr(r)%e.length;e=e[s]}let o=e;return o=o.replace(or,String(t)),o=o.replace(sr,String(n)),o=o.replace(ar,String(i)),Number.isInteger(n)&&Number.isInteger(i)&&(o=o.replace(/\{-y\}/g,String(Math.pow(2,i)-n-1))),o}function fr(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function Pe(e,t,n,i){let r=i,o=n-t>>1,s=n-t,a,l=e[t],f=e[t+1],c=e[n],u=e[n+1];for(let p=t+3;p<n;p+=3){let h=cr(e[p],e[p+1],l,f,c,u);if(h>r)a=p,r=h;else if(h===r){let d=Math.abs(p-o);d<s&&(a=p,s=d)}}r>i&&(a-t>3&&Pe(e,t,a,i),e[a+2]=r,n-a>3&&Pe(e,a,n,i))}function cr(e,t,n,i,r,o){let s=r-n,a=o-i;if(s!==0||a!==0){let l=((e-n)*s+(t-i)*a)/(s*s+a*a);l>1?(n=r,i=o):l>0&&(n+=s*l,i+=a*l)}return s=e-n,a=t-i,s*s+a*a}function L(e,t,n,i){let r={id:e??null,type:t,geometry:n,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(t==="Point"||t==="MultiPoint"||t==="LineString")Fe(r,n);else if(t==="Polygon")Fe(r,n[0]);else if(t==="MultiLineString")for(let o of n)Fe(r,o);else if(t==="MultiPolygon")for(let o of n)Fe(r,o[0]);return r}function Fe(e,t){for(let n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function Yt(e,t){let n=[];if(e.type==="FeatureCollection")for(let i=0;i<e.features.length;i++)Ie(n,e.features[i],t,i);else e.type==="Feature"?Ie(n,e,t):Ie(n,{geometry:e},t);return n}function Ie(e,t,n,i){if(!t.geometry)return;let r=t.geometry.coordinates,o=t.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),a=[],l=t.id;if(n.promoteId?l=t.properties[n.promoteId]:n.generateId&&(l=i||0),o==="Point")Wt(r,a);else if(o==="MultiPoint")for(let f of r)Wt(f,a);else if(o==="LineString")Ke(r,a,s,!1);else if(o==="MultiLineString")if(n.lineMetrics){for(let f of r)a=[],Ke(f,a,s,!1),e.push(L(l,"LineString",a,t.properties));return}else He(r,a,s,!1);else if(o==="Polygon")He(r,a,s,!0);else if(o==="MultiPolygon")for(let f of r){let c=[];He(f,c,s,!0),a.push(c)}else if(o==="GeometryCollection"){for(let f of t.geometry.geometries)Ie(e,{id:l,geometry:f,properties:t.properties},n,i);return}else throw new Error("Input data is not a valid GeoJSON object.");e.push(L(l,o,a,t.properties))}function Wt(e,t){t.push(Xt(e[0]),$t(e[1]),0)}function Ke(e,t,n,i){let r,o,s=0;for(let l=0;l<e.length;l++){let f=Xt(e[l][0]),c=$t(e[l][1]);t.push(f,c,0),l>0&&(i?s+=(r*c-f*o)/2:s+=Math.sqrt(Math.pow(f-r,2)+Math.pow(c-o,2))),r=f,o=c}let a=t.length-3;t[2]=1,Pe(t,0,a,n),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function He(e,t,n,i){for(let r=0;r<e.length;r++){let o=[];Ke(e[r],o,n,i),t.push(o)}}function Xt(e){return e/360+.5}function $t(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function B(e,t,n,i,r,o,s,a){if(n/=t,i/=t,o>=n&&s<i)return e;if(s<n||o>=i)return null;let l=[];for(let f of e){let c=f.geometry,u=f.type,p=r===0?f.minX:f.minY,h=r===0?f.maxX:f.maxY;if(p>=n&&h<i){l.push(f);continue}else if(h<n||p>=i)continue;let d=[];if(u==="Point"||u==="MultiPoint")ur(c,d,n,i,r);else if(u==="LineString")Kt(c,d,n,i,r,!1,a.lineMetrics);else if(u==="MultiLineString")Qe(c,d,n,i,r,!1);else if(u==="Polygon")Qe(c,d,n,i,r,!0);else if(u==="MultiPolygon")for(let x of c){let w=[];Qe(x,w,n,i,r,!0),w.length&&d.push(w)}if(d.length){if(a.lineMetrics&&u==="LineString"){for(let x of d)l.push(L(f.id,u,x,f.tags));continue}(u==="LineString"||u==="MultiLineString")&&(d.length===1?(u="LineString",d=d[0]):u="MultiLineString"),(u==="Point"||u==="MultiPoint")&&(u=d.length===3?"Point":"MultiPoint"),l.push(L(f.id,u,d,f.tags))}}return l.length?l:null}function ur(e,t,n,i,r){for(let o=0;o<e.length;o+=3){let s=e[o+r];s>=n&&s<=i&&z(t,e[o],e[o+1],e[o+2])}}function Kt(e,t,n,i,r,o,s){let a=Ht(e),l=r===0?hr:pr,f=e.start,c,u;for(let I=0;I<e.length-3;I+=3){let _=e[I],g=e[I+1],m=e[I+2],v=e[I+3],F=e[I+4],T=r===0?_:g,S=r===0?v:F,M=!1;s&&(c=Math.sqrt(Math.pow(_-v,2)+Math.pow(g-F,2))),T<n?S>n&&(u=l(a,_,g,v,F,n),s&&(a.start=f+c*u)):T>i?S<i&&(u=l(a,_,g,v,F,i),s&&(a.start=f+c*u)):z(a,_,g,m),S<n&&T>=n&&(u=l(a,_,g,v,F,n),M=!0),S>i&&T<=i&&(u=l(a,_,g,v,F,i),M=!0),!o&&M&&(s&&(a.end=f+c*u),t.push(a),a=Ht(e)),s&&(f+=c)}let p=e.length-3,h=e[p],d=e[p+1],x=e[p+2],w=r===0?h:d;w>=n&&w<=i&&z(a,h,d,x),p=a.length-3,o&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&z(a,a[0],a[1],a[2]),a.length&&t.push(a)}function Ht(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Qe(e,t,n,i,r,o){for(let s of e)Kt(s,t,n,i,r,o,!1)}function z(e,t,n,i){e.push(t,n,i)}function hr(e,t,n,i,r,o){let s=(o-t)/(i-t);return z(e,o,n+(r-n)*s,1),s}function pr(e,t,n,i,r,o){let s=(o-n)/(r-n);return z(e,t+(i-t)*s,o,1),s}function qt(e,t){let n=t.buffer/t.extent,i=e,r=B(e,1,-1-n,n,0,-1,2,t),o=B(e,1,1-n,2+n,0,-1,2,t);return(r||o)&&(i=B(e,1,-n,1+n,0,-1,2,t)||[],r&&(i=Qt(r,1).concat(i)),o&&(i=i.concat(Qt(o,-1)))),i}function Qt(e,t){let n=[];for(let i=0;i<e.length;i++){let r=e[i],o=r.type,s;if(o==="Point"||o==="MultiPoint"||o==="LineString")s=qe(r.geometry,t);else if(o==="MultiLineString"||o==="Polygon"){s=[];for(let a of r.geometry)s.push(qe(a,t))}else if(o==="MultiPolygon"){s=[];for(let a of r.geometry){let l=[];for(let f of a)l.push(qe(f,t));s.push(l)}}n.push(L(r.id,o,s,r.tags))}return n}function qe(e,t){let n=[];n.size=e.size,e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let i=0;i<e.length;i+=3)n.push(e[i]+t,e[i+1],e[i+2]);return n}function et(e,t){if(e.transformed)return e;let n=1<<e.z,i=e.x,r=e.y;for(let o of e.features){let s=o.geometry,a=o.type;if(o.geometry=[],a===1)for(let l=0;l<s.length;l+=2)o.geometry.push(en(s[l],s[l+1],t,n,i,r));else for(let l=0;l<s.length;l++){let f=[];for(let c=0;c<s[l].length;c+=2)f.push(en(s[l][c],s[l][c+1],t,n,i,r));o.geometry.push(f)}}return e.transformed=!0,e}function en(e,t,n,i,r,o){return[Math.round(n*(e*i-r)),Math.round(n*(t*i-o))]}function tn(e,t,n,i,r){let o=t===r.maxZoom?0:r.tolerance/((1<<t)*r.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:n,y:i,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let a of e)dr(s,a,o,r);return s}function dr(e,t,n,i){let r=t.geometry,o=t.type,s=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),o==="Point"||o==="MultiPoint")for(let a=0;a<r.length;a+=3)s.push(r[a],r[a+1]),e.numPoints++,e.numSimplified++;else if(o==="LineString")tt(s,r,e,n,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(let a=0;a<r.length;a++)tt(s,r[a],e,n,o==="Polygon",a===0);else if(o==="MultiPolygon")for(let a=0;a<r.length;a++){let l=r[a];for(let f=0;f<l.length;f++)tt(s,l[f],e,n,!0,f===0)}if(s.length){let a=t.tags||null;if(o==="LineString"&&i.lineMetrics){a={};for(let f in t.tags)a[f]=t.tags[f];a.mapbox_clip_start=r.start/r.size,a.mapbox_clip_end=r.end/r.size}let l={geometry:s,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:a};t.id!==null&&(l.id=t.id),e.features.push(l)}}function tt(e,t,n,i,r,o){let s=i*i;if(i>0&&t.size<(r?s:i)){n.numPoints+=t.length/3;return}let a=[];for(let l=0;l<t.length;l+=3)(i===0||t[l+2]>s)&&(n.numSimplified++,a.push(t[l],t[l+1])),n.numPoints++;r&&gr(a,o),e.push(a)}function gr(e,t){let n=0;for(let i=0,r=e.length-2;i<e.length;r=i,i+=2)n+=(e[i]-e[r])*(e[i+1]+e[r+1]);if(n>0===t)for(let i=0,r=e.length;i<r/2;i+=2){let o=e[i],s=e[i+1];e[i]=e[r-2-i],e[i+1]=e[r-1-i],e[r-2-i]=o,e[r-1-i]=s}}var mr={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:void 0,generateId:!1,debug:0},ve=class{options;tiles={};tileCoords=[];stats={};total=0;constructor(t,n){this.options={...mr,...n},n=this.options;let i=n.debug;if(i&&console.time("preprocess data"),this.options.maxZoom<0||this.options.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&this.options.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=Yt(t,n);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles")),r=qt(r,this.options),r.length&&this.splitTile(r,0,0,0),i&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}getTile(t,n,i){let{extent:r,debug:o}=this.options;if(t<0||t>24)return null;let s=1<<t;n=n+s&s-1;let a=nt(t,n,i);if(this.tiles[a])return et(this.tiles[a],r);o>1&&console.log("drilling down to z%d-%d-%d",t,n,i);let l=t,f=n,c=i,u;for(;!u&&l>0;)l--,f=f>>1,c=c>>1,u=this.tiles[nt(l,f,c)];return!u||!u.source?null:(o>1&&(console.log("found parent tile z%d-%d-%d",l,f,c),console.time("drilling down")),this.splitTile(u.source,l,f,c,t,n,i),o>1&&console.timeEnd("drilling down"),this.tiles[a]?et(this.tiles[a],r):null)}splitTile(t,n,i,r,o,s,a){let l=[t,n,i,r],f=this.options,c=f.debug;for(;l.length;){r=l.pop(),i=l.pop(),n=l.pop(),t=l.pop();let u=1<<n,p=nt(n,i,r),h=this.tiles[p];if(!h&&(c>1&&console.time("creation"),h=this.tiles[p]=tn(t,n,i,r,f),this.tileCoords.push({z:n,x:i,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,i,r,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));let S=`z${n}`;this.stats[S]=(this.stats[S]||0)+1,this.total++}if(h.source=t,o===void 0){if(n===f.indexMaxZoom||h.numPoints<=f.indexMaxPoints)continue}else{if(n===f.maxZoom||n===o)continue;if(o!==void 0){let S=o-n;if(i!==s>>S||r!==a>>S)continue}}if(h.source=null,t.length===0)continue;c>1&&console.time("clipping");let d=.5*f.buffer/f.extent,x=.5-d,w=.5+d,I=1+d,_=null,g=null,m=null,v=null,F=B(t,u,i-d,i+w,0,h.minX,h.maxX,f),T=B(t,u,i+x,i+I,0,h.minX,h.maxX,f);t=null,F&&(_=B(F,u,r-d,r+w,1,h.minY,h.maxY,f),g=B(F,u,r+x,r+I,1,h.minY,h.maxY,f),F=null),T&&(m=B(T,u,r-d,r+w,1,h.minY,h.maxY,f),v=B(T,u,r+x,r+I,1,h.minY,h.maxY,f),T=null),c>1&&console.timeEnd("clipping"),l.push(_||[],n+1,i*2,r*2),l.push(g||[],n+1,i*2,r*2+1),l.push(m||[],n+1,i*2+1,r*2),l.push(v||[],n+1,i*2+1,r*2+1)}}};function nt(e,t,n){return((1<<e)*n+t)*32+e}return fn(te);})();
7
+ "use strict";var __exports__=(()=>{var wn=Object.create;var Q=Object.defineProperty;var Pn=Object.getOwnPropertyDescriptor;var Tn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,Fn=Object.prototype.hasOwnProperty;var vn=(e,t,n)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Sn=(e,t)=>{for(var n in t)Q(e,n,{get:t[n],enumerable:!0})},ue=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Tn(t))!Fn.call(e,r)&&r!==n&&Q(e,r,{get:()=>t[r],enumerable:!(o=Pn(t,r))||o.enumerable});return e},he=(e,t,n)=>(ue(e,t,"default"),n&&ue(n,t,"default")),ut=(e,t,n)=>(n=e!=null?wn(In(e)):{},ue(t||!e||!e.__esModule?Q(n,"default",{value:e,enumerable:!0}):n,e)),bn=e=>ue(Q({},"__esModule",{value:!0}),e);var pe=(e,t,n)=>(vn(e,typeof t!="symbol"?t+"":t,n),n);var pt=Ae((Zr,ht)=>{ht.exports=globalThis.loaders});var At=Ae(He=>{He.read=function(e,t,n,o,r){var i,s,a=r*8-o-1,l=(1<<a)-1,f=l>>1,c=-7,u=n?r-1:0,p=n?-1:1,h=e[t+u];for(u+=p,i=h&(1<<-c)-1,h>>=-c,c+=a;c>0;i=i*256+e[t+u],u+=p,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=o;c>0;s=s*256+e[t+u],u+=p,c-=8);if(i===0)i=1-f;else{if(i===l)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,o),i=i-f}return(h?-1:1)*s*Math.pow(2,i-o)};He.write=function(e,t,n,o,r,i){var s,a,l,f=i*8-r-1,c=(1<<f)-1,u=c>>1,p=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=o?0:i-1,d=o?1:-1,x=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+u>=1?t+=p/l:t+=p*Math.pow(2,1-u),t*l>=2&&(s++,l/=2),s+u>=c?(a=0,s=c):s+u>=1?(a=(t*l-1)*Math.pow(2,r),s=s+u):(a=t*Math.pow(2,u-1)*Math.pow(2,r),s=0));r>=8;e[n+h]=a&255,h+=d,a/=256,r-=8);for(s=s<<r|a,f+=r;f>0;e[n+h]=s&255,h+=d,s/=256,f-=8);e[n+h-d]|=x*128}});var kt=Ae((Cs,Ct)=>{"use strict";Ct.exports=y;var Te=At();function y(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}y.Varint=0;y.Fixed64=1;y.Bytes=2;y.Fixed32=5;var Je=(1<<16)*(1<<16),Lt=1/Je,To=12,Dt=typeof TextDecoder>"u"?null:new TextDecoder("utf8");y.prototype={destroy:function(){this.buf=null},readFields:function(e,t,n){for(n=n||this.length;this.pos<n;){var o=this.readVarint(),r=o>>3,i=this.pos;this.type=o&7,e(r,t,this),this.pos===i&&this.skip(o)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Ie(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=Nt(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Ie(this.buf,this.pos)+Ie(this.buf,this.pos+4)*Je;return this.pos+=8,e},readSFixed64:function(){var e=Ie(this.buf,this.pos)+Nt(this.buf,this.pos+4)*Je;return this.pos+=8,e},readFloat:function(){var e=Te.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Te.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,n,o;return o=t[this.pos++],n=o&127,o<128||(o=t[this.pos++],n|=(o&127)<<7,o<128)||(o=t[this.pos++],n|=(o&127)<<14,o<128)||(o=t[this.pos++],n|=(o&127)<<21,o<128)?n:(o=t[this.pos],n|=(o&15)<<28,Io(n,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=To&&Dt?Co(this.buf,t,e):Do(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==y.Bytes)return e.push(this.readVarint(t));var n=N(this);for(e=e||[];this.pos<n;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==y.Bytes)return e.push(this.readSVarint());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==y.Bytes)return e.push(this.readBoolean());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==y.Bytes)return e.push(this.readFloat());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==y.Bytes)return e.push(this.readDouble());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==y.Bytes)return e.push(this.readFixed32());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==y.Bytes)return e.push(this.readSFixed32());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==y.Bytes)return e.push(this.readFixed64());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==y.Bytes)return e.push(this.readSFixed64());var t=N(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===y.Varint)for(;this.buf[this.pos++]>127;);else if(t===y.Bytes)this.pos=this.readVarint()+this.pos;else if(t===y.Fixed32)this.pos+=4;else if(t===y.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var n=new Uint8Array(t);n.set(this.buf),this.buf=n,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),X(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),X(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),X(this.buf,e&-1,this.pos),X(this.buf,Math.floor(e*Lt),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),X(this.buf,e&-1,this.pos),X(this.buf,Math.floor(e*Lt),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Fo(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=ko(this.buf,e,this.pos);var n=this.pos-t;n>=128&&Vt(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n},writeFloat:function(e){this.realloc(4),Te.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Te.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var n=0;n<t;n++)this.buf[this.pos++]=e[n]},writeRawMessage:function(e,t){this.pos++;var n=this.pos;e(t,this);var o=this.pos-n;o>=128&&Vt(n,o,this),this.pos=n-1,this.writeVarint(o),this.pos+=o},writeMessage:function(e,t,n){this.writeTag(e,y.Bytes),this.writeRawMessage(t,n)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,bo,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,_o,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Mo,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Bo,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Eo,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,Ao,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Lo,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Vo,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,No,t)},writeBytesField:function(e,t){this.writeTag(e,y.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,y.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,y.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,y.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,y.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,y.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,y.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,y.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,y.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,y.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}};function Io(e,t,n){var o=n.buf,r,i;if(i=o[n.pos++],r=(i&112)>>4,i<128||(i=o[n.pos++],r|=(i&127)<<3,i<128)||(i=o[n.pos++],r|=(i&127)<<10,i<128)||(i=o[n.pos++],r|=(i&127)<<17,i<128)||(i=o[n.pos++],r|=(i&127)<<24,i<128)||(i=o[n.pos++],r|=(i&1)<<31,i<128))return Y(e,r,t);throw new Error("Expected varint not more than 10 bytes")}function N(e){return e.type===y.Bytes?e.readVarint()+e.pos:e.pos+1}function Y(e,t,n){return n?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Fo(e,t){var n,o;if(e>=0?(n=e%4294967296|0,o=e/4294967296|0):(n=~(-e%4294967296),o=~(-e/4294967296),n^4294967295?n=n+1|0:(n=0,o=o+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),vo(n,o,t),So(o,t)}function vo(e,t,n){n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos++]=e&127|128,e>>>=7,n.buf[n.pos]=e&127}function So(e,t){var n=(e&7)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Vt(e,t,n){var o=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));n.realloc(o);for(var r=n.pos-1;r>=e;r--)n.buf[r+o]=n.buf[r]}function bo(e,t){for(var n=0;n<e.length;n++)t.writeVarint(e[n])}function _o(e,t){for(var n=0;n<e.length;n++)t.writeSVarint(e[n])}function Bo(e,t){for(var n=0;n<e.length;n++)t.writeFloat(e[n])}function Eo(e,t){for(var n=0;n<e.length;n++)t.writeDouble(e[n])}function Mo(e,t){for(var n=0;n<e.length;n++)t.writeBoolean(e[n])}function Ao(e,t){for(var n=0;n<e.length;n++)t.writeFixed32(e[n])}function Lo(e,t){for(var n=0;n<e.length;n++)t.writeSFixed32(e[n])}function Vo(e,t){for(var n=0;n<e.length;n++)t.writeFixed64(e[n])}function No(e,t){for(var n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Ie(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function X(e,t,n){e[n]=t,e[n+1]=t>>>8,e[n+2]=t>>>16,e[n+3]=t>>>24}function Nt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Do(e,t,n){for(var o="",r=t;r<n;){var i=e[r],s=null,a=i>239?4:i>223?3:i>191?2:1;if(r+a>n)break;var l,f,c;a===1?i<128&&(s=i):a===2?(l=e[r+1],(l&192)===128&&(s=(i&31)<<6|l&63,s<=127&&(s=null))):a===3?(l=e[r+1],f=e[r+2],(l&192)===128&&(f&192)===128&&(s=(i&15)<<12|(l&63)<<6|f&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):a===4&&(l=e[r+1],f=e[r+2],c=e[r+3],(l&192)===128&&(f&192)===128&&(c&192)===128&&(s=(i&15)<<18|(l&63)<<12|(f&63)<<6|c&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,a=1):s>65535&&(s-=65536,o+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),o+=String.fromCharCode(s),r+=a}return o}function Co(e,t,n){return Dt.decode(e.subarray(t,n))}function ko(e,t,n){for(var o=0,r,i;o<t.length;o++){if(r=t.charCodeAt(o),r>55295&&r<57344)if(i)if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}else r=i-55296<<10|r-56320|65536,i=null;else{r>56319||o+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}else i&&(e[n++]=239,e[n++]=191,e[n++]=189,i=null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=r&63|128)}return n}});var ce={};Sn(ce,{GeoJSONTileSource:()=>fe,MVTLoader:()=>ve,MVTSource:()=>_e,MVTWorkerLoader:()=>$e,TileJSONLoader:()=>$});he(ce,ut(pt(),1));function D(e){return D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D(e)}function Le(e,t){if(D(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var o=n.call(e,t||"default");if(D(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ve(e){var t=Le(e,"string");return D(t)==="symbol"?t:String(t)}function P(e,t,n){return t=Ve(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var q={x:0,y:1,z:2};function U(e,t={}){let{start:n=0,end:o=e.length,plane:r="xy"}=t,i=t.size||2,s=0,a=q[r[0]],l=q[r[1]];for(let f=n,c=o-i;f<o;f+=i)s+=(e[f+a]-e[c+a])*(e[f+l]+e[c+l]),c=f;return s/2}function De(e,t,n=2,o,r="xy"){let i=t&&t.length,s=i?t[0]*n:e.length,a=gt(e,0,s,n,!0,o&&o[0],r),l=[];if(!a||a.next===a.prev)return l;let f,c,u,p,h,d,x;if(i&&(a=Vn(e,t,a,n,o,r)),e.length>80*n){p=c=e[0],h=u=e[1];for(let w=n;w<s;w+=n)d=e[w],x=e[w+1],d<p&&(p=d),x<h&&(h=x),d>c&&(c=d),x>u&&(u=x);f=Math.max(c-p,u-h),f=f!==0?32767/f:0}return ee(a,l,n,p,h,f,0),l}function gt(e,t,n,o,r,i,s){let a,l;i===void 0&&(i=U(e,{start:t,end:n,size:o,plane:s}));let f=q[s[0]],c=q[s[1]];if(r===i<0)for(a=t;a<n;a+=o)l=dt(a,e[a+f],e[a+c],l);else for(a=n-o;a>=t;a-=o)l=dt(a,e[a+f],e[a+c],l);return l&&me(l,l.next)&&(ne(l),l=l.next),l}function G(e,t){if(!e)return e;t||(t=e);let n=e,o;do if(o=!1,!n.steiner&&(me(n,n.next)||T(n.prev,n,n.next)===0)){if(ne(n),n=t=n.prev,n===n.next)break;o=!0}else n=n.next;while(o||n!==t);return t}function ee(e,t,n,o,r,i,s){if(!e)return;!s&&i&&Un(e,o,r,i);let a=e,l,f;for(;e.prev!==e.next;){if(l=e.prev,f=e.next,i?Mn(e,o,r,i):En(e)){t.push(l.i/n|0),t.push(e.i/n|0),t.push(f.i/n|0),ne(e),e=f.next,a=f.next;continue}if(e=f,e===a){s?s===1?(e=An(G(e),t,n),ee(e,t,n,o,r,i,2)):s===2&&Ln(e,t,n,o,r,i):ee(G(e),t,n,o,r,i,1);break}}}function En(e){let t=e.prev,n=e,o=e.next;if(T(t,n,o)>=0)return!1;let r=t.x,i=n.x,s=o.x,a=t.y,l=n.y,f=o.y,c=r<i?r<s?r:s:i<s?i:s,u=a<l?a<f?a:f:l<f?l:f,p=r>i?r>s?r:s:i>s?i:s,h=a>l?a>f?a:f:l>f?l:f,d=o.next;for(;d!==t;){if(d.x>=c&&d.x<=p&&d.y>=u&&d.y<=h&&Z(r,a,i,l,s,f,d.x,d.y)&&T(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Mn(e,t,n,o){let r=e.prev,i=e,s=e.next;if(T(r,i,s)>=0)return!1;let a=r.x,l=i.x,f=s.x,c=r.y,u=i.y,p=s.y,h=a<l?a<f?a:f:l<f?l:f,d=c<u?c<p?c:p:u<p?u:p,x=a>l?a>f?a:f:l>f?l:f,w=c>u?c>p?c:p:u>p?u:p,F=Ne(h,d,t,n,o),_=Ne(x,w,t,n,o),g=e.prevZ,m=e.nextZ;for(;g&&g.z>=F&&m&&m.z<=_;){if(g.x>=h&&g.x<=x&&g.y>=d&&g.y<=w&&g!==r&&g!==s&&Z(a,c,l,u,f,p,g.x,g.y)&&T(g.prev,g,g.next)>=0||(g=g.prevZ,m.x>=h&&m.x<=x&&m.y>=d&&m.y<=w&&m!==r&&m!==s&&Z(a,c,l,u,f,p,m.x,m.y)&&T(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;g&&g.z>=F;){if(g.x>=h&&g.x<=x&&g.y>=d&&g.y<=w&&g!==r&&g!==s&&Z(a,c,l,u,f,p,g.x,g.y)&&T(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;m&&m.z<=_;){if(m.x>=h&&m.x<=x&&m.y>=d&&m.y<=w&&m!==r&&m!==s&&Z(a,c,l,u,f,p,m.x,m.y)&&T(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function An(e,t,n){let o=e;do{let r=o.prev,i=o.next.next;!me(r,i)&&mt(r,o,o.next,i)&&te(r,i)&&te(i,r)&&(t.push(r.i/n|0),t.push(o.i/n|0),t.push(i.i/n|0),ne(o),ne(o.next),o=e=i),o=o.next}while(o!==e);return G(o)}function Ln(e,t,n,o,r,i){let s=e;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&jn(s,a)){let l=xt(s,a);s=G(s,s.next),l=G(l,l.next),ee(s,t,n,o,r,i,0),ee(l,t,n,o,r,i,0);return}a=a.next}s=s.next}while(s!==e)}function Vn(e,t,n,o,r,i){let s=[],a,l,f,c,u;for(a=0,l=t.length;a<l;a++)f=t[a]*o,c=a<l-1?t[a+1]*o:e.length,u=gt(e,f,c,o,!1,r&&r[a+1],i),u===u.next&&(u.steiner=!0),s.push(On(u));for(s.sort(Nn),a=0;a<s.length;a++)n=Dn(s[a],n);return n}function Nn(e,t){return e.x-t.x}function Dn(e,t){let n=Cn(e,t);if(!n)return t;let o=xt(n,e);return G(o,o.next),G(n,n.next)}function Cn(e,t){let n=t,o=e.x,r=e.y,i=-1/0,s;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){let p=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=o&&p>i&&(i=p,s=n.x<n.next.x?n:n.next,p===o))return s}n=n.next}while(n!==t);if(!s)return null;let a=s,l=s.x,f=s.y,c=1/0,u;n=s;do o>=n.x&&n.x>=l&&o!==n.x&&Z(r<f?o:i,r,l,f,r<f?i:o,r,n.x,n.y)&&(u=Math.abs(r-n.y)/(o-n.x),te(n,e)&&(u<c||u===c&&(n.x>s.x||n.x===s.x&&kn(s,n)))&&(s=n,c=u)),n=n.next;while(n!==a);return s}function kn(e,t){return T(e.prev,e,t.prev)<0&&T(t.next,e,e.next)<0}function Un(e,t,n,o){let r=e;do r.z===0&&(r.z=Ne(r.x,r.y,t,n,o)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,Gn(r)}function Gn(e){let t,n,o=1,r,i,s,a,l,f;do{for(i=e,e=null,f=null,r=0;i;){for(r++,a=i,s=0,n=0;n<o&&(s++,a=a.nextZ,!!a);n++);for(l=o;s>0||l>0&&a;)s!==0&&(l===0||!a||i.z<=a.z)?(t=i,i=i.nextZ,s--):(t=a,a=a.nextZ,l--),f?f.nextZ=t:e=t,t.prevZ=f,f=t;i=a}f.nextZ=null,o*=2}while(r>1);return e}function Ne(e,t,n,o,r){return e=(e-n)*r|0,t=(t-o)*r|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function On(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Z(e,t,n,o,r,i,s,a){return(r-s)*(t-a)>=(e-s)*(i-a)&&(e-s)*(o-a)>=(n-s)*(t-a)&&(n-s)*(i-a)>=(r-s)*(o-a)}function jn(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Rn(e,t)&&(te(e,t)&&te(t,e)&&zn(e,t)&&(T(e.prev,e,t.prev)||T(e,t.prev,t))||me(e,t)&&T(e.prev,e,e.next)>0&&T(t.prev,t,t.next)>0)}function T(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function me(e,t){return e.x===t.x&&e.y===t.y}function mt(e,t,n,o){let r=ge(T(e,t,n)),i=ge(T(e,t,o)),s=ge(T(n,o,e)),a=ge(T(n,o,t));return!!(r!==i&&s!==a||r===0&&de(e,n,t)||i===0&&de(e,o,t)||s===0&&de(n,e,o)||a===0&&de(n,t,o))}function de(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ge(e){return e>0?1:e<0?-1:0}function Rn(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&mt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function te(e,t){return T(e.prev,e,e.next)<0?T(e,t,e.next)>=0&&T(e,e.prev,t)>=0:T(e,t,e.prev)<0||T(e,e.next,t)<0}function zn(e,t){let n=e,o=!1,r=(e.x+t.x)/2,i=(e.y+t.y)/2;do n.y>i!=n.next.y>i&&n.next.y!==n.y&&r<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==e);return o}function xt(e,t){let n=new oe(e.i,e.x,e.y),o=new oe(t.i,t.x,t.y),r=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,o.next=n,n.prev=o,i.next=o,o.prev=i,o}function dt(e,t,n,o){let r=new oe(e,t,n);return o?(r.next=o.next,r.prev=o,o.next.prev=r,o.next=r):(r.prev=r,r.next=r),r}function ne(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var oe=class{constructor(t,n,o){P(this,"i",void 0),P(this,"x",void 0),P(this,"y",void 0),P(this,"prev",null),P(this,"next",null),P(this,"z",0),P(this,"prevZ",null),P(this,"nextZ",null),P(this,"steiner",!1),this.i=t,this.x=n,this.y=o}};function Ue(e,t,n){let o=Yn(e),r=Object.keys(o).filter(i=>o[i]!==Array);return Xn(e,{propArrayTypes:o,...t},{numericPropKeys:n&&n.numericPropKeys||r,PositionDataType:n?n.PositionDataType:Float32Array,triangulate:n?n.triangulate:!0})}function Yn(e){let t={};for(let n of e)if(n.properties)for(let o in n.properties){let r=n.properties[o];t[o]=to(r,t[o])}return t}function Xn(e,t,n){let{pointPositionsCount:o,pointFeaturesCount:r,linePositionsCount:i,linePathsCount:s,lineFeaturesCount:a,polygonPositionsCount:l,polygonObjectsCount:f,polygonRingsCount:c,polygonFeaturesCount:u,propArrayTypes:p,coordLength:h}=t,{numericPropKeys:d=[],PositionDataType:x=Float32Array,triangulate:w=!0}=n,F=e[0]&&"id"in e[0],_=e.length>65535?Uint32Array:Uint16Array,g={type:"Point",positions:new x(o*h),globalFeatureIds:new _(o),featureIds:r>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},m={type:"LineString",pathIndices:i>65535?new Uint32Array(s+1):new Uint16Array(s+1),positions:new x(i*h),globalFeatureIds:new _(i),featureIds:a>65535?new Uint32Array(i):new Uint16Array(i),numericProps:{},properties:[],fields:[]},v={type:"Polygon",polygonIndices:l>65535?new Uint32Array(f+1):new Uint16Array(f+1),primitivePolygonIndices:l>65535?new Uint32Array(c+1):new Uint16Array(c+1),positions:new x(l*h),globalFeatureIds:new _(l),featureIds:u>65535?new Uint32Array(l):new Uint16Array(l),numericProps:{},properties:[],fields:[]};w&&(v.triangles=[]);for(let S of[g,m,v])for(let b of d){let B=p[b];S.numericProps[b]=new B(S.positions.length/h)}m.pathIndices[s]=i,v.polygonIndices[f]=l,v.primitivePolygonIndices[c]=l;let I={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let S of e){let b=S.geometry,B=S.properties||{};switch(b.type){case"Point":$n(b,g,I,h,B),g.properties.push(ke(B,d)),F&&g.fields.push({id:S.id}),I.pointFeature++;break;case"LineString":Kn(b,m,I,h,B),m.properties.push(ke(B,d)),F&&m.fields.push({id:S.id}),I.lineFeature++;break;case"Polygon":Qn(b,v,I,h,B),v.properties.push(ke(B,d)),F&&v.fields.push({id:S.id}),I.polygonFeature++;break;default:throw new Error("Invalid geometry type")}I.feature++}return eo(g,m,v,h)}function $n(e,t,n,o,r){t.positions.set(e.data,n.pointPosition*o);let i=e.data.length/o;Ge(t,r,n.pointPosition,i),t.globalFeatureIds.fill(n.feature,n.pointPosition,n.pointPosition+i),t.featureIds.fill(n.pointFeature,n.pointPosition,n.pointPosition+i),n.pointPosition+=i}function Kn(e,t,n,o,r){t.positions.set(e.data,n.linePosition*o);let i=e.data.length/o;Ge(t,r,n.linePosition,i),t.globalFeatureIds.fill(n.feature,n.linePosition,n.linePosition+i),t.featureIds.fill(n.lineFeature,n.linePosition,n.linePosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=e.indices[s],f=s===a-1?e.data.length:e.indices[s+1];t.pathIndices[n.linePath++]=n.linePosition,n.linePosition+=(f-l)/o}}function Qn(e,t,n,o,r){t.positions.set(e.data,n.polygonPosition*o);let i=e.data.length/o;Ge(t,r,n.polygonPosition,i),t.globalFeatureIds.fill(n.feature,n.polygonPosition,n.polygonPosition+i),t.featureIds.fill(n.polygonFeature,n.polygonPosition,n.polygonPosition+i);for(let s=0,a=e.indices.length;s<a;++s){let l=n.polygonPosition;t.polygonIndices[n.polygonObject++]=l;let f=e.areas[s],c=e.indices[s],u=e.indices[s+1];for(let h=0,d=c.length;h<d;++h){let x=c[h],w=h===d-1?u===void 0?e.data.length:u[0]:c[h+1];t.primitivePolygonIndices[n.polygonRing++]=n.polygonPosition,n.polygonPosition+=(w-x)/o}let p=n.polygonPosition;qn(t,f,c,{startPosition:l,endPosition:p,coordLength:o})}}function qn(e,t,n,{startPosition:o,endPosition:r,coordLength:i}){if(!e.triangles)return;let s=o*i,a=r*i,l=e.positions.subarray(s,a),f=n[0],c=n.slice(1).map(p=>(p-f)/i),u=De(l,c,i,t);for(let p=0,h=u.length;p<h;++p)e.triangles.push(o+u[p])}function Ce(e,t){let n={};for(let o in e)n[o]={value:e[o],size:t};return n}function eo(e,t,n,o){let r={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:o},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Ce(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:o},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Ce(t.numericProps,1)},polygons:{...n,positions:{value:n.positions,size:o},polygonIndices:{value:n.polygonIndices,size:1},primitivePolygonIndices:{value:n.primitivePolygonIndices,size:1},globalFeatureIds:{value:n.globalFeatureIds,size:1},featureIds:{value:n.featureIds,size:1},numericProps:Ce(n.numericProps,1)}};return r.polygons&&n.triangles&&(r.polygons.triangles={value:new Uint32Array(n.triangles),size:1}),r}function Ge(e,t,n,o){for(let r in e.numericProps)if(r in t){let i=t[r];e.numericProps[r].fill(i,n,n+o)}}function ke(e,t){let n={};for(let o in e)t.includes(o)||(n[o]=e[o]);return n}function to(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function re(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var L={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},no=L.self||L.window||L.global||{},oo=L.window||L.self||L.global||{},ro=L.global||L.self||L.window||{},io=L.document||{};var Oe=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Pt=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),so=Pt&&parseFloat(Pt[1])||0;function je(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,n=e||t;return!!(n&&n.indexOf("Electron")>=0)}function M(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||je()}var ao=globalThis.self||globalThis.window||globalThis.global,H=globalThis.window||globalThis.self||globalThis.global,lo=globalThis.document||{},O=globalThis.process||{},fo=globalThis.console,zi=globalThis.navigator||{};var xe=typeof __VERSION__<"u"?__VERSION__:"untranspiled source",Ji=M();function co(e){try{let t=window[e],n="__storage_test__";return t.setItem(n,n),t.removeItem(n),t}catch{return null}}var ye=class{constructor(t,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";P(this,"storage",void 0),P(this,"id",void 0),P(this,"config",void 0),this.storage=co(o),this.id=t,this.config=n,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let n=JSON.stringify(this.config);this.storage.setItem(this.id,n)}}_loadConfiguration(){let t={};if(this.storage){let n=this.storage.getItem(this.id);t=n?JSON.parse(n):{}}return Object.assign(this.config,t),this}};function Tt(e){let t;return e<10?t="".concat(e.toFixed(2),"ms"):e<100?t="".concat(e.toFixed(1),"ms"):e<1e3?t="".concat(e.toFixed(0),"ms"):t="".concat((e/1e3).toFixed(2),"s"),t}function It(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8,n=Math.max(t-e.length,0);return"".concat(" ".repeat(n)).concat(e)}function we(e,t,n){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600,r=e.src.replace(/\(/g,"%28").replace(/\)/g,"%29");e.width>o&&(n=Math.min(n,o/e.width));let i=e.width*n,s=e.height*n,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(r,");"),"background-size:".concat(i,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}var Pe;(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Pe||(Pe={}));var uo=10;function Ft(e){return typeof e!="string"?e:(e=e.toUpperCase(),Pe[e]||Pe.WHITE)}function vt(e,t,n){if(!M&&typeof e=="string"){if(t){let o=Ft(t);e="\x1B[".concat(o,"m").concat(e,"\x1B[39m")}if(n){let o=Ft(n);e="\x1B[".concat(o+uo,"m").concat(e,"\x1B[49m")}}return e}function St(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"],n=Object.getPrototypeOf(e),o=Object.getOwnPropertyNames(n),r=e;for(let i of o){let s=r[i];typeof s=="function"&&(t.find(a=>i===a)||(r[i]=s.bind(e)))}}function J(e,t){if(!e)throw new Error(t||"Assertion failed")}function j(){let e;if(M()&&H.performance){var t,n;e=H===null||H===void 0||(t=H.performance)===null||t===void 0||(n=t.now)===null||n===void 0?void 0:n.call(t)}else if("hrtime"in O){var o;let r=O===null||O===void 0||(o=O.hrtime)===null||o===void 0?void 0:o.call(O);e=r[0]*1e3+r[1]/1e6}else e=Date.now();return e}var W={debug:M()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},ho={enabled:!0,level:0};function E(){}var bt={},_t={once:!0},C=class{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};P(this,"id",void 0),P(this,"VERSION",xe),P(this,"_startTs",j()),P(this,"_deltaTs",j()),P(this,"_storage",void 0),P(this,"userData",{}),P(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new ye("__probe-".concat(this.id,"__"),ho),this.timeStamp("".concat(this.id," started")),St(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((j()-this._startTs).toPrecision(10))}getDelta(){return Number((j()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,n){this._storage.setConfiguration({[t]:n})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,n){J(t,n)}warn(t){return this._getLogFunction(0,t,W.warn,arguments,_t)}error(t){return this._getLogFunction(0,t,W.error,arguments)}deprecated(t,n){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(n,"` instead"))}removed(t,n){return this.error("`".concat(t,"` has been removed. Use `").concat(n,"` instead"))}probe(t,n){return this._getLogFunction(t,n,W.log,arguments,{time:!0,once:!0})}log(t,n){return this._getLogFunction(t,n,W.debug,arguments)}info(t,n){return this._getLogFunction(t,n,console.info,arguments)}once(t,n){return this._getLogFunction(t,n,W.debug||W.info,arguments,_t)}table(t,n,o){return n?this._getLogFunction(t,n,console.table||E,o&&[o],{tag:xo(n)}):E}image(t){let{logLevel:n,priority:o,image:r,message:i="",scale:s=1}=t;return this._shouldLog(n||o)?M()?mo({image:r,message:i,scale:s}):go({image:r,message:i,scale:s}):E}time(t,n){return this._getLogFunction(t,n,console.time?console.time:console.info)}timeEnd(t,n){return this._getLogFunction(t,n,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,n){return this._getLogFunction(t,n,console.timeStamp||E)}group(t,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1},r=Bt({logLevel:t,message:n,opts:o}),{collapsed:i}=o;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,n){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,n,Object.assign({},o,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||E)}withGroup(t,n,o){this.group(t,n)();try{o()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Et(t)}_getLogFunction(t,n,o,r,i){if(this._shouldLog(t)){i=Bt({logLevel:t,message:n,args:r,opts:i}),o=o||i.method,J(o),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=j();let s=i.tag||i.message;if(i.once&&s)if(!bt[s])bt[s]=j();else return E;return n=po(this.id,i.message,i),o.bind(console,n,...i.args)}return E}};P(C,"VERSION",xe);function Et(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return J(Number.isFinite(t)&&t>=0),t}function Bt(e){let{logLevel:t,message:n}=e;e.logLevel=Et(t);let o=e.args?Array.from(e.args):[];for(;o.length&&o.shift()!==n;);switch(typeof t){case"string":case"function":n!==void 0&&o.unshift(n),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let r=typeof e.message;return J(r==="string"||r==="object"),Object.assign(e,{args:o},e.opts)}function po(e,t,n){if(typeof t=="string"){let o=n.time?It(Tt(n.total)):"";t=n.time?"".concat(e,": ").concat(o," ").concat(t):"".concat(e,": ").concat(t),t=vt(t,n.color,n.background)}return t}function go(e){let{image:t,message:n="",scale:o=1}=e;return console.warn("removed"),E}function mo(e){let{image:t,message:n="",scale:o=1}=e;if(typeof t=="string"){let i=new Image;return i.onload=()=>{let s=we(i,n,o);console.log(...s)},i.src=t,E}let r=t.nodeName||"";if(r.toLowerCase()==="img")return console.log(...we(t,n,o)),E;if(r.toLowerCase()==="canvas"){let i=new Image;return i.onload=()=>console.log(...we(i,n,o)),i.src=t.toDataURL(),E}return E}function xo(e){for(let t in e)for(let n in e[t])return n||"untitled";return"empty"}var ws=new C({id:"@probe.gl/log"});var Re="4.2.0",yo=Re[0]>="0"&&Re[0]<="9"?`v${Re}`:"",ze=new C({id:`loaders.gl ${yo}`});var wo="",Mt={};function Ze(e){for(let t in Mt)if(e.startsWith(t)){let n=Mt[t];e=e.replace(t,n)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${wo}${e}`),e}var ie=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Po(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let n=this._needsRefresh;return t&&(this._needsRefresh=!1),n}};function Po(e){let t=e?.fetch;if(t&&typeof t=="function")return(o,r)=>t(o,r);let n=e?.fetch;return n&&typeof n!="function"?o=>fetch(o,n):o=>fetch(o)}var Ye=ut(kt(),1);function Uo(e){let t=0;for(let n=0,o=e.length-1,r,i;n<e.length;o=n++)r=e[n],i=e[o],t+=(i[0]-r[0])*(r[1]+i[1]);return t}function Ut(e,t,n){let{x:o,y:r,z:i}=t,s=n*Math.pow(2,i),a=n*o,l=n*r;for(let f=0,c=e.length;f<c;f+=2){e[f]=(e[f]+a)*360/s-180;let u=180-(e[f+1]+l)*360/s;e[f+1]=360/Math.PI*Math.atan(Math.exp(u*Math.PI/180))-90}}function Gt(e){let t=e.length;if(t<=1)return[e];let n=[],o,r;for(let i=0;i<t;i++){let s=Uo(e[i]);s!==0&&(r===void 0&&(r=s<0),r===s<0?(o&&n.push(o),o=[e[i]]):o&&o.push(e[i]))}return o&&n.push(o),n}function Ot(e){let t=e.indices.length,n="Polygon";if(t<=1)return{type:n,data:e.data,areas:[[U(e.data)]],indices:[e.indices]};let o=[],r=[],i=[],s=[],a,l=0;for(let f,c=0,u;c<t;c++){u=e.indices[c]-l,f=e.indices[c+1]-l||e.data.length;let p=e.data.slice(u,f),h=U(p);if(h===0){let d=e.data.slice(0,u),x=e.data.slice(f);e.data=d.concat(x),l+=f-u;continue}a===void 0&&(a=h<0),a===h<0?(s.length&&(o.push(i),r.push(s)),s=[u],i=[h]):(i.push(h),s.push(u))}return i&&o.push(i),s.length&&r.push(s),{type:n,areas:o,indices:r,data:e.data}}var R=class{properties;extent;type;id;_pbf;_geometry;_keys;_values;_geometryInfo;constructor(t,n,o,r,i,s){this.properties={},this.extent=o,this.type=0,this.id=null,this._pbf=t,this._geometry=-1,this._keys=r,this._values=i,this._geometryInfo=s,t.readFields(Go,this,n)}toGeoJSON(t){let n=this.loadGeometry();if(typeof t=="function")return jt(this,n,t);let{x:o,y:r,z:i}=t,s=this.extent*Math.pow(2,i),a=this.extent*o,l=this.extent*r;function f(c){for(let u=0;u<c.length;u++){let p=c[u];p[0]=(p[0]+a)*360/s-180;let h=180-(p[1]+l)*360/s;p[1]=360/Math.PI*Math.atan(Math.exp(h*Math.PI/180))-90}}return jt(this,n,f)}toBinaryCoordinates(t){if(typeof t=="function")return this._toBinaryCoordinates(t);let n=t;return this._toBinaryCoordinates(o=>Ut(o,n,this.extent))}bbox(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,o=1,r=0,i=0,s=0,a=1/0,l=-1/0,f=1/0,c=-1/0;for(;t.pos<n;){if(r<=0){let u=t.readVarint();o=u&7,r=u>>3}if(r--,o===1||o===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>l&&(l=i),s<f&&(f=s),s>c&&(c=s);else if(o!==7)throw new Error(`unknown command ${o}`)}return[a,f,l,c]}_toBinaryCoordinates(t){let n=this.loadFlatGeometry(),o;t(n.data,this);let r=2;switch(this.type){case 1:this._geometryInfo.pointFeaturesCount++,this._geometryInfo.pointPositionsCount+=n.indices.length,o={type:"Point",...n};break;case 2:this._geometryInfo.lineFeaturesCount++,this._geometryInfo.linePathsCount+=n.indices.length,this._geometryInfo.linePositionsCount+=n.data.length/r,o={type:"LineString",...n};break;case 3:o=Ot(n),this._geometryInfo.polygonFeaturesCount++,this._geometryInfo.polygonObjectsCount+=o.indices.length;for(let s of o.indices)this._geometryInfo.polygonRingsCount+=s.length;this._geometryInfo.polygonPositionsCount+=o.data.length/r;break;default:throw new Error(`Invalid geometry type: ${this.type}`)}let i={type:"Feature",geometry:o,properties:this.properties};return this.id!==null&&(i.id=this.id),i}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,o=1,r=0,i=0,s=0,a=[],l;for(;t.pos<n;){if(r<=0){let f=t.readVarint();o=f&7,r=f>>3}switch(r--,o){case 1:case 2:i+=t.readSVarint(),s+=t.readSVarint(),o===1&&(l&&a.push(l),l=[]),l&&l.push([i,s]);break;case 7:l&&l.push(l[0].slice());break;default:throw new Error(`unknown command ${o}`)}}return l&&a.push(l),a}loadFlatGeometry(){let t=this._pbf;t.pos=this._geometry;let n=t.readVarint()+t.pos,o=1,r,i=0,s=0,a=0,l=0,f=[],c=[];for(;t.pos<n;)if(i<=0&&(r=t.readVarint(),o=r&7,i=r>>3),i--,o===1||o===2)s+=t.readSVarint(),a+=t.readSVarint(),o===1&&f.push(l),c.push(s,a),l+=2;else if(o===7){if(l>0){let u=f[f.length-1];c.push(c[u],c[u+1]),l+=2}}else throw new Error(`unknown command ${o}`);return{data:c,indices:f}}};pe(R,"types",["Unknown","Point","LineString","Polygon"]);function jt(e,t,n){let o=R.types[e.type],r,i,s;switch(e.type){case 1:let l=[];for(r=0;r<t.length;r++)l[r]=t[r][0];s=l,n(s,e);break;case 2:for(s=t,r=0;r<s.length;r++)n(s[r],e);break;case 3:for(s=Gt(t),r=0;r<s.length;r++)for(i=0;i<s[r].length;i++)n(s[r][i],e);break;default:throw new Error("illegal vector tile type")}s.length===1?s=s[0]:o=`Multi${o}`;let a={type:"Feature",geometry:{type:o,coordinates:s},properties:e.properties};return e.id!==null&&(a.id=e.id),a}function Go(e,t,n){t&&n&&(e===1?t.id=n.readVarint():e===2?Oo(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos))}function Oo(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let o=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[o]=r}}var Fe=class{version;name;extent;length;_pbf;_keys;_values;_features;constructor(t,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(jo,this,n),this.length=this._features.length}getGeoJSONFeature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let n=this._pbf.readVarint()+this._pbf.pos;return new R(this._pbf,n,this.extent,this._keys,this._values)}getBinaryFeature(t,n){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];let o=this._pbf.readVarint()+this._pbf.pos;return new R(this._pbf,o,this.extent,this._keys,this._values,n)}};function jo(e,t,n){t&&n&&(e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(Ro(n)))}function Ro(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let o=e.readVarint()>>3;t=o===1?e.readString():o===2?e.readFloat():o===3?e.readDouble():o===4?e.readVarint64():o===5?e.readVarint():o===6?e.readSVarint():o===7?e.readBoolean():null}return t}var se=class{layers;constructor(t,n){this.layers=t.readFields(zo,{},n)}};function zo(e,t,n){if(e===3&&n){let o=new Fe(n,n.readVarint()+n.pos);o.length&&t&&(t[o.name]=o)}}function Xe(e,t){let n=Ho(t),o=t?.gis?.format||t?.mvt?.shape||t?.shape;switch(o){case"columnar-table":return{shape:"columnar-table",data:We(e,n)};case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",features:Rt(e,n)};case"geojson":return Rt(e,n);case"binary-geometry":return We(e,n);case"binary":return We(e,n);default:throw new Error(o||"undefined shape")}}function We(e,t){let[n,o]=Zo(e,t),r=Ue(n,o);return r.byteLength=e.byteLength,r}function Zo(e,t){let n=[],o={coordLength:2,pointPositionsCount:0,pointFeaturesCount:0,linePositionsCount:0,linePathsCount:0,lineFeaturesCount:0,polygonPositionsCount:0,polygonObjectsCount:0,polygonRingsCount:0,polygonFeaturesCount:0};if(e.byteLength<=0)return[n,o];let r=new se(new Ye.default(e));return(t&&Array.isArray(t.layers)?t.layers:Object.keys(r.layers)).forEach(s=>{let a=r.layers[s];if(a)for(let l=0;l<a.length;l++){let f=a.getBinaryFeature(l,o),c=Wo(f,t,s);n.push(c)}}),[n,o]}function Rt(e,t){if(e.byteLength<=0)return[];let n=[],o=new se(new Ye.default(e));return(Array.isArray(t.layers)?t.layers:Object.keys(o.layers)).forEach(i=>{let s=o.layers[i];if(s)for(let a=0;a<s.length;a++){let l=s.getGeoJSONFeature(a),f=Jo(l,t,i);n.push(f)}}),n}function Ho(e){if(!e?.mvt)throw new Error("mvt options required");if(e.mvt?.coordinates==="wgs84"&&!e.mvt.tileIndex)throw new Error("MVT Loader: WGS84 coordinates need tileIndex property");return e.gis&&ze.warn('MVTLoader: "options.gis" is deprecated, use "options.mvt.shape" instead')(),e.mvt}function Jo(e,t,n){let o=e.toGeoJSON(t.coordinates==="wgs84"?t.tileIndex:Yo);return t.layerProperty&&(o.properties||={},o.properties[t.layerProperty]=n),o}function Wo(e,t,n){let o=e.toBinaryCoordinates(t.coordinates==="wgs84"?t.tileIndex:Xo);return t.layerProperty&&o.properties&&(o.properties[t.layerProperty]=n),o}function Yo(e,t){let{extent:n}=t;for(let o=0;o<e.length;o++){let r=e[o];r[0]/=n,r[1]/=n}}function Xo(e,t){let{extent:n}=t;for(let o=0,r=e.length;o<r;++o)e[o]/=n}var $o="4.2.0",$e={dataType:null,batchType:null,name:"Mapbox Vector Tile",id:"mvt",module:"mvt",version:$o,extensions:["mvt","pbf"],mimeTypes:["application/vnd.mapbox-vector-tile","application/x-protobuf"],worker:!0,category:"geometry",options:{mvt:{shape:"geojson",coordinates:"local",layerProperty:"layerName",layers:void 0,tileIndex:void 0}}},ve={...$e,parse:async(e,t)=>Xe(e,t),parseSync:Xe,binary:!0};var Jt=e=>e!==null&&typeof e=="object";function Ke(e,t){if(!e||!Jt(e))return null;let n={name:e.name||"",description:e.description||""};if(typeof e.generator=="string"&&(n.generator=e.generator),typeof e.generator_options=="string"&&(n.generatorOptions=e.generator_options),n.boundingBox=zt(e.bounds)||zt(e.antimeridian_adjusted_bounds),n.center=nr(e.center),n.maxZoom=Zt(e.maxzoom),n.minZoom=Zt(e.minzoom),typeof e?.json=="string")try{n.metaJson=JSON.parse(e.json)}catch(a){console.warn("Failed to parse tilejson.json field",a)}let o=e.tilestats||n.metaJson?.tilestats,r=qo(o,t),i=Ko(e.vector_layers),s=tr(i,r);return n={...n,layers:s},n.maxZoom===null&&s.length>0&&(n.maxZoom=s[0].maxZoom||null),n.minZoom===null&&s.length>0&&(n.minZoom=s[0].minZoom||null),n}function Ko(e){return Array.isArray(e)?e.map(t=>Qo(t)):[]}function Qo(e){let t=Object.entries(e.fields||[]).map(([o,r])=>({name:o,...$t(String(r))})),n={...e};return delete n.fields,{name:e.id||"",...n,fields:t}}function qo(e,t){return Jt(e)&&Array.isArray(e.layers)?e.layers.map(n=>er(n,t)):[]}function er(e,t){let n=[],o={},r=e.attributes||[];for(let i of r){let s=i.attribute;if(typeof s=="string")if(s.split("|").length>1){let a=s.split("|")[0];o[a]=o[a]||[],o[a].push(i),console.warn("ignoring tilestats indexed field",a)}else n[s]||n.push(rr(i,t))}return{name:e.layer||"",dominantGeometry:e.geometry,fields:n}}function tr(e,t){return e.map(n=>{let o=t.find(s=>s.name===n.name),r=o?.fields||[],i={...n};return delete i.fields,{...i,...o,fields:r}})}function zt(e){let t=Xt(e);if(Array.isArray(t)&&t.length===4&&[t[0],t[2]].every(Yt)&&[t[1],t[3]].every(Wt))return[[t[0],t[1]],[t[2],t[3]]]}function nr(e){let t=Xt(e);return Array.isArray(t)&&t.length===3&&Yt(t[0])&&Wt(t[1])&&or(t[2])?t:null}function Zt(e){let t=typeof e=="string"?parseFloat(e):typeof e=="number"?e:null;return t===null||isNaN(t)?null:t}function Wt(e){return Number.isFinite(e)&&e<=90&&e>=-90}function Yt(e){return Number.isFinite(e)&&e<=180&&e>=-180}function or(e){return Number.isFinite(e)&&e>=0&&e<=22}function Xt(e){return typeof e=="string"?e.split(",").map(parseFloat):Array.isArray(e)?e:null}var Ht={number:{type:"float32"},numeric:{type:"float32"},string:{type:"utf8"},vachar:{type:"utf8"},float:{type:"float32"},int:{type:"int32"},int4:{type:"int32"},boolean:{type:"boolean"},bool:{type:"boolean"}};function rr(e={},t){let n=$t(e.type),o={name:e.attribute,...n};return typeof e.min=="number"&&(o.min=e.min),typeof e.max=="number"&&(o.max=e.max),typeof e.count=="number"&&(o.uniqueValueCount=e.count),e.values&&(o.values=e.values),o.values&&typeof t.maxValues=="number"&&(o.values=o.values?.slice(0,t.maxValues)),o}function $t(e){let t=e.toLowerCase();return!t||Ht[t],Ht[t]||{type:"string"}}var ir="4.2.0",$={dataType:null,batchType:null,name:"TileJSON",id:"tilejson",module:"pmtiles",version:ir,worker:!0,extensions:["json"],mimeTypes:["application/json"],text:!0,options:{tilejson:{maxValues:void 0}},parse:async(e,t)=>{let n=new TextDecoder().decode(e),o=JSON.parse(n),r={...$.options.tilejson,...t?.tilejson};return Ke(o,r)},parseTextSync:(e,t)=>{let n=JSON.parse(e),o={...$.options.tilejson,...t?.tilejson};return Ke(n,o)}};var Kt="4.2.0";var sr=globalThis.loaders?.parseImageNode,Qe=typeof Image<"u",qe=typeof ImageBitmap<"u",ar=Boolean(sr),et=Oe?!0:ar;function Qt(e){switch(e){case"auto":return qe||Qe||et;case"imagebitmap":return qe;case"image":return Qe;case"data":return et;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function qt(){if(qe)return"imagebitmap";if(Qe)return"image";if(et)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function lr(e){let t=fr(e);if(!t)throw new Error("Not an image");return t}function en(e){switch(lr(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),n=t.getContext("2d");if(!n)throw new Error("getImageData");return t.width=e.width,t.height=e.height,n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function fr(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var cr=/^data:image\/svg\+xml/,ur=/\.svg((\?|#).*)?$/;function Se(e){return e&&(cr.test(e)||ur.test(e))}function tn(e,t){if(Se(t)){let o=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(o=unescape(encodeURIComponent(o)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(o)}`}return tt(e,t)}function tt(e,t){if(Se(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function be(e,t,n){let o=tn(e,n),r=self.URL||self.webkitURL,i=typeof o!="string"&&r.createObjectURL(o);try{return await hr(i||o,t)}finally{i&&r.revokeObjectURL(i)}}async function hr(e,t){let n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((o,r)=>{try{n.onload=()=>o(n),n.onerror=i=>{let s=i instanceof Error?i.message:"error";r(new Error(s))}}catch(i){r(i)}})}var pr={},nn=!0;async function on(e,t,n){let o;Se(n)?o=await be(e,t,n):o=tt(e,n);let r=t&&t.imagebitmap;return await dr(o,r)}async function dr(e,t=null){if((gr(t)||!nn)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(n){console.warn(n),nn=!1}return await createImageBitmap(e)}function gr(e){for(let t in e||pr)return!1;return!0}function rn(e){return!wr(e,"ftyp",4)||!(e[8]&96)?null:mr(e)}function mr(e){switch(xr(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function xr(e,t,n){return String.fromCharCode(...e.slice(t,n))}function yr(e){return[...e].map(t=>t.charCodeAt(0))}function wr(e,t,n=0){let o=yr(t);for(let r=0;r<o.length;++r)if(o[r]!==e[r+n])return!1;return!0}var V=!1,ae=!0;function z(e){let t=le(e);return Tr(t)||vr(t)||Ir(t)||Fr(t)||Pr(t)}function Pr(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),n=rn(t);return n?{mimeType:n.mimeType,width:0,height:0}:null}function Tr(e){let t=le(e);return t.byteLength>=24&&t.getUint32(0,V)===2303741511?{mimeType:"image/png",width:t.getUint32(16,V),height:t.getUint32(20,V)}:null}function Ir(e){let t=le(e);return t.byteLength>=10&&t.getUint32(0,V)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,ae),height:t.getUint16(8,ae)}:null}function Fr(e){let t=le(e);return t.byteLength>=14&&t.getUint16(0,V)===16973&&t.getUint32(2,ae)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,ae),height:t.getUint32(22,ae)}:null}function vr(e){let t=le(e);if(!(t.byteLength>=3&&t.getUint16(0,V)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:o,sofMarkers:r}=Sr(),i=2;for(;i+9<t.byteLength;){let s=t.getUint16(i,V);if(r.has(s))return{mimeType:"image/jpeg",height:t.getUint16(i+5,V),width:t.getUint16(i+7,V)};if(!o.has(s))return null;i+=2,i+=t.getUint16(i,V)}return null}function Sr(){let e=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)e.add(n);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function le(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function sn(e,t){let{mimeType:n}=z(e)||{},o=globalThis.loaders?.parseImageNode;return re(o),await o(e,n)}async function an(e,t,n){t=t||{};let r=(t.image||{}).type||"auto",{url:i}=n||{},s=br(r),a;switch(s){case"imagebitmap":a=await on(e,t,i);break;case"image":a=await be(e,t,i);break;case"data":a=await sn(e,t);break;default:re(!1)}return r==="data"&&(a=en(a)),a}function br(e){switch(e){case"auto":case"data":return qt();default:return Qt(e),e}}var _r=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Br=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Er={image:{type:"auto",decode:!0}},nt={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:Kt,mimeTypes:Br,extensions:_r,parse:an,tests:[e=>Boolean(z(new DataView(e)))],options:Er};var _e=class extends ie{props;url;metadataUrl=null;data;schema="tms";metadata;extension;mimeType=null;constructor(t){super(t),this.props=t,this.url=Ze(t.url),this.metadataUrl=t.metadataUrl===void 0?`${this.url}/tilejson.json`:t.metadataUrl,this.extension=t.extension||".png",this.data=this.url,this.getTileData=this.getTileData.bind(this),this.metadata=this.getMetadata(),Mr(this.url)&&(this.schema="template")}async getMetadata(){if(!this.metadataUrl)return null;let t;try{t=await this.fetch(this.metadataUrl)}catch(r){return console.error(r.message),null}if(!t.ok)return console.error(t.statusText),null;let n=await t.text();return $.parseTextSync?.(n)||null}getTileMIMEType(){return this.mimeType}async getTile(t){let{x:n,y:o,z:r}=t,i=this.getTileURL(n,o,r),s=await this.fetch(i);return s.ok?await s.arrayBuffer():null}async getTileData(t){let{x:n,y:o,z:r}=t.index,i=await this.getTile({x:n,y:o,z:r,layers:[]});if(i===null)return null;let s=z(i);switch(this.mimeType=this.mimeType||s?.mimeType||"application/vnd.mapbox-vector-tile",this.mimeType){case"application/vnd.mapbox-vector-tile":return await this._parseVectorTile(i,{x:n,y:o,z:r,layers:[]});default:return await this._parseImageTile(i)}}async getImageTile(t){let n=await this.getTile(t);return n?this._parseImageTile(n):null}async _parseImageTile(t){return await nt.parse(t,this.loadOptions)}async getVectorTile(t){let n=await this.getTile(t);return n?this._parseVectorTile(n,t):null}async _parseVectorTile(t,n){let o={shape:"geojson-table",mvt:{coordinates:"wgs84",tileIndex:{x:n.x,y:n.y,z:n.z},...this.loadOptions?.mvt},...this.loadOptions};return await ve.parse(t,o)}getMetadataUrl(){return this.metadataUrl}getTileURL(t,n,o){switch(this.schema){case"xyz":return`${this.url}/${t}/${n}/${o}${this.extension}`;case"tms":return`${this.url}/${o}/${t}/${n}${this.extension}`;case"template":return Nr(this.url,t,n,o,"0");default:throw new Error(this.schema)}}};function Mr(e){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))|(?=.*{x})(?=.*({y}|{-y})(?=.*{z}))/.test(e)}var Ar=new RegExp("{x}","g"),Lr=new RegExp("{y}","g"),Vr=new RegExp("{z}","g");function Nr(e,t,n,o,r="0"){if(Array.isArray(e)){let s=Dr(r)%e.length;e=e[s]}let i=e;return i=i.replace(Ar,String(t)),i=i.replace(Lr,String(n)),i=i.replace(Vr,String(o)),Number.isInteger(n)&&Number.isInteger(o)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,o)-n-1))),i}function Dr(e){return Math.abs(e.split("").reduce((t,n)=>(t<<5)-t+n.charCodeAt(0)|0,0))}function Be(e,t,n,o){let r=o,i=n-t>>1,s=n-t,a,l=e[t],f=e[t+1],c=e[n],u=e[n+1];for(let p=t+3;p<n;p+=3){let h=Cr(e[p],e[p+1],l,f,c,u);if(h>r)a=p,r=h;else if(h===r){let d=Math.abs(p-i);d<s&&(a=p,s=d)}}r>o&&(a-t>3&&Be(e,t,a,o),e[a+2]=r,n-a>3&&Be(e,a,n,o))}function Cr(e,t,n,o,r,i){let s=r-n,a=i-o;if(s!==0||a!==0){let l=((e-n)*s+(t-o)*a)/(s*s+a*a);l>1?(n=r,o=i):l>0&&(n+=s*l,o+=a*l)}return s=e-n,a=t-o,s*s+a*a}function k(e,t,n,o){let r={id:e??null,type:t,geometry:n,tags:o,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(t==="Point"||t==="MultiPoint"||t==="LineString")Ee(r,n);else if(t==="Polygon")Ee(r,n[0]);else if(t==="MultiLineString")for(let i of n)Ee(r,i);else if(t==="MultiPolygon")for(let i of n)Ee(r,i[0]);return r}function Ee(e,t){for(let n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function fn(e,t){let n=[];if(e.type==="FeatureCollection")for(let o=0;o<e.features.length;o++)Me(n,e.features[o],t,o);else e.type==="Feature"?Me(n,e,t):Me(n,{geometry:e},t);return n}function Me(e,t,n,o){if(!t.geometry)return;let r=t.geometry.coordinates,i=t.geometry.type,s=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),a=[],l=t.id;if(n.promoteId?l=t.properties[n.promoteId]:n.generateId&&(l=o||0),i==="Point")ln(r,a);else if(i==="MultiPoint")for(let f of r)ln(f,a);else if(i==="LineString")rt(r,a,s,!1);else if(i==="MultiLineString")if(n.lineMetrics){for(let f of r)a=[],rt(f,a,s,!1),e.push(k(l,"LineString",a,t.properties));return}else ot(r,a,s,!1);else if(i==="Polygon")ot(r,a,s,!0);else if(i==="MultiPolygon")for(let f of r){let c=[];ot(f,c,s,!0),a.push(c)}else if(i==="GeometryCollection"){for(let f of t.geometry.geometries)Me(e,{id:l,geometry:f,properties:t.properties},n,o);return}else throw new Error("Input data is not a valid GeoJSON object.");e.push(k(l,i,a,t.properties))}function ln(e,t){t.push(cn(e[0]),un(e[1]),0)}function rt(e,t,n,o){let r,i,s=0;for(let l=0;l<e.length;l++){let f=cn(e[l][0]),c=un(e[l][1]);t.push(f,c,0),l>0&&(o?s+=(r*c-f*i)/2:s+=Math.sqrt(Math.pow(f-r,2)+Math.pow(c-i,2))),r=f,i=c}let a=t.length-3;t[2]=1,Be(t,0,a,n),t[a+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size}function ot(e,t,n,o){for(let r=0;r<e.length;r++){let i=[];rt(e[r],i,n,o),t.push(i)}}function cn(e){return e/360+.5}function un(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function A(e,t,n,o,r,i,s,a){if(n/=t,o/=t,i>=n&&s<o)return e;if(s<n||i>=o)return null;let l=[];for(let f of e){let c=f.geometry,u=f.type,p=r===0?f.minX:f.minY,h=r===0?f.maxX:f.maxY;if(p>=n&&h<o){l.push(f);continue}else if(h<n||p>=o)continue;let d=[];if(u==="Point"||u==="MultiPoint")kr(c,d,n,o,r);else if(u==="LineString")pn(c,d,n,o,r,!1,a.lineMetrics);else if(u==="MultiLineString")it(c,d,n,o,r,!1);else if(u==="Polygon")it(c,d,n,o,r,!0);else if(u==="MultiPolygon")for(let x of c){let w=[];it(x,w,n,o,r,!0),w.length&&d.push(w)}if(d.length){if(a.lineMetrics&&u==="LineString"){for(let x of d)l.push(k(f.id,u,x,f.tags));continue}(u==="LineString"||u==="MultiLineString")&&(d.length===1?(u="LineString",d=d[0]):u="MultiLineString"),(u==="Point"||u==="MultiPoint")&&(u=d.length===3?"Point":"MultiPoint"),l.push(k(f.id,u,d,f.tags))}}return l.length?l:null}function kr(e,t,n,o,r){for(let i=0;i<e.length;i+=3){let s=e[i+r];s>=n&&s<=o&&K(t,e[i],e[i+1],e[i+2])}}function pn(e,t,n,o,r,i,s){let a=hn(e),l=r===0?Ur:Gr,f=e.start,c,u;for(let F=0;F<e.length-3;F+=3){let _=e[F],g=e[F+1],m=e[F+2],v=e[F+3],I=e[F+4],S=r===0?_:g,b=r===0?v:I,B=!1;s&&(c=Math.sqrt(Math.pow(_-v,2)+Math.pow(g-I,2))),S<n?b>n&&(u=l(a,_,g,v,I,n),s&&(a.start=f+c*u)):S>o?b<o&&(u=l(a,_,g,v,I,o),s&&(a.start=f+c*u)):K(a,_,g,m),b<n&&S>=n&&(u=l(a,_,g,v,I,n),B=!0),b>o&&S<=o&&(u=l(a,_,g,v,I,o),B=!0),!i&&B&&(s&&(a.end=f+c*u),t.push(a),a=hn(e)),s&&(f+=c)}let p=e.length-3,h=e[p],d=e[p+1],x=e[p+2],w=r===0?h:d;w>=n&&w<=o&&K(a,h,d,x),p=a.length-3,i&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&K(a,a[0],a[1],a[2]),a.length&&t.push(a)}function hn(e){let t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function it(e,t,n,o,r,i){for(let s of e)pn(s,t,n,o,r,i,!1)}function K(e,t,n,o){e.push(t,n,o)}function Ur(e,t,n,o,r,i){let s=(i-t)/(o-t);return K(e,i,n+(r-n)*s,1),s}function Gr(e,t,n,o,r,i){let s=(i-n)/(r-n);return K(e,t+(o-t)*s,i,1),s}function gn(e,t){let n=t.buffer/t.extent,o=e,r=A(e,1,-1-n,n,0,-1,2,t),i=A(e,1,1-n,2+n,0,-1,2,t);return(r||i)&&(o=A(e,1,-n,1+n,0,-1,2,t)||[],r&&(o=dn(r,1).concat(o)),i&&(o=o.concat(dn(i,-1)))),o}function dn(e,t){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=r.type,s;if(i==="Point"||i==="MultiPoint"||i==="LineString")s=st(r.geometry,t);else if(i==="MultiLineString"||i==="Polygon"){s=[];for(let a of r.geometry)s.push(st(a,t))}else if(i==="MultiPolygon"){s=[];for(let a of r.geometry){let l=[];for(let f of a)l.push(st(f,t));s.push(l)}}n.push(k(r.id,i,s,r.tags))}return n}function st(e,t){let n=[];n.size=e.size,e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let o=0;o<e.length;o+=3)n.push(e[o]+t,e[o+1],e[o+2]);return n}function at(e,t){if(e.transformed)return e;let n=1<<e.z,o=e.x,r=e.y;for(let i of e.features){let s=i.geometry,a=i.type;if(i.geometry=[],a===1)for(let l=0;l<s.length;l+=2)i.geometry.push(mn(s[l],s[l+1],t,n,o,r));else for(let l=0;l<s.length;l++){let f=[];for(let c=0;c<s[l].length;c+=2)f.push(mn(s[l][c],s[l][c+1],t,n,o,r));i.geometry.push(f)}}return e.transformed=!0,e}function mn(e,t,n,o,r,i){return[Math.round(n*(e*o-r)),Math.round(n*(t*o-i))]}function xn(e,t,n,o,r){let i=t===r.maxZoom?0:r.tolerance/((1<<t)*r.extent),s={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:n,y:o,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let a of e)Or(s,a,i,r);return s}function Or(e,t,n,o){let r=t.geometry,i=t.type,s=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),i==="Point"||i==="MultiPoint")for(let a=0;a<r.length;a+=3)s.push(r[a],r[a+1]),e.numPoints++,e.numSimplified++;else if(i==="LineString")lt(s,r,e,n,!1,!1);else if(i==="MultiLineString"||i==="Polygon")for(let a=0;a<r.length;a++)lt(s,r[a],e,n,i==="Polygon",a===0);else if(i==="MultiPolygon")for(let a=0;a<r.length;a++){let l=r[a];for(let f=0;f<l.length;f++)lt(s,l[f],e,n,!0,f===0)}if(s.length){let a=t.tags||null;if(i==="LineString"&&o.lineMetrics){a={};for(let f in t.tags)a[f]=t.tags[f];a.mapbox_clip_start=r.start/r.size,a.mapbox_clip_end=r.end/r.size}let l={geometry:s,type:i==="Polygon"||i==="MultiPolygon"?3:i==="LineString"||i==="MultiLineString"?2:1,tags:a};t.id!==null&&(l.id=t.id),e.features.push(l)}}function lt(e,t,n,o,r,i){let s=o*o;if(o>0&&t.size<(r?s:o)){n.numPoints+=t.length/3;return}let a=[];for(let l=0;l<t.length;l+=3)(o===0||t[l+2]>s)&&(n.numSimplified++,a.push(t[l],t[l+1])),n.numPoints++;r&&jr(a,i),e.push(a)}function jr(e,t){let n=0;for(let o=0,r=e.length-2;o<e.length;r=o,o+=2)n+=(e[o]-e[r])*(e[o+1]+e[r+1]);if(n>0===t)for(let o=0,r=e.length;o<r/2;o+=2){let i=e[o],s=e[o+1];e[o]=e[r-2-o],e[o+1]=e[r-1-o],e[r-2-o]=i,e[r-1-o]=s}}var ct=class{mimeType="application/vnd.mapbox-vector-tile";options;tiles={};tileCoords=[];stats={};total=0;ready;constructor(t,n){this.options={...ct.defaultOptions,...n},this.getTileData=this.getTileData.bind(this),this.ready=this.initializeTilesAsync(t)}async initializeTilesAsync(t){let n=await t;this.initializeTilesSync(n)}initializeTilesSync(t){let n=this.options,o=n.debug;if(o&&console.time("preprocess data"),this.options.maxZoom<0||this.options.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(n.promoteId&&this.options.generateId)throw new Error("promoteId and generateId cannot be used together.");let r=fn(t,n);o&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",n.indexMaxZoom,n.indexMaxPoints),console.time("generate tiles")),r=gn(r,this.options),r.length&&this.splitTile(r,0,0,0),o&&(r.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}async getMetadata(){return{}}async getVectorTile(t){return await this.ready,this.getTileSync(t)}async getTile(t){return await this.ready,this.getTileSync(t)}async getTileData(t){let{x:n,y:o,z:r}=t.index;return await this.getVectorTile({x:n,y:o,z:r})}getTileSync(t){let n=this.getRawTile(t);return n?Rr(n,this.options.extent):null}getRawTile(t){let{z:n,y:o}=t,{x:r}=t,{extent:i,debug:s}=this.options;if(n<0||n>24)return null;let a=1<<n;r=r+a&a-1;let l=ft(n,r,o);if(this.tiles[l])return at(this.tiles[l],i);s>1&&console.log("drilling down to z%d-%d-%d",n,r,o);let f=n,c=r,u=o,p;for(;!p&&f>0;)f--,c=c>>1,u=u>>1,p=this.tiles[ft(f,c,u)];return!p||!p.source?null:(s>1&&(console.log("found parent tile z%d-%d-%d",f,c,u),console.time("drilling down")),this.splitTile(p.source,f,c,u,n,r,o),s>1&&console.timeEnd("drilling down"),this.tiles[l]?at(this.tiles[l],i):null)}splitTile(t,n,o,r,i,s,a){let l=[t,n,o,r],f=this.options,c=f.debug;for(;l.length;){r=l.pop(),o=l.pop(),n=l.pop(),t=l.pop();let u=1<<n,p=ft(n,o,r),h=this.tiles[p];if(!h&&(c>1&&console.time("creation"),h=this.tiles[p]=xn(t,n,o,r,f),this.tileCoords.push({z:n,x:o,y:r}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",n,o,r,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));let b=`z${n}`;this.stats[b]=(this.stats[b]||0)+1,this.total++}if(h.source=t,i===void 0){if(n===f.indexMaxZoom||h.numPoints<=f.indexMaxPoints)continue}else{if(n===f.maxZoom||n===i)continue;if(i!==void 0){let b=i-n;if(o!==s>>b||r!==a>>b)continue}}if(h.source=null,t.length===0)continue;c>1&&console.time("clipping");let d=.5*f.buffer/f.extent,x=.5-d,w=.5+d,F=1+d,_=null,g=null,m=null,v=null,I=A(t,u,o-d,o+w,0,h.minX,h.maxX,f),S=A(t,u,o+x,o+F,0,h.minX,h.maxX,f);t=null,I&&(_=A(I,u,r-d,r+w,1,h.minY,h.maxY,f),g=A(I,u,r+x,r+F,1,h.minY,h.maxY,f),I=null),S&&(m=A(S,u,r-d,r+w,1,h.minY,h.maxY,f),v=A(S,u,r+x,r+F,1,h.minY,h.maxY,f),S=null),c>1&&console.timeEnd("clipping"),l.push(_||[],n+1,o*2,r*2),l.push(g||[],n+1,o*2,r*2+1),l.push(m||[],n+1,o*2+1,r*2),l.push(v||[],n+1,o*2+1,r*2+1)}}},fe=ct;pe(fe,"defaultOptions",{maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:void 0,generateId:!1,debug:0});function ft(e,t,n){return((1<<e)*n+t)*32+e}function Rr(e,t){let n=[];for(let r of e.features){if(!r||!r.geometry)continue;let i,s;switch(r.type){case 1:r.geometry.length===1?(i="Point",s=r.geometry[0]):(i="MultiPoint",s=r.geometry);break;case 2:r.geometry.length===1?(i="LineString",s=r.geometry[0]):(i="MultiLineString",s=r.geometry);break;case 3:r.geometry.length>1?(i="MultiPolygon",s=[r.geometry]):(i="Polygon",s=r.geometry);break;default:continue}s=yn(s,t);let a={type:"Feature",geometry:{type:i,coordinates:s},properties:r.tags||{}};n.push(a)}return{shape:"geojson-table",type:"FeatureCollection",features:n}}function yn(e,t){return Array.isArray(e[0])?e.map(n=>yn(n,t)):[e[0]/t,e[1]/t]}return bn(ce);})();
8
8
  /*! Bundled license information:
9
9
 
10
10
  ieee754/index.js:
@@ -0,0 +1,79 @@
1
+ import { VectorTileSource, VectorTileSourceProps, TileLoadParameters } from '@loaders.gl/loader-utils';
2
+ import { GeoJSONTable } from '@loaders.gl/schema';
3
+ import type { GeoJSONTile, GeoJSONTileFeature } from "./lib/geojsonvt/tile.js";
4
+ /** Options to configure tiling */
5
+ export type GeoJSONTileSourceOptions = VectorTileSourceProps & {
6
+ maxZoom?: number /** max zoom to preserve detail on */;
7
+ indexMaxZoom?: number /** max zoom in the tile index */;
8
+ indexMaxPoints?: number /** max number of points per tile in the tile index */;
9
+ tolerance?: number /** simplification tolerance (higher means simpler) */;
10
+ extent?: number /** tile extent */;
11
+ buffer?: number /** tile buffer on each side */;
12
+ lineMetrics?: boolean /** whether to calculate line metrics */;
13
+ promoteId?: string /** name of a feature property to be promoted to feature.id */;
14
+ generateId?: boolean /** whether to generate feature ids. Cannot be used with promoteId */;
15
+ debug?: number /** logging level (0, 1 or 2) */;
16
+ };
17
+ export declare class GeoJSONTileSource implements VectorTileSource<any> {
18
+ static defaultOptions: Required<GeoJSONTileSourceOptions>;
19
+ mimeType: string;
20
+ options: Required<GeoJSONTileSourceOptions>;
21
+ tiles: Record<string, GeoJSONTile>;
22
+ tileCoords: {
23
+ x: number;
24
+ y: number;
25
+ z: number;
26
+ }[];
27
+ stats: Record<string, number>;
28
+ total: number;
29
+ /** Sync methods can be called: the input data promise has been resolved and initial top-level tiling is done */
30
+ ready: Promise<void>;
31
+ constructor(data: GeoJSONTable | Promise<GeoJSONTable>, options?: GeoJSONTileSourceOptions);
32
+ initializeTilesAsync(dataPromise: GeoJSONTable | Promise<GeoJSONTable>): Promise<void>;
33
+ initializeTilesSync(data: GeoJSONTable): void;
34
+ getMetadata(): Promise<unknown>;
35
+ /**
36
+ * Get a tile at the specified index
37
+ * @param tileIndex z, x, y of tile
38
+ * @returns
39
+ */
40
+ getVectorTile(tileIndex: {
41
+ z: number;
42
+ x: number;
43
+ y: number;
44
+ }): Promise<GeoJSONTable | null>;
45
+ getTile(tileIndex: {
46
+ z: number;
47
+ x: number;
48
+ y: number;
49
+ }): Promise<GeoJSONTable | null>;
50
+ getTileData(tileParams: TileLoadParameters): Promise<unknown | null>;
51
+ /**
52
+ * Synchronously request a tile
53
+ * @note Application must await `source.ready` before calling sync methods.
54
+ */
55
+ getTileSync(tileIndex: {
56
+ z: number;
57
+ x: number;
58
+ y: number;
59
+ }): GeoJSONTable | null;
60
+ /**
61
+ * Return geojsonvt-style "half formed" vector tile
62
+ * @note Application must await `source.ready` before calling sync methods.
63
+ */
64
+ getRawTile(tileIndex: {
65
+ z: number;
66
+ x: number;
67
+ y: number;
68
+ }): GeoJSONTile | null;
69
+ /**
70
+ * splits features from a parent tile to sub-tiles.
71
+ * @param z, x, and y are the coordinates of the parent tile
72
+ * @param cz, cx, and cy are the coordinates of the target tile
73
+ *
74
+ * If no target tile is specified, splitting stops when we reach the maximum
75
+ * zoom or the number of points is low as specified in the options.
76
+ */
77
+ splitTile(features: GeoJSONTileFeature[], z: number, x: number, y: number, cz?: number, cx?: number, cy?: number): void;
78
+ }
79
+ //# sourceMappingURL=geojson-tile-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geojson-tile-source.d.ts","sourceRoot":"","sources":["../src/geojson-tile-source.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAU,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAC,WAAW,EAAE,kBAAkB,EAAC,gCAA6B;AAO1E,kCAAkC;AAClC,MAAM,MAAM,wBAAwB,GAAG,qBAAqB,GAAG;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC,qCAAqC,CAAC;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC,iCAAiC,CAAC;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC,sDAAsD,CAAC;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC,sDAAsD,CAAC;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC,kBAAkB,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC,+BAA+B,CAAC;IAChD,WAAW,CAAC,EAAE,OAAO,CAAC,wCAAwC,CAAC;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC,8DAA8D,CAAC;IAClF,UAAU,CAAC,EAAE,OAAO,CAAC,qEAAqE,CAAC;IAC3F,KAAK,CAAC,EAAE,MAAM,CAAC,gCAAgC,CAAC;CACjD,CAAC;AAEF,qBAAa,iBAAkB,YAAW,gBAAgB,CAAC,GAAG,CAAC;IAC7D,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,wBAAwB,CAAC,CAYvD;IAEF,QAAQ,SAAwC;IAEhD,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC,CAAC;IAG5C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAM;IACxC,UAAU,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,EAAE,CAAM;IAErD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IACnC,KAAK,EAAE,MAAM,CAAK;IAElB,gHAAgH;IAChH,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBAET,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAMpF,oBAAoB,CAAC,WAAW,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5F,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IA2CvC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAIrC;;;;OAIG;IACG,aAAa,CAAC,SAAS,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAMzF,OAAO,CAAC,SAAS,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAKnF,WAAW,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAO1E;;;OAGG;IACH,WAAW,CAAC,SAAS,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,YAAY,GAAG,IAAI;IAS9E;;;OAGG;IAEH,UAAU,CAAC,SAAS,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,WAAW,GAAG,IAAI;IAoD5E;;;;;;;OAOG;IAEH,SAAS,CACP,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,EAAE,CAAC,EAAE,MAAM,EACX,EAAE,CAAC,EAAE,MAAM,EACX,EAAE,CAAC,EAAE,MAAM,GACV,IAAI;CAyGR"}
@@ -1,35 +1,46 @@
1
1
  // loaders.gl
2
- // SPDX-License-Identifier: MIT
2
+ // SPDX-License-Identifier: MIT AND ISC
3
3
  // Copyright (c) vis.gl contributors
4
- // Forked from https://github.com/mapbox/geojson-vt under compatible ISC license
5
- import { convert } from "./convert.js"; // GeoJSON conversion and preprocessing
6
- import { clip } from "./clip.js"; // stripe clipping algorithm
7
- import { wrap } from "./wrap.js"; // date line processing
8
- import { transformTile } from "./transform.js"; // coordinate transformation
9
- import { createTile } from "./tile.js"; // final simplified tile generation
10
- const DEFAULT_OPTIONS = {
11
- maxZoom: 14, // max zoom to preserve detail on
12
- indexMaxZoom: 5, // max zoom in the tile index
13
- indexMaxPoints: 100000, // max number of points per tile in the tile index
14
- tolerance: 3, // simplification tolerance (higher means simpler)
15
- extent: 4096, // tile extent
16
- buffer: 64, // tile buffer on each side
17
- lineMetrics: false, // whether to calculate line metrics
18
- // @ts-expect-error Ensures all these required params have defaults
19
- promoteId: undefined, // name of a feature property to be promoted to feature.id
20
- generateId: false, // whether to generate feature ids. Cannot be used with promoteId
21
- debug: 0 // logging level (0, 1 or 2)
22
- };
23
- export class GeoJSONTiler {
4
+ // Based on https://github.com/mapbox/geojson-vt under compatible ISC license
5
+ import { convert } from "./lib/geojsonvt/convert.js"; // GeoJSON conversion and preprocessing
6
+ import { clip } from "./lib/geojsonvt/clip.js"; // stripe clipping algorithm
7
+ import { wrap } from "./lib/geojsonvt/wrap.js"; // date line processing
8
+ import { transformTile } from "./lib/geojsonvt/transform.js"; // coordinate transformation
9
+ import { createTile } from "./lib/geojsonvt/tile.js"; // final simplified tile generation
10
+ export class GeoJSONTileSource {
11
+ static defaultOptions = {
12
+ maxZoom: 14, // max zoom to preserve detail on
13
+ indexMaxZoom: 5, // max zoom in the tile index
14
+ indexMaxPoints: 100000, // max number of points per tile in the tile index
15
+ tolerance: 3, // simplification tolerance (higher means simpler)
16
+ extent: 4096, // tile extent
17
+ buffer: 64, // tile buffer on each side
18
+ lineMetrics: false, // whether to calculate line metrics
19
+ // @ts-expect-error
20
+ promoteId: undefined, // name of a feature property to be promoted to feature.id
21
+ generateId: false, // whether to generate feature ids. Cannot be used with promoteId
22
+ debug: 0 // logging level (0, 1 or 2)
23
+ };
24
+ mimeType = 'application/vnd.mapbox-vector-tile';
24
25
  options;
25
26
  // tiles and tileCoords are part of the public API
26
27
  tiles = {};
27
28
  tileCoords = [];
28
29
  stats = {};
29
30
  total = 0;
31
+ /** Sync methods can be called: the input data promise has been resolved and initial top-level tiling is done */
32
+ ready;
30
33
  constructor(data, options) {
31
- this.options = { ...DEFAULT_OPTIONS, ...options };
32
- options = this.options;
34
+ this.options = { ...GeoJSONTileSource.defaultOptions, ...options };
35
+ this.getTileData = this.getTileData.bind(this);
36
+ this.ready = this.initializeTilesAsync(data);
37
+ }
38
+ async initializeTilesAsync(dataPromise) {
39
+ const data = await dataPromise;
40
+ this.initializeTilesSync(data);
41
+ }
42
+ initializeTilesSync(data) {
43
+ const options = this.options;
33
44
  const debug = options.debug;
34
45
  if (debug)
35
46
  console.time('preprocess data');
@@ -60,15 +71,47 @@ export class GeoJSONTiler {
60
71
  console.log('tiles generated:', this.total, JSON.stringify(this.stats));
61
72
  }
62
73
  }
74
+ async getMetadata() {
75
+ return {};
76
+ }
63
77
  /**
64
78
  * Get a tile at the specified index
65
- * @param z
66
- * @param x
67
- * @param y
79
+ * @param tileIndex z, x, y of tile
68
80
  * @returns
69
81
  */
82
+ async getVectorTile(tileIndex) {
83
+ await this.ready;
84
+ const table = this.getTileSync(tileIndex);
85
+ return table;
86
+ }
87
+ async getTile(tileIndex) {
88
+ await this.ready;
89
+ return this.getTileSync(tileIndex);
90
+ }
91
+ async getTileData(tileParams) {
92
+ const { x, y, z } = tileParams.index;
93
+ return await this.getVectorTile({ x, y, z });
94
+ }
95
+ // Implementation
96
+ /**
97
+ * Synchronously request a tile
98
+ * @note Application must await `source.ready` before calling sync methods.
99
+ */
100
+ getTileSync(tileIndex) {
101
+ const rawTile = this.getRawTile(tileIndex);
102
+ if (!rawTile) {
103
+ return null;
104
+ }
105
+ return convertToGeoJSONTable(rawTile, this.options.extent);
106
+ }
107
+ /**
108
+ * Return geojsonvt-style "half formed" vector tile
109
+ * @note Application must await `source.ready` before calling sync methods.
110
+ */
70
111
  // eslint-disable-next-line complexity, max-statements
71
- getTile(z, x, y) {
112
+ getRawTile(tileIndex) {
113
+ const { z, y } = tileIndex;
114
+ let { x } = tileIndex;
72
115
  // z = +z;
73
116
  // x = +x;
74
117
  // y = +y;
@@ -207,3 +250,70 @@ export class GeoJSONTiler {
207
250
  function toID(z, x, y) {
208
251
  return ((1 << z) * y + x) * 32 + z;
209
252
  }
253
+ function convertToGeoJSONTable(vtTile, extent) {
254
+ const features = [];
255
+ for (const rawFeature of vtTile.features) {
256
+ if (!rawFeature || !rawFeature.geometry) {
257
+ continue;
258
+ }
259
+ let type;
260
+ let coordinates;
261
+ // raw geometry
262
+ switch (rawFeature.type) {
263
+ case 1:
264
+ if (rawFeature.geometry.length === 1) {
265
+ type = 'Point';
266
+ coordinates = rawFeature.geometry[0];
267
+ }
268
+ else {
269
+ type = 'MultiPoint';
270
+ coordinates = rawFeature.geometry;
271
+ }
272
+ break;
273
+ case 2:
274
+ if (rawFeature.geometry.length === 1) {
275
+ type = 'LineString';
276
+ coordinates = rawFeature.geometry[0];
277
+ }
278
+ else {
279
+ type = 'MultiLineString';
280
+ coordinates = rawFeature.geometry;
281
+ }
282
+ break;
283
+ case 3:
284
+ if (rawFeature.geometry.length > 1) {
285
+ type = 'MultiPolygon';
286
+ coordinates = [rawFeature.geometry];
287
+ }
288
+ else {
289
+ type = 'Polygon';
290
+ coordinates = rawFeature.geometry;
291
+ }
292
+ break;
293
+ default:
294
+ continue;
295
+ }
296
+ coordinates = toLngLat(coordinates, extent);
297
+ const feature = {
298
+ type: 'Feature',
299
+ geometry: {
300
+ type,
301
+ coordinates
302
+ },
303
+ properties: rawFeature.tags || {}
304
+ };
305
+ features.push(feature);
306
+ }
307
+ const table = {
308
+ shape: 'geojson-table',
309
+ type: 'FeatureCollection',
310
+ features
311
+ };
312
+ return table;
313
+ }
314
+ function toLngLat(coords, extent) {
315
+ if (Array.isArray(coords[0])) {
316
+ return coords.map((c) => toLngLat(c, extent));
317
+ }
318
+ return [coords[0] / extent, coords[1] / extent];
319
+ }