node-red-contrib-web-worldmap 4.6.4 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
1
  ### Change Log for Node-RED Worldmap
2
2
 
3
+ - v4.6.5 - Let geojson allow for generic overrides with .icon and .layer.
3
4
  - v4.6.4 - Fix deletion of layers logic to actually fully remove points.
4
5
  - v4.6.3 - Fix sending of layer events when not wanted. Issue #262
5
6
  - v4.6.2 - Fix multiple use of contextmenu feedback. Issue #259
package/README.md CHANGED
@@ -13,6 +13,7 @@ Feel free to [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%
13
13
 
14
14
  ### Updates
15
15
 
16
+ - v4.6.5 - Let geojson allow for generic overrides with .icon and .layer.
16
17
  - v4.6.4 - Fix deletion of layers logic to actually fully remove points.
17
18
  - v4.6.3 - Fix sending of layer events when not wanted. Issue #262
18
19
  - v4.6.2 - Fix multiple use of contextmenu feedback. Issue #259
@@ -399,6 +400,7 @@ Optional properties for **msg.payload.command** include
399
400
  - **button** - if supplied with a `name` and `icon` property - adds a button to provide user input - sends
400
401
  a msg `{"action":"button", "name":"the_button_name"}` to the worldmap in node. If supplied with a `name` property only, it will remove the button. Optional `position` property can be 'bottomright', 'bottomleft', 'topleft' or 'topright' (default). button can also be an array of button objects.
401
402
  - **contextmenu** - html string to define the right click menu when not on a marker. Defaults to the simple add marker input. Empty string `""` disables this right click.
403
+ - **drawcontextmenu** : an html fragment to display on right click or when creating new shapes (enable Drawing overlay in the worldmap node Overlays selection dropdown) - defaults to "Name" Input "Edit Points|Drag|Rotate|Delete|Ok" buttons.
402
404
  - **toptitle** - Words to replace title in title bar (if not in iframe)
403
405
  - **toplogo** - URL to logo image for top title bar (if not in iframe) - ideally 60px by 24px.
404
406
  - **trackme** - Turns on/off the browser self locating. Boolean false = off, true = cyan circle showing accuracy error, or an object like `{"command":{"trackme":{"name":"Dave","icon":"car","iconColor":"blue","layer":"mytrack","accuracy":false}}}`. Usual marker options can be applied.
@@ -624,6 +626,11 @@ Example simple form
624
626
 
625
627
  See the section on **Utility Functions** for details of the feedback function.
626
628
 
629
+ For the drawcontextmenu you can use the following snippet as a template:
630
+ ```
631
+ msg.payload = {"command" :{"drawcontextmenu" :"<input type='text' value='${name}' id='dinput' placeholder='name (,icon, layer)'/><br/><button onclick='editPoly(\"${name}\");'>My Edit points</button><button onclick='editPoly(\"${name}\",\"drag\");'>My Drag</button><button onclick='editPoly(\"${name}\",\"rot\");'>My Rotate</button><button onclick='delMarker(\"${name}\",true);'>My Delete</button><button onclick='sendDrawing();'>My OK</button>"}};
632
+ ```
633
+
627
634
  #### To add and remove a legend
628
635
 
629
636
  If you want to add a small legend overlay
@@ -721,16 +728,17 @@ You can use a PMtiles format map archive file from [Protomaps](https://docs.prot
721
728
 
722
729
  Copy your .pmtiles file(s) into your `~/.node-red` user directory. On re-starting Node-RED the node will detect the file(s) and add them to the base map layer menu, using the file name as the layer name.
723
730
 
724
- You can set some default options for the pmtiles by creating a file called **pmtiles.opts** in your user directory. For example to create a nightvision style
731
+ You can set some default options for the pmtiles by creating a file called **pmtiles.opts** in your user directory. For example to use a dark theme
725
732
 
726
733
  {
727
734
  "attribution": "Protomaps and OSM",
728
735
  "maxDataZoom": 15,
729
736
  "maxZoom": 20,
730
- "shade": "red",
731
- "dark": true
737
+ "theme": "dark"
732
738
  }
733
739
 
740
+ theme can be light, dark, white, black, or grayscale.
741
+
734
742
  The `maxDataZoom` should match the maximum zoom level in you pmtiles file(s) - whereas the `maxZoom` is the leaflet maximum zoom level you want to support. `shade` can be any valid html colour or #rrggbb string, and `dark` is a boolean (default false).
735
743
 
736
744
  You can also load them dynamically with a command like
@@ -1,16 +1,21 @@
1
+ 0.6.0 / 2023-11-06
2
+ ==================
3
+
4
+ * Add `partitioned` option
5
+
1
6
  0.5.0 / 2022-04-11
2
7
  ==================
3
8
 
4
9
  * Add `priority` option
5
10
  * Fix `expires` option to reject invalid dates
6
- * pref: improve default decode speed
7
- * pref: remove slow string split in parse
11
+ * perf: improve default decode speed
12
+ * perf: remove slow string split in parse
8
13
 
9
14
  0.4.2 / 2022-02-02
10
15
  ==================
11
16
 
12
- * pref: read value only when assigning in parse
13
- * pref: remove unnecessary regexp in parse
17
+ * perf: read value only when assigning in parse
18
+ * perf: remove unnecessary regexp in parse
14
19
 
15
20
  0.4.1 / 2020-04-21
16
21
  ==================
@@ -41,7 +46,7 @@
41
46
 
42
47
  * perf: enable strict mode
43
48
  * perf: use for loop in parse
44
- * perf: use string concatination for serialization
49
+ * perf: use string concatenation for serialization
45
50
 
46
51
  0.2.3 / 2015-10-25
47
52
  ==================
@@ -2,9 +2,9 @@
2
2
 
3
3
  [![NPM Version][npm-version-image]][npm-url]
4
4
  [![NPM Downloads][npm-downloads-image]][npm-url]
5
- [![Node.js Version][node-version-image]][node-version-url]
6
- [![Build Status][github-actions-ci-image]][github-actions-ci-url]
7
- [![Test Coverage][coveralls-image]][coveralls-url]
5
+ [![Node.js Version][node-image]][node-url]
6
+ [![Build Status][ci-image]][ci-url]
7
+ [![Coverage Status][coveralls-image]][coveralls-url]
8
8
 
9
9
  Basic HTTP cookie parser and serializer for HTTP servers.
10
10
 
@@ -107,6 +107,17 @@ The given number will be converted to an integer by rounding down. By default, n
107
107
  `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
108
108
  so if both are set, they should point to the same date and time.
109
109
 
110
+ ##### partitioned
111
+
112
+ Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies)
113
+ attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the
114
+ `Partitioned` attribute is not set.
115
+
116
+ **note** This is an attribute that has not yet been fully standardized, and may change in the future.
117
+ This also means many clients may ignore this attribute until they understand it.
118
+
119
+ More information about can be found in [the proposal](https://github.com/privacycg/CHIPS).
120
+
110
121
  ##### path
111
122
 
112
123
  Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path
@@ -212,49 +223,52 @@ $ npm test
212
223
  ```
213
224
  $ npm run bench
214
225
 
215
- > cookie@0.4.2 bench
226
+ > cookie@0.5.0 bench
216
227
  > node benchmark/index.js
217
228
 
218
- node@16.14.0
219
- v8@9.4.146.24-node.20
220
- uv@1.43.0
221
- zlib@1.2.11
229
+ node@18.18.2
230
+ acorn@8.10.0
231
+ ada@2.6.0
232
+ ares@1.19.1
222
233
  brotli@1.0.9
223
- ares@1.18.1
224
- modules@93
225
- nghttp2@1.45.1
226
- napi@8
227
- llhttp@6.0.4
228
- openssl@1.1.1m+quic
229
- cldr@40.0
230
- icu@70.1
231
- tz@2021a3
232
- unicode@14.0
233
- ngtcp2@0.1.0-DEV
234
- nghttp3@0.1.0-DEV
234
+ cldr@43.1
235
+ icu@73.2
236
+ llhttp@6.0.11
237
+ modules@108
238
+ napi@9
239
+ nghttp2@1.57.0
240
+ nghttp3@0.7.0
241
+ ngtcp2@0.8.1
242
+ openssl@3.0.10+quic
243
+ simdutf@3.2.14
244
+ tz@2023c
245
+ undici@5.26.3
246
+ unicode@15.0
247
+ uv@1.44.2
248
+ uvwasi@0.0.18
249
+ v8@10.2.154.26-node.26
250
+ zlib@1.2.13.1-motley
235
251
 
236
252
  > node benchmark/parse-top.js
237
253
 
238
254
  cookie.parse - top sites
239
255
 
240
- 15 tests completed.
241
-
242
- parse accounts.google.com x 2,421,245 ops/sec ±0.80% (188 runs sampled)
243
- parse apple.com x 2,684,710 ops/sec ±0.59% (189 runs sampled)
244
- parse cloudflare.com x 2,231,418 ops/sec ±0.76% (186 runs sampled)
245
- parse docs.google.com x 2,316,357 ops/sec ±1.28% (187 runs sampled)
246
- parse drive.google.com x 2,363,543 ops/sec ±0.49% (189 runs sampled)
247
- parse en.wikipedia.org x 839,414 ops/sec ±0.53% (189 runs sampled)
248
- parse linkedin.com x 553,797 ops/sec ±0.63% (190 runs sampled)
249
- parse maps.google.com x 1,314,779 ops/sec ±0.72% (189 runs sampled)
250
- parse microsoft.com x 153,783 ops/sec ±0.53% (190 runs sampled)
251
- parse play.google.com x 2,249,574 ops/sec ±0.59% (187 runs sampled)
252
- parse plus.google.com x 2,258,682 ops/sec ±0.60% (188 runs sampled)
253
- parse sites.google.com x 2,247,069 ops/sec ±0.68% (189 runs sampled)
254
- parse support.google.com x 1,456,840 ops/sec ±0.70% (187 runs sampled)
255
- parse www.google.com x 1,046,028 ops/sec ±0.58% (188 runs sampled)
256
- parse youtu.be x 937,428 ops/sec ±1.47% (190 runs sampled)
257
- parse youtube.com x 963,878 ops/sec ±0.59% (190 runs sampled)
256
+ 14 tests completed.
257
+
258
+ parse accounts.google.com x 2,588,913 ops/sec ±0.74% (186 runs sampled)
259
+ parse apple.com x 2,370,002 ops/sec ±0.69% (186 runs sampled)
260
+ parse cloudflare.com x 2,213,102 ops/sec ±0.88% (188 runs sampled)
261
+ parse docs.google.com x 2,194,157 ops/sec ±1.03% (184 runs sampled)
262
+ parse drive.google.com x 2,265,084 ops/sec ±0.79% (187 runs sampled)
263
+ parse en.wikipedia.org x 457,099 ops/sec ±0.81% (186 runs sampled)
264
+ parse linkedin.com x 504,407 ops/sec ±0.89% (186 runs sampled)
265
+ parse maps.google.com x 1,230,959 ops/sec ±0.98% (186 runs sampled)
266
+ parse microsoft.com x 926,294 ops/sec ±0.88% (184 runs sampled)
267
+ parse play.google.com x 2,311,338 ops/sec ±0.83% (185 runs sampled)
268
+ parse support.google.com x 1,508,850 ops/sec ±0.86% (186 runs sampled)
269
+ parse www.google.com x 1,022,582 ops/sec ±1.32% (182 runs sampled)
270
+ parse youtu.be x 332,136 ops/sec ±1.02% (185 runs sampled)
271
+ parse youtube.com x 323,833 ops/sec ±0.77% (183 runs sampled)
258
272
 
259
273
  > node benchmark/parse.js
260
274
 
@@ -262,12 +276,12 @@ $ npm run bench
262
276
 
263
277
  6 tests completed.
264
278
 
265
- simple x 2,745,604 ops/sec ±0.77% (185 runs sampled)
266
- decode x 557,287 ops/sec ±0.60% (188 runs sampled)
267
- unquote x 2,498,475 ops/sec ±0.55% (189 runs sampled)
268
- duplicates x 868,591 ops/sec ±0.89% (187 runs sampled)
269
- 10 cookies x 306,745 ops/sec ±0.49% (190 runs sampled)
270
- 100 cookies x 22,414 ops/sec ±2.38% (182 runs sampled)
279
+ simple x 3,214,032 ops/sec ±1.61% (183 runs sampled)
280
+ decode x 587,237 ops/sec ±1.16% (187 runs sampled)
281
+ unquote x 2,954,618 ops/sec ±1.35% (183 runs sampled)
282
+ duplicates x 857,008 ops/sec ±0.89% (187 runs sampled)
283
+ 10 cookies x 292,133 ops/sec ±0.89% (187 runs sampled)
284
+ 100 cookies x 22,610 ops/sec ±0.68% (187 runs sampled)
271
285
  ```
272
286
 
273
287
  ## References
@@ -275,6 +289,7 @@ $ npm run bench
275
289
  - [RFC 6265: HTTP State Management Mechanism][rfc-6265]
276
290
  - [Same-site Cookies][rfc-6265bis-09-5.4.7]
277
291
 
292
+ [rfc-cutler-httpbis-partitioned-cookies]: https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/
278
293
  [rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1
279
294
  [rfc-6265bis-09-5.4.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7
280
295
  [rfc-6265]: https://tools.ietf.org/html/rfc6265
@@ -291,12 +306,12 @@ $ npm run bench
291
306
 
292
307
  [MIT](LICENSE)
293
308
 
309
+ [ci-image]: https://badgen.net/github/checks/jshttp/cookie/master?label=ci
310
+ [ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml
294
311
  [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master
295
312
  [coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master
296
- [github-actions-ci-image]: https://img.shields.io/github/workflow/status/jshttp/cookie/ci/master?label=ci
297
- [github-actions-ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml
298
- [node-version-image]: https://badgen.net/npm/node/cookie
299
- [node-version-url]: https://nodejs.org/en/download
313
+ [node-image]: https://badgen.net/npm/node/cookie
314
+ [node-url]: https://nodejs.org/en/download
300
315
  [npm-downloads-image]: https://badgen.net/npm/dm/cookie
301
316
  [npm-url]: https://npmjs.org/package/cookie
302
317
  [npm-version-image]: https://badgen.net/npm/v/cookie
@@ -172,6 +172,10 @@ function serialize(name, val, options) {
172
172
  str += '; Secure';
173
173
  }
174
174
 
175
+ if (opt.partitioned) {
176
+ str += '; Partitioned'
177
+ }
178
+
175
179
  if (opt.priority) {
176
180
  var priority = typeof opt.priority === 'string'
177
181
  ? opt.priority.toLowerCase()
@@ -233,7 +237,7 @@ function decode (str) {
233
237
  /**
234
238
  * URL-encode value.
235
239
  *
236
- * @param {string} str
240
+ * @param {string} val
237
241
  * @returns {string}
238
242
  */
239
243
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cookie",
3
3
  "description": "HTTP server cookie parsing and serialization",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "author": "Roman Shtylman <shtylman@gmail.com>",
6
6
  "contributors": [
7
7
  "Douglas Christopher Wilson <doug@somethingdoug.com>"
@@ -15,12 +15,12 @@
15
15
  "devDependencies": {
16
16
  "beautify-benchmark": "0.2.4",
17
17
  "benchmark": "2.1.4",
18
- "eslint": "7.32.0",
19
- "eslint-plugin-markdown": "2.2.1",
20
- "mocha": "9.2.2",
18
+ "eslint": "8.53.0",
19
+ "eslint-plugin-markdown": "3.0.1",
20
+ "mocha": "10.2.0",
21
21
  "nyc": "15.1.0",
22
22
  "safe-buffer": "5.2.1",
23
- "top-sites": "1.1.97"
23
+ "top-sites": "1.1.194"
24
24
  },
25
25
  "files": [
26
26
  "HISTORY.md",
@@ -1,4 +1,20 @@
1
- 4.18.3 / 2024-02-26
1
+ 4.19.2 / 2024-03-25
2
+ ==========
3
+
4
+ * Improved fix for open redirect allow list bypass
5
+
6
+ 4.19.1 / 2024-03-20
7
+ ==========
8
+
9
+ * Allow passing non-strings to res.location with new encoding handling checks
10
+
11
+ 4.19.0 / 2024-03-20
12
+ ==========
13
+
14
+ * Prevent open redirect allow list bypass due to encodeurl
15
+ * deps: cookie@0.6.0
16
+
17
+ 4.18.3 / 2024-02-29
2
18
  ==========
3
19
 
4
20
  * Fix routing requests without method
@@ -6,6 +22,8 @@
6
22
  - Fix strict json error message on Node.js 19+
7
23
  - deps: content-type@~1.0.5
8
24
  - deps: raw-body@2.5.2
25
+ * deps: cookie@0.6.0
26
+ - Add `partitioned` option
9
27
 
10
28
  4.18.2 / 2022-10-08
11
29
  ===================
@@ -55,6 +55,7 @@ module.exports = res
55
55
  */
56
56
 
57
57
  var charsetRegExp = /;\s*charset\s*=/;
58
+ var schemaAndHostRegExp = /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:)?\/\/[^\\\/\?]+/;
58
59
 
59
60
  /**
60
61
  * Set status `code`.
@@ -904,15 +905,23 @@ res.cookie = function (name, value, options) {
904
905
  */
905
906
 
906
907
  res.location = function location(url) {
907
- var loc = url;
908
+ var loc;
908
909
 
909
910
  // "back" is an alias for the referrer
910
911
  if (url === 'back') {
911
912
  loc = this.req.get('Referrer') || '/';
913
+ } else {
914
+ loc = String(url);
912
915
  }
913
916
 
914
- // set location
915
- return this.set('Location', encodeUrl(loc));
917
+ var m = schemaAndHostRegExp.exec(loc);
918
+ var pos = m ? m[0].length + 1 : 0;
919
+
920
+ // Only encode after host to avoid invalid encoding which can introduce
921
+ // vulnerabilities (e.g. `\\` to `%5C`).
922
+ loc = loc.slice(0, pos) + encodeUrl(loc.slice(pos));
923
+
924
+ return this.set('Location', loc);
916
925
  };
917
926
 
918
927
  /**
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "express",
3
3
  "description": "Fast, unopinionated, minimalist web framework",
4
- "version": "4.18.3",
4
+ "version": "4.19.2",
5
5
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
6
6
  "contributors": [
7
7
  "Aaron Heckmann <aaron.heckmann+github@gmail.com>",
@@ -33,7 +33,7 @@
33
33
  "body-parser": "1.20.2",
34
34
  "content-disposition": "0.5.4",
35
35
  "content-type": "~1.0.4",
36
- "cookie": "0.5.0",
36
+ "cookie": "0.6.0",
37
37
  "cookie-signature": "1.0.6",
38
38
  "debug": "2.6.9",
39
39
  "depd": "2.0.0",
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "node-red-contrib-web-worldmap",
3
- "version": "4.6.4",
3
+ "version": "4.7.0",
4
4
  "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
5
5
  "dependencies": {
6
6
  "@turf/bezier-spline": "~6.5.0",
7
7
  "cgi": "0.3.1",
8
8
  "compression": "^1.7.4",
9
- "express": "^4.18.2",
9
+ "express": "^4.19.2",
10
10
  "sockjs": "~0.3.24"
11
11
  },
12
12
  "bundledDependencies": [
@@ -1,9 +1,9 @@
1
- var protomapsL=(()=>{var bi=Object.create;var De=Object.defineProperty;var wi=Object.getOwnPropertyDescriptor;var vi=Object.getOwnPropertyNames,Jt=Object.getOwnPropertySymbols,_i=Object.getPrototypeOf,Gt=Object.prototype.hasOwnProperty,zi=Object.prototype.propertyIsEnumerable;var Qt=(t,e,r)=>e in t?De(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,er=(t,e)=>{for(var r in e||(e={}))Gt.call(e,r)&&Qt(t,r,e[r]);if(Jt)for(var r of Jt(e))zi.call(e,r)&&Qt(t,r,e[r]);return t};var tr=t=>De(t,"__esModule",{value:!0});var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ki=(t,e)=>{tr(t);for(var r in e)De(t,r,{get:e[r],enumerable:!0})},Li=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vi(e))!Gt.call(t,i)&&i!=="default"&&De(t,i,{get:()=>e[i],enumerable:!(r=wi(e,i))||r.enumerable});return t},N=t=>Li(tr(De(t!=null?bi(_i(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var O=(t,e,r)=>new Promise((i,n)=>{var a=l=>{try{o(r.next(l))}catch(u){n(u)}},s=l=>{try{o(r.throw(l))}catch(u){n(u)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,s);o((r=r.apply(t,e)).next())});var re=K((ca,rr)=>{"use strict";rr.exports=ge;function ge(t,e){this.x=t,this.y=e}ge.prototype={clone:function(){return new ge(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),a=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};ge.convert=function(t){return t instanceof ge?t:Array.isArray(t)?new ge(t[0],t[1]):t}});var pt=K((ma,ir)=>{"use strict";var Si=re();ir.exports=be;function be(t,e,r,i,n){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n,t.readFields(Fi,this,e)}function Fi(t,e,r){t==1?e.id=r.readVarint():t==2?Mi(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function Mi(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var i=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[i]=n}}be.types=["Unknown","Point","LineString","Polygon"];be.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=[],o;t.pos<e;){if(i<=0){var l=t.readVarint();r=l&7,i=l>>3}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),r===1&&(o&&s.push(o),o=[]),o.push(new Si(n,a));else if(r===7)o&&o.push(o[0].clone());else throw new Error("unknown command "+r)}return o&&s.push(o),s};be.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;t.pos<e;){if(i<=0){var f=t.readVarint();r=f&7,i=f>>3}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),n<s&&(s=n),n>o&&(o=n),a<l&&(l=a),a>u&&(u=a);else if(r!==7)throw new Error("unknown command "+r)}return[s,l,o,u]};be.prototype.toGeoJSON=function(t,e,r){var i=this.extent*Math.pow(2,r),n=this.extent*t,a=this.extent*e,s=this.loadGeometry(),o=be.types[this.type],l,u;function f(x){for(var w=0;w<x.length;w++){var z=x[w],h=180-(z.y+a)*360/i;x[w]=[(z.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp(h*Math.PI/180))-90]}}switch(this.type){case 1:var d=[];for(l=0;l<s.length;l++)d[l]=s[l][0];s=d,f(s);break;case 2:for(l=0;l<s.length;l++)f(s[l]);break;case 3:for(s=Ci(s),l=0;l<s.length;l++)for(u=0;u<s[l].length;u++)f(s[l][u]);break}s.length===1?s=s[0]:o="Multi"+o;var c={type:"Feature",geometry:{type:o,coordinates:s},properties:this.properties};return"id"in this&&(c.id=this.id),c};function Ci(t){var e=t.length;if(e<=1)return[t];for(var r=[],i,n,a=0;a<e;a++){var s=Ti(t[a]);s!==0&&(n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[t[a]]):i.push(t[a]))}return i&&r.push(i),r}function Ti(t){for(var e=0,r=0,i=t.length,n=i-1,a,s;r<i;n=r++)a=t[r],s=t[n],e+=(s.x-a.x)*(a.y+s.y);return e}});var yt=K((pa,ar)=>{"use strict";var Pi=pt();ar.exports=nr;function nr(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Di,this,e),this.length=this._features.length}function Di(t,e,r){t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(Ai(r))}function Ai(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var i=t.readVarint()>>3;e=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null}return e}nr.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Pi(this._pbf,e,this.extent,this._keys,this._values)}});var or=K((ya,sr)=>{"use strict";var Bi=yt();sr.exports=Ei;function Ei(t,e){this.layers=t.readFields(Ri,{},e)}function Ri(t,e,r){if(t===3){var i=new Bi(r,r.readVarint()+r.pos);i.length&&(e[i.name]=i)}}});var lr=K((xa,Ge)=>{Ge.exports.VectorTile=or();Ge.exports.VectorTileFeature=pt();Ge.exports.VectorTileLayer=yt()});var ur=K(xt=>{xt.read=function(t,e,r,i,n){var a,s,o=n*8-i-1,l=(1<<o)-1,u=l>>1,f=-7,d=r?n-1:0,c=r?-1:1,x=t[e+d];for(d+=c,a=x&(1<<-f)-1,x>>=-f,f+=o;f>0;a=a*256+t[e+d],d+=c,f-=8);for(s=a&(1<<-f)-1,a>>=-f,f+=i;f>0;s=s*256+t[e+d],d+=c,f-=8);if(a===0)a=1-u;else{if(a===l)return s?NaN:(x?-1:1)*(1/0);s=s+Math.pow(2,i),a=a-u}return(x?-1:1)*s*Math.pow(2,a-i)};xt.write=function(t,e,r,i,n,a){var s,o,l,u=a*8-n-1,f=(1<<u)-1,d=f>>1,c=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:a-1,w=i?1:-1,z=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?e+=c/l:e+=c*Math.pow(2,1-d),e*l>=2&&(s++,l/=2),s+d>=f?(o=0,s=f):s+d>=1?(o=(e*l-1)*Math.pow(2,n),s=s+d):(o=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+x]=o&255,x+=w,o/=256,n-=8);for(s=s<<n|o,u+=n;u>0;t[r+x]=s&255,x+=w,s/=256,u-=8);t[r+x-w]|=z*128}});var pr=K((ba,mr)=>{"use strict";mr.exports=F;var Qe=ur();function F(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}F.Varint=0;F.Fixed64=1;F.Bytes=2;F.Fixed32=5;var gt=(1<<16)*(1<<16),hr=1/gt,Oi=12,fr=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");F.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var i=this.readVarint(),n=i>>3,a=this.pos;this.type=i&7,t(n,e,this),this.pos===a&&this.skip(i)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=et(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=cr(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=et(this.buf,this.pos)+et(this.buf,this.pos+4)*gt;return this.pos+=8,t},readSFixed64:function(){var t=et(this.buf,this.pos)+cr(this.buf,this.pos+4)*gt;return this.pos+=8,t},readFloat:function(){var t=Qe.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Qe.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,i;return i=e[this.pos++],r=i&127,i<128||(i=e[this.pos++],r|=(i&127)<<7,i<128)||(i=e[this.pos++],r|=(i&127)<<14,i<128)||(i=e[this.pos++],r|=(i&127)<<21,i<128)?r:(i=e[this.pos],r|=(i&15)<<28,Ii(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Oi&&fr?Gi(this.buf,e,t):Ji(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==F.Bytes)return t.push(this.readVarint(e));var r=ae(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==F.Bytes)return t.push(this.readSVarint());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==F.Bytes)return t.push(this.readBoolean());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==F.Bytes)return t.push(this.readFloat());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==F.Bytes)return t.push(this.readDouble());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==F.Bytes)return t.push(this.readFixed32());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==F.Bytes)return t.push(this.readSFixed32());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==F.Bytes)return t.push(this.readFixed64());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==F.Bytes)return t.push(this.readSFixed64());var e=ae(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===F.Varint)for(;this.buf[this.pos++]>127;);else if(e===F.Bytes)this.pos=this.readVarint()+this.pos;else if(e===F.Fixed32)this.pos+=4;else if(e===F.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),ve(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),ve(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),ve(this.buf,t&-1,this.pos),ve(this.buf,Math.floor(t*hr),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),ve(this.buf,t&-1,this.pos),ve(this.buf,Math.floor(t*hr),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Xi(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=Qi(this.buf,t,this.pos);var r=this.pos-e;r>=128&&dr(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Qe.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Qe.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var i=this.pos-r;i>=128&&dr(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,e,r){this.writeTag(t,F.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Ui,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,ji,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Zi,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Ni,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,qi,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Wi,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,$i,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Hi,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Ki,e)},writeBytesField:function(t,e){this.writeTag(t,F.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,F.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,F.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,F.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,F.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,F.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,F.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,F.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,F.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,F.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function Ii(t,e,r){var i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return we(t,n,e);throw new Error("Expected varint not more than 10 bytes")}function ae(t){return t.type===F.Bytes?t.readVarint()+t.pos:t.pos+1}function we(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Xi(t,e){var r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Vi(r,i,e),Yi(i,e)}function Vi(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Yi(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),!!t&&(e.buf[e.pos++]=t&127)))))}function dr(t,e,r){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i);for(var n=r.pos-1;n>=t;n--)r.buf[n+i]=r.buf[n]}function Ui(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function ji(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Ni(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function qi(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Zi(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Wi(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function $i(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Hi(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Ki(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function et(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function ve(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function cr(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Ji(t,e,r){for(var i="",n=e;n<r;){var a=t[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;var l,u,f;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],f=t[n+3],(l&192)==128&&(u&192)==128&&(f&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|f&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function Gi(t,e,r){return fr.decode(t.subarray(e,r))}function Qi(t,e,r){for(var i=0,n,a;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(a)if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}else n=a-55296<<10|n-56320|65536,a=null;else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}else a&&(t[r++]=239,t[r++]=191,t[r++]=189,a=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}});var jr=K((Ft,Mt)=>{(function(t,e){typeof Ft=="object"&&typeof Mt!="undefined"?Mt.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self).RBush=e()})(Ft,function(){"use strict";function t(h,m,p,b,y){(function g(v,_,k,S,D){for(;S>k;){if(S-k>600){var T=S-k+1,E=_-k+1,W=Math.log(T),$=.5*Math.exp(2*W/3),ie=.5*Math.sqrt(W*$*(T-$)/T)*(E-T/2<0?-1:1),V=Math.max(k,Math.floor(_-E*$/T+ie)),dt=Math.min(S,Math.floor(_+(T-E)*$/T+ie));g(v,_,V,dt,D)}var xe=v[_],ne=k,R=S;for(e(v,k,_),D(v[S],xe)>0&&e(v,k,S);ne<R;){for(e(v,ne,R),ne++,R--;D(v[ne],xe)<0;)ne++;for(;D(v[R],xe)>0;)R--}D(v[k],xe)===0?e(v,k,R):e(v,++R,S),R<=_&&(k=R+1),_<=R&&(S=R-1)}})(h,m,p||0,b||h.length-1,y||r)}function e(h,m,p){var b=h[m];h[m]=h[p],h[p]=b}function r(h,m){return h<m?-1:h>m?1:0}var i=function(h){h===void 0&&(h=9),this._maxEntries=Math.max(4,h),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function n(h,m,p){if(!p)return m.indexOf(h);for(var b=0;b<m.length;b++)if(p(h,m[b]))return b;return-1}function a(h,m){s(h,0,h.children.length,m,h)}function s(h,m,p,b,y){y||(y=w(null)),y.minX=1/0,y.minY=1/0,y.maxX=-1/0,y.maxY=-1/0;for(var g=m;g<p;g++){var v=h.children[g];o(y,h.leaf?b(v):v)}return y}function o(h,m){return h.minX=Math.min(h.minX,m.minX),h.minY=Math.min(h.minY,m.minY),h.maxX=Math.max(h.maxX,m.maxX),h.maxY=Math.max(h.maxY,m.maxY),h}function l(h,m){return h.minX-m.minX}function u(h,m){return h.minY-m.minY}function f(h){return(h.maxX-h.minX)*(h.maxY-h.minY)}function d(h){return h.maxX-h.minX+(h.maxY-h.minY)}function c(h,m){return h.minX<=m.minX&&h.minY<=m.minY&&m.maxX<=h.maxX&&m.maxY<=h.maxY}function x(h,m){return m.minX<=h.maxX&&m.minY<=h.maxY&&m.maxX>=h.minX&&m.maxY>=h.minY}function w(h){return{children:h,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function z(h,m,p,b,y){for(var g=[m,p];g.length;)if(!((p=g.pop())-(m=g.pop())<=b)){var v=m+Math.ceil((p-m)/b/2)*b;t(h,v,m,p,y),g.push(m,v,v,p)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(h){var m=this.data,p=[];if(!x(h,m))return p;for(var b=this.toBBox,y=[];m;){for(var g=0;g<m.children.length;g++){var v=m.children[g],_=m.leaf?b(v):v;x(h,_)&&(m.leaf?p.push(v):c(h,_)?this._all(v,p):y.push(v))}m=y.pop()}return p},i.prototype.collides=function(h){var m=this.data;if(!x(h,m))return!1;for(var p=[];m;){for(var b=0;b<m.children.length;b++){var y=m.children[b],g=m.leaf?this.toBBox(y):y;if(x(h,g)){if(m.leaf||c(h,g))return!0;p.push(y)}}m=p.pop()}return!1},i.prototype.load=function(h){if(!h||!h.length)return this;if(h.length<this._minEntries){for(var m=0;m<h.length;m++)this.insert(h[m]);return this}var p=this._build(h.slice(),0,h.length-1,0);if(this.data.children.length)if(this.data.height===p.height)this._splitRoot(this.data,p);else{if(this.data.height<p.height){var b=this.data;this.data=p,p=b}this._insert(p,this.data.height-p.height-1,!0)}else this.data=p;return this},i.prototype.insert=function(h){return h&&this._insert(h,this.data.height-1),this},i.prototype.clear=function(){return this.data=w([]),this},i.prototype.remove=function(h,m){if(!h)return this;for(var p,b,y,g=this.data,v=this.toBBox(h),_=[],k=[];g||_.length;){if(g||(g=_.pop(),b=_[_.length-1],p=k.pop(),y=!0),g.leaf){var S=n(h,g.children,m);if(S!==-1)return g.children.splice(S,1),_.push(g),this._condense(_),this}y||g.leaf||!c(g,v)?b?(p++,g=b.children[p],y=!1):g=null:(_.push(g),k.push(p),p=0,b=g,g=g.children[0])}return this},i.prototype.toBBox=function(h){return h},i.prototype.compareMinX=function(h,m){return h.minX-m.minX},i.prototype.compareMinY=function(h,m){return h.minY-m.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(h){return this.data=h,this},i.prototype._all=function(h,m){for(var p=[];h;)h.leaf?m.push.apply(m,h.children):p.push.apply(p,h.children),h=p.pop();return m},i.prototype._build=function(h,m,p,b){var y,g=p-m+1,v=this._maxEntries;if(g<=v)return a(y=w(h.slice(m,p+1)),this.toBBox),y;b||(b=Math.ceil(Math.log(g)/Math.log(v)),v=Math.ceil(g/Math.pow(v,b-1))),(y=w([])).leaf=!1,y.height=b;var _=Math.ceil(g/v),k=_*Math.ceil(Math.sqrt(v));z(h,m,p,k,this.compareMinX);for(var S=m;S<=p;S+=k){var D=Math.min(S+k-1,p);z(h,S,D,_,this.compareMinY);for(var T=S;T<=D;T+=_){var E=Math.min(T+_-1,D);y.children.push(this._build(h,T,E,b-1))}}return a(y,this.toBBox),y},i.prototype._chooseSubtree=function(h,m,p,b){for(;b.push(m),!m.leaf&&b.length-1!==p;){for(var y=1/0,g=1/0,v=void 0,_=0;_<m.children.length;_++){var k=m.children[_],S=f(k),D=(T=h,E=k,(Math.max(E.maxX,T.maxX)-Math.min(E.minX,T.minX))*(Math.max(E.maxY,T.maxY)-Math.min(E.minY,T.minY))-S);D<g?(g=D,y=S<y?S:y,v=k):D===g&&S<y&&(y=S,v=k)}m=v||m.children[0]}var T,E;return m},i.prototype._insert=function(h,m,p){var b=p?h:this.toBBox(h),y=[],g=this._chooseSubtree(b,this.data,m,y);for(g.children.push(h),o(g,b);m>=0&&y[m].children.length>this._maxEntries;)this._split(y,m),m--;this._adjustParentBBoxes(b,y,m)},i.prototype._split=function(h,m){var p=h[m],b=p.children.length,y=this._minEntries;this._chooseSplitAxis(p,y,b);var g=this._chooseSplitIndex(p,y,b),v=w(p.children.splice(g,p.children.length-g));v.height=p.height,v.leaf=p.leaf,a(p,this.toBBox),a(v,this.toBBox),m?h[m-1].children.push(v):this._splitRoot(p,v)},i.prototype._splitRoot=function(h,m){this.data=w([h,m]),this.data.height=h.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(h,m,p){for(var b,y,g,v,_,k,S,D=1/0,T=1/0,E=m;E<=p-m;E++){var W=s(h,0,E,this.toBBox),$=s(h,E,p,this.toBBox),ie=(y=W,g=$,v=void 0,_=void 0,k=void 0,S=void 0,v=Math.max(y.minX,g.minX),_=Math.max(y.minY,g.minY),k=Math.min(y.maxX,g.maxX),S=Math.min(y.maxY,g.maxY),Math.max(0,k-v)*Math.max(0,S-_)),V=f(W)+f($);ie<D?(D=ie,b=E,T=V<T?V:T):ie===D&&V<T&&(T=V,b=E)}return b||p-m},i.prototype._chooseSplitAxis=function(h,m,p){var b=h.leaf?this.compareMinX:l,y=h.leaf?this.compareMinY:u;this._allDistMargin(h,m,p,b)<this._allDistMargin(h,m,p,y)&&h.children.sort(b)},i.prototype._allDistMargin=function(h,m,p,b){h.children.sort(b);for(var y=this.toBBox,g=s(h,0,m,y),v=s(h,p-m,p,y),_=d(g)+d(v),k=m;k<p-m;k++){var S=h.children[k];o(g,h.leaf?y(S):S),_+=d(g)}for(var D=p-m-1;D>=m;D--){var T=h.children[D];o(v,h.leaf?y(T):T),_+=d(v)}return _},i.prototype._adjustParentBBoxes=function(h,m,p){for(var b=p;b>=0;b--)o(m[b],h)},i.prototype._condense=function(h){for(var m=h.length-1,p=void 0;m>=0;m--)h[m].children.length===0?m>0?(p=h[m-1].children).splice(p.indexOf(h[m]),1):this.clear():a(h[m],this.toBBox)},i})});var Kr=K(()=>{});var Jr=K((Pt,Dt)=>{(function(t,e){typeof Pt=="object"&&typeof Dt!="undefined"?Dt.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self,t.TinyQueue=e())})(Pt,function(){"use strict";var t=function(i,n){if(i===void 0&&(i=[]),n===void 0&&(n=e),this.data=i,this.length=this.data.length,this.compare=n,this.length>0)for(var a=(this.length>>1)-1;a>=0;a--)this._down(a)};t.prototype.push=function(i){this.data.push(i),this.length++,this._up(this.length-1)},t.prototype.pop=function(){if(this.length!==0){var i=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),i}},t.prototype.peek=function(){return this.data[0]},t.prototype._up=function(i){for(var n=this,a=n.data,s=n.compare,o=a[i];i>0;){var l=i-1>>1,u=a[l];if(s(o,u)>=0)break;a[i]=u,i=l}a[i]=o},t.prototype._down=function(i){for(var n=this,a=n.data,s=n.compare,o=this.length>>1,l=a[i];i<o;){var u=(i<<1)+1,f=a[u],d=u+1;if(d<this.length&&s(a[d],f)<0&&(u=d,f=a[d]),s(f,l)>=0)break;a[i]=f,i=u}a[i]=l};function e(r,i){return r<i?-1:r>i?1:0}return t})});var Qr=K((Ua,At)=>{"use strict";var ot=Jr();ot.default&&(ot=ot.default);At.exports=Gr;At.exports.default=Gr;function Gr(t,e,r){e=e||1;for(var i,n,a,s,o=0;o<t[0].length;o++){var l=t[0][o];(!o||l[0]<i)&&(i=l[0]),(!o||l[1]<n)&&(n=l[1]),(!o||l[0]>a)&&(a=l[0]),(!o||l[1]>s)&&(s=l[1])}var u=a-i,f=s-n,d=Math.min(u,f),c=d/2;if(d===0){var x=[i,n];return x.distance=0,x}for(var w=new ot(void 0,Wn),z=i;z<a;z+=d)for(var h=n;h<s;h+=d)w.push(new fe(z+c,h+c,c,t));var m=Hn(t),p=new fe(i+u/2,n+f/2,0,t);p.d>m.d&&(m=p);for(var b=w.length;w.length;){var y=w.pop();y.d>m.d&&(m=y,r&&console.log("found best %d after %d probes",Math.round(1e4*y.d)/1e4,b)),!(y.max-m.d<=e)&&(c=y.h/2,w.push(new fe(y.x-c,y.y-c,c,t)),w.push(new fe(y.x+c,y.y-c,c,t)),w.push(new fe(y.x-c,y.y+c,c,t)),w.push(new fe(y.x+c,y.y+c,c,t)),b+=4)}r&&(console.log("num probes: "+b),console.log("best distance: "+m.d));var g=[m.x,m.y];return g.distance=m.d,g}function Wn(t,e){return e.max-t.max}function fe(t,e,r,i){this.x=t,this.y=e,this.h=r,this.d=$n(t,e,i),this.max=this.d+this.h*Math.SQRT2}function $n(t,e,r){for(var i=!1,n=1/0,a=0;a<r.length;a++)for(var s=r[a],o=0,l=s.length,u=l-1;o<l;u=o++){var f=s[o],d=s[u];f[1]>e!=d[1]>e&&t<(d[0]-f[0])*(e-f[1])/(d[1]-f[1])+f[0]&&(i=!i),n=Math.min(n,Kn(t,e,f,d))}return n===0?0:(i?1:-1)*Math.sqrt(n)}function Hn(t){for(var e=0,r=0,i=0,n=t[0],a=0,s=n.length,o=s-1;a<s;o=a++){var l=n[a],u=n[o],f=l[0]*u[1]-u[0]*l[1];r+=(l[0]+u[0])*f,i+=(l[1]+u[1])*f,e+=f*3}return e===0?new fe(n[0][0],n[0][1],0,t):new fe(r/e,i/e,0,t)}function Kn(t,e,r,i){var n=r[0],a=r[1],s=i[0]-n,o=i[1]-a;if(s!==0||o!==0){var l=((t-n)*s+(e-a)*o)/(s*s+o*o);l>1?(n=i[0],a=i[1]):l>0&&(n+=s*l,a+=o*l)}return s=t-n,o=e-a,s*s+o*o}});var fa={};ki(fa,{CenteredSymbolizer:()=>It,CenteredTextSymbolizer:()=>U,CircleSymbolizer:()=>te,FlexSymbolizer:()=>$e,Font:()=>Ut,GeomType:()=>ee,GroupSymbolizer:()=>ye,IconSymbolizer:()=>li,Index:()=>Ct,Justify:()=>X,Labeler:()=>Ue,Labelers:()=>je,LineLabelPlacement:()=>Me,LineLabelSymbolizer:()=>ce,LineSymbolizer:()=>C,OffsetSymbolizer:()=>Xt,OffsetTextSymbolizer:()=>le,PMTiles:()=>rt,Padding:()=>hi,PmtilesSource:()=>Oe,PolygonLabelSymbolizer:()=>ue,PolygonSymbolizer:()=>A,Sheet:()=>gi,ShieldSymbolizer:()=>lt,Static:()=>pi,TextPlacements:()=>P,TextSymbolizer:()=>He,TileCache:()=>st,Toner:()=>ha,View:()=>St,ZxySource:()=>it,arr:()=>de,covering:()=>Zr,createPattern:()=>Ot,cubicBezier:()=>ta,dark:()=>Se,exp:()=>j,filterFn:()=>Je,getFont:()=>qt,getZoom:()=>Vt,isCCW:()=>Ir,isInRing:()=>Lt,json_style:()=>ua,labelRules:()=>Te,leafletLayer:()=>oa,light:()=>Le,linear:()=>ea,numberFn:()=>ft,numberOrFn:()=>jt,paintRules:()=>Ce,painter:()=>Ye,pointInPolygon:()=>Xr,pointMinDistToLines:()=>Yr,pointMinDistToPoints:()=>Vr,sourcesToViews:()=>Ve,step:()=>Qn,toIndex:()=>oe,transformGeom:()=>Ie,widthFn:()=>Nt,wrap:()=>Xe});var he=N(re());var pe=N(re());var ke=N(re()),Ar=N(lr()),Br=N(pr());var Y=(t,e,r)=>new Promise((i,n)=>{var a=l=>{try{o(r.next(l))}catch(u){n(u)}},s=l=>{try{o(r.throw(l))}catch(u){n(u)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,s);o((r=r.apply(t,e)).next())}),q=Uint8Array,me=Uint16Array,yr=Uint32Array,xr=new q([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gr=new q([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),en=new q([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),br=function(t,e){for(var r=new me(31),i=0;i<31;++i)r[i]=e+=1<<t[i-1];for(var n=new yr(r[30]),i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return[r,n]},wr=br(xr,2),vr=wr[0],tn=wr[1];vr[28]=258,tn[258]=28;var _r=br(gr,0),rn=_r[0],wa=_r[1],bt=new me(32768);for(M=0;M<32768;++M)se=(M&43690)>>>1|(M&21845)<<1,se=(se&52428)>>>2|(se&13107)<<2,se=(se&61680)>>>4|(se&3855)<<4,bt[M]=((se&65280)>>>8|(se&255)<<8)>>>1;var se,M,Ae=function(t,e,r){for(var i=t.length,n=0,a=new me(e);n<i;++n)t[n]&&++a[t[n]-1];var s=new me(e);for(n=0;n<e;++n)s[n]=s[n-1]+a[n-1]<<1;var o;if(r){o=new me(1<<e);var l=15-e;for(n=0;n<i;++n)if(t[n])for(var u=n<<4|t[n],f=e-t[n],d=s[t[n]-1]++<<f,c=d|(1<<f)-1;d<=c;++d)o[bt[d]>>>l]=u}else for(o=new me(i),n=0;n<i;++n)t[n]&&(o[n]=bt[s[t[n]-1]++]>>>15-t[n]);return o},Be=new q(288);for(M=0;M<144;++M)Be[M]=8;var M;for(M=144;M<256;++M)Be[M]=9;var M;for(M=256;M<280;++M)Be[M]=7;var M;for(M=280;M<288;++M)Be[M]=8;var M,zr=new q(32);for(M=0;M<32;++M)zr[M]=5;var M,nn=Ae(Be,9,1),an=Ae(zr,5,1),wt=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},J=function(t,e,r){var i=e/8|0;return(t[i]|t[i+1]<<8)>>(e&7)&r},vt=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},sn=function(t){return(t+7)/8|0},on=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var i=new(t.BYTES_PER_ELEMENT==2?me:t.BYTES_PER_ELEMENT==4?yr:q)(r-e);return i.set(t.subarray(e,r)),i},ln=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],G=function(t,e,r){var i=new Error(e||ln[t]);if(i.code=t,Error.captureStackTrace&&Error.captureStackTrace(i,G),!r)throw i;return i},_t=function(t,e,r){var i=t.length;if(!i||r&&r.f&&!r.l)return e||new q(0);var n=!e||r,a=!r||r.i;r||(r={}),e||(e=new q(i*3));var s=function($t){var Ht=e.length;if($t>Ht){var Kt=new q(Math.max(Ht*2,$t));Kt.set(e),e=Kt}},o=r.f||0,l=r.p||0,u=r.b||0,f=r.l,d=r.d,c=r.m,x=r.n,w=i*8;do{if(!f){o=J(t,l,1);var z=J(t,l+1,3);if(l+=3,z)if(z==1)f=nn,d=an,c=9,x=5;else if(z==2){var b=J(t,l,31)+257,y=J(t,l+10,15)+4,g=b+J(t,l+5,31)+1;l+=14;for(var v=new q(g),_=new q(19),k=0;k<y;++k)_[en[k]]=J(t,l+k*3,7);l+=y*3;for(var S=wt(_),D=(1<<S)-1,T=Ae(_,S,1),k=0;k<g;){var E=T[J(t,l,D)];l+=E&15;var h=E>>>4;if(h<16)v[k++]=h;else{var W=0,$=0;for(h==16?($=3+J(t,l,3),l+=2,W=v[k-1]):h==17?($=3+J(t,l,7),l+=3):h==18&&($=11+J(t,l,127),l+=7);$--;)v[k++]=W}}var ie=v.subarray(0,b),V=v.subarray(b);c=wt(ie),x=wt(V),f=Ae(ie,c,1),d=Ae(V,x,1)}else G(1);else{var h=sn(l)+4,m=t[h-4]|t[h-3]<<8,p=h+m;if(p>i){a&&G(0);break}n&&s(u+m),e.set(t.subarray(h,p),u),r.b=u+=m,r.p=l=p*8,r.f=o;continue}if(l>w){a&&G(0);break}}n&&s(u+131072);for(var dt=(1<<c)-1,xe=(1<<x)-1,ne=l;;ne=l){var W=f[vt(t,l)&dt],R=W>>>4;if(l+=W&15,l>w){a&&G(0);break}if(W||G(2),R<256)e[u++]=R;else if(R==256){ne=l,f=null;break}else{var Zt=R-254;if(R>264){var k=R-257,Pe=xr[k];Zt=J(t,l,(1<<Pe)-1)+vr[k],l+=Pe}var ct=d[vt(t,l)&xe],mt=ct>>>4;ct||G(3),l+=ct&15;var V=rn[mt];if(mt>3){var Pe=gr[mt];V+=vt(t,l)&(1<<Pe)-1,l+=Pe}if(l>w){a&&G(0);break}n&&s(u+131072);for(var Wt=u+Zt;u<Wt;u+=4)e[u]=e[u-V],e[u+1]=e[u+1-V],e[u+2]=e[u+2-V],e[u+3]=e[u+3-V];u=Wt}}r.l=f,r.p=ne,r.b=u,r.f=o,f&&(o=1,r.m=c,r.d=d,r.n=x)}while(!o);return u==e.length?e:on(e,0,u)},un=new q(0),hn=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&G(6,"invalid gzip data");var e=t[3],r=10;e&4&&(r+=t[10]|(t[11]<<8)+2);for(var i=(e>>3&1)+(e>>4&1);i>0;i-=!t[r++]);return r+(e&2)},fn=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},dn=function(t){((t[0]&15)!=8||t[0]>>>4>7||(t[0]<<8|t[1])%31)&&G(6,"invalid zlib data"),t[1]&32&&G(6,"invalid zlib data: preset dictionaries not supported")};function cn(t,e){return _t(t,e)}function mn(t,e){return _t(t.subarray(hn(t),-8),e||new q(fn(t)))}function pn(t,e){return _t((dn(t),t.subarray(2,-4)),e)}function zt(t,e){return t[0]==31&&t[1]==139&&t[2]==8?mn(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?cn(t,e):pn(t,e)}var yn=typeof TextDecoder!="undefined"&&new TextDecoder,xn=0;try{yn.decode(un,{stream:!0}),xn=1}catch(t){}var kr=(t,e)=>t*Math.pow(2,e),Ee=(t,e)=>Math.floor(t/Math.pow(2,e)),tt=(t,e)=>kr(t.getUint16(e+1,!0),8)+t.getUint8(e),Lr=(t,e)=>kr(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),gn=(t,e,r,i,n)=>{if(t!=i.getUint8(n))return t-i.getUint8(n);let a=tt(i,n+1);if(e!=a)return e-a;let s=tt(i,n+4);return r!=s?r-s:0},bn=(t,e,r,i)=>{let n=Fr(t,e|128,r,i);return n?{z:e,x:r,y:i,offset:n[0],length:n[1],is_dir:!0}:null},Sr=(t,e,r,i)=>{let n=Fr(t,e,r,i);return n?{z:e,x:r,y:i,offset:n[0],length:n[1],is_dir:!1}:null},Fr=(t,e,r,i)=>{let n=0,a=t.byteLength/17-1;for(;n<=a;){let s=a+n>>1,o=gn(e,r,i,t,s*17);if(o>0)n=s+1;else if(o<0)a=s-1;else return[Lr(t,s*17+7),t.getUint32(s*17+13,!0)]}return null},wn=(t,e)=>t.is_dir&&!e.is_dir?1:!t.is_dir&&e.is_dir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,Mr=(t,e)=>{let r=t.getUint8(e*17);return{z:r&127,x:tt(t,e*17+1),y:tt(t,e*17+4),offset:Lr(t,e*17+7),length:t.getUint32(e*17+13,!0),is_dir:r>>7==1}},Cr=t=>{let e=[],r=new DataView(t);for(let i=0;i<r.byteLength/17;i++)e.push(Mr(r,i));return vn(e)},vn=t=>{t.sort(wn);let e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let i=0;i<t.length;i++){let n=t[i],a=n.z;n.is_dir&&(a=a|128),r[i*17]=a,r[i*17+1]=n.x&255,r[i*17+2]=n.x>>8&255,r[i*17+3]=n.x>>16&255,r[i*17+4]=n.y&255,r[i*17+5]=n.y>>8&255,r[i*17+6]=n.y>>16&255,r[i*17+7]=n.offset&255,r[i*17+8]=Ee(n.offset,8)&255,r[i*17+9]=Ee(n.offset,16)&255,r[i*17+10]=Ee(n.offset,24)&255,r[i*17+11]=Ee(n.offset,32)&255,r[i*17+12]=Ee(n.offset,48)&255,r[i*17+13]=n.length&255,r[i*17+14]=n.length>>8&255,r[i*17+15]=n.length>>16&255,r[i*17+16]=n.length>>24&255}return e},_n=(t,e)=>{if(t.byteLength<17)return null;let r=t.byteLength/17,i=Mr(t,r-1);if(i.is_dir){let n=i.z,a=e.z-n,s=Math.trunc(e.x/(1<<a)),o=Math.trunc(e.y/(1<<a));return{z:n,x:s,y:o}}return null};function zn(t){return Y(this,null,function*(){let e=yield t.getBytes(0,512e3),r=new DataView(e.data),i=r.getUint32(4,!0),n=r.getUint16(8,!0),a=new TextDecoder("utf-8"),s=JSON.parse(a.decode(new DataView(e.data,10,i))),o=0;s.compression==="gzip"&&(o=2);let l=0;"minzoom"in s&&(l=+s.minzoom);let u=0;"maxzoom"in s&&(u=+s.maxzoom);let f=0,d=0,c=0,x=-180,w=-85,z=180,h=85;if(s.bounds){let p=s.bounds.split(",");x=+p[0],w=+p[1],z=+p[2],h=+p[3]}if(s.center){let p=s.center.split(",");f=+p[0],d=+p[1],c=+p[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+i,rootDirectoryLength:n*17,jsonMetadataOffset:10,jsonMetadataLength:i,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:o,tileType:1,minZoom:l,maxZoom:u,minLon:x,minLat:w,maxLon:z,maxLat:h,centerZoom:c,centerLon:f,centerLat:d,etag:e.etag}})}function kn(t,e,r,i,n,a,s){return Y(this,null,function*(){let o=yield r.getArrayBuffer(e,t.rootDirectoryOffset,t.rootDirectoryLength,t);t.specVersion===1&&(o=Cr(o));let l=Sr(new DataView(o),i,n,a);if(l){let d=(yield e.getBytes(l.offset,l.length,s)).data,c=new DataView(d);return c.getUint8(0)==31&&c.getUint8(1)==139&&(d=zt(new Uint8Array(d))),{data:d}}let u=_n(new DataView(o),{z:i,x:n,y:a});if(u){let f=bn(new DataView(o),u.z,u.x,u.y);if(f){let d=yield r.getArrayBuffer(e,f.offset,f.length,t);t.specVersion===1&&(d=Cr(d));let c=Sr(new DataView(d),i,n,a);if(c){let w=(yield e.getBytes(c.offset,c.length,s)).data,z=new DataView(w);return z.getUint8(0)==31&&z.getUint8(1)==139&&(w=zt(new Uint8Array(w))),{data:w}}}}})}var Tr={getHeader:zn,getZxy:kn};function _e(t,e){return(e>>>0)*4294967296+(t>>>0)}function Ln(t,e){let r=e.buf,i,n;if(n=r[e.pos++],i=(n&112)>>4,n<128||(n=r[e.pos++],i|=(n&127)<<3,n<128)||(n=r[e.pos++],i|=(n&127)<<10,n<128)||(n=r[e.pos++],i|=(n&127)<<17,n<128)||(n=r[e.pos++],i|=(n&127)<<24,n<128)||(n=r[e.pos++],i|=(n&1)<<31,n<128))return _e(t,i);throw new Error("Expected varint not more than 10 bytes")}function Re(t){let e=t.buf,r,i;return i=e[t.pos++],r=i&127,i<128||(i=e[t.pos++],r|=(i&127)<<7,i<128)||(i=e[t.pos++],r|=(i&127)<<14,i<128)||(i=e[t.pos++],r|=(i&127)<<21,i<128)?r:(i=e[t.pos],r|=(i&15)<<28,Ln(r,t))}function Sn(t,e,r,i){if(i==0){r==1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let n=e[0];e[0]=e[1],e[1]=n}}function Fn(t,e,r){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>Math.pow(2,t)-1||r>Math.pow(2,t)-1)throw Error("tile x/y outside zoom level bounds");let i=0,n=0;for(;n<t;)i+=Math.pow(2,n)*Math.pow(2,n),n++;let a=Math.pow(2,t),s=0,o=0,l=0,u=[e,r],f=a/2;for(;f>0;)s=(u[0]&f)>0?1:0,o=(u[1]&f)>0?1:0,l+=f*f*(3*s^o),Sn(f,u,s,o),f=f/2;return i+l}function Pr(t,e){return Y(this,null,function*(){if(e===1||e===0)return t;if(e===2)return zt(new Uint8Array(t));throw Error("Compression method not supported")})}var Mn=127;function Cn(t,e){let r=0,i=t.length-1;for(;r<=i;){let n=i+r>>1,a=e-t[n].tileId;if(a>0)r=n+1;else if(a<0)i=n-1;else return t[n]}return i>=0&&(t[i].runLength===0||e-t[i].tileId<t[i].runLength)?t[i]:null}var Tn=class{constructor(t){this.url=t}getKey(){return this.url}getBytes(t,e,r){return Y(this,null,function*(){let i;r||(i=new AbortController,r=i.signal);let n=yield fetch(this.url,{signal:r,headers:{Range:"bytes="+t+"-"+(t+e-1)}});if(n.status===416&&t===0){let o=n.headers.get("Content-Range");if(!o||!o.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let l=+o.substr(8);n=yield fetch(this.url,{signal:r,headers:{Range:"bytes=0-"+(l-1)}})}if(n.status>=300)throw Error("Bad response code: "+n.status);let a=n.headers.get("Content-Length");if(n.status===200&&(!a||+a>e))throw i&&i.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield n.arrayBuffer(),etag:n.headers.get("ETag")||void 0,cacheControl:n.headers.get("Cache-Control")||void 0,expires:n.headers.get("Expires")||void 0}})}};function Q(t,e){let r=t.getUint32(e+4,!0),i=t.getUint32(e+0,!0);return r*Math.pow(2,32)+i}function Pn(t,e){let r=new DataView(t),i=r.getUint8(7);if(i>3)throw Error(`Archive is spec version ${i} but this library supports up to spec version 3`);return{specVersion:i,rootDirectoryOffset:Q(r,8),rootDirectoryLength:Q(r,16),jsonMetadataOffset:Q(r,24),jsonMetadataLength:Q(r,32),leafDirectoryOffset:Q(r,40),leafDirectoryLength:Q(r,48),tileDataOffset:Q(r,56),tileDataLength:Q(r,64),numAddressedTiles:Q(r,72),numTileEntries:Q(r,80),numTileContents:Q(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:e}}function Dr(t){let e={buf:new Uint8Array(t),pos:0},r=Re(e),i=[],n=0;for(let a=0;a<r;a++){let s=Re(e);i.push({tileId:n+s,offset:0,length:0,runLength:1}),n+=s}for(let a=0;a<r;a++)i[a].runLength=Re(e);for(let a=0;a<r;a++)i[a].length=Re(e);for(let a=0;a<r;a++){let s=Re(e);s===0&&a>0?i[a].offset=i[a-1].offset+i[a-1].length:i[a].offset=s-1}return i}function Dn(t){let e=new DataView(t);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var ze=class extends Error{};function An(t,e,r,i){return Y(this,null,function*(){let n=yield t.getBytes(0,16384);if(new DataView(n.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(Dn(n.data)<3)return[yield Tr.getHeader(t)];let s=n.data.slice(0,Mn),o=n.etag;i&&n.etag!=i&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+t.getKey()),o=void 0);let l=Pn(s,o);if(r){let u=n.data.slice(l.rootDirectoryOffset,l.rootDirectoryOffset+l.rootDirectoryLength),f=t.getKey()+"|"+(l.etag||"")+"|"+l.rootDirectoryOffset+"|"+l.rootDirectoryLength,d=Dr(yield e(u,l.internalCompression));return[l,[f,d.length,d]]}return[l,void 0]})}function Bn(t,e,r,i,n){return Y(this,null,function*(){let a=yield t.getBytes(r,i);if(n.etag&&n.etag!==a.etag)throw new ze(a.etag);let s=yield e(a.data,n.internalCompression),o=Dr(s);if(o.length===0)throw new Error("Empty directory is invalid");return o})}var En=class{constructor(t=100,e=!0,r=Pr){this.cache=new Map,this.maxCacheEntries=t,this.counter=1,this.prefetch=e,this.decompress=r}getHeader(t,e){return Y(this,null,function*(){let r=t.getKey();if(this.cache.has(r))return this.cache.get(r).lastUsed=this.counter++,yield this.cache.get(r).data;let i=new Promise((n,a)=>{An(t,this.decompress,this.prefetch,e).then(s=>{s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:Promise.resolve(s[1][2])}),n(s[0]),this.prune()}).catch(s=>{a(s)})});return this.cache.set(r,{lastUsed:this.counter++,data:i}),i})}getDirectory(t,e,r,i){return Y(this,null,function*(){let n=t.getKey()+"|"+(i.etag||"")+"|"+e+"|"+r;if(this.cache.has(n))return this.cache.get(n).lastUsed=this.counter++,yield this.cache.get(n).data;let a=new Promise((s,o)=>{Bn(t,this.decompress,e,r,i).then(l=>{s(l),this.prune()}).catch(l=>{o(l)})});return this.cache.set(n,{lastUsed:this.counter++,data:a}),a})}getArrayBuffer(t,e,r,i){return Y(this,null,function*(){let n=t.getKey()+"|"+(i.etag||"")+"|"+e+"|"+r;if(this.cache.has(n))return this.cache.get(n).lastUsed=this.counter++,yield this.cache.get(n).data;let a=new Promise((s,o)=>{t.getBytes(e,r).then(l=>{if(i.etag&&i.etag!==l.etag)throw new ze(l.etag);s(l.data),this.cache.has(n),this.prune()}).catch(l=>{o(l)})});return this.cache.set(n,{lastUsed:this.counter++,data:a}),a})}prune(){if(this.cache.size>=this.maxCacheEntries){let t=1/0,e;this.cache.forEach((r,i)=>{r.lastUsed<t&&(t=r.lastUsed,e=i)}),e&&this.cache.delete(e)}}invalidate(t,e){return Y(this,null,function*(){this.cache.delete(t.getKey()),yield this.getHeader(t,e)})}},rt=class{constructor(t,e,r){typeof t=="string"?this.source=new Tn(t):this.source=t,r?this.decompress=r:this.decompress=Pr,e?this.cache=e:this.cache=new En}getHeader(){return Y(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,r,i){return Y(this,null,function*(){let n=Fn(t,e,r),a=yield this.cache.getHeader(this.source);if(a.specVersion<3)return Tr.getZxy(a,this.source,this.cache,t,e,r,i);if(t<a.minZoom||t>a.maxZoom)return;let s=a.rootDirectoryOffset,o=a.rootDirectoryLength;for(let l=0;l<=3;l++){let u=yield this.cache.getDirectory(this.source,s,o,a),f=Cn(u,n);if(f)if(f.runLength>0){let d=yield this.source.getBytes(a.tileDataOffset+f.offset,f.length,i);if(a.etag&&a.etag!==d.etag)throw new ze(d.etag);return{data:yield this.decompress(d.data,a.tileCompression),cacheControl:d.cacheControl,expires:d.expires}}else s=a.leafDirectoryOffset+f.offset,o=f.length;else return}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,r,i){return Y(this,null,function*(){try{return yield this.getZxyAttempt(t,e,r,i)}catch(n){if(n instanceof ze)return this.cache.invalidate(this.source,n.message),yield this.getZxyAttempt(t,e,r,i);throw n}})}getMetadataAttempt(){return Y(this,null,function*(){let t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength);if(t.etag&&t.etag!==e.etag)throw new ze(e.etag);let r=yield this.decompress(e.data,t.internalCompression),i=new TextDecoder("utf-8");return JSON.parse(i.decode(r))})}getMetadata(){return Y(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof ze)return this.cache.invalidate(this.source,t.message),yield this.getMetadataAttempt();throw t}})}};var ee;(function(i){i[i.Point=1]="Point",i[i.Line=2]="Line",i[i.Polygon=3]="Polygon"})(ee||(ee={}));function oe(t){return t.x+":"+t.y+":"+t.z}var Rn=(t,e,r)=>{t.pos=e;for(var i=t.readVarint()+t.pos,n=1,a=0,s=0,o=0,l=1/0,u=-1/0,f=1/0,d=-1/0,c=[],x=[];t.pos<i;){if(a<=0){var w=t.readVarint();n=w&7,a=w>>3}if(a--,n===1||n===2)s+=t.readSVarint()*r,o+=t.readSVarint()*r,s<l&&(l=s),s>u&&(u=s),o<f&&(f=o),o>d&&(d=o),n===1&&(x.length>0&&c.push(x),x=[]),x.push(new ke.default(s,o));else if(n===7)x&&x.push(x[0].clone());else throw new Error("unknown command "+n)}return x&&c.push(x),{geom:c,bbox:{minX:l,minY:f,maxX:u,maxY:d}}};function Er(t,e){let r=new Ar.VectorTile(new Br.default(t)),i=new Map;for(let[n,a]of Object.entries(r.layers)){let s=[],o=a;for(let l=0;l<o.length;l++){let u=Rn(o.feature(l)._pbf,o.feature(l)._geometry,e/o.extent),f=0;for(let d of u.geom)f+=d.length;s.push({id:o.feature(l).id,geomType:o.feature(l).type,geom:u.geom,numVertices:f,bbox:u.bbox,props:o.feature(l).properties})}i.set(n,s)}return i}var Oe=class{constructor(e,r){typeof e=="string"?this.p=new rt(e):this.p=e,this.controllers=[],this.shouldCancelZooms=r}get(e,r){return O(this,null,function*(){this.shouldCancelZooms&&(this.controllers=this.controllers.filter(s=>s[0]!=e.z?(s[1].abort(),!1):!0));let i=new AbortController;this.controllers.push([e.z,i]);let n=i.signal,a=yield this.p.getZxy(e.z,e.x,e.y,n);return a?Er(a.data,r):new Map})}},it=class{constructor(e,r){this.url=e,this.controllers=[],this.shouldCancelZooms=r}get(e,r){return O(this,null,function*(){this.shouldCancelZooms&&(this.controllers=this.controllers.filter(s=>s[0]!=e.z?(s[1].abort(),!1):!0));let i=this.url.replace("{z}",e.z.toString()).replace("{x}",e.x.toString()).replace("{y}",e.y.toString()),n=new AbortController;this.controllers.push([e.z,n]);let a=n.signal;return new Promise((s,o)=>{fetch(i,{signal:a}).then(l=>l.arrayBuffer()).then(l=>{let u=Er(l,r);s(u)}).catch(l=>{o(l)})})})}},kt=6378137,Rr=85.0511287798,nt=kt*Math.PI,On=t=>{let e=Math.PI/180,r=Math.max(Math.min(Rr,t[0]),-Rr),i=Math.sin(r*e);return new ke.default(kt*t[1]*e,kt*Math.log((1+i)/(1-i))/2)};function Or(t){return t*t}function at(t,e){return Or(t.x-e.x)+Or(t.y-e.y)}function In(t,e,r){var i=at(e,r);if(i===0)return at(t,e);var n=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/i;return n=Math.max(0,Math.min(1,n)),at(t,new ke.default(e.x+n*(r.x-e.x),e.y+n*(r.y-e.y)))}function Lt(t,e){for(var r=!1,i=0,n=e.length-1;i<e.length;n=i++){var a=e[i].x,s=e[i].y,o=e[n].x,l=e[n].y,u=s>t.y!=l>t.y&&t.x<(o-a)*(t.y-s)/(l-s)+a;u&&(r=!r)}return r}function Ir(t){for(var e=0,r=0;r<t.length;r++){let i=(r+1)%t.length;e+=t[r].x*t[i].y,e-=t[i].x*t[r].y}return e<0}function Xr(t,e){var r=!1;for(let i of e)if(Ir(i))Lt(t,i)&&(r=!1);else{if(r)return!0;Lt(t,i)&&(r=!0)}return r}function Vr(t,e){let r=1/0;for(let i of e){let n=Math.sqrt(at(t,i[0]));n<r&&(r=n)}return r}function Yr(t,e){let r=1/0;for(let n of e)for(var i=0;i<n.length-1;i++){let a=Math.sqrt(In(t,n[i],n[i+1]));a<r&&(r=a)}return r}var st=class{constructor(e,r){this.source=e,this.cache=new Map,this.inflight=new Map,this.tileSize=r}queryFeatures(e,r,i,n){let a=On([r,e]);var s=new ke.default((a.x+nt)/(nt*2),1-(a.y+nt)/(nt*2));s.x>1&&(s.x=s.x-Math.floor(s.x));let o=s.mult(1<<i),l=Math.floor(o.x),u=Math.floor(o.y),f=oe({z:i,x:l,y:u}),d=[],c=this.cache.get(f);if(c){let x=new ke.default((o.x-l)*this.tileSize,(o.y-u)*this.tileSize);for(let[w,z]of c.data.entries())for(let h of z)h.geomType==1?Vr(x,h.geom)<n&&d.push({feature:h,layerName:w}):h.geomType==2?Yr(x,h.geom)<n&&d.push({feature:h,layerName:w}):Xr(x,h.geom)&&d.push({feature:h,layerName:w})}return d}get(e){return O(this,null,function*(){let r=oe(e);return new Promise((i,n)=>{let a=this.cache.get(r);if(a)a.used=performance.now(),i(a.data);else{let s=this.inflight.get(r);s?s.push([i,n]):(this.inflight.set(r,[]),this.source.get(e,this.tileSize).then(o=>{this.cache.set(r,{used:performance.now(),data:o});let l=this.inflight.get(r);if(l&&l.forEach(u=>u[0](o)),this.inflight.delete(r),i(o),this.cache.size>=64){let u=1/0,f;this.cache.forEach((d,c)=>{d.used<u&&(u=d.used,f=c)}),f&&this.cache.delete(f)}}).catch(o=>{let l=this.inflight.get(r);l&&l.forEach(u=>u[1](o)),this.inflight.delete(r),n(o)}))}})})}};var Ie=(t,e,r)=>{let i=[];for(let n of t){let a=[];for(let s of n)a.push(s.clone().mult(e).add(r));i.push(a)}return i},Xe=(t,e)=>{let r=1<<e;return t<0&&(t=r+t),t>=r&&(t=t%r),t},St=class{constructor(e,r,i){this.tileCache=e,this.maxDataLevel=r,this.levelDiff=i}dataTilesForBounds(e,r){let i=Math.pow(2,e)/Math.pow(2,Math.ceil(e)),n=[];var a=1,s=this.tileCache.tileSize;if(e<this.levelDiff)a=1/(1<<this.levelDiff-e)*i,n.push({data_tile:{z:0,x:0,y:0},origin:new pe.default(0,0),scale:a,dim:s*a});else if(e<=this.levelDiff+this.maxDataLevel){let u=1<<this.levelDiff,f=256*i,d=Math.ceil(e)-this.levelDiff,c=Math.floor(r.minX/u/f),x=Math.floor(r.minY/u/f),w=Math.floor(r.maxX/u/f),z=Math.floor(r.maxY/u/f);for(var o=c;o<=w;o++)for(var l=x;l<=z;l++){let h=new pe.default(o*u*f,l*u*f);n.push({data_tile:{z:d,x:Xe(o,d),y:Xe(l,d)},origin:h,scale:i,dim:s*i})}}else{let u=1<<this.levelDiff;a=(1<<Math.ceil(e)-this.maxDataLevel-this.levelDiff)*i;let f=Math.floor(r.minX/u/256/a),d=Math.floor(r.minY/u/256/a),c=Math.floor(r.maxX/u/256/a),x=Math.floor(r.maxY/u/256/a);for(var o=f;o<=c;o++)for(var l=d;l<=x;l++){let h=new pe.default(o*u*256*a,l*u*256*a);n.push({data_tile:{z:this.maxDataLevel,x:Xe(o,this.maxDataLevel),y:Xe(l,this.maxDataLevel)},origin:h,scale:a,dim:s*a})}}return n}dataTileForDisplayTile(e){var r,i=1,n=this.tileCache.tileSize,a;if(e.z<this.levelDiff)r={z:0,x:0,y:0},i=1/(1<<this.levelDiff-e.z),a=new pe.default(0,0),n=n*i;else if(e.z<=this.levelDiff+this.maxDataLevel){let s=1<<this.levelDiff;r={z:e.z-this.levelDiff,x:Math.floor(e.x/s),y:Math.floor(e.y/s)},a=new pe.default(r.x*s*256,r.y*s*256)}else{i=1<<e.z-this.maxDataLevel-this.levelDiff;let s=1<<this.levelDiff;r={z:this.maxDataLevel,x:Math.floor(e.x/s/i),y:Math.floor(e.y/s/i)},a=new pe.default(r.x*s*i*256,r.y*s*i*256),n=n*i}return{data_tile:r,scale:i,origin:a,dim:n}}getBbox(e,r){return O(this,null,function*(){let i=this.dataTilesForBounds(e,r);return(yield Promise.all(i.map(a=>this.tileCache.get(a.data_tile)))).map((a,s)=>{let o=i[s];return{data:a,z:e,data_tile:o.data_tile,scale:o.scale,dim:o.dim,origin:o.origin}})})}getDisplayTile(e){return O(this,null,function*(){let r=this.dataTileForDisplayTile(e);return{data:yield this.tileCache.get(r.data_tile),z:e.z,data_tile:r.data_tile,scale:r.scale,origin:r.origin,dim:r.dim}})}queryFeatures(e,r,i){let n=Math.round(i),a=Math.min(n-this.levelDiff,this.maxDataLevel),s=16/(1<<n-a);return this.tileCache.queryFeatures(e,r,a,s)}},Ve=t=>{let e=i=>{let n=i.levelDiff===void 0?2:i.levelDiff,a=i.maxDataZoom||14,s;typeof i.url=="string"?i.url.endsWith(".pmtiles")?s=new Oe(i.url,!0):s=new it(i.url,!0):s=new Oe(i.url,!0);let o=new st(s,256*1<<n);return new St(o,a,n)},r=new Map;if(t.sources)for(let i in t.sources)r.set(i,e(t.sources[i]));else r.set("",e(t));return r};var Ur=N(re());function Ye(t,e,r,i,n,a,s,o,l){let u=performance.now();t.save(),t.miterLimit=2;for(var f of n){if(f.minzoom&&e<f.minzoom||f.maxzoom&&e>f.maxzoom)continue;let w=r.get(f.dataSource||"");if(!!w)for(let z of w){var d=z.data.get(f.dataLayer);if(d===void 0)continue;f.symbolizer.before&&f.symbolizer.before(t,z.z);let h=z.origin,m=z.dim,p=z.scale;if(t.save(),o){t.beginPath();let b=Math.max(h.x-s.x,a.minX-s.x),y=Math.max(h.y-s.y,a.minY-s.y),g=Math.min(h.x-s.x+m,a.maxX-s.x),v=Math.min(h.y-s.y+m,a.maxY-s.y);t.rect(b,y,g-b,v-y),t.clip()}t.translate(h.x-s.x,h.y-s.y);for(var c of d){let b=c.geom,y=c.bbox;y.maxX*p+h.x<a.minX||y.minX*p+h.x>a.maxX||y.minY*p+h.y>a.maxY||y.maxY*p+h.y<a.minY||f.filter&&!f.filter(z.z,c)||(p!=1&&(b=Ie(b,p,new Ur.default(0,0))),f.symbolizer.draw(t,b,z.z,c))}t.restore()}}if(o&&(t.beginPath(),t.rect(a.minX-s.x,a.minY-s.y,a.maxX-a.minX,a.maxY-a.minY),t.clip()),i){let w=i.searchBbox(a,1/0);for(var x of w)if(t.save(),t.translate(x.anchor.x-s.x,x.anchor.y-s.y),x.draw(t),t.restore(),l){t.lineWidth=.5,t.strokeStyle=l,t.fillStyle=l,t.globalAlpha=1,t.fillRect(x.anchor.x-s.x-2,x.anchor.y-s.y-2,4,4);for(let z of x.bboxes)t.strokeRect(z.minX-s.x,z.minY-s.y,z.maxX-z.minX,z.maxY-z.minY)}}return t.restore(),performance.now()-u}var Nr=N(re()),qr=N(jr());var Zr=(t,e,r)=>{let i=256,n=e/i,a=Math.floor(r.minX/i),s=Math.floor(r.minY/i),o=Math.floor(r.maxX/i),l=Math.floor(r.maxY/i),u=Math.log2(n),f=[];for(let d=a;d<=o;d++){let c=d%(1<<t);for(let x=s;x<=l;x++)f.push({display:oe({z:t,x:c,y:x}),key:oe({z:t-u,x:Math.floor(c/n),y:Math.floor(x/n)})})}return f},Ct=class{constructor(e,r){this.tree=new qr.default,this.current=new Map,this.dim=e,this.maxLabeledTiles=r}hasPrefix(e){for(let r of this.current.keys())if(r.startsWith(e))return!0;return!1}has(e){return this.current.has(e)}size(){return this.current.size}keys(){return this.current.keys()}searchBbox(e,r){let i=new Set;for(let n of this.tree.search(e))n.indexed_label.order<=r&&i.add(n.indexed_label);return i}searchLabel(e,r){let i=new Set;for(let n of e.bboxes)for(let a of this.tree.search(n))a.indexed_label.order<=r&&i.add(a.indexed_label);return i}bboxCollides(e,r){for(let i of this.tree.search(e))if(i.indexed_label.order<=r)return!0;return!1}labelCollides(e,r){for(let i of e.bboxes)for(let n of this.tree.search(i))if(n.indexed_label.order<=r)return!0;return!1}deduplicationCollides(e){if(!e.deduplicationKey||!e.deduplicationDistance)return!1;let r=e.deduplicationDistance,i={minX:e.anchor.x-r,minY:e.anchor.y-r,maxX:e.anchor.x+r,maxY:e.anchor.y+r};for(let n of this.tree.search(i))if(n.indexed_label.deduplicationKey===e.deduplicationKey&&n.indexed_label.anchor.dist(e.anchor)<r)return!0;return!1}makeEntry(e){this.current.get(e)&&console.log("consistency error 1");let r=new Set;this.current.set(e,r)}insert(e,r,i){let n={anchor:e.anchor,bboxes:e.bboxes,draw:e.draw,order:r,tileKey:i,deduplicationKey:e.deduplicationKey,deduplicationDistance:e.deduplicationDistance},a=this.current.get(i);if(!a){let d=new Set;this.current.set(i,d),a=d}a.add(n);var s=!1,o=!1;for(let d of e.bboxes){var l=d;l.indexed_label=n,this.tree.insert(l),d.minX<0&&(s=!0),d.maxX>this.dim&&(o=!0)}if(s||o){var u=s?this.dim:-this.dim,f=[];for(let x of e.bboxes)f.push({minX:x.minX+u,minY:x.minY,maxX:x.maxX+u,maxY:x.maxY});let d={anchor:new Nr.default(e.anchor.x+u,e.anchor.y),bboxes:f,draw:e.draw,order:r,tileKey:i},c=this.current.get(i);c&&c.add(d);for(let x of f){var l=x;l.indexed_label=d,this.tree.insert(l)}}}pruneOrNoop(e){let r=e.split(":"),i,n=0,a=0;for(var s of this.current.keys()){let o=s.split(":");if(o[3]===r[3]){a++;let l=Math.sqrt(Math.pow(+o[0]-+r[0],2)+Math.pow(+o[1]-+r[1],2));l>n&&(n=l,i=s)}i&&a>this.maxLabeledTiles&&this.pruneKey(i)}}pruneKey(e){let r=this.current.get(e);if(!r)return;let i=[];for(let n of this.tree.all())r.has(n.indexed_label)&&i.push(n);i.forEach(n=>{this.tree.remove(n)}),this.current.delete(e)}removeLabel(e){let r=[];for(let n of this.tree.all())e==n.indexed_label&&r.push(n);r.forEach(n=>{this.tree.remove(n)});let i=this.current.get(e.tileKey);i&&i.delete(e)}},Ue=class{constructor(e,r,i,n,a){this.index=new Ct(256*1<<e,n),this.z=e,this.scratch=r,this.labelRules=i,this.callback=a}layout(e){let r=performance.now(),i=new Set;for(let[o,l]of e)for(let u of l){let f=oe(u.data_tile)+":"+o;this.index.has(f)||(this.index.makeEntry(f),i.add(f))}let n=new Set;for(let[o,l]of this.labelRules.entries()){if(l.visible==!1||l.minzoom&&this.z<l.minzoom||l.maxzoom&&this.z>l.maxzoom)continue;let u=l.dataSource||"",f=e.get(u);if(!!f)for(let d of f){let c=oe(d.data_tile)+":"+u;if(!i.has(c))continue;let x=d.data.get(l.dataLayer);if(x===void 0)continue;let w=x;l.sort&&w.sort((h,m)=>l.sort?l.sort(h.props,m.props):0);let z={index:this.index,zoom:this.z,scratch:this.scratch,order:o,overzoom:this.z-d.data_tile.z};for(let h of w){if(l.filter&&!l.filter(this.z,h))continue;let m=Ie(h.geom,d.scale,d.origin),p=l.symbolizer.place(z,m,h);if(!!p)for(let b of p){var a=!1;if(!(b.deduplicationKey&&this.index.deduplicationCollides(b))){if(this.index.labelCollides(b,1/0)){if(!this.index.labelCollides(b,o)){let y=this.index.searchLabel(b,1/0);for(let g of y){this.index.removeLabel(g);for(let v of g.bboxes)this.findInvalidatedTiles(n,d.dim,v,c)}this.index.insert(b,o,c),a=!0}}else this.index.insert(b,o,c),a=!0;if(a)for(let y of b.bboxes)(y.maxX>d.origin.x+d.dim||y.minX<d.origin.x||y.minY<d.origin.y||y.maxY>d.origin.y+d.dim)&&this.findInvalidatedTiles(n,d.dim,y,c)}}}}}for(var s of i)this.index.pruneOrNoop(s);return n.size>0&&this.callback&&this.callback(n),performance.now()-r}findInvalidatedTiles(e,r,i,n){let a=Zr(this.z,r,i);for(let s of a)s.key!=n&&this.index.hasPrefix(s.key)&&e.add(s.display)}add(e){var r=!0;for(let[i,n]of e)for(let a of n)this.index.has(oe(a.data_tile)+":"+i)||(r=!1);return r?0:this.layout(e)}},je=class{constructor(e,r,i,n){this.labelers=new Map,this.scratch=e,this.labelRules=r,this.maxLabeledTiles=i,this.callback=n}add(e,r){var i=this.labelers.get(e);return i||(i=new Ue(e,this.scratch,this.labelRules,this.maxLabeledTiles,this.callback),this.labelers.set(e,i)),i.add(r)}getIndex(e){let r=this.labelers.get(e);if(r)return r.index}};var Le={earth:"#FFFBF6",glacier:"#ffffff",residential:"#F4F4F8",hospital:"#FFF6F6",cemetery:"#EFF2EE",school:"#F7F6FF",industrial:"#FFF9EF",wood:"#F4F9EF",grass:"#EBF9E3",park:"#E5F9D5",water:"#B7DFF2",sand:"#ebebeb",buildings:"#F2EDE8",highwayCasing:"#FFC3C3",majorRoadCasing:"#FFB9B9",mediumRoadCasing:"#FFCE8E",minorRoadCasing:"#cccccc",highway:"#FFCEBB",majorRoad:"#FFE4B3",mediumRoad:"#FFF2C8",minorRoad:"#ffffff",boundaries:"#9e9e9e",mask:"#dddddd",countryLabel:"#aaaaaa",cityLabel:"#6C6C6C",stateLabel:"#999999",neighbourhoodLabel:"#888888",landuseLabel:"#898989",waterLabel:"#41ABDC",naturalLabel:"#4B8F14",roadsLabel:"#888888",poisLabel:"#606060"};var Se={earth:"#151515",glacier:"#1c1c1c",residential:"#252B2F",hospital:"#3E2C2C",cemetery:"#36483D",school:"#2C3440",industrial:"#33312C",wood:"#3A3E38",grass:"#4E604D",park:"#2C4034",water:"#4D5B73",sand:"#777777",buildings:"#464545",highwayCasing:"#000000",majorRoadCasing:"#1C1B1B",mediumRoadCasing:"#3E3E3E",minorRoadCasing:"#000000",highway:"#5B5B5B",majorRoad:"#595959",mediumRoad:"#4F4F4F",minorRoad:"#393939",boundaries:"#666666",mask:"#dddddd",countryLabel:"#ffffff",cityLabel:"#FFFFFF",stateLabel:"#ffffff",neighbourhoodLabel:"#FDFDFD",landuseLabel:"#DDDDDD",waterLabel:"#707E95",naturalLabel:"#4c4c4c",roadsLabel:"#C4C4C4",poisLabel:"#959393"};function Ne(t,e,r){return Math.min(Math.max(t,r),e)}var Fe=class extends Error{constructor(e){super(`Failed to parse color: "${e}"`)}};function Xn(t){if(typeof t!="string")throw new Fe(t);if(t.trim().toLowerCase()==="transparent")return[0,0,0,0];let e=t.trim();e=qn.test(t)?function(s){let o=s.toLowerCase().trim(),l=Vn[function(u){let f=5381,d=u.length;for(;d;)f=33*f^u.charCodeAt(--d);return(f>>>0)%2341}(o)];if(!l)throw new Fe(s);return`#${l}`}(t):t;let r=Yn.exec(e);if(r){let s=Array.from(r).slice(1);return[...s.slice(0,3).map(o=>parseInt(qe(o,2),16)),parseInt(qe(s[3]||"f",2),16)/255]}let i=Un.exec(e);if(i){let s=Array.from(i).slice(1);return[...s.slice(0,3).map(o=>parseInt(o,16)),parseInt(s[3]||"ff",16)/255]}let n=jn.exec(e);if(n){let s=Array.from(n).slice(1);return[...s.slice(0,3).map(o=>parseInt(o,10)),parseFloat(s[3]||"1")]}let a=Nn.exec(e);if(a){let[s,o,l,u]=Array.from(a).slice(1).map(parseFloat);if(Ne(0,100,o)!==o)throw new Fe(t);if(Ne(0,100,l)!==l)throw new Fe(t);return[...Zn(s,o,l),u||1]}throw new Fe(t)}var Wr=t=>parseInt(t.replace(/_/g,""),36),Vn="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((t,e)=>{let r=Wr(e.substring(0,3)),i=Wr(e.substring(3)).toString(16),n="";for(let a=0;a<6-i.length;a++)n+="0";return t[r]=`${n}${i}`,t},{}),qe=(t,e)=>Array.from(Array(e)).map(()=>t).join(""),Yn=new RegExp(`^#${qe("([a-f0-9])",3)}([a-f0-9])?$`,"i"),Un=new RegExp(`^#${qe("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),jn=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${qe(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),Nn=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,qn=/^[a-z]+$/i,$r=t=>Math.round(255*t),Zn=(t,e,r)=>{let i=r/100;if(e===0)return[i,i,i].map($r);let n=(t%360+360)%360/60,a=(1-Math.abs(2*i-1))*(e/100),s=a*(1-Math.abs(n%2-1)),o=0,l=0,u=0;n>=0&&n<1?(o=a,l=s):n>=1&&n<2?(o=s,l=a):n>=2&&n<3?(l=a,u=s):n>=3&&n<4?(l=s,u=a):n>=4&&n<5?(o=s,u=a):n>=5&&n<6&&(o=a,u=s);let f=i-a/2;return[o+f,l+f,u+f].map($r)};function Tt(t){let[e,r,i,n]=Xn(t).map((u,f)=>f===3?u:u/255),a=Math.max(e,r,i),s=Math.min(e,r,i),o=(a+s)/2;if(a===s)return[0,0,o,n];let l=a-s;return[60*(e===a?(r-i)/l+(r<i?6:0):r===a?(i-e)/l+2:(e-r)/l+4),o>.5?l/(2-a-s):l/(a+s),o,n]}function Hr(t,e,r,i){return`hsla(${(t%360).toFixed()}, ${Ne(0,100,100*e).toFixed()}%, ${Ne(0,100,100*r).toFixed()}%, ${parseFloat(Ne(0,1,i).toFixed(3))})`}var Z=N(re()),ri=N(Kr()),ii=N(Qr());var I=class{constructor(e,r){this.str=e!=null?e:r,this.per_feature=typeof this.str=="function"&&this.str.length==2}get(e,r){return typeof this.str=="function"?this.str(e,r):this.str}},B=class{constructor(e,r=1){this.value=e!=null?e:r,this.per_feature=typeof this.value=="function"&&this.value.length==2}get(e,r){return typeof this.value=="function"?this.value(e,r):this.value}},Ze=class{constructor(e){var r;this.label_props=(r=e==null?void 0:e.label_props)!=null?r:["name"],this.textTransform=e==null?void 0:e.textTransform}get(e,r){let i,n;typeof this.label_props=="function"?n=this.label_props(e,r):n=this.label_props;for(let s of n)if(r.props.hasOwnProperty(s)&&typeof r.props[s]=="string"){i=r.props[s];break}let a;return typeof this.textTransform=="function"?a=this.textTransform(e,r):a=this.textTransform,i&&a==="uppercase"?i=i.toUpperCase():i&&a==="lowercase"?i=i.toLowerCase():i&&a==="capitalize"&&(i=i.toLowerCase().split(" ").map(l=>l[0].toUpperCase()+l.slice(1)).join(" ")),i}},We=class{constructor(e){var r,i;(e==null?void 0:e.font)?this.font=e.font:(this.family=(r=e==null?void 0:e.fontFamily)!=null?r:"sans-serif",this.size=(i=e==null?void 0:e.fontSize)!=null?i:12,this.weight=e==null?void 0:e.fontWeight,this.style=e==null?void 0:e.fontStyle)}get(e,r){if(this.font)return typeof this.font=="function"?this.font(e,r):this.font;var i="";this.style&&(typeof this.style=="function"?i=this.style(e,r)+" ":i=this.style+" ");var n="";this.weight&&(typeof this.weight=="function"?n=this.weight(e,r)+" ":n=this.weight+" ");var a;typeof this.size=="function"?a=this.size(e,r):a=this.size;var s;return typeof this.family=="function"?s=this.family(e,r):s=this.family,`${i}${n}${a}px ${s}`}},Bt=class{constructor(e,r=[]){this.value=e!=null?e:r,this.per_feature=typeof this.value=="function"&&this.value.length==2}get(e,r){return typeof this.value=="function"?this.value(e,r):this.value}};var Et=N(re()),Jn=(t,e,r)=>{var i=[],n,a,s,o=0,l=0,u=0,f=0,d=0,c=0,x=0,w=0,z=0,h=0,m=0,p=0;if(t.length<2)return[];if(t.length===2)return u=Math.sqrt(Math.pow(t[1].x-t[0].x,2)+Math.pow(t[1].y-t[0].y,2)),[{length:u,beginIndex:0,beginDistance:0,endIndex:2,endDistance:u}];for(f=Math.sqrt(Math.pow(t[1].x-t[0].x,2)+Math.pow(t[1].y-t[0].y,2)),o=1,l=t.length-1;o<l;o++)n=t[o-1],a=t[o],s=t[o+1],c=a.x-n.x,x=a.y-n.y,w=s.x-a.x,z=s.y-a.y,d=Math.sqrt(w*w+z*z),u+=f,h=Math.acos((c*w+x*z)/(f*d)),(h>e||u-p>r)&&(i.push({length:u-p,beginDistance:p,beginIndex:m,endIndex:o+1,endDistance:u}),m=o,p=u),f=d;return o-m>0&&i.push({length:u-p+d,beginIndex:m,beginDistance:p,endIndex:o+1,endDistance:u+d}),i};function ei(t,e,r,i){let n,a,s=0,o=[];var l=-1/0;for(let f of t){let d=Jn(f,Math.PI/45,e);for(let c of d)if(c.length>=e+i){let x=new Et.default(f[c.beginIndex].x,f[c.beginIndex].y),w=f[c.endIndex-1],z=new Et.default((w.x-x.x)/c.length,(w.y-x.y)/c.length);for(var u=i;u<c.length-e;u+=r)o.push({start:x.add(z.mult(u)),end:x.add(z.mult(u+e))})}}return o}function ti(t,e,r,i){let n=e.x-t.x,a=e.y-t.y,s=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),o=[];for(var l=0;l<r+i;l+=2*i){let u=l*1/s;o.push({x:t.x+u*n,y:t.y+u*a})}return o}function Rt(t,e){if(t.length<=e)return[t];let r=e-1,i=t.lastIndexOf(" ",r),n=t.indexOf(" ",r);if(i==-1&&n==-1)return[t];let a,s;return n==-1||i>=0&&r-i<n-r?(a=t.substring(0,i),s=t.substring(i+1,t.length)):(a=t.substring(0,n),s=t.substring(n+1,t.length)),[a,...Rt(s,e)]}var Gn="\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DB5\u4E00-\u9FEA\uF900-\uFA6D\uFA70-\uFAD9\u2000",qa=new RegExp("^["+Gn+"]+$");var ni=5400,X;(function(i){i[i.Left=1]="Left",i[i.Center=2]="Center",i[i.Right=3]="Right"})(X||(X={}));var P;(function(l){l[l.N=1]="N",l[l.NE=2]="NE",l[l.E=3]="E",l[l.SE=4]="SE",l[l.S=5]="S",l[l.SW=6]="SW",l[l.W=7]="W",l[l.NW=8]="NW"})(P||(P={}));var Ot=(t,e,r)=>{let i=document.createElement("canvas"),n=i.getContext("2d");return i.width=t,i.height=e,n!==null&&r(i,n),i},A=class{constructor(e){var r;this.pattern=e.pattern,this.fill=new I(e.fill,"black"),this.opacity=new B(e.opacity,1),this.stroke=new I(e.stroke,"black"),this.width=new B(e.width,0),this.per_feature=(r=this.fill.per_feature||this.opacity.per_feature||this.stroke.per_feature||this.width.per_feature||e.per_feature)!=null?r:!1,this.do_stroke=!1}before(e,r){if(!this.per_feature){e.globalAlpha=this.opacity.get(r),e.fillStyle=this.fill.get(r),e.strokeStyle=this.stroke.get(r);let i=this.width.get(r);i>0&&(this.do_stroke=!0),e.lineWidth=i}if(this.pattern){let i=e.createPattern(this.pattern,"repeat");i&&(e.fillStyle=i)}}draw(e,r,i,n){var a=!1;if(this.per_feature){e.globalAlpha=this.opacity.get(i,n),e.fillStyle=this.fill.get(i,n);var s=this.width.get(i,n);s&&(a=!0,e.strokeStyle=this.stroke.get(i,n),e.lineWidth=s)}let o=()=>{e.fill(),(a||this.do_stroke)&&e.stroke()};var l=0;e.beginPath();for(var u of r){l+u.length>ni&&(o(),l=0,e.beginPath());for(var f=0;f<u.length;f++){let d=u[f];f==0?e.moveTo(d.x,d.y):e.lineTo(d.x,d.y)}l+=u.length}l>0&&o()}};function de(t,e){return r=>{let i=r-t;return i>=0&&i<e.length?e[i]:0}}function ai(t,e){let r=0;for(;e[r+1][0]<t;)r++;return r}function si(t,e,r){return t*(r-e)+e}function oi(t,e,r,i){let n=i[e+1][0]-i[e][0],a=t-i[e][0];return n===0?0:r===1?a/n:(Math.pow(r,a)-1)/(Math.pow(r,n)-1)}function j(t,e){return r=>{if(e.length<1)return 0;if(r<=e[0][0])return e[0][1];if(r>=e[e.length-1][0])return e[e.length-1][1];let i=ai(r,e),n=oi(r,i,t,e);return si(n,e[i][1],e[i+1][1])}}function Qn(t,e){return r=>{if(e.length<1)return 0;let i=t;for(let n=0;n<e.length;n++)r>=e[n][0]&&(i=e[n][1]);return i}}function ea(t){return j(1,t)}function ta(t,e,r,i,n){return a=>{if(n.length<1)return 0;let s=new ri.default(t,e,r,i),o=ai(a,n),l=s.solve(oi(a,o,1,n));return si(l,n[o][1],n[o+1][1])}}var C=class{constructor(e){var r;this.color=new I(e.color,"black"),this.width=new B(e.width),this.opacity=new B(e.opacity),this.dash=e.dash?new Bt(e.dash):null,this.dashColor=new I(e.dashColor,"black"),this.dashWidth=new B(e.dashWidth,1),this.lineCap=new I(e.lineCap,"butt"),this.lineJoin=new I(e.lineJoin,"miter"),this.skip=!1,this.per_feature=!!(((r=this.dash)==null?void 0:r.per_feature)||this.color.per_feature||this.opacity.per_feature||this.width.per_feature||this.lineCap.per_feature||this.lineJoin.per_feature||e.per_feature)}before(e,r){this.per_feature||(e.strokeStyle=this.color.get(r),e.lineWidth=this.width.get(r),e.globalAlpha=this.opacity.get(r),e.lineCap=this.lineCap.get(r),e.lineJoin=this.lineJoin.get(r))}draw(e,r,i,n){if(this.skip)return;let a=()=>{this.per_feature&&(e.globalAlpha=this.opacity.get(i,n),e.lineCap=this.lineCap.get(i,n),e.lineJoin=this.lineJoin.get(i,n)),this.dash?(e.save(),this.per_feature?(e.lineWidth=this.dashWidth.get(i,n),e.strokeStyle=this.dashColor.get(i,n),e.setLineDash(this.dash.get(i,n))):e.setLineDash(this.dash.get(i)),e.stroke(),e.restore()):(e.save(),this.per_feature&&(e.lineWidth=this.width.get(i,n),e.strokeStyle=this.color.get(i,n)),e.stroke(),e.restore())};var s=0;e.beginPath();for(var o of r){s+o.length>ni&&(a(),s=0,e.beginPath());for(var l=0;l<o.length;l++){let u=o[l];l==0?e.moveTo(u.x,u.y):e.lineTo(u.x,u.y)}s+=o.length}s>0&&a()}},li=class{constructor(e){this.name=e.name,this.sheet=e.sheet,this.dpr=window.devicePixelRatio}place(e,r,i){let n=r[0],a=new Z.default(r[0][0].x,r[0][0].y),s=this.sheet.get(this.name),o=s.w/this.dpr,l=s.h/this.dpr,u={minX:a.x-o/2,minY:a.y-l/2,maxX:a.x+o/2,maxY:a.y+l/2};return[{anchor:a,bboxes:[u],draw:d=>{d.globalAlpha=1,d.drawImage(this.sheet.canvas,s.x,s.y,s.w,s.h,-s.w/2/this.dpr,-s.h/2/this.dpr,s.w/2,s.h/2)}}]}},te=class{constructor(e){this.radius=new B(e.radius,3),this.fill=new I(e.fill,"black"),this.stroke=new I(e.stroke,"white"),this.width=new B(e.width,0),this.opacity=new B(e.opacity)}draw(e,r,i,n){e.globalAlpha=this.opacity.get(i,n);let a=this.radius.get(i,n),s=this.width.get(i,n);s>0&&(e.strokeStyle=this.stroke.get(i,n),e.lineWidth=s,e.beginPath(),e.arc(r[0][0].x,r[0][0].y,a+s/2,0,2*Math.PI),e.stroke()),e.fillStyle=this.fill.get(i,n),e.beginPath(),e.arc(r[0][0].x,r[0][0].y,a,0,2*Math.PI),e.fill()}place(e,r,i){let n=r[0],a=new Z.default(r[0][0].x,r[0][0].y),s=this.radius.get(e.zoom,i),o={minX:a.x-s,minY:a.y-s,maxX:a.x+s,maxY:a.y+s};return[{anchor:a,bboxes:[o],draw:u=>{this.draw(u,[[new Z.default(0,0)]],e.zoom,i)}}]}},lt=class{constructor(e){this.font=new We(e),this.text=new Ze(e),this.fill=new I(e.fill,"black"),this.background=new I(e.background,"white"),this.padding=new B(e.padding,0)}place(e,r,i){let n=this.text.get(e.zoom,i);if(!n)return;let a=this.font.get(e.zoom,i);e.scratch.font=a;let s=e.scratch.measureText(n),o=s.width,l=s.actualBoundingBoxAscent,u=s.actualBoundingBoxDescent,f=r[0],d=new Z.default(r[0][0].x,r[0][0].y),c=this.padding.get(e.zoom,i),x={minX:d.x-o/2-c,minY:d.y-l-c,maxX:d.x+o/2+c,maxY:d.y+u+c};return[{anchor:d,bboxes:[x],draw:z=>{z.globalAlpha=1,z.fillStyle=this.background.get(e.zoom,i),z.fillRect(-o/2-c,-l-c,o+2*c,l+u+2*c),z.fillStyle=this.fill.get(e.zoom,i),z.font=a,z.fillText(n,-o/2,0)}}]}},$e=class{constructor(e){this.list=e}place(e,r,i){var n=this.list[0].place(e,r,i);if(!n)return;var a=n[0];let s=a.anchor,o=a.bboxes[0],l=o.maxY-o.minY,u=[{draw:a.draw,translate:{x:0,y:0}}],f=[[new Z.default(r[0][0].x,r[0][0].y+l)]];for(let c=1;c<this.list.length;c++)n=this.list[c].place(e,f,i),n&&(a=n[0],o=ui(o,a.bboxes[0]),u.push({draw:a.draw,translate:{x:0,y:l}}));return[{anchor:s,bboxes:[o],draw:c=>{for(let x of u)c.save(),c.translate(x.translate.x,x.translate.y),x.draw(c),c.restore()}}]}},ui=(t,e)=>({minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}),ye=class{constructor(e){this.list=e}place(e,r,i){let n=this.list[0];if(!n)return;var a=n.place(e,r,i);if(!a)return;var s=a[0];let o=s.anchor,l=s.bboxes[0],u=[s.draw];for(let d=1;d<this.list.length;d++){if(a=this.list[d].place(e,r,i),!a)return;s=a[0],l=ui(l,s.bboxes[0]),u.push(s.draw)}return[{anchor:o,bboxes:[l],draw:d=>{u.forEach(c=>c(d))}}]}},It=class{constructor(e){this.symbolizer=e}place(e,r,i){let n=r[0][0],a=this.symbolizer.place(e,[[new Z.default(0,0)]],i);if(!a||a.length==0)return;let s=a[0],o=s.bboxes[0],l=o.maxX-o.minX,u=o.maxY-o.minY,f={minX:n.x-l/2,maxX:n.x+l/2,minY:n.y-u/2,maxY:n.y+u/2};return[{anchor:n,bboxes:[f],draw:c=>{c.translate(-l/2,u/2-o.maxY),s.draw(c,{justify:2})}}]}},hi=class{constructor(e,r){this.padding=new B(e,0),this.symbolizer=r}place(e,r,i){let n=this.symbolizer.place(e,r,i);if(!n||n.length==0)return;let a=this.padding.get(e.zoom,i);for(var s of n)for(var o of s.bboxes)o.minX-=a,o.minY-=a,o.maxX+=a,o.maxY+=a;return n}},He=class{constructor(e){this.font=new We(e),this.text=new Ze(e),this.fill=new I(e.fill,"black"),this.stroke=new I(e.stroke,"black"),this.width=new B(e.width,0),this.lineHeight=new B(e.lineHeight,1),this.letterSpacing=new B(e.letterSpacing,0),this.maxLineCodeUnits=new B(e.maxLineChars,15),this.justify=e.justify}place(e,r,i){let n=this.text.get(e.zoom,i);if(!n)return;let a=this.font.get(e.zoom,i);e.scratch.font=a;let s=this.letterSpacing.get(e.zoom,i),o=Rt(n,this.maxLineCodeUnits.get(e.zoom,i));var l="",u=0;for(let p of o)p.length>u&&(u=p.length,l=p);let f=e.scratch.measureText(l),d=f.width+s*(u-1),c=f.actualBoundingBoxAscent,x=f.actualBoundingBoxDescent,w=(c+x)*this.lineHeight.get(e.zoom,i),z=new Z.default(r[0][0].x,r[0][0].y),h={minX:z.x,minY:z.y-c,maxX:z.x+d,maxY:z.y+x+(o.length-1)*w};return[{anchor:z,bboxes:[h],draw:(p,b)=>{p.globalAlpha=1,p.font=a,p.fillStyle=this.fill.get(e.zoom,i);let y=this.width.get(e.zoom,i);var g=0;for(let S of o){var v=0;if(this.justify==2||b&&b.justify==2?v=(d-p.measureText(S).width)/2:(this.justify==3||b&&b.justify==3)&&(v=d-p.measureText(S).width),y)if(p.lineWidth=y*2,p.strokeStyle=this.stroke.get(e.zoom,i),s>0){var _=v;for(var k of S)p.strokeText(k,_,g),_+=p.measureText(k).width+s}else p.strokeText(S,v,g);if(s>0){var _=v;for(var k of S)p.fillText(k,_,g),_+=p.measureText(k).width+s}else p.fillText(S,v,g);g+=w}}}]}},U=class{constructor(e){this.centered=new It(new He(e))}place(e,r,i){return this.centered.place(e,r,i)}},Xt=class{constructor(e,r){var i,n,a;this.symbolizer=e,this.offsetX=new B(r.offsetX,0),this.offsetY=new B(r.offsetY,0),this.justify=(i=r.justify)!=null?i:void 0,this.placements=(n=r.placements)!=null?n:[2,6,8,4,1,3,5,7],this.ddValues=(a=r.ddValues)!=null?a:()=>({})}place(e,r,i){if(i.geomType!==ee.Point)return;let n=r[0][0],a=this.symbolizer.place(e,[[new Z.default(0,0)]],i);if(!a||a.length==0)return;let s=a[0],o=s.bboxes[0],l=this.offsetX,u=this.offsetY,f=this.justify,d=this.placements,{offsetX:c,offsetY:x,justify:w,placements:z}=this.ddValues(e.zoom,i)||{};c&&(l=new B(c,0)),x&&(u=new B(x,0)),w&&(f=w),z&&(d=z);let h=l.get(e.zoom,i),m=u.get(e.zoom,i),p=(_,k)=>({minX:_.x+k.x+o.minX,minY:_.y+k.y+o.minY,maxX:_.x+k.x+o.maxX,maxY:_.y+k.y+o.maxY});var b=new Z.default(h,m),y;let g=_=>{_.translate(b.x,b.y),s.draw(_,{justify:y})},v=(_,k)=>{let S=p(_,k);if(!e.index.bboxCollides(S,e.order))return[{anchor:n,bboxes:[S],draw:g}]};for(let _ of d){let k=this.computeXAxisOffset(h,o,_),S=this.computeYAxisOffset(m,o,_);return y=this.computeJustify(f,_),b=new Z.default(k,S),v(n,b)}}computeXAxisOffset(e,r,i){let n=r.maxX,a=n/2;return[1,5].includes(i)?e-a:[8,7,6].includes(i)?e-n:e}computeYAxisOffset(e,r,i){let n=Math.abs(r.minY),a=r.maxY,s=(r.minY+r.maxY)/2;return[3,7].includes(i)?e-s:[8,2,1].includes(i)?e-a:[6,4,5].includes(i)?e+n:e}computeJustify(e,r){return e||([1,5].includes(r)?2:[2,3,4].includes(r)?1:3)}},le=class{constructor(e){this.symbolizer=new Xt(new He(e),e)}place(e,r,i){return this.symbolizer.place(e,r,i)}},Me;(function(i){i[i.Above=1]="Above",i[i.Center=2]="Center",i[i.Below=3]="Below"})(Me||(Me={}));var ce=class{constructor(e){var r;this.font=new We(e),this.text=new Ze(e),this.fill=new I(e.fill,"black"),this.stroke=new I(e.stroke,"black"),this.width=new B(e.width,0),this.offset=new B(e.offset,0),this.position=(r=e.position)!=null?r:1,this.maxLabelCodeUnits=new B(e.maxLabelChars,40),this.repeatDistance=new B(e.repeatDistance,250)}place(e,r,i){let n=this.text.get(e.zoom,i);if(!n||n.length>this.maxLabelCodeUnits.get(e.zoom,i))return;let a=20,s=i.bbox;if(s.maxY-s.minY<a&&s.maxX-s.minX<a)return;let o=this.font.get(e.zoom,i);e.scratch.font=o;let l=e.scratch.measureText(n),u=l.width,f=l.actualBoundingBoxAscent+l.actualBoundingBoxDescent;var d=this.repeatDistance.get(e.zoom,i);e.overzoom>4&&(d*=1<<e.overzoom-4);let c=f*2,x=ei(r,u,d,c);if(x.length==0)return;let w=[];for(let z of x){let h=z.end.x-z.start.x,m=z.end.y-z.start.y,b=ti(z.start,z.end,u,c/2).map(g=>({minX:g.x-c/2,minY:g.y-c/2,maxX:g.x+c/2,maxY:g.y+c/2})),y=g=>{g.globalAlpha=1,g.rotate(Math.atan2(m,h)),h<0&&(g.scale(-1,-1),g.translate(-u,0));let v=0;this.position===3?v+=f:this.position===2&&(v+=f/2),g.translate(0,v-this.offset.get(e.zoom,i)),g.font=o;let _=this.width.get(e.zoom,i);_&&(g.lineWidth=_,g.strokeStyle=this.stroke.get(e.zoom,i),g.strokeText(n,0,0)),g.fillStyle=this.fill.get(e.zoom,i),g.fillText(n,0,0)};w.push({anchor:z.start,bboxes:b,draw:y,deduplicationKey:n,deduplicationDistance:d})}return w}},ue=class{constructor(e){this.symbolizer=new He(e)}place(e,r,i){let n=i.bbox;if((n.maxY-n.minY)*(n.maxX-n.minX)<2e4)return;let s=this.symbolizer.place(e,[[new Z.default(0,0)]],i);if(!s||s.length==0)return;let o=s[0],l=o.bboxes[0],u=r[0],f=(0,ii.default)([u.map(w=>[w.x,w.y])]),d=new Z.default(f[0],f[1]),c={minX:d.x-(l.maxX-l.minX)/2,minY:d.y-(l.maxY-l.minY)/2,maxX:d.x+(l.maxX-l.minX)/2,maxY:d.y+(l.maxY-l.minY)/2};return[{anchor:d,bboxes:[c],draw:w=>{w.translate(o.anchor.x-(l.maxX-l.minX)/2,o.anchor.y),o.draw(w)}}]}};var fi=(t,e)=>{let r=Tt(e),i=er({},t);for(let[n,a]of Object.entries(t)){let s=Tt(a);i[n]=Hr(r[0],r[1],s[2],s[3])}return i},Ce=(t,e)=>(e&&(t=fi(t,e)),[{dataLayer:"earth",symbolizer:new A({fill:t.earth})},{dataLayer:"natural",symbolizer:new A({fill:t.glacier}),filter:(r,i)=>i.props.natural=="glacier"},{dataLayer:"landuse",symbolizer:new A({fill:t.residential}),filter:(r,i)=>i.props.landuse=="residential"||i.props.place=="neighbourhood"},{dataLayer:"landuse",symbolizer:new A({fill:t.hospital}),filter:(r,i)=>i.props.amenity=="hospital"},{dataLayer:"landuse",symbolizer:new A({fill:t.cemetery}),filter:(r,i)=>i.props.landuse=="cemetery"},{dataLayer:"landuse",symbolizer:new A({fill:t.school}),filter:(r,i)=>i.props.amenity=="school"||i.props.amenity=="kindergarten"||i.props.amenity=="university"||i.props.amenity=="college"},{dataLayer:"landuse",symbolizer:new A({fill:t.industrial}),filter:(r,i)=>i.props.landuse=="industrial"},{dataLayer:"natural",symbolizer:new A({fill:t.wood}),filter:(r,i)=>i.props.natural=="wood"},{dataLayer:"landuse",symbolizer:new A({fill:t.grass}),filter:(r,i)=>i.props.landuse=="grass"},{dataLayer:"landuse",symbolizer:new A({fill:t.park}),filter:(r,i)=>i.props.leisure=="park"},{dataLayer:"water",symbolizer:new A({fill:t.water})},{dataLayer:"natural",symbolizer:new A({fill:t.sand}),filter:(r,i)=>i.props.natural=="sand"},{dataLayer:"buildings",symbolizer:new A({fill:t.buildings})},{dataLayer:"roads",symbolizer:new C({color:t.highwayCasing,width:j(1.4,[[5,1.5],[11,4],[16,9],[20,40]])}),filter:(r,i)=>i.props["pmap:kind"]=="highway"},{dataLayer:"roads",symbolizer:new C({color:t.majorRoadCasing,width:j(1.4,[[9,3],[12,4],[17,8],[20,22]])}),filter:(r,i)=>i.props["pmap:kind"]=="major_road"},{dataLayer:"roads",symbolizer:new C({color:t.mediumRoadCasing,width:j(1.4,[[13,3],[17,6],[20,18]])}),filter:(r,i)=>i.props["pmap:kind"]=="medium_road"},{dataLayer:"roads",symbolizer:new C({color:t.minorRoadCasing,width:j(1.4,[[14,2],[17,5],[20,15]])}),filter:(r,i)=>i.props["pmap:kind"]=="minor_road"},{dataLayer:"roads",symbolizer:new C({color:t.minorRoad,width:j(1.4,[[14,1],[17,3],[20,13]])}),filter:(r,i)=>i.props["pmap:kind"]=="minor_road"},{dataLayer:"roads",symbolizer:new C({color:t.mediumRoad,width:j(1.4,[[13,2],[17,4],[20,15]])}),filter:(r,i)=>i.props["pmap:kind"]=="medium_road"},{dataLayer:"roads",symbolizer:new C({color:t.majorRoad,width:j(1.4,[[9,2],[12,3],[17,6],[20,20]])}),filter:(r,i)=>i.props["pmap:kind"]=="major_road"},{dataLayer:"roads",symbolizer:new C({color:t.highway,width:j(1.4,[[5,.5],[11,2.5],[16,7],[20,30]])}),filter:(r,i)=>i.props["pmap:kind"]=="highway"},{dataLayer:"boundaries",symbolizer:new C({color:t.boundaries,width:2,opacity:.4})},{dataLayer:"mask",symbolizer:new A({fill:t.mask})}]),Te=(t,e,r,i)=>{e&&(t=fi(t,e));var n=["name"];r&&(n=r);let a=(s,o)=>i?s instanceof le?new $e([s,new le({fill:o,label_props:i})]):new $e([s,new U({fill:o,label_props:i})]):s;return[{dataLayer:"places",symbolizer:a(new U({label_props:n,fill:t.countryLabel,lineHeight:1.5,font:(s,o)=>s<6?"200 14px sans-serif":"200 20px sans-serif",textTransform:"uppercase"}),t.countryLabel),filter:(s,o)=>o.props["pmap:kind"]=="country"},{dataLayer:"places",symbolizer:a(new U({label_props:n,fill:t.stateLabel,font:"300 16px sans-serif"}),t.stateLabel),filter:(s,o)=>o.props["pmap:kind"]=="state"},{id:"cities_high",dataLayer:"places",filter:(s,o)=>o.props["pmap:kind"]=="city",minzoom:7,symbolizer:a(new U({label_props:n,fill:t.cityLabel,font:(s,o)=>(o==null?void 0:o.props["pmap:rank"])===1?s>8?"600 20px sans-serif":"600 12px sans-serif":s>8?"600 16px sans-serif":"600 10px sans-serif"}),t.cityLabel),sort:(s,o)=>s["pmap:rank"]-o["pmap:rank"]},{id:"cities_low",dataLayer:"places",filter:(s,o)=>o.props["pmap:kind"]=="city",maxzoom:6,symbolizer:new ye([new te({radius:2,fill:t.cityLabel}),a(new le({label_props:n,fill:t.cityLabel,offsetX:2,offsetY:2,font:(s,o)=>(o==null?void 0:o.props["pmap:rank"])===1?s>8?"600 20px sans-serif":"600 12px sans-serif":s>8?"600 16px sans-serif":"600 10px sans-serif"}),t.cityLabel)]),sort:(s,o)=>s["pmap:rank"]-o["pmap:rank"]},{id:"neighbourhood",dataLayer:"places",symbolizer:a(new U({label_props:n,fill:t.neighbourhoodLabel,font:"500 10px sans-serif",textTransform:"uppercase"}),t.neighbourhoodLabel),filter:(s,o)=>o.props["pmap:kind"]=="neighbourhood"},{dataLayer:"landuse",symbolizer:a(new ue({label_props:n,fill:t.landuseLabel,font:"300 12px sans-serif"}),t.landuseLabel)},{dataLayer:"water",symbolizer:a(new ue({label_props:n,fill:t.waterLabel,font:"italic 600 12px sans-serif"}),t.waterLabel)},{dataLayer:"natural",symbolizer:a(new ue({label_props:n,fill:t.naturalLabel,font:"italic 300 12px sans-serif"}),t.naturalLabel)},{dataLayer:"roads",symbolizer:a(new ce({label_props:n,fill:t.roadsLabel,font:"500 12px sans-serif"}),t.roadsLabel),minzoom:12},{dataLayer:"roads",symbolizer:new lt({label_props:["ref"],font:"600 9px sans-serif",background:t.highway,padding:2,fill:t.neighbourhoodLabel}),filter:(s,o)=>o.props["pmap:kind"]=="highway"},{dataLayer:"pois",symbolizer:new ye([new te({radius:2,fill:t.poisLabel}),a(new le({label_props:n,fill:t.poisLabel,offsetX:2,offsetY:2,font:"300 10px sans-serif"}),t.poisLabel)])}]};var di=(t,e,r)=>[{dataSource:t,dataLayer:e,symbolizer:new te({opacity:.2,fill:r,radius:4}),filter:(i,n)=>n.geomType==ee.Point},{dataSource:t,dataLayer:e,symbolizer:new C({opacity:.2,color:r,width:2}),filter:(i,n)=>n.geomType==ee.Line},{dataSource:t,dataLayer:e,symbolizer:new A({opacity:.2,fill:r,stroke:r,width:1}),filter:(i,n)=>n.geomType==ee.Polygon}],ut=(t,e)=>{var r=[];for(var[i,n]of t)for(var a of n)for(var s of a.data.keys())i===e.dataSource&&s===e.dataLayer||(r=r.concat(di(i,s,"steelblue")));return r=r.concat(di(e.dataSource||"",e.dataLayer,"red")),r};var Ke=6378137,ci=85.0511287798,H=Ke*Math.PI,mi=t=>{let e=Math.PI/180,r=Math.max(Math.min(ci,t.y),-ci),i=Math.sin(r*e);return new he.default(Ke*t.x*e,Ke*Math.log((1+i)/(1-i))/2)},ra=t=>{var e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(t.y/Ke))-Math.PI/2)*e,lng:t.x*e/Ke}},ia=(t,e)=>r=>{let i=mi(r);return new he.default((i.x+H)/(H*2),1-(i.y+H)/(H*2)).mult((1<<e)*256).sub(t)},na=(t,e)=>r=>{let i=new he.default(r.x,r.y).add(t).div((1<<e)*256),n=new he.default(i.x*(H*2)-H,(1-i.y)*(H*2)-H);return ra(n)},Vt=(t,e)=>{let r=e*(360/t);return Math.log2(r/256)},pi=class{constructor(e){let r=e.dark?Se:Le;this.paint_rules=e.paint_rules||Ce(r,e.shade),this.label_rules=e.label_rules||Te(r,e.shade,e.language1,e.language2),this.backgroundColor=e.backgroundColor,this.views=Ve(e),this.debug=e.debug||"",this.xray=e.xray}drawContext(e,r,i,n,a){return O(this,null,function*(){let s=mi(n),l=new he.default((s.x+H)/(H*2),1-(s.y+H)/(H*2)).clone().mult(Math.pow(2,a)*256).sub(new he.default(r/2,i/2)),u={minX:l.x,minY:l.y,maxX:l.x+r,maxY:l.y+i},f=[];for(let[p,b]of this.views){let y=b.getBbox(a,u);f.push({key:p,promise:y})}let d=yield Promise.all(f.map(p=>p.promise.then(b=>({status:"fulfilled",value:b,key:p.key}),b=>({status:"rejected",value:[],reason:b,key:p.key})))),c=new Map;for(let p of d)p.status==="fulfilled"&&c.set(p.key,p.value);let x=performance.now(),w=new Ue(a,e,this.label_rules,16,void 0),z=w.add(c);this.backgroundColor&&(e.save(),e.fillStyle=this.backgroundColor,e.fillRect(0,0,r,i),e.restore());let h=this.paint_rules;this.xray&&(h=ut(c,this.xray));let m=Ye(e,a,c,this.xray?null:w.index,h,u,l,!0,this.debug);if(this.debug){e.save(),e.translate(-l.x,-l.y),e.strokeStyle=this.debug,e.fillStyle=this.debug,e.font="12px sans-serif";let p=0;for(let[b,y]of c){for(let g of y){e.strokeRect(g.origin.x,g.origin.y,g.dim,g.dim);let v=g.data_tile;e.fillText(b+(b?" ":"")+v.z+" "+v.x+" "+v.y,g.origin.x+4,g.origin.y+14*(1+p))}p++}e.restore()}return{elapsed:performance.now()-x,project:ia(l,a),unproject:na(l,a)}})}drawCanvas(a,s,o){return O(this,arguments,function*(e,r,i,n={}){let l=window.devicePixelRatio,u=e.clientWidth,f=e.clientHeight;e.width==u*l&&e.height==f*l||(e.width=u*l,e.height=f*l),n.lang&&(e.lang=n.lang);let d=e.getContext("2d");return d.setTransform(l,0,0,l,0,0),this.drawContext(d,u,f,r,i)})}drawContextBounds(e,r,i,n,a){return O(this,null,function*(){let s=i.x-r.x,o=new he.default((r.x+i.x)/2,(r.y+i.y)/2);return this.drawContext(e,n,a,o,Vt(s,n))})}drawCanvasBounds(s,o,l,u){return O(this,arguments,function*(e,r,i,n,a={}){let f=i.x-r.x,d=new he.default((r.x+i.x)/2,(r.y+i.y)/2);return this.drawCanvas(e,d,Vt(f,n),a)})}};var yi=N(re());var aa=t=>new Promise((e,r)=>{setTimeout(()=>{e()},t)}),sa=t=>t.then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e})),oa=(t={})=>{class e extends L.GridLayer{constructor(i={}){i.noWrap&&!i.bounds&&(i.bounds=[[-90,-180],[90,180]]),i.attribution==null&&(i.attribution='<a href="https://protomaps.com">Protomaps</a> \xA9 <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>'),super(i);let n=i.dark?Se:Le;this.paint_rules=i.paint_rules||Ce(n,i.shade),this.label_rules=i.label_rules||Te(n,i.shade,i.language1,i.language2),this.backgroundColor=i.backgroundColor,this.lastRequestedZ=void 0,this.xray=i.xray,this.tasks=i.tasks||[],this.views=Ve(i),this.debug=i.debug;let a=document.createElement("canvas").getContext("2d");this.scratch=a,this.onTilesInvalidated=s=>{s.forEach(o=>{this.rerenderTile(o)})},this.labelers=new je(this.scratch,this.label_rules,16,this.onTilesInvalidated),this.tile_size=256*window.devicePixelRatio,this.tileDelay=i.tileDelay||3,this.lang=i.lang,this.inspector=this.inspect(this)}setDefaultStyle(i,n,a,s){let o=i?Se:Le;this.paint_rules=Ce(o,n),this.label_rules=Te(o,n,a,s)}renderTile(i,n,a,s=()=>{}){return O(this,null,function*(){this.lastRequestedZ=i.z;let o=[];for(let[_,k]of this.views){let S=k.getDisplayTile(i);o.push({key:_,promise:S})}let l=yield Promise.all(o.map(_=>_.promise.then(k=>({status:"fulfilled",value:k,key:_.key}),k=>({status:"rejected",reason:k,key:_.key})))),u=new Map;for(let _ of l)_.status==="fulfilled"?u.set(_.key,[_.value]):_.reason.name==="AbortError"||console.error(_.reason);if(n.key!=a||this.lastRequestedZ!==i.z||(yield Promise.all(this.tasks.map(sa)),n.key!=a)||this.lastRequestedZ!==i.z)return;let f=this.labelers.add(i.z,u);if(n.key!=a||this.lastRequestedZ!==i.z)return;let d=this.labelers.getIndex(i.z);if(!this._map)return;let c=this._map.getCenter().wrap(),x=this._getTiledPixelBounds(c),w=this._pxBoundsToTileRange(x),z=w.getCenter(),h=i.distanceTo(z)*this.tileDelay;if(yield aa(h),n.key!=a||this.lastRequestedZ!==i.z)return;let m=16,p={minX:256*i.x-m,minY:256*i.y-m,maxX:256*(i.x+1)+m,maxY:256*(i.y+1)+m},b=new yi.default(256*i.x,256*i.y);n.width=this.tile_size,n.height=this.tile_size;let y=n.getContext("2d");y.setTransform(this.tile_size/256,0,0,this.tile_size/256,0,0),y.clearRect(0,0,256,256),this.backgroundColor&&(y.save(),y.fillStyle=this.backgroundColor,y.fillRect(0,0,256,256),y.restore());var g=0;let v=this.paint_rules;if(this.xray&&(v=ut(u,this.xray)),g=Ye(y,i.z,u,this.xray?null:d,v,p,b,!1,this.debug),this.debug){y.save(),y.fillStyle=this.debug,y.font="600 12px sans-serif",y.fillText(i.z+" "+i.x+" "+i.y,4,14),y.font="12px sans-serif";let _=28;for(let[k,S]of u){let D=S[0].data_tile;y.fillText(k+(k?" ":"")+D.z+" "+D.x+" "+D.y,4,_),_+=14}y.font="600 10px sans-serif",g>8&&(y.fillText(g.toFixed()+" ms paint",4,_),_+=14),f>8&&y.fillText(f.toFixed()+" ms layout",4,_),y.strokeStyle=this.debug,y.lineWidth=.5,y.beginPath(),y.moveTo(0,0),y.lineTo(0,256),y.stroke(),y.lineWidth=.5,y.beginPath(),y.moveTo(0,0),y.lineTo(256,0),y.stroke(),y.restore()}s()})}rerenderTile(i){for(let n in this._tiles){let a=this._wrapCoords(this._keyToTileCoords(n));i===this._tileCoordsToKey(a)&&this.renderTile(a,this._tiles[n].el,i)}}clearLayout(){this.labelers=new je(this.scratch,this.label_rules,16,this.onTilesInvalidated)}rerenderTiles(){for(let i in this._tiles){let n=this._wrapCoords(this._keyToTileCoords(i)),a=this._tileCoordsToKey(n);this.renderTile(n,this._tiles[i].el,a)}}createTile(i,n){let a=L.DomUtil.create("canvas","leaflet-tile");a.lang=this.lang;let s=this._tileCoordsToKey(i);return a.key=s,this.renderTile(i,a,s,()=>{n(null,a)}),a}_removeTile(i){let n=this._tiles[i];!n||(n.el.removed=!0,n.el.key=void 0,L.DomUtil.removeClass(n.el,"leaflet-tile-loaded"),n.el.width=n.el.height=0,L.DomUtil.remove(n.el),delete this._tiles[i],this.fire("tileunload",{tile:n.el,coords:this._keyToTileCoords(i)}))}queryFeatures(i,n){let a=new Map;for(var[s,o]of this.views)a.set(s,o.queryFeatures(i,n,this._map.getZoom()));return a}inspect(i){return n=>{let a=["\u25CE","\u27CD","\u25FB"],s=i._map.wrapLatLng(n.latlng),o=i.queryFeatures(s.lng,s.lat);var l="";let u=!0;for(var[f,d]of o)for(var c of d)if(!(this.xray&&this.xray!==!0&&!((this.xray.dataSource||"")===f&&this.xray.dataLayer===c.layerName))){l=l+`<div style="margin-top:${u?0:.5}em">${a[c.feature.geomType-1]} <b>${f} ${f?"/":""} ${c.layerName}</b> ${c.feature.id||""}</div>`;for(let x in c.feature.props)l=l+`<div style="font-size:0.9em">${x} = ${c.feature.props[x]}</div>`;u=!1}u&&(l="No features."),L.popup().setLatLng(n.latlng).setContent('<div style="max-height:400px;overflow-y:scroll;padding-right:8px">'+l+"</div>").openOn(i._map)}}addInspector(i){return i.on("click",this.inspector)}removeInspector(i){return i.off("click",this.inspector)}}return new e(t)};function Yt(t){let e=0,r=0;for(let o of t)e+=o.w*o.h,r=Math.max(r,o.w);t.sort((o,l)=>l.h-o.h);let i=Math.max(Math.ceil(Math.sqrt(e/.95)),r),n=[{x:0,y:0,w:i,h:1/0}],a=0,s=0;for(let o of t)for(let l=n.length-1;l>=0;l--){let u=n[l];if(!(o.w>u.w||o.h>u.h)){if(o.x=u.x,o.y=u.y,s=Math.max(s,o.y+o.h),a=Math.max(a,o.x+o.w),o.w===u.w&&o.h===u.h){let f=n.pop();l<n.length&&(n[l]=f)}else o.h===u.h?(u.x+=o.w,u.w-=o.w):o.w===u.w?(u.y+=o.h,u.h-=o.h):(n.push({x:u.x+o.w,y:u.y,w:u.w-o.w,h:o.h}),u.y+=o.h,u.h-=o.h);break}}return{w:a,h:s,fill:e/(a*s)||0}}var Ut=(t,e,r)=>{let i=new FontFace(t,"url("+e+")",{weight:r});return document.fonts.add(i),i.load()},xi=t=>O(void 0,null,function*(){return new Promise((e,r)=>{let i=new Image;i.onload=()=>e(i),i.onerror=()=>r("Invalid SVG"),i.src=t})}),la=`
1
+ "use strict";var protomapsL=(()=>{var Zr=Object.create;var He=Object.defineProperty;var Jr=Object.getOwnPropertyDescriptor;var Kr=Object.getOwnPropertyNames;var Gr=Object.getPrototypeOf,Qr=Object.prototype.hasOwnProperty;var B=Math.pow;var se=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),en=(t,e)=>{for(var r in e)He(t,r,{get:e[r],enumerable:!0})},Et=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Kr(e))!Qr.call(t,i)&&i!==r&&He(t,i,{get:()=>e[i],enumerable:!(n=Jr(e,i))||n.enumerable});return t};var W=(t,e,r)=>(r=t!=null?Zr(Gr(t)):{},Et(e||!t||!t.__esModule?He(r,"default",{value:t,enumerable:!0}):r,t)),tn=t=>Et(He({},"__esModule",{value:!0}),t);var R=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{o(r.next(l))}catch(c){i(c)}},a=l=>{try{o(r.throw(l))}catch(c){i(c)}},o=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,a);o((r=r.apply(t,e)).next())});var Q=se((Ki,Ut)=>{"use strict";Ut.exports=fe;function fe(t,e){this.x=t,this.y=e}fe.prototype={clone:function(){return new fe(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),s=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=s,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};fe.convert=function(t){return t instanceof fe?t:Array.isArray(t)?new fe(t[0],t[1]):t}});var mt=se((is,Zt)=>{"use strict";var pn=Q();Zt.exports=pe;function pe(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields(gn,this,e)}function gn(t,e,r){t==1?e.id=r.readVarint():t==2?bn(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function bn(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}pe.types=["Unknown","Point","LineString","Polygon"];pe.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=[],o;t.pos<e;){if(n<=0){var l=t.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=t.readSVarint(),s+=t.readSVarint(),r===1&&(o&&a.push(o),o=[]),o.push(new pn(i,s));else if(r===7)o&&o.push(o[0].clone());else throw new Error("unknown command "+r)}return o&&a.push(o),a};pe.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,c=-1/0;t.pos<e;){if(n<=0){var u=t.readVarint();r=u&7,n=u>>3}if(n--,r===1||r===2)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>o&&(o=i),s<l&&(l=s),s>c&&(c=s);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,o,c]};pe.prototype.toGeoJSON=function(t,e,r){var n=this.extent*Math.pow(2,r),i=this.extent*t,s=this.extent*e,a=this.loadGeometry(),o=pe.types[this.type],l,c;function u(y){for(var _=0;_<y.length;_++){var k=y[_],f=180-(k.y+s)*360/n;y[_]=[(k.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(f*Math.PI/180))-90]}}switch(this.type){case 1:var h=[];for(l=0;l<a.length;l++)h[l]=a[l][0];a=h,u(a);break;case 2:for(l=0;l<a.length;l++)u(a[l]);break;case 3:for(a=xn(a),l=0;l<a.length;l++)for(c=0;c<a[l].length;c++)u(a[l][c]);break}a.length===1?a=a[0]:o="Multi"+o;var p={type:"Feature",geometry:{type:o,coordinates:a},properties:this.properties};return"id"in this&&(p.id=this.id),p};function xn(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,s=0;s<e;s++){var a=yn(t[s]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[t[s]]):n.push(t[s]))}return n&&r.push(n),r}function yn(t){for(var e=0,r=0,n=t.length,i=n-1,s,a;r<n;i=r++)s=t[r],a=t[i],e+=(a.x-s.x)*(s.y+a.y);return e}});var pt=se((ss,Kt)=>{"use strict";var wn=mt();Kt.exports=Jt;function Jt(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(_n,this,e),this.length=this._features.length}function _n(t,e,r){t===15?e.version=r.readVarint():t===1?e.name=r.readString():t===5?e.extent=r.readVarint():t===2?e._features.push(r.pos):t===3?e._keys.push(r.readString()):t===4&&e._values.push(vn(r))}function vn(t){for(var e=null,r=t.readVarint()+t.pos;t.pos<r;){var n=t.readVarint()>>3;e=n===1?t.readString():n===2?t.readFloat():n===3?t.readDouble():n===4?t.readVarint64():n===5?t.readVarint():n===6?t.readSVarint():n===7?t.readBoolean():null}return e}Jt.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new wn(this._pbf,e,this.extent,this._keys,this._values)}});var Qt=se((as,Gt)=>{"use strict";var kn=pt();Gt.exports=zn;function zn(t,e){this.layers=t.readFields(Tn,{},e)}function Tn(t,e,r){if(t===3){var n=new kn(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var er=se((os,Ze)=>{Ze.exports.VectorTile=Qt();Ze.exports.VectorTileFeature=mt();Ze.exports.VectorTileLayer=pt()});var tr=se(gt=>{gt.read=function(t,e,r,n,i){var s,a,o=i*8-n-1,l=(1<<o)-1,c=l>>1,u=-7,h=r?i-1:0,p=r?-1:1,y=t[e+h];for(h+=p,s=y&(1<<-u)-1,y>>=-u,u+=o;u>0;s=s*256+t[e+h],h+=p,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=n;u>0;a=a*256+t[e+h],h+=p,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-c}return(y?-1:1)*a*Math.pow(2,s-n)};gt.write=function(t,e,r,n,i,s){var a,o,l,c=s*8-i-1,u=(1<<c)-1,h=u>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,_=n?1:-1,k=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+h>=1?e+=p/l:e+=p*Math.pow(2,1-h),e*l>=2&&(a++,l/=2),a+h>=u?(o=0,a=u):a+h>=1?(o=(e*l-1)*Math.pow(2,i),a=a+h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+y]=o&255,y+=_,o/=256,i-=8);for(a=a<<i|o,c+=i;c>0;t[r+y]=a&255,y+=_,a/=256,c-=8);t[r+y-_]|=k*128}});var or=se((cs,ar)=>{"use strict";ar.exports=P;var Je=tr();function P(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}P.Varint=0;P.Fixed64=1;P.Bytes=2;P.Fixed32=5;var bt=(1<<16)*(1<<16),rr=1/bt,Mn=12,sr=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");P.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,s=this.pos;this.type=n&7,t(i,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Ke(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=ir(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ke(this.buf,this.pos)+Ke(this.buf,this.pos+4)*bt;return this.pos+=8,t},readSFixed64:function(){var t=Ke(this.buf,this.pos)+ir(this.buf,this.pos+4)*bt;return this.pos+=8,t},readFloat:function(){var t=Je.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Je.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e=this.buf,r,n;return n=e[this.pos++],r=n&127,n<128||(n=e[this.pos++],r|=(n&127)<<7,n<128)||(n=e[this.pos++],r|=(n&127)<<14,n<128)||(n=e[this.pos++],r|=(n&127)<<21,n<128)?r:(n=e[this.pos],r|=(n&15)<<28,Pn(r,t,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2===1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=Mn&&sr?Vn(this.buf,e,t):Yn(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==P.Bytes)return t.push(this.readVarint(e));var r=ee(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==P.Bytes)return t.push(this.readSVarint());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==P.Bytes)return t.push(this.readBoolean());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==P.Bytes)return t.push(this.readFloat());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==P.Bytes)return t.push(this.readDouble());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==P.Bytes)return t.push(this.readFixed32());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==P.Bytes)return t.push(this.readSFixed32());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==P.Bytes)return t.push(this.readFixed64());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==P.Bytes)return t.push(this.readSFixed64());var e=ee(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===P.Varint)for(;this.buf[this.pos++]>127;);else if(e===P.Bytes)this.pos=this.readVarint()+this.pos;else if(e===P.Fixed32)this.pos+=4;else if(e===P.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),be(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),be(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),be(this.buf,t&-1,this.pos),be(this.buf,Math.floor(t*rr),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),be(this.buf,t&-1,this.pos),be(this.buf,Math.floor(t*rr),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Ln(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?-t*2-1:t*2)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(t.length*4),this.pos++;var e=this.pos;this.pos=En(this.buf,t,this.pos);var r=this.pos-e;r>=128&&nr(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Je.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Je.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&nr(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,P.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,Cn,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Dn,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Rn,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,An,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Bn,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,jn,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,On,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Xn,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,In,e)},writeBytesField:function(t,e){this.writeTag(t,P.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,P.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,P.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,P.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,P.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,P.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,P.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,P.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,P.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,P.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};function Pn(t,e,r){var n=r.buf,i,s;if(s=n[r.pos++],i=(s&112)>>4,s<128||(s=n[r.pos++],i|=(s&127)<<3,s<128)||(s=n[r.pos++],i|=(s&127)<<10,s<128)||(s=n[r.pos++],i|=(s&127)<<17,s<128)||(s=n[r.pos++],i|=(s&127)<<24,s<128)||(s=n[r.pos++],i|=(s&1)<<31,s<128))return ge(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function ee(t){return t.type===P.Bytes?t.readVarint()+t.pos:t.pos+1}function ge(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Ln(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Fn(r,n,e),Sn(n,e)}function Fn(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Sn(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function nr(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function Cn(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Dn(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function An(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Bn(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Rn(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function jn(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function On(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Xn(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function In(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Ke(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function be(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function ir(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Yn(t,e,r){for(var n="",i=e;i<r;){var s=t[i],a=null,o=s>239?4:s>223?3:s>191?2:1;if(i+o>r)break;var l,c,u;o===1?s<128&&(a=s):o===2?(l=t[i+1],(l&192)===128&&(a=(s&31)<<6|l&63,a<=127&&(a=null))):o===3?(l=t[i+1],c=t[i+2],(l&192)===128&&(c&192)===128&&(a=(s&15)<<12|(l&63)<<6|c&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):o===4&&(l=t[i+1],c=t[i+2],u=t[i+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(a=(s&15)<<18|(l&63)<<12|(c&63)<<6|u&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,o=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=o}return n}function Vn(t,e,r){return sr.decode(t.subarray(e,r))}function En(t,e,r){for(var n=0,i,s;n<e.length;n++){if(i=e.charCodeAt(n),i>55295&&i<57344)if(s)if(i<56320){t[r++]=239,t[r++]=191,t[r++]=189,s=i;continue}else i=s-55296<<10|i-56320|65536,s=null;else{i>56319||n+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):s=i;continue}else s&&(t[r++]=239,t[r++]=191,t[r++]=189,s=null);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(i<65536?t[r++]=i>>12|224:(t[r++]=i>>18|240,t[r++]=i>>12&63|128),t[r++]=i>>6&63|128),t[r++]=i&63|128)}return r}});var Ir=se((Ct,Dt)=>{(function(t,e){typeof Ct=="object"&&typeof Dt!="undefined"?Dt.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self).RBush=e()})(Ct,function(){"use strict";function t(f,d,m,x,g){(function b(v,w,z,T,M){for(;T>z;){if(T-z>600){var S=T-z+1,A=w-z+1,ae=Math.log(S),G=.5*Math.exp(2*ae/3),Y=.5*Math.sqrt(ae*G*(S-G)/S)*(A-S/2<0?-1:1),q=Math.max(z,Math.floor(w-A*G/S+Y)),Ne=Math.min(T,Math.floor(w+(S-A)*G/S+Y));b(v,w,q,Ne,M)}var X=v[w],oe=z,V=T;for(e(v,z,w),M(v[T],X)>0&&e(v,z,T);oe<V;){for(e(v,oe,V),oe++,V--;M(v[oe],X)<0;)oe++;for(;M(v[V],X)>0;)V--}M(v[z],X)===0?e(v,z,V):e(v,++V,T),V<=w&&(z=V+1),w<=V&&(T=V-1)}})(f,d,m||0,x||f.length-1,g||r)}function e(f,d,m){var x=f[d];f[d]=f[m],f[m]=x}function r(f,d){return f<d?-1:f>d?1:0}var n=function(f){f===void 0&&(f=9),this._maxEntries=Math.max(4,f),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(f,d,m){if(!m)return d.indexOf(f);for(var x=0;x<d.length;x++)if(m(f,d[x]))return x;return-1}function s(f,d){a(f,0,f.children.length,d,f)}function a(f,d,m,x,g){g||(g=_(null)),g.minX=1/0,g.minY=1/0,g.maxX=-1/0,g.maxY=-1/0;for(var b=d;b<m;b++){var v=f.children[b];o(g,f.leaf?x(v):v)}return g}function o(f,d){return f.minX=Math.min(f.minX,d.minX),f.minY=Math.min(f.minY,d.minY),f.maxX=Math.max(f.maxX,d.maxX),f.maxY=Math.max(f.maxY,d.maxY),f}function l(f,d){return f.minX-d.minX}function c(f,d){return f.minY-d.minY}function u(f){return(f.maxX-f.minX)*(f.maxY-f.minY)}function h(f){return f.maxX-f.minX+(f.maxY-f.minY)}function p(f,d){return f.minX<=d.minX&&f.minY<=d.minY&&d.maxX<=f.maxX&&d.maxY<=f.maxY}function y(f,d){return d.minX<=f.maxX&&d.minY<=f.maxY&&d.maxX>=f.minX&&d.maxY>=f.minY}function _(f){return{children:f,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function k(f,d,m,x,g){for(var b=[d,m];b.length;)if(!((m=b.pop())-(d=b.pop())<=x)){var v=d+Math.ceil((m-d)/x/2)*x;t(f,v,d,m,g),b.push(d,v,v,m)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(f){var d=this.data,m=[];if(!y(f,d))return m;for(var x=this.toBBox,g=[];d;){for(var b=0;b<d.children.length;b++){var v=d.children[b],w=d.leaf?x(v):v;y(f,w)&&(d.leaf?m.push(v):p(f,w)?this._all(v,m):g.push(v))}d=g.pop()}return m},n.prototype.collides=function(f){var d=this.data;if(!y(f,d))return!1;for(var m=[];d;){for(var x=0;x<d.children.length;x++){var g=d.children[x],b=d.leaf?this.toBBox(g):g;if(y(f,b)){if(d.leaf||p(f,b))return!0;m.push(g)}}d=m.pop()}return!1},n.prototype.load=function(f){if(!f||!f.length)return this;if(f.length<this._minEntries){for(var d=0;d<f.length;d++)this.insert(f[d]);return this}var m=this._build(f.slice(),0,f.length-1,0);if(this.data.children.length)if(this.data.height===m.height)this._splitRoot(this.data,m);else{if(this.data.height<m.height){var x=this.data;this.data=m,m=x}this._insert(m,this.data.height-m.height-1,!0)}else this.data=m;return this},n.prototype.insert=function(f){return f&&this._insert(f,this.data.height-1),this},n.prototype.clear=function(){return this.data=_([]),this},n.prototype.remove=function(f,d){if(!f)return this;for(var m,x,g,b=this.data,v=this.toBBox(f),w=[],z=[];b||w.length;){if(b||(b=w.pop(),x=w[w.length-1],m=z.pop(),g=!0),b.leaf){var T=i(f,b.children,d);if(T!==-1)return b.children.splice(T,1),w.push(b),this._condense(w),this}g||b.leaf||!p(b,v)?x?(m++,b=x.children[m],g=!1):b=null:(w.push(b),z.push(m),m=0,x=b,b=b.children[0])}return this},n.prototype.toBBox=function(f){return f},n.prototype.compareMinX=function(f,d){return f.minX-d.minX},n.prototype.compareMinY=function(f,d){return f.minY-d.minY},n.prototype.toJSON=function(){return this.data},n.prototype.fromJSON=function(f){return this.data=f,this},n.prototype._all=function(f,d){for(var m=[];f;)f.leaf?d.push.apply(d,f.children):m.push.apply(m,f.children),f=m.pop();return d},n.prototype._build=function(f,d,m,x){var g,b=m-d+1,v=this._maxEntries;if(b<=v)return s(g=_(f.slice(d,m+1)),this.toBBox),g;x||(x=Math.ceil(Math.log(b)/Math.log(v)),v=Math.ceil(b/Math.pow(v,x-1))),(g=_([])).leaf=!1,g.height=x;var w=Math.ceil(b/v),z=w*Math.ceil(Math.sqrt(v));k(f,d,m,z,this.compareMinX);for(var T=d;T<=m;T+=z){var M=Math.min(T+z-1,m);k(f,T,M,w,this.compareMinY);for(var S=T;S<=M;S+=w){var A=Math.min(S+w-1,M);g.children.push(this._build(f,S,A,x-1))}}return s(g,this.toBBox),g},n.prototype._chooseSubtree=function(f,d,m,x){for(;x.push(d),!d.leaf&&x.length-1!==m;){for(var g=1/0,b=1/0,v=void 0,w=0;w<d.children.length;w++){var z=d.children[w],T=u(z),M=(S=f,A=z,(Math.max(A.maxX,S.maxX)-Math.min(A.minX,S.minX))*(Math.max(A.maxY,S.maxY)-Math.min(A.minY,S.minY))-T);M<b?(b=M,g=T<g?T:g,v=z):M===b&&T<g&&(g=T,v=z)}d=v||d.children[0]}var S,A;return d},n.prototype._insert=function(f,d,m){var x=m?f:this.toBBox(f),g=[],b=this._chooseSubtree(x,this.data,d,g);for(b.children.push(f),o(b,x);d>=0&&g[d].children.length>this._maxEntries;)this._split(g,d),d--;this._adjustParentBBoxes(x,g,d)},n.prototype._split=function(f,d){var m=f[d],x=m.children.length,g=this._minEntries;this._chooseSplitAxis(m,g,x);var b=this._chooseSplitIndex(m,g,x),v=_(m.children.splice(b,m.children.length-b));v.height=m.height,v.leaf=m.leaf,s(m,this.toBBox),s(v,this.toBBox),d?f[d-1].children.push(v):this._splitRoot(m,v)},n.prototype._splitRoot=function(f,d){this.data=_([f,d]),this.data.height=f.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(f,d,m){for(var x,g,b,v,w,z,T,M=1/0,S=1/0,A=d;A<=m-d;A++){var ae=a(f,0,A,this.toBBox),G=a(f,A,m,this.toBBox),Y=(g=ae,b=G,v=void 0,w=void 0,z=void 0,T=void 0,v=Math.max(g.minX,b.minX),w=Math.max(g.minY,b.minY),z=Math.min(g.maxX,b.maxX),T=Math.min(g.maxY,b.maxY),Math.max(0,z-v)*Math.max(0,T-w)),q=u(ae)+u(G);Y<M?(M=Y,x=A,S=q<S?q:S):Y===M&&q<S&&(S=q,x=A)}return x||m-d},n.prototype._chooseSplitAxis=function(f,d,m){var x=f.leaf?this.compareMinX:l,g=f.leaf?this.compareMinY:c;this._allDistMargin(f,d,m,x)<this._allDistMargin(f,d,m,g)&&f.children.sort(x)},n.prototype._allDistMargin=function(f,d,m,x){f.children.sort(x);for(var g=this.toBBox,b=a(f,0,d,g),v=a(f,m-d,m,g),w=h(b)+h(v),z=d;z<m-d;z++){var T=f.children[z];o(b,f.leaf?g(T):T),w+=h(b)}for(var M=m-d-1;M>=d;M--){var S=f.children[M];o(v,f.leaf?g(S):S),w+=h(v)}return w},n.prototype._adjustParentBBoxes=function(f,d,m){for(var x=m;x>=0;x--)o(d[x],f)},n.prototype._condense=function(f){for(var d=f.length-1,m=void 0;d>=0;d--)f[d].children.length===0?d>0?(m=f[d-1].children).splice(m.indexOf(f[d]),1):this.clear():s(f[d],this.toBBox)},n})});var Zi={};en(Zi,{CenteredSymbolizer:()=>tt,CenteredTextSymbolizer:()=>ne,CircleSymbolizer:()=>Be,FlexSymbolizer:()=>Ft,Font:()=>qi,GeomType:()=>Mt,GroupSymbolizer:()=>Re,IconSymbolizer:()=>Pt,Index:()=>at,Justify:()=>Br,Labeler:()=>ke,Labelers:()=>ze,LineLabelPlacement:()=>Or,LineLabelSymbolizer:()=>le,LineSymbolizer:()=>O,OffsetSymbolizer:()=>rt,OffsetTextSymbolizer:()=>Oe,Padding:()=>St,PmtilesSource:()=>ve,PolygonSymbolizer:()=>D,Sheet:()=>jt,ShieldSymbolizer:()=>Lt,Static:()=>Bt,TextPlacements:()=>Rr,TextSymbolizer:()=>je,TileCache:()=>Ae,View:()=>st,ZxySource:()=>De,arr:()=>Si,covering:()=>Er,createPattern:()=>Fi,exp:()=>$,getZoom:()=>At,isCcw:()=>Sr,isInRing:()=>Tt,labelRules:()=>Ie,leafletLayer:()=>Hi,linear:()=>nt,paint:()=>Ue,paintRules:()=>Xe,pointInPolygon:()=>Cr,pointMinDistToLines:()=>Ar,pointMinDistToPoints:()=>Dr,sourcesToViews:()=>Ee,step:()=>Bi,toIndex:()=>re,transformGeom:()=>Ve,wrap:()=>Ye});var ie=W(Q(),1);function he(t,e,r){return Math.min(Math.max(t,r),e)}var ft=class extends Error{constructor(e){super(`Failed to parse color: "${e}"`)}},Me=ft;function $t(t){if(typeof t!="string")throw new Me(t);if(t.trim().toLowerCase()==="transparent")return[0,0,0,0];let e=t.trim();e=un.test(t)?sn(t):t;let r=an.exec(e);if(r){let a=Array.from(r).slice(1);return[...a.slice(0,3).map(o=>parseInt(Pe(o,2),16)),parseInt(Pe(a[3]||"f",2),16)/255]}let n=on.exec(e);if(n){let a=Array.from(n).slice(1);return[...a.slice(0,3).map(o=>parseInt(o,16)),parseInt(a[3]||"ff",16)/255]}let i=ln.exec(e);if(i){let a=Array.from(i).slice(1);return[...a.slice(0,3).map(o=>parseInt(o,10)),parseFloat(a[3]||"1")]}let s=cn.exec(e);if(s){let[a,o,l,c]=Array.from(s).slice(1).map(parseFloat);if(he(0,100,o)!==o)throw new Me(t);if(he(0,100,l)!==l)throw new Me(t);return[...fn(a,o,l),Number.isNaN(c)?1:c]}throw new Me(t)}function rn(t){let e=5381,r=t.length;for(;r;)e=e*33^t.charCodeAt(--r);return(e>>>0)%2341}var Nt=t=>parseInt(t.replace(/_/g,""),36),nn="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((t,e)=>{let r=Nt(e.substring(0,3)),n=Nt(e.substring(3)).toString(16),i="";for(let s=0;s<6-n.length;s++)i+="0";return t[r]=`${i}${n}`,t},{});function sn(t){let e=t.toLowerCase().trim(),r=nn[rn(e)];if(!r)throw new Me(t);return`#${r}`}var Pe=(t,e)=>Array.from(Array(e)).map(()=>t).join(""),an=new RegExp(`^#${Pe("([a-f0-9])",3)}([a-f0-9])?$`,"i"),on=new RegExp(`^#${Pe("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),ln=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Pe(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),cn=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,un=/^[a-z]+$/i,Ht=t=>Math.round(t*255),fn=(t,e,r)=>{let n=r/100;if(e===0)return[n,n,n].map(Ht);let i=(t%360+360)%360/60,s=(1-Math.abs(2*n-1))*(e/100),a=s*(1-Math.abs(i%2-1)),o=0,l=0,c=0;i>=0&&i<1?(o=s,l=a):i>=1&&i<2?(o=a,l=s):i>=2&&i<3?(l=s,c=a):i>=3&&i<4?(l=a,c=s):i>=4&&i<5?(o=a,c=s):i>=5&&i<6&&(o=s,c=a);let u=n-s/2,h=o+u,p=l+u,y=c+u;return[h,p,y].map(Ht)};function hn(t,e,r,n){return`rgba(${he(0,255,t).toFixed()}, ${he(0,255,e).toFixed()}, ${he(0,255,r).toFixed()}, ${parseFloat(he(0,1,n).toFixed(3))})`}function qe(t,e,r){let n=(b,v)=>v===3?b:b/255,[i,s,a,o]=$t(t).map(n),[l,c,u,h]=$t(e).map(n),p=h-o,y=r*2-1,k=((y*p===-1?y:y+p/(1+y*p))+1)/2,f=1-k,d=(i*f+l*k)*255,m=(s*f+c*k)*255,x=(a*f+u*k)*255,g=h*r+o*(1-r);return hn(d,m,x,g)}var K=W(Q(),1);var j=class{constructor(e,r){this.str=e!=null?e:r,this.perFeature=typeof this.str=="function"&&this.str.length===2}get(e,r){return typeof this.str=="function"?this.str(e,r):this.str}},C=class{constructor(e,r=1){this.value=e!=null?e:r,this.perFeature=typeof this.value=="function"&&this.value.length===2}get(e,r){return typeof this.value=="function"?this.value(e,r):this.value}},de=class{constructor(e){var r;this.labelProps=(r=e==null?void 0:e.labelProps)!=null?r:["name"],this.textTransform=e==null?void 0:e.textTransform}get(e,r){let n,i;typeof this.labelProps=="function"?i=this.labelProps(e,r):i=this.labelProps;for(let a of i)if(Object.prototype.hasOwnProperty.call(r.props,a)&&typeof r.props[a]=="string"){n=r.props[a];break}let s;return typeof this.textTransform=="function"?s=this.textTransform(e,r):s=this.textTransform,n&&s==="uppercase"?n=n.toUpperCase():n&&s==="lowercase"?n=n.toLowerCase():n&&s==="capitalize"&&(n=n.toLowerCase().split(" ").map(l=>l[0].toUpperCase()+l.slice(1)).join(" ")),n}},me=class{constructor(e){var r,n;e!=null&&e.font?this.font=e.font:(this.family=(r=e==null?void 0:e.fontFamily)!=null?r:"sans-serif",this.size=(n=e==null?void 0:e.fontSize)!=null?n:12,this.weight=e==null?void 0:e.fontWeight,this.style=e==null?void 0:e.fontStyle)}get(e,r){if(this.font)return typeof this.font=="function"?this.font(e,r):this.font;let n="";this.style&&(typeof this.style=="function"?n=`${this.style(e,r)} `:n=`${this.style} `);let i="";this.weight&&(typeof this.weight=="function"?i=`${this.weight(e,r)} `:i=`${this.weight} `);let s;typeof this.size=="function"?s=this.size(e,r):s=this.size;let a;return typeof this.family=="function"?a=this.family(e,r):a=this.family,`${n}${i}${s}px ${a}`}},We=class{constructor(e,r=[]){this.value=e!=null?e:r,this.perFeature=typeof this.value=="function"&&this.value.length===2}get(e,r){return typeof this.value=="function"?this.value(e,r):this.value}};var ht=W(Q(),1);var dn=(t,e,r)=>{let n=[],i,s,a,o=0,l=0,c=0,u=0,h=0,p=0,y=0,_=0,k=0,f=0,d=0,m=0;if(t.length<2)return[];if(t.length===2)return c=Math.sqrt(B(t[1].x-t[0].x,2)+B(t[1].y-t[0].y,2)),[{length:c,beginIndex:0,beginDistance:0,endIndex:2,endDistance:c}];for(u=Math.sqrt(B(t[1].x-t[0].x,2)+B(t[1].y-t[0].y,2)),o=1,l=t.length-1;o<l;o++)i=t[o-1],s=t[o],a=t[o+1],p=s.x-i.x,y=s.y-i.y,_=a.x-s.x,k=a.y-s.y,h=Math.sqrt(_*_+k*k),c+=u,f=Math.acos((p*_+y*k)/(u*h)),(f>e||c-m>r)&&(n.push({length:c-m,beginDistance:m,beginIndex:d,endIndex:o+1,endDistance:c}),d=o,m=c),u=h;return o-d>0&&n.push({length:c-m+h,beginIndex:d,beginDistance:m,endIndex:o+1,endDistance:c+h}),n};function qt(t,e,r,n){let i=[];for(let s of t){let a=dn(s,Math.PI/45,e);for(let o of a)if(o.length>=e+n){let l=new ht.default(s[o.beginIndex].x,s[o.beginIndex].y),c=s[o.endIndex-1],u=new ht.default((c.x-l.x)/o.length,(c.y-l.y)/o.length);for(let h=n;h<o.length-e;h+=r)i.push({start:l.add(u.mult(h)),end:l.add(u.mult(h+e))})}}return i}function Wt(t,e,r,n){let i=e.x-t.x,s=e.y-t.y,a=Math.sqrt(B(e.x-t.x,2)+B(e.y-t.y,2)),o=[];for(let l=0;l<r+n;l+=2*n){let c=l*1/a;o.push({x:t.x+c*i,y:t.y+c*s})}return o}function dt(t,e){if(t.length<=e)return[t];let r=e-1,n=t.lastIndexOf(" ",r),i=t.indexOf(" ",r);if(n===-1&&i===-1)return[t];let s,a;return i===-1||n>=0&&r-n<i-r?(s=t.substring(0,n),a=t.substring(n+1,t.length)):(s=t.substring(0,i),a=t.substring(i+1,t.length)),[s,...dt(a,e)]}var mn="\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DB5\u4E00-\u9FEA\uF900-\uFA6D\uFA70-\uFAD9\u2000",rs=new RegExp(`^[${mn}]+$`);var _e=W(Q(),1),Pr=W(er(),1),Lr=W(or(),1);var we=Math.pow,I=(t,e,r)=>new Promise((n,i)=>{var s=l=>{try{o(r.next(l))}catch(c){i(c)}},a=l=>{try{o(r.throw(l))}catch(c){i(c)}},o=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,a);o((r=r.apply(t,e)).next())}),U=Uint8Array,ye=Uint16Array,Un=Int32Array,ur=new U([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),fr=new U([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),$n=new U([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hr=function(t,e){for(var r=new ye(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];for(var i=new Un(r[30]),n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return{b:r,r:i}},dr=hr(ur,2),mr=dr.b,Nn=dr.r;mr[28]=258,Nn[258]=28;var pr=hr(fr,0),Hn=pr.b,us=pr.r,wt=new ye(32768);for(F=0;F<32768;++F)te=(F&43690)>>1|(F&21845)<<1,te=(te&52428)>>2|(te&13107)<<2,te=(te&61680)>>4|(te&3855)<<4,wt[F]=((te&65280)>>8|(te&255)<<8)>>1;var te,F,Se=function(t,e,r){for(var n=t.length,i=0,s=new ye(e);i<n;++i)t[i]&&++s[t[i]-1];var a=new ye(e);for(i=1;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(r){o=new ye(1<<e);var l=15-e;for(i=0;i<n;++i)if(t[i])for(var c=i<<4|t[i],u=e-t[i],h=a[t[i]-1]++<<u,p=h|(1<<u)-1;h<=p;++h)o[wt[h]>>l]=c}else for(o=new ye(n),i=0;i<n;++i)t[i]&&(o[i]=wt[a[t[i]-1]++]>>15-t[i]);return o},Ce=new U(288);for(F=0;F<144;++F)Ce[F]=8;var F;for(F=144;F<256;++F)Ce[F]=9;var F;for(F=256;F<280;++F)Ce[F]=7;var F;for(F=280;F<288;++F)Ce[F]=8;var F,gr=new U(32);for(F=0;F<32;++F)gr[F]=5;var F,qn=Se(Ce,9,1),Wn=Se(gr,5,1),xt=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},Z=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(e&7)&r},yt=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},Zn=function(t){return(t+7)/8|0},Jn=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var n=new U(r-e);return n.set(t.subarray(e,r)),n},Kn=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,e,r){var n=new Error(e||Kn[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,E),!r)throw n;return n},kt=function(t,e,r,n){var i=t.length,s=n?n.length:0;if(!i||e.f&&!e.l)return r||new U(0);var a=!r||e.i!=2,o=e.i;r||(r=new U(i*3));var l=function(It){var Yt=r.length;if(It>Yt){var Vt=new U(Math.max(Yt*2,It));Vt.set(r),r=Vt}},c=e.f||0,u=e.p||0,h=e.b||0,p=e.l,y=e.d,_=e.m,k=e.n,f=i*8;do{if(!p){c=Z(t,u,1);var d=Z(t,u+1,3);if(u+=3,d)if(d==1)p=qn,y=Wn,_=9,k=5;else if(d==2){var b=Z(t,u,31)+257,v=Z(t,u+10,15)+4,w=b+Z(t,u+5,31)+1;u+=14;for(var z=new U(w),T=new U(19),M=0;M<v;++M)T[$n[M]]=Z(t,u+M*3,7);u+=v*3;for(var S=xt(T),A=(1<<S)-1,ae=Se(T,S,1),M=0;M<w;){var G=ae[Z(t,u,A)];u+=G&15;var m=G>>4;if(m<16)z[M++]=m;else{var Y=0,q=0;for(m==16?(q=3+Z(t,u,3),u+=2,Y=z[M-1]):m==17?(q=3+Z(t,u,7),u+=3):m==18&&(q=11+Z(t,u,127),u+=7);q--;)z[M++]=Y}}var Ne=z.subarray(0,b),X=z.subarray(b);_=xt(Ne),k=xt(X),p=Se(Ne,_,1),y=Se(X,k,1)}else E(1);else{var m=Zn(u)+4,x=t[m-4]|t[m-3]<<8,g=m+x;if(g>i){o&&E(0);break}a&&l(h+x),r.set(t.subarray(m,g),h),e.b=h+=x,e.p=u=g*8,e.f=c;continue}if(u>f){o&&E(0);break}}a&&l(h+131072);for(var oe=(1<<_)-1,V=(1<<k)-1,ot=u;;ot=u){var Y=p[yt(t,u)&oe],ue=Y>>4;if(u+=Y&15,u>f){o&&E(0);break}if(Y||E(2),ue<256)r[h++]=ue;else if(ue==256){ot=u,p=null;break}else{var Ot=ue-254;if(ue>264){var M=ue-257,Te=ur[M];Ot=Z(t,u,(1<<Te)-1)+mr[M],u+=Te}var lt=y[yt(t,u)&V],ct=lt>>4;lt||E(3),u+=lt&15;var X=Hn[ct];if(ct>3){var Te=fr[ct];X+=yt(t,u)&(1<<Te)-1,u+=Te}if(u>f){o&&E(0);break}a&&l(h+131072);var ut=h+Ot;if(h<X){var Xt=s-X,Wr=Math.min(X,ut);for(Xt+h<0&&E(3);h<Wr;++h)r[h]=n[Xt+h]}for(;h<ut;h+=4)r[h]=r[h-X],r[h+1]=r[h+1-X],r[h+2]=r[h+2-X],r[h+3]=r[h+3-X];h=ut}}e.l=p,e.p=ot,e.b=h,e.f=c,p&&(c=1,e.m=_,e.d=y,e.n=k)}while(!c);return h==r.length?r:Jn(r,0,h)},Gn=new U(0),Qn=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&E(6,"invalid gzip data");var e=t[3],r=10;e&4&&(r+=(t[10]|t[11]<<8)+2);for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!t[r++]);return r+(e&2)},ei=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},ti=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&E(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&E(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function ri(t,e){return kt(t,{i:2},e&&e.out,e&&e.dictionary)}function ni(t,e){var r=Qn(t);return r+8>t.length&&E(6,"invalid gzip data"),kt(t.subarray(r,-8),{i:2},e&&e.out||new U(ei(t)),e&&e.dictionary)}function ii(t,e){return kt(t.subarray(ti(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function _t(t,e){return t[0]==31&&t[1]==139&&t[2]==8?ni(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?ri(t,e):ii(t,e)}var si=typeof TextDecoder!="undefined"&&new TextDecoder,ai=0;try{si.decode(Gn,{stream:!0}),ai=1}catch(t){}var br=(t,e)=>t*we(2,e),Le=(t,e)=>Math.floor(t/we(2,e)),Ge=(t,e)=>br(t.getUint16(e+1,!0),8)+t.getUint8(e),xr=(t,e)=>br(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),oi=(t,e,r,n,i)=>{if(t!==n.getUint8(i))return t-n.getUint8(i);let s=Ge(n,i+1);if(e!==s)return e-s;let a=Ge(n,i+4);return r!==a?r-a:0},li=(t,e,r,n)=>{let i=yr(t,e|128,r,n);return i?{z:e,x:r,y:n,offset:i[0],length:i[1],isDir:!0}:null},lr=(t,e,r,n)=>{let i=yr(t,e,r,n);return i?{z:e,x:r,y:n,offset:i[0],length:i[1],isDir:!1}:null},yr=(t,e,r,n)=>{let i=0,s=t.byteLength/17-1;for(;i<=s;){let a=s+i>>1,o=oi(e,r,n,t,a*17);if(o>0)i=a+1;else if(o<0)s=a-1;else return[xr(t,a*17+7),t.getUint32(a*17+13,!0)]}return null},ci=(t,e)=>t.isDir&&!e.isDir?1:!t.isDir&&e.isDir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,wr=(t,e)=>{let r=t.getUint8(e*17);return{z:r&127,x:Ge(t,e*17+1),y:Ge(t,e*17+4),offset:xr(t,e*17+7),length:t.getUint32(e*17+13,!0),isDir:r>>7===1}},cr=t=>{let e=[],r=new DataView(t);for(let n=0;n<r.byteLength/17;n++)e.push(wr(r,n));return ui(e)},ui=t=>{t.sort(ci);let e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let n=0;n<t.length;n++){let i=t[n],s=i.z;i.isDir&&(s=s|128),r[n*17]=s,r[n*17+1]=i.x&255,r[n*17+2]=i.x>>8&255,r[n*17+3]=i.x>>16&255,r[n*17+4]=i.y&255,r[n*17+5]=i.y>>8&255,r[n*17+6]=i.y>>16&255,r[n*17+7]=i.offset&255,r[n*17+8]=Le(i.offset,8)&255,r[n*17+9]=Le(i.offset,16)&255,r[n*17+10]=Le(i.offset,24)&255,r[n*17+11]=Le(i.offset,32)&255,r[n*17+12]=Le(i.offset,48)&255,r[n*17+13]=i.length&255,r[n*17+14]=i.length>>8&255,r[n*17+15]=i.length>>16&255,r[n*17+16]=i.length>>24&255}return e},fi=(t,e)=>{if(t.byteLength<17)return null;let r=t.byteLength/17,n=wr(t,r-1);if(n.isDir){let i=n.z,s=e.z-i,a=Math.trunc(e.x/(1<<s)),o=Math.trunc(e.y/(1<<s));return{z:i,x:a,y:o}}return null};function hi(t){return I(this,null,function*(){let e=yield t.getBytes(0,512e3),r=new DataView(e.data),n=r.getUint32(4,!0),i=r.getUint16(8,!0),s=new TextDecoder("utf-8"),a=JSON.parse(s.decode(new DataView(e.data,10,n))),o=0;a.compression==="gzip"&&(o=2);let l=0;"minzoom"in a&&(l=+a.minzoom);let c=0;"maxzoom"in a&&(c=+a.maxzoom);let u=0,h=0,p=0,y=-180,_=-85,k=180,f=85;if(a.bounds){let m=a.bounds.split(",");y=+m[0],_=+m[1],k=+m[2],f=+m[3]}if(a.center){let m=a.center.split(",");u=+m[0],h=+m[1],p=+m[2]}return{specVersion:r.getUint16(2,!0),rootDirectoryOffset:10+n,rootDirectoryLength:i*17,jsonMetadataOffset:10,jsonMetadataLength:n,leafDirectoryOffset:0,leafDirectoryLength:void 0,tileDataOffset:0,tileDataLength:void 0,numAddressedTiles:0,numTileEntries:0,numTileContents:0,clustered:!1,internalCompression:1,tileCompression:o,tileType:1,minZoom:l,maxZoom:c,minLon:y,minLat:_,maxLon:k,maxLat:f,centerZoom:p,centerLon:u,centerLat:h,etag:e.etag}})}function di(t,e,r,n,i,s,a){return I(this,null,function*(){let o=yield r.getArrayBuffer(e,t.rootDirectoryOffset,t.rootDirectoryLength,t);t.specVersion===1&&(o=cr(o));let l=lr(new DataView(o),n,i,s);if(l){let h=(yield e.getBytes(l.offset,l.length,a)).data,p=new DataView(h);return p.getUint8(0)===31&&p.getUint8(1)===139&&(h=_t(new Uint8Array(h))),{data:h}}let c=fi(new DataView(o),{z:n,x:i,y:s});if(c){let u=li(new DataView(o),c.z,c.x,c.y);if(u){let h=yield r.getArrayBuffer(e,u.offset,u.length,t);t.specVersion===1&&(h=cr(h));let p=lr(new DataView(h),n,i,s);if(p){let _=(yield e.getBytes(p.offset,p.length,a)).data,k=new DataView(_);return k.getUint8(0)===31&&k.getUint8(1)===139&&(_=_t(new Uint8Array(_))),{data:_}}}}})}var _r={getHeader:hi,getZxy:di};function xe(t,e){return(e>>>0)*4294967296+(t>>>0)}function mi(t,e){let r=e.buf,n=r[e.pos++],i=(n&112)>>4;if(n<128||(n=r[e.pos++],i|=(n&127)<<3,n<128)||(n=r[e.pos++],i|=(n&127)<<10,n<128)||(n=r[e.pos++],i|=(n&127)<<17,n<128)||(n=r[e.pos++],i|=(n&127)<<24,n<128)||(n=r[e.pos++],i|=(n&1)<<31,n<128))return xe(t,i);throw new Error("Expected varint not more than 10 bytes")}function Fe(t){let e=t.buf,r=e[t.pos++],n=r&127;return r<128||(r=e[t.pos++],n|=(r&127)<<7,r<128)||(r=e[t.pos++],n|=(r&127)<<14,r<128)||(r=e[t.pos++],n|=(r&127)<<21,r<128)?n:(r=e[t.pos],n|=(r&15)<<28,mi(n,t))}function pi(t,e,r,n){if(n===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let i=e[0];e[0]=e[1],e[1]=i}}var gi=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function bi(t,e,r){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>we(2,t)-1||r>we(2,t)-1)throw Error("tile x/y outside zoom level bounds");let n=gi[t],i=we(2,t),s=0,a=0,o=0,l=[e,r],c=i/2;for(;c>0;)s=(l[0]&c)>0?1:0,a=(l[1]&c)>0?1:0,o+=c*c*(3*s^a),pi(c,l,s,a),c=c/2;return n+o}function vr(t,e){return I(this,null,function*(){if(e===1||e===0)return t;if(e===2){if(typeof globalThis.DecompressionStream=="undefined")return _t(new Uint8Array(t));let r=new Response(t).body;if(!r)throw Error("Failed to read response stream");let n=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(n).arrayBuffer()}throw Error("Compression method not supported")})}var xi=127;function yi(t,e){let r=0,n=t.length-1;for(;r<=n;){let i=n+r>>1,s=e-t[i].tileId;if(s>0)r=i+1;else if(s<0)n=i-1;else return t[i]}return n>=0&&(t[n].runLength===0||e-t[n].tileId<t[n].runLength)?t[n]:null}var wi=class{constructor(t,e=new Headers){this.url=t,this.customHeaders=e,this.mustReload=!1}getKey(){return this.url}setHeaders(t){this.customHeaders=t}getBytes(t,e,r,n){return I(this,null,function*(){let i,s;r?s=r:(i=new AbortController,s=i.signal);let a=new Headers(this.customHeaders);a.set("range",`bytes=${t}-${t+e-1}`);let o;this.mustReload&&(o="reload");let l=yield fetch(this.url,{signal:s,cache:o,headers:a});if(t===0&&l.status===416){let p=l.headers.get("Content-Range");if(!p||!p.startsWith("bytes */"))throw Error("Missing content-length on 416 response");let y=+p.substr(8);l=yield fetch(this.url,{signal:s,cache:"reload",headers:{range:`bytes=0-${y-1}`}})}let c=l.headers.get("Etag");if(c!=null&&c.startsWith("W/")&&(c=null),l.status===416||n&&c&&c!==n)throw this.mustReload=!0,new vt(n);if(l.status>=300)throw Error(`Bad response code: ${l.status}`);let u=l.headers.get("Content-Length");if(l.status===200&&(!u||+u>e))throw i&&i.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield l.arrayBuffer(),etag:c||void 0,cacheControl:l.headers.get("Cache-Control")||void 0,expires:l.headers.get("Expires")||void 0}})}};function J(t,e){let r=t.getUint32(e+4,!0),n=t.getUint32(e+0,!0);return r*we(2,32)+n}function _i(t,e){let r=new DataView(t),n=r.getUint8(7);if(n>3)throw Error(`Archive is spec version ${n} but this library supports up to spec version 3`);return{specVersion:n,rootDirectoryOffset:J(r,8),rootDirectoryLength:J(r,16),jsonMetadataOffset:J(r,24),jsonMetadataLength:J(r,32),leafDirectoryOffset:J(r,40),leafDirectoryLength:J(r,48),tileDataOffset:J(r,56),tileDataLength:J(r,64),numAddressedTiles:J(r,72),numTileEntries:J(r,80),numTileContents:J(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:e}}function kr(t){let e={buf:new Uint8Array(t),pos:0},r=Fe(e),n=[],i=0;for(let s=0;s<r;s++){let a=Fe(e);n.push({tileId:i+a,offset:0,length:0,runLength:1}),i+=a}for(let s=0;s<r;s++)n[s].runLength=Fe(e);for(let s=0;s<r;s++)n[s].length=Fe(e);for(let s=0;s<r;s++){let a=Fe(e);a===0&&s>0?n[s].offset=n[s-1].offset+n[s-1].length:n[s].offset=a-1}return n}function vi(t){let e=new DataView(t);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var vt=class extends Error{};function ki(t,e){return I(this,null,function*(){let r=yield t.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(vi(r.data)<3)return[yield _r.getHeader(t)];let i=r.data.slice(0,xi),s=_i(i,r.etag),a=r.data.slice(s.rootDirectoryOffset,s.rootDirectoryOffset+s.rootDirectoryLength),o=`${t.getKey()}|${s.etag||""}|${s.rootDirectoryOffset}|${s.rootDirectoryLength}`,l=kr(yield e(a,s.internalCompression));return[s,[o,l.length,l]]})}function zi(t,e,r,n,i){return I(this,null,function*(){let s=yield t.getBytes(r,n,void 0,i.etag),a=yield e(s.data,i.internalCompression),o=kr(a);if(o.length===0)throw new Error("Empty directory is invalid");return o})}var Ti=class{constructor(t=100,e=!0,r=vr){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=r}getHeader(t){return I(this,null,function*(){let e=t.getKey(),r=this.cache.get(e);if(r)return r.lastUsed=this.counter++,yield r.data;let n=new Promise((i,s)=>{ki(t,this.decompress).then(a=>{a[1]&&this.cache.set(a[1][0],{lastUsed:this.counter++,data:Promise.resolve(a[1][2])}),i(a[0]),this.prune()}).catch(a=>{s(a)})});return this.cache.set(e,{lastUsed:this.counter++,data:n}),n})}getDirectory(t,e,r,n){return I(this,null,function*(){let i=`${t.getKey()}|${n.etag||""}|${e}|${r}`,s=this.cache.get(i);if(s)return s.lastUsed=this.counter++,yield s.data;let a=new Promise((o,l)=>{zi(t,this.decompress,e,r,n).then(c=>{o(c),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:a}),a})}getArrayBuffer(t,e,r,n){return I(this,null,function*(){let i=`${t.getKey()}|${n.etag||""}|${e}|${r}`,s=this.cache.get(i);if(s)return s.lastUsed=this.counter++,yield s.data;let a=new Promise((o,l)=>{t.getBytes(e,r,void 0,n.etag).then(c=>{o(c.data),this.cache.has(i),this.prune()}).catch(c=>{l(c)})});return this.cache.set(i,{lastUsed:this.counter++,data:a}),a})}prune(){if(this.cache.size>=this.maxCacheEntries){let t=1/0,e;this.cache.forEach((r,n)=>{r.lastUsed<t&&(t=r.lastUsed,e=n)}),e&&this.cache.delete(e)}}invalidate(t){return I(this,null,function*(){let e=t.getKey();if(this.invalidations.get(e))return yield this.invalidations.get(e);this.cache.delete(t.getKey());let r=new Promise((n,i)=>{this.getHeader(t).then(s=>{n(),this.invalidations.delete(e)}).catch(s=>{i(s)})});this.invalidations.set(e,r)})}},zr=class{constructor(t,e,r){typeof t=="string"?this.source=new wi(t):this.source=t,r?this.decompress=r:this.decompress=vr,e?this.cache=e:this.cache=new Ti}getHeader(){return I(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,r,n){return I(this,null,function*(){let i=bi(t,e,r),s=yield this.cache.getHeader(this.source);if(s.specVersion<3)return _r.getZxy(s,this.source,this.cache,t,e,r,n);if(t<s.minZoom||t>s.maxZoom)return;let a=s.rootDirectoryOffset,o=s.rootDirectoryLength;for(let l=0;l<=3;l++){let c=yield this.cache.getDirectory(this.source,a,o,s),u=yi(c,i);if(u){if(u.runLength>0){let h=yield this.source.getBytes(s.tileDataOffset+u.offset,u.length,n,s.etag);return{data:yield this.decompress(h.data,s.tileCompression),cacheControl:h.cacheControl,expires:h.expires}}a=s.leafDirectoryOffset+u.offset,o=u.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,r,n){return I(this,null,function*(){try{return yield this.getZxyAttempt(t,e,r,n)}catch(i){if(i instanceof vt)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,r,n);throw i}})}getMetadataAttempt(){return I(this,null,function*(){let t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength,void 0,t.etag),r=yield this.decompress(e.data,t.internalCompression),n=new TextDecoder("utf-8");return JSON.parse(n.decode(r))})}getMetadata(){return I(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof vt)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}})}};var Mt=(n=>(n[n.Point=1]="Point",n[n.Line=2]="Line",n[n.Polygon=3]="Polygon",n))(Mt||{});function re(t){return`${t.x}:${t.y}:${t.z}`}var Mi=(t,e,r)=>{t.pos=e;let n=t.readVarint()+t.pos,i=1,s=0,a=0,o=0,l=1/0,c=-1/0,u=1/0,h=-1/0,p=[],y=[];for(;t.pos<n;){if(s<=0){let _=t.readVarint();i=_&7,s=_>>3}if(s--,i===1||i===2)a+=t.readSVarint()*r,o+=t.readSVarint()*r,a<l&&(l=a),a>c&&(c=a),o<u&&(u=o),o>h&&(h=o),i===1&&(y.length>0&&p.push(y),y=[]),y.push(new _e.default(a,o));else if(i===7)y&&y.push(y[0].clone());else throw new Error(`unknown command ${i}`)}return y&&p.push(y),{geom:p,bbox:{minX:l,minY:u,maxX:c,maxY:h}}};function Fr(t,e){let r=new Pr.VectorTile(new Lr.default(t)),n=new Map;for(let[i,s]of Object.entries(r.layers)){let a=[],o=s;for(let l=0;l<o.length;l++){let c=Mi(o.feature(l)._pbf,o.feature(l)._geometry,e/o.extent),u=0;for(let h of c.geom)u+=h.length;a.push({id:o.feature(l).id,geomType:o.feature(l).type,geom:c.geom,numVertices:u,bbox:c.bbox,props:o.feature(l).properties})}n.set(i,a)}return n}var ve=class{constructor(e,r){typeof e=="string"?this.p=new zr(e):this.p=e,this.zoomaborts=[],this.shouldCancelZooms=r}get(e,r){return R(this,null,function*(){this.shouldCancelZooms&&(this.zoomaborts=this.zoomaborts.filter(a=>a.z!==e.z?(a.controller.abort(),!1):!0));let n=new AbortController;this.zoomaborts.push({z:e.z,controller:n});let i=n.signal,s=yield this.p.getZxy(e.z,e.x,e.y,i);return s?Fr(s.data,r):new Map})}},De=class{constructor(e,r){this.url=e,this.zoomaborts=[],this.shouldCancelZooms=r}get(e,r){return R(this,null,function*(){this.shouldCancelZooms&&(this.zoomaborts=this.zoomaborts.filter(a=>a.z!==e.z?(a.controller.abort(),!1):!0));let n=this.url.replace("{z}",e.z.toString()).replace("{x}",e.x.toString()).replace("{y}",e.y.toString()),i=new AbortController;this.zoomaborts.push({z:e.z,controller:i});let s=i.signal;return new Promise((a,o)=>{fetch(n,{signal:s}).then(l=>l.arrayBuffer()).then(l=>{let c=Fr(l,r);a(c)}).catch(l=>{o(l)})})})}},zt=6378137,Tr=85.0511287798,Qe=zt*Math.PI,Pi=t=>{let e=Math.PI/180,r=Math.max(Math.min(Tr,t[0]),-Tr),n=Math.sin(r*e);return new _e.default(zt*t[1]*e,zt*Math.log((1+n)/(1-n))/2)};function Mr(t){return t*t}function et(t,e){return Mr(t.x-e.x)+Mr(t.y-e.y)}function Li(t,e,r){let n=et(e,r);if(n===0)return et(t,e);let i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return i=Math.max(0,Math.min(1,i)),et(t,new _e.default(e.x+i*(r.x-e.x),e.y+i*(r.y-e.y)))}function Tt(t,e){let r=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){let s=e[n].x,a=e[n].y,o=e[i].x,l=e[i].y;a>t.y!=l>t.y&&t.x<(o-s)*(t.y-a)/(l-a)+s&&(r=!r)}return r}function Sr(t){let e=0;for(let r=0;r<t.length;r++){let n=(r+1)%t.length;e+=t[r].x*t[n].y,e-=t[n].x*t[r].y}return e<0}function Cr(t,e){let r=!1;for(let n of e)if(Sr(n))Tt(t,n)&&(r=!1);else{if(r)return!0;Tt(t,n)&&(r=!0)}return r}function Dr(t,e){let r=1/0;for(let n of e){let i=Math.sqrt(et(t,n[0]));i<r&&(r=i)}return r}function Ar(t,e){let r=1/0;for(let n of e)for(let i=0;i<n.length-1;i++){let s=Math.sqrt(Li(t,n[i],n[i+1]));s<r&&(r=s)}return r}var Ae=class{constructor(e,r){this.source=e,this.cache=new Map,this.inflight=new Map,this.tileSize=r}get(e){return R(this,null,function*(){let r=re(e);return new Promise((n,i)=>{let s=this.cache.get(r);if(s)s.used=performance.now(),n(s.data);else{let a=this.inflight.get(r);a?a.push({resolve:n,reject:i}):(this.inflight.set(r,[]),this.source.get(e,this.tileSize).then(o=>{this.cache.set(r,{used:performance.now(),data:o});let l=this.inflight.get(r);if(l)for(let c of l)c.resolve(o);if(this.inflight.delete(r),n(o),this.cache.size>=64){let c=1/0,u;this.cache.forEach((h,p)=>{h.used<c&&(c=h.used,u=p)}),u&&this.cache.delete(u)}}).catch(o=>{let l=this.inflight.get(r);if(l)for(let c of l)c.reject(o);this.inflight.delete(r),i(o)}))}})})}queryFeatures(e,r,n,i){let s=Pi([r,e]),a=new _e.default((s.x+Qe)/(Qe*2),1-(s.y+Qe)/(Qe*2));a.x>1&&(a.x=a.x-Math.floor(a.x));let o=a.mult(1<<n),l=Math.floor(o.x),c=Math.floor(o.y),u=re({z:n,x:l,y:c}),h=[],p=this.cache.get(u);if(p){let y=new _e.default((o.x-l)*this.tileSize,(o.y-c)*this.tileSize);for(let[_,k]of p.data.entries())for(let f of k)f.geomType===1?Dr(y,f.geom)<i&&h.push({feature:f,layerName:_}):f.geomType===2?Ar(y,f.geom)<i&&h.push({feature:f,layerName:_}):Cr(y,f.geom)&&h.push({feature:f,layerName:_})}return h}};var Br=(n=>(n[n.Left=1]="Left",n[n.Center=2]="Center",n[n.Right=3]="Right",n))(Br||{}),Rr=(l=>(l[l.N=1]="N",l[l.Ne=2]="Ne",l[l.E=3]="E",l[l.Se=4]="Se",l[l.S=5]="S",l[l.Sw=6]="Sw",l[l.W=7]="W",l[l.Nw=8]="Nw",l))(Rr||{}),Fi=(t,e,r)=>{let n=document.createElement("canvas"),i=n.getContext("2d");return n.width=t,n.height=e,i!==null&&r(n,i),n},D=class{constructor(e){var r;this.pattern=e.pattern,this.fill=new j(e.fill,"black"),this.opacity=new C(e.opacity,1),this.stroke=new j(e.stroke,"black"),this.width=new C(e.width,0),this.perFeature=(r=this.fill.perFeature||this.opacity.perFeature||this.stroke.perFeature||this.width.perFeature||e.perFeature)!=null?r:!1,this.doStroke=!1}before(e,r){if(!this.perFeature){e.globalAlpha=this.opacity.get(r),e.fillStyle=this.fill.get(r),e.strokeStyle=this.stroke.get(r);let n=this.width.get(r);n>0&&(this.doStroke=!0),e.lineWidth=n}if(this.pattern){let n=e.createPattern(this.pattern,"repeat");n&&(e.fillStyle=n)}}draw(e,r,n,i){let s=!1;if(this.perFeature){e.globalAlpha=this.opacity.get(n,i),e.fillStyle=this.fill.get(n,i);let o=this.width.get(n,i);o&&(s=!0,e.strokeStyle=this.stroke.get(n,i),e.lineWidth=o)}let a=()=>{e.fill(),(s||this.doStroke)&&e.stroke()};e.beginPath();for(let o of r)for(let l=0;l<o.length;l++){let c=o[l];l===0?e.moveTo(c.x,c.y):e.lineTo(c.x,c.y)}a()}};function Si(t,e){return r=>{let n=r-t;return n>=0&&n<e.length?e[n]:0}}function Ci(t,e){let r=0;for(;e[r+1][0]<t;)r++;return r}function Di(t,e,r){return t*(r-e)+e}function Ai(t,e,r,n){let i=n[e+1][0]-n[e][0],s=t-n[e][0];return i===0?0:r===1?s/i:(B(r,s)-1)/(B(r,i)-1)}function $(t,e){return r=>{if(e.length<1)return 0;if(r<=e[0][0])return e[0][1];if(r>=e[e.length-1][0])return e[e.length-1][1];let n=Ci(r,e),i=Ai(r,n,t,e);return Di(i,e[n][1],e[n+1][1])}}function Bi(t,e){return r=>{if(e.length<1)return 0;let n=t;for(let i=0;i<e.length;i++)r>=e[i][0]&&(n=e[i][1]);return n}}function nt(t){return $(1,t)}var O=class{constructor(e){var r;this.color=new j(e.color,"black"),this.width=new C(e.width),this.opacity=new C(e.opacity),this.dash=e.dash?new We(e.dash):null,this.dashColor=new j(e.dashColor,"black"),this.dashWidth=new C(e.dashWidth,1),this.lineCap=new j(e.lineCap,"butt"),this.lineJoin=new j(e.lineJoin,"miter"),this.skip=!1,this.perFeature=!!(((r=this.dash)==null?void 0:r.perFeature)||this.color.perFeature||this.opacity.perFeature||this.width.perFeature||this.lineCap.perFeature||this.lineJoin.perFeature||e.perFeature)}before(e,r){this.perFeature||(e.strokeStyle=this.color.get(r),e.lineWidth=this.width.get(r),e.globalAlpha=this.opacity.get(r),e.lineCap=this.lineCap.get(r),e.lineJoin=this.lineJoin.get(r))}draw(e,r,n,i){if(this.skip)return;let s=()=>{this.perFeature&&(e.globalAlpha=this.opacity.get(n,i),e.lineCap=this.lineCap.get(n,i),e.lineJoin=this.lineJoin.get(n,i)),this.dash?(e.save(),this.perFeature?(e.lineWidth=this.dashWidth.get(n,i),e.strokeStyle=this.dashColor.get(n,i),e.setLineDash(this.dash.get(n,i))):e.setLineDash(this.dash.get(n)),e.stroke(),e.restore()):(e.save(),this.perFeature&&(e.lineWidth=this.width.get(n,i),e.strokeStyle=this.color.get(n,i)),e.stroke(),e.restore())};e.beginPath();for(let a of r)for(let o=0;o<a.length;o++){let l=a[o];o===0?e.moveTo(l.x,l.y):e.lineTo(l.x,l.y)}s()}},Pt=class{constructor(e){this.name=e.name,this.sheet=e.sheet,this.dpr=window.devicePixelRatio}place(e,r,n){let i=r[0],s=new K.default(r[0][0].x,r[0][0].y),a=this.sheet.get(this.name),o=a.w/this.dpr,l=a.h/this.dpr,c={minX:s.x-o/2,minY:s.y-l/2,maxX:s.x+o/2,maxY:s.y+l/2};return[{anchor:s,bboxes:[c],draw:h=>{h.globalAlpha=1,h.drawImage(this.sheet.canvas,a.x,a.y,a.w,a.h,-a.w/2/this.dpr,-a.h/2/this.dpr,a.w/2,a.h/2)}}]}},Be=class{constructor(e){this.radius=new C(e.radius,3),this.fill=new j(e.fill,"black"),this.stroke=new j(e.stroke,"white"),this.width=new C(e.width,0),this.opacity=new C(e.opacity)}draw(e,r,n,i){e.globalAlpha=this.opacity.get(n,i);let s=this.radius.get(n,i),a=this.width.get(n,i);a>0&&(e.strokeStyle=this.stroke.get(n,i),e.lineWidth=a,e.beginPath(),e.arc(r[0][0].x,r[0][0].y,s+a/2,0,2*Math.PI),e.stroke()),e.fillStyle=this.fill.get(n,i),e.beginPath(),e.arc(r[0][0].x,r[0][0].y,s,0,2*Math.PI),e.fill()}place(e,r,n){let i=r[0],s=new K.default(r[0][0].x,r[0][0].y),a=this.radius.get(e.zoom,n),o={minX:s.x-a,minY:s.y-a,maxX:s.x+a,maxY:s.y+a};return[{anchor:s,bboxes:[o],draw:c=>{this.draw(c,[[new K.default(0,0)]],e.zoom,n)}}]}},Lt=class{constructor(e){this.font=new me(e),this.text=new de(e),this.fill=new j(e.fill,"black"),this.background=new j(e.background,"white"),this.padding=new C(e.padding,0)}place(e,r,n){let i=this.text.get(e.zoom,n);if(!i)return;let s=this.font.get(e.zoom,n);e.scratch.font=s;let a=e.scratch.measureText(i),o=a.width,l=a.actualBoundingBoxAscent,c=a.actualBoundingBoxDescent,u=r[0],h=new K.default(r[0][0].x,r[0][0].y),p=this.padding.get(e.zoom,n),y={minX:h.x-o/2-p,minY:h.y-l-p,maxX:h.x+o/2+p,maxY:h.y+c+p};return[{anchor:h,bboxes:[y],draw:k=>{k.globalAlpha=1,k.fillStyle=this.background.get(e.zoom,n),k.fillRect(-o/2-p,-l-p,o+2*p,l+c+2*p),k.fillStyle=this.fill.get(e.zoom,n),k.font=s,k.fillText(i,-o/2,0)}}]}},Ft=class{constructor(e){this.list=e}place(e,r,n){let i=this.list[0].place(e,r,n);if(!i)return;let s=i[0],a=s.anchor,o=s.bboxes[0],l=o.maxY-o.minY,c=[{draw:s.draw,translate:{x:0,y:0}}],u=[[new K.default(r[0][0].x,r[0][0].y+l)]];for(let p=1;p<this.list.length;p++)i=this.list[p].place(e,u,n),i&&(s=i[0],o=jr(o,s.bboxes[0]),c.push({draw:s.draw,translate:{x:0,y:l}}));return[{anchor:a,bboxes:[o],draw:p=>{for(let y of c)p.save(),p.translate(y.translate.x,y.translate.y),y.draw(p),p.restore()}}]}},jr=(t,e)=>({minX:Math.min(t.minX,e.minX),minY:Math.min(t.minY,e.minY),maxX:Math.max(t.maxX,e.maxX),maxY:Math.max(t.maxY,e.maxY)}),Re=class{constructor(e){this.list=e}place(e,r,n){let i=this.list[0];if(!i)return;let s=i.place(e,r,n);if(!s)return;let a=s[0],o=a.anchor,l=a.bboxes[0],c=[a.draw];for(let h=1;h<this.list.length;h++){if(s=this.list[h].place(e,r,n),!s)return;a=s[0],l=jr(l,a.bboxes[0]),c.push(a.draw)}return[{anchor:o,bboxes:[l],draw:h=>{for(let p of c)p(h)}}]}},tt=class{constructor(e){this.symbolizer=e}place(e,r,n){let i=r[0][0],s=this.symbolizer.place(e,[[new K.default(0,0)]],n);if(!s||s.length===0)return;let a=s[0],o=a.bboxes[0],l=o.maxX-o.minX,c=o.maxY-o.minY,u={minX:i.x-l/2,maxX:i.x+l/2,minY:i.y-c/2,maxY:i.y+c/2};return[{anchor:i,bboxes:[u],draw:p=>{p.translate(-l/2,c/2-o.maxY),a.draw(p,{justify:2})}}]}},St=class{constructor(e,r){this.padding=new C(e,0),this.symbolizer=r}place(e,r,n){let i=this.symbolizer.place(e,r,n);if(!i||i.length===0)return;let s=this.padding.get(e.zoom,n);for(let a of i)for(let o of a.bboxes)o.minX-=s,o.minY-=s,o.maxX+=s,o.maxY+=s;return i}},je=class{constructor(e){this.font=new me(e),this.text=new de(e),this.fill=new j(e.fill,"black"),this.stroke=new j(e.stroke,"black"),this.width=new C(e.width,0),this.lineHeight=new C(e.lineHeight,1),this.letterSpacing=new C(e.letterSpacing,0),this.maxLineCodeUnits=new C(e.maxLineChars,15),this.justify=e.justify}place(e,r,n){let i=this.text.get(e.zoom,n);if(!i)return;let s=this.font.get(e.zoom,n);e.scratch.font=s;let a=this.letterSpacing.get(e.zoom,n),o=dt(i,this.maxLineCodeUnits.get(e.zoom,n)),l="",c=0;for(let m of o)m.length>c&&(c=m.length,l=m);let u=e.scratch.measureText(l),h=u.width+a*(c-1),p=u.actualBoundingBoxAscent,y=u.actualBoundingBoxDescent,_=(p+y)*this.lineHeight.get(e.zoom,n),k=new K.default(r[0][0].x,r[0][0].y),f={minX:k.x,minY:k.y-p,maxX:k.x+h,maxY:k.y+y+(o.length-1)*_};return[{anchor:k,bboxes:[f],draw:(m,x)=>{m.globalAlpha=1,m.font=s,m.fillStyle=this.fill.get(e.zoom,n);let g=this.width.get(e.zoom,n),b=0;for(let v of o){let w=0;if(this.justify===2||x&&x.justify===2?w=(h-m.measureText(v).width)/2:(this.justify===3||x&&x.justify===3)&&(w=h-m.measureText(v).width),g)if(m.lineWidth=g*2,m.strokeStyle=this.stroke.get(e.zoom,n),a>0){let z=w;for(let T of v)m.strokeText(T,z,b),z+=m.measureText(T).width+a}else m.strokeText(v,w,b);if(a>0){let z=w;for(let T of v)m.fillText(T,z,b),z+=m.measureText(T).width+a}else m.fillText(v,w,b);b+=_}}}]}},ne=class{constructor(e){this.centered=new tt(new je(e))}place(e,r,n){return this.centered.place(e,r,n)}},rt=class{constructor(e,r){var n,i,s;this.symbolizer=e,this.offsetX=new C(r.offsetX,0),this.offsetY=new C(r.offsetY,0),this.justify=(n=r.justify)!=null?n:void 0,this.placements=(i=r.placements)!=null?i:[2,6,8,4,1,3,5,7],this.ddValues=(s=r.ddValues)!=null?s:()=>({})}place(e,r,n){if(n.geomType!==1)return;let i=r[0][0],s=this.symbolizer.place(e,[[new K.default(0,0)]],n);if(!s||s.length===0)return;let a=s[0],o=a.bboxes[0],l=this.offsetX,c=this.offsetY,u=this.justify,h=this.placements,{offsetX:p,offsetY:y,justify:_,placements:k}=this.ddValues(e.zoom,n)||{};p&&(l=new C(p,0)),y&&(c=new C(y,0)),_&&(u=_),k&&(h=k);let f=l.get(e.zoom,n),d=c.get(e.zoom,n),m=(w,z)=>({minX:w.x+z.x+o.minX,minY:w.y+z.y+o.minY,maxX:w.x+z.x+o.maxX,maxY:w.y+z.y+o.maxY}),x=new K.default(f,d),g,b=w=>{w.translate(x.x,x.y),a.draw(w,{justify:g})},v=(w,z)=>{let T=m(w,z);if(!e.index.bboxCollides(T,e.order))return[{anchor:i,bboxes:[T],draw:b}]};for(let w of h){let z=this.computeXaxisOffset(f,o,w),T=this.computeYaxisOffset(d,o,w);return g=this.computeJustify(u,w),x=new K.default(z,T),v(i,x)}}computeXaxisOffset(e,r,n){let i=r.maxX,s=i/2;return[1,5].includes(n)?e-s:[8,7,6].includes(n)?e-i:e}computeYaxisOffset(e,r,n){let i=Math.abs(r.minY),s=r.maxY,a=(r.minY+r.maxY)/2;return[3,7].includes(n)?e-a:[8,2,1].includes(n)?e-s:[6,4,5].includes(n)?e+i:e}computeJustify(e,r){return e||([1,5].includes(r)?2:[2,3,4].includes(r)?1:3)}},Oe=class{constructor(e){this.symbolizer=new rt(new je(e),e)}place(e,r,n){return this.symbolizer.place(e,r,n)}},Or=(n=>(n[n.Above=1]="Above",n[n.Center=2]="Center",n[n.Below=3]="Below",n))(Or||{}),le=class{constructor(e){var r;this.font=new me(e),this.text=new de(e),this.fill=new j(e.fill,"black"),this.stroke=new j(e.stroke,"black"),this.width=new C(e.width,0),this.offset=new C(e.offset,0),this.position=(r=e.position)!=null?r:1,this.maxLabelCodeUnits=new C(e.maxLabelChars,40),this.repeatDistance=new C(e.repeatDistance,250)}place(e,r,n){let i=this.text.get(e.zoom,n);if(!i||i.length>this.maxLabelCodeUnits.get(e.zoom,n))return;let s=20,a=n.bbox;if(a.maxY-a.minY<s&&a.maxX-a.minX<s)return;let o=this.font.get(e.zoom,n);e.scratch.font=o;let l=e.scratch.measureText(i),c=l.width,u=l.actualBoundingBoxAscent+l.actualBoundingBoxDescent,h=this.repeatDistance.get(e.zoom,n);e.overzoom>4&&(h*=1<<e.overzoom-4);let p=u*2,y=qt(r,c,h,p);if(y.length===0)return;let _=[];for(let k of y){let f=k.end.x-k.start.x,d=k.end.y-k.start.y,x=Wt(k.start,k.end,c,p/2).map(b=>({minX:b.x-p/2,minY:b.y-p/2,maxX:b.x+p/2,maxY:b.y+p/2})),g=b=>{b.globalAlpha=1,b.rotate(Math.atan2(d,f)),f<0&&(b.scale(-1,-1),b.translate(-c,0));let v=0;this.position===3?v+=u:this.position===2&&(v+=u/2),b.translate(0,v-this.offset.get(e.zoom,n)),b.font=o;let w=this.width.get(e.zoom,n);w&&(b.lineWidth=w,b.strokeStyle=this.stroke.get(e.zoom,n),b.strokeText(i,0,0)),b.fillStyle=this.fill.get(e.zoom,n),b.fillText(i,0,0)};_.push({anchor:k.start,bboxes:x,draw:g,deduplicationKey:i,deduplicationDistance:h})}return _}};var N=(t,e)=>{let r=t[e];return typeof r=="string"?r:""},Xr=(t,e)=>{let r=t[e];return typeof r=="number"?r:0},Xe=t=>[{dataLayer:"earth",symbolizer:new D({fill:t.earth})},{dataLayer:"landuse",symbolizer:new D({fill:(e,r)=>qe(t.park_a,t.park_b,Math.min(Math.max(e/12,12),0))}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["allotments","village_green","playground"].includes(n)}},{dataLayer:"landuse",symbolizer:new D({fill:t.park_b,opacity:.7}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course"].includes(n)}},{dataLayer:"landuse",symbolizer:new D({fill:t.hospital}),filter:(e,r)=>r.props["pmap:kind"]==="hospital"},{dataLayer:"landuse",symbolizer:new D({fill:t.industrial}),filter:(e,r)=>r.props["pmap:kind"]==="industrial"},{dataLayer:"landuse",symbolizer:new D({fill:t.school}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["school","university","college"].includes(n)}},{dataLayer:"landuse",symbolizer:new D({fill:t.beach}),filter:(e,r)=>r.props["pmap:kind"]==="beach"},{dataLayer:"landuse",symbolizer:new D({fill:t.zoo}),filter:(e,r)=>r.props["pmap:kind"]==="zoo"},{dataLayer:"landuse",symbolizer:new D({fill:t.zoo}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["military","naval_base","airfield"].includes(n)}},{dataLayer:"natural",symbolizer:new D({fill:(e,r)=>qe(t.wood_a,t.wood_b,Math.min(Math.max(e/12,12),0))}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["wood","nature_reserve","forest"].includes(n)}},{dataLayer:"natural",symbolizer:new D({fill:(e,r)=>qe(t.scrub_a,t.scrub_b,Math.min(Math.max(e/12,12),0))}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["scrub","grassland","grass"].includes(n)}},{dataLayer:"natural",symbolizer:new D({fill:t.scrub_b}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["scrub","grassland","grass"].includes(n)}},{dataLayer:"natural",symbolizer:new D({fill:t.glacier}),filter:(e,r)=>r.props["pmap:kind"]==="glacier"},{dataLayer:"natural",symbolizer:new D({fill:t.sand}),filter:(e,r)=>r.props["pmap:kind"]==="sand"},{dataLayer:"landuse",symbolizer:new D({fill:t.aerodrome}),filter:(e,r)=>r.props["pmap:kind"]==="aerodrome"},{dataLayer:"water",symbolizer:new D({fill:t.water})},{dataLayer:"transit",symbolizer:new O({color:t.runway,width:(e,r)=>$(1.6,[[11,0],[13,4],[19,30]])(e)}),filter:(e,r)=>r.props["pmap:kind_detail"]==="runway"},{dataLayer:"transit",symbolizer:new O({color:t.runway,width:(e,r)=>$(1.6,[[14,0],[14.5,1],[16,6]])(e)}),filter:(e,r)=>r.props["pmap:kind_detail"]==="taxiway"},{dataLayer:"transit",symbolizer:new O({color:t.pier,width:(e,r)=>$(1.6,[[13,0],[13.5,0,5],[21,16]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="pier"},{dataLayer:"physical_line",minzoom:14,symbolizer:new O({color:t.water,width:(e,r)=>$(1.6,[[9,0],[9.5,1],[18,12]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="river"},{dataLayer:"physical_line",minzoom:14,symbolizer:new O({color:t.water,width:.5}),filter:(e,r)=>r.props["pmap:kind"]==="stream"},{dataLayer:"landuse",symbolizer:new D({fill:t.pedestrian}),filter:(e,r)=>r.props["pmap:kind"]==="pedestrian"},{dataLayer:"landuse",symbolizer:new D({fill:t.pier}),filter:(e,r)=>r.props["pmap:kind"]==="pier"},{dataLayer:"buildings",symbolizer:new D({fill:t.buildings,opacity:.5})},{dataLayer:"roads",symbolizer:new O({color:t.major,width:(e,r)=>$(1.6,[[14,0],[20,7]])(e)}),filter:(e,r)=>{let n=N(r.props,"pmap:kind");return["other","path"].includes(n)}},{dataLayer:"roads",symbolizer:new O({color:t.major,width:(e,r)=>$(1.6,[[13,0],[18,8]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="minor_road"},{dataLayer:"roads",symbolizer:new O({color:t.major,width:(e,r)=>$(1.6,[[7,0],[12,1.2],[15,3],[18,13]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="medium_road"},{dataLayer:"roads",symbolizer:new O({color:t.major,width:(e,r)=>$(1.6,[[6,0],[12,1.6],[15,3],[18,13]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="major_road"},{dataLayer:"roads",symbolizer:new O({color:t.major,width:(e,r)=>$(1.6,[[3,0],[6,1.1],[12,1.6],[15,5],[18,15]])(e)}),filter:(e,r)=>r.props["pmap:kind"]==="highway"},{dataLayer:"boundaries",symbolizer:new O({dash:[3,2],color:t.boundaries,width:1}),filter:(e,r)=>{let n=r.props["pmap:min_admin_level"];return typeof n=="number"&&n<=2}},{dataLayer:"transit",symbolizer:new O({dash:[.3,.75],color:t.railway,dashWidth:(e,r)=>$(1.6,[[4,0],[7,.15],[19,9]])(e),opacity:.5}),filter:(e,r)=>r.props["pmap:kind"]==="rail"},{dataLayer:"boundaries",symbolizer:new O({dash:[3,2],color:t.boundaries,width:.5}),filter:(e,r)=>{let n=r.props["pmap:min_admin_level"];return typeof n=="number"&&n>2}}],Ie=t=>{let e=["name"];return[{dataLayer:"roads",symbolizer:new le({labelProps:e,fill:t.roads_label_minor,font:"400 12px sans-serif",width:2,stroke:t.roads_label_minor_halo}),minzoom:16,filter:(r,n)=>{let i=N(n.props,"pmap:kind");return["minor_road","other","path"].includes(i)}},{dataLayer:"roads",symbolizer:new le({labelProps:e,fill:t.roads_label_major,font:"400 12px sans-serif",width:2,stroke:t.roads_label_major_halo}),minzoom:12,filter:(r,n)=>{let i=N(n.props,"pmap:kind");return["highway","major_road","medium_road"].includes(i)}},{dataLayer:"roads",symbolizer:new le({labelProps:e,fill:t.roads_label_major,font:"400 12px sans-serif",width:2,stroke:t.roads_label_major_halo}),minzoom:12,filter:(r,n)=>{let i=N(n.props,"pmap:kind");return["highway","major_road","medium_road"].includes(i)}},{dataLayer:"physical_point",symbolizer:new ne({labelProps:e,fill:t.ocean_label,lineHeight:1.5,letterSpacing:1,font:(r,n)=>`400 ${nt([[3,10],[10,12]])(r)}px sans-serif`,textTransform:"uppercase"}),filter:(r,n)=>{let i=N(n.props,"pmap:kind");return["ocean","bay","strait","fjord"].includes(i)}},{dataLayer:"physical_point",symbolizer:new ne({labelProps:e,fill:t.ocean_label,lineHeight:1.5,letterSpacing:1,font:(r,n)=>`400 ${nt([[3,0],[6,12],[10,12]])(r)}px sans-serif`}),filter:(r,n)=>{let i=N(n.props,"pmap:kind");return["sea","lake","water"].includes(i)}},{dataLayer:"places",symbolizer:new ne({labelProps:(r,n)=>r<6?["name:short"]:e,fill:t.state_label,stroke:t.state_label_halo,width:1,lineHeight:1.5,font:(r,n)=>r<6?"400 16px sans-serif":"400 12px sans-serif",textTransform:"uppercase"}),filter:(r,n)=>n.props["pmap:kind"]==="region"},{dataLayer:"places",symbolizer:new ne({labelProps:e,fill:t.country_label,lineHeight:1.5,font:(r,n)=>(r<6,"600 12px sans-serif"),textTransform:"uppercase"}),filter:(r,n)=>n.props["pmap:kind"]==="country"},{dataLayer:"places",minzoom:9,symbolizer:new ne({labelProps:e,fill:t.city_label,lineHeight:1.5,font:(r,n)=>{if(!n)return"400 12px sans-serif";let i=n.props["pmap:min_zoom"],s=400;i&&i<=5&&(s=600);let a=12,o=n.props["pmap:population_rank"];return o&&o>9&&(a=16),`${s} ${a}px sans-serif`}}),sort:(r,n)=>{let i=Xr(r,"pmap:population_rank"),s=Xr(n,"pmap:population_rank");return i-s},filter:(r,n)=>n.props["pmap:kind"]==="locality"},{dataLayer:"places",maxzoom:8,symbolizer:new Re([new Be({radius:2,fill:t.city_circle,stroke:t.city_circle_stroke,width:1.5}),new Oe({labelProps:e,fill:t.city_label,stroke:t.city_label_halo,width:1,offsetX:6,offsetY:4.5,font:(r,n)=>"400 12px sans-serif"})]),filter:(r,n)=>n.props["pmap:kind"]==="locality"}]};var Ri={background:"#cccccc",earth:"#e0e0e0",park_a:"#cfddd5",park_b:"#9cd3b4",hospital:"#e4dad9",industrial:"#d1dde1",school:"#e4ded7",wood_a:"#d0ded0",wood_b:"#a0d9a0",pedestrian:"#e3e0d4",scrub_a:"#cedcd7",scrub_b:"#99d2bb",glacier:"#e7e7e7",sand:"#e2e0d7",beach:"#e8e4d0",aerodrome:"#dadbdf",runway:"#e9e9ed",water:"#80deea",pier:"#e0e0e0",zoo:"#c6dcdc",military:"#dcdcdc",tunnel_other_casing:"#e0e0e0",tunnel_minor_casing:"#e0e0e0",tunnel_link_casing:"#e0e0e0",tunnel_medium_casing:"#e0e0e0",tunnel_major_casing:"#e0e0e0",tunnel_highway_casing:"#e0e0e0",tunnel_other:"#d5d5d5",tunnel_minor:"#d5d5d5",tunnel_link:"#d5d5d5",tunnel_medium:"#d5d5d5",tunnel_major:"#d5d5d5",tunnel_highway:"#d5d5d5",transit_pier:"#e0e0e0",buildings:"#cccccc",minor_service_casing:"#e0e0e0",minor_casing:"#e0e0e0",link_casing:"#e0e0e0",medium_casing:"#e0e0e0",major_casing_late:"#e0e0e0",highway_casing_late:"#e0e0e0",other:"#ebebeb",minor_service:"#ebebeb",minor_a:"#ebebeb",minor_b:"#ffffff",link:"#ffffff",medium:"#f5f5f5",major_casing_early:"#e0e0e0",major:"#ffffff",highway_casing_early:"#e0e0e0",highway:"#ffffff",railway:"#a7b1b3",boundaries:"#adadad",waterway_label:"#ffffff",bridges_other_casing:"#e0e0e0",bridges_minor_casing:"#e0e0e0",bridges_link_casing:"#e0e0e0",bridges_medium_casing:"#e0e0e0",bridges_major_casing:"#e0e0e0",bridges_highway_casing:"#e0e0e0",bridges_other:"#ebebeb",bridges_minor:"#ffffff",bridges_link:"#ffffff",bridges_medium:"#f0eded",bridges_major:"#f5f5f5",bridges_highway:"#ffffff",roads_label_minor:"#91888b",roads_label_minor_halo:"#ffffff",roads_label_major:"#938a8d",roads_label_major_halo:"#ffffff",ocean_label:"#ffffff",peak_label:"#7e9aa0",subplace_label:"#8f8f8f",subplace_label_halo:"#e0e0e0",city_circle:"#ffffff",city_circle_stroke:"#a3a3a3",city_label:"#5c5c5c",city_label_halo:"#e0e0e0",state_label:"#b3b3b3",state_label_halo:"#e0e0e0",country_label:"#a3a3a3"},ji={background:"#34373d",earth:"#1f1f1f",park_a:"#232325",park_b:"#232325",hospital:"#252424",industrial:"#222222",school:"#262323",wood_a:"#202121",wood_b:"#202121",pedestrian:"#1e1e1e",scrub_a:"#222323",scrub_b:"#222323",glacier:"#1c1c1c",sand:"#212123",beach:"#28282a",aerodrome:"#1e1e1e",runway:"#333333",water:"#34373d",pier:"#222222",zoo:"#222323",military:"#242323",tunnel_other_casing:"#141414",tunnel_minor_casing:"#141414",tunnel_link_casing:"#141414",tunnel_medium_casing:"#141414",tunnel_major_casing:"#141414",tunnel_highway_casing:"#141414",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_medium:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",transit_pier:"#333333",buildings:"#111111",minor_service_casing:"#1f1f1f",minor_casing:"#1f1f1f",link_casing:"#1f1f1f",medium_casing:"#1f1f1f",major_casing_late:"#1f1f1f",highway_casing_late:"#1f1f1f",other:"#333333",minor_service:"#333333",minor_a:"#3d3d3d",minor_b:"#333333",link:"#3d3d3d",medium:"#3d3d3d",major_casing_early:"#1f1f1f",major:"#3d3d3d",highway_casing_early:"#1f1f1f",highway:"#474747",railway:"#000000",boundaries:"#5b6374",waterway_label:"#717784",bridges_other_casing:"#2b2b2b",bridges_minor_casing:"#1f1f1f",bridges_link_casing:"#1f1f1f",bridges_medium_casing:"#1f1f1f",bridges_major_casing:"#1f1f1f",bridges_highway_casing:"#1f1f1f",bridges_other:"#333333",bridges_minor:"#333333",bridges_link:"#3d3d3d",bridges_medium:"#3d3d3d",bridges_major:"#3d3d3d",bridges_highway:"#474747",roads_label_minor:"#525252",roads_label_minor_halo:"#1f1f1f",roads_label_major:"#666666",roads_label_major_halo:"#1f1f1f",ocean_label:"#717784",peak_label:"#898080",subplace_label:"#525252",subplace_label_halo:"#1f1f1f",city_circle:"#000000",city_circle_stroke:"#7a7a7a",city_label:"#7a7a7a",city_label_halo:"#212121",state_label:"#3d3d3d",state_label_halo:"#1f1f1f",country_label:"#5c5c5c"},Oi={background:"#ffffff",earth:"#ffffff",park_a:"#fcfcfc",park_b:"#fcfcfc",hospital:"#f8f8f8",industrial:"#fcfcfc",school:"#f8f8f8",wood_a:"#fafafa",wood_b:"#fafafa",pedestrian:"#fdfdfd",scrub_a:"#fafafa",scrub_b:"#fafafa",glacier:"#fcfcfc",sand:"#fafafa",beach:"#f6f6f6",aerodrome:"#fdfdfd",runway:"#efefef",water:"#dcdcdc",pier:"#f5f5f5",zoo:"#f7f7f7",military:"#fcfcfc",tunnel_other_casing:"#d6d6d6",tunnel_minor_casing:"#fcfcfc",tunnel_link_casing:"#fcfcfc",tunnel_medium_casing:"#fcfcfc",tunnel_major_casing:"#fcfcfc",tunnel_highway_casing:"#fcfcfc",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_medium:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",transit_pier:"#efefef",buildings:"#efefef",minor_service_casing:"#ffffff",minor_casing:"#ffffff",link_casing:"#ffffff",medium_casing:"#ffffff",major_casing_late:"#ffffff",highway_casing_late:"#ffffff",other:"#f5f5f5",minor_service:"#f5f5f5",minor_a:"#ebebeb",minor_b:"#f5f5f5",link:"#ebebeb",medium:"#ebebeb",major_casing_early:"#ffffff",major:"#ebebeb",highway_casing_early:"#ffffff",highway:"#ebebeb",railway:"#d6d6d6",boundaries:"#adadad",waterway_label:"#adadad",bridges_other_casing:"#ffffff",bridges_minor_casing:"#ffffff",bridges_link_casing:"#ffffff",bridges_medium_casing:"#ffffff",bridges_major_casing:"#ffffff",bridges_highway_casing:"#ffffff",bridges_other:"#f5f5f5",bridges_minor:"#f5f5f5",bridges_link:"#ebebeb",bridges_medium:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#adadad",roads_label_minor_halo:"#ffffff",roads_label_major:"#999999",roads_label_major_halo:"#ffffff",ocean_label:"#adadad",peak_label:"#adadad",subplace_label:"#8f8f8f",subplace_label_halo:"#ffffff",city_circle:"#ffffff",city_circle_stroke:"#adadad",city_label:"#5c5c5c",city_label_halo:"#ffffff",state_label:"#b3b3b3",state_label_halo:"#ffffff",country_label:"#b8b8b8"},Xi={background:"#a3a3a3",earth:"#cccccc",park_a:"#c2c2c2",park_b:"#c2c2c2",hospital:"#d0d0d0",industrial:"#c6c6c6",school:"#d0d0d0",wood_a:"#c2c2c2",wood_b:"#c2c2c2",pedestrian:"#c4c4c4",scrub_a:"#c2c2c2",scrub_b:"#c2c2c2",glacier:"#d2d2d2",sand:"#d2d2d2",beach:"#d2d2d2",aerodrome:"#c9c9c9",runway:"#f5f5f5",water:"#a3a3a3",pier:"#b8b8b8",zoo:"#c7c7c7",military:"#bfbfbf",tunnel_other_casing:"#b8b8b8",tunnel_minor_casing:"#b8b8b8",tunnel_link_casing:"#b8b8b8",tunnel_medium_casing:"#b8b8b8",tunnel_major_casing:"#b8b8b8",tunnel_highway_casing:"#b8b8b8",tunnel_other:"#d6d6d6",tunnel_minor:"#d6d6d6",tunnel_link:"#d6d6d6",tunnel_medium:"#d6d6d6",tunnel_major:"#d6d6d6",tunnel_highway:"#d6d6d6",transit_pier:"#b8b8b8",buildings:"#e0e0e0",minor_service_casing:"#cccccc",minor_casing:"#cccccc",link_casing:"#cccccc",medium_casing:"#cccccc",major_casing_late:"#cccccc",highway_casing_late:"#cccccc",other:"#e0e0e0",minor_service:"#e0e0e0",minor_a:"#ebebeb",minor_b:"#e0e0e0",link:"#ebebeb",medium:"#ebebeb",major_casing_early:"#cccccc",major:"#ebebeb",highway_casing_early:"#cccccc",highway:"#ebebeb",railway:"#f5f5f5",boundaries:"#5c5c5c",waterway_label:"#7a7a7a",bridges_other_casing:"#cccccc",bridges_minor_casing:"#cccccc",bridges_link_casing:"#cccccc",bridges_medium_casing:"#cccccc",bridges_major_casing:"#cccccc",bridges_highway_casing:"#cccccc",bridges_other:"#e0e0e0",bridges_minor:"#e0e0e0",bridges_link:"#ebebeb",bridges_medium:"#ebebeb",bridges_major:"#ebebeb",bridges_highway:"#ebebeb",roads_label_minor:"#999999",roads_label_minor_halo:"#e0e0e0",roads_label_major:"#8f8f8f",roads_label_major_halo:"#ebebeb",ocean_label:"#7a7a7a",peak_label:"#5c5c5c",subplace_label:"#7a7a7a",subplace_label_halo:"#cccccc",city_circle:"#c2c2c2",city_circle_stroke:"#7a7a7a",city_label:"#474747",city_label_halo:"#cccccc",state_label:"#999999",state_label_halo:"#cccccc",country_label:"#858585"},Ii={background:"#2b2b2b",earth:"#141414",park_a:"#181818",park_b:"#181818",hospital:"#1d1d1d",industrial:"#101010",school:"#111111",wood_a:"#1a1a1a",wood_b:"#1a1a1a",pedestrian:"#191919",scrub_a:"#1c1c1c",scrub_b:"#1c1c1c",glacier:"#191919",sand:"#161616",beach:"#1f1f1f",aerodrome:"#191919",runway:"#323232",water:"#333333",pier:"#0a0a0a",zoo:"#191919",military:"#121212",tunnel_other_casing:"#101010",tunnel_minor_casing:"#101010",tunnel_link_casing:"#101010",tunnel_medium_casing:"#101010",tunnel_major_casing:"#101010",tunnel_highway_casing:"#101010",tunnel_other:"#292929",tunnel_minor:"#292929",tunnel_link:"#292929",tunnel_medium:"#292929",tunnel_major:"#292929",tunnel_highway:"#292929",transit_pier:"#0a0a0a",buildings:"#0a0a0a",minor_service_casing:"#141414",minor_casing:"#141414",link_casing:"#141414",medium_casing:"#141414",major_casing_late:"#141414",highway_casing_late:"#141414",other:"#1f1f1f",minor_service:"#1f1f1f",minor_a:"#292929",minor_b:"#1f1f1f",link:"#1f1f1f",medium:"#292929",major_casing_early:"#141414",major:"#292929",highway_casing_early:"#141414",highway:"#292929",railway:"#292929",boundaries:"#707070",waterway_label:"#707070",bridges_other_casing:"#141414",bridges_minor_casing:"#141414",bridges_link_casing:"#141414",bridges_medium_casing:"#141414",bridges_major_casing:"#141414",bridges_highway_casing:"#141414",bridges_other:"#1f1f1f",bridges_minor:"#1f1f1f",bridges_link:"#292929",bridges_medium:"#292929",bridges_major:"#292929",bridges_highway:"#292929",roads_label_minor:"#525252",roads_label_minor_halo:"#141414",roads_label_major:"#5c5c5c",roads_label_major_halo:"#141414",ocean_label:"#707070",peak_label:"#707070",subplace_label:"#5c5c5c",subplace_label_halo:"#141414",city_circle:"#000000",city_circle_stroke:"#666666",city_label:"#999999",city_label_halo:"#141414",state_label:"#3d3d3d",state_label_halo:"#141414",country_label:"#707070"},Yi={light:Ri,dark:ji,white:Oi,grayscale:Xi,black:Ii},it=Yi;var Yr=W(Q(),1),Vr=W(Ir(),1);var ce=W(Q(),1);var Ve=(t,e,r)=>{let n=[];for(let i of t){let s=[];for(let a of i)s.push(a.clone().mult(e).add(r));n.push(s)}return n},Ye=(t,e)=>{let r=1<<e;return t<0?r+t:t>=r?t%r:t},st=class{constructor(e,r,n){this.tileCache=e,this.maxDataLevel=r,this.levelDiff=n}dataTilesForBounds(e,r){let n=B(2,e)/B(2,Math.ceil(e)),i=[],s=1,a=this.tileCache.tileSize;if(e<this.levelDiff)s=1/(1<<this.levelDiff-e)*n,i.push({dataTile:{z:0,x:0,y:0},origin:new ce.default(0,0),scale:s,dim:a*s});else if(e<=this.levelDiff+this.maxDataLevel){let o=1<<this.levelDiff,l=256*n,c=Math.ceil(e)-this.levelDiff,u=Math.floor(r.minX/o/l),h=Math.floor(r.minY/o/l),p=Math.floor(r.maxX/o/l),y=Math.floor(r.maxY/o/l);for(let _=u;_<=p;_++)for(let k=h;k<=y;k++){let f=new ce.default(_*o*l,k*o*l);i.push({dataTile:{z:c,x:Ye(_,c),y:Ye(k,c)},origin:f,scale:n,dim:a*n})}}else{let o=1<<this.levelDiff;s=(1<<Math.ceil(e)-this.maxDataLevel-this.levelDiff)*n;let l=Math.floor(r.minX/o/256/s),c=Math.floor(r.minY/o/256/s),u=Math.floor(r.maxX/o/256/s),h=Math.floor(r.maxY/o/256/s);for(let p=l;p<=u;p++)for(let y=c;y<=h;y++){let _=new ce.default(p*o*256*s,y*o*256*s);i.push({dataTile:{z:this.maxDataLevel,x:Ye(p,this.maxDataLevel),y:Ye(y,this.maxDataLevel)},origin:_,scale:s,dim:a*s})}}return i}dataTileForDisplayTile(e){let r,n=1,i=this.tileCache.tileSize,s;if(e.z<this.levelDiff)r={z:0,x:0,y:0},n=1/(1<<this.levelDiff-e.z),s=new ce.default(0,0),i=i*n;else if(e.z<=this.levelDiff+this.maxDataLevel){let a=1<<this.levelDiff;r={z:e.z-this.levelDiff,x:Math.floor(e.x/a),y:Math.floor(e.y/a)},s=new ce.default(r.x*a*256,r.y*a*256)}else{n=1<<e.z-this.maxDataLevel-this.levelDiff;let a=1<<this.levelDiff;r={z:this.maxDataLevel,x:Math.floor(e.x/a/n),y:Math.floor(e.y/a/n)},s=new ce.default(r.x*a*n*256,r.y*a*n*256),i=i*n}return{dataTile:r,scale:n,origin:s,dim:i}}getBbox(e,r){return R(this,null,function*(){let n=this.dataTilesForBounds(e,r);return(yield Promise.all(n.map(s=>this.tileCache.get(s.dataTile)))).map((s,a)=>{let o=n[a];return{data:s,z:e,dataTile:o.dataTile,scale:o.scale,dim:o.dim,origin:o.origin}})})}getDisplayTile(e){return R(this,null,function*(){let r=this.dataTileForDisplayTile(e);return{data:yield this.tileCache.get(r.dataTile),z:e.z,dataTile:r.dataTile,scale:r.scale,origin:r.origin,dim:r.dim}})}queryFeatures(e,r,n,i){let s=Math.round(n),a=Math.min(s-this.levelDiff,this.maxDataLevel),o=i/(1<<s-a);return this.tileCache.queryFeatures(e,r,a,o)}},Ee=t=>{let e=n=>{let i=n.levelDiff===void 0?1:n.levelDiff,s=n.maxDataZoom||15,a;if(typeof n.url=="string")n.url.endsWith(".pmtiles")?a=new ve(n.url,!0):a=new De(n.url,!0);else if(n.url)a=new ve(n.url,!0);else throw new Error(`Invalid source ${n.url}`);let o=new Ae(a,256*1<<i);return new st(o,s,i)},r=new Map;if(t.sources)for(let n in t.sources)r.set(n,e(t.sources[n]));else r.set("",e(t));return r};var Er=(t,e,r)=>{let i=e/256,s=Math.floor(r.minX/256),a=Math.floor(r.minY/256),o=Math.floor(r.maxX/256),l=Math.floor(r.maxY/256),c=Math.log2(i),u=[];for(let h=s;h<=o;h++){let p=h%(1<<t);for(let y=a;y<=l;y++)u.push({display:re({z:t,x:p,y}),key:re({z:t-c,x:Math.floor(p/i),y:Math.floor(y/i)})})}return u},at=class{constructor(e,r){this.tree=new Vr.default,this.current=new Map,this.dim=e,this.maxLabeledTiles=r}hasPrefix(e){for(let r of this.current.keys())if(r.startsWith(e))return!0;return!1}has(e){return this.current.has(e)}size(){return this.current.size}keys(){return this.current.keys()}searchBbox(e,r){let n=new Set;for(let i of this.tree.search(e))i.indexedLabel.order<=r&&n.add(i.indexedLabel);return n}searchLabel(e,r){let n=new Set;for(let i of e.bboxes)for(let s of this.tree.search(i))s.indexedLabel.order<=r&&n.add(s.indexedLabel);return n}bboxCollides(e,r){for(let n of this.tree.search(e))if(n.indexedLabel.order<=r)return!0;return!1}labelCollides(e,r){for(let n of e.bboxes)for(let i of this.tree.search(n))if(i.indexedLabel.order<=r)return!0;return!1}deduplicationCollides(e){if(!e.deduplicationKey||!e.deduplicationDistance)return!1;let r=e.deduplicationDistance,n={minX:e.anchor.x-r,minY:e.anchor.y-r,maxX:e.anchor.x+r,maxY:e.anchor.y+r};for(let i of this.tree.search(n))if(i.indexedLabel.deduplicationKey===e.deduplicationKey&&i.indexedLabel.anchor.dist(e.anchor)<r)return!0;return!1}makeEntry(e){this.current.get(e)&&console.log("consistency error 1");let r=new Set;this.current.set(e,r)}insert(e,r,n){let i={anchor:e.anchor,bboxes:e.bboxes,draw:e.draw,order:r,tileKey:n,deduplicationKey:e.deduplicationKey,deduplicationDistance:e.deduplicationDistance},s=this.current.get(n);if(!s){let l=new Set;this.current.set(n,l),s=l}s.add(i);let a=!1,o=!1;for(let l of e.bboxes)this.tree.insert({minX:l.minX,minY:l.minY,maxX:l.maxX,maxY:l.maxY,indexedLabel:i}),l.minX<0&&(a=!0),l.maxX>this.dim&&(o=!0);if(a||o){let l=a?this.dim:-this.dim,c=[];for(let p of e.bboxes)c.push({minX:p.minX+l,minY:p.minY,maxX:p.maxX+l,maxY:p.maxY});let u={anchor:new Yr.default(e.anchor.x+l,e.anchor.y),bboxes:c,draw:e.draw,order:r,tileKey:n},h=this.current.get(n);h&&h.add(u);for(let p of c)this.tree.insert({minX:p.minX,minY:p.minY,maxX:p.maxX,maxY:p.maxY,indexedLabel:u})}}pruneOrNoop(e){let r=e.split(":"),n,i=0,s=0;for(let a of this.current.keys()){let o=a.split(":");if(o[3]===r[3]){s++;let l=Math.sqrt(B(+o[0]-+r[0],2)+B(+o[1]-+r[1],2));l>i&&(i=l,n=a)}n&&s>this.maxLabeledTiles&&this.pruneKey(n)}}pruneKey(e){let r=this.current.get(e);if(!r)return;let n=[];for(let i of this.tree.all())r.has(i.indexedLabel)&&n.push(i);for(let i of n)this.tree.remove(i);this.current.delete(e)}removeLabel(e){let r=[];for(let i of this.tree.all())e===i.indexedLabel&&r.push(i);for(let i of r)this.tree.remove(i);let n=this.current.get(e.tileKey);n&&n.delete(e)}},ke=class{constructor(e,r,n,i,s){this.index=new at(256*1<<e,i),this.z=e,this.scratch=r,this.labelRules=n,this.callback=s}layout(e){let r=performance.now(),n=new Set;for(let[s,a]of e)for(let o of a){let l=`${re(o.dataTile)}:${s}`;this.index.has(l)||(this.index.makeEntry(l),n.add(l))}let i=new Set;for(let[s,a]of this.labelRules.entries()){if(a.visible===!1||a.minzoom&&this.z<a.minzoom||a.maxzoom&&this.z>a.maxzoom)continue;let o=a.dataSource||"",l=e.get(o);if(!!l)for(let c of l){let u=`${re(c.dataTile)}:${o}`;if(!n.has(u))continue;let h=c.data.get(a.dataLayer);if(h===void 0)continue;let p=h;a.sort&&p.sort((_,k)=>a.sort?a.sort(_.props,k.props):0);let y={index:this.index,zoom:this.z,scratch:this.scratch,order:s,overzoom:this.z-c.dataTile.z};for(let _ of p){if(a.filter&&!a.filter(this.z,_))continue;let k=Ve(_.geom,c.scale,c.origin),f=a.symbolizer.place(y,k,_);if(!!f)for(let d of f){let m=!1;if(!(d.deduplicationKey&&this.index.deduplicationCollides(d))){if(this.index.labelCollides(d,1/0)){if(!this.index.labelCollides(d,s)){let x=this.index.searchLabel(d,1/0);for(let g of x){this.index.removeLabel(g);for(let b of g.bboxes)this.findInvalidatedTiles(i,c.dim,b,u)}this.index.insert(d,s,u),m=!0}}else this.index.insert(d,s,u),m=!0;if(m)for(let x of d.bboxes)(x.maxX>c.origin.x+c.dim||x.minX<c.origin.x||x.minY<c.origin.y||x.maxY>c.origin.y+c.dim)&&this.findInvalidatedTiles(i,c.dim,x,u)}}}}}for(let s of n)this.index.pruneOrNoop(s);return i.size>0&&this.callback&&this.callback(i),performance.now()-r}findInvalidatedTiles(e,r,n,i){let s=Er(this.z,r,n);for(let a of s)a.key!==i&&this.index.hasPrefix(a.key)&&e.add(a.display)}add(e){let r=!0;for(let[i,s]of e)for(let a of s)this.index.has(`${re(a.dataTile)}:${i}`)||(r=!1);return r?0:this.layout(e)}},ze=class{constructor(e,r,n,i){this.labelers=new Map,this.scratch=e,this.labelRules=r,this.maxLabeledTiles=n,this.callback=i}add(e,r){let n=this.labelers.get(e);return n||(n=new ke(e,this.scratch,this.labelRules,this.maxLabeledTiles,this.callback),this.labelers.set(e,n)),n.add(r)}getIndex(e){let r=this.labelers.get(e);if(r)return r.index}};var Ur=W(Q(),1);function Ue(t,e,r,n,i,s,a,o,l){let c=performance.now();t.save(),t.miterLimit=2;for(let u of i){if(u.minzoom&&e<u.minzoom||u.maxzoom&&e>u.maxzoom)continue;let h=r.get(u.dataSource||"");if(!!h)for(let p of h){let y=p.data.get(u.dataLayer);if(y===void 0)continue;u.symbolizer.before&&u.symbolizer.before(t,p.z);let _=p.origin,k=p.dim,f=p.scale;if(t.save(),o){t.beginPath();let d=Math.max(_.x-a.x,s.minX-a.x),m=Math.max(_.y-a.y,s.minY-a.y),x=Math.min(_.x-a.x+k,s.maxX-a.x),g=Math.min(_.y-a.y+k,s.maxY-a.y);t.rect(d,m,x-d,g-m),t.clip()}t.translate(_.x-a.x,_.y-a.y);for(let d of y){let m=d.geom,x=d.bbox;x.maxX*f+_.x<s.minX||x.minX*f+_.x>s.maxX||x.minY*f+_.y>s.maxY||x.maxY*f+_.y<s.minY||u.filter&&!u.filter(p.z,d)||(f!==1&&(m=Ve(m,f,new Ur.default(0,0))),u.symbolizer.draw(t,m,p.z,d))}t.restore()}}if(o&&(t.beginPath(),t.rect(s.minX-a.x,s.minY-a.y,s.maxX-s.minX,s.maxY-s.minY),t.clip()),n){let u=n.searchBbox(s,1/0);for(let h of u)if(t.save(),t.translate(h.anchor.x-a.x,h.anchor.y-a.y),h.draw(t),t.restore(),l){t.lineWidth=.5,t.strokeStyle=l,t.fillStyle=l,t.globalAlpha=1,t.fillRect(h.anchor.x-a.x-2,h.anchor.y-a.y-2,4,4);for(let p of h.bboxes)t.strokeRect(p.minX-a.x,p.minY-a.y,p.maxX-p.minX,p.maxY-p.minY)}}return t.restore(),performance.now()-c}var $e=6378137,$r=85.0511287798,H=$e*Math.PI,Nr=t=>{let e=Math.PI/180,r=Math.max(Math.min($r,t.y),-$r),n=Math.sin(r*e);return new ie.default($e*t.x*e,$e*Math.log((1+n)/(1-n))/2)},Vi=t=>{let e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(t.y/$e))-Math.PI/2)*e,lng:t.x*e/$e}},Ei=(t,e)=>r=>{let n=Nr(r);return new ie.default((n.x+H)/(H*2),1-(n.y+H)/(H*2)).mult((1<<e)*256).sub(t)},Ui=(t,e)=>r=>{let n=new ie.default(r.x,r.y).add(t).div((1<<e)*256),i=new ie.default(n.x*(H*2)-H,(1-n.y)*(H*2)-H);return Vi(i)},At=(t,e)=>{let r=e*(360/t);return Math.log2(r/256)},Bt=class{constructor(e){if(e.theme){let r=it[e.theme];this.paintRules=Xe(r),this.labelRules=Ie(r),this.backgroundColor=r.background}else this.paintRules=e.paintRules||[],this.labelRules=e.labelRules||[],this.backgroundColor=e.backgroundColor;this.views=Ee(e),this.debug=e.debug||""}drawContext(e,r,n,i,s){return R(this,null,function*(){let a=Nr(i),l=new ie.default((a.x+H)/(H*2),1-(a.y+H)/(H*2)).clone().mult(B(2,s)*256).sub(new ie.default(r/2,n/2)),c={minX:l.x,minY:l.y,maxX:l.x+r,maxY:l.y+n},u=[];for(let[m,x]of this.views){let g=x.getBbox(s,c);u.push({key:m,promise:g})}let h=yield Promise.all(u.map(m=>m.promise.then(x=>({status:"fulfilled",value:x,key:m.key}),x=>({status:"rejected",value:[],reason:x,key:m.key})))),p=new Map;for(let m of h)m.status==="fulfilled"&&p.set(m.key,m.value);let y=performance.now(),_=new ke(s,e,this.labelRules,16,void 0),k=_.add(p);this.backgroundColor&&(e.save(),e.fillStyle=this.backgroundColor,e.fillRect(0,0,r,n),e.restore());let f=this.paintRules,d=Ue(e,s,p,_.index,f,c,l,!0,this.debug);if(this.debug){e.save(),e.translate(-l.x,-l.y),e.strokeStyle=this.debug,e.fillStyle=this.debug,e.font="12px sans-serif";let m=0;for(let[x,g]of p){for(let b of g){e.strokeRect(b.origin.x,b.origin.y,b.dim,b.dim);let v=b.dataTile;e.fillText(`${x+(x?" ":"")+v.z} ${v.x} ${v.y}`,b.origin.x+4,b.origin.y+14*(1+m))}m++}e.restore()}return{elapsed:performance.now()-y,project:Ei(l,s),unproject:Ui(l,s)}})}drawCanvas(s,a,o){return R(this,arguments,function*(e,r,n,i={}){let l=window.devicePixelRatio,c=e.clientWidth,u=e.clientHeight;e.width===c*l&&e.height===u*l||(e.width=c*l,e.height=u*l),i.lang&&(e.lang=i.lang);let h=e.getContext("2d");if(!h){console.error("Failed to initialize canvas2d context.");return}return h.setTransform(l,0,0,l,0,0),this.drawContext(h,c,u,r,n)})}drawContextBounds(e,r,n,i,s){return R(this,null,function*(){let a=n.x-r.x,o=new ie.default((r.x+n.x)/2,(r.y+n.y)/2);return this.drawContext(e,i,s,o,At(a,i))})}drawCanvasBounds(a,o,l,c){return R(this,arguments,function*(e,r,n,i,s={}){let u=n.x-r.x,h=new ie.default((r.x+n.x)/2,(r.y+n.y)/2);return this.drawCanvas(e,h,At(u,i),s)})}};var Hr=W(Q(),1);var $i=t=>new Promise(e=>{setTimeout(()=>{e()},t)}),Ni=t=>t.then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e})),Hi=(t={})=>{class e extends L.GridLayer{constructor(n={}){if(n.noWrap&&!n.bounds&&(n.bounds=[[-90,-180],[90,180]]),n.attribution==null&&(n.attribution='<a href="https://protomaps.com">Protomaps</a> \xA9 <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>'),super(n),n.theme){let s=it[n.theme];this.paintRules=Xe(s),this.labelRules=Ie(s),this.backgroundColor=s.background}else this.paintRules=n.paintRules||[],this.labelRules=n.labelRules||[],this.backgroundColor=n.backgroundColor;this.lastRequestedZ=void 0,this.tasks=n.tasks||[],this.views=Ee(n),this.debug=n.debug;let i=document.createElement("canvas").getContext("2d");this.scratch=i,this.onTilesInvalidated=s=>{for(let a of s)this.rerenderTile(a)},this.labelers=new ze(this.scratch,this.labelRules,16,this.onTilesInvalidated),this.tileSize=256*window.devicePixelRatio,this.tileDelay=n.tileDelay||3,this.lang=n.lang}renderTile(n,i,s,a=()=>{}){return R(this,null,function*(){this.lastRequestedZ=n.z;let o=[];for(let[w,z]of this.views){let T=z.getDisplayTile(n);o.push({key:w,promise:T})}let l=yield Promise.all(o.map(w=>w.promise.then(z=>({status:"fulfilled",value:z,key:w.key}),z=>({status:"rejected",reason:z,key:w.key})))),c=new Map;for(let w of l)w.status==="fulfilled"?c.set(w.key,[w.value]):w.reason.name==="AbortError"||console.error(w.reason);if(i.key!==s||this.lastRequestedZ!==n.z||(yield Promise.all(this.tasks.map(Ni)),i.key!==s)||this.lastRequestedZ!==n.z)return;let u=this.labelers.add(n.z,c);if(i.key!==s||this.lastRequestedZ!==n.z)return;let h=this.labelers.getIndex(n.z);if(!this._map)return;let p=this._map.getCenter().wrap(),y=this._getTiledPixelBounds(p),k=this._pxBoundsToTileRange(y).getCenter(),f=n.distanceTo(k)*this.tileDelay;if(yield $i(f),i.key!==s||this.lastRequestedZ!==n.z)return;let d=16,m={minX:256*n.x-d,minY:256*n.y-d,maxX:256*(n.x+1)+d,maxY:256*(n.y+1)+d},x=new Hr.default(256*n.x,256*n.y);i.width=this.tileSize,i.height=this.tileSize;let g=i.getContext("2d");if(!g){console.error("Failed to get Canvas context");return}g.setTransform(this.tileSize/256,0,0,this.tileSize/256,0,0),g.clearRect(0,0,256,256),this.backgroundColor&&(g.save(),g.fillStyle=this.backgroundColor,g.fillRect(0,0,256,256),g.restore());let b=0,v=this.paintRules;if(b=Ue(g,n.z,c,this.xray?null:h,v,m,x,!1,this.debug),this.debug){g.save(),g.fillStyle=this.debug,g.font="600 12px sans-serif",g.fillText(`${n.z} ${n.x} ${n.y}`,4,14),g.font="12px sans-serif";let w=28;for(let[z,T]of c){let M=T[0].dataTile;g.fillText(`${z+(z?" ":"")+M.z} ${M.x} ${M.y}`,4,w),w+=14}g.font="600 10px sans-serif",b>8&&(g.fillText(`${b.toFixed()} ms paint`,4,w),w+=14),u>8&&g.fillText(`${u.toFixed()} ms layout`,4,w),g.strokeStyle=this.debug,g.lineWidth=.5,g.beginPath(),g.moveTo(0,0),g.lineTo(0,256),g.stroke(),g.lineWidth=.5,g.beginPath(),g.moveTo(0,0),g.lineTo(256,0),g.stroke(),g.restore()}a()})}rerenderTile(n){for(let i in this._tiles){let s=this._wrapCoords(this._keyToTileCoords(i));n===this._tileCoordsToKey(s)&&this.renderTile(s,this._tiles[i].el,n)}}queryTileFeaturesDebug(n,i,s=16){let a=new Map;for(let[o,l]of this.views)a.set(o,l.queryFeatures(n,i,this._map.getZoom(),s));return a}clearLayout(){this.labelers=new ze(this.scratch,this.labelRules,16,this.onTilesInvalidated)}rerenderTiles(){for(let n in this._tiles){let i=this._wrapCoords(this._keyToTileCoords(n)),s=this._tileCoordsToKey(i);this.renderTile(i,this._tiles[n].el,s)}}createTile(n,i){let s=L.DomUtil.create("canvas","leaflet-tile");s.lang=this.lang;let a=this._tileCoordsToKey(n);return s.key=a,this.renderTile(n,s,a,()=>{i(void 0,s)}),s}_removeTile(n){let i=this._tiles[n];!i||(i.el.removed=!0,i.el.key=void 0,L.DomUtil.removeClass(i.el,"leaflet-tile-loaded"),i.el.width=i.el.height=0,L.DomUtil.remove(i.el),delete this._tiles[n],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(n)}))}}return new e(t)};function Rt(t){let e=0,r=0;for(let o of t)e+=o.w*o.h,r=Math.max(r,o.w);t.sort((o,l)=>l.h-o.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],s=0,a=0;for(let o of t)for(let l=i.length-1;l>=0;l--){let c=i[l];if(!(o.w>c.w||o.h>c.h)){if(o.x=c.x,o.y=c.y,a=Math.max(a,o.y+o.h),s=Math.max(s,o.x+o.w),o.w===c.w&&o.h===c.h){let u=i.pop();l<i.length&&(i[l]=u)}else o.h===c.h?(c.x+=o.w,c.w-=o.w):o.w===c.w?(c.y+=o.h,c.h-=o.h):(i.push({x:c.x+o.w,y:c.y,w:c.w-o.w,h:o.h}),c.y+=o.h,c.h-=o.h);break}}return{w:s,h:a,fill:e/(s*a)||0}}var qi=(t,e,r)=>{let n=new FontFace(t,`url(${e})`,{weight:r});return document.fonts.add(n),n.load()},qr=t=>R(void 0,null,function*(){return new Promise((e,r)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>r("Invalid SVG"),n.src=t})}),Wi=`
2
2
  <svg width="20px" height="20px" viewBox="0 0 50 50" version="1.1" xmlns="http://www.w3.org/2000/svg">
3
3
  <rect width="50" height="50" fill="#cccccc"/>
4
4
  <g transform="translate(5,5)">
5
5
  <path fill="none" stroke="#666666" stroke-width="7" d="m11,12a8.5,8 0 1,1 17,0q0,4-4,6t-4.5,4.5-.4,4v.2m0,3v7"/>
6
6
  </g>
7
7
  </svg>
8
- `,gi=class{constructor(e){this.src=e,this.canvas=document.createElement("canvas"),this.mapping=new Map,this.missingBox={x:0,y:0,w:0,h:0}}load(){return O(this,null,function*(){let e=this.src,r=window.devicePixelRatio;e.endsWith(".html")&&(e=yield(yield fetch(e)).text());let i=new window.DOMParser().parseFromString(e,"text/html"),n=Array.from(i.body.children),a=yield xi("data:image/svg+xml;base64,"+btoa(la)),s=[{w:a.width*r,h:a.height*r,img:a,id:""}],o=new XMLSerializer;for(let c of n){var l=btoa(o.serializeToString(c)),u="data:image/svg+xml;base64,"+l;let x=yield xi(u);s.push({w:x.width*r,h:x.height*r,img:x,id:c.id})}let f=Yt(s);this.canvas.width=f.w,this.canvas.height=f.h;let d=this.canvas.getContext("2d");if(d)for(let c of s)c.x!==void 0&&c.y!==void 0&&(d.drawImage(c.img,c.x,c.y,c.w,c.h),c.id?this.mapping.set(c.id,{x:c.x,y:c.y,w:c.w,h:c.h}):this.missingBox={x:c.x,y:c.y,w:c.w,h:c.h});return this})}get(e){let r=this.mapping.get(e);return r||(r=this.missingBox),r}};function ht(t,e){return typeof t=="number"?t:e}function Je(t){if(t.includes("$type"))return e=>!0;if(t[0]=="==")return(e,r)=>r.props[t[1]]===t[2];if(t[0]=="!=")return(e,r)=>r.props[t[1]]!==t[2];if(t[0]=="!"){let e=Je(t[1]);return(r,i)=>!e(r,i)}else{if(t[0]==="<")return(e,r)=>ht(r.props[t[1]],1/0)<t[2];if(t[0]==="<=")return(e,r)=>ht(r.props[t[1]],1/0)<=t[2];if(t[0]===">")return(e,r)=>ht(r.props[t[1]],-1/0)>t[2];if(t[0]===">=")return(e,r)=>ht(r.props[t[1]],-1/0)>=t[2];if(t[0]==="in")return(e,r)=>t.slice(2,t.length).includes(r.props[t[1]]);if(t[0]==="!in")return(e,r)=>!t.slice(2,t.length).includes(r.props[t[1]]);if(t[0]==="has")return(e,r)=>r.props.hasOwnProperty(t[1]);if(t[0]==="!has")return(e,r)=>!r.props.hasOwnProperty(t[1]);if(t[0]==="all"){let e=t.slice(1,t.length).map(r=>Je(r));return(r,i)=>e.every(n=>n(r,i))}else if(t[0]==="any"){let e=t.slice(1,t.length).map(r=>Je(r));return(r,i)=>e.some(n=>n(r,i))}else return console.log("Unimplemented filter: ",t[0]),e=>!1}}function ft(t){if(t.base&&t.stops)return r=>j(t.base,t.stops)(r-1);if(t[0]=="interpolate"&&t[1][0]=="exponential"&&t[2]=="zoom"){let r=t.slice(3),i=[];for(var e=0;e<r.length;e+=2)i.push([r[e],r[e+1]]);return n=>j(t[1][1],i)(n-1)}else if(t[0]=="step"&&t[1][0]=="get"){let r=t.slice(2),i=t[1][1];return(n,a)=>{let s=a==null?void 0:a.props[i];if(typeof s=="number"){if(s<r[1])return r[0];for(e=1;e<r.length;e+=2)if(s<=r[e])return r[e+1]}return r[r.length-1]}}else return console.log("Unimplemented numeric fn: ",t),r=>1}function jt(t,e=0){return t?typeof t=="number"?t:(r,i)=>i?ft(t)(r,i):e:e}function Nt(t,e){let r=jt(t,1),i=jt(e);return(n,a)=>{let s=typeof r=="number"?r:r(n,a);return i?s+(typeof i=="number"?i:i(n,a)):s}}function qt(t,e){let r=[];for(let o of t["text-font"])e.hasOwnProperty(o)&&r.push(e[o]);r.length===0&&r.push({face:"sans-serif"});let i=t["text-size"];var n="";r.length&&r[0].weight&&(n=r[0].weight+" ");var a="";if(r.length&&r[0].style&&(a=r[0].style+" "),typeof i=="number")return o=>`${a}${n}${i}px ${r.map(l=>l.face).join(", ")}`;if(i.stops){var s=1.4;i.base?s=i.base:i.base=s;let o=ft(i);return(l,u)=>`${a}${n}${o(l,u)}px ${r.map(f=>f.face).join(", ")}`}else if(i[0]=="step"){let o=ft(i);return(l,u)=>`${a}${n}${o(l,u)}px ${r.map(f=>f.face).join(", ")}`}else return console.log("Can't parse font: ",t),o=>"12px sans-serif"}function ua(t,e){let r=[],i=[],n=new Map;for(var a of t.layers){if(n.set(a.id,a),a.layout&&a.layout.visibility=="none")continue;if(a.ref){let u=n.get(a.ref);a.type=u.type,a.filter=u.filter,a.source=u.source,a["source-layer"]=u["source-layer"]}let l=a["source-layer"];var s,o=void 0;a.filter&&(o=Je(a.filter)),a.type=="fill"?r.push({dataLayer:a["source-layer"],filter:o,symbolizer:new A({fill:a.paint["fill-color"],opacity:a.paint["fill-opacity"]})}):a.type=="fill-extrusion"?r.push({dataLayer:a["source-layer"],filter:o,symbolizer:new A({fill:a.paint["fill-extrusion-color"],opacity:a.paint["fill-extrusion-opacity"]})}):a.type=="line"?a.paint["line-dasharray"]?r.push({dataLayer:a["source-layer"],filter:o,symbolizer:new C({width:Nt(a.paint["line-width"],a.paint["line-gap-width"]),dash:a.paint["line-dasharray"],dashColor:a.paint["line-color"]})}):r.push({dataLayer:a["source-layer"],filter:o,symbolizer:new C({color:a.paint["line-color"],width:Nt(a.paint["line-width"],a.paint["line-gap-width"])})}):a.type=="symbol"?a.layout["symbol-placement"]=="line"?i.push({dataLayer:a["source-layer"],filter:o,symbolizer:new ce({font:qt(a.layout,e),fill:a.paint["text-color"],width:a.paint["text-halo-width"],stroke:a.paint["text-halo-color"],textTransform:a.layout["text-transform"],label_props:a.layout["text-field"]?[a.layout["text-field"]]:void 0})}):i.push({dataLayer:a["source-layer"],filter:o,symbolizer:new U({font:qt(a.layout,e),fill:a.paint["text-color"],stroke:a.paint["text-halo-color"],width:a.paint["text-halo-width"],textTransform:a.layout["text-transform"],label_props:a.layout["text-field"]?[a.layout["text-field"]]:void 0})}):a.type=="circle"&&r.push({dataLayer:a["source-layer"],filter:o,symbolizer:new te({radius:a.paint["circle-radius"],fill:a.paint["circle-color"],stroke:a.paint["circle-stroke-color"],width:a.paint["circle-stroke-width"]})})}return i.reverse(),{paint_rules:r,label_rules:i,tasks:[]}}var ha=t=>{let e=Ot(4,4,s=>{var o=s.getContext("2d");o&&(o.beginPath(),o.rect(0,0,1,1),o.rect(2,2,1,1),o.fillStyle="black",o.fill())});var r="black";t==="lite"&&(r="#d9d9d9");let i=["name:en","name"],n=[{dataLayer:"earth",symbolizer:new A({fill:"white"})},{dataLayer:"landuse",symbolizer:new A({pattern:e}),filter:(s,o)=>o.props.leisure=="park"},{dataLayer:"water",symbolizer:new A({fill:r})},{dataLayer:"roads",symbolizer:new C({color:"#dddddd"}),filter:(s,o)=>o.props["pmap:kind"]==="minor_road"},{dataLayer:"roads",symbolizer:new C({color:"white",width:de(16,[7,9,17,20])}),filter:(s,o)=>o.props["pmap:kind"]==="medium_road"},{dataLayer:"roads",symbolizer:new C({color:"#cccccc",width:de(10,[.2,.2,.2,.4,.8,1.5,4,7,13,16])}),filter:(s,o)=>o.props["pmap:kind"]==="medium_road"},{dataLayer:"roads",symbolizer:new C({color:"white",width:de(11,[1.25,5,5,5,8,11,18,22,30])}),filter:(s,o)=>o.props["pmap:kind"]==="major_road"},{dataLayer:"roads",symbolizer:new C({color:"black",width:de(9,[.15,.5,.7,1,1.5,1.9,5,7,12,18,26])}),filter:(s,o)=>o.props["pmap:kind"]==="major_road"},{dataLayer:"roads",symbolizer:new C({color:"white",width:de(7,[2.25,3.25,4.25,5,6,7,8,9,11,14,24,42,49])}),filter:(s,o)=>o.props["pmap:kind"]==="highway"},{dataLayer:"roads",symbolizer:new C({color:"black",width:de(6,[.1,1.5,1.5,1.5,2,2.5,3,3,4,6,9,15,28,35])}),filter:(s,o)=>o.props["pmap:kind"]==="highway"},{dataLayer:"transit",symbolizer:new C({color:"#888888",dashColor:"#888888",dash:[1,4],dashWidth:3}),filter:(s,o)=>o.props["pmap:kind"]==="railway",minzoom:14},{dataLayer:"transit",symbolizer:new C({color:"#888888"}),filter:(s,o)=>o.props["pmap:kind"]==="railway",minzoom:14},{dataLayer:"buildings",symbolizer:new C({color:"#888888",width:.5})},{dataLayer:"boundaries",symbolizer:new C({color:"black",width:1}),maxzoom:6},{dataLayer:"boundaries",symbolizer:new C({color:"white",width:2.5,dash:[3,1],dashWidth:.3,dashColor:"black"}),minzoom:7}],a=[{dataLayer:"places",symbolizer:new U({label_props:i,fill:"black",stroke:"white",width:1.5,fontFamily:"Inter",fontWeight:300,fontSize:15,justify:X.Center}),filter:(s,o)=>o.props["pmap:kind"]=="country"},{dataLayer:"places",symbolizer:new U({label_props:i,fill:"black",stroke:"white",width:2,fontFamily:"Inter",fontWeight:300,fontSize:12,justify:X.Center}),filter:(s,o)=>o.props["pmap:kind"]=="state"},{dataLayer:"places",symbolizer:new ye([new te({radius:2,fill:"black",stroke:"white",width:2}),new le({label_props:i,offsetX:3,fill:"black",stroke:"white",width:1.5,fontFamily:"Inter",fontWeight:600,fontSize:(s,o)=>o.props["pmap:rank"]==1?15:13})]),sort:(s,o)=>s["pmap:rank"]-o["pmap:rank"],filter:(s,o)=>o.props["pmap:kind"]=="city",maxzoom:8},{dataLayer:"places",symbolizer:new U({label_props:i,justify:X.Center,fill:"black",stroke:"white",width:2,fontFamily:"Inter",fontWeight:600,fontSize:(s,o)=>o.props["pmap:rank"]==1?15:13}),sort:(s,o)=>s["pmap:rank"]-o["pmap:rank"],filter:(s,o)=>o.props["pmap:kind"]=="city",minzoom:9},{dataLayer:"water",symbolizer:new ue({label_props:i,fill:"white",stroke:"black",width:3,font:"italic 400 12px Inter"})},{dataLayer:"landuse",symbolizer:new ue({fill:"black",stroke:"white",width:2,font:"italic 400 12px Inter"})},{dataLayer:"physical_point",symbolizer:new U({label_props:i,fill:"white",stroke:"black",width:3,font:"italic 600 12px Inter",textTransform:"uppercase",justify:X.Center}),filter:(s,o)=>["ocean","sea"].includes(o.props.place)},{dataLayer:"roads",symbolizer:new ce({fill:"black",stroke:"white",width:2,font:"600 14px Inter",offset:4})}];return{tasks:[Ut("Inter","https://cdn.protomaps.com/fonts/woff2/Inter.var.woff2","100 900")],paint_rules:n,label_rules:a,attribution:'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>.'}};return fa;})();
8
+ `,jt=class{constructor(e){this.src=e,this.canvas=document.createElement("canvas"),this.mapping=new Map,this.missingBox={x:0,y:0,w:0,h:0}}load(){return R(this,null,function*(){let e=this.src,r=window.devicePixelRatio;e.endsWith(".html")&&(e=yield(yield fetch(e)).text());let n=new window.DOMParser().parseFromString(e,"text/html"),i=Array.from(n.body.children),s=yield qr(`data:image/svg+xml;base64,${btoa(Wi)}`),a=[{w:s.width*r,h:s.height*r,img:s,id:""}],o=new XMLSerializer;for(let u of i){let p=`data:image/svg+xml;base64,${btoa(o.serializeToString(u))}`,y=yield qr(p);a.push({w:y.width*r,h:y.height*r,img:y,id:u.id})}let l=Rt(a);this.canvas.width=l.w,this.canvas.height=l.h;let c=this.canvas.getContext("2d");if(c)for(let u of a)u.x!==void 0&&u.y!==void 0&&(c.drawImage(u.img,u.x,u.y,u.w,u.h),u.id?this.mapping.set(u.id,{x:u.x,y:u.y,w:u.w,h:u.h}):this.missingBox={x:u.x,y:u.y,w:u.w,h:u.h});return this})}get(e){let r=this.mapping.get(e);return r||(r=this.missingBox),r}};return tn(Zi);})();
9
9
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
@@ -117,7 +117,7 @@ console.log("CONNECT TO",location.pathname + 'socket');
117
117
 
118
118
  var handleData = function(data) {
119
119
  if (Array.isArray(data)) {
120
- //console.log("ARRAY:",data.length);
120
+ // console.log("ARRAY:",data.length);
121
121
  for (var prop in data) {
122
122
  if (data[prop].command) { doCommand(data[prop].command); delete data[prop].command; }
123
123
  if (data[prop].hasOwnProperty("name")) {
@@ -150,10 +150,10 @@ var handleData = function(data) {
150
150
 
151
151
  // handle raw geojson type msg
152
152
  if (data.hasOwnProperty("type") && data.type.indexOf("Feature") === 0) {
153
- if (data.hasOwnProperty('properties') && data.properties.hasOwnProperty('title')) {
154
- doGeojson(data.properties.title,data)
153
+ if (data?.properties?.title) {
154
+ doGeojson(data.properties.title,data,data?.layer,data?.options,data?.icon) // name, geojson, layer, options, icon
155
155
  }
156
- else { doGeojson("geojson",data); }
156
+ else { doGeojson("geojson",data,data?.layer,data?.options,data?.icon); }
157
157
  }
158
158
  // handle TAK json (from tak-ingest node or fastxml node)
159
159
  else if (data.hasOwnProperty("event") && data.event.hasOwnProperty("point")) {
@@ -869,7 +869,8 @@ var feedback = function(n,v,a,c) {
869
869
  if (markers[n]) {
870
870
  console.log("FB1",n,v,a,c)
871
871
  allData[n].action = a || "feedback";
872
- if (v !== undefined) { allData[n][a||"value"] = v; }
872
+ //if (v !== undefined) { allData[n][a||"value"] = v; }
873
+ if (v !== undefined) { allData[n]["value"] = v; }
873
874
  ws.send(JSON.stringify(allData[n]));
874
875
  setMarker(allData[n]);
875
876
  }
@@ -2611,13 +2612,16 @@ function doCommand(cmd) {
2611
2612
  }
2612
2613
  var opt = {};
2613
2614
  if (cmd.map.hasOwnProperty("opt")) { opt = cmd.map.opt || {}; }
2615
+
2616
+ if (!opt.paintRules && !opt.labelRules && !opt.backgroundColor && !opt.theme) {
2617
+ opt.theme = "light"; // light, dark, white, black, grayscale
2618
+ };
2619
+
2614
2620
  opt.url = cmd.map.pmtiles;
2615
2621
  opt.attribution = opt.attribution || '&copy; Protomaps & OSM';
2616
2622
  opt.maxDataZoom = opt.maxDataZoom || 15;
2617
2623
  opt.maxZoom = opt.maxZoom || 20;
2618
- // opt.shade = "grey";
2619
- // opt.dark = false;
2620
- // opt.xray = true;
2624
+
2621
2625
  console.log("New PMtiles:",cmd.map.name,opt);
2622
2626
  basemaps[cmd.map.name] = protomapsL.leafletLayer(opt);
2623
2627
  if (!existsalready) {
@@ -3084,7 +3088,7 @@ function doCommand(cmd) {
3084
3088
  }
3085
3089
 
3086
3090
  // handle any incoming GEOJSON directly - may style badly
3087
- function doGeojson(n,g,l,o) { // name, geojson, layer, options
3091
+ function doGeojson(n,g,l,o,i) { // name, geojson, layer, options, icon
3088
3092
  var lay = l ?? g.name ?? "unknown";
3089
3093
  // if (!basemaps[lay]) {
3090
3094
  var opt = { style: function(feature) {
@@ -3132,13 +3136,14 @@ function doGeojson(n,g,l,o) { // name, geojson, layer, options
3132
3136
  additionalInformation:feature.properties.modifier,
3133
3137
  size:25
3134
3138
  });
3139
+ var anc = myMarker.getAnchor();
3135
3140
  if (myMarker.hasOwnProperty("metadata") && myMarker.metadata.hasOwnProperty("echelon")) {
3136
3141
  var sz = iconSz[myMarker.metadata.echelon];
3137
3142
  myMarker.setOptions({size:sz});
3138
3143
  }
3139
3144
  myMarker = L.icon({
3140
3145
  iconUrl: myMarker.toDataURL(),
3141
- iconAnchor: [myMarker.getAnchor().x, myMarker.getAnchor().y],
3146
+ iconAnchor: [anc.x, anc.y],
3142
3147
  className: "natoicon",
3143
3148
  });
3144
3149
  }
@@ -3156,7 +3161,7 @@ function doGeojson(n,g,l,o) { // name, geojson, layer, options
3156
3161
  }
3157
3162
  else {
3158
3163
  myMarker = L.VectorMarkers.icon({
3159
- icon: feature.properties["marker-symbol"] ?? "circle",
3164
+ icon: feature.properties["marker-symbol"] ?? i ?? "circle",
3160
3165
  markerColor: (feature.properties["marker-color"] ?? "#910000"),
3161
3166
  prefix: 'fa',
3162
3167
  iconColor: 'white'
package/worldmap.js CHANGED
@@ -129,13 +129,14 @@ module.exports = function(RED) {
129
129
  if (node.name) { c.toptitle = node.name; }
130
130
  //console.log("INIT",c)
131
131
  client.write(JSON.stringify({command:c}));
132
- for (var p=0; p<pmtiles.length; p++) {
132
+ for (var p=0; p < pmtiles.length; p++) {
133
133
  fs.symlink(RED.settings.userDir+'/'+pmtiles[p], __dirname+'/worldmap/'+pmtiles[p], 'file', (err) => {
134
134
  if (err) {
135
135
  if (err.code !== "EEXIST") { console.log(err); }
136
136
  }
137
137
  })
138
138
  client.write(JSON.stringify({command: {map: {name:pmtiles[p].split('.')[0], pmtiles:pmtiles[p], opt:pmtilesopts }}}));
139
+ node.log("Added pmtiles file: "+pmtiles[p]);
139
140
  }
140
141
  var o = Object.values(allPoints);
141
142
  o.map(v => delete v.tout);
@@ -200,7 +201,6 @@ module.exports = function(RED) {
200
201
  if (msg.payload.ttl && msg.payload.ttl < t) { t = msg.payload.ttl; }
201
202
  allPoints[msg.payload.name].tout = setTimeout( function() { delete allPoints[msg.payload.name] }, t * 1000 );
202
203
  }
203
-
204
204
  if (msg?.payload?.command?.map?.delete) {
205
205
  var ddd = msg.payload.command.map.delete;
206
206
  if (!Array.isArray(ddd)) { ddd = [cmd.map.delete]; }
@@ -214,8 +214,8 @@ module.exports = function(RED) {
214
214
  }
215
215
  }
216
216
  }
217
-
218
217
  });
218
+
219
219
  node.on("close", function() {
220
220
  for (var c in clients) {
221
221
  if (clients.hasOwnProperty(c)) {
@@ -232,6 +232,7 @@ module.exports = function(RED) {
232
232
  }
233
233
  node.status({});
234
234
  });
235
+
235
236
  sockets[node.path].on('connection', callback);
236
237
  }
237
238
  var WorldMap = function(n) {