@prushforth/map 1.0.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +89 -0
  3. package/demo/index.html +78 -0
  4. package/dist/cjs/AttributionButton-DgbgLHy4.js +106 -0
  5. package/dist/cjs/MapTileLayer-D4vp8bR4.js +454 -0
  6. package/dist/cjs/app-globals-DY--Q2Nl.js +775 -0
  7. package/dist/cjs/calculatePosition-CDcdNl7C.js +92 -0
  8. package/dist/cjs/gcds-ext-map.cjs.js +47 -0
  9. package/dist/cjs/gcds-ext-map_2.cjs.entry.js +8081 -0
  10. package/dist/cjs/index-CW_WOSnc.js +32697 -0
  11. package/dist/cjs/index.cjs.js +2 -0
  12. package/dist/cjs/loader.cjs.js +14 -0
  13. package/dist/cjs/locale-_4nEyxeO.js +153 -0
  14. package/dist/cjs/map-a.cjs.entry.js +16 -0
  15. package/dist/cjs/map-caption.cjs.entry.js +55 -0
  16. package/dist/cjs/map-extent.cjs.entry.js +993 -0
  17. package/dist/cjs/map-feature.cjs.entry.js +636 -0
  18. package/dist/cjs/map-featurecaption.cjs.entry.js +14 -0
  19. package/dist/cjs/map-geometry.cjs.entry.js +36 -0
  20. package/dist/cjs/map-input.cjs.entry.js +348 -0
  21. package/dist/cjs/map-link.cjs.entry.js +6055 -0
  22. package/dist/cjs/map-meta.cjs.entry.js +40 -0
  23. package/dist/cjs/map-properties.cjs.entry.js +14 -0
  24. package/dist/cjs/map-select.cjs.entry.js +100 -0
  25. package/dist/cjs/map-span.cjs.entry.js +14 -0
  26. package/dist/cjs/map-style.cjs.entry.js +127 -0
  27. package/dist/cjs/map-tile.cjs.entry.js +274 -0
  28. package/dist/cjs/renderStyles-yOMXvf12.js +59 -0
  29. package/dist/collection/assets/canada.json +1 -0
  30. package/dist/collection/assets/images/w3community.ico +0 -0
  31. package/dist/collection/assets/mapml/en/apstile/arctic +18 -0
  32. package/dist/collection/assets/mapml/en/cbmtile/canvec +22 -0
  33. package/dist/collection/assets/mapml/en/cbmtile/cbmt +24 -0
  34. package/dist/collection/assets/mapml/en/cbmtile/cbmtgeom +20 -0
  35. package/dist/collection/assets/mapml/en/cbmtile/cbmtsimple +20 -0
  36. package/dist/collection/assets/mapml/en/cbmtile/current_conditions +33 -0
  37. package/dist/collection/assets/mapml/en/cbmtile/toporama +25 -0
  38. package/dist/collection/assets/mapml/en/custom/arcticsdi.mapml +18 -0
  39. package/dist/collection/assets/mapml/en/osmtile/cbmt +24 -0
  40. package/dist/collection/assets/mapml/en/osmtile/current_conditions +32 -0
  41. package/dist/collection/assets/mapml/en/osmtile/dark.mapml +19 -0
  42. package/dist/collection/assets/mapml/en/osmtile/light.mapml +19 -0
  43. package/dist/collection/assets/mapml/en/osmtile/osm +19 -0
  44. package/dist/collection/assets/mapml/en/osmtile/toporama +25 -0
  45. package/dist/collection/assets/mapml/fr/apstile/arctic +19 -0
  46. package/dist/collection/assets/mapml/fr/cbmtile/canvec +22 -0
  47. package/dist/collection/assets/mapml/fr/cbmtile/cbmt +24 -0
  48. package/dist/collection/assets/mapml/fr/cbmtile/cbmtgeom +20 -0
  49. package/dist/collection/assets/mapml/fr/cbmtile/cbmtsimple +20 -0
  50. package/dist/collection/assets/mapml/fr/cbmtile/current_conditions +25 -0
  51. package/dist/collection/assets/mapml/fr/cbmtile/toporama +25 -0
  52. package/dist/collection/assets/mapml/fr/osmtile/cbmt +24 -0
  53. package/dist/collection/assets/mapml/fr/osmtile/current_conditions +24 -0
  54. package/dist/collection/assets/mapml/fr/osmtile/dark.mapml +19 -0
  55. package/dist/collection/assets/mapml/fr/osmtile/light.mapml +19 -0
  56. package/dist/collection/assets/mapml/fr/osmtile/osm +19 -0
  57. package/dist/collection/assets/mapml/fr/osmtile/toporama +25 -0
  58. package/dist/collection/assets/pmtiles/darkTheme.js +19 -0
  59. package/dist/collection/assets/pmtiles/lightTheme.js +19 -0
  60. package/dist/collection/collection-manifest.json +28 -0
  61. package/dist/collection/components/gcds-ext-map/assets/pmtiles/darkTheme.js +19 -0
  62. package/dist/collection/components/gcds-ext-map/assets/pmtiles/lightTheme.js +19 -0
  63. package/dist/collection/components/gcds-ext-map/gcds-ext-map.css +2138 -0
  64. package/dist/collection/components/gcds-ext-map/gcds-ext-map.js +1517 -0
  65. package/dist/collection/components/gcds-ext-map/stories/gcds-ext-map.stories.js +367 -0
  66. package/dist/collection/components/map-a/map-a.js +89 -0
  67. package/dist/collection/components/map-caption/map-caption.js +52 -0
  68. package/dist/collection/components/map-extent/map-extent.js +809 -0
  69. package/dist/collection/components/map-feature/map-feature.js +724 -0
  70. package/dist/collection/components/map-featurecaption/map-featurecaption.js +6 -0
  71. package/dist/collection/components/map-geometry/map-geometry.js +57 -0
  72. package/dist/collection/components/map-input/map-input.js +355 -0
  73. package/dist/collection/components/map-layer/map-layer.js +1245 -0
  74. package/dist/collection/components/map-layer/stories/map-layer.stories.js +101 -0
  75. package/dist/collection/components/map-link/map-link.js +1149 -0
  76. package/dist/collection/components/map-meta/map-meta.js +82 -0
  77. package/dist/collection/components/map-properties/map-properties.js +7 -0
  78. package/dist/collection/components/map-select/map-select.js +145 -0
  79. package/dist/collection/components/map-span/map-span.js +7 -0
  80. package/dist/collection/components/map-style/map-style.js +144 -0
  81. package/dist/collection/components/map-tile/map-tile.js +370 -0
  82. package/dist/collection/components/utils/mapml/DOMTokenList.js +123 -0
  83. package/dist/collection/components/utils/mapml/DefaultMapOptions.js +11 -0
  84. package/dist/collection/components/utils/mapml/Util.js +1601 -0
  85. package/dist/collection/components/utils/mapml/control/AttributionButton.js +101 -0
  86. package/dist/collection/components/utils/mapml/control/FullscreenButton.js +181 -0
  87. package/dist/collection/components/utils/mapml/control/GeolocationButton.js +70 -0
  88. package/dist/collection/components/utils/mapml/control/LayerControl.js +212 -0
  89. package/dist/collection/components/utils/mapml/control/ReloadButton.js +75 -0
  90. package/dist/collection/components/utils/mapml/control/ScaleBar.js +108 -0
  91. package/dist/collection/components/utils/mapml/control/SearchButton.js +565 -0
  92. package/dist/collection/components/utils/mapml/elementSupport/extents/createLayerControlForExtent.js +259 -0
  93. package/dist/collection/components/utils/mapml/elementSupport/inputs/heightInput.js +18 -0
  94. package/dist/collection/components/utils/mapml/elementSupport/inputs/hiddenInput.js +19 -0
  95. package/dist/collection/components/utils/mapml/elementSupport/inputs/locationInput.js +127 -0
  96. package/dist/collection/components/utils/mapml/elementSupport/inputs/widthInput.js +18 -0
  97. package/dist/collection/components/utils/mapml/elementSupport/inputs/zoomInput.js +30 -0
  98. package/dist/collection/components/utils/mapml/elementSupport/layers/calculatePosition.js +88 -0
  99. package/dist/collection/components/utils/mapml/elementSupport/layers/createLayerControlForLayer.js +326 -0
  100. package/dist/collection/components/utils/mapml/elementSupport/layers/renderStyles.js +55 -0
  101. package/dist/collection/components/utils/mapml/elementSupport/viewers/matchMedia.js +251 -0
  102. package/dist/collection/components/utils/mapml/features/featureRenderer.js +342 -0
  103. package/dist/collection/components/utils/mapml/features/geometry.js +268 -0
  104. package/dist/collection/components/utils/mapml/features/path.js +485 -0
  105. package/dist/collection/components/utils/mapml/handlers/AnnounceMovement.js +154 -0
  106. package/dist/collection/components/utils/mapml/handlers/ContextMenu.js +1436 -0
  107. package/dist/collection/components/utils/mapml/handlers/FeatureIndex.js +116 -0
  108. package/dist/collection/components/utils/mapml/handlers/QueryHandler.js +476 -0
  109. package/dist/collection/components/utils/mapml/handlers/keyboard.js +60 -0
  110. package/dist/collection/components/utils/mapml/layers/Crosshair.js +108 -0
  111. package/dist/collection/components/utils/mapml/layers/DebugOverlay.js +357 -0
  112. package/dist/collection/components/utils/mapml/layers/FeatureIndexOverlay.js +239 -0
  113. package/dist/collection/components/utils/mapml/layers/ImageLayer.js +136 -0
  114. package/dist/collection/components/utils/mapml/layers/MapExtentLayer.js +114 -0
  115. package/dist/collection/components/utils/mapml/layers/MapFeatureLayer.js +623 -0
  116. package/dist/collection/components/utils/mapml/layers/MapLayer.js +640 -0
  117. package/dist/collection/components/utils/mapml/layers/MapTileLayer.js +450 -0
  118. package/dist/collection/components/utils/mapml/layers/TemplatedFeaturesOrTilesLayer.js +346 -0
  119. package/dist/collection/components/utils/mapml/layers/TemplatedImageLayer.js +276 -0
  120. package/dist/collection/components/utils/mapml/layers/TemplatedPMTilesLayer.js +135 -0
  121. package/dist/collection/components/utils/mapml/layers/TemplatedTileLayer.js +664 -0
  122. package/dist/collection/components/utils/utils.js +26 -0
  123. package/dist/collection/fonts/icons/LICENSE.txt +92 -0
  124. package/dist/collection/fonts/icons/README.md +543 -0
  125. package/dist/collection/fonts/icons/gcds-icons.css +110 -0
  126. package/dist/collection/fonts/icons/gcds-icons.eot +0 -0
  127. package/dist/collection/fonts/icons/gcds-icons.svg +82 -0
  128. package/dist/collection/fonts/icons/gcds-icons.ttf +0 -0
  129. package/dist/collection/fonts/icons/gcds-icons.woff +0 -0
  130. package/dist/collection/fonts/lato/LICENSE.txt +48 -0
  131. package/dist/collection/fonts/lato/README.md +195 -0
  132. package/dist/collection/fonts/lato/gcds-lato-italic.woff +0 -0
  133. package/dist/collection/fonts/lato/gcds-lato-italic.woff2 +0 -0
  134. package/dist/collection/fonts/lato/gcds-lato.css +30 -0
  135. package/dist/collection/fonts/lato/gcds-lato.woff +0 -0
  136. package/dist/collection/fonts/lato/gcds-lato.woff2 +0 -0
  137. package/dist/collection/fonts/noto-sans/LICENSE.txt +43 -0
  138. package/dist/collection/fonts/noto-sans/README.md +423 -0
  139. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold-italic.woff +0 -0
  140. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold-italic.woff2 +0 -0
  141. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold.woff +0 -0
  142. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold.woff2 +0 -0
  143. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light-italic.woff +0 -0
  144. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light-italic.woff2 +0 -0
  145. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light.woff +0 -0
  146. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light.woff2 +0 -0
  147. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium-italic.woff +0 -0
  148. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium-italic.woff2 +0 -0
  149. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium.woff +0 -0
  150. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium.woff2 +0 -0
  151. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular-italic.woff +0 -0
  152. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular-italic.woff2 +0 -0
  153. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular.woff +0 -0
  154. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular.woff2 +0 -0
  155. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff +0 -0
  156. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff2 +0 -0
  157. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold.woff +0 -0
  158. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold.woff2 +0 -0
  159. package/dist/collection/fonts/noto-sans/gcds-noto-sans.css +89 -0
  160. package/dist/collection/fonts/noto-sans-mono/LICENSE.txt +93 -0
  161. package/dist/collection/fonts/noto-sans-mono/README.md +135 -0
  162. package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.css +17 -0
  163. package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.woff +0 -0
  164. package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.woff2 +0 -0
  165. package/dist/collection/generated/locale.js +148 -0
  166. package/dist/collection/global/mapml-globals.js +916 -0
  167. package/dist/collection/index.js +1 -0
  168. package/dist/collection/leaflet-src.esm.js +14419 -0
  169. package/dist/components/gcds-ext-map.d.ts +11 -0
  170. package/dist/components/gcds-ext-map.js +10 -0
  171. package/dist/components/index.d.ts +35 -0
  172. package/dist/components/index.js +1 -0
  173. package/dist/components/map-a.d.ts +11 -0
  174. package/dist/components/map-a.js +1 -0
  175. package/dist/components/map-caption.d.ts +11 -0
  176. package/dist/components/map-caption.js +1 -0
  177. package/dist/components/map-extent.d.ts +11 -0
  178. package/dist/components/map-extent.js +1 -0
  179. package/dist/components/map-feature.d.ts +11 -0
  180. package/dist/components/map-feature.js +1 -0
  181. package/dist/components/map-featurecaption.d.ts +11 -0
  182. package/dist/components/map-featurecaption.js +1 -0
  183. package/dist/components/map-geometry.d.ts +11 -0
  184. package/dist/components/map-geometry.js +1 -0
  185. package/dist/components/map-input.d.ts +11 -0
  186. package/dist/components/map-input.js +1 -0
  187. package/dist/components/map-layer.d.ts +11 -0
  188. package/dist/components/map-layer.js +1 -0
  189. package/dist/components/map-link.d.ts +11 -0
  190. package/dist/components/map-link.js +1 -0
  191. package/dist/components/map-meta.d.ts +11 -0
  192. package/dist/components/map-meta.js +1 -0
  193. package/dist/components/map-properties.d.ts +11 -0
  194. package/dist/components/map-properties.js +1 -0
  195. package/dist/components/map-select.d.ts +11 -0
  196. package/dist/components/map-select.js +1 -0
  197. package/dist/components/map-span.d.ts +11 -0
  198. package/dist/components/map-span.js +1 -0
  199. package/dist/components/map-style.d.ts +11 -0
  200. package/dist/components/map-style.js +1 -0
  201. package/dist/components/map-tile.d.ts +11 -0
  202. package/dist/components/map-tile.js +1 -0
  203. package/dist/components/p-B4YLD_Og.js +1 -0
  204. package/dist/components/p-BE41zrui.js +1 -0
  205. package/dist/components/p-Bpv_U_Lb.js +1 -0
  206. package/dist/components/p-CwRxGZga.js +5 -0
  207. package/dist/components/p-EYVT9Efh.js +1 -0
  208. package/dist/components/p-gwC_yeRa.js +1 -0
  209. package/dist/esm/AttributionButton-CfaoSLCu.js +103 -0
  210. package/dist/esm/MapTileLayer-DvC_iOIS.js +451 -0
  211. package/dist/esm/app-globals-De5ze2BD.js +773 -0
  212. package/dist/esm/calculatePosition-B4YLD_Og.js +90 -0
  213. package/dist/esm/gcds-ext-map.js +43 -0
  214. package/dist/esm/gcds-ext-map_2.entry.js +8078 -0
  215. package/dist/esm/index-BUsJ7i5g.js +32656 -0
  216. package/dist/esm/index.js +1 -0
  217. package/dist/esm/loader.js +12 -0
  218. package/dist/esm/locale-Bpv_U_Lb.js +150 -0
  219. package/dist/esm/map-a.entry.js +14 -0
  220. package/dist/esm/map-caption.entry.js +53 -0
  221. package/dist/esm/map-extent.entry.js +991 -0
  222. package/dist/esm/map-feature.entry.js +634 -0
  223. package/dist/esm/map-featurecaption.entry.js +12 -0
  224. package/dist/esm/map-geometry.entry.js +34 -0
  225. package/dist/esm/map-input.entry.js +346 -0
  226. package/dist/esm/map-link.entry.js +6035 -0
  227. package/dist/esm/map-meta.entry.js +38 -0
  228. package/dist/esm/map-properties.entry.js +12 -0
  229. package/dist/esm/map-select.entry.js +98 -0
  230. package/dist/esm/map-span.entry.js +12 -0
  231. package/dist/esm/map-style.entry.js +125 -0
  232. package/dist/esm/map-tile.entry.js +272 -0
  233. package/dist/esm/renderStyles-EYVT9Efh.js +57 -0
  234. package/dist/gcds-ext-map/assets/canada.json +1 -0
  235. package/dist/gcds-ext-map/assets/images/w3community.ico +0 -0
  236. package/dist/gcds-ext-map/assets/mapml/en/apstile/arctic +18 -0
  237. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/canvec +22 -0
  238. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmt +24 -0
  239. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmtgeom +20 -0
  240. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmtsimple +20 -0
  241. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/current_conditions +33 -0
  242. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/toporama +25 -0
  243. package/dist/gcds-ext-map/assets/mapml/en/custom/arcticsdi.mapml +18 -0
  244. package/dist/gcds-ext-map/assets/mapml/en/osmtile/cbmt +24 -0
  245. package/dist/gcds-ext-map/assets/mapml/en/osmtile/current_conditions +32 -0
  246. package/dist/gcds-ext-map/assets/mapml/en/osmtile/dark.mapml +19 -0
  247. package/dist/gcds-ext-map/assets/mapml/en/osmtile/light.mapml +19 -0
  248. package/dist/gcds-ext-map/assets/mapml/en/osmtile/osm +19 -0
  249. package/dist/gcds-ext-map/assets/mapml/en/osmtile/toporama +25 -0
  250. package/dist/gcds-ext-map/assets/mapml/fr/apstile/arctic +19 -0
  251. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/canvec +22 -0
  252. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmt +24 -0
  253. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmtgeom +20 -0
  254. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmtsimple +20 -0
  255. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/current_conditions +25 -0
  256. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/toporama +25 -0
  257. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/cbmt +24 -0
  258. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/current_conditions +24 -0
  259. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/dark.mapml +19 -0
  260. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/light.mapml +19 -0
  261. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/osm +19 -0
  262. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/toporama +25 -0
  263. package/dist/gcds-ext-map/assets/pmtiles/darkTheme.js +19 -0
  264. package/dist/gcds-ext-map/assets/pmtiles/lightTheme.js +19 -0
  265. package/dist/gcds-ext-map/fonts/icons/LICENSE.txt +92 -0
  266. package/dist/gcds-ext-map/fonts/icons/README.md +543 -0
  267. package/dist/gcds-ext-map/fonts/icons/gcds-icons.css +110 -0
  268. package/dist/gcds-ext-map/fonts/icons/gcds-icons.eot +0 -0
  269. package/dist/gcds-ext-map/fonts/icons/gcds-icons.svg +82 -0
  270. package/dist/gcds-ext-map/fonts/icons/gcds-icons.ttf +0 -0
  271. package/dist/gcds-ext-map/fonts/icons/gcds-icons.woff +0 -0
  272. package/dist/gcds-ext-map/fonts/lato/LICENSE.txt +48 -0
  273. package/dist/gcds-ext-map/fonts/lato/README.md +195 -0
  274. package/dist/gcds-ext-map/fonts/lato/gcds-lato-italic.woff +0 -0
  275. package/dist/gcds-ext-map/fonts/lato/gcds-lato-italic.woff2 +0 -0
  276. package/dist/gcds-ext-map/fonts/lato/gcds-lato.css +30 -0
  277. package/dist/gcds-ext-map/fonts/lato/gcds-lato.woff +0 -0
  278. package/dist/gcds-ext-map/fonts/lato/gcds-lato.woff2 +0 -0
  279. package/dist/gcds-ext-map/fonts/noto-sans/LICENSE.txt +43 -0
  280. package/dist/gcds-ext-map/fonts/noto-sans/README.md +423 -0
  281. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold-italic.woff +0 -0
  282. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold-italic.woff2 +0 -0
  283. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold.woff +0 -0
  284. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold.woff2 +0 -0
  285. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light-italic.woff +0 -0
  286. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light-italic.woff2 +0 -0
  287. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light.woff +0 -0
  288. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light.woff2 +0 -0
  289. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium-italic.woff +0 -0
  290. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium-italic.woff2 +0 -0
  291. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium.woff +0 -0
  292. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium.woff2 +0 -0
  293. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular-italic.woff +0 -0
  294. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular-italic.woff2 +0 -0
  295. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular.woff +0 -0
  296. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular.woff2 +0 -0
  297. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff +0 -0
  298. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff2 +0 -0
  299. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold.woff +0 -0
  300. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold.woff2 +0 -0
  301. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans.css +89 -0
  302. package/dist/gcds-ext-map/fonts/noto-sans-mono/LICENSE.txt +93 -0
  303. package/dist/gcds-ext-map/fonts/noto-sans-mono/README.md +135 -0
  304. package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.css +17 -0
  305. package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.woff +0 -0
  306. package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.woff2 +0 -0
  307. package/dist/gcds-ext-map/gcds-ext-map.esm.js +1 -0
  308. package/dist/gcds-ext-map/index.esm.js +0 -0
  309. package/dist/gcds-ext-map/leaflet-src.esm.js +14419 -0
  310. package/dist/gcds-ext-map/p-1b22f774.entry.js +1 -0
  311. package/dist/gcds-ext-map/p-29b4ba34.entry.js +1 -0
  312. package/dist/gcds-ext-map/p-2dd09d44.entry.js +1 -0
  313. package/dist/gcds-ext-map/p-3fef47e5.entry.js +1 -0
  314. package/dist/gcds-ext-map/p-4e324a1d.entry.js +1 -0
  315. package/dist/gcds-ext-map/p-4f4a6873.entry.js +1 -0
  316. package/dist/gcds-ext-map/p-9cc5ad37.entry.js +1 -0
  317. package/dist/gcds-ext-map/p-9edfea7d.entry.js +1 -0
  318. package/dist/gcds-ext-map/p-B4YLD_Og.js +1 -0
  319. package/dist/gcds-ext-map/p-B8Id5Ptd.js +1 -0
  320. package/dist/gcds-ext-map/p-BUsJ7i5g.js +6 -0
  321. package/dist/gcds-ext-map/p-Bpv_U_Lb.js +1 -0
  322. package/dist/gcds-ext-map/p-CtOuMgy9.js +1 -0
  323. package/dist/gcds-ext-map/p-Dd474fsL.js +1 -0
  324. package/dist/gcds-ext-map/p-EYVT9Efh.js +1 -0
  325. package/dist/gcds-ext-map/p-a67d721d.entry.js +1 -0
  326. package/dist/gcds-ext-map/p-b16e862b.entry.js +1 -0
  327. package/dist/gcds-ext-map/p-b9cbf1e0.entry.js +10 -0
  328. package/dist/gcds-ext-map/p-cab5246e.entry.js +1 -0
  329. package/dist/gcds-ext-map/p-d58d409b.entry.js +1 -0
  330. package/dist/gcds-ext-map/p-dfa21368.entry.js +1 -0
  331. package/dist/gcds-ext-map/p-f211048a.entry.js +1 -0
  332. package/dist/index.cjs.js +1 -0
  333. package/dist/index.js +1 -0
  334. package/dist/types/components/gcds-ext-map/gcds-ext-map.d.ts +125 -0
  335. package/dist/types/components/gcds-ext-map/stories/gcds-ext-map.stories.d.ts +230 -0
  336. package/dist/types/components/map-a/map-a.d.ts +7 -0
  337. package/dist/types/components/map-caption/map-caption.d.ts +7 -0
  338. package/dist/types/components/map-extent/map-extent.d.ts +53 -0
  339. package/dist/types/components/map-feature/map-feature.d.ts +50 -0
  340. package/dist/types/components/map-featurecaption/map-featurecaption.d.ts +3 -0
  341. package/dist/types/components/map-geometry/map-geometry.d.ts +7 -0
  342. package/dist/types/components/map-input/map-input.d.ts +24 -0
  343. package/dist/types/components/map-layer/map-layer.d.ts +85 -0
  344. package/dist/types/components/map-layer/stories/map-layer.stories.d.ts +96 -0
  345. package/dist/types/components/map-link/map-link.d.ts +66 -0
  346. package/dist/types/components/map-meta/map-meta.d.ts +11 -0
  347. package/dist/types/components/map-properties/map-properties.d.ts +3 -0
  348. package/dist/types/components/map-select/map-select.d.ts +13 -0
  349. package/dist/types/components/map-span/map-span.d.ts +5 -0
  350. package/dist/types/components/map-style/map-style.d.ts +17 -0
  351. package/dist/types/components/map-tile/map-tile.d.ts +32 -0
  352. package/dist/types/components/utils/mapml/DOMTokenList.d.ts +30 -0
  353. package/dist/types/components/utils/mapml/elementSupport/inputs/heightInput.d.ts +7 -0
  354. package/dist/types/components/utils/mapml/elementSupport/inputs/hiddenInput.d.ts +7 -0
  355. package/dist/types/components/utils/mapml/elementSupport/inputs/locationInput.d.ts +14 -0
  356. package/dist/types/components/utils/mapml/elementSupport/inputs/widthInput.d.ts +7 -0
  357. package/dist/types/components/utils/mapml/elementSupport/inputs/zoomInput.d.ts +11 -0
  358. package/dist/types/components/utils/mapml/layers/MapLayer.d.ts +69 -0
  359. package/dist/types/components/utils/utils.d.ts +2 -0
  360. package/dist/types/components.d.ts +521 -0
  361. package/dist/types/gcds-ext-map.d.ts +17 -0
  362. package/dist/types/generated/locale.d.ts +146 -0
  363. package/dist/types/index.d.ts +11 -0
  364. package/dist/types/stencil-public-runtime.d.ts +1861 -0
  365. package/loader/cdn.js +1 -0
  366. package/loader/index.cjs.js +1 -0
  367. package/loader/index.d.ts +24 -0
  368. package/loader/index.es2017.js +1 -0
  369. package/loader/index.js +2 -0
  370. package/package.json +87 -0
@@ -0,0 +1 @@
1
+ import{r}from"./p-BUsJ7i5g.js";const s=class{constructor(s){r(this,s)}render(){return null}};export{s as map_properties}
@@ -0,0 +1 @@
1
+ import{r as t,g as i,U as s}from"./p-BUsJ7i5g.js";import{m as e}from"./p-B8Id5Ptd.js";import{c as h}from"./p-B4YLD_Og.js";const n=class{constructor(i){t(this,i)}get el(){return i(this)}row;col;zoom;src;_parentEl;_tileLayer;_extent;_initialRow;_initialCol;_initialZoom;_hasConnected=!1;srcChanged(t,i){i!==t&&(this._extent&&this._calculateExtent(),this._tileLayer&&(this._tileLayer.removeMapTile(this.el),this._tileLayer.addMapTile(this.el)))}connectedCallback(){this._initialRow=this.el.hasAttribute("row")?+this.el.getAttribute("row"):this.row??0,this._initialCol=this.el.hasAttribute("col")?+this.el.getAttribute("col"):this.col??0;let t=0;if(this.el.hasAttribute("zoom"))t=+this.el.getAttribute("zoom");else if(void 0!==this.zoom)t=this.zoom;else{const i=this._getMetaZoomValue();t=null!==i?i:this.getMapEl()?.zoom||0}this._initialZoom=t,this._hasConnected=!0;const i=this.el.getAttribute.bind(this.el),s=this.el.setAttribute.bind(this.el);this.el.getAttribute=t=>{if(this._hasConnected)switch(t){case"row":return String(this._initialRow);case"col":return String(this._initialCol);case"zoom":return String(this._initialZoom)}return i(t)},this.el.setAttribute=(t,i)=>{if(this._hasConnected)switch(t){case"row":case"col":case"zoom":return}s(t,i)},Object.defineProperties(this.el,{row:{get:()=>this._initialRow,configurable:!0},col:{get:()=>this._initialCol,configurable:!0},zoom:{get:()=>this._initialZoom,configurable:!0}});const e=this.el.parentNode;this._parentEl="MAP-LAYER"===e.nodeName||"LAYER-"===e.nodeName||"MAP-LINK"===e.nodeName?e:e.host,(new Image).src=this.src||"",this._createOrGetTileLayer()}disconnectedCallback(){if(this._tileLayer&&(this._tileLayer.removeMapTile(this.el),this._tileLayer._mapTiles&&0===this._tileLayer._mapTiles.length)){this._tileLayer.remove(),this._tileLayer=null,delete this._tileLayer;const t=this?._parentEl?._layerRegistry?.get(this.position);t&&(t.count--,0===t.count&&this._parentEl._layerRegistry.delete(this.position))}}get rowValue(){return this._hasConnected?this._initialRow:+this.row}get colValue(){return this._hasConnected?this._initialCol:+this.col}get zoomValue(){return this._hasConnected?this._initialZoom:+this.zoom}get extent(){return this._extent||this._calculateExtent(),this._extent}get position(){return h(this.el)}isFirst(){return!this._parentEl._layerRegistry.has(this.position)}getPrevious(){return this.isFirst()?null:this.el.previousElementSibling}async zoomTo(){const t=this.extent,i=this.getMapEl()?._map;if(!t||!i)return;const e=t.bottomRight.pcrs.horizontal,h=t.topLeft.pcrs.vertical,n=window.L.bounds(window.L.point(t.topLeft.pcrs.horizontal,t.bottomRight.pcrs.vertical),window.L.point(e,h)),o=i.options.crs.unproject(n.getCenter(!0));i.setView(o,s.getMaxZoom(n,i,t.zoom.minZoom,t.zoom.maxZoom),{animate:!1})}getMapEl(){return s.getClosest(this.el,"gcds-ext-map")}getLayerEl(){return s.getClosest(this.el,"map-layer,layer-")}_getMetaZoomValue(){const t=this.getLayerEl();if(!t)return null;const i=t.querySelector('map-meta[name="zoom"][content]');if(!i)return null;const s=i.getAttribute("content");if(!s)return null;const e=s.match(/value=(\d+)/);return e&&e[1]?parseInt(e[1],10):null}getMeta(t){const i=t.toLowerCase();if("cs"!==i&&"zoom"!==i&&"projection"!==i)return;const s=this._parentEl?.shadowRoot?.querySelector(`map-meta[name=${i}][content]`);return"MAP-LINK"===this._parentEl?.nodeName?s||this._parentEl.parentElement?.getMeta(t):this._parentEl?.src?this._parentEl.shadowRoot?.querySelector(`map-meta[name=${i}][content]`):this._parentEl.querySelector(`map-meta[name=${i}][content]`)}async _createOrGetTileLayer(){if(!this._parentEl?.whenReady)return;await this._parentEl.whenReady();const t=this._parentEl;if(this.isFirst())this._tileLayer=e({projection:this.getMapEl()?.projection,opacity:1,pane:t._templatedLayer?.getContainer?.()||t._layer?.getContainer?.(),zIndex:this.position}),this._tileLayer.addMapTile(this.el),t._templatedLayer?.addLayer?t._templatedLayer.addLayer(this._tileLayer):t._layer?.addLayer?.(this._tileLayer),this.el._tileLayer=this._tileLayer,t._layerRegistry.set(this.position,{layer:this._tileLayer,count:1});else{const i=t._layerRegistry.get(this.position);this._tileLayer=i?.layer,i&&i.count++,this._tileLayer&&(this._tileLayer.addMapTile(this.el),this.el._tileLayer=this._tileLayer)}}_calculateExtent(){const t=this.getMapEl();if(!t||!t._map)return;const i=t._map,e=i.options.projection,h=window.M[e].options.crs.tile.bounds.max.x,n=this.colValue*h,o=this.rowValue*h,r=window.L.bounds(window.L.point(n,o),window.L.point(n+h,o+h)),a=s.pixelToPCRSBounds(r,this.zoomValue,e);this._extent=s._convertAndFormatPCRS(a,i.options.crs,e),this._extent.zoom={minZoom:this.zoomValue,maxZoom:this.zoomValue,minNativeZoom:this.zoomValue,maxNativeZoom:this.zoomValue}}render(){return null}static get watchers(){return{src:[{srcChanged:0}]}}};export{n as map_tile}
@@ -0,0 +1 @@
1
+ import{U as t,l as i,r as s,g as e}from"./p-BUsJ7i5g.js";class h{name;min;max;value;step;layer;constructor(t,i,s,e,h,r){this.name=t,this.min=i,this.max=s,this.value=e,this.step=h,this.layer=r}validateInput(){return!!this.name}getValue(){return this.layer._map.options.mapEl.zoom}}class r{name;value;constructor(t,i){this.name=t,this.value=i}validateInput(){return!(!this.name||!this.value)}getValue(){return this.value}}class n{name;layer;constructor(t,i){this.name=t,this.layer=i}validateInput(){return!!this.name}getValue(){return this.layer._map.getSize().x}}class a{name;layer;constructor(t,i){this.name=t,this.layer=i}validateInput(){return!!this.name}getValue(){return this.layer._map.getSize().y}}class l{name;position;axis;units;min;max;rel;layer;constructor(i,s,e,h,r,n,a,l){this.name=i,this.position=s,this.axis=e,this.units=h||!e||["i","j"].includes(e)?h:t.axisToCS(e).toLowerCase(),this.min=r,this.max=n,this.rel=a,this.layer=l}validateInput(){if(!this.name||!this.axis)return!1;if(("i"===this.axis||"j"===this.axis)&&!["map","tile"].includes(this.units))return!1;if(this.units){let i=t.axisToCS(this.axis);if("string"==typeof i&&i.toUpperCase()!==this.units.toUpperCase())return!1}return!0}_TCRSToPCRS(t,i){const s=this.layer._map.options.crs;return s.transformation.untransform(t,s.scale(i))}getValue(t,s){if(void 0===t&&(t=this.layer._map.getZoom()),void 0===s&&(s=this.layer._map.getPixelBounds()),"pcrs"===this.units||"gcrs"===this.units)switch(this.axis){case"longitude":case"easting":if(!this.position)return this._TCRSToPCRS(s.min,t).x;if(this.position.match(/.*?-left/i))return this._TCRSToPCRS(s.min,t).x;if(this.position.match(/.*?-right/i))return this._TCRSToPCRS(s.max,t).x;break;case"latitude":case"northing":if(!this.position)return this._TCRSToPCRS(s.min,t).y;if(this.position.match(/top-.*?/i))return this._TCRSToPCRS(s.min,t).y;if(this.position.match(/bottom-.*?/i))return this._TCRSToPCRS(s.max,t).y}else if("tilematrix"===this.units){const t=this.layer._map.getCenter(),s=this.layer._extentLayer._templates[0].layer,e=s._getTiledPixelBounds(t),h=s._pxBoundsToTileRange(e),r=[];for(let t=h.min.y;t<=h.max.y;t++)for(let e=h.min.x;e<=h.max.x;e++){const h=new i.Point(e,t);h.z=s._tileZoom,r.push(h)}return r}}}const c=class{constructor(t){s(this,t)}get el(){return e(this)}name;type;value;axis;units;position;rel;min;max;step;input;_layer;initialValue;getMapEl(){return t.getClosest(this.el,"gcds-ext-map")}getLayerEl(){return t.getClosest(this.el,"map-layer,layer-")}async connectedCallback(){try{switch(this.el.getMapEl=this.getMapEl.bind(this),this.el.getLayerEl=this.getLayerEl.bind(this),this.type){case"zoom":this.initialValue=+this.el.getAttribute("value"),this.el.initialValue=this.initialValue,this.input=new h(this.name,this.min,this.max,this.initialValue,this.step,this._layer);break;case"location":this.input=new l(this.name,this.position,this.axis,this.units,this.min,this.max,this.rel,this._layer);break;case"width":this.input=new n(this.name,this._layer);break;case"height":this.input=new a(this.name,this._layer);break;case"hidden":this.input=new r(this.name,this.value)}}catch(t){console.log(t,"\nin mapInput.connectedCallback")}}disconnectedCallback(){}checkValidity(){if(this.input?.validateInput())return!0;{const t=new Event("invalid",{bubbles:!0,cancelable:!0,composed:!0});return this.el.dispatchEvent(t),!1}}reportValidity(){if(this.input?.validateInput())return!0;{const t=new Event("invalid",{bubbles:!0,cancelable:!0,composed:!0});return this.el.dispatchEvent(t),console.log("Input type='"+this.type+"' is not valid!"),!1}}async whenReady(){return new Promise(((t,i)=>{let s,e;this.input?t():(s=setInterval((function(h){h.input?(clearInterval(s),clearTimeout(e),t()):h.el.isConnected||(clearInterval(s),clearTimeout(e),i("map-input was disconnected while waiting to be ready"))}),300,this),e=setTimeout((function(){clearInterval(s),clearTimeout(e),i("Timeout reached waiting for input to be ready")}),1e4))}))}render(){return null}};export{c as map_input}
@@ -0,0 +1 @@
1
+ import{r as t,g as e,U as i,M as s,f as h,l as n,p as a}from"./p-BUsJ7i5g.js";import{c as o}from"./p-B4YLD_Og.js";const r=class{constructor(e){t(this,e)}get el(){return e(this)}zoom;min;max;_featureLayer;_geometry;_groupEl;_observer;_parentEl;_initialZoom;_getFeatureExtent;zoomChanged(t,e){e!==t&&this._featureLayer&&this.reRender(this._featureLayer)}minChanged(t,e){e!==t&&this._featureLayer&&this.reRender(this._featureLayer)}maxChanged(t,e){e!==t&&this._featureLayer&&this.reRender(this._featureLayer)}get zoomValue(){let t={},e=this.getMeta("zoom");return e&&(t=i._metaContentToObject(e.getAttribute("content"))),"MAP-LINK"===this._parentEl?.nodeName?+(this.el.hasAttribute("zoom")?this.el.getAttribute("zoom"):t.value?t.value:t.max?t.max:this._initialZoom??this.getMapEl()?.zoom??0):+(this.el.hasAttribute("zoom")?this.el.getAttribute("zoom"):this._initialZoom??this.getMapEl()?.zoom??0)}get minValue(){let t={},e=this.getMeta("zoom");return e&&(t=i._metaContentToObject(e.getAttribute("content"))),"MAP-LINK"===this._parentEl?.nodeName?+(this.el.hasAttribute("min")?this.el.getAttribute("min"):t.min?t.min:this._parentEl.getZoomBounds().minZoom):+(this.el.hasAttribute("min")?this.el.getAttribute("min"):t.min?t.min:0)}get maxValue(){let t={},e=this.getMeta("zoom");e&&(t=i._metaContentToObject(e.getAttribute("content")));let s=this.getMapEl()?._map?.options.crs.options.resolutions.length-1;return"MAP-LINK"===this._parentEl?.nodeName?+(this.el.hasAttribute("max")?this.el.getAttribute("max"):t.max?t.max:this._parentEl.getZoomBounds().maxZoom):+(this.el.hasAttribute("max")?this.el.getAttribute("max"):t.max?t.max:s)}get extent(){if(this.el.isConnected)return this._getFeatureExtent||(this._getFeatureExtent=this._memoizeExtent()),this._getFeatureExtent()}get position(){return o(this.el)}getMapEl(){return i.getClosest(this.el,"gcds-ext-map")}getLayerEl(){return i.getClosest(this.el,"map-layer,layer-")}async connectedCallback(){this._initialZoom=this.getMapEl()?.zoom,this._parentEl="MAP-LAYER"===this.el.parentNode?.nodeName||"LAYER-"===this.el.parentNode?.nodeName||"MAP-LINK"===this.el.parentNode?.nodeName?this.el.parentNode:this.el.parentNode?.host,this.getLayerEl()?.hasAttribute("data-moving")||this._parentEl?.parentElement?.hasAttribute("data-moving")||(this.el.getMapEl=this.getMapEl.bind(this),this.el.getLayerEl=this.getLayerEl.bind(this),this.el.zoomTo=this.zoomTo.bind(this),this.el.getZoomToZoom=this.getZoomToZoom.bind(this),this.el.click=this.click.bind(this),this.el.focus=this.focus.bind(this),this.el.blur=this.blur.bind(this),this.el.mapml2geojson=this.mapml2geojson.bind(this),this.el.addFeature=this.addFeature.bind(this),this.el.removeFeature=this.removeFeature.bind(this),this.el.reRender=this.reRender.bind(this),Object.defineProperty(this.el,"zoom",{get:()=>this.zoomValue,configurable:!0,enumerable:!0}),Object.defineProperty(this.el,"extent",{get:()=>this.extent,configurable:!0,enumerable:!0}),Object.defineProperty(this.el,"position",{get:()=>this.position,configurable:!0,enumerable:!0}),"MAP-LAYER"!==this._parentEl?.nodeName&&"LAYER-"!==this._parentEl?.nodeName&&"MAP-LINK"!==this._parentEl?.nodeName||this._createOrGetFeatureLayer(),Object.defineProperty(this.el,"_featureLayer",{get:()=>this._featureLayer,configurable:!0,enumerable:!0}),Object.defineProperty(this.el,"_geometry",{get:()=>this._geometry,configurable:!0,enumerable:!0}),this._observer=new MutationObserver((t=>{for(let e of t){if("attributes"===e.type&&e.target===this.el)return;this.reRender(this._featureLayer)}})),this._observer.observe(this.el,{childList:!0,subtree:!0,attributes:!0,attributeOldValue:!0,characterData:!0}))}disconnectedCallback(){if(this.getLayerEl()?.hasAttribute("data-moving")||this._parentEl?.parentElement?.hasAttribute("data-moving"))return;this._observer?.disconnect(),this._featureLayer&&(this.removeFeature(this._featureLayer),0===this._featureLayer.getLayers().length&&(this._featureLayer.options.renderer&&this._featureLayer.options.renderer.remove(),this._featureLayer.remove(),this._featureLayer=null,delete this._featureLayer));const t=this?._parentEl?._layerRegistry?.get(this.position);t&&(t.count--,0===t.count&&this._parentEl._layerRegistry.delete(this.position))}reRender(t){if(this._groupEl?.isConnected){let e=this._getFallbackCS(),i=document.createElement("span");this._groupEl.insertAdjacentElement("beforebegin",i),t._staticFeature&&t._removeFromFeaturesList(this._geometry),t.removeLayer(this._geometry),this._geometry=t.createGeometry(this.el,e).addTo(t),this._groupEl=this.el._groupEl,i.replaceWith(this._geometry.options.group),t._validateRendering(),delete this._getFeatureExtent,this._setUpEvents()}}removeFeature(t){t.removeLayer(this._geometry),t._staticFeature&&t._removeFromFeaturesList(this._geometry),t.options.properties=null,delete this._geometry,this._getFeatureExtent&&delete this._getFeatureExtent}addFeature(t){if(this._featureLayer=t,!this.el.querySelector("map-geometry"))return;let e=this._getFallbackCS();this._geometry=t.createGeometry(this.el,e),this._geometry&&(this._groupEl=this.el._groupEl,this._geometry._layerEl=this.getLayerEl(),t.addLayer(this._geometry),this._setUpEvents())}getPrevious(){return this.isFirst()?null:this.el.previousElementSibling}isFirst(){return!this._parentEl._layerRegistry.has(this.position)}_createOrGetFeatureLayer(){this._parentEl.whenReady().then((()=>{const t="MAP-LINK"===this._parentEl.nodeName,e=t?this._parentEl._templatedLayer:this._parentEl._layer,i=this._parentEl;if(this.isFirst()&&e){let a=i.getMapEl()._map;this._featureLayer=new s(null,{renderer:h(),pane:e.getContainer(),...t&&i.getBounds()?{layerBounds:i.getBounds()}:{},...t?{zoomBounds:this._getZoomBounds()}:{},...t?{}:{_leafletLayer:i._layer},zIndex:this.position,projection:a.options.projection,mapEl:i.getMapEl(),onEachFeature:function(t,e){if(t){const s={autoClose:!1,autoPan:!0,maxHeight:.5*a.getSize().y-50,maxWidth:.7*a.getSize().x,minWidth:165};var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,s)}}}),n.extend(this._featureLayer.options,{_leafletLayer:Object.assign(this._featureLayer,{_layerEl:this.getLayerEl()})}),i._layerRegistry.set(this.position,{layer:this._featureLayer,count:1}),this.addFeature(this._featureLayer),e.addLayer(this._featureLayer)}else{const t=i._layerRegistry.get(this.position);this._featureLayer=t?.layer,t&&t.count++,this._featureLayer&&this.addFeature(this._featureLayer)}})).catch((t=>{console.log("Error waiting for parent layer to be ready:",t)}))}_setUpEvents(){["click","focus","blur","keyup","keydown"].forEach((t=>{this._groupEl.addEventListener(t,(e=>{if("click"===t){let i=new PointerEvent(t,{cancelable:!0});i.originalEvent=e,this.el.dispatchEvent(i)}else if("keyup"===t||"keydown"===t){let i=new KeyboardEvent(t,{cancelable:!0});i.originalEvent=e,this.el.dispatchEvent(i)}else{let i=new FocusEvent(t,{cancelable:!0});i.originalEvent=e,this.el.dispatchEvent(i)}}))}))}_getFallbackCS(){let t;if("MAP-LINK"===this._parentEl?.nodeName)t=this._parentEl.shadowRoot?.querySelector("map-meta[name=cs][content]")||this._parentEl.parentElement?.getMeta?.("cs");else{let e=this.getLayerEl();t=e?.src?e.shadowRoot?.querySelector("map-meta[name=cs][content]"):e?.querySelector("map-meta[name=cs][content]")}return t?i._metaContentToObject(t.getAttribute("content")).content:"gcrs"}_memoizeExtent(){let t;return()=>{if(t&&this._getFeatureExtent)return t;{let e=this.getMapEl()._map,s=this.el.querySelector("map-geometry"),h=s?.getAttribute("cs")||this._getFallbackCS(),a=this.zoomValue,o=s?.querySelectorAll("map-point, map-linestring, map-polygon, map-multipoint, map-multilinestring"),r=[1/0,1/0,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];if(o)for(let t of Array.from(o)){let e=t.querySelectorAll("map-coordinates");for(let i=0;i<e.length;++i)r=this._updateExtent(t,e[i],r)}let l=n.point(r[0],r[1]),m=n.point(r[2],r[3]),c=i.boundsToPCRSBounds(n.bounds(l,m),a,e.options.projection,h);if(1===o?.length&&"MAP-POINT"===o[0].tagName.toUpperCase()){let t=e.options.projection,s=this.el.hasAttribute("max")?+this.el.getAttribute("max"):M[t].options.resolutions.length-1,h=M[t].options.crs.tile.bounds.getCenter(),a=M[t].transformation.transform(c.min,M[t].scale(+this.zoomValue||s));c=i.pixelToPCRSBounds(n.bounds(a.subtract(h),a.add(h)),this.zoomValue||s,t)}let u=Object.assign(i._convertAndFormatPCRS(c,e.options.crs,e.options.projection),{zoom:this._getZoomBounds()});return t=u,u}}}_updateExtent(t,e,s){let h=e.innerHTML.trim().replace(/<[^>]+>/g,"").replace(/\s+/g," ").split(/[<>\ ]/g);switch(t.tagName.toUpperCase()){case"MAP-POINT":s=i._updateExtent(s,+h[0],+h[1]);break;case"MAP-LINESTRING":case"MAP-POLYGON":case"MAP-MULTIPOINT":case"MAP-MULTILINESTRING":for(let t=0;t<h.length;t+=2)s=i._updateExtent(s,+h[t],+h[t+1])}return s}_getZoomBounds(){return{minZoom:this.minValue,maxZoom:this.maxValue,minNativeZoom:this.zoomValue,maxNativeZoom:this.zoomValue}}getZoomToZoom(){let t,e=this.extent.topLeft.pcrs,s=this.extent.bottomRight.pcrs,h=n.bounds(n.point(e.horizontal,e.vertical),n.point(s.horizontal,s.vertical)),a=this.getMapEl()._map.options.projection,o=this.getLayerEl().extent.zoom,r=o.minZoom?o.minZoom:0,l=o.maxZoom?o.maxZoom:M[a].options.resolutions.length-1;return this.el.hasAttribute("zoom")?t=this.zoomValue:(t=i.getMaxZoom(h,this.getMapEl()._map,r,l),this.maxValue<t?t=this.maxValue:this.minValue>t&&(t=this.minValue)),t<r?t=r:t>l&&(t=l),t}getMeta(t){let e=t.toLowerCase();if("cs"!==e&&"zoom"!==e&&"projection"!==e)return null;let i=this._parentEl?.shadowRoot?.querySelector(`map-meta[name=${e}][content]`);return"MAP-LINK"===this._parentEl?.nodeName?i||this._parentEl.parentElement?.getMeta?.(t):this._parentEl?.src?this._parentEl.shadowRoot?.querySelector(`map-meta[name=${e}][content]`):this._parentEl?.querySelector(`map-meta[name=${e}][content]`)}mapml2geojson(t){t=Object.assign({},{propertyFunction:null,transform:!0},t);let e={type:"Feature",properties:{},geometry:{}},s=this.el.querySelector("map-properties");if(s)if("function"==typeof t.propertyFunction)e.properties=t.propertyFunction(s);else if(s.querySelector("table")){let t=s.querySelector("table").cloneNode(!0);e.properties=i._table2properties(t)}else e.properties={prop0:s.innerHTML.replace(/(<([^>]+)>)/gi,"").replace(/\s/g,"")};else e.properties=null;let h=null,n=null,o=this.getMapEl()._map;t.transform&&(h=new a.Proj(o.options.crs.code),n=new a.Proj("EPSG:4326"),"EPSG:3857"!==o.options.crs.code&&"EPSG:4326"!==o.options.crs.code||(t.transform=!1));let r=this.el.querySelector("map-geometry")?.querySelector("map-geometrycollection"),l=this.el.querySelector("map-geometry")?.querySelectorAll("map-point, map-polygon, map-linestring, map-multipoint, map-multipolygon, map-multilinestring");if(r){if(e.geometry.type="GeometryCollection",e.geometry.geometries=[],l)for(let s of Array.from(l))e.geometry.geometries.push(i._geometry2geojson(s,h,n,t.transform))}else l&&l.length>0&&(e.geometry=i._geometry2geojson(l[0],h,n,t.transform));return e}click(){let t=this._groupEl,e=t.getBoundingClientRect(),i=new MouseEvent("click",{clientX:e.x+e.width/2,clientY:e.y+e.height/2,button:0}),s=this.el.querySelector("map-properties");if("link"===t.getAttribute("role"))for(let e of t.children)e.mousedown?.call(this._geometry,i),e.mouseup?.call(this._geometry,i);let h=new PointerEvent("click",{cancelable:!0});if(h.originalEvent=i,this.el.dispatchEvent(h),s&&this.el.isConnected){let t=this._geometry,e=t._layers;for(let t in e)e[t].isPopupOpen()&&e[t].closePopup();t.isPopupOpen()?t.closePopup():h.originalEvent.cancelBubble||t.openPopup()}}focus(t){this._groupEl?.focus(t)}blur(){document.activeElement?.shadowRoot?.activeElement!==this._groupEl&&document.activeElement?.shadowRoot?.activeElement?.parentNode!==this._groupEl||(this._groupEl.blur(),this.getMapEl()?._map?.getContainer().focus())}zoomTo(){let t=this.extent,e=this.getMapEl()._map,i=t.topLeft.pcrs,s=t.bottomRight.pcrs,h=n.bounds(n.point(i.horizontal,i.vertical),n.point(s.horizontal,s.vertical)),a=e.options.crs.unproject(h.getCenter(!0));e.setView(a,this.getZoomToZoom(),{animate:!1})}async whenReady(){return new Promise(((t,e)=>{let i,s;this.el.addFeature?t():(i=setInterval((function(e){e.addFeature&&(clearInterval(i),clearTimeout(s),t())}),200,this.el),s=setTimeout((function(){clearInterval(i),clearTimeout(s),e("Timeout reached waiting for feature to be ready")}),5e3))}))}render(){return null}static get watchers(){return{zoom:[{zoomChanged:0}],min:[{minChanged:0}],max:[{maxChanged:0}]}}};export{r as map_feature}
@@ -0,0 +1 @@
1
+ import{r as t,g as s}from"./p-BUsJ7i5g.js";const i=class{constructor(s){t(this,s)}get el(){return s(this)}observer;connectedCallback(){"GCDS-EXT-MAP"===this.el.parentElement.nodeName&&setTimeout((()=>{if(this.el.parentElement.querySelector("map-caption")!==this.el)return;let t=this.el.innerText;this.observer=new MutationObserver((()=>{let s=this.el.innerText;s!==t&&(this.el.parentElement.setAttribute("aria-label",s),t=s)})),this.observer.observe(this.el,{characterData:!0,subtree:!0,attributes:!0,childList:!0}),this.el.parentElement.hasAttribute("aria-label")||this.el.parentElement.setAttribute("aria-label",this.el.innerText)}),0)}disconnectedCallback(){this.observer&&this.observer.disconnect()}render(){return null}};export{i as map_caption}
@@ -0,0 +1 @@
1
+ import{r as e,g as t}from"./p-BUsJ7i5g.js";const s=class{constructor(t){e(this,t)}get el(){return t(this)}name;selectDetails;htmlSelect;connectedCallback(){this._createLayerControlForSelect(),this.el.selectdetails=this.selectDetails,this.el.htmlselect=this.htmlSelect}disconnectedCallback(){}nameChanged(e,t){}_createLayerControlForSelect(){this.htmlSelect=this.transcribe();const e=document.createElement("details");e.className="mapml-layer-item-details mapml-control-layers";const t=document.createElement("summary"),s=document.createElement("label");s.innerText=this.name||"",this.el.hasAttribute("id")&&s.setAttribute("for",this.el.getAttribute("id")),t.appendChild(s),e.appendChild(t),e.appendChild(this.htmlSelect),this.selectDetails=e,this.htmlSelect.addEventListener("change",(()=>{this.el.parentElement?._extentLayer?.redraw?.()}))}transcribe(){const e=document.createElement("select"),t=this.el.getAttributeNames();for(let s=0;s<t.length;s++)e.setAttribute(t[s],this.el.getAttribute(t[s]));const s=this.el.querySelectorAll("map-option");for(let t=0;t<s.length;t++){const a=document.createElement("option"),n=s[t].getAttributeNames();for(let e=0;e<n.length;e++)a.setAttribute(n[e],s[t].getAttribute(n[e]));a.innerHTML=s[t].innerHTML,e.appendChild(a)}return e}async whenReady(){return new Promise(((e,t)=>{let s,a;this.selectDetails?e():(s=setInterval((function(n){n.selectDetails?(clearInterval(s),clearTimeout(a),e()):n.el.isConnected||(clearInterval(s),clearTimeout(a),t("map-select was disconnected while waiting to be ready"))}),300,this),a=setTimeout((function(){clearInterval(s),clearTimeout(a),t("Timeout reached waiting for map-select to be ready")}),1e4))}))}render(){return null}static get watchers(){return{name:[{nameChanged:0}]}}};export{s as map_select}
@@ -0,0 +1 @@
1
+ import{r as s,g as t}from"./p-BUsJ7i5g.js";const a=class{constructor(t){s(this,t)}get el(){return t(this)}connectedCallback(){}disconnectedCallback(){}};export{a as map_span}
@@ -0,0 +1 @@
1
+ import{l as t,U as e,M as i,c as s,r,g as n}from"./p-BUsJ7i5g.js";import"./p-B8Id5Ptd.js";import{r as a}from"./p-EYVT9Efh.js";function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var h=t.ImageOverlay.extend({initialize:function(e,i,s,r,n,a){this._container=n,this._url=e,this._location=i,this._size=t.point(s),this._angle=r,t.setOptions(this,a)},getEvents:function(){var t={viewreset:this._reset};return this._zoomAnimated&&this._step<=1&&(t.zoomanim=this._animateZoom),t},onAdd:function(){this.on({load:this._onImageLoad}),this._image||this._initImage(),this.options.interactive&&(t.DomUtil.addClass(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this._container.appendChild(this._image),this._reset()},onRemove:function(){t.DomUtil.remove(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},_onImageLoad:function(){this._image&&(this._image.loaded=+new Date,this._updateOpacity())},_animateZoom:function(e){var i=this._map.getZoomScale(e.zoom),s=this._map.getPixelOrigin().add(this._location).multiplyBy(i).subtract(this._map._getNewPixelOrigin(e.center,e.zoom)).round();t.Browser.any3d?t.DomUtil.setTransform(this._image,s,i):t.DomUtil.setPosition(this._image,s)},_reset:function(e){var i=this._image,s=this._size;e&&this._step>1&&(void 0===this._overlayToRemove||this._url===this._overlayToRemove)||(t.DomUtil.setPosition(i,this._location),i.style.width=s.x+"px",i.style.height=s.y+"px")},_updateOpacity:function(){if(this._map){var e=+new Date,i=!1,s=this._image,r=Math.min(1,(e-s.loaded)/200);t.DomUtil.setOpacity(s,r),r<1&&(i=!0),i&&(t.Util.cancelAnimFrame(this._fadeFrame),this._fadeFrame=t.Util.requestAnimFrame(this._updateOpacity,this)),t.DomUtil.addClass(s,"leaflet-image-loaded")}}}),l=t.Layer.extend({initialize:function(e,i){this._template=e,this._container=t.DomUtil.create("div","leaflet-layer"),t.DomUtil.addClass(this._container,"mapml-image-container"),this._linkEl=i.linkEl,this.zoomBounds=i.zoomBounds,this.extentBounds=i.extentBounds,delete i.zoomBounds,delete i.extentBounds,t.setOptions(this,t.extend(i,this._setUpExtentTemplateVars(e)))},getEvents:function(){return{moveend:this._onMoveEnd,zoomstart:this._clearLayer}},onAdd:function(t){this._map=t,this.options.pane.appendChild(this._container),this.setZIndex(this.options.zIndex),this._onAdd()},redraw:function(){this._onMoveEnd()},isVisible:function(){let t=this._linkEl.getMapEl()._map,i=t.getZoom(),s=e.pixelToPCRSBounds(t.getPixelBounds(),i,t.options.projection);return i<=this.zoomBounds.maxZoom&&i>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(s)},_clearLayer:function(){let t=this._container.querySelectorAll("img");for(let e=0;e<t.length;e++)this._container.removeChild(t[e])},_addImage:function(t,e,i){let s=this._map,r=this._imageOverlay,n=this.getImageUrl(t,e),a=s.getSize();this._imageOverlay=function(t,e,i,s,r){return new h(t,e,i,0,r,void 0)}(n,i,a,0,this._container),this._imageOverlay._step=this._template.step,this._imageOverlay.addTo(s),r&&(this._imageOverlay._overlayToRemove=r._url,this._imageOverlay.on("load error",(function(){s.removeLayer(r)})))},_scaleImage:function(e,i){let s=this;setTimeout((function(){if(!s._map)return;let r=s._template.step,n=Math.floor(i/r)*r,a=s._map.getZoomScale(i,n),o=e.min.multiplyBy(a).subtract(s._map._getNewPixelOrigin(s._map.getCenter(),i)).round();t.DomUtil.setTransform(s._imageOverlay._image,o,a)}))},_onAdd:function(){let t=this._map.getZoom(),e=t,i=this._template.step;t%i!=0&&(e=Math.floor(t/i)*i);let s=this._map.getPixelBounds(this._map.getCenter(),e);this._pixelOrigins={},this._pixelOrigins[e]=s.min;let r=this._map.getPixelBounds().min.subtract(this._map.getPixelOrigin());this._addImage(s,e,r),t!==e&&this._scaleImage(s,t)},_onMoveEnd:function(e){let i=this._map.getZoom(),s=this._map.options.mapEl._history,r=s[s.length-1],n=s[s.length-2];n||(n=r);let a=this._template.step,o=Math.floor(i/a)*a,h=this._map.getPixelBounds(this._map.getCenter(),o);if("1"!==a&&(i+1)%a==0&&r.zoom===n.zoom-1)this._addImage(h,o,t.point(0,0)),this._scaleImage(h,i);else if(e&&i%a!=0)if(this._imageOverlay._overlayToRemove=this._imageOverlay._url,r.zoom!==n.zoom)this._addImage(h,o,t.point(0,0)),this._pixelOrigins[o]=h.min,this._scaleImage(h,i);else{let t=h.min.subtract(this._pixelOrigins[o]);if(this.getImageUrl(h,o)===this._imageOverlay._url)return;this._addImage(h,o,t),this._scaleImage(h,i)}else{if(!this.isVisible)return void this._clearLayer();var l=this._map,f=l.getPixelBounds().min.subtract(l.getPixelOrigin());this._addImage(l.getPixelBounds(),i,f),this._pixelOrigins[i]=l.getPixelOrigin()}},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&null!=this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(){t.DomUtil.remove(this._container),this._clearLayer()},getImageUrl:function(e,i){var s={};for(var r in s[this.options.extent.width]=this._map.getSize().x,s[this.options.extent.height]=this._map.getSize().y,s[this.options.extent.bottom]=this._TCRSToPCRS(e.max,i).y,s[this.options.extent.left]=this._TCRSToPCRS(e.min,i).x,s[this.options.extent.top]=this._TCRSToPCRS(e.min,i).y,s[this.options.extent.right]=this._TCRSToPCRS(e.max,i).x,this.options.extent)["width","height","left","right","top","bottom"].indexOf(r)<0&&(s[r]=this.options.extent[r]);return t.Util.template(this._template.template,s)},_TCRSToPCRS:function(t,e){var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))},_setUpExtentTemplateVars:function(t){for(var e={extent:{}},i=t.values,s=0;s<t.values.length;s++){var r=i[s].getAttribute("type"),n=i[s].getAttribute("units"),a=i[s].getAttribute("axis"),o=i[s].getAttribute("name"),h=i[s].getAttribute("position"),l="map-select"===i[s].tagName.toLowerCase();if("width"===r)e.extent.width=o;else if("height"===r)e.extent.height=o;else if("location"!==r||"pcrs"!==n&&"gcrs"!==n)if(l){const t=i[s].htmlselect;e.extent[o]=function(){return t.value}}else{const t=i[s];e.extent[o]=function(){return t.getAttribute("value")}}else switch(a){case"longitude":case"easting":h&&(h.match(/.*?-left/i)?e.extent.left=o:h.match(/.*?-right/i)&&(e.extent.right=o));break;case"latitude":case"northing":h&&(h.match(/top-.*?/i)?e.extent.top=o:h.match(/bottom-.*?/i)&&(e.extent.bottom=o))}}return e}}),f=t.TileLayer.extend({initialize:function(e,i){i.tms=e.tms,this.zoomBounds=Object.assign({},i.zoomBounds),t.extend(i,this.zoomBounds),t.setOptions(this,i),this._setUpTileTemplateVars(e),this._linkEl=i.linkEl,this.extentBounds=this.options.extentBounds,delete this.options.zoomBounds,delete this.options.extentBounds,this._template=e,this._initContainer(),t.TileLayer.prototype.initialize.call(this,e.template,t.extend(i,{pane:this.options.pane}))},onAdd:function(e){this.options.pane.appendChild(this._container),t.TileLayer.prototype.onAdd.call(this,e),this._handleMoveEnd()},onRemove:function(){t.DomUtil.remove(this._container);for(let e of this._container.children)t.DomUtil.remove(e)},getEvents:function(){let e=t.TileLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=e.moveend,e.moveend=this._handleMoveEnd,e},isVisible:function(){let t=this._linkEl.getMapEl()._map,i=t.getZoom(),s=e.pixelToPCRSBounds(t.getPixelBounds(),i,t.options.projection);return i<=this.zoomBounds.maxZoom&&i>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(s)},_initContainer:function(){this._container||(this._container=t.DomUtil.create("div","leaflet-layer",this.options.pane),t.DomUtil.addClass(this._container,"mapml-templated-tile-container"),this._updateZIndex())},_handleMoveEnd:function(){this.isVisible()&&this._parentOnMoveEnd()},createTile:function(e){let i=document.createElement("DIV"),s=this.getTileSize();if(t.DomUtil.addClass(i,"mapml-tile-group"),t.DomUtil.addClass(i,"leaflet-tile"),this._template.linkEl.dispatchEvent(new CustomEvent("tileloadstart",{detail:{x:e.x,y:e.y,zoom:e.z,appendTile:t=>{i.appendChild(t)}}})),this._template.type.startsWith("image/")){let r=t.TileLayer.prototype.createTile.call(this,e,(function(){}));r.width=s.x,r.height=s.y,i.appendChild(r)}else this._url.includes(M.BLANK_TT_TREF)||this._fetchTile(e,i);return i},_mapmlTileReady:function(e){t.DomUtil.addClass(e,"leaflet-tile-loaded")},getPane:function(){return this.options.pane},_fetchTile:function(t,e){let i=this.getTileUrl(t);i&&fetch(i,{redirect:"follow"}).then((function(t){return t.status>=200&&t.status<300?Promise.resolve(t):(console.log("Looks like there was a problem. Status Code: "+t.status),Promise.reject(t))})).then((function(t){return t.text()})).then((t=>(new DOMParser).parseFromString(t,"application/xml"))).then((i=>{this._createFeatures(i,t,e),this._mapmlTileReady(e)})).catch((t=>{console.log("Error creating tile: "+t)}))},_parseStylesheetAsHTML:function(t,e,i){if(i instanceof Element&&t&&t.querySelector("map-link[rel=stylesheet],map-style")){if(e instanceof Element)e=e.getAttribute("href")?e.getAttribute("href"):document.URL;else if(!e||""===e||e instanceof Object)return;for(var s=[],r=t.querySelectorAll("map-link[rel=stylesheet],map-style"),n=0;n<r.length;n++)if("MAP-LINK"===r[n].nodeName.toUpperCase()){var a=r[n].hasAttribute("href")?new URL(r[n].getAttribute("href"),e).href:null;if(a&&!i.querySelector("link[href='"+a+"']")){var o=document.createElement("link");f(r[n],o),o.setAttribute("href",a),s.push(o)}}else{var h=document.createElement("style");f(r[n],h),h.textContent=r[n].textContent,s.push(h)}for(var l=s.length-1;l>=0;l--)i.insertAdjacentElement("afterbegin",s[l])}function f(t,e){return Array.from(t.attributes).forEach((t=>{"href"!==t.nodeName&&e.setAttribute(t.nodeName,t.nodeValue)}))}},_createFeatures:function(r,n,a){if(r.querySelector("map-link[rel=stylesheet],map-style")){let t=r.querySelector("map-base")&&r.querySelector("map-base").hasAttribute("href")?new URL(r.querySelector("map-base").getAttribute("href")).href:r.URL;this._parseStylesheetAsHTML(r,t,a)}let o=t.SVG.create("svg"),h=t.SVG.create("g"),l=this._map.options.crs.options.crs.tile.bounds.max.x,f=n.x*l,c=n.y*l,u=new i(null,{projection:this._map.options.projection,tiles:!0,layerBounds:this.extentBounds,zoomBounds:this.zoomBounds,interactive:!1,mapEl:this._linkEl.getMapEl()}),d=e.getNativeVariables(r),m=r.querySelectorAll('map-feature:has(> map-geometry),map-tile[row="'+n.y+'"][col="'+n.x+'"][zoom="'+n.z+'"]');for(let e=0;e<m.length;e++)if("map-feature"===m[e].nodeName){let i=u.createGeometry(m[e],d.cs,n.z);for(let e in i._layers){let r=i._layers[e];s.prototype._initPath(r,!1),r._project(this._map,t.point([f,c]),n.z),s.prototype._addPath(r,h,!1),s.prototype._updateFeature(r)}}else{let i=m[e];const s=new Image;s.src=i.getAttribute("src");let r=t.SVG.create("image");r.setAttribute("href",s.src),h.appendChild(r)}o.setAttribute("width",l.toString()),o.setAttribute("height",l.toString()),o.appendChild(h),a.appendChild(o)},getTileUrl:function(e){if(e.z>=this._template.tilematrix.bounds.length||!this._template.tilematrix.bounds[e.z].contains(e))return"";var i={},s=this._template.linkEl,r=s.zoomInput;for(var n in i[this._template.tilematrix.col.name]=e.x,i[this._template.tilematrix.row.name]=e.y,r&&s.hasAttribute("tref")&&s.getAttribute("tref").includes(`{${r.getAttribute("name")}}`)&&(i[this._template.zoom.name]=this._getZoomForUrl()),i[this._template.pcrs.easting.left]=this._tileMatrixToPCRSPosition(e,"top-left").x,i[this._template.pcrs.easting.right]=this._tileMatrixToPCRSPosition(e,"top-right").x,i[this._template.pcrs.northing.top]=this._tileMatrixToPCRSPosition(e,"top-left").y,i[this._template.pcrs.northing.bottom]=this._tileMatrixToPCRSPosition(e,"bottom-left").y,this._template.tile)["row","col","zoom","left","right","top","bottom"].indexOf(n)<0&&(i[n]=this._template.tile[n]);return this._map&&!this._map.options.crs.infinite&&this.options.tms&&(i[this._template.tilematrix.row.name]=this._globalTileRange.max.y-e.y),i.r=this.options.detectRetina&&t.Browser.retina&&this.options.maxZoom>0?"@2x":"",t.Util.template(this._url,i)},_tileMatrixToPCRSPosition:function(e,i){var s=this._map.options.crs,r=this.getTileSize(),n=e.scaleBy(r),a=n.add(r),o=n.add(Math.floor(r/2)),h=s.transformation.untransform(n,s.scale(e.z)),l=s.transformation.untransform(a,s.scale(e.z)),f=s.transformation.untransform(o,s.scale(e.z)),c=null;switch(i){case"top-left":c=h;break;case"bottom-left":c=new t.Point(h.x,l.y);break;case"center-left":c=new t.Point(h.x,f.y);break;case"top-right":c=new t.Point(l.x,h.y);break;case"bottom-right":c=l;break;case"center-right":c=new t.Point(l.x,f.y);break;case"top-center":c=new t.Point(f.x,h.y);break;case"bottom-center":c=new t.Point(f.x,l.y);break;case"center":c=f}return c},_setUpTileTemplateVars:function(i){i.tile={};for(var s,r,n,a,o=i.values,h=this.options.crs.options,l=0;l<i.values.length;l++){var f=o[l].getAttribute("type"),c=o[l].getAttribute("units"),u=o[l].getAttribute("axis"),d=o[l].getAttribute("name"),m=o[l].getAttribute("position"),b="map-select"===o[l].tagName.toLowerCase();o[l].getAttribute("value");var w=o[l].getAttribute("min"),_=o[l].getAttribute("max");if("location"===f&&"tilematrix"===c)switch(u){case"column":a={name:d,min:h.crs.tilematrix.horizontal.min,max:h.crs.tilematrix.horizontal.max(h.resolutions.length-1)},isNaN(Number.parseFloat(w))||(a.min=Number.parseFloat(w)),isNaN(Number.parseFloat(_))||(a.max=Number.parseFloat(_));break;case"row":n={name:d,min:h.crs.tilematrix.vertical.min,max:h.crs.tilematrix.vertical.max(h.resolutions.length-1)},isNaN(Number.parseFloat(w))||(n.min=Number.parseFloat(w)),isNaN(Number.parseFloat(_))||(n.max=Number.parseFloat(_));break;case"longitude":case"easting":s||(s={min:h.crs.pcrs.horizontal.min,max:h.crs.pcrs.horizontal.max}),isNaN(Number.parseFloat(w))||(s.min=Number.parseFloat(w)),isNaN(Number.parseFloat(_))||(s.max=Number.parseFloat(_)),m&&(m.match(/.*?-left/i)?s.left=d:m.match(/.*?-right/i)&&(s.right=d));break;case"latitude":case"northing":r||(r={min:h.crs.pcrs.vertical.min,max:h.crs.pcrs.vertical.max}),isNaN(Number.parseFloat(w))||(r.min=Number.parseFloat(w)),isNaN(Number.parseFloat(_))||(r.max=Number.parseFloat(_)),m&&(m.match(/top-.*?/i)?r.top=d:m.match(/bottom-.*?/i)&&(r.bottom=d))}else if(b){const t=o[l].htmlselect;i.tile[d]=function(){return t.value}}else if("hidden"===f){const t=o[l];i.tile[d]=function(){return t.getAttribute("value")}}}var p=this.options.crs.transformation,y=this.options.crs.options.crs.tile.bounds.max.x,g=t.bind(this.options.crs.scale,this.options.crs),v=function(t,e){return p.transform(t,g(e)).divideBy(y).floor()};s&&r?(i.pcrs={},i.pcrs.bounds=t.bounds([s.min,r.min],[s.max,r.max]),i.pcrs.easting=s,i.pcrs.northing=r):a&&n&&!isNaN(i.zoom.initialValue)&&(i.pcrs||(i.pcrs={},i.pcrs.easting="",i.pcrs.northing=""),i.pcrs.bounds=e.boundsToPCRSBounds(t.bounds(t.point([a.min,n.min]),t.point([a.max,n.max])),i.zoom.initialValue,this.options.crs,e.axisToCS("column")),i.tilematrix={},i.tilematrix.col=a,i.tilematrix.row=n),i.tilematrix||(i.tilematrix={},i.tilematrix.col={},i.tilematrix.row={}),i.tilematrix.bounds=[];for(var x=i.pcrs.bounds,k=this.options.minNativeZoom,M=this.options.maxNativeZoom,z=0;z<=M;z++)i.tilematrix.bounds[z]=z>=k?t.bounds(v(x.min,z),v(x.max,z)):t.bounds(t.point([-1,-1]),t.point([-1,-1]))},_clampZoom:function(e){let i=t.GridLayer.prototype._clampZoom.call(this,e);return this._template.step>this.options.maxNativeZoom&&(this._template.step=this.options.maxNativeZoom),e!==i?e=i:e%this._template.step!=0&&(e=Math.floor(e/this._template.step)*this._template.step),e}}),c=t.LayerGroup.extend({initialize:function(e,i){t.LayerGroup.prototype.initialize.call(this,[]),this._template=e,this._container=t.DomUtil.create("div","leaflet-layer"),t.DomUtil.addClass(this._container,"mapml-features-tiles-container"),this.zoomBounds=i.zoomBounds,this.extentBounds=i.extentBounds,delete i.zoomBounds,delete i.extentBounds,this._linkEl=i.linkEl,t.setOptions(this,t.extend(i,this._setUpTemplateVars(e)))},onAdd:function(e){this._map=e,this.options.pane.appendChild(this._container),this._onMoveEnd(),t.LayerGroup.prototype.onAdd.call(this,e)},onRemove:function(e){t.DomUtil.remove(this._container);for(let e of this._container.children)t.DomUtil.remove(e);t.LayerGroup.prototype.onRemove.call(this,e)},getContainer:function(){return this._container},getEvents:function(){return{moveend:this._onMoveEnd}},isVisible:function(){let t=this._linkEl.getMapEl()._map,i=t.getZoom(),s=e.pixelToPCRSBounds(t.getPixelBounds(),i,t.options.projection);return i<=this.zoomBounds.maxZoom&&i>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(s)},redraw:function(){this._onMoveEnd()},_onMoveEnd:function(){let e=this._map.options.mapEl._history,i=e[e.length-1],s=e[e.length-2]??i,r=this._template.step,n=this._map.getZoom(),a=n;if("1"!==r&&(n+1)%r==0&&i.zoom===s.zoom-1||i.zoom===s.zoom||Math.floor(n/r)*r!=Math.floor(s.zoom/r)*r)a=Math.floor(n/r)*r;else if(n%this._template.step!=0)return;let o=this._map.getPixelBounds(this._map.getCenter(),a);var h=((e,i)=>{void 0===e&&(e=this._map.getZoom()),void 0===i&&(i=this._map.getPixelBounds());const s=(t,e)=>{var i=this._map.options.crs;return i.transformation.untransform(t,i.scale(e))};var r={};for(var n in this.options.param.zoom&&(r[this.options.param.zoom]=e),this.options.param.width&&(r[this.options.param.width]=this._map.getSize().x),this.options.param.height&&(r[this.options.param.height]=this._map.getSize().y),this.options.param.bottom&&(r[this.options.param.bottom]=s(i.max,e).y),this.options.param.left&&(r[this.options.param.left]=s(i.min,e).x),this.options.param.top&&(r[this.options.param.top]=s(i.min,e).y),this.options.param.right&&(r[this.options.param.right]=s(i.max,e).x),this.options.param)["width","height","left","right","top","bottom","zoom"].indexOf(n)<0&&(r[n]=this.options.param[n]);return t.Util.template(this._template.template,r)}).bind(this)(a,o);if(this._url=h,this.clearLayers(),this._linkEl.shadowRoot&&(this._linkEl.shadowRoot.innerHTML=""),this._container.querySelectorAll("link[rel=stylesheet],style").forEach((t=>t.remove())),!this.isVisible())return void(this._url="");let l,f=new Headers({Accept:"text/mapml"}),c=this._linkEl;const u=this._map;(()=>fetch(this._url,{redirect:"follow",headers:f}).then((function(t){return t.text()})).then((function(t){let e=new DOMParser;l=e.parseFromString(t,"application/xml");let i=document.createDocumentFragment();const s="\n map-head > map-link,\n map-body > map-link,\n map-head > map-meta,\n map-body > map-meta,\n map-head > map-style,\n map-body > map-style,\n map-tile,\n map-feature\n ".trim();let r=l.querySelectorAll(s);for(let t=0;t<r.length;t++)i.appendChild(r[t]);c.shadowRoot.appendChild(i)})))().then((()=>{const t=c.shadowRoot.querySelectorAll("map-feature"),e=Array.from(t).map((t=>t.whenReady?t.whenReady():Promise.resolve()));Promise.all(e).then((()=>{u.fire("templatedfeatureslayeradd")})),this.eachLayer((function(t){if(t._path&&("M0 0"!==t._path.getAttribute("d")?t._path.setAttribute("tabindex",0):t._path.removeAttribute("tabindex"),0===t._path.childElementCount)){let e=document.createElement("title");e.innerText=this._linkEl.getMapEl().locale.dfFeatureCaption,t._path.appendChild(e)}}),this)})).catch((function(t){console.log(t)}))},_setUpTemplateVars:function(t){var e={param:{}},i=t.values;e.param.hidden=[];for(var s=0;s<i.length;s++){var r=i[s].getAttribute("type"),n=i[s].getAttribute("units"),a=i[s].getAttribute("axis"),o=i[s].getAttribute("name"),h=i[s].getAttribute("position");i[s].getAttribute("value");var l="map-select"===i[s].tagName.toLowerCase();if("width"===r)e.param.width=o;else if("height"===r)e.param.height=o;else if("zoom"===r)e.param.zoom=o;else if("location"!==r||"pcrs"!==n&&"gcrs"!==n)if(l){const t=i[s].htmlselect;e.param[o]=function(){return t.value}}else{const t=i[s];e.param[o]=function(){return t.getAttribute("value")}}else switch(a){case"x":case"longitude":case"easting":h&&(h.match(/.*?-left/i)?e.param.left=o:h.match(/.*?-right/i)&&(e.param.right=o));break;case"y":case"latitude":case"northing":h&&(h.match(/top-.*?/i)?e.param.top=o:h.match(/bottom-.*?/i)&&(e.param.bottom=o))}}return e},renderStyles:a});function u(t,e){this.x=t,this.y=e}function d(t,e,i){return Math.min(Math.max(t,i),e)}u.prototype={clone(){return new u(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){const e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){const e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){const t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){const e=Math.cos(t),i=Math.sin(t),s=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=s,this},_rotateAround(t,e){const i=Math.cos(t),s=Math.sin(t),r=e.y+s*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-s*(this.y-e.y),this.y=r,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:u},u.convert=function(t){if(t instanceof u)return t;if(Array.isArray(t))return new u(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new u(+t.x,+t.y);throw new Error("Expected [x, y] or {x, y} point format")};class m extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var b=m;function w(t){if("string"!=typeof t)throw new b(t);if("transparent"===t.trim().toLowerCase())return[0,0,0,0];let e=t.trim();e=z.test(t)?function(t){const e=t.toLowerCase().trim(),i=p[function(t){let e=5381,i=t.length;for(;i;)e=33*e^t.charCodeAt(--i);return(e>>>0)%2341}(e)];if(!i)throw new b(t);return`#${i}`}(t):t;const i=g.exec(e);if(i){const t=Array.from(i).slice(1);return[...t.slice(0,3).map((t=>parseInt(y(t,2),16))),parseInt(y(t[3]||"f",2),16)/255]}const s=v.exec(e);if(s){const t=Array.from(s).slice(1);return[...t.slice(0,3).map((t=>parseInt(t,16))),parseInt(t[3]||"ff",16)/255]}const r=x.exec(e);if(r){const t=Array.from(r).slice(1);return[...t.slice(0,3).map((t=>parseInt(t,10))),parseFloat(t[3]||"1")]}const n=k.exec(e);if(n){const[e,i,s,r]=Array.from(n).slice(1).map(parseFloat);if(d(0,100,i)!==i)throw new b(t);if(d(0,100,s)!==s)throw new b(t);return[...T(e,i,s),Number.isNaN(r)?1:r]}throw new b(t)}const _=t=>parseInt(t.replace(/_/g,""),36),p="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)=>{const i=_(e.substring(0,3)),s=_(e.substring(3)).toString(16);let r="";for(let t=0;t<6-s.length;t++)r+="0";return t[i]=`${r}${s}`,t}),{}),y=(t,e)=>Array.from(Array(e)).map((()=>t)).join(""),g=new RegExp(`^#${y("([a-f0-9])",3)}([a-f0-9])?$`,"i"),v=new RegExp(`^#${y("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),x=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${y(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),k=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,z=/^[a-z]+$/i,j=t=>Math.round(255*t),T=(t,e,i)=>{let s=i/100;if(0===e)return[s,s,s].map(j);const r=(t%360+360)%360/60,n=(1-Math.abs(2*s-1))*(e/100),a=n*(1-Math.abs(r%2-1));let o=0,h=0,l=0;r>=0&&r<1?(o=n,h=a):r>=1&&r<2?(o=a,h=n):r>=2&&r<3?(h=n,l=a):r>=3&&r<4?(h=a,l=n):r>=4&&r<5?(o=a,l=n):r>=5&&r<6&&(o=n,l=a);const f=s-n/2;return[o+f,h+f,l+f].map(j)};function P(t,e,i){const s=(t,e)=>3===e?t:t/255,[r,n,a,o]=w(t).map(s),[h,l,f,c]=w(e).map(s),u=c-o,m=2*i-1,b=((m*u==-1?m:m+u/(1+m*u))+1)/2,_=1-b;return p=255*(n*_+l*b),y=255*(a*_+f*b),g=c*i+o*(1-i),`rgba(${d(0,255,255*(r*_+h*b)).toFixed()}, ${d(0,255,p).toFixed()}, ${d(0,255,y).toFixed()}, ${parseFloat(d(0,1,g).toFixed(3))})`;var p,y,g}class S{constructor(t,e,i,s,r){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=s,this._values=r,t.readFields(E,this,e)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos,i=[];let s,r=1,n=0,a=0,o=0;for(;t.pos<e;){if(n<=0){const e=t.readVarint();r=7&e,n=e>>3}if(n--,1===r||2===r)a+=t.readSVarint(),o+=t.readSVarint(),1===r&&(s&&i.push(s),s=[]),s&&s.push(new u(a,o));else{if(7!==r)throw new Error(`unknown command ${r}`);s&&s.push(s[0].clone())}}return s&&i.push(s),i}bbox(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let i=1,s=0,r=0,n=0,a=1/0,o=-1/0,h=1/0,l=-1/0;for(;t.pos<e;){if(s<=0){const e=t.readVarint();i=7&e,s=e>>3}if(s--,1===i||2===i)r+=t.readSVarint(),n+=t.readSVarint(),r<a&&(a=r),r>o&&(o=r),n<h&&(h=n),n>l&&(l=n);else if(7!==i)throw new Error(`unknown command ${i}`)}return[a,h,o,l]}toGeoJSON(t,e,i){const s=this.extent*Math.pow(2,i),r=this.extent*t,n=this.extent*e,a=this.loadGeometry();function o(t){return[360*(t.x+r)/s-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+n)/s)*Math.PI))-90]}function h(t){return t.map(o)}let l;if(1===this.type){const t=[];for(const e of a)t.push(e[0]);const e=h(t);l=1===t.length?{type:"Point",coordinates:e[0]}:{type:"MultiPoint",coordinates:e}}else if(2===this.type){const t=a.map(h);l=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}else{if(3!==this.type)throw new Error("unknown feature type");{const t=function(t){const e=t.length;if(e<=1)return[t];const i=[];let s,r;for(let n=0;n<e;n++){const e=$(t[n]);0!==e&&(void 0===r&&(r=e<0),r===e<0?(s&&i.push(s),s=[t[n]]):s&&s.push(t[n]))}return s&&i.push(s),i}(a),e=[];for(const i of t)e.push(i.map(h));l=1===e.length?{type:"Polygon",coordinates:e[0]}:{type:"MultiPolygon",coordinates:e}}}const f={type:"Feature",geometry:l,properties:this.properties};return null!=this.id&&(f.id=this.id),f}}function E(t,e,i){1===t?e.id=i.readVarint():2===t?function(t,e){const i=t.readVarint()+t.pos;for(;t.pos<i;){const i=e._keys[t.readVarint()],s=e._values[t.readVarint()];e.properties[i]=s}}(i,e):3===t?e.type=i.readVarint():4===t&&(e._geometry=i.pos)}function $(t){let e=0;for(let i,s,r=0,n=t.length,a=n-1;r<n;a=r++)i=t[r],s=t[a],e+=(s.x-i.x)*(i.y+s.y);return e}S.types=["Unknown","Point","LineString","Polygon"];class A{constructor(t,e){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(C,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const e=this._pbf.readVarint()+this._pbf.pos;return new S(this._pbf,e,this.extent,this._keys,this._values)}}function C(t,e,i){15===t?e.version=i.readVarint():1===t?e.name=i.readString():5===t?e.extent=i.readVarint():2===t?e._features.push(i.pos):3===t?e._keys.push(i.readString()):4===t&&e._values.push(function(t){let e=null;const i=t.readVarint()+t.pos;for(;t.pos<i;){const i=t.readVarint()>>3;e=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}if(null==e)throw new Error("unknown feature value");return e}(i))}class D{constructor(t,e){this.layers=t.readFields(F,{},e)}}function F(t,e,i){if(3===t){const t=new A(i,i.readVarint()+i.pos);t.length&&(e[t.name]=t)}}const I=4294967296,B=1/I,R="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class N{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){const i=this.readVarint(),s=i>>3,r=this.pos;this.type=7&i,t(s,e,this),this.pos===r&&this.skip(i)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*I;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*I;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let i,s;return s=e[this.pos++],i=127&s,s<128?i:(s=e[this.pos++],i|=(127&s)<<7,s<128?i:(s=e[this.pos++],i|=(127&s)<<14,s<128?i:(s=e[this.pos++],i|=(127&s)<<21,s<128?i:(s=e[this.pos],i|=(15&s)<<28,function(t,e,i){const s=i.buf;let r,n;if(n=s[i.pos++],r=(112&n)>>4,n<128)return V(t,r,e);if(n=s[i.pos++],r|=(127&n)<<3,n<128)return V(t,r,e);if(n=s[i.pos++],r|=(127&n)<<10,n<128)return V(t,r,e);if(n=s[i.pos++],r|=(127&n)<<17,n<128)return V(t,r,e);if(n=s[i.pos++],r|=(127&n)<<24,n<128)return V(t,r,e);if(n=s[i.pos++],r|=(1&n)<<31,n<128)return V(t,r,e);throw new Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&R?R.decode(this.buf.subarray(e,t)):function(t,e,i){let s="",r=e;for(;r<i;){const e=t[r];let n,a,o,h=null,l=e>239?4:e>223?3:e>191?2:1;if(r+l>i)break;1===l?e<128&&(h=e):2===l?(n=t[r+1],128==(192&n)&&(h=(31&e)<<6|63&n,h<=127&&(h=null))):3===l?(n=t[r+1],a=t[r+2],128==(192&n)&&128==(192&a)&&(h=(15&e)<<12|(63&n)<<6|63&a,(h<=2047||h>=55296&&h<=57343)&&(h=null))):4===l&&(n=t[r+1],a=t[r+2],o=t[r+3],128==(192&n)&&128==(192&a)&&128==(192&o)&&(h=(15&e)<<18|(63&n)<<12|(63&a)<<6|63&o,(h<=65535||h>=1114112)&&(h=null))),null===h?(h=65533,l=1):h>65535&&(h-=65536,s+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),s+=String.fromCharCode(h),r+=l}return s}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*B),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*B),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let i,s;if(t>=0?(i=t%4294967296|0,s=t/4294967296|0):(i=~(-t%4294967296),s=~(-t/4294967296),4294967295^i?i=i+1|0:(i=0,s=s+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,i.buf[i.pos]=127&(t>>>=7)}(i,0,e),function(t,e){const i=(7&t)<<4;e.buf[e.pos++]|=i|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(s,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,i){for(let s,r,n=0;n<e.length;n++){if(s=e.charCodeAt(n),s>55295&&s<57344){if(!r){s>56319||n+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=s;continue}if(s<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=s;continue}s=r-55296<<10|s-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);s<128?t[i++]=s:(s<2048?t[i++]=s>>6|192:(s<65536?t[i++]=s>>12|224:(t[i++]=s>>18|240,t[i++]=s>>12&63|128),t[i++]=s>>6&63|128),t[i++]=63&s|128)}return i}(this.buf,t,this.pos);const i=this.pos-e;i>=128&&O(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;const i=this.pos;t(e,this);const s=this.pos-i;s>=128&&O(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,U,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,X,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Z,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,q,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Y,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,H,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,G,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,W,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,K,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function V(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function O(t,e,i){const s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(s);for(let e=i.pos-1;e>=t;e--)i.buf[e+s]=i.buf[e]}function U(t,e){for(let i=0;i<t.length;i++)e.writeVarint(t[i])}function X(t,e){for(let i=0;i<t.length;i++)e.writeSVarint(t[i])}function q(t,e){for(let i=0;i<t.length;i++)e.writeFloat(t[i])}function Y(t,e){for(let i=0;i<t.length;i++)e.writeDouble(t[i])}function Z(t,e){for(let i=0;i<t.length;i++)e.writeBoolean(t[i])}function H(t,e){for(let i=0;i<t.length;i++)e.writeFixed32(t[i])}function G(t,e){for(let i=0;i<t.length;i++)e.writeSFixed32(t[i])}function W(t,e){for(let i=0;i<t.length;i++)e.writeFixed64(t[i])}function K(t,e){for(let i=0;i<t.length;i++)e.writeSFixed64(t[i])}var J,Q,tt,et=function(){if(Q)return J;Q=1;var t,e=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,n=Math.pow,a=(t,e,i)=>new Promise(((s,r)=>{var n=t=>{try{o(i.next(t))}catch(t){r(t)}},a=t=>{try{o(i.throw(t))}catch(t){r(t)}},o=t=>t.done?s(t.value):Promise.resolve(t.value).then(n,a);o((i=i.apply(t,e)).next())})),o={};((t,i)=>{for(var s in i)e(t,s,{get:i[s],enumerable:!0})})(o,{Compression:()=>at,EtagMismatch:()=>wt,FetchSource:()=>ut,FileSource:()=>ct,PMTiles:()=>vt,Protocol:()=>W,ResolvedValueCache:()=>yt,SharedPromiseCache:()=>gt,TileType:()=>ht,bytesToHeader:()=>mt,findTile:()=>ft,getUint64:()=>dt,leafletRasterLayer:()=>G,readVarint:()=>tt,tileIdToZxy:()=>nt,tileTypeExt:()=>lt,zxyToTileId:()=>rt}),t=o,J=((t,n,a,o)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let a of s(n))r.call(t,a)||undefined===a||e(t,a,{get:()=>n[a],enumerable:!(o=i(n,a))||o.enumerable});return t})(e({},"__esModule",{value:!0}),t);var h=Uint8Array,l=Uint16Array,f=Int32Array,c=new h([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]),u=new h([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]),d=new h([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),m=function(t,e){for(var i=new l(31),s=0;s<31;++s)i[s]=e+=1<<t[s-1];var r=new f(i[30]);for(s=1;s<30;++s)for(var n=i[s];n<i[s+1];++n)r[n]=n-i[s]<<5|s;return{b:i,r}},b=m(c,2),w=b.b,_=b.r;w[28]=258,_[258]=28;var p,y=m(u,0).b,g=new l(32768);for(k=0;k<32768;++k)g[k]=((65280&(p=(61680&(p=(52428&(p=(43690&k)>>1|(21845&k)<<1))>>2|(13107&p)<<2))>>4|(3855&p)<<4))>>8|(255&p)<<8)>>1;var v=function(t,e){for(var i=t.length,s=0,r=new l(e);s<i;++s)t[s]&&++r[t[s]-1];var n,a=new l(e);for(s=1;s<e;++s)a[s]=a[s-1]+r[s-1]<<1;n=new l(1<<e);var o=15-e;for(s=0;s<i;++s)if(t[s])for(var h=s<<4|t[s],f=e-t[s],c=a[t[s]-1]++<<f,u=c|(1<<f)-1;c<=u;++c)n[g[c]>>o]=h;return n},x=new h(288);for(k=0;k<144;++k)x[k]=8;for(k=144;k<256;++k)x[k]=9;for(k=256;k<280;++k)x[k]=7;for(k=280;k<288;++k)x[k]=8;var k,M=new h(32);for(k=0;k<32;++k)M[k]=5;var z=v(x,9),j=v(M,5),T=function(t){for(var e=t[0],i=1;i<t.length;++i)t[i]>e&&(e=t[i]);return e},P=function(t,e,i){var s=e/8|0;return(t[s]|t[s+1]<<8)>>(7&e)&i},S=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)},E=["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"],$=function(t,e,i){var s=new Error(e||E[t]);if(s.code=t,Error.captureStackTrace&&Error.captureStackTrace(s,$),!i)throw s;return s},A=function(t,e,i,s){var r=t.length;if(!r||e.f&&!e.l)return i||new h(0);var n=!i||2!=e.i,a=e.i;i||(i=new h(3*r));var o=function(t){var e=i.length;if(t>e){var s=new h(Math.max(2*e,t));s.set(i),i=s}},l=e.f||0,f=e.p||0,m=e.b||0,b=e.l,_=e.d,p=e.m,g=e.n,x=8*r;do{if(!b){l=P(t,f,1);var k=P(t,f+1,3);if(f+=3,!k){var M=t[(V=4+((f+7)/8|0))-4]|t[V-3]<<8,L=V+M;if(L>r){a&&$(0);break}n&&o(m+M),i.set(t.subarray(V,L),m),e.b=m+=M,e.p=f=8*L,e.f=l;continue}if(1==k)b=z,_=j,p=9,g=5;else if(2==k){var E=P(t,f,31)+257,A=P(t,f+10,15)+4,C=E+P(t,f+5,31)+1;f+=14;for(var D=new h(C),F=new h(19),I=0;I<A;++I)F[d[I]]=P(t,f+3*I,7);f+=3*A;var B=T(F),R=(1<<B)-1,N=v(F,B);for(I=0;I<C;){var V,O=N[P(t,f,R)];if(f+=15&O,(V=O>>4)<16)D[I++]=V;else{var U=0,X=0;for(16==V?(X=3+P(t,f,3),f+=2,U=D[I-1]):17==V?(X=3+P(t,f,7),f+=3):18==V&&(X=11+P(t,f,127),f+=7);X--;)D[I++]=U}}var q=D.subarray(0,E),Y=D.subarray(E);p=T(q),g=T(Y),b=v(q,p),_=v(Y,g)}else $(1);if(f>x){a&&$(0);break}}n&&o(m+131072);for(var Z=(1<<p)-1,H=(1<<g)-1,G=f;;G=f){var W=(U=b[S(t,f)&Z])>>4;if((f+=15&U)>x){a&&$(0);break}if(U||$(2),W<256)i[m++]=W;else{if(256==W){G=f,b=null;break}var K=W-254;W>264&&(K=P(t,f,(1<<(tt=c[I=W-257]))-1)+w[I],f+=tt);var J=_[S(t,f)&H],Q=J>>4;if(J||$(3),f+=15&J,Y=y[Q],Q>3){var tt=u[Q];Y+=S(t,f)&(1<<tt)-1,f+=tt}if(f>x){a&&$(0);break}n&&o(m+131072);var et=m+K;if(m<Y){var it=0-Y,st=Math.min(Y,et);for(it+m<0&&$(3);m<st;++m)i[m]=s[it+m]}for(;m<et;m+=4)i[m]=i[m-Y],i[m+1]=i[m+1-Y],i[m+2]=i[m+2-Y],i[m+3]=i[m+3-Y];m=et}}e.l=b,e.p=G,e.b=m,e.f=l,b&&(l=1,e.m=p,e.d=_,e.n=g)}while(!l);return m==i.length?i:function(t,e,i){(null==i||i>t.length)&&(i=t.length);var s=new h(i-0);return s.set(t.subarray(0,i)),s}(i,0,m)},C=new h(0);function D(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?function(t,e){var i,s,r=function(t){31==t[0]&&139==t[1]&&8==t[2]||$(6,"invalid gzip data");var e=t[3],i=10;4&e&&(i+=2+(t[10]|t[11]<<8));for(var s=(e>>3&1)+(e>>4&1);s>0;s-=!t[i++]);return i+(2&e)}(t);return r+8>t.length&&$(6,"invalid gzip data"),A(t.subarray(r,-8),{i:2},new h(((i=t)[(s=i.length)-4]|i[s-3]<<8|i[s-2]<<16|i[s-1]<<24)>>>0),e)}(t,e):8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31?function(t,e){return A(t,{i:2},e,e)}(t,e):function(t,e){return A(t.subarray(((8!=(15&(i=t)[0])||i[0]>>4>7||(i[0]<<8|i[1])%31)&&$(6,"invalid zlib data"),1==(i[1]>>5&1)&&$(6,"invalid zlib data: "+(32&i[1]?"need":"unexpected")+" dictionary"),2+(i[1]>>3&4)),-4),{i:2},e,e);var i}(t,e)}var F="undefined"!=typeof TextDecoder&&new TextDecoder;try{F.decode(C,{stream:!0})}catch(t){}var I=(t,e)=>t*n(2,e),B=(t,e)=>Math.floor(t/n(2,e)),R=(t,e)=>I(t.getUint16(e+1,!0),8)+t.getUint8(e),N=(t,e)=>I(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),V=(t,e,i,s,r)=>{if(t!==s.getUint8(r))return t-s.getUint8(r);const n=R(s,r+1);if(e!==n)return e-n;const a=R(s,r+4);return i!==a?i-a:0},O=(t,e,i,s)=>{const r=U(t,e,i,s);return r?{z:e,x:i,y:s,offset:r[0],length:r[1],isDir:!1}:null},U=(t,e,i,s)=>{let r=0,n=t.byteLength/17-1;for(;r<=n;){const a=n+r>>1,o=V(e,i,s,t,17*a);if(o>0)r=a+1;else{if(!(o<0))return[N(t,17*a+7),t.getUint32(17*a+13,!0)];n=a-1}}return null},X=(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,q=(t,e)=>{const i=t.getUint8(17*e);return{z:127&i,x:R(t,17*e+1),y:R(t,17*e+4),offset:N(t,17*e+7),length:t.getUint32(17*e+13,!0),isDir:i>>7==1}},Y=t=>{const e=[],i=new DataView(t);for(let t=0;t<i.byteLength/17;t++)e.push(q(i,t));return Z(e)},Z=t=>{t.sort(X);const e=new ArrayBuffer(17*t.length),i=new Uint8Array(e);for(let e=0;e<t.length;e++){const s=t[e];let r=s.z;s.isDir&&(r|=128),i[17*e]=r,i[17*e+1]=255&s.x,i[17*e+2]=s.x>>8&255,i[17*e+3]=s.x>>16&255,i[17*e+4]=255&s.y,i[17*e+5]=s.y>>8&255,i[17*e+6]=s.y>>16&255,i[17*e+7]=255&s.offset,i[17*e+8]=255&B(s.offset,8),i[17*e+9]=255&B(s.offset,16),i[17*e+10]=255&B(s.offset,24),i[17*e+11]=255&B(s.offset,32),i[17*e+12]=255&B(s.offset,48),i[17*e+13]=255&s.length,i[17*e+14]=s.length>>8&255,i[17*e+15]=s.length>>16&255,i[17*e+16]=s.length>>24&255}return e},H={getHeader:function(t){return a(this,null,(function*(){const e=yield t.getBytes(0,512e3),i=new DataView(e.data),s=i.getUint32(4,!0),r=i.getUint16(8,!0),n=new TextDecoder("utf-8"),a=JSON.parse(n.decode(new DataView(e.data,10,s)));let o=0;"gzip"===a.compression&&(o=2);let h=0;"minzoom"in a&&(h=+a.minzoom);let l=0;"maxzoom"in a&&(l=+a.maxzoom);let f=0,c=0,u=0,d=-180,m=-85,b=180,w=85;if(a.bounds){const t=a.bounds.split(",");d=+t[0],m=+t[1],b=+t[2],w=+t[3]}if(a.center){const t=a.center.split(",");f=+t[0],c=+t[1],u=+t[2]}return{specVersion:i.getUint16(2,!0),rootDirectoryOffset:10+s,rootDirectoryLength:17*r,jsonMetadataOffset:10,jsonMetadataLength:s,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:h,maxZoom:l,minLon:d,minLat:m,maxLon:b,maxLat:w,centerZoom:u,centerLon:f,centerLat:c,etag:e.etag}}))},getZxy:function(t,e,i,s,r,n,o){return a(this,null,(function*(){let a=yield i.getArrayBuffer(e,t.rootDirectoryOffset,t.rootDirectoryLength,t);1===t.specVersion&&(a=Y(a));const h=O(new DataView(a),s,r,n);if(h){let t=(yield e.getBytes(h.offset,h.length,o)).data;const i=new DataView(t);return 31===i.getUint8(0)&&139===i.getUint8(1)&&(t=D(new Uint8Array(t))),{data:t}}const l=((t,e)=>{if(t.byteLength<17)return null;const i=q(t,t.byteLength/17-1);if(i.isDir){const t=i.z,s=e.z-t;return{z:t,x:Math.trunc(e.x/(1<<s)),y:Math.trunc(e.y/(1<<s))}}return null})(new DataView(a),{z:s,x:r,y:n});if(l){const h=((t,e,i,s)=>{const r=U(t,128|e,i,s);return r?{z:e,x:i,y:s,offset:r[0],length:r[1],isDir:!0}:null})(new DataView(a),l.z,l.x,l.y);if(h){let a=yield i.getArrayBuffer(e,h.offset,h.length,t);1===t.specVersion&&(a=Y(a));const l=O(new DataView(a),s,r,n);if(l){let t=(yield e.getBytes(l.offset,l.length,o)).data;const i=new DataView(t);return 31===i.getUint8(0)&&139===i.getUint8(1)&&(t=D(new Uint8Array(t))),{data:t}}}}}))}},G=(t,e)=>{let i=!1,s="";return new(L.GridLayer.extend({createTile:(e,r)=>{const n=document.createElement("img"),a=new AbortController,o=a.signal;return n.cancel=()=>{a.abort()},i||(t.getHeader().then((t=>{1===t.tileType?console.error("Error: archive contains MVT vector tiles, but leafletRasterLayer is for displaying raster tiles. See https://github.com/protomaps/PMTiles/tree/main/js for details."):2===t.tileType?s="image/png":3===t.tileType?s="image/jpeg":4===t.tileType?s="image/webp":5===t.tileType&&(s="image/avif")})),i=!0),t.getZxy(e.z,e.x,e.y,o).then((t=>{if(t){const e=new Blob([t.data],{type:s}),i=window.URL.createObjectURL(e);n.src=i,n.cancel=void 0,r(void 0,n)}})).catch((t=>{if("AbortError"!==t.name)throw t})),n},_removeTile:function(t){const e=this._tiles[t];e&&(e.el.cancel&&e.el.cancel(),e.el.width=0,e.el.height=0,e.el.deleted=!0,L.DomUtil.remove(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))}}))(e)},W=class{constructor(t){var e;this.tilev4=(t,e)=>a(this,null,(function*(){if("json"===t.type){const e=t.url.substr(10);let i=this.tiles.get(e);if(i||(i=new vt(e),this.tiles.set(e,i)),this.metadata)return{data:yield i.getTileJson(t.url)};const s=yield i.getHeader();return{data:{tiles:[`${t.url}/{z}/{x}/{y}`],minzoom:s.minZoom,maxzoom:s.maxZoom,bounds:[s.minLon,s.minLat,s.maxLon,s.maxLat]}}}const i=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),s=t.url.match(i);if(!s)throw new Error("Invalid PMTiles protocol URL");const r=s[1];let n=this.tiles.get(r);n||(n=new vt(r),this.tiles.set(r,n));const a=s[2],o=s[3],h=s[4],l=yield n.getHeader(),f=yield null==n?void 0:n.getZxy(+a,+o,+h,e.signal);return f?{data:new Uint8Array(f.data),cacheControl:f.cacheControl,expires:f.expires}:1===l.tileType?{data:new Uint8Array}:{data:null}})),this.tile=(e=this.tilev4,(t,i)=>{if(i instanceof AbortController)return e(t,i);const s=new AbortController;return e(t,s).then((t=>i(void 0,t.data,t.cacheControl||"",t.expires||"")),(t=>i(t))).catch((t=>i(t))),{cancel:()=>s.abort()}}),this.tiles=new Map,this.metadata=(null==t?void 0:t.metadata)||!1}add(t){this.tiles.set(t.source.getKey(),t)}get(t){return this.tiles.get(t)}};function K(t,e){return 4294967296*(e>>>0)+(t>>>0)}function tt(t){const e=t.buf;let i=e[t.pos++],s=127&i;return i<128?s:(i=e[t.pos++],s|=(127&i)<<7,i<128?s:(i=e[t.pos++],s|=(127&i)<<14,i<128?s:(i=e[t.pos++],s|=(127&i)<<21,i<128?s:(i=e[t.pos],s|=(15&i)<<28,function(t,e){const i=e.buf;let s=i[e.pos++],r=(112&s)>>4;if(s<128)return K(t,r);if(s=i[e.pos++],r|=(127&s)<<3,s<128)return K(t,r);if(s=i[e.pos++],r|=(127&s)<<10,s<128)return K(t,r);if(s=i[e.pos++],r|=(127&s)<<17,s<128)return K(t,r);if(s=i[e.pos++],r|=(127&s)<<24,s<128)return K(t,r);if(s=i[e.pos++],r|=(1&s)<<31,s<128)return K(t,r);throw new Error("Expected varint not more than 10 bytes")}(s,t)))))}function et(t,e,i,s){if(0===s){1===i&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const s=e[0];e[0]=e[1],e[1]=s}}function it(t,e){const i=n(2,t);let s=e,r=e,a=e;const o=[0,0];let h=1;for(;h<i;)s=1&a/2,r=1&(a^s),et(h,o,s,r),o[0]+=h*s,o[1]+=h*r,a/=4,h*=2;return[t,o[0],o[1]]}var st=[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 rt(t,e,i){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>n(2,t)-1||i>n(2,t)-1)throw Error("tile x/y outside zoom level bounds");const s=st[t];let r=0,a=0,o=0;const h=[e,i];let l=n(2,t)/2;for(;l>0;)r=(h[0]&l)>0?1:0,a=(h[1]&l)>0?1:0,o+=l*l*(3*r^a),et(l,h,r,a),l/=2;return s+o}function nt(t){let e=0;for(let i=0;i<27;i++){const s=(1<<i)*(1<<i);if(e+s>t)return it(i,t-e);e+=s}throw Error("Tile zoom level exceeds max safe number limit (26)")}var at=(t=>(t[t.Unknown=0]="Unknown",t[t.None=1]="None",t[t.Gzip=2]="Gzip",t[t.Brotli=3]="Brotli",t[t.Zstd=4]="Zstd",t))(at||{});function ot(t,e){return a(this,null,(function*(){if(1===e||0===e)return t;if(2===e){if(void 0===globalThis.DecompressionStream)return D(new Uint8Array(t));const e=new Response(t).body;if(!e)throw Error("Failed to read response stream");const i=e.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(i).arrayBuffer()}throw Error("Compression method not supported")}))}var ht=(t=>(t[t.Unknown=0]="Unknown",t[t.Mvt=1]="Mvt",t[t.Png=2]="Png",t[t.Jpeg=3]="Jpeg",t[t.Webp=4]="Webp",t[t.Avif=5]="Avif",t))(ht||{});function lt(t){return 1===t?".mvt":2===t?".png":3===t?".jpg":4===t?".webp":5===t?".avif":""}function ft(t,e){let i=0,s=t.length-1;for(;i<=s;){const r=s+i>>1,n=e-t[r].tileId;if(n>0)i=r+1;else{if(!(n<0))return t[r];s=r-1}}if(s>=0){if(0===t[s].runLength)return t[s];if(e-t[s].tileId<t[s].runLength)return t[s]}return null}var ct=class{constructor(t){this.file=t}getKey(){return this.file.name}getBytes(t,e){return a(this,null,(function*(){const i=this.file.slice(t,t+e);return{data:yield i.arrayBuffer()}}))}},ut=class{constructor(t,e=new Headers){this.url=t,this.customHeaders=e,this.mustReload=!1;let i="";"navigator"in globalThis&&(i=globalThis.navigator.userAgent||"");const s=i.indexOf("Windows")>-1,r=/Chrome|Chromium|Edg|OPR|Brave/.test(i);this.chromeWindowsNoCache=!1,s&&r&&(this.chromeWindowsNoCache=!0)}getKey(){return this.url}setHeaders(t){this.customHeaders=t}getBytes(t,e,i,s){return a(this,null,(function*(){let r,n;i?n=i:(r=new AbortController,n=r.signal);const a=new Headers(this.customHeaders);let o;a.set("range",`bytes=${t}-${t+e-1}`),this.mustReload?o="reload":this.chromeWindowsNoCache&&(o="no-store");let h=yield fetch(this.url,{signal:n,cache:o,headers:a});if(0===t&&416===h.status){const t=h.headers.get("Content-Range");if(!t||!t.startsWith("bytes */"))throw Error("Missing content-length on 416 response");const e=+t.substr(8);h=yield fetch(this.url,{signal:n,cache:"reload",headers:{range:"bytes=0-"+(e-1)}})}let l=h.headers.get("Etag");if((null==l?void 0:l.startsWith("W/"))&&(l=null),416===h.status||s&&l&&l!==s)throw this.mustReload=!0,new wt(`Server returned non-matching ETag ${s} after one retry. Check browser extensions and servers for issues that may affect correct ETag headers.`);if(h.status>=300)throw Error(`Bad response code: ${h.status}`);const f=h.headers.get("Content-Length");if(200===h.status&&(!f||+f>e))throw r&&r.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 h.arrayBuffer(),etag:l||void 0,cacheControl:h.headers.get("Cache-Control")||void 0,expires:h.headers.get("Expires")||void 0}}))}};function dt(t,e){const i=t.getUint32(e+4,!0),s=t.getUint32(e+0,!0);return i*n(2,32)+s}function mt(t,e){const i=new DataView(t),s=i.getUint8(7);if(s>3)throw Error(`Archive is spec version ${s} but this library supports up to spec version 3`);return{specVersion:s,rootDirectoryOffset:dt(i,8),rootDirectoryLength:dt(i,16),jsonMetadataOffset:dt(i,24),jsonMetadataLength:dt(i,32),leafDirectoryOffset:dt(i,40),leafDirectoryLength:dt(i,48),tileDataOffset:dt(i,56),tileDataLength:dt(i,64),numAddressedTiles:dt(i,72),numTileEntries:dt(i,80),numTileContents:dt(i,88),clustered:1===i.getUint8(96),internalCompression:i.getUint8(97),tileCompression:i.getUint8(98),tileType:i.getUint8(99),minZoom:i.getUint8(100),maxZoom:i.getUint8(101),minLon:i.getInt32(102,!0)/1e7,minLat:i.getInt32(106,!0)/1e7,maxLon:i.getInt32(110,!0)/1e7,maxLat:i.getInt32(114,!0)/1e7,centerZoom:i.getUint8(118),centerLon:i.getInt32(119,!0)/1e7,centerLat:i.getInt32(123,!0)/1e7,etag:e}}function bt(t){const e={buf:new Uint8Array(t),pos:0},i=tt(e),s=[];let r=0;for(let t=0;t<i;t++){const t=tt(e);s.push({tileId:r+t,offset:0,length:0,runLength:1}),r+=t}for(let t=0;t<i;t++)s[t].runLength=tt(e);for(let t=0;t<i;t++)s[t].length=tt(e);for(let t=0;t<i;t++){const i=tt(e);s[t].offset=0===i&&t>0?s[t-1].offset+s[t-1].length:i-1}return s}var wt=class extends Error{};function _t(t,e){return a(this,null,(function*(){const i=yield t.getBytes(0,16384);if(19792!==new DataView(i.data).getUint16(0,!0))throw new Error("Wrong magic number for PMTiles archive");if(function(t){const e=new DataView(t);return 2===e.getUint16(2,!0)?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):1===e.getUint16(2,!0)?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}(i.data)<3)return[yield H.getHeader(t)];const s=mt(i.data.slice(0,127),i.etag),r=i.data.slice(s.rootDirectoryOffset,s.rootDirectoryOffset+s.rootDirectoryLength),n=`${t.getKey()}|${s.etag||""}|${s.rootDirectoryOffset}|${s.rootDirectoryLength}`,a=bt(yield e(r,s.internalCompression));return[s,[n,a.length,a]]}))}function pt(t,e,i,s,r){return a(this,null,(function*(){const n=yield t.getBytes(i,s,void 0,r.etag),a=bt(yield e(n.data,r.internalCompression));if(0===a.length)throw new Error("Empty directory is invalid");return a}))}var yt=class{constructor(t=100,e=!0,i=ot){this.cache=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=i}getHeader(t){return a(this,null,(function*(){const e=t.getKey(),i=this.cache.get(e);if(i)return i.lastUsed=this.counter++,i.data;const s=yield _t(t,this.decompress);return s[1]&&this.cache.set(s[1][0],{lastUsed:this.counter++,data:s[1][2]}),this.cache.set(e,{lastUsed:this.counter++,data:s[0]}),this.prune(),s[0]}))}getDirectory(t,e,i,s){return a(this,null,(function*(){const r=`${t.getKey()}|${s.etag||""}|${e}|${i}`,n=this.cache.get(r);if(n)return n.lastUsed=this.counter++,n.data;const a=yield pt(t,this.decompress,e,i,s);return this.cache.set(r,{lastUsed:this.counter++,data:a}),this.prune(),a}))}getArrayBuffer(t,e,i,s){return a(this,null,(function*(){const r=`${t.getKey()}|${s.etag||""}|${e}|${i}`,n=this.cache.get(r);if(n)return n.lastUsed=this.counter++,yield n.data;const a=yield t.getBytes(e,i,void 0,s.etag);return this.cache.set(r,{lastUsed:this.counter++,data:a.data}),this.prune(),a.data}))}prune(){if(this.cache.size>this.maxCacheEntries){let t,e=1/0;this.cache.forEach(((i,s)=>{i.lastUsed<e&&(e=i.lastUsed,t=s)})),t&&this.cache.delete(t)}}invalidate(t){return a(this,null,(function*(){this.cache.delete(t.getKey())}))}},gt=class{constructor(t=100,e=!0,i=ot){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=i}getHeader(t){return a(this,null,(function*(){const e=t.getKey(),i=this.cache.get(e);if(i)return i.lastUsed=this.counter++,yield i.data;const s=new Promise(((e,i)=>{_t(t,this.decompress).then((t=>{t[1]&&this.cache.set(t[1][0],{lastUsed:this.counter++,data:Promise.resolve(t[1][2])}),e(t[0]),this.prune()})).catch((t=>{i(t)}))}));return this.cache.set(e,{lastUsed:this.counter++,data:s}),s}))}getDirectory(t,e,i,s){return a(this,null,(function*(){const r=`${t.getKey()}|${s.etag||""}|${e}|${i}`,n=this.cache.get(r);if(n)return n.lastUsed=this.counter++,yield n.data;const a=new Promise(((r,n)=>{pt(t,this.decompress,e,i,s).then((t=>{r(t),this.prune()})).catch((t=>{n(t)}))}));return this.cache.set(r,{lastUsed:this.counter++,data:a}),a}))}getArrayBuffer(t,e,i,s){return a(this,null,(function*(){const r=`${t.getKey()}|${s.etag||""}|${e}|${i}`,n=this.cache.get(r);if(n)return n.lastUsed=this.counter++,yield n.data;const a=new Promise(((n,a)=>{t.getBytes(e,i,void 0,s.etag).then((t=>{n(t.data),this.cache.has(r),this.prune()})).catch((t=>{a(t)}))}));return this.cache.set(r,{lastUsed:this.counter++,data:a}),a}))}prune(){if(this.cache.size>=this.maxCacheEntries){let t,e=1/0;this.cache.forEach(((i,s)=>{i.lastUsed<e&&(e=i.lastUsed,t=s)})),t&&this.cache.delete(t)}}invalidate(t){return a(this,null,(function*(){const e=t.getKey();if(this.invalidations.get(e))return yield this.invalidations.get(e);this.cache.delete(t.getKey());const i=new Promise(((i,s)=>{this.getHeader(t).then((()=>{i(),this.invalidations.delete(e)})).catch((t=>{s(t)}))}));this.invalidations.set(e,i)}))}},vt=class{constructor(t,e,i){this.source="string"==typeof t?new ut(t):t,this.decompress=i||ot,this.cache=e||new gt}getHeader(){return a(this,null,(function*(){return yield this.cache.getHeader(this.source)}))}getZxyAttempt(t,e,i,s){return a(this,null,(function*(){const r=rt(t,e,i),n=yield this.cache.getHeader(this.source);if(n.specVersion<3)return H.getZxy(n,this.source,this.cache,t,e,i,s);if(t<n.minZoom||t>n.maxZoom)return;let a=n.rootDirectoryOffset,o=n.rootDirectoryLength;for(let t=0;t<=3;t++){const t=ft(yield this.cache.getDirectory(this.source,a,o,n),r);if(!t)return;if(t.runLength>0){const e=yield this.source.getBytes(n.tileDataOffset+t.offset,t.length,s,n.etag);return{data:yield this.decompress(e.data,n.tileCompression),cacheControl:e.cacheControl,expires:e.expires}}a=n.leafDirectoryOffset+t.offset,o=t.length}throw Error("Maximum directory depth exceeded")}))}getZxy(t,e,i,s){return a(this,null,(function*(){try{return yield this.getZxyAttempt(t,e,i,s)}catch(r){if(r instanceof wt)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,i,s);throw r}}))}getMetadataAttempt(){return a(this,null,(function*(){const t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength,void 0,t.etag),i=yield this.decompress(e.data,t.internalCompression),s=new TextDecoder("utf-8");return JSON.parse(s.decode(i))}))}getMetadata(){return a(this,null,(function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof wt)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}}))}getTileJson(t){return a(this,null,(function*(){const e=yield this.getHeader(),i=yield this.getMetadata(),s=lt(e.tileType);return{tilejson:"3.0.0",scheme:"xyz",tiles:[`${t}/{z}/{x}/{y}${s}`],vector_layers:i.vector_layers,attribution:i.attribution,description:i.description,name:i.name,version:i.version,bounds:[e.minLon,e.minLat,e.maxLon,e.maxLat],center:[e.centerLon,e.centerLat,e.centerZoom],minzoom:e.minZoom,maxzoom:e.maxZoom}}))}};return J}(),it={exports:{}},st=(tt||(tt=1,it.exports=function(){function t(t,s,r,n,a){!function t(i,s,r,n,a){for(;n>r;){if(n-r>600){var o=n-r+1,h=s-r+1,l=Math.log(o),f=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*f*(o-f)/o)*(h-o/2<0?-1:1);t(i,s,Math.max(r,Math.floor(s-h*f/o+c)),Math.min(n,Math.floor(s+(o-h)*f/o+c)),a)}var u=i[s],d=r,m=n;for(e(i,r,s),a(i[n],u)>0&&e(i,r,n);d<m;){for(e(i,d,m),d++,m--;a(i[d],u)<0;)d++;for(;a(i[m],u)>0;)m--}0===a(i[r],u)?e(i,r,m):e(i,++m,n),m<=s&&(r=m+1),s<=m&&(n=m-1)}}(t,s,r||0,n||t.length-1,a||i)}function e(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function i(t,e){return t<e?-1:t>e?1:0}var s=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function r(t,e,i){if(!i)return e.indexOf(t);for(var s=0;s<e.length;s++)if(i(t,e[s]))return s;return-1}function n(t,e){a(t,0,t.children.length,e,t)}function a(t,e,i,s,r){r||(r=m(null)),r.minX=1/0,r.minY=1/0,r.maxX=-1/0,r.maxY=-1/0;for(var n=e;n<i;n++){var a=t.children[n];o(r,t.leaf?s(a):a)}return r}function o(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function h(t,e){return t.minX-e.minX}function l(t,e){return t.minY-e.minY}function f(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function c(t){return t.maxX-t.minX+(t.maxY-t.minY)}function u(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function d(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function m(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function b(e,i,s,r,n){for(var a=[i,s];a.length;)if(!((s=a.pop())-(i=a.pop())<=r)){var o=i+Math.ceil((s-i)/r/2)*r;t(e,o,i,s,n),a.push(i,o,o,s)}}return s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(t){var e=this.data,i=[];if(!d(t,e))return i;for(var s=this.toBBox,r=[];e;){for(var n=0;n<e.children.length;n++){var a=e.children[n],o=e.leaf?s(a):a;d(t,o)&&(e.leaf?i.push(a):u(t,o)?this._all(a,i):r.push(a))}e=r.pop()}return i},s.prototype.collides=function(t){var e=this.data;if(!d(t,e))return!1;for(var i=[];e;){for(var s=0;s<e.children.length;s++){var r=e.children[s],n=e.leaf?this.toBBox(r):r;if(d(t,n)){if(e.leaf||u(t,n))return!0;i.push(r)}}e=i.pop()}return!1},s.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var i=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var s=this.data;this.data=i,i=s}this._insert(i,this.data.height-i.height-1,!0)}else this.data=i;return this},s.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},s.prototype.clear=function(){return this.data=m([]),this},s.prototype.remove=function(t,e){if(!t)return this;for(var i,s,n,a=this.data,o=this.toBBox(t),h=[],l=[];a||h.length;){if(a||(a=h.pop(),s=h[h.length-1],i=l.pop(),n=!0),a.leaf){var f=r(t,a.children,e);if(-1!==f)return a.children.splice(f,1),h.push(a),this._condense(h),this}n||a.leaf||!u(a,o)?s?(i++,a=s.children[i],n=!1):a=null:(h.push(a),l.push(i),i=0,s=a,a=a.children[0])}return this},s.prototype.toBBox=function(t){return t},s.prototype.compareMinX=function(t,e){return t.minX-e.minX},s.prototype.compareMinY=function(t,e){return t.minY-e.minY},s.prototype.toJSON=function(){return this.data},s.prototype.fromJSON=function(t){return this.data=t,this},s.prototype._all=function(t,e){for(var i=[];t;)t.leaf?e.push.apply(e,t.children):i.push.apply(i,t.children),t=i.pop();return e},s.prototype._build=function(t,e,i,s){var r,a=i-e+1,o=this._maxEntries;if(a<=o)return n(r=m(t.slice(e,i+1)),this.toBBox),r;s||(s=Math.ceil(Math.log(a)/Math.log(o)),o=Math.ceil(a/Math.pow(o,s-1))),(r=m([])).leaf=!1,r.height=s;var h=Math.ceil(a/o),l=h*Math.ceil(Math.sqrt(o));b(t,e,i,l,this.compareMinX);for(var f=e;f<=i;f+=l){var c=Math.min(f+l-1,i);b(t,f,c,h,this.compareMinY);for(var u=f;u<=c;u+=h){var d=Math.min(u+h-1,c);r.children.push(this._build(t,u,d,s-1))}}return n(r,this.toBBox),r},s.prototype._chooseSubtree=function(t,e,i,s){for(;s.push(e),!e.leaf&&s.length-1!==i;){for(var r=1/0,n=1/0,a=void 0,o=0;o<e.children.length;o++){var h=e.children[o],l=f(h),c=(u=t,d=h,(Math.max(d.maxX,u.maxX)-Math.min(d.minX,u.minX))*(Math.max(d.maxY,u.maxY)-Math.min(d.minY,u.minY))-l);c<n?(n=c,r=l<r?l:r,a=h):c===n&&l<r&&(r=l,a=h)}e=a||e.children[0]}var u,d;return e},s.prototype._insert=function(t,e,i){var s=i?t:this.toBBox(t),r=[],n=this._chooseSubtree(s,this.data,e,r);for(n.children.push(t),o(n,s);e>=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(s,r,e)},s.prototype._split=function(t,e){var i=t[e],s=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,s);var a=this._chooseSplitIndex(i,r,s),o=m(i.children.splice(a,i.children.length-a));o.height=i.height,o.leaf=i.leaf,n(i,this.toBBox),n(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)},s.prototype._splitRoot=function(t,e){this.data=m([t,e]),this.data.height=t.height+1,this.data.leaf=!1,n(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(t,e,i){for(var s,r,n,o,h,l,c,u=1/0,d=1/0,m=e;m<=i-e;m++){var b=a(t,0,m,this.toBBox),w=a(t,m,i,this.toBBox),_=(r=b,n=w,void 0,void 0,void 0,void 0,o=Math.max(r.minX,n.minX),h=Math.max(r.minY,n.minY),l=Math.min(r.maxX,n.maxX),c=Math.min(r.maxY,n.maxY),Math.max(0,l-o)*Math.max(0,c-h)),p=f(b)+f(w);_<u?(u=_,s=m,d=p<d?p:d):_===u&&p<d&&(d=p,s=m)}return s||i-e},s.prototype._chooseSplitAxis=function(t,e,i){var s=t.leaf?this.compareMinX:h,r=t.leaf?this.compareMinY:l;this._allDistMargin(t,e,i,s)<this._allDistMargin(t,e,i,r)&&t.children.sort(s)},s.prototype._allDistMargin=function(t,e,i,s){t.children.sort(s);for(var r=this.toBBox,n=a(t,0,e,r),h=a(t,i-e,i,r),l=c(n)+c(h),f=e;f<i-e;f++){var u=t.children[f];o(n,t.leaf?r(u):u),l+=c(n)}for(var d=i-e-1;d>=e;d--){var m=t.children[d];o(h,t.leaf?r(m):m),l+=c(h)}return l},s.prototype._adjustParentBBoxes=function(t,e,i){for(var s=i;s>=0;s--)o(e[s],t)},s.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():n(t[e],this.toBBox)},s}()),it.exports),rt=o(st),nt=Object.defineProperty,at=Math.pow,ot=(t,e)=>nt(t,"name",{value:e,configurable:!0}),ht=(t,e,i)=>new Promise(((s,r)=>{var n=t=>{try{o(i.next(t))}catch(t){r(t)}},a=t=>{try{o(i.throw(t))}catch(t){r(t)}},o=t=>t.done?s(t.value):Promise.resolve(t.value).then(n,a);o((i=i.apply(t,e)).next())})),lt=class{constructor(t,e){this.str=null!=t?t:e,this.perFeature="function"==typeof this.str&&2===this.str.length}get(t,e){return"function"==typeof this.str?this.str(t,e):this.str}};ot(lt,"StringAttr");var ft=lt,ct=class{constructor(t,e=1){this.value=null!=t?t:e,this.perFeature="function"==typeof this.value&&2===this.value.length}get(t,e){return"function"==typeof this.value?this.value(t,e):this.value}};ot(ct,"NumberAttr");var ut=ct,dt=class{constructor(t){var e;this.labelProps=null!=(e=null==t?void 0:t.labelProps)?e:["name"],this.textTransform=null==t?void 0:t.textTransform}get(t,e){let i,s,r;s="function"==typeof this.labelProps?this.labelProps(t,e):this.labelProps;for(let t of s)if(Object.prototype.hasOwnProperty.call(e.props,t)&&"string"==typeof e.props[t]){i=e.props[t];break}return r="function"==typeof this.textTransform?this.textTransform(t,e):this.textTransform,i&&"uppercase"===r?i=i.toUpperCase():i&&"lowercase"===r?i=i.toLowerCase():i&&"capitalize"===r&&(i=i.toLowerCase().split(" ").map((t=>t[0].toUpperCase()+t.slice(1))).join(" ")),i}};ot(dt,"TextAttr");var mt=dt,bt=class{constructor(t){var e,i;null!=t&&t.font?this.font=t.font:(this.family=null!=(e=null==t?void 0:t.fontFamily)?e:"sans-serif",this.size=null!=(i=null==t?void 0:t.fontSize)?i:12,this.weight=null==t?void 0:t.fontWeight,this.style=null==t?void 0:t.fontStyle)}get(t,e){if(this.font)return"function"==typeof this.font?this.font(t,e):this.font;let i="";this.style&&(i="function"==typeof this.style?`${this.style(t,e)} `:`${this.style} `);let s,r,n="";return this.weight&&(n="function"==typeof this.weight?`${this.weight(t,e)} `:`${this.weight} `),s="function"==typeof this.size?this.size(t,e):this.size,r="function"==typeof this.family?this.family(t,e):this.family,`${i}${n}${s}px ${r}`}};ot(bt,"FontAttr");var wt=bt,_t=class{constructor(t,e=[]){this.value=null!=t?t:e,this.perFeature="function"==typeof this.value&&2===this.value.length}get(t,e){return"function"==typeof this.value?this.value(t,e):this.value}};ot(_t,"ArrayAttr");var pt=_t,yt=ot(((t,e,i)=>{let s,r,n,a=[],o=0,h=0,l=0,f=0,c=0,u=0,d=0,m=0,b=0,w=0,_=0,p=0;if(t.length<2)return[];if(2===t.length)return l=Math.sqrt(at(t[1].x-t[0].x,2)+at(t[1].y-t[0].y,2)),[{length:l,beginIndex:0,beginDistance:0,endIndex:2,endDistance:l}];for(f=Math.sqrt(at(t[1].x-t[0].x,2)+at(t[1].y-t[0].y,2)),o=1,h=t.length-1;o<h;o++)s=t[o-1],r=t[o],n=t[o+1],u=r.x-s.x,d=r.y-s.y,m=n.x-r.x,b=n.y-r.y,c=Math.sqrt(m*m+b*b),l+=f,w=Math.acos((u*m+d*b)/(f*c)),(w>e||l-p>i)&&(a.push({length:l-p,beginDistance:p,beginIndex:_,endIndex:o+1,endDistance:l}),_=o,p=l),f=c;return o-_>0&&a.push({length:l-p+c,beginIndex:_,beginDistance:p,endIndex:o+1,endDistance:l+c}),a}),"linelabel");function gt(t,e,i,s){let r=[];for(let n of t){let t=yt(n,Math.PI/45,e);for(let a of t)if(a.length>=e+s){let t=new u(n[a.beginIndex].x,n[a.beginIndex].y),o=n[a.endIndex-1],h=new u((o.x-t.x)/a.length,(o.y-t.y)/a.length);for(let n=s;n<a.length-e;n+=i)r.push({start:t.add(h.mult(n)),end:t.add(h.mult(n+e))})}}return r}function vt(t,e,i,s){let r=e.x-t.x,n=e.y-t.y,a=Math.sqrt(at(e.x-t.x,2)+at(e.y-t.y,2)),o=[];for(let e=0;e<i+s;e+=2*s){let i=1*e/a;o.push({x:t.x+i*r,y:t.y+i*n})}return o}function xt(t,e){if(t.length<=e)return[t];let i,s,r=e-1,n=t.lastIndexOf(" ",r),a=t.indexOf(" ",r);return-1===n&&-1===a?[t]:(-1===a||n>=0&&r-n<a-r?(i=t.substring(0,n),s=t.substring(n+1,t.length)):(i=t.substring(0,a),s=t.substring(a+1,t.length)),[i,...xt(s,e)])}ot(gt,"simpleLabel"),ot(vt,"lineCells"),ot(xt,"linebreak");var kt=(t=>(t[t.Point=1]="Point",t[t.Line=2]="Line",t[t.Polygon=3]="Polygon",t))(kt||{});function Mt(t){return`${t.x}:${t.y}:${t.z}`}ot(Mt,"toIndex");var zt=ot(((t,e,i)=>{t.pos=e;let s=t.readVarint()+t.pos,r=1,n=0,a=0,o=0,h=1/0,l=-1/0,f=1/0,c=-1/0,d=[],m=[];for(;t.pos<s;){if(n<=0){let e=t.readVarint();r=7&e,n=e>>3}if(n--,1===r||2===r)a+=t.readSVarint()*i,o+=t.readSVarint()*i,a<h&&(h=a),a>l&&(l=a),o<f&&(f=o),o>c&&(c=o),1===r&&(m.length>0&&d.push(m),m=[]),m.push(new u(a,o));else{if(7!==r)throw new Error(`unknown command ${r}`);m&&m.push(m[0].clone())}}return m&&d.push(m),{geom:d,bbox:{minX:h,minY:f,maxX:l,maxY:c}}}),"loadGeomAndBbox");function jt(t,e){let i=new D(new N(t)),s=new Map;for(let[t,r]of Object.entries(i.layers)){let i=[],n=r;for(let t=0;t<n.length;t++){let s=zt(n.feature(t)._pbf,n.feature(t)._geometry,e/n.extent),r=0;for(let t of s.geom)r+=t.length;i.push({id:n.feature(t).id,geomType:n.feature(t).type,geom:s.geom,numVertices:r,bbox:s.bbox,props:n.feature(t).properties})}s.set(t,i)}return s}ot(jt,"parseTile");var Lt=class{constructor(t,e){this.p="string"==typeof t?new et.PMTiles(t):t,this.zoomaborts=[],this.shouldCancelZooms=e}get(t,e){return ht(this,null,(function*(){this.shouldCancelZooms&&(this.zoomaborts=this.zoomaborts.filter((e=>e.z===t.z||(e.controller.abort(),!1))));let i=new AbortController;this.zoomaborts.push({z:t.z,controller:i});let s=i.signal,r=yield this.p.getZxy(t.z,t.x,t.y,s);return r?jt(r.data,e):new Map}))}};ot(Lt,"PmtilesSource");var Tt=Lt,Pt=class{constructor(t,e){this.url=t,this.zoomaborts=[],this.shouldCancelZooms=e}get(t,e){return ht(this,null,(function*(){this.shouldCancelZooms&&(this.zoomaborts=this.zoomaborts.filter((e=>e.z===t.z||(e.controller.abort(),!1))));let i=this.url.replace("{z}",t.z.toString()).replace("{x}",t.x.toString()).replace("{y}",t.y.toString()),s=new AbortController;this.zoomaborts.push({z:t.z,controller:s});let r=s.signal;return new Promise(((t,s)=>{fetch(i,{signal:r}).then((t=>t.arrayBuffer())).then((i=>{let s=jt(i,e);t(s)})).catch((t=>{s(t)}))}))}))}};ot(Pt,"ZxySource");var St=Pt,Et=6378137,$t=85.0511287798,At=Et*Math.PI,Ct=ot((t=>{let e=Math.PI/180,i=Math.max(Math.min($t,t[0]),-$t),s=Math.sin(i*e);return new u(Et*t[1]*e,Et*Math.log((1+s)/(1-s))/2)}),"project");function Dt(t){return t*t}function Ft(t,e){return Dt(t.x-e.x)+Dt(t.y-e.y)}function It(t,e,i){let s=Ft(e,i);if(0===s)return Ft(t,e);let r=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/s;return r=Math.max(0,Math.min(1,r)),Ft(t,new u(e.x+r*(i.x-e.x),e.y+r*(i.y-e.y)))}function Bt(t,e){let i=!1;for(let s=0,r=e.length-1;s<e.length;r=s++){let n=e[s].x,a=e[s].y,o=e[r].y;a>t.y!=o>t.y&&t.x<(e[r].x-n)*(t.y-a)/(o-a)+n&&(i=!i)}return i}function Rt(t){let e=0;for(let i=0;i<t.length;i++){let s=(i+1)%t.length;e+=t[i].x*t[s].y,e-=t[s].x*t[i].y}return e<0}function Nt(t,e){let i=!1;for(let s of e)if(Rt(s))Bt(t,s)&&(i=!1);else{if(i)return!0;Bt(t,s)&&(i=!0)}return i}function Vt(t,e){let i=1/0;for(let s of e){let e=Math.sqrt(Ft(t,s[0]));e<i&&(i=e)}return i}function Ot(t,e){let i=1/0;for(let s of e)for(let e=0;e<s.length-1;e++){let r=Math.sqrt(It(t,s[e],s[e+1]));r<i&&(i=r)}return i}ot(Dt,"sqr"),ot(Ft,"dist2"),ot(It,"distToSegmentSquared"),ot(Bt,"isInRing"),ot(Rt,"isCcw"),ot(Nt,"pointInPolygon"),ot(Vt,"pointMinDistToPoints"),ot(Ot,"pointMinDistToLines");var Ut=class{constructor(t,e){this.source=t,this.cache=new Map,this.inflight=new Map,this.tileSize=e}get(t){return ht(this,null,(function*(){let e=Mt(t);return new Promise(((i,s)=>{let r=this.cache.get(e);if(r)r.used=performance.now(),i(r.data);else{let r=this.inflight.get(e);r?r.push({resolve:i,reject:s}):(this.inflight.set(e,[]),this.source.get(t,this.tileSize).then((t=>{this.cache.set(e,{used:performance.now(),data:t});let s=this.inflight.get(e);if(s)for(let e of s)e.resolve(t);if(this.inflight.delete(e),i(t),this.cache.size>=64){let t,e=1/0;this.cache.forEach(((i,s)=>{i.used<e&&(e=i.used,t=s)})),t&&this.cache.delete(t)}})).catch((t=>{let i=this.inflight.get(e);if(i)for(let e of i)e.reject(t);this.inflight.delete(e),s(t)})))}}))}))}queryFeatures(t,e,i,s){let r=Ct([e,t]),n=new u((r.x+At)/(2*At),1-(r.y+At)/(2*At));n.x>1&&(n.x=n.x-Math.floor(n.x));let a=n.mult(1<<i),o=Math.floor(a.x),h=Math.floor(a.y),l=Mt({z:i,x:o,y:h}),f=[],c=this.cache.get(l);if(c){let t=new u((a.x-o)*this.tileSize,(a.y-h)*this.tileSize);for(let[e,i]of c.data.entries())for(let r of i)1===r.geomType?Vt(t,r.geom)<s&&f.push({feature:r,layerName:e}):2===r.geomType?Ot(t,r.geom)<s&&f.push({feature:r,layerName:e}):Nt(t,r.geom)&&f.push({feature:r,layerName:e})}return f}};ot(Ut,"TileCache");var Xt,qt=Ut,Yt=(t=>(t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right",t))(Yt||{}),Zt=((Xt=Zt||{})[Xt.N=1]="N",Xt[Xt.Ne=2]="Ne",Xt[Xt.E=3]="E",Xt[Xt.Se=4]="Se",Xt[Xt.S=5]="S",Xt[Xt.Sw=6]="Sw",Xt[Xt.W=7]="W",Xt[Xt.Nw=8]="Nw",Xt),Ht=ot(((t,e,i)=>{let s=document.createElement("canvas"),r=s.getContext("2d");return s.width=t,s.height=e,null!==r&&i(s,r),s}),"createPattern"),Gt=class{constructor(t){var e;this.pattern=t.pattern,this.fill=new ft(t.fill,"black"),this.opacity=new ut(t.opacity,1),this.stroke=new ft(t.stroke,"black"),this.width=new ut(t.width,0),this.perFeature=null!=(e=this.fill.perFeature||this.opacity.perFeature||this.stroke.perFeature||this.width.perFeature||t.perFeature)&&e,this.doStroke=!1}before(t,e){if(!this.perFeature){t.globalAlpha=this.opacity.get(e),t.fillStyle=this.fill.get(e),t.strokeStyle=this.stroke.get(e);let i=this.width.get(e);i>0&&(this.doStroke=!0),t.lineWidth=i}if(this.pattern){let e=t.createPattern(this.pattern,"repeat");e&&(t.fillStyle=e)}}draw(t,e,i,s){let r=!1;if(this.perFeature){t.globalAlpha=this.opacity.get(i,s),t.fillStyle=this.fill.get(i,s);let e=this.width.get(i,s);e&&(r=!0,t.strokeStyle=this.stroke.get(i,s),t.lineWidth=e)}let n=ot((()=>{t.fill(),(r||this.doStroke)&&t.stroke()}),"drawPath");t.beginPath();for(let i of e)for(let e=0;e<i.length;e++){let s=i[e];0===e?t.moveTo(s.x,s.y):t.lineTo(s.x,s.y)}n()}};ot(Gt,"PolygonSymbolizer");var Wt=Gt;function Kt(t,e){return i=>{let s=i-t;return s>=0&&s<e.length?e[s]:0}}function Jt(t,e){let i=0;for(;e[i+1][0]<t;)i++;return i}function Qt(t,e,i){return t*(i-e)+e}function te(t,e,i,s){let r=s[e+1][0]-s[e][0],n=t-s[e][0];return 0===r?0:1===i?n/r:(at(i,n)-1)/(at(i,r)-1)}function ee(t,e){return i=>{if(e.length<1)return 0;if(i<=e[0][0])return e[0][1];if(i>=e[e.length-1][0])return e[e.length-1][1];let s=Jt(i,e);return Qt(te(i,s,t,e),e[s][1],e[s+1][1])}}function ie(t,e){return i=>{if(e.length<1)return 0;let s=t;for(let t=0;t<e.length;t++)i>=e[t][0]&&(s=e[t][1]);return s}}function se(t){return ee(1,t)}ot(Kt,"arr"),ot(Jt,"getStopIndex"),ot(Qt,"interpolate"),ot(te,"computeInterpolationFactor"),ot(ee,"exp"),ot(ie,"step"),ot(se,"linear");var re=class{constructor(t){var e;this.color=new ft(t.color,"black"),this.width=new ut(t.width),this.opacity=new ut(t.opacity),this.dash=t.dash?new pt(t.dash):null,this.dashColor=new ft(t.dashColor,"black"),this.dashWidth=new ut(t.dashWidth,1),this.lineCap=new ft(t.lineCap,"butt"),this.lineJoin=new ft(t.lineJoin,"miter"),this.skip=!1,this.perFeature=!!(null!=(e=this.dash)&&e.perFeature||this.color.perFeature||this.opacity.perFeature||this.width.perFeature||this.lineCap.perFeature||this.lineJoin.perFeature||t.perFeature)}before(t,e){this.perFeature||(t.strokeStyle=this.color.get(e),t.lineWidth=this.width.get(e),t.globalAlpha=this.opacity.get(e),t.lineCap=this.lineCap.get(e),t.lineJoin=this.lineJoin.get(e))}draw(t,e,i,s){if(this.skip)return;let r=ot((()=>{this.perFeature&&(t.globalAlpha=this.opacity.get(i,s),t.lineCap=this.lineCap.get(i,s),t.lineJoin=this.lineJoin.get(i,s)),this.dash?(t.save(),this.perFeature?(t.lineWidth=this.dashWidth.get(i,s),t.strokeStyle=this.dashColor.get(i,s),t.setLineDash(this.dash.get(i,s))):t.setLineDash(this.dash.get(i)),t.stroke(),t.restore()):(t.save(),this.perFeature&&(t.lineWidth=this.width.get(i,s),t.strokeStyle=this.color.get(i,s)),t.stroke(),t.restore())}),"strokePath");t.beginPath();for(let i of e)for(let e=0;e<i.length;e++){let s=i[e];0===e?t.moveTo(s.x,s.y):t.lineTo(s.x,s.y)}r()}};ot(re,"LineSymbolizer");var ne=re,ae=class{constructor(t){this.name=t.name,this.sheet=t.sheet,this.dpr=window.devicePixelRatio}place(t,e,i){let s=new u(e[0][0].x,e[0][0].y),r=this.sheet.get(this.name),n=r.w/this.dpr,a=r.h/this.dpr;return[{anchor:s,bboxes:[{minX:s.x-n/2,minY:s.y-a/2,maxX:s.x+n/2,maxY:s.y+a/2}],draw:ot((t=>{t.globalAlpha=1,t.drawImage(this.sheet.canvas,r.x,r.y,r.w,r.h,-r.w/2/this.dpr,-r.h/2/this.dpr,r.w/2,r.h/2)}),"draw")}]}};ot(ae,"IconSymbolizer");var oe=ae,he=class{constructor(t){this.radius=new ut(t.radius,3),this.fill=new ft(t.fill,"black"),this.stroke=new ft(t.stroke,"white"),this.width=new ut(t.width,0),this.opacity=new ut(t.opacity)}draw(t,e,i,s){t.globalAlpha=this.opacity.get(i,s);let r=this.radius.get(i,s),n=this.width.get(i,s);n>0&&(t.strokeStyle=this.stroke.get(i,s),t.lineWidth=n,t.beginPath(),t.arc(e[0][0].x,e[0][0].y,r+n/2,0,2*Math.PI),t.stroke()),t.fillStyle=this.fill.get(i,s),t.beginPath(),t.arc(e[0][0].x,e[0][0].y,r,0,2*Math.PI),t.fill()}place(t,e,i){let s=new u(e[0][0].x,e[0][0].y),r=this.radius.get(t.zoom,i);return[{anchor:s,bboxes:[{minX:s.x-r,minY:s.y-r,maxX:s.x+r,maxY:s.y+r}],draw:ot((e=>{this.draw(e,[[new u(0,0)]],t.zoom,i)}),"draw")}]}};ot(he,"CircleSymbolizer");var le=he,fe=class{constructor(t){this.font=new wt(t),this.text=new mt(t),this.fill=new ft(t.fill,"black"),this.background=new ft(t.background,"white"),this.padding=new ut(t.padding,0)}place(t,e,i){let s=this.text.get(t.zoom,i);if(!s)return;let r=this.font.get(t.zoom,i);t.scratch.font=r;let n=t.scratch.measureText(s),a=n.width,o=n.actualBoundingBoxAscent,h=n.actualBoundingBoxDescent,l=new u(e[0][0].x,e[0][0].y),f=this.padding.get(t.zoom,i);return[{anchor:l,bboxes:[{minX:l.x-a/2-f,minY:l.y-o-f,maxX:l.x+a/2+f,maxY:l.y+h+f}],draw:ot((e=>{e.globalAlpha=1,e.fillStyle=this.background.get(t.zoom,i),e.fillRect(-a/2-f,-o-f,a+2*f,o+h+2*f),e.fillStyle=this.fill.get(t.zoom,i),e.font=r,e.fillText(s,-a/2,0)}),"draw")}]}};ot(fe,"ShieldSymbolizer");var ce=fe,ue=class{constructor(t){this.list=t}place(t,e,i){let s=this.list[0].place(t,e,i);if(!s)return;let r=s[0],n=r.anchor,a=r.bboxes[0],o=a.maxY-a.minY,h=[{draw:r.draw,translate:{x:0,y:0}}],l=[[new u(e[0][0].x,e[0][0].y+o)]];for(let e=1;e<this.list.length;e++)s=this.list[e].place(t,l,i),s&&(r=s[0],a=me(a,r.bboxes[0]),h.push({draw:r.draw,translate:{x:0,y:o}}));return[{anchor:n,bboxes:[a],draw:ot((t=>{for(let e of h)t.save(),t.translate(e.translate.x,e.translate.y),e.draw(t),t.restore()}),"draw")}]}};ot(ue,"FlexSymbolizer");var de=ue,me=ot(((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)})),"mergeBbox"),be=class{constructor(t){this.list=t}place(t,e,i){let s=this.list[0];if(!s)return;let r=s.place(t,e,i);if(!r)return;let n=r[0],a=n.anchor,o=n.bboxes[0],h=[n.draw];for(let s=1;s<this.list.length;s++){if(r=this.list[s].place(t,e,i),!r)return;n=r[0],o=me(o,n.bboxes[0]),h.push(n.draw)}return[{anchor:a,bboxes:[o],draw:ot((t=>{for(let e of h)e(t)}),"draw")}]}};ot(be,"GroupSymbolizer");var we=be,_e=class{constructor(t){this.symbolizer=t}place(t,e,i){let s=e[0][0],r=this.symbolizer.place(t,[[new u(0,0)]],i);if(!r||0===r.length)return;let n=r[0],a=n.bboxes[0],o=a.maxX-a.minX,h=a.maxY-a.minY;return[{anchor:s,bboxes:[{minX:s.x-o/2,maxX:s.x+o/2,minY:s.y-h/2,maxY:s.y+h/2}],draw:ot((t=>{t.translate(-o/2,h/2-a.maxY),n.draw(t,{justify:2})}),"draw")}]}};ot(_e,"CenteredSymbolizer");var pe=_e,ye=class{constructor(t,e){this.padding=new ut(t,0),this.symbolizer=e}place(t,e,i){let s=this.symbolizer.place(t,e,i);if(!s||0===s.length)return;let r=this.padding.get(t.zoom,i);for(let t of s)for(let e of t.bboxes)e.minX-=r,e.minY-=r,e.maxX+=r,e.maxY+=r;return s}};ot(ye,"Padding");var ge=ye,ve=class{constructor(t){this.font=new wt(t),this.text=new mt(t),this.fill=new ft(t.fill,"black"),this.stroke=new ft(t.stroke,"black"),this.width=new ut(t.width,0),this.lineHeight=new ut(t.lineHeight,1),this.letterSpacing=new ut(t.letterSpacing,0),this.maxLineCodeUnits=new ut(t.maxLineChars,15),this.justify=t.justify}place(t,e,i){let s=this.text.get(t.zoom,i);if(!s)return;let r=this.font.get(t.zoom,i);t.scratch.font=r;let n=this.letterSpacing.get(t.zoom,i),a=xt(s,this.maxLineCodeUnits.get(t.zoom,i)),o="",h=0;for(let t of a)t.length>h&&(h=t.length,o=t);let l=t.scratch.measureText(o),f=l.width+n*(h-1),c=l.actualBoundingBoxAscent,d=l.actualBoundingBoxDescent,m=(c+d)*this.lineHeight.get(t.zoom,i),b=new u(e[0][0].x,e[0][0].y);return[{anchor:b,bboxes:[{minX:b.x,minY:b.y-c,maxX:b.x+f,maxY:b.y+d+(a.length-1)*m}],draw:ot(((e,s)=>{e.globalAlpha=1,e.font=r,e.fillStyle=this.fill.get(t.zoom,i);let o=this.width.get(t.zoom,i),h=0;for(let r of a){let a=0;if(2===this.justify||s&&2===s.justify?a=(f-e.measureText(r).width)/2:(3===this.justify||s&&3===s.justify)&&(a=f-e.measureText(r).width),o)if(e.lineWidth=2*o,e.strokeStyle=this.stroke.get(t.zoom,i),n>0){let t=a;for(let i of r)e.strokeText(i,t,h),t+=e.measureText(i).width+n}else e.strokeText(r,a,h);if(n>0){let t=a;for(let i of r)e.fillText(i,t,h),t+=e.measureText(i).width+n}else e.fillText(r,a,h);h+=m}}),"draw")}]}};ot(ve,"TextSymbolizer");var xe=ve,ke=class{constructor(t){this.centered=new pe(new xe(t))}place(t,e,i){return this.centered.place(t,e,i)}};ot(ke,"CenteredTextSymbolizer");var Me=ke,ze=class{constructor(t,e){var i,s,r;this.symbolizer=t,this.offsetX=new ut(e.offsetX,0),this.offsetY=new ut(e.offsetY,0),this.justify=null!=(i=e.justify)?i:void 0,this.placements=null!=(s=e.placements)?s:[2,6,8,4,1,3,5,7],this.ddValues=null!=(r=e.ddValues)?r:()=>({})}place(t,e,i){if(1!==i.geomType)return;let s=e[0][0],r=this.symbolizer.place(t,[[new u(0,0)]],i);if(!r||0===r.length)return;let n=r[0],a=n.bboxes[0],o=this.offsetX,h=this.offsetY,l=this.justify,f=this.placements,{offsetX:c,offsetY:d,justify:m,placements:b}=this.ddValues(t.zoom,i)||{};c&&(o=new ut(c,0)),d&&(h=new ut(d,0)),m&&(l=m),b&&(f=b);let w,_=o.get(t.zoom,i),p=h.get(t.zoom,i),y=ot(((t,e)=>({minX:t.x+e.x+a.minX,minY:t.y+e.y+a.minY,maxX:t.x+e.x+a.maxX,maxY:t.y+e.y+a.maxY})),"getBbox"),g=new u(_,p),v=ot((t=>{t.translate(g.x,g.y),n.draw(t,{justify:w})}),"draw"),x=ot(((e,i)=>{let r=y(e,i);if(!t.index.bboxCollides(r,t.order))return[{anchor:s,bboxes:[r],draw:v}]}),"placeLabelInPoint");for(let t of f){let e=this.computeXaxisOffset(_,a,t),i=this.computeYaxisOffset(p,a,t);return w=this.computeJustify(l,t),g=new u(e,i),x(s,g)}}computeXaxisOffset(t,e,i){let s=e.maxX,r=s/2;return[1,5].includes(i)?t-r:[8,7,6].includes(i)?t-s:t}computeYaxisOffset(t,e,i){let s=Math.abs(e.minY),r=e.maxY,n=(e.minY+e.maxY)/2;return[3,7].includes(i)?t-n:[8,2,1].includes(i)?t-r:[6,4,5].includes(i)?t+s:t}computeJustify(t,e){return t||([1,5].includes(e)?2:[2,3,4].includes(e)?1:3)}};ot(ze,"OffsetSymbolizer");var je=ze,Le=class{constructor(t){this.symbolizer=new je(new xe(t),t)}place(t,e,i){return this.symbolizer.place(t,e,i)}};ot(Le,"OffsetTextSymbolizer");var Te=Le,Pe=(t=>(t[t.Above=1]="Above",t[t.Center=2]="Center",t[t.Below=3]="Below",t))(Pe||{}),Se=class{constructor(t){var e;this.font=new wt(t),this.text=new mt(t),this.fill=new ft(t.fill,"black"),this.stroke=new ft(t.stroke,"black"),this.width=new ut(t.width,0),this.offset=new ut(t.offset,0),this.position=null!=(e=t.position)?e:1,this.maxLabelCodeUnits=new ut(t.maxLabelChars,40),this.repeatDistance=new ut(t.repeatDistance,250)}place(t,e,i){let s=this.text.get(t.zoom,i);if(!s||s.length>this.maxLabelCodeUnits.get(t.zoom,i))return;let r=i.bbox;if(r.maxY-r.minY<20&&r.maxX-r.minX<20)return;let n=this.font.get(t.zoom,i);t.scratch.font=n;let a=t.scratch.measureText(s),o=a.width,h=a.actualBoundingBoxAscent+a.actualBoundingBoxDescent,l=this.repeatDistance.get(t.zoom,i);t.overzoom>4&&(l*=1<<t.overzoom-4);let f=2*h,c=gt(e,o,l,f);if(0===c.length)return;let u=[];for(let e of c){let r=e.end.x-e.start.x,a=e.end.y-e.start.y,c=vt(e.start,e.end,o,f/2).map((t=>({minX:t.x-f/2,minY:t.y-f/2,maxX:t.x+f/2,maxY:t.y+f/2}))),d=ot((e=>{e.globalAlpha=1,e.rotate(Math.atan2(a,r)),r<0&&(e.scale(-1,-1),e.translate(-o,0));let l=0;3===this.position?l+=h:2===this.position&&(l+=h/2),e.translate(0,l-this.offset.get(t.zoom,i)),e.font=n;let f=this.width.get(t.zoom,i);f&&(e.lineWidth=f,e.strokeStyle=this.stroke.get(t.zoom,i),e.strokeText(s,0,0)),e.fillStyle=this.fill.get(t.zoom,i),e.fillText(s,0,0)}),"draw");u.push({anchor:e.start,bboxes:c,draw:d,deduplicationKey:s,deduplicationDistance:l})}return u}};ot(Se,"LineLabelSymbolizer");var Ee=Se,$e=ot(((t,e)=>{let i=t[e];return"string"==typeof i?i:""}),"getString"),Ae=ot(((t,e)=>{let i=t[e];return"number"==typeof i?i:0}),"getNumber"),Ce=ot((t=>[{dataLayer:"earth",symbolizer:new Wt({fill:t.earth})},{dataLayer:"landuse",symbolizer:new Wt({fill:ot((e=>P(t.park_a,t.park_b,Math.min(Math.max(e/12,12),0))),"fill")}),filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["allotments","village_green","playground"].includes(i)}),"filter")},{dataLayer:"landuse",symbolizer:new Wt({fill:t.park_b,opacity:.7}),filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course"].includes(i)}),"filter")},{dataLayer:"landuse",symbolizer:new Wt({fill:t.hospital}),filter:ot(((t,e)=>"hospital"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Wt({fill:t.industrial}),filter:ot(((t,e)=>"industrial"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Wt({fill:t.school}),filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["school","university","college"].includes(i)}),"filter")},{dataLayer:"landuse",symbolizer:new Wt({fill:t.beach}),filter:ot(((t,e)=>"beach"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Wt({fill:t.zoo}),filter:ot(((t,e)=>"zoo"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Wt({fill:t.zoo}),filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["military","naval_base","airfield"].includes(i)}),"filter")},{dataLayer:"natural",symbolizer:new Wt({fill:ot((e=>P(t.wood_a,t.wood_b,Math.min(Math.max(e/12,12),0))),"fill")}),filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["wood","nature_reserve","forest"].includes(i)}),"filter")},{dataLayer:"natural",symbolizer:new Wt({fill:ot((e=>P(t.scrub_a,t.scrub_b,Math.min(Math.max(e/12,12),0))),"fill")}),filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["scrub","grassland","grass"].includes(i)}),"filter")},{dataLayer:"natural",symbolizer:new Wt({fill:t.scrub_b}),filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["scrub","grassland","grass"].includes(i)}),"filter")},{dataLayer:"natural",symbolizer:new Wt({fill:t.glacier}),filter:ot(((t,e)=>"glacier"===e.props["pmap:kind"]),"filter")},{dataLayer:"natural",symbolizer:new Wt({fill:t.sand}),filter:ot(((t,e)=>"sand"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Wt({fill:t.aerodrome}),filter:ot(((t,e)=>"aerodrome"===e.props["pmap:kind"]),"filter")},{dataLayer:"water",symbolizer:new Wt({fill:t.water})},{dataLayer:"transit",symbolizer:new ne({color:t.runway,width:ot((t=>ee(1.6,[[11,0],[13,4],[19,30]])(t)),"width")}),filter:ot(((t,e)=>"runway"===e.props["pmap:kind_detail"]),"filter")},{dataLayer:"transit",symbolizer:new ne({color:t.runway,width:ot((t=>ee(1.6,[[14,0],[14.5,1],[16,6]])(t)),"width")}),filter:ot(((t,e)=>"taxiway"===e.props["pmap:kind_detail"]),"filter")},{dataLayer:"transit",symbolizer:new ne({color:t.pier,width:ot((t=>ee(1.6,[[13,0],[13.5,0,5],[21,16]])(t)),"width")}),filter:ot(((t,e)=>"pier"===e.props["pmap:kind"]),"filter")},{dataLayer:"physical_line",minzoom:14,symbolizer:new ne({color:t.water,width:ot((t=>ee(1.6,[[9,0],[9.5,1],[18,12]])(t)),"width")}),filter:ot(((t,e)=>"river"===e.props["pmap:kind"]),"filter")},{dataLayer:"physical_line",minzoom:14,symbolizer:new ne({color:t.water,width:.5}),filter:ot(((t,e)=>"stream"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Wt({fill:t.pedestrian}),filter:ot(((t,e)=>"pedestrian"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Wt({fill:t.pier}),filter:ot(((t,e)=>"pier"===e.props["pmap:kind"]),"filter")},{dataLayer:"buildings",symbolizer:new Wt({fill:t.buildings,opacity:.5})},{dataLayer:"roads",symbolizer:new ne({color:t.major,width:ot((t=>ee(1.6,[[14,0],[20,7]])(t)),"width")}),filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["other","path"].includes(i)}),"filter")},{dataLayer:"roads",symbolizer:new ne({color:t.major,width:ot((t=>ee(1.6,[[13,0],[18,8]])(t)),"width")}),filter:ot(((t,e)=>"minor_road"===e.props["pmap:kind"]),"filter")},{dataLayer:"roads",symbolizer:new ne({color:t.major,width:ot((t=>ee(1.6,[[7,0],[12,1.2],[15,3],[18,13]])(t)),"width")}),filter:ot(((t,e)=>"medium_road"===e.props["pmap:kind"]),"filter")},{dataLayer:"roads",symbolizer:new ne({color:t.major,width:ot((t=>ee(1.6,[[6,0],[12,1.6],[15,3],[18,13]])(t)),"width")}),filter:ot(((t,e)=>"major_road"===e.props["pmap:kind"]),"filter")},{dataLayer:"roads",symbolizer:new ne({color:t.major,width:ot((t=>ee(1.6,[[3,0],[6,1.1],[12,1.6],[15,5],[18,15]])(t)),"width")}),filter:ot(((t,e)=>"highway"===e.props["pmap:kind"]),"filter")},{dataLayer:"boundaries",symbolizer:new ne({dash:[3,2],color:t.boundaries,width:1}),filter:ot(((t,e)=>{let i=e.props["pmap:min_admin_level"];return"number"==typeof i&&i<=2}),"filter")},{dataLayer:"transit",symbolizer:new ne({dash:[.3,.75],color:t.railway,dashWidth:ot((t=>ee(1.6,[[4,0],[7,.15],[19,9]])(t)),"dashWidth"),opacity:.5}),filter:ot(((t,e)=>"rail"===e.props["pmap:kind"]),"filter")},{dataLayer:"boundaries",symbolizer:new ne({dash:[3,2],color:t.boundaries,width:.5}),filter:ot(((t,e)=>{let i=e.props["pmap:min_admin_level"];return"number"==typeof i&&i>2}),"filter")}]),"paintRules"),De=ot((t=>{let e=["name"];return[{dataLayer:"roads",symbolizer:new Ee({labelProps:e,fill:t.roads_label_minor,font:"400 12px sans-serif",width:2,stroke:t.roads_label_minor_halo}),minzoom:16,filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["minor_road","other","path"].includes(i)}),"filter")},{dataLayer:"roads",symbolizer:new Ee({labelProps:e,fill:t.roads_label_major,font:"400 12px sans-serif",width:2,stroke:t.roads_label_major_halo}),minzoom:12,filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["highway","major_road","medium_road"].includes(i)}),"filter")},{dataLayer:"roads",symbolizer:new Ee({labelProps:e,fill:t.roads_label_major,font:"400 12px sans-serif",width:2,stroke:t.roads_label_major_halo}),minzoom:12,filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["highway","major_road","medium_road"].includes(i)}),"filter")},{dataLayer:"physical_point",symbolizer:new Me({labelProps:e,fill:t.ocean_label,lineHeight:1.5,letterSpacing:1,font:ot((t=>`400 ${se([[3,10],[10,12]])(t)}px sans-serif`),"font"),textTransform:"uppercase"}),filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["ocean","bay","strait","fjord"].includes(i)}),"filter")},{dataLayer:"physical_point",symbolizer:new Me({labelProps:e,fill:t.ocean_label,lineHeight:1.5,letterSpacing:1,font:ot((t=>`400 ${se([[3,0],[6,12],[10,12]])(t)}px sans-serif`),"font")}),filter:ot(((t,e)=>{let i=$e(e.props,"pmap:kind");return["sea","lake","water"].includes(i)}),"filter")},{dataLayer:"places",symbolizer:new Me({labelProps:ot((t=>t<6?["name:short"]:e),"labelProps"),fill:t.state_label,stroke:t.state_label_halo,width:1,lineHeight:1.5,font:ot((t=>t<6?"400 16px sans-serif":"400 12px sans-serif"),"font"),textTransform:"uppercase"}),filter:ot(((t,e)=>"region"===e.props["pmap:kind"]),"filter")},{dataLayer:"places",symbolizer:new Me({labelProps:e,fill:t.country_label,lineHeight:1.5,font:ot((()=>"600 12px sans-serif"),"font"),textTransform:"uppercase"}),filter:ot(((t,e)=>"country"===e.props["pmap:kind"]),"filter")},{dataLayer:"places",minzoom:9,symbolizer:new Me({labelProps:e,fill:t.city_label,lineHeight:1.5,font:ot(((t,e)=>{if(!e)return"400 12px sans-serif";let i=e.props["pmap:min_zoom"],s=400;i&&i<=5&&(s=600);let r=12,n=e.props["pmap:population_rank"];return n&&n>9&&(r=16),`${s} ${r}px sans-serif`}),"font")}),sort:ot(((t,e)=>Ae(t,"pmap:population_rank")-Ae(e,"pmap:population_rank")),"sort"),filter:ot(((t,e)=>"locality"===e.props["pmap:kind"]),"filter")},{dataLayer:"places",maxzoom:8,symbolizer:new we([new le({radius:2,fill:t.city_circle,stroke:t.city_circle_stroke,width:1.5}),new Te({labelProps:e,fill:t.city_label,stroke:t.city_label_halo,width:1,offsetX:6,offsetY:4.5,font:ot((()=>"400 12px sans-serif"),"font")})]),filter:ot(((t,e)=>"locality"===e.props["pmap:kind"]),"filter")}]}),"labelRules"),Fe={light:{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"},dark:{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"},white:{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"},grayscale:{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"},black:{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"}},Ie=ot(((t,e,i)=>{let s=[];for(let r of t){let t=[];for(let s of r)t.push(s.clone().mult(e).add(i));s.push(t)}return s}),"transformGeom"),Be=ot(((t,e)=>{let i=1<<e;return t<0?i+t:t>=i?t%i:t}),"wrap"),Re=class{constructor(t,e,i){this.tileCache=t,this.maxDataLevel=e,this.levelDiff=i}dataTilesForBounds(t,e){let i=at(2,t)/at(2,Math.ceil(t)),s=[],r=1,n=this.tileCache.tileSize;if(t<this.levelDiff)r=1/(1<<this.levelDiff-t)*i,s.push({dataTile:{z:0,x:0,y:0},origin:new u(0,0),scale:r,dim:n*r});else if(t<=this.levelDiff+this.maxDataLevel){let r=1<<this.levelDiff,a=256*i,o=Math.ceil(t)-this.levelDiff,h=Math.floor(e.minX/r/a),l=Math.floor(e.minY/r/a),f=Math.floor(e.maxX/r/a),c=Math.floor(e.maxY/r/a);for(let t=h;t<=f;t++)for(let e=l;e<=c;e++){let h=new u(t*r*a,e*r*a);s.push({dataTile:{z:o,x:Be(t,o),y:Be(e,o)},origin:h,scale:i,dim:n*i})}}else{let a=1<<this.levelDiff;r=(1<<Math.ceil(t)-this.maxDataLevel-this.levelDiff)*i;let o=Math.floor(e.minX/a/256/r),h=Math.floor(e.minY/a/256/r),l=Math.floor(e.maxX/a/256/r),f=Math.floor(e.maxY/a/256/r);for(let t=o;t<=l;t++)for(let e=h;e<=f;e++){let i=new u(t*a*256*r,e*a*256*r);s.push({dataTile:{z:this.maxDataLevel,x:Be(t,this.maxDataLevel),y:Be(e,this.maxDataLevel)},origin:i,scale:r,dim:n*r})}}return s}dataTileForDisplayTile(t){let e,i,s=1,r=this.tileCache.tileSize;if(t.z<this.levelDiff)e={z:0,x:0,y:0},s=1/(1<<this.levelDiff-t.z),i=new u(0,0),r*=s;else if(t.z<=this.levelDiff+this.maxDataLevel){let s=1<<this.levelDiff;e={z:t.z-this.levelDiff,x:Math.floor(t.x/s),y:Math.floor(t.y/s)},i=new u(e.x*s*256,e.y*s*256)}else{s=1<<t.z-this.maxDataLevel-this.levelDiff;let n=1<<this.levelDiff;e={z:this.maxDataLevel,x:Math.floor(t.x/n/s),y:Math.floor(t.y/n/s)},i=new u(e.x*n*s*256,e.y*n*s*256),r*=s}return{dataTile:e,scale:s,origin:i,dim:r}}getBbox(t,e){return ht(this,null,(function*(){let i=this.dataTilesForBounds(t,e);return(yield Promise.all(i.map((t=>this.tileCache.get(t.dataTile))))).map(((e,s)=>{let r=i[s];return{data:e,z:t,dataTile:r.dataTile,scale:r.scale,dim:r.dim,origin:r.origin}}))}))}getDisplayTile(t){return ht(this,null,(function*(){let e=this.dataTileForDisplayTile(t);return{data:yield this.tileCache.get(e.dataTile),z:t.z,dataTile:e.dataTile,scale:e.scale,origin:e.origin,dim:e.dim}}))}queryFeatures(t,e,i,s){let r=Math.round(i),n=Math.min(r-this.levelDiff,this.maxDataLevel);return this.tileCache.queryFeatures(t,e,n,s/(1<<r-n))}};ot(Re,"View");var Ne=Re,Ve=ot((t=>{let e=ot((t=>{let e,i=void 0===t.levelDiff?1:t.levelDiff,s=t.maxDataZoom||15;if("string"==typeof t.url)e=new URL(t.url,"http://example.com").pathname.endsWith(".pmtiles")?new Tt(t.url,!0):new St(t.url,!0);else{if(!t.url)throw new Error(`Invalid source ${t.url}`);e=new Tt(t.url,!0)}let r=new qt(e,256<<i);return new Ne(r,s,i)}),"sourceToViews"),i=new Map;if(t.sources)for(let s in t.sources)i.set(s,e(t.sources[s]));else i.set("",e(t));return i}),"sourcesToViews"),Oe=ot(((t,e,i)=>{let s=e/256,r=Math.floor(i.minX/256),n=Math.floor(i.minY/256),a=Math.floor(i.maxX/256),o=Math.floor(i.maxY/256),h=Math.log2(s),l=[];for(let e=r;e<=a;e++){let i=e%(1<<t);for(let e=n;e<=o;e++)l.push({display:Mt({z:t,x:i,y:e}),key:Mt({z:t-h,x:Math.floor(i/s),y:Math.floor(e/s)})})}return l}),"covering"),Ue=class{constructor(t,e){this.tree=new rt,this.current=new Map,this.dim=t,this.maxLabeledTiles=e}hasPrefix(t){for(let e of this.current.keys())if(e.startsWith(t))return!0;return!1}has(t){return this.current.has(t)}size(){return this.current.size}keys(){return this.current.keys()}searchBbox(t,e){let i=new Set;for(let s of this.tree.search(t))s.indexedLabel.order<=e&&i.add(s.indexedLabel);return i}searchLabel(t,e){let i=new Set;for(let s of t.bboxes)for(let t of this.tree.search(s))t.indexedLabel.order<=e&&i.add(t.indexedLabel);return i}bboxCollides(t,e){for(let i of this.tree.search(t))if(i.indexedLabel.order<=e)return!0;return!1}labelCollides(t,e){for(let i of t.bboxes)for(let t of this.tree.search(i))if(t.indexedLabel.order<=e)return!0;return!1}deduplicationCollides(t){if(!t.deduplicationKey||!t.deduplicationDistance)return!1;let e=t.deduplicationDistance,i={minX:t.anchor.x-e,minY:t.anchor.y-e,maxX:t.anchor.x+e,maxY:t.anchor.y+e};for(let s of this.tree.search(i))if(s.indexedLabel.deduplicationKey===t.deduplicationKey&&s.indexedLabel.anchor.dist(t.anchor)<e)return!0;return!1}makeEntry(t){this.current.get(t)&&console.log("consistency error 1");let e=new Set;this.current.set(t,e)}insert(t,e,i){let s={anchor:t.anchor,bboxes:t.bboxes,draw:t.draw,order:e,tileKey:i,deduplicationKey:t.deduplicationKey,deduplicationDistance:t.deduplicationDistance},r=this.current.get(i);if(!r){let t=new Set;this.current.set(i,t),r=t}r.add(s);let n=!1,a=!1;for(let e of t.bboxes)this.tree.insert({minX:e.minX,minY:e.minY,maxX:e.maxX,maxY:e.maxY,indexedLabel:s}),e.minX<0&&(n=!0),e.maxX>this.dim&&(a=!0);if(n||a){let s=n?this.dim:-this.dim,r=[];for(let e of t.bboxes)r.push({minX:e.minX+s,minY:e.minY,maxX:e.maxX+s,maxY:e.maxY});let a={anchor:new u(t.anchor.x+s,t.anchor.y),bboxes:r,draw:t.draw,order:e,tileKey:i},o=this.current.get(i);o&&o.add(a);for(let t of r)this.tree.insert({minX:t.minX,minY:t.minY,maxX:t.maxX,maxY:t.maxY,indexedLabel:a})}}pruneOrNoop(t){let e,i=t.split(":"),s=0,r=0;for(let t of this.current.keys()){let n=t.split(":");if(n[3]===i[3]){r++;let a=Math.sqrt(at(+n[0]-+i[0],2)+at(+n[1]-+i[1],2));a>s&&(s=a,e=t)}e&&r>this.maxLabeledTiles&&this.pruneKey(e)}}pruneKey(t){let e=this.current.get(t);if(!e)return;let i=[];for(let t of this.tree.all())e.has(t.indexedLabel)&&i.push(t);for(let t of i)this.tree.remove(t);this.current.delete(t)}removeLabel(t){let e=[];for(let i of this.tree.all())t===i.indexedLabel&&e.push(i);for(let t of e)this.tree.remove(t);let i=this.current.get(t.tileKey);i&&i.delete(t)}};ot(Ue,"Index");var Xe=Ue,qe=class{constructor(t,e,i,s,r){this.index=new Xe(256<<t,s),this.z=t,this.scratch=e,this.labelRules=i,this.callback=r}layout(t){let e=performance.now(),i=new Set;for(let[e,s]of t)for(let t of s){let s=`${Mt(t.dataTile)}:${e}`;this.index.has(s)||(this.index.makeEntry(s),i.add(s))}let s=new Set;for(let[e,r]of this.labelRules.entries()){if(!1===r.visible||r.minzoom&&this.z<r.minzoom||r.maxzoom&&this.z>r.maxzoom)continue;let n=r.dataSource||"",a=t.get(n);if(a)for(let t of a){let a=`${Mt(t.dataTile)}:${n}`;if(!i.has(a))continue;let o=t.data.get(r.dataLayer);if(void 0===o)continue;let h=o;r.sort&&h.sort(((t,e)=>r.sort?r.sort(t.props,e.props):0));let l={index:this.index,zoom:this.z,scratch:this.scratch,order:e,overzoom:this.z-t.dataTile.z};for(let i of h){if(r.filter&&!r.filter(this.z,i))continue;let n=Ie(i.geom,t.scale,t.origin),o=r.symbolizer.place(l,n,i);if(o)for(let i of o){let r=!1;if(!i.deduplicationKey||!this.index.deduplicationCollides(i)){if(this.index.labelCollides(i,1/0)){if(!this.index.labelCollides(i,e)){let n=this.index.searchLabel(i,1/0);for(let e of n){this.index.removeLabel(e);for(let i of e.bboxes)this.findInvalidatedTiles(s,t.dim,i,a)}this.index.insert(i,e,a),r=!0}}else this.index.insert(i,e,a),r=!0;if(r)for(let e of i.bboxes)(e.maxX>t.origin.x+t.dim||e.minX<t.origin.x||e.minY<t.origin.y||e.maxY>t.origin.y+t.dim)&&this.findInvalidatedTiles(s,t.dim,e,a)}}}}}for(let t of i)this.index.pruneOrNoop(t);return s.size>0&&this.callback&&this.callback(s),performance.now()-e}findInvalidatedTiles(t,e,i,s){let r=Oe(this.z,e,i);for(let e of r)e.key!==s&&this.index.hasPrefix(e.key)&&t.add(e.display)}add(t){let e=!0;for(let[i,s]of t)for(let t of s)this.index.has(`${Mt(t.dataTile)}:${i}`)||(e=!1);return e?0:this.layout(t)}};ot(qe,"Labeler");var Ye=qe,Ze=class{constructor(t,e,i,s){this.labelers=new Map,this.scratch=t,this.labelRules=e,this.maxLabeledTiles=i,this.callback=s}add(t,e){let i=this.labelers.get(t);return i||(i=new Ye(t,this.scratch,this.labelRules,this.maxLabeledTiles,this.callback),this.labelers.set(t,i)),i.add(e)}getIndex(t){let e=this.labelers.get(t);if(e)return e.index}};ot(Ze,"Labelers");var He=Ze;function Ge(t,e,i,s,r,n,a,o,h){let l=performance.now();t.save(),t.miterLimit=2;for(let s of r){if(s.minzoom&&e<s.minzoom||s.maxzoom&&e>s.maxzoom)continue;let r=i.get(s.dataSource||"");if(r)for(let e of r){let i=e.data.get(s.dataLayer);if(void 0===i)continue;s.symbolizer.before&&s.symbolizer.before(t,e.z);let r=e.origin,h=e.dim,l=e.scale;if(t.save(),o){t.beginPath();let e=Math.max(r.x-a.x,n.minX-a.x),i=Math.max(r.y-a.y,n.minY-a.y),s=Math.min(r.x-a.x+h,n.maxX-a.x),o=Math.min(r.y-a.y+h,n.maxY-a.y);t.rect(e,i,s-e,o-i),t.clip()}t.translate(r.x-a.x,r.y-a.y);for(let a of i){let i=a.geom,o=a.bbox;o.maxX*l+r.x<n.minX||o.minX*l+r.x>n.maxX||o.minY*l+r.y>n.maxY||o.maxY*l+r.y<n.minY||s.filter&&!s.filter(e.z,a)||(1!==l&&(i=Ie(i,l,new u(0,0))),s.symbolizer.draw(t,i,e.z,a))}t.restore()}}if(o&&(t.beginPath(),t.rect(n.minX-a.x,n.minY-a.y,n.maxX-n.minX,n.maxY-n.minY),t.clip()),s){let e=s.searchBbox(n,1/0);for(let i of e)if(t.save(),t.translate(i.anchor.x-a.x,i.anchor.y-a.y),i.draw(t),t.restore(),h){t.lineWidth=.5,t.strokeStyle=h,t.fillStyle=h,t.globalAlpha=1,t.fillRect(i.anchor.x-a.x-2,i.anchor.y-a.y-2,4,4);for(let e of i.bboxes)t.strokeRect(e.minX-a.x,e.minY-a.y,e.maxX-e.minX,e.maxY-e.minY)}}return t.restore(),performance.now()-l}ot(Ge,"paint");var We=6378137,Ke=85.0511287798,Je=We*Math.PI,Qe=ot((t=>{let e=Math.PI/180,i=Math.max(Math.min(Ke,t.y),-Ke),s=Math.sin(i*e);return new u(We*t.x*e,We*Math.log((1+s)/(1-s))/2)}),"project"),ti=ot((t=>{let e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(t.y/We))-Math.PI/2)*e,lng:t.x*e/We}}),"unproject"),ei=ot(((t,e)=>i=>{let s=Qe(i);return new u((s.x+Je)/(2*Je),1-(s.y+Je)/(2*Je)).mult(256*at(2,e)).sub(t)}),"instancedProject"),ii=ot(((t,e)=>i=>{let s=new u(i.x,i.y).add(t).div(256*at(2,e)),r=new u(s.x*(2*Je)-Je,2*Je*(1-s.y)-Je);return ti(r)}),"instancedUnproject"),si=ot(((t,e)=>Math.log2(e*(360/t)/256)),"getZoom"),ri=class{constructor(t){if(t.theme){let e=Fe[t.theme];this.paintRules=Ce(e),this.labelRules=De(e),this.backgroundColor=e.background}else this.paintRules=t.paintRules||[],this.labelRules=t.labelRules||[],this.backgroundColor=t.backgroundColor;this.views=Ve(t),this.debug=t.debug||""}drawContext(t,e,i,s,r){return ht(this,null,(function*(){let n=Qe(s),a=new u((n.x+Je)/(2*Je),1-(n.y+Je)/(2*Je)).clone().mult(256*at(2,r)).sub(new u(e/2,i/2)),o={minX:a.x,minY:a.y,maxX:a.x+e,maxY:a.y+i},h=[];for(let[t,e]of this.views){let i=e.getBbox(r,o);h.push({key:t,promise:i})}let l=yield Promise.all(h.map((t=>t.promise.then((e=>({status:"fulfilled",value:e,key:t.key})),(e=>({status:"rejected",value:[],reason:e,key:t.key})))))),f=new Map;for(let t of l)"fulfilled"===t.status&&f.set(t.key,t.value);let c=performance.now(),d=new Ye(r,t,this.labelRules,16,void 0);if(d.add(f),this.backgroundColor&&(t.save(),t.fillStyle=this.backgroundColor,t.fillRect(0,0,e,i),t.restore()),Ge(t,r,f,d.index,this.paintRules,o,a,!0,this.debug),this.debug){t.save(),t.translate(-a.x,-a.y),t.strokeStyle=this.debug,t.fillStyle=this.debug,t.font="12px sans-serif";let e=0;for(let[i,s]of f){for(let r of s){t.strokeRect(r.origin.x,r.origin.y,r.dim,r.dim);let s=r.dataTile;t.fillText(`${i+(i?" ":"")+s.z} ${s.x} ${s.y}`,r.origin.x+4,r.origin.y+14*(1+e))}e++}t.restore()}return{elapsed:performance.now()-c,project:ei(a,r),unproject:ii(a,r)}}))}drawCanvas(t,e,i){return ht(this,arguments,(function*(t,e,i,s={}){let r=window.devicePixelRatio,n=t.clientWidth,a=t.clientHeight;t.width===n*r&&t.height===a*r||(t.width=n*r,t.height=a*r),s.lang&&(t.lang=s.lang);let o=t.getContext("2d");if(o)return o.setTransform(r,0,0,r,0,0),this.drawContext(o,n,a,e,i);console.error("Failed to initialize canvas2d context.")}))}drawContextBounds(t,e,i,s,r){return ht(this,null,(function*(){let n=i.x-e.x,a=new u((e.x+i.x)/2,(e.y+i.y)/2);return this.drawContext(t,s,r,a,si(n,s))}))}drawCanvasBounds(t,e,i,s){return ht(this,arguments,(function*(t,e,i,s,r={}){let n=i.x-e.x,a=new u((e.x+i.x)/2,(e.y+i.y)/2);return this.drawCanvas(t,a,si(n,s),r)}))}};ot(ri,"Static");var ni=ri,ai=ot((t=>new Promise((e=>{setTimeout((()=>{e()}),t)}))),"timer"),oi=ot((t=>t.then((t=>({status:"fulfilled",value:t})),(t=>({status:"rejected",reason:t})))),"reflect"),hi=ot(((t={})=>{let e=class extends L.GridLayer{constructor(t={}){if(t.noWrap&&!t.bounds&&(t.bounds=[[-90,-180],[90,180]]),null==t.attribution&&(t.attribution='<a href="https://protomaps.com">Protomaps</a> © <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>'),super(t),t.theme){let e=Fe[t.theme];this.paintRules=Ce(e),this.labelRules=De(e),this.backgroundColor=e.background}else this.paintRules=t.paintRules||[],this.labelRules=t.labelRules||[],this.backgroundColor=t.backgroundColor;this.lastRequestedZ=void 0,this.tasks=t.tasks||[],this.views=Ve(t),this.debug=t.debug;let e=document.createElement("canvas").getContext("2d");this.scratch=e,this.onTilesInvalidated=t=>{for(let e of t)this.rerenderTile(e)},this.labelers=new He(this.scratch,this.labelRules,16,this.onTilesInvalidated),this.tileSize=256*window.devicePixelRatio,this.tileDelay=t.tileDelay||3,this.lang=t.lang}renderTile(t,e,i,s=()=>{}){return ht(this,null,(function*(){this.lastRequestedZ=t.z;let r=[];for(let[e,i]of this.views){let s=i.getDisplayTile(t);r.push({key:e,promise:s})}let n=yield Promise.all(r.map((t=>t.promise.then((e=>({status:"fulfilled",value:e,key:t.key})),(e=>({status:"rejected",reason:e,key:t.key})))))),a=new Map;for(let t of n)"fulfilled"===t.status?a.set(t.key,[t.value]):"AbortError"===t.reason.name||console.error(t.reason);if(e.key!==i||this.lastRequestedZ!==t.z||(yield Promise.all(this.tasks.map(oi)),e.key!==i)||this.lastRequestedZ!==t.z)return;let o=this.labelers.add(t.z,a);if(e.key!==i||this.lastRequestedZ!==t.z)return;let h=this.labelers.getIndex(t.z);if(!this._map)return;let l=this._map.getCenter().wrap(),f=this._getTiledPixelBounds(l),c=this._pxBoundsToTileRange(f).getCenter(),d=t.distanceTo(c)*this.tileDelay;if(yield ai(d),e.key!==i||this.lastRequestedZ!==t.z)return;let m={minX:256*t.x-16,minY:256*t.y-16,maxX:256*(t.x+1)+16,maxY:256*(t.y+1)+16},b=new u(256*t.x,256*t.y);e.width=this.tileSize,e.height=this.tileSize;let w=e.getContext("2d");if(!w)return void console.error("Failed to get Canvas context");w.setTransform(this.tileSize/256,0,0,this.tileSize/256,0,0),w.clearRect(0,0,256,256),this.backgroundColor&&(w.save(),w.fillStyle=this.backgroundColor,w.fillRect(0,0,256,256),w.restore());let _=0;if(_=Ge(w,t.z,a,this.xray?null:h,this.paintRules,m,b,!1,this.debug),this.debug){w.save(),w.fillStyle=this.debug,w.font="600 12px sans-serif",w.fillText(`${t.z} ${t.x} ${t.y}`,4,14),w.font="12px sans-serif";let e=28;for(let[t,i]of a){let s=i[0].dataTile;w.fillText(`${t+(t?" ":"")+s.z} ${s.x} ${s.y}`,4,e),e+=14}w.font="600 10px sans-serif",_>8&&(w.fillText(`${_.toFixed()} ms paint`,4,e),e+=14),o>8&&w.fillText(`${o.toFixed()} ms layout`,4,e),w.strokeStyle=this.debug,w.lineWidth=.5,w.beginPath(),w.moveTo(0,0),w.lineTo(0,256),w.stroke(),w.lineWidth=.5,w.beginPath(),w.moveTo(0,0),w.lineTo(256,0),w.stroke(),w.restore()}s()}))}rerenderTile(t){for(let e in this._tiles){let i=this._wrapCoords(this._keyToTileCoords(e));t===this._tileCoordsToKey(i)&&this.renderTile(i,this._tiles[e].el,t)}}queryTileFeaturesDebug(t,e,i=16){let s=new Map;for(let[r,n]of this.views)s.set(r,n.queryFeatures(t,e,this._map.getZoom(),i));return s}clearLayout(){this.labelers=new He(this.scratch,this.labelRules,16,this.onTilesInvalidated)}rerenderTiles(){for(let t in this._tiles){let e=this._wrapCoords(this._keyToTileCoords(t)),i=this._tileCoordsToKey(e);this.renderTile(e,this._tiles[t].el,i)}}createTile(t,e){let i=L.DomUtil.create("canvas","leaflet-tile");i.lang=this.lang;let s=this._tileCoordsToKey(t);return i.key=s,this.renderTile(t,i,s,(()=>{e(void 0,i)})),i}_removeTile(t){let e=this._tiles[t];e&&(e.el.removed=!0,e.el.key=void 0,L.DomUtil.removeClass(e.el,"leaflet-tile-loaded"),e.el.width=e.el.height=0,L.DomUtil.remove(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))}};return ot(e,"LeafletLayer"),new e(t)}),"leafletLayer"),li=ot(((t,e,i)=>{let s=new FontFace(t,`url(${e})`,{weight:i});return document.fonts.add(s),s.load()}),"Font"),fi=ot((t=>ht(void 0,null,(function*(){return new Promise(((e,i)=>{let s=new Image;s.onload=()=>e(s),s.onerror=()=>i("Invalid SVG"),s.src=t}))}))),"mkimg"),ci=class{constructor(t){this.src=t,this.canvas=document.createElement("canvas"),this.mapping=new Map,this.missingBox={x:0,y:0,w:0,h:0}}load(){return ht(this,null,(function*(){let t=this.src,e=window.devicePixelRatio;t.endsWith(".html")&&(t=yield(yield fetch(t)).text());let i=(new window.DOMParser).parseFromString(t,"text/html"),s=Array.from(i.body.children),r=yield fi(`data:image/svg+xml;base64,${btoa('\n<svg width="20px" height="20px" viewBox="0 0 50 50" version="1.1" xmlns="http://www.w3.org/2000/svg">\n <rect width="50" height="50" fill="#cccccc"/>\n <g transform="translate(5,5)">\n <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"/>\n </g>\n</svg>\n')}`),n=[{w:r.width*e,h:r.height*e,img:r,id:""}],a=new XMLSerializer;for(let t of s){let i=`data:image/svg+xml;base64,${btoa(a.serializeToString(t))}`,s=yield fi(i);n.push({w:s.width*e,h:s.height*e,img:s,id:t.id})}let o=function(t){let e=0,i=0;for(const s of t)e+=s.w*s.h,i=Math.max(i,s.w);t.sort(((t,e)=>e.h-t.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let r=0,n=0;for(const e of t)for(let t=s.length-1;t>=0;t--){const i=s[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,n=Math.max(n,e.y+e.h),r=Math.max(r,e.x+e.w),e.w===i.w&&e.h===i.h){const e=s.pop();t<s.length&&(s[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(s.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:r,h:n,fill:e/(r*n)||0}}(n);this.canvas.width=o.w,this.canvas.height=o.h;let h=this.canvas.getContext("2d");if(h)for(let t of n)void 0!==t.x&&void 0!==t.y&&(h.drawImage(t.img,t.x,t.y,t.w,t.h),t.id?this.mapping.set(t.id,{x:t.x,y:t.y,w:t.w,h:t.h}):this.missingBox={x:t.x,y:t.y,w:t.w,h:t.h});return this}))}get(t){let e=this.mapping.get(t);return e||(e=this.missingBox),e}};ot(ci,"Sheet");var ui=Object.freeze({__proto__:null,CenteredSymbolizer:pe,CenteredTextSymbolizer:Me,CircleSymbolizer:le,FlexSymbolizer:de,Font:li,GeomType:kt,GroupSymbolizer:we,IconSymbolizer:oe,Index:Xe,Justify:Yt,Labeler:Ye,Labelers:He,LineLabelPlacement:Pe,LineLabelSymbolizer:Ee,LineSymbolizer:ne,OffsetSymbolizer:je,OffsetTextSymbolizer:Te,Padding:ge,PmtilesSource:Tt,PolygonSymbolizer:Wt,Sheet:ci,ShieldSymbolizer:ce,Static:ni,TextPlacements:Zt,TextSymbolizer:xe,TileCache:qt,View:Ne,ZxySource:St,arr:Kt,covering:Oe,createPattern:Ht,exp:ee,getZoom:si,isCcw:Rt,isInRing:Bt,labelRules:De,leafletLayer:hi,linear:se,paint:Ge,paintRules:Ce,pointInPolygon:Nt,pointMinDistToLines:Ot,pointMinDistToPoints:Vt,sourcesToViews:Ve,step:ie,toIndex:Mt,transformGeom:Ie,wrap:Be});window.L={GridLayer:t.GridLayer,DomUtil:t.DomUtil},window.protomapsL=ui;var di=t.Layer.extend({initialize:function(e,i){this._template=e,this._container=t.DomUtil.create("div","leaflet-layer mapml-pmtiles-container"),this._pmtilesOptions={pane:this._container,maxDataZoom:e.zoom?.max??15,url:this._mapInputNamesToProtomapsUrl(e),noWrap:!0};let s=i?.pmtilesRules?.get(this._template.template);s?.rules?(t.extend(this._pmtilesOptions,{paintRules:s.rules.PAINT_RULES}),t.extend(this._pmtilesOptions,{labelRules:s.rules.LABEL_RULES}),s.sheet&&t.extend(this._pmtilesOptions,{tasks:[s.sheet.load()]})):s?.theme?.theme?t.extend(this._pmtilesOptions,{theme:s.theme.theme}):console.warn("pmtiles symbolizer rules or theme not found for map-link@tref -> "+this._template.template),this.zoomBounds=i.zoomBounds,this.extentBounds=i.extentBounds,delete i.zoomBounds,delete i.extentBounds,this._linkEl=i.linkEl,t.setOptions(this,i)},_mapInputNamesToProtomapsUrl:function(t){let e=t.template,i=new RegExp(t.zoom?.name?"{"+t.zoom.name+"}":"{z}","ig");e=e.replace(i,"{z}");let s=t.values.find((t=>"location"===t.type&&"row"===t.axis))?.name;i=new RegExp(s?"{"+s+"}":"{y}","ig"),e=e.replace(i,"{y}");let r=t.values.find((t=>"location"===t.type&&"column"===t.axis))?.name;return i=new RegExp(r?"{"+r+"}":"{x}","ig"),e=e.replace(i,"{x}"),e},onAdd:function(t){this._map=t,this.options.pane.appendChild(this._container),this.setZIndex(this.options.zIndex),this._pmtilesLayer=hi(this._pmtilesOptions).addTo(t)},onRemove:function(){this._pmtilesLayer.remove(),t.DomUtil.remove(this._container)},isVisible:function(){if("OSMTILE"!==this._template.projection)return!1;let t=this._linkEl.getMapEl()._map,i=t.getZoom(),s=e.pixelToPCRSBounds(t.getPixelBounds(),i,t.options.projection);return i<=this.zoomBounds.maxZoom&&i>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(s)},setZIndex:function(t){return this.options.zIndex=t,this._container&&null!=this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex),this}});const mi=class{constructor(t){r(this,t)}get el(){return n(this)}type;get typeValue(){return this.type||"image/*"}rel;href;hreflang;tref;get trefValue(){return this.tref||M.BLANK_TT_TREF}media;tms;projection;disabled;_templatedLayer;_templateVars;_alternate;_styleOption;_stylesheetHost;_pmtilesRules;_mql;_changeHandler;_layerRegistry=new Map;parentExtent;mapEl;zoomInput;zIndex;link;typeChanged(t,e){}relChanged(t,e){}hrefChanged(t,e){}hreflangChanged(t,e){}trefChanged(t,e){e!==t&&this._initTemplateVars()}mediaChanged(t,e){e!==t&&this._registerMediaQuery(t)}tmsChanged(t,e){}projectionChanged(t,e){}disabledChanged(t){t?this._disableLink():this._enableLink()}get extent(){return this._templateVars?Object.assign(e._convertAndFormatPCRS(this.getBounds(),M[this.parentExtent.units],this.parentExtent.units),{zoom:this.getZoomBounds()}):null}getMapEl(){return e.getClosest(this.el,"gcds-ext-map")}getLayerEl(){return e.getClosest(this.el,"map-layer,layer-")}getBase(){const t=this.el.getRootNode();if(t instanceof ShadowRoot){const e=t.querySelector("map-base[href]");if(e)return e.getAttribute("href");const i=t.host;return new URL(i.src,i.baseURI).href}const e=this.el.getRootNode().querySelector("map-base[href]");return e?e.getAttribute("href"):this.el.baseURI}async connectedCallback(){if(!(this.getLayerEl()?.hasAttribute("data-moving")||this.parentExtent&&this.parentExtent.hasAttribute("data-moving"))){switch(this.el._layerRegistry=this._layerRegistry,this.el.getMapEl=this.getMapEl.bind(this),this.el.getLayerEl=this.getLayerEl.bind(this),this.el.zoomTo=this.zoomTo.bind(this),this.el.getZoomBounds=this.getZoomBounds.bind(this),this.el.getBounds=this.getBounds.bind(this),this.el.isVisible=this.isVisible.bind(this),this.el.getLayerControlOption=this.getLayerControlOption.bind(this),Object.defineProperty(this.el,"extent",{get:()=>this.extent,configurable:!0,enumerable:!0}),this.rel?.toLowerCase()){case"tile":case"image":case"features":case"query":this.disabled||(this._initTemplateVars(),await this._createTemplatedLink());break;case"style":case"self":case"style self":case"self style":this._createSelfOrStyleLink();break;case"zoomin":case"zoomout":case"legend":break;case"stylesheet":this.disabled||this._createStylesheetLink();break;case"alternate":this._createAlternateLink()}await this._registerMediaQuery(this.media)}}disconnectedCallback(){"stylesheet"===this.rel?.toLowerCase()&&this._stylesheetHost&&this.link?.remove(),this._layerRegistry.clear()}_disableLink(){switch(this.rel?.toLowerCase()){case"tile":case"image":case"features":this._templatedLayer&&this.parentExtent?._extentLayer?.hasLayer(this._templatedLayer)&&(this.parentExtent._extentLayer.removeLayer(this._templatedLayer),delete this._templatedLayer,this.el.shadowRoot&&(this.el.shadowRoot.innerHTML=""),this.getLayerEl()?._validateDisabled());break;case"query":delete this._templateVars,this.el.shadowRoot&&(this.el.shadowRoot.innerHTML=""),this.getLayerEl()?._validateDisabled();break;case"stylesheet":delete this._pmtilesRules,delete this._stylesheetHost,this.link&&(this.link.remove(),delete this.link)}}async _enableLink(){switch(this.rel?.toLowerCase()){case"tile":case"image":case"features":case"query":this._initTemplateVars(),await this._createTemplatedLink(),this.getLayerEl()?._validateDisabled();break;case"stylesheet":this._createStylesheetLink()}}async _registerMediaQuery(t){if(this._changeHandler||(this._changeHandler=()=>{this.disabled=!this._mql.matches}),t){const e=this.getMapEl();if(!e)return;await e.whenReady(),this._mql&&this._mql.removeEventListener("change",this._changeHandler),this._mql=e.matchMedia(t),this._changeHandler(),this._mql.addEventListener("change",this._changeHandler)}else this._mql&&(this._mql.removeEventListener("change",this._changeHandler),delete this._mql,this.disabled=!1)}_createAlternateLink(){this.href&&this.projection&&(this._alternate=!0)}_createStylesheetLink(){if("application/pmtiles+stylesheet"===this.type){const t=new URL(this.href,this.getBase()).href;import(t).then((t=>t.pmtilesRulesReady)).then((t=>{this._pmtilesRules=t,this.el._pmtilesRules=t})).catch((t=>{console.error("Error importing pmtiles symbolizer rules or theme: \n"+t)}))}else{if(this._stylesheetHost=this.el.getRootNode()instanceof ShadowRoot?this.el.getRootNode().host:this.el.parentElement,void 0===this._stylesheetHost)return;this.link=document.createElement("link"),this.el.link=this.link,this.link.mapLink=this.el,this.link.setAttribute("href",new URL(this.href,this.getBase()).href),this._copyAttributes(this.el,this.link),this.link.disabled=this.disabled||!1,this._stylesheetHost._layer?this._stylesheetHost._layer.renderStyles(this.el):this._stylesheetHost._templatedLayer?this._stylesheetHost._templatedLayer.renderStyles(this.el):this._stylesheetHost._extentLayer&&this._stylesheetHost._extentLayer.renderStyles(this.el)}}_copyAttributes(t,e){Array.from(t.attributes).forEach((t=>{"href"!==t.nodeName&&"media"!==t.nodeName&&"disabled"!==t.nodeName&&e.setAttribute(t.nodeName,t.nodeValue)}))}async _createTemplatedLink(){if(this.parentExtent="MAP-EXTENT"===this.el.parentNode?.nodeName.toUpperCase()?this.el.parentNode:this.el.parentNode?.host,!this.disabled&&this.parentExtent){try{await this.parentExtent.whenReady(),await(this._templateVars?.inputsReady)}catch(t){return void console.log("Error while creating templated link: "+t)}if(this.mapEl=this.getMapEl(),this.zIndex=Array.from(this.parentExtent.querySelectorAll("map-link[rel=image],map-link[rel=tile],map-link[rel=features]")).indexOf(this.el),"tile"===this.rel&&"application/pmtiles"===this.type||"application/vnd.mapbox-vector-tile"===this.type){const t='map-link[rel="stylesheet"][type="application/pmtiles+stylesheet"]:not([disabled])';let i=this.getLayerEl()?.src?this.el.closest("map-extent")?.querySelector(t)??this.el.getRootNode().querySelector(":host > "+t):e.getClosest(this.el,"map-extent:has("+t+"),map-layer:has("+t+"),layer-:has("+t+")")?.querySelector(t);if(i){await i.whenReady();const t={zoomBounds:this.getZoomBounds(),extentBounds:this.getBounds(),crs:M[this.parentExtent.units],zIndex:this.zIndex,pane:this.parentExtent._extentLayer.getContainer(),linkEl:this.el,pmtilesRules:i?._pmtilesRules};this._templatedLayer=function(t,e){return new di(t,e)}(this._templateVars,t).addTo(this.parentExtent._extentLayer),this.el._templatedLayer=this._templatedLayer}else console.warn("Stylesheet not found for "+this._templateVars.template)}else"tile"===this.rel?(this._templatedLayer=(t=this._templateVars,i={zoomBounds:this.getZoomBounds(),extentBounds:this.getBounds(),crs:M[this.parentExtent.units],errorTileUrl:"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",zIndex:this.zIndex,pane:this.parentExtent._extentLayer.getContainer(),linkEl:this.el},new f(t,i)).addTo(this.parentExtent._extentLayer),this.el._templatedLayer=this._templatedLayer):"image"===this.rel?(this._templatedLayer=function(t,e){return new l(t,e)}(this._templateVars,{zoomBounds:this.getZoomBounds(),extentBounds:this.getBounds(),zIndex:this.zIndex,pane:this.parentExtent._extentLayer.getContainer(),linkEl:this.el}).addTo(this.parentExtent._extentLayer),this.el._templatedLayer=this._templatedLayer):"features"===this.rel?(this.el.shadowRoot||this.el.attachShadow({mode:"open"}),this._templatedLayer=function(t,e){return new c(t,e)}(this._templateVars,{zoomBounds:this.getZoomBounds(),extentBounds:this.getBounds(),zIndex:this.zIndex,pane:this.parentExtent._extentLayer.getContainer(),linkEl:this.el,projection:this.mapEl._map.options.projection}).addTo(this.parentExtent._extentLayer),this.el._templatedLayer=this._templatedLayer):"query"===this.rel&&(this.el.shadowRoot||this.el.attachShadow({mode:"open"}),Object.assign(this._templateVars,this._setupQueryVars(this._templateVars)),Object.assign(this._templateVars,{extentBounds:this.getBounds()}));var t,i}}_setupQueryVars(t){const e={query:{}},i=t.values;for(let s=0;s<t.values.length;s++){const t=i[s].getAttribute("type"),r=i[s].getAttribute("units"),n=i[s].getAttribute("axis"),a=i[s].getAttribute("name"),o=i[s].getAttribute("position"),h=i[s].getAttribute("rel"),l="map-select"===i[s].tagName.toLowerCase();if("width"===t)e.query.width=a;else if("height"===t)e.query.height=a;else if("location"===t)switch(n){case"x":case"y":case"column":case"row":e.query[n]=a;break;case"longitude":case"easting":o?o.match(/.*?-left/i)?"pixel"===h?e.query.pixelleft=a:"tile"===h?e.query.tileleft=a:e.query.mapleft=a:o.match(/.*?-right/i)&&("pixel"===h?e.query.pixelright=a:"tile"===h?e.query.tileright=a:e.query.mapright=a):e.query[n]=a;break;case"latitude":case"northing":o?o.match(/top-.*?/i)?"pixel"===h?e.query.pixeltop=a:"tile"===h?e.query.tiletop=a:e.query.maptop=a:o.match(/bottom-.*?/i)&&("pixel"===h?e.query.pixelbottom=a:"tile"===h?e.query.tilebottom=a:e.query.mapbottom=a):e.query[n]=a;break;case"i":"tile"===r?e.query.tilei=a:e.query.mapi=a;break;case"j":"tile"===r?e.query.tilej=a:e.query.mapj=a}else if("zoom"===t)e.query.zoom=a;else if(l){const t=i[s].htmlselect;e.query[a]=function(){return t.value}}else{const t=i[s];e.query[a]=function(){return t.getAttribute("value")}}}return e}_initTemplateVars(){const t=new RegExp("(?:{)(.*?)(?:})","g"),e=this.el.parentElement?.querySelector('map-input[type="zoom" i]');let i,s,r=!1,n=this.trefValue;if(n===M.BLANK_TT_TREF){const t=this.el.parentElement?.querySelectorAll("map-input");t&&t.forEach((t=>{n+=`{${t.getAttribute("name")}}`}))}this.zoomInput=e,this.el.zoomInput=e;const a=n.match(t)||[],o=[],h=[];for(;null!==(s=t.exec(n));){const t=s[1],e=this.el.parentElement?.querySelector(`map-input[name=${t}],map-select[name=${t}]`);e?(o.push(e),h.push(e.whenReady()),e.hasAttribute("type")&&"zoom"===e.getAttribute("type").toLowerCase()&&(i=e,r=!0)):console.log("input with name="+t+" not found for template variable of same name")}if(n&&a.length===o.length){!r&&e&&(o.push(e),h.push(e.whenReady()),i=e);const t=e?e.getAttribute("step"):1;let s=t;t&&"0"!==t&&!isNaN(t)||(s=1),this._templateVars={template:decodeURI(new URL(n,this.getBase()).href),linkEl:this.el,rel:this.rel,type:this.typeValue,values:o,inputsReady:Promise.allSettled(h),zoom:i,projection:this.el.parentElement?.getAttribute("units"),tms:this.tms,step:s},this.el._templateVars=this._templateVars}}getZoomBounds(){return this._getZoomBounds(this._templateVars?.zoom)}_getZoomBounds(t){const i={},s=this.el.parentElement?.getMeta?.("zoom"),r=s?+e._metaContentToObject(s.getAttribute("content"))?.min:null;i.minZoom=r||(t?+t.getAttribute("min"):0),i.minNativeZoom=t?+t.getAttribute("min"):i.minZoom;const n=s?+e._metaContentToObject(s.getAttribute("content"))?.max:null;return i.maxZoom=n||(t?+t.getAttribute("max"):M[this.el.parentElement?.getAttribute("units")]?.options.resolutions.length-1),i.maxNativeZoom=t?+t.getAttribute("max"):i.maxZoom,i}getBounds(){const t=this._templateVars;if(!t)return null;const i=t.values,s=this.el.parentElement?.getAttribute("units"),r={};r.name=M.FALLBACK_CS;let n=M[s].options.crs.tilematrix.bounds(0),a=!1;for(let t=0;t<i.length;t++)if("location"===i[t].getAttribute("type")){if(!i[t].getAttribute("max")||!i[t].getAttribute("min"))continue;const s=+i[t].getAttribute("max"),a=+i[t].getAttribute("min");switch(i[t].getAttribute("axis")?.toLowerCase()){case"x":case"longitude":case"column":case"easting":r.name=e.axisToCS(i[t].getAttribute("axis").toLowerCase()),n.min.x=a,n.max.x=s,r.horizontalAxis=i[t].getAttribute("axis").toLowerCase();break;case"y":case"latitude":case"row":case"northing":r.name=e.axisToCS(i[t].getAttribute("axis").toLowerCase()),n.min.y=a,n.max.y=s,r.verticalAxis=i[t].getAttribute("axis").toLowerCase()}}if(r.horizontalAxis&&r.verticalAxis&&("x"===r.horizontalAxis&&"y"===r.verticalAxis||"longitude"===r.horizontalAxis&&"latitude"===r.verticalAxis||"column"===r.horizontalAxis&&"row"===r.verticalAxis||"easting"===r.horizontalAxis&&"northing"===r.verticalAxis)&&(a=!0),a){const t=this._templateVars.zoom?.hasAttribute("value")?+this._templateVars.zoom.getAttribute("value"):0;n=e.boundsToPCRSBounds(n,t,s,r.name)}else a||(n=this.getFallbackBounds(s));return n}getFallbackBounds(i){let s,r=0;const n=this.el.parentElement?.getMeta?.("extent");if(n){const a=e._metaContentToObject(n.getAttribute("content"));let o;r=a.zoom||r;const h=Object.keys(a);for(let t=0;t<h.length;t++)if(!h[t].includes("zoom")){o=e.axisToCS(h[t].split("-")[2]);break}const l=e.csToAxes(o);s=e.boundsToPCRSBounds(t.bounds(t.point(+a[`top-left-${l[0]}`],+a[`top-left-${l[1]}`]),t.point(+a[`bottom-right-${l[0]}`],+a[`bottom-right-${l[1]}`])),r,i,o)}else{const t=M[i];s=t?.options.crs.pcrs.bounds}return s}isVisible(){if(this.disabled)return!1;let e=!1;const i=this.getMapEl(),s=i?.zoom,r=i?.extent;if(!r)return!1;const n=r.bottomRight.pcrs.horizontal,a=r.topLeft.pcrs.vertical,o=t.bounds(t.point(r.topLeft.pcrs.horizontal,r.bottomRight.pcrs.vertical),t.point(n,a));if(this._templatedLayer)e=this._templatedLayer.isVisible();else if("query"===this.rel){const t=this.extent?.zoom.minZoom,i=this.extent?.zoom.maxZoom,r=e=>t<=e&&e<=i,n=this.getBounds();n?.overlaps(o)&&r(s)&&(e=!0)}return e}zoomTo(){const i=this.extent;if(!i)return;const s=this.getMapEl()._map,r=i.bottomRight.pcrs.horizontal,n=i.topLeft.pcrs.vertical,a=t.bounds(t.point(i.topLeft.pcrs.horizontal,i.bottomRight.pcrs.vertical),t.point(r,n)),o=s.options.crs.unproject(a.getCenter(!0));s.setView(o,e.getMaxZoom(a,s,i.zoom.minZoom,i.zoom.maxZoom),{animate:!1})}_createSelfOrStyleLink(){const e=this.getLayerEl(),i=document.createElement("div"),s=i.appendChild(document.createElement("input"));s.setAttribute("type","radio"),s.setAttribute("id","rad-"+t.stamp(s)),s.setAttribute("name","styles-"+t.stamp(i)),s.setAttribute("value",this.el.getAttribute("title")),s.setAttribute("data-href",new URL(this.href,this.getBase()).href);const r=i.appendChild(document.createElement("label"));r.setAttribute("for","rad-"+t.stamp(s)),r.innerText=this.el.getAttribute("title"),"style self"!==this.rel&&"self style"!==this.rel||(s.checked=!0),this._styleOption=i,s.addEventListener("click",function(i){t.DomEvent.stop(i),e.dispatchEvent(new CustomEvent("changestyle",{detail:{src:i.target.getAttribute("data-href")}}))}.bind(this))}getLayerControlOption(){return this._styleOption}resolve(){if(this.trefValue!==M.BLANK_TT_TREF){const e={},i=this.el.parentElement?.querySelectorAll("map-input");if("image"===this.rel){for(let t=0;t<i.length;t++){const s=i[t];e[s.getAttribute("name")]=s.value}return t.Util.template(this.trefValue,e)}if("tile"===this.rel)return e}}async whenReady(){return new Promise(((t,e)=>{let i,s,r;switch(this.rel?.toLowerCase()){case"tile":case"image":case"features":r="_templatedLayer",this.disabled&&t();break;case"style":case"self":case"style self":case"self style":r="_styleOption";break;case"query":r="shadowRoot",this.disabled&&t();break;case"alternate":r="_alternate";break;case"stylesheet":r="application/pmtiles+stylesheet"===this.type?"_pmtilesRules":"_stylesheetHost";break;default:return void t()}this[r]?t():(i=setInterval((function(n){n.el[r]?(clearInterval(i),clearTimeout(s),t()):n.el.isConnected||(clearInterval(i),clearTimeout(s),e("map-link was disconnected while waiting to be ready"))}),300,this),s=setTimeout((function(){clearInterval(i),clearTimeout(s),e("Timeout reached waiting for link to be ready")}),1e3))}))}render(){return null}static get watchers(){return{type:[{typeChanged:0}],rel:[{relChanged:0}],href:[{hrefChanged:0}],hreflang:[{hreflangChanged:0}],tref:[{trefChanged:0}],media:[{mediaChanged:0}],tms:[{tmsChanged:0}],projection:[{projectionChanged:0}],disabled:[{disabledChanged:0}]}}};export{mi as map_link}
@@ -0,0 +1 @@
1
+ function t(t){const e=t.tagName.toLowerCase(),n=["map-tile","map-extent","map-feature"];if(!n.includes(e))return console.warn(`calculatePosition: Invalid element type ${e}`),0;const o=t.parentNode;if(!o)return 1;const r=o.children||Array.from(o.childNodes).filter((t=>t.nodeType===Node.ELEMENT_NODE));if(!r||0===r.length)return 1;let l=0,i=null,u=!1;for(const e of r){if(e.nodeType!==Node.ELEMENT_NODE)continue;const o=e.tagName.toLowerCase();if(n.includes(o)){if(e===t)return u=!0,"map-extent"===o?(l++,l):(i===o||l++,l);u||("map-extent"===o||null!==i&&i!==o?l++:null===i&&(l=1),i=o)}}return 0}export{t as c}
@@ -0,0 +1 @@
1
+ import{l as t,U as i}from"./p-BUsJ7i5g.js";var s=t.GridLayer.extend({initialize:function(i){t.GridLayer.prototype.initialize.call(this,i),this._mapTiles=i.mapTiles||[],this._tileMap={},this._pendingTiles={},this._buildTileMap(),this._container=t.DomUtil.create("div","leaflet-layer"),i.zIndex&&(this._container.style.zIndex=i.zIndex),t.DomUtil.addClass(this._container,"mapml-static-tile-container")},getEvents:function(){const i=t.GridLayer.prototype.getEvents?t.GridLayer.prototype.getEvents.call(this):{};return i.zoomend=this._handleZoomChange,i},onAdd:function(i){this.options.pane.appendChild(this._container),t.GridLayer.prototype.onAdd.call(this,i)},onRemove:function(){this._pendingTiles={},t.DomUtil.remove(this._container)},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&null!=this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_handleZoomChange:function(){const t=this._map.getZoom();for(const i in this._tiles)this._keyToTileCoords(i).z!==t&&this._removeTile(i)},addMapTile:function(t){this._mapTiles.includes(t)||(this._mapTiles.push(t),this._addToTileMap(t),this._updateBounds(),this._map&&this.redraw())},removeMapTile:function(t){const i=this._mapTiles.indexOf(t);-1!==i&&(this._mapTiles.splice(i,1),this._removeFromTileMap(t),this._updateBounds(),this._map&&this.redraw())},removeMapTileAt:function(t,i){const s=this._mapTiles.indexOf(t);-1!==s&&(this._mapTiles.splice(s,1),this._removeFromTileMapAt(i),t._tileDiv&&(t._tileDiv._mapTile=null,t._tileDiv=null),this._updateBounds(),this._map&&this.redraw())},isVisible:function(){if(!this._map)return!1;this.layerBounds||this._updateBounds();let t=this._map,s=t.getZoom(),n=this.zoomBounds,o=this.layerBounds;return s<=n.maxZoom&&s>=n.minZoom&&this._mapTiles&&o&&o.overlaps(i.pixelToPCRSBounds(t.getPixelBounds(),s,t.options.projection))},createTile:function(i,s){const n=this._tileCoordsToKey(i),o=this.getTileSize(),e=document.createElement("div");e.setAttribute("col",i.x),e.setAttribute("row",i.y),e.setAttribute("zoom",i.z),t.DomUtil.addClass(e,"leaflet-tile"),e.style.width=o.x+"px",e.style.height=o.y+"px";const h=this._tileMap[n];if(h){const i=document.createElement("img");i.src=h.src,i.width=o.x,i.height=o.y,i.alt="",i.setAttribute("role","presentation"),e._mapTile=h,h._tileDiv=e,e.appendChild(i),t.DomUtil.addClass(e,"leaflet-tile-loaded"),s(null,e)}else this._pendingTiles||(this._pendingTiles={}),this._pendingTiles[n]={element:e,done:s};return e},_buildTileMap:function(){this._tileMap={};for(const t of this._mapTiles)this._addToTileMap(t)},_addToTileMap:function(i){const s=`${i.col}:${i.row}:${i.zoom}`;if(this._tileMap[s]=i,this._pendingTiles&&this._pendingTiles[s]){const n=this._pendingTiles[s],o=n.element,e=n.done,h=this.getTileSize(),l=document.createElement("img");l.src=i.src,l.width=h.x,l.height=h.y,l.alt="",l.setAttribute("role","presentation"),o._mapTile=i,i._tileDiv=o,o.appendChild(l),t.DomUtil.addClass(o,"leaflet-tile-loaded"),e&&e(null,o),delete this._pendingTiles[s]}},_removeFromTileMap:function(t){const i=`${t.col}:${t.row}:${t.zoom}`;delete this._tileMap[i],t._tileDiv&&(t._tileDiv._mapTile=null,t._tileDiv=null),this._pendingTiles&&this._pendingTiles[i]&&delete this._pendingTiles[i]},_removeFromTileMapAt:function(t){const i=`${t.col}:${t.row}:${t.zoom}`;delete this._tileMap[i],this._pendingTiles&&this._pendingTiles[i]&&delete this._pendingTiles[i]},_updateBounds:function(){this.layerBounds=this._computeLayerBounds(),this.zoomBounds=this._computeZoomBounds()},_computeLayerBounds:function(){if(0===this._mapTiles.length)return t.bounds([0,0],[0,0]);const s={},n=this.options.projection,o=M[n].options.crs.tile.bounds.max.x;for(const t of this._mapTiles){const i=t.zoom;s[i]||(s[i]=[]),s[i].push({x:t.col,y:t.row,z:i})}const e={};for(const h in s){const l=s[h];let c=null;for(const i of l){const s=i.x*o,n=i.y*o;c?(c.extend(t.point(s,n)),c.extend(t.point(s+o,n+o))):c=t.bounds(t.point(s,n),t.point(s+o,n+o))}c&&(e[h]=i.pixelToPCRSBounds(c,parseInt(h),n))}let h=null;for(const t in e)h?(h.extend(e[t].min),h.extend(e[t].max)):h=e[t].pad(0);return h||t.bounds([0,0],[0,0])},_computeZoomBounds:function(){const t={minZoom:1/0,maxZoom:-1/0,minNativeZoom:1/0,maxNativeZoom:-1/0};if(0===this._mapTiles.length)return{minZoom:0,maxZoom:22,minNativeZoom:0,maxNativeZoom:22};for(const i of this._mapTiles){const s=i.zoom;t.minNativeZoom=Math.min(t.minNativeZoom,s),t.maxNativeZoom=Math.max(t.maxNativeZoom,s)}return t.minZoom=t.minNativeZoom,t.maxZoom=t.maxNativeZoom,t}}),n=function(t){return new s(t)};export{s as M,n as m}