@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{t,p as e,H as i,U as s,M as h,f as n,l as a,c as o}from"./p-CwRxGZga.js";import{c as r}from"./p-B4YLD_Og.js";const l=e(class extends i{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get el(){return 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=s._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=s._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=s._metaContentToObject(e.getAttribute("content")));let i=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:i)}get extent(){if(this.el.isConnected)return this._getFeatureExtent||(this._getFeatureExtent=this._memoizeExtent()),this._getFeatureExtent()}get position(){return r(this.el)}getMapEl(){return s.getClosest(this.el,"gcds-ext-map")}getLayerEl(){return s.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 s=i.getMapEl()._map;this._featureLayer=new h(null,{renderer:n(),pane:e.getContainer(),...t&&i.getBounds()?{layerBounds:i.getBounds()}:{},...t?{zoomBounds:this._getZoomBounds()}:{},...t?{}:{_leafletLayer:i._layer},zIndex:this.position,projection:s.options.projection,mapEl:i.getMapEl(),onEachFeature:function(t,e){if(t){const h={autoClose:!1,autoPan:!0,maxHeight:.5*s.getSize().y-50,maxWidth:.7*s.getSize().x,minWidth:165};var i=document.createElement("div");i.classList.add("mapml-popup-content"),i.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(i,h)}}}),a.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?s._metaContentToObject(t.getAttribute("content")).content:"gcrs"}_memoizeExtent(){let t;return()=>{if(t&&this._getFeatureExtent)return t;{let e=this.getMapEl()._map,i=this.el.querySelector("map-geometry"),h=i?.getAttribute("cs")||this._getFallbackCS(),n=this.zoomValue,o=i?.querySelectorAll("map-point, map-linestring, map-polygon, map-multipoint, map-multilinestring"),r=[1/0,1/0,-1/0,-1/0];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=a.point(r[0],r[1]),m=a.point(r[2],r[3]),c=s.boundsToPCRSBounds(a.bounds(l,m),n,e.options.projection,h);if(1===o?.length&&"MAP-POINT"===o[0].tagName.toUpperCase()){let t=e.options.projection,i=this.el.hasAttribute("max")?+this.el.getAttribute("max"):M[t].options.resolutions.length-1,h=M[t].options.crs.tile.bounds.getCenter(),n=M[t].transformation.transform(c.min,M[t].scale(+this.zoomValue||i));c=s.pixelToPCRSBounds(a.bounds(n.subtract(h),n.add(h)),this.zoomValue||i,t)}let u=Object.assign(s._convertAndFormatPCRS(c,e.options.crs,e.options.projection),{zoom:this._getZoomBounds()});return t=u,u}}}_updateExtent(t,e,i){let h=e.innerHTML.trim().replace(/<[^>]+>/g,"").replace(/\s+/g," ").split(/[<>\ ]/g);switch(t.tagName.toUpperCase()){case"MAP-POINT":i=s._updateExtent(i,+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)i=s._updateExtent(i,+h[t],+h[t+1])}return i}_getZoomBounds(){return{minZoom:this.minValue,maxZoom:this.maxValue,minNativeZoom:this.zoomValue,maxNativeZoom:this.zoomValue}}getZoomToZoom(){let t,e=this.extent.topLeft.pcrs,i=this.extent.bottomRight.pcrs,h=a.bounds(a.point(e.horizontal,e.vertical),a.point(i.horizontal,i.vertical)),n=this.getMapEl()._map.options.projection,o=this.getLayerEl().extent.zoom,r=o.minZoom?o.minZoom:0,l=o.maxZoom?o.maxZoom:M[n].options.resolutions.length-1;return this.el.hasAttribute("zoom")?t=this.zoomValue:(t=s.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:{}},i=this.el.querySelector("map-properties");if(i)if("function"==typeof t.propertyFunction)e.properties=t.propertyFunction(i);else if(i.querySelector("table")){let t=i.querySelector("table").cloneNode(!0);e.properties=s._table2properties(t)}else e.properties={prop0:i.innerHTML.replace(/(<([^>]+)>)/gi,"").replace(/\s/g,"")};else e.properties=null;let h=null,n=null,a=this.getMapEl()._map;t.transform&&(h=new o.Proj(a.options.crs.code),n=new o.Proj("EPSG:4326"),"EPSG:3857"!==a.options.crs.code&&"EPSG:4326"!==a.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 i of Array.from(l))e.geometry.geometries.push(s._geometry2geojson(i,h,n,t.transform))}else l&&l.length>0&&(e.geometry=s._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=a.bounds(a.point(i.horizontal,i.vertical),a.point(s.horizontal,s.vertical)),n=e.options.crs.unproject(h.getCenter(!0));e.setView(n,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}]}}},[513,"map-feature",{zoom:[1026],min:[1538],max:[1538],whenReady:[64]},void 0,{zoom:[{zoomChanged:0}],min:[{minChanged:0}],max:[{maxChanged:0}]}]);function m(){"undefined"!=typeof customElements&&["map-feature"].forEach((e=>{"map-feature"===e&&(customElements.get(t(e))||customElements.define(t(e),l))}))}m();const c=l,u=m;export{c as MapFeature,u as defineCustomElement}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface MapFeaturecaption extends Components.MapFeaturecaption, HTMLElement {}
4
+ export const MapFeaturecaption: {
5
+ prototype: MapFeaturecaption;
6
+ new (): MapFeaturecaption;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1 @@
1
+ import{t,p as e,H as a}from"./p-CwRxGZga.js";const n=e(class extends a{render(){return null}connectedCallback(){this.textContent=this.render()}static get is(){return"map-featurecaption"}},[0,"map-featurecaption"]);"undefined"!=typeof customElements&&["map-featurecaption"].forEach((e=>{"map-featurecaption"===e&&(customElements.get(t(e))||customElements.define(t(e),n))}));export{n as MapFeaturecaption}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface MapGeometry extends Components.MapGeometry, HTMLElement {}
4
+ export const MapGeometry: {
5
+ prototype: MapGeometry;
6
+ new (): MapGeometry;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1 @@
1
+ import{t as e,p as t,H as s,h as c}from"./p-CwRxGZga.js";const r=t(class extends s{constructor(e){super(),!1!==e&&this.__registerHost()}get el(){return this}cs;csChanged(e,t){}connectedCallback(){Object.defineProperty(this.el,"cs",{get:()=>this.el.getAttribute("cs"),set:e=>{["tcrs","tilematrix","pcrs","gcrs","map","tile"].includes(e)&&(this.cs=e)},configurable:!0,enumerable:!0})}render(){return c("slot",{key:"419b5956ada9cc1d59880ed9168b1d539301ff85"})}static get watchers(){return{cs:[{csChanged:0}]}}},[772,"map-geometry",{cs:[1537]},void 0,{cs:[{csChanged:0}]}]);function n(){"undefined"!=typeof customElements&&["map-geometry"].forEach((t=>{"map-geometry"===t&&(customElements.get(e(t))||customElements.define(e(t),r))}))}n();const a=r,o=n;export{a as MapGeometry,o as defineCustomElement}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface MapInput extends Components.MapInput, HTMLElement {}
4
+ export const MapInput: {
5
+ prototype: MapInput;
6
+ new (): MapInput;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1 @@
1
+ import{U as t,l as i,t as s,p as e,H as n}from"./p-CwRxGZga.js";class h{name;min;max;value;step;layer;constructor(t,i,s,e,n,h){this.name=t,this.min=i,this.max=s,this.value=e,this.step=n,this.layer=h}validateInput(){return!!this.name}getValue(){return this.layer._map.options.mapEl.zoom}}class a{name;value;constructor(t,i){this.name=t,this.value=i}validateInput(){return!(!this.name||!this.value)}getValue(){return this.value}}class r{name;layer;constructor(t,i){this.name=t,this.layer=i}validateInput(){return!!this.name}getValue(){return this.layer._map.getSize().x}}class l{name;layer;constructor(t,i){this.name=t,this.layer=i}validateInput(){return!!this.name}getValue(){return this.layer._map.getSize().y}}class u{name;position;axis;units;min;max;rel;layer;constructor(i,s,e,n,h,a,r,l){this.name=i,this.position=s,this.axis=e,this.units=n||!e||["i","j"].includes(e)?n:t.axisToCS(e).toLowerCase(),this.min=h,this.max=a,this.rel=r,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),n=s._pxBoundsToTileRange(e),h=[];for(let t=n.min.y;t<=n.max.y;t++)for(let e=n.min.x;e<=n.max.x;e++){const n=new i.Point(e,t);n.z=s._tileZoom,h.push(n)}return h}}}const c=e(class extends n{constructor(t){super(),!1!==t&&this.__registerHost()}get el(){return 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 u(this.name,this.position,this.axis,this.units,this.min,this.max,this.rel,this._layer);break;case"width":this.input=new r(this.name,this._layer);break;case"height":this.input=new l(this.name,this._layer);break;case"hidden":this.input=new a(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(n){n.input?(clearInterval(s),clearTimeout(e),t()):n.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}},[512,"map-input",{name:[513],type:[513],value:[1537],axis:[513],units:[513],position:[513],rel:[513],min:[513],max:[513],step:[513],whenReady:[64]}]);function o(){"undefined"!=typeof customElements&&["map-input"].forEach((t=>{"map-input"===t&&(customElements.get(s(t))||customElements.define(s(t),c))}))}o();const p=c,m=o;export{p as MapInput,m as defineCustomElement}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface MapLayer extends Components.MapLayer, HTMLElement {}
4
+ export const MapLayer: {
5
+ prototype: MapLayer;
6
+ new (): MapLayer;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1 @@
1
+ import{l as t,U as e,M as i,t as s,p as a,H as h}from"./p-CwRxGZga.js";import{M as n}from"./p-gwC_yeRa.js";import{r as l}from"./p-EYVT9Efh.js";var o=t.LayerGroup.extend({options:{zIndex:0,opacity:"1.0"},initialize:function(e,i,s){t.LayerGroup.prototype.initialize.call(this,null,s),e&&(this._href=e),this._layerEl=i,this._content=i.src?i.shadowRoot:i,t.setOptions(this,s),this._container=t.DomUtil.create("div","leaflet-layer"),this.changeOpacity(this.options.opacity),t.DomUtil.addClass(this._container,"mapml-layer"),this._initialize(this._content)},getContainer:function(){return this._container},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getHref:function(){return this._href??""},_updateZIndex:function(){this._container&&null!=this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},changeOpacity:function(t){this._container.style.opacity=t,this._layerEl._opacity=t,this._layerEl._opacitySlider&&(this._layerEl._opacitySlider.value=t)},titleIsReadOnly(){return!!this._titleIsReadOnly},setName(t){this.titleIsReadOnly()||(this._title=t,this._layerEl._layerControlHTML.querySelector(".mapml-layer-item-name").innerHTML=t)},getName(){return this._title},onAdd:function(e){this.getPane().appendChild(this._container),t.LayerGroup.prototype.onAdd.call(this,e),this.setZIndex(this.options.zIndex),e.on("popupopen",this._attachSkipButtons,this)},_calculateBounds:function(){let s,a;delete this.bounds,delete this.zoomBounds,s=this._layerEl.src&&this._layerEl.shadowRoot.querySelector(":host > map-meta[name=extent][content]")?e.getBoundsFromMeta(this._layerEl.shadowRoot):this._layerEl.querySelector(":scope > map-meta[name=extent][content]")?e.getBoundsFromMeta(this._layerEl):void 0,a=this._layerEl.src&&this._layerEl.shadowRoot.querySelector(":host > map-meta[name=zoom][content]")?e.getZoomBoundsFromMeta(this._layerEl.shadowRoot):this._layerEl.querySelector(":scope > map-meta[name=zoom][content]")?e.getZoomBoundsFromMeta(this._layerEl):void 0;const h=this._layerEl.src?this._layerEl.shadowRoot.querySelectorAll("map-extent"):this._layerEl.querySelectorAll("map-extent");if(["_staticTileLayer","_mapmlvectors","_extentLayer"].forEach((e=>{let l,o,r,c;if(a&&(l=a.maxZoom,o=a.minZoom,c=a.maxNativeZoom?a.maxNativeZoom:-1/0,r=a.minNativeZoom?a.minNativeZoom:1/0),"_extentLayer"===e&&h.length){for(let e=0;e<h.length;e++)if(h[e]._extentLayer?.bounds){let i=h[e]._extentLayer;s?s.extend(i.bounds):s=t.bounds(i.bounds.min,i.bounds.max),i.zoomBounds&&(a?(l=Math.max(l,i.zoomBounds.maxZoom),o=Math.min(o,i.zoomBounds.minZoom),c=Math.max(c,i.zoomBounds.maxNativeZoom),r=Math.min(r,i.zoomBounds.minNativeZoom),a.minZoom=o,a.maxZoom=l,a.minNativeZoom=r,a.maxNativeZoom=c):a=i.zoomBounds)}}else this.eachLayer("_mapmlvectors"===e?function(t){t instanceof i&&t.layerBounds&&(s?s.extend(t.layerBounds):s=t.layerBounds),t instanceof i&&t.zoomBounds&&(a?(l=Math.max(l,t.zoomBounds.maxZoom),o=Math.min(o,t.zoomBounds.minZoom),c=Math.max(c,t.zoomBounds.maxNativeZoom),r=Math.min(r,t.zoomBounds.minNativeZoom),a.minZoom=o,a.maxZoom=l,a.minNativeZoom=r,a.maxNativeZoom=c):a=t.zoomBounds)}:t=>{t instanceof n&&(t.layerBounds&&(s?s.extend(t.layerBounds):s=t.layerBounds),t.zoomBounds&&(l=Math.max(l,t.zoomBounds.maxZoom),o=Math.min(o,t.zoomBounds.minZoom),c=Math.max(c,t.zoomBounds.maxNativeZoom),r=Math.min(r,t.zoomBounds.minNativeZoom),a.minZoom=o,a.maxZoom=l,a.minNativeZoom=r,a.maxNativeZoom=c))})})),s)this.bounds=s;else{let e=M[this.options.projection].options.bounds;this.bounds=t.bounds(e.min,e.max)}a||(a={}),a.minZoom||(a.minZoom=0),a.maxZoom||(a.maxZoom=M[this.options.projection].options.resolutions.length-1),a.minNativeZoom===1/0&&(a.minNativeZoom=a.minZoom),a.maxNativeZoom===-1/0&&(a.maxNativeZoom=a.maxZoom),this.zoomBounds=a},onRemove:function(e){t.LayerGroup.prototype.onRemove.call(this,e),t.DomUtil.remove(this._container),e.off("popupopen",this._attachSkipButtons)},getAttribution:function(){return this.options.attribution},getBase:function(){return new URL(this._content.querySelector("map-base")?this._content.querySelector("map-base").getAttribute("href"):"MAP-LAYER"===this._content.nodeName||"LAYER-"===this._content.nodeName?this._content.baseURI:this._href,this._href).href},renderStyles:l,_initialize:function(){var e=this;e.getBase();var i=this._content;!function(){var s,a,h=i.querySelector("map-link[rel=license]");h&&(s=h.getAttribute("title"),a='<a href="'+h.getAttribute("href")+'" title="'+s+'">'+s+"</a>"),t.setOptions(e,{attribution:a});var n=i.querySelector("map-link[rel=legend]");n&&(e._legendUrl=n.getAttribute("href")),e._map&&e._map.hasLayer(e)&&e._map.attributionControl.addAttribution(e.getAttribution())}(),i.querySelector("map-title")?(e._title=i.querySelector("map-title").textContent.trim(),e._titleIsReadOnly=!0):e._layerEl&&e._layerEl.hasAttribute("label")&&(e._title=e._layerEl.getAttribute("label").trim()),e._layerEl.parentElement&&e._layerEl.parentElement._toggleControls()},getQueryTemplates:function(t,e){const i=this._layerEl.querySelectorAll("map-extent[checked] map-link[rel=query]").length?this._layerEl.querySelectorAll("map-extent[checked] map-link[rel=query]"):this._layerEl.shadowRoot.querySelectorAll("map-extent[checked] map-link[rel=query]").length?this._layerEl.shadowRoot.querySelectorAll("map-extent[checked] map-link[rel=query]"):null;if(i){var s=[];for(let a=0;a<i.length;a++){const h=i[a].extent.zoom.minZoom,n=i[a].extent.zoom.maxZoom,l=t=>h<=t&&t<=n;i[a].getBounds().contains(t)&&l(e)&&s.push(i[a]._templateVars)}return s}},_attachSkipButtons:function(e){let i,s,a=e.popup,h=e.target,n=a._container.getElementsByClassName("mapml-popup-content")[0];a._container.setAttribute("role","dialog"),n.setAttribute("tabindex","-1"),n.setAttribute("role","document"),a._count=0,a._source._eventParents?(i=a._source._eventParents[Object.keys(a._source._eventParents)[0]],s=a._source.group,f.call(a)):(i=(a._source._layerEl.querySelector("map-extent")||a._source._layerEl.shadowRoot.querySelector("map-extent"))._extentLayer,h.on("attachZoomLink",f,a)),a._container.querySelector('nav[class="mapml-focus-buttons"]')&&(t.DomUtil.remove(a._container.querySelector('nav[class="mapml-focus-buttons"]')),t.DomUtil.remove(a._container.querySelector("hr")));let l=t.DomUtil.create("nav","mapml-focus-buttons"),o=t.DomUtil.create("button","mapml-popup-button",l);o.type="button",o.title=h.options.mapEl.locale.kbdFocusMap,o.innerHTML="<span aria-hidden='true'>|&#10094;</span>",t.DomEvent.on(o,"click",(e=>{t.DomEvent.stop(e),h.featureIndex._sortIndex(),h.closePopup(),h._container.focus()}),a);let r=t.DomUtil.create("button","mapml-popup-button",l);r.type="button",r.title=h.options.mapEl.locale.kbdPrevFeature,r.innerHTML="<span aria-hidden='true'>&#10094;</span>",t.DomEvent.on(r,"click",i._previousFeature,a),t.DomUtil.create("p","mapml-feature-count",l).innerText=a._count+1+"/"+(this._totalFeatureCount?this._totalFeatureCount:1);let c=t.DomUtil.create("button","mapml-popup-button",l);c.type="button",c.title=h.options.mapEl.locale.kbdNextFeature,c.innerHTML="<span aria-hidden='true'>&#10095;</span>",t.DomEvent.on(c,"click",i._nextFeature,a);let m=t.DomUtil.create("button","mapml-popup-button",l);m.type="button",m.title=h.options.mapEl.locale.kbdFocusControls,m.innerHTML="<span aria-hidden='true'>&#10095;|</span>",t.DomEvent.on(m,"click",(e=>{h.featureIndex._sortIndex(),h.featureIndex.currentIndex=h.featureIndex.inBoundFeatures.length-1,h.featureIndex.inBoundFeatures[0]?.path.setAttribute("tabindex",-1),h.featureIndex.inBoundFeatures[h.featureIndex.currentIndex]?.path.setAttribute("tabindex",0),t.DomEvent.stop(e),h.closePopup(),h._controlContainer.querySelector("A:not([hidden])").focus()}),a);let p=t.DomUtil.create("hr","mapml-popup-divider");function d(e){let i=e.originalEvent.path||e.originalEvent.composedPath(),n=9===e.originalEvent.keyCode,l=e.originalEvent.shiftKey;(i[0].classList.contains("leaflet-popup-close-button")&&n&&!l||27===e.originalEvent.keyCode||i[0].classList.contains("leaflet-popup-close-button")&&13===e.originalEvent.keyCode||i[0].classList.contains("mapml-popup-content")&&n&&l||i[0]===a._content.querySelector("a")&&n&&l)&&setTimeout((()=>{h.closePopup(a),s.focus(),t.DomEvent.stop(e)}),0)}function u(e){let i=e.originalEvent.path||e.originalEvent.composedPath(),s=9===e.originalEvent.keyCode,n=e.originalEvent.shiftKey;13===e.originalEvent.keyCode&&i[0].classList.contains("leaflet-popup-close-button")||27===e.originalEvent.keyCode?(t.DomEvent.stopPropagation(e),h.closePopup(a),h._container.focus(),27!==e.originalEvent.keyCode&&(h._popupClosed=!0)):s&&i[0].classList.contains("leaflet-popup-close-button")?h.closePopup(a):i[0].classList.contains("mapml-popup-content")&&s&&n?(h.closePopup(a),setTimeout((()=>{t.DomEvent.stop(e),h._container.focus()}),0)):i[0]===a._content.querySelector("a")&&s&&n&&(h.closePopup(a),setTimeout((()=>{t.DomEvent.stop(e),h.getContainer.focus()}),0))}function f(e){let i=this._wrapper,s=e?e.currFeature:this._source._groupLayer._featureEl;if(i.querySelector("a.mapml-zoom-link")&&i.querySelector("a.mapml-zoom-link").remove(),!s.querySelector("map-geometry"))return;let a=s.extent.topLeft.gcrs,n=s.extent.bottomRight.gcrs,l=t.latLngBounds(t.latLng(a.horizontal,a.vertical),t.latLng(n.horizontal,n.vertical)).getCenter(!0),o=document.createElement("a");o.href=`#${s.getZoomToZoom()},${l.lng},${l.lat}`,o.innerHTML=""+h.options.mapEl.locale.popupZoom,o.className="mapml-zoom-link",o.onclick=o.onkeydown=function(t){(t instanceof MouseEvent||13===t.keyCode)&&(t.preventDefault(),s.zoomTo(),h.closePopup(),h.getContainer().focus())};let r=i.querySelector(".mapml-zoom-link");r&&r.remove(),i.insertBefore(o,i.querySelector("hr.mapml-popup-divider"))}a._navigationBar=l,a._content.parentElement.parentElement.appendChild(p),a._content.parentElement.parentElement.appendChild(l),n.focus(),s&&!M.options.featureIndexOverlayOption?(s.setAttribute("aria-expanded","true"),h.on("keydown",d)):h.on("keydown",u),h.on("popupclose",(function t(e){e.popup===a&&(h.off("keydown",d),h.off("keydown",u),h.off("popupopen",f),h.off("popupclose",t),s&&s.setAttribute("aria-expanded","false"))}))}}),r=function(t,e,i){return t||e?new o(t,e,i):null},c=async function(){var e=t.DomUtil.create("fieldset","mapml-layer-item"),i=t.DomUtil.create("input"),s=t.DomUtil.create("span","mapml-layer-item-name"),a=t.DomUtil.create("span"),h=t.DomUtil.create("div","mapml-layer-item-properties",e),n=t.DomUtil.create("div","mapml-layer-item-settings",e),l=t.DomUtil.create("label","mapml-layer-item-toggle",h),o=t.DomUtil.create("div","mapml-layer-item-controls",h),r=t.DomUtil.create("details","mapml-layer-item-opacity mapml-control-layers",n),c=t.DomUtil.create("input"),m=t.DomUtil.create("summary"),p=t.SVG.create("svg"),d=t.SVG.create("path"),u=t.SVG.create("path"),f=t.DomUtil.create("fieldset","mapml-layer-grouped-extents"),b=this.parentNode;c.setAttribute("data-testid","layer-item-opacity"),p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("height","22"),p.setAttribute("width","22"),p.setAttribute("fill","currentColor"),d.setAttribute("d","M0 0h24v24H0z"),d.setAttribute("fill","none"),u.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),p.appendChild(d),p.appendChild(u),n.hidden=!0,a.setAttribute("aria-hidden",!0);let y=t.DomUtil.create("button","mapml-layer-item-remove-control",o);y.type="button",y.title=b.locale.lmRemoveLayer,y.innerHTML="<span aria-hidden='true'>&#10005;</span>",y.classList.add("mapml-button"),t.DomEvent.on(y,"click",t.DomEvent.stop),t.DomEvent.on(y,"click",(t=>{let e,i,s=0;if(i="GCDS-EXT-MAP"===b.tagName?b.shadowRoot:b.querySelector(".mapml-web-map").shadowRoot,t.target.closest("fieldset").nextElementSibling&&!t.target.closest("fieldset").nextElementSibling.disbaled)for(e=t.target.closest("fieldset").previousElementSibling;e;)s+=2,e=e.previousElementSibling;else e="link";b.removeChild(t.target.closest("fieldset").querySelector("span").layer._layerEl),e=e?i.querySelector(".leaflet-control-attribution").firstElementChild:e=i.querySelectorAll("input")[s],e.focus()}),this._layer);let g=t.DomUtil.create("button","mapml-layer-item-settings-control",o);if(g.type="button",g.title=b.locale.lmLayerSettings,g.setAttribute("aria-expanded",!1),g.classList.add("mapml-button"),t.DomEvent.on(g,"click",(t=>{let e=this._layer._layerEl._layerControl._container;e._isExpanded||"touch"!==t.pointerType?!0===n.hidden?(g.setAttribute("aria-expanded",!0),n.hidden=!1):(g.setAttribute("aria-expanded",!1),n.hidden=!0):e._isExpanded=!0}),this._layer),i.defaultChecked=this.checked,i.type="checkbox",i.setAttribute("class","leaflet-control-layers-selector"),i.setAttribute("data-testid","layer-item-checkbox"),s.layer=this._layer,i.addEventListener("change",function(){this.checked=!this.checked,this.dispatchEvent(new CustomEvent("map-change")),this._layerControlCheckbox.focus()}.bind(this)),this._layer._legendUrl){var v=document.createElement("a");v.text=" "+this._layer._title,v.href=this._layer._legendUrl,v.target="_blank",v.draggable=!1,s.appendChild(v)}else s.innerHTML=this._layer._title;s.id="mapml-layer-item-name-{"+t.stamp(s)+"}",m.innerText=b.locale.lcOpacity,m.id="mapml-layer-item-opacity-"+t.stamp(m),r.appendChild(m),r.appendChild(c),c.setAttribute("type","range"),c.setAttribute("min","0"),c.setAttribute("max","1.0"),c.setAttribute("value",this._opacity||"1.0"),c.setAttribute("step","0.1"),c.setAttribute("aria-labelledby","mapml-layer-item-opacity-"+t.stamp(m)),c.value=this._opacity||"1.0",c.addEventListener("change",function(t){t&&t.target&&t.target.value>=0&&t.target.value<=1&&this._layer.changeOpacity(t.target.value)}.bind(this)),e.setAttribute("aria-grabbed","false"),e.setAttribute("aria-labelledby",s.id),e.ontouchstart=e.onmousedown=t=>{if("label"===t.target.parentElement.tagName.toLowerCase()&&"input"!==t.target.tagName.toLowerCase()||"label"===t.target.tagName.toLowerCase()){t=t instanceof TouchEvent?t.touches[0]:t;let i=e,s=e.parentNode,a=!1,h=t.clientY,n=Array.from(s.querySelectorAll("fieldset")).indexOf(e);document.body.ontouchmove=document.body.onmousemove=t=>{t.preventDefault();let e=(t=t instanceof TouchEvent?t.touches[0]:t).clientY-h;if(a=Math.abs(e)>15||a,s&&!a||s&&s.childElementCount<=1||s.getBoundingClientRect().top>i.getBoundingClientRect().bottom||s.getBoundingClientRect().bottom<i.getBoundingClientRect().top)return;s.classList.add("mapml-draggable"),i.style.transform="translateY("+e+"px)",i.style.pointerEvents="none";let n=t.clientX,l=t.clientY,o=("GCDS-EXT-MAP"===b.tagName?b.shadowRoot:b.querySelector(".mapml-web-map").shadowRoot).elementFromPoint(n,l),r=o&&o.closest("fieldset")?o.closest("fieldset"):i;r=Math.abs(e)<=r.offsetHeight?i:r,i.setAttribute("aria-grabbed","true"),i.setAttribute("aria-dropeffect","move"),r&&s===r.parentNode&&(r=r!==i.nextSibling?r:r.nextSibling,i!==r&&(h=t.clientY,i.style.transform=null),s.insertBefore(i,r))},document.body.ontouchend=document.body.onmouseup=()=>{let t=Array.from(s.querySelectorAll("fieldset")).indexOf(e);if(i.setAttribute("aria-grabbed","false"),i.removeAttribute("aria-dropeffect"),i.style.pointerEvents=null,i.style.transform=null,n!==t){let t=s.children,e=1;for(let e of t){let t=e.querySelector("span").layer._layerEl;t.setAttribute("data-moving",""),b.insertAdjacentElement("beforeend",t),t.removeAttribute("data-moving")}let i=b.querySelectorAll("map-layer,layer-");for(let t=0;t<i.length;t++){let s=i[t]._layer;s.options.zIndex!==e&&s.setZIndex(e),e++}}s.classList.remove("mapml-draggable"),document.body.ontouchmove=document.body.onmousemove=document.body.onmouseup=null}}},l.appendChild(i),l.appendChild(s),g.appendChild(a),a.appendChild(p);let w=this.src?this.shadowRoot:this;var k=w.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');let x;k&&(x=this.getAlternateStyles(k),x&&n.appendChild(x)),this._layerControlCheckbox=i,this._layerControlLabel=l,this._opacityControl=r,this._opacitySlider=c,this._layerControlHTML=e,this._layerItemSettingsHTML=n,this._propertiesGroupAnatomy=f,this._styles=x,f.setAttribute("aria-label","Sublayers"),f.setAttribute("hidden","");let M=w.querySelectorAll("map-extent:not([hidden])"),_=[];for(let t=0;t<M.length;t++)_.push(M[t].whenReady()),f.removeAttribute("hidden");await Promise.all(_);for(let t=0;t<M.length;t++)f.appendChild(M[t].getLayerControlHTML());return n.appendChild(f),this._layerControlHTML};const m=a(class extends h{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get el(){return this}src;checked;hidden=!1;opacity=1;_opacity;media;get opacityValue(){return this._opacity??this.opacity??1}_layer;_layerControl;_layerControlHTML;_layerItemSettingsHTML;_propertiesGroupAnatomy;disabled=!1;_fetchError=!1;_layerRegistry=new Map;srcChanged(t,e){e!==t&&(this._onRemove(),this.el.isConnected&&this._onAdd())}checkedChanged(t){if(this._layer){const e=this.getMapEl();if(e&&e._map){const i=e._map;t?i.addLayer(this._layer):i.removeLayer(this._layer)}this._layerControlCheckbox&&(this._layerControlCheckbox.checked=t)}}opacityChanged(t,e){e!==t&&this._layer&&(this._opacity=t,this._layer.changeOpacity(t),this._opacitySlider&&(this._opacitySlider.value=""+t))}mediaChanged(t,e){e!==t&&this._registerMediaQuery(t)}hiddenChanged(t,e){e!==t&&this._layer&&this._layerControl&&this._applyHiddenState(t)}_applyHiddenState(t){this._layer&&this._layerControl&&(t?this._layerControl.removeLayer(this._layer):(this._layerControl.addOrUpdateOverlay(this._layer,this.label),this._validateDisabled()))}loggedMessages;_observer;_mql;_changeHandler;_boundCreateLayerControlHTML;_layerControlCheckbox;_layerControlLabel;_opacityControl;_opacitySlider;_styles;get label(){return this._layer?this._layer.getName():this.el.hasAttribute("label")?this.el.getAttribute("label"):""}set label(t){t&&(this.el.setAttribute("label",t),this._layer&&this._layer.setName(t))}get extent(){return this._layer&&this._layer._calculateBounds(),this._layer?Object.assign(e._convertAndFormatPCRS(this._layer.bounds,window.M[this.getProjection()],this.getProjection()),{zoom:this._layer.zoomBounds}):null}_registerMediaQuery(t){if(this._changeHandler||(this._changeHandler=()=>{this._onRemove(),this._mql.matches&&this._onAdd(),this._validateDisabled()}),t){let e=this.getMapEl();if(!e)return;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._onRemove(),this._onAdd(),this._validateDisabled())}getMapEl(){return e.getClosest(this.el,"gcds-ext-map")}componentWillLoad(){this.loggedMessages=new Set,Object.defineProperty(this.el,"queryable",{value:()=>this.queryable(),writable:!0,configurable:!0})}disconnectedCallback(){this.el.hasAttribute("data-moving")||(this._onRemove(),this._mql&&(this._changeHandler&&this._mql.removeEventListener("change",this._changeHandler),delete this._mql))}_onRemove(){this._observer&&this._observer.disconnect();let t=this._layer,e=this._layerControl;t&&t.off(),t&&t._map&&t._map.removeLayer(t),e&&!this.el.hasAttribute("hidden")&&e.removeLayer(t),delete this._layer,delete this._layerControl,delete this._layerControlHTML,delete this._fetchError,delete this.el._layer,delete this.el._layerControl,delete this.el._layerControlHTML,delete this.el._fetchError,this._layerControlCheckbox=void 0,this._layerControlLabel=void 0,this._opacityControl=void 0,this._opacitySlider=void 0,this._styles=void 0,this.el.shadowRoot.innerHTML="",this.src&&(this.el.innerHTML=""),this._layerRegistry.clear()}connectedCallback(){if(this.el.hasAttribute("data-moving"))return;this._boundCreateLayerControlHTML=c.bind(this.el),this.el._validateDisabled=this._validateDisabled.bind(this),Object.defineProperty(this.el,"disabled",{get:()=>this.disabled,set:t=>{this.disabled=t},configurable:!0,enumerable:!0}),Object.defineProperty(this.el,"_opacity",{get:()=>this._opacity,set:t=>{t!==this._opacity&&(this._opacity=t)},configurable:!0,enumerable:!0}),Object.defineProperty(this.el,"opacity",{get:()=>this.opacityValue,set:t=>{+t>1||+t<0||(this._opacity=t,this._layer?.changeOpacity(t))},configurable:!0,enumerable:!0}),Object.defineProperty(this.el,"whenElemsReady",{value:()=>this.whenElemsReady(),writable:!0,configurable:!0}),Object.defineProperty(this.el,"zoomTo",{value:()=>this.zoomTo(),writable:!0,configurable:!0}),Object.defineProperty(this.el,"mapml2geojson",{value:(t={})=>this.mapml2geojson(t),writable:!0,configurable:!0}),Object.defineProperty(this.el,"pasteFeature",{value:t=>this.pasteFeature(t),writable:!0,configurable:!0}),Object.defineProperty(this.el,"getAlternateStyles",{value:t=>this.getAlternateStyles(t),writable:!0,configurable:!0}),Object.defineProperty(this.el,"getOuterHTML",{value:()=>this.getOuterHTML(),writable:!0,configurable:!0}),Object.defineProperty(this.el,"getMapEl",{value:()=>this.getMapEl(),writable:!0,configurable:!0}),Object.defineProperty(this.el,"getProjection",{value:()=>this.getProjection(),writable:!0,configurable:!0}),Object.defineProperty(this.el,"label",{get:()=>this.label,set:t=>this.label=t,configurable:!0,enumerable:!0}),Object.defineProperty(this.el,"hidden",{get:()=>this.el.hasAttribute("hidden"),set:t=>{t?this.el.setAttribute("hidden",""):this.el.removeAttribute("hidden")},configurable:!0,enumerable:!0}),Object.defineProperty(this.el,"extent",{get:()=>this.extent,configurable:!0,enumerable:!0}),this.el._layerRegistry=this._layerRegistry;const t=this._onAdd.bind(this),e=this._onRemove.bind(this),i=this._registerMediaQuery.bind(this);let s=this.media;this.getMapEl().whenReady().then((()=>{e(),s?i(s):t()})).catch((t=>{throw Error("Map never became ready: "+t)}))}_onAdd(){new Promise(((t,e)=>{this.el.addEventListener("changestyle",(t=>{t.stopPropagation(),t.detail&&(this.src=t.detail.src)}),{once:!0});let i=this.el.baseURI?this.el.baseURI:document.baseURI;const s=new Headers;if(s.append("Accept","text/mapml"),this.src)fetch(this.src,{headers:s}).then((t=>{if(!t.ok)throw Error("HTTP error! Status: "+t.status);const e=t.url;return t.text().then((t=>({text:t,url:e})))})).then((({text:t,url:e})=>{let i=(new DOMParser).parseFromString(t,"text/xml");if(i.querySelector("parsererror")||!i.querySelector("mapml-"))throw this._fetchError=!0,this.el._fetchError=this._fetchError,console.log("Error fetching layer content:\n\n"+t+"\n"),Error("Parser error");return i._sourceUrl=e,i})).then((t=>{this._copyRemoteContentToShadowRoot(t.querySelector("mapml-"),t._sourceUrl),this._copyRemoteContentToShadowRoot(t.querySelector("mapml-"));let e=this.el.shadowRoot.querySelectorAll("*"),i=[];for(let t=0;t<e.length;t++)e[t].whenReady&&i.push(e[t].whenReady().catch((i=>(console.warn(`Element ${e[t].tagName} failed to become ready:`,i),null))));return Promise.allSettled(i)})).then((()=>{this._selectAlternateOrChangeProjection()})).then((()=>{this._layer=r(new URL(this.src,i).href,this.el,{projection:this.getProjection(),opacity:this.opacityValue}),this.el._layer=this._layer,this._createLayerControlHTML(),this._setLocalizedDefaultLabel(),this._attachedToMap(),this._runMutationObserver(this.el.shadowRoot.children),this._bindMutationObserver(),this._validateDisabled(),this.el.dispatchEvent(new CustomEvent("loadedmetadata",{detail:{target:this.el}})),t(void 0)})).catch((t=>{e(t)}));else{let i=this.el.querySelectorAll("*"),s=[];for(let t=0;t<i.length;t++)i[t].whenReady&&s.push(i[t].whenReady());Promise.allSettled(s).then((()=>{this._selectAlternateOrChangeProjection()})).then((()=>{this._layer=r(null,this.el,{projection:this.getProjection(),opacity:this.opacityValue}),this.el._layer=this._layer,this._createLayerControlHTML(),this._setLocalizedDefaultLabel(),this._attachedToMap(),this._runMutationObserver(this.el.children),this._bindMutationObserver(),this._validateDisabled(),this.el.dispatchEvent(new CustomEvent("loadedmetadata",{detail:{target:this.el}})),t(void 0)})).catch((t=>{e(t)}))}})).catch((t=>{if("changeprojection"===t.message){if(t.cause.href)console.log("Changing layer src to: "+t.cause.href),this.src=t.cause.href;else if(t.cause.mapprojection){console.log("Changing map projection to match layer: "+t.cause.mapprojection);const e=this.getMapEl();e&&(e.projection=t.cause.mapprojection)}}else"Failed to fetch"===t.message?(this._fetchError=!0,this.el._fetchError=this._fetchError):(console.log(t),this.el.dispatchEvent(new CustomEvent("error",{detail:{target:this.el}})))}))}_setLocalizedDefaultLabel(){if(!this._layer?._titleIsReadOnly&&!this._layer?._title){const t=this.getMapEl();t&&t.locale?.dfLayer&&(this.label=t.locale.dfLayer)}}_selectAlternateOrChangeProjection(){const t=this.src?this.el.shadowRoot:this.el,e=this.getMapEl();if(!t||!e)return;const i=this.getProjection()!==e.projection&&t.querySelector("map-link[rel=alternate][projection="+e.projection+"][href]");if(i){let e;const s=t.querySelector("map-base[href]");e=s?s.getAttribute("href"):this.src?new URL(this.src,this.el.baseURI||document.baseURI).href:this.el.baseURI||document.baseURI;const a=new URL(i.getAttribute("href"),e).href;throw Error("changeprojection",{cause:{href:a}})}const s=this.getProjection();if(s!==e.projection&&1===e.layers?.length)throw Error("changeprojection",{cause:{mapprojection:s}})}_copyRemoteContentToShadowRoot(t,e){const i=this.el.shadowRoot;if(!i||!t)return;const s=document.createDocumentFragment(),a=t.querySelectorAll("map-head > *, map-body > *");let h=Array.from(a).find((t=>"MAP-BASE"===t.nodeName));if(!h&&e)h=document.createElement("map-base"),h.setAttribute("href",e),s.appendChild(h);else if(h&&e){const t=new URL(h.getAttribute("href")||"",e).href;h.setAttribute("href",t)}for(let t=0;t<a.length;t++)s.appendChild(a[t]);i.appendChild(s)}getProjection(){let t=this.src?this.el.shadowRoot:this.el,i=this.getMapEl().projection;if(t.querySelector("map-meta[name=projection][content]"))i=e._metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content||i;else if(t.querySelector("map-extent[units]"))i=(t=>{let e=t[0].attributes.units.value,i=!0;for(let s=0;s<t.length;s++)e!==t[s].attributes.units.value&&(i=!1);return i?e:null})(Array.from(t.querySelectorAll("map-extent[units]")))||i;else{const t=this.el.querySelector("map-title"),e=`A projection was not assigned to the '${this.label||(t?t.textContent:"Unnamed")}' Layer. \nPlease specify a projection for that layer using a map-meta element. \nSee more here - https://maps4html.org/web-map-doc/docs/elements/meta/`;this.loggedMessages.has(e)||(console.log(e),this.loggedMessages.add(e))}return i}_attachedToMap(){const e=this.getMapEl();if(!e||!this._layer)return;let i=0,s=1;const a=e.children;for(i=0;i<a.length;i++)"MAP-LAYER"!==a[i].nodeName&&"LAYER-"!==a[i].nodeName||(a[i]===this.el?s=i+1:a[i]._layer&&a[i]._layer.setZIndex(i+1));t.setOptions(this._layer,{zIndex:s,mapprojection:e.projection?e.projection:"OSMTILE",opacity:window.getComputedStyle(this.el).opacity}),this.checked&&this._layer.addTo(e._map),e._map.on("moveend layeradd",this._validateDisabled,this),this._layer.on("add remove",this._validateDisabled,this),e._layerControl&&(this._layerControl=e._layerControl,this.el._layerControl=this._layerControl),e._layerControl&&!this.hidden&&this._layerControl.addOrUpdateOverlay(this._layer,this.label),this._layer._legendUrl&&(this.el.legendLinks=[{type:"application/octet-stream",href:this._layer._legendUrl,rel:"legend",lang:null,hreflang:null,sizes:null}])}_runMutationObserver(t){const e=t=>{this.whenReady().then((()=>{this._layer.renderStyles(t)}))},i=t=>{this.whenReady().then((()=>{this._layer.renderStyles(t)}))},s=t=>{this.whenReady().then((()=>{"function"==typeof t.whenReady?t.whenReady().then((()=>{delete this._layer.bounds,this._layer._calculateBounds(),this._validateDisabled()})):(delete this._layer.bounds,this._layer._calculateBounds(),this._validateDisabled())}))},a=this.src?this.el.shadowRoot:this.el,h=a instanceof ShadowRoot?":host":":scope",n=()=>{this.whenReady().then((()=>{this._layer._calculateBounds(),this._validateDisabled()}))};for(let l=0;l<t.length;++l){const o=t[l];switch(o.nodeName){case"MAP-LINK":o.link&&!o.link.isConnected&&e(o);break;case"MAP-STYLE":o.styleElement&&!o.styleElement.isConnected&&i(o);break;case"MAP-EXTENT":s(o);break;case"MAP-META":o.hasAttribute("name")&&("zoom"===o.getAttribute("name").toLowerCase()||"extent"===o.getAttribute("name").toLowerCase())&&o===a.querySelector(`${h} > [name=${o.getAttribute("name")}]`)&&o.hasAttribute("content")&&n()}}}_bindMutationObserver(){this._observer=new MutationObserver((t=>{for(let e of t)"childList"===e.type&&this._runMutationObserver(e.addedNodes)})),this._observer.observe(this.src?this.el.shadowRoot:this.el,{childList:!0})}_validateDisabled(){const t=()=>{let t=0,e=0;return this._layer.eachLayer((i=>{i instanceof n&&(t++,i.isVisible()||e++)})),{totalCount:t,disabledCount:e}},e=()=>{let t=0,e=0;return this._layer.eachLayer((s=>{s instanceof i&&(t++,s.isVisible()||e++)})),{totalCount:t,disabledCount:e}};setTimeout((()=>{let i=this._layer,s=i?._map;if(this._mql&&!this._mql.matches)return this.el.setAttribute("disabled",""),void(this.disabled=!0);if(s){const i=this.src?this.el.shadowRoot?.querySelectorAll("map-extent"):this.el.querySelectorAll("map-extent");let s=[];if(i)for(let t=0;t<i.length;t++)i[t].whenLinksReady&&s.push(i[t].whenLinksReady());Promise.allSettled(s).then((()=>{let s=0,a=0,h=["_staticTileLayer","_mapmlvectors","_extentLayer"];for(let n=0;n<h.length;n++){let l=h[n];if(this.checked)if("_extentLayer"===l&&i&&i.length>0)for(let t=0;t<i.length;t++)a++,i[t]._validateDisabled&&i[t]._validateDisabled()&&s++;else if("_mapmlvectors"===l){const t=e();a+=t.totalCount,s+=t.disabledCount}else{const e=t();a+=e.totalCount,s+=e.disabledCount}}s===a&&0!==s?(this.el.setAttribute("disabled",""),this.disabled=!0):(this.el.removeAttribute("disabled"),this.disabled=!1),this.toggleLayerControlDisabled()})).catch((t=>{console.log(t)}))}}),0)}toggleLayerControlDisabled(){let t=this._layerControlCheckbox,e=this._layerControlLabel,i=this._opacityControl,s=this._opacitySlider,a=this._styles;this.disabled?(t&&(t.disabled=!0),s&&(s.disabled=!0),e&&(e.style.fontStyle="italic"),i&&(i.style.fontStyle="italic"),a&&(a.style.fontStyle="italic",a.querySelectorAll("input").forEach((t=>{t.disabled=!0})))):(t&&(t.disabled=!1),s&&(s.disabled=!1),e&&(e.style.fontStyle="normal"),i&&(i.style.fontStyle="normal"),a&&(a.style.fontStyle="normal",a.querySelectorAll("input").forEach((t=>{t.disabled=!1}))))}queryable(){let t=this.src?this.el.shadowRoot:this.el;return!(!(t?.querySelector("map-extent[checked] > map-link[rel=query]:not([disabled])")&&this.checked&&this._layer)||this.el.hasAttribute("hidden"))}getAlternateStyles(e){if(e.length>1){const i=document.createElement("details"),s=document.createElement("summary"),a=this.getMapEl();s.innerText=a?.locale?.lmStyle||"Style",i.appendChild(s);for(let s=0;s<e.length;s++)i.appendChild(e[s].getLayerControlOption()),t.DomUtil.addClass(i,"mapml-layer-item-style mapml-control-layers");return i}return null}getOuterHTML(){let t=this.el.cloneNode(!0);if(this.el.hasAttribute("src")){let e=this._layer.getHref();t.setAttribute("src",e)}this.el.querySelector("map-link")&&t.querySelectorAll("map-link").forEach((t=>{t.hasAttribute("href")?t.setAttribute("href",decodeURI(new URL(t.getAttribute("href"),this.el.baseURI?this.el.baseURI:document.baseURI).href)):t.hasAttribute("tref")&&t.setAttribute("tref",decodeURI(new URL(t.getAttribute("tref"),this.el.baseURI?this.el.baseURI:document.baseURI).href))}));let e=t.outerHTML;return t.remove(),e}zoomTo(){this.whenReady().then((()=>{let i=this.getMapEl()?._map,s=this.extent,a=s.topLeft.pcrs,h=s.bottomRight.pcrs,n=t.bounds(t.point(a.horizontal,a.vertical),t.point(h.horizontal,h.vertical)),l=i.options.crs.unproject(n.getCenter(!0));i.setView(l,e.getMaxZoom(n,i,s.zoom.minZoom,s.zoom.maxZoom),{animate:!1})}))}pasteFeature(t){switch(typeof t){case"string":t.trim(),"<map-feature"===t.slice(0,12)&&"</map-feature>"===t.slice(-14)&&this.el.insertAdjacentHTML("beforeend",t);break;case"object":"MAP-FEATURE"===t.nodeName?.toUpperCase()&&this.el.appendChild(t)}}_createLayerControlHTML(){this._boundCreateLayerControlHTML&&this._boundCreateLayerControlHTML().then((t=>{this._layerControlHTML=t,this.el._layerControlHTML=this._layerControlHTML,this._layerControlCheckbox=this.el._layerControlCheckbox,this._layerControlLabel=this.el._layerControlLabel,this._opacityControl=this.el._opacityControl,this._opacitySlider=this.el._opacitySlider,this._layerItemSettingsHTML=this.el._layerItemSettingsHTML,this._propertiesGroupAnatomy=this.el._propertiesGroupAnatomy,this._styles=this.el._styles,this._opacitySlider&&void 0!==this._opacity&&(this._opacitySlider.value=""+this._opacity)}))}async whenReady(){return new Promise(((t,e)=>{let i,s;this.el._layer&&this._layerControlHTML&&(!this.src||this.el.shadowRoot?.childNodes.length)?t():(i=setInterval((function(a){a._layer&&a._layerControlHTML&&(!a.src||a.shadowRoot?.childNodes.length)?(clearInterval(i),clearTimeout(s),t()):a._fetchError&&(clearInterval(i),clearTimeout(s),e("Error fetching layer content"))}),200,this.el),s=setTimeout((function(){clearInterval(i),clearTimeout(s),e("Timeout reached waiting for layer to be ready")}),5e3))}))}async whenElemsReady(){let t=[],e=this.src?this.el.shadowRoot:this.el;if(!e)return[];const i=Array.from(e.querySelectorAll("map-extent")),s=Array.from(e.querySelectorAll("map-feature"));for(let e of[...i,...s])"function"==typeof e.whenReady&&t.push(e.whenReady());return Promise.allSettled(t)}mapml2geojson(t={}){return e.mapml2geojson(this.el,t)}render(){return null}static get watchers(){return{src:[{srcChanged:0}],checked:[{checkedChanged:0}],_opacity:[{opacityChanged:0}],media:[{mediaChanged:0}],hidden:[{hiddenChanged:0}]}}},[513,"map-layer",{src:[1537],checked:[1540],hidden:[1540],opacity:[1026],_opacity:[1026],media:[1537],whenReady:[64],whenElemsReady:[64]},void 0,{src:[{srcChanged:0}],checked:[{checkedChanged:0}],_opacity:[{opacityChanged:0}],media:[{mediaChanged:0}],hidden:[{hiddenChanged:0}]}]);function p(){"undefined"!=typeof customElements&&["map-layer"].forEach((t=>{"map-layer"===t&&(customElements.get(s(t))||customElements.define(s(t),m))}))}p();const d=m,u=p;export{d as MapLayer,u as defineCustomElement}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface MapLink extends Components.MapLink, HTMLElement {}
4
+ export const MapLink: {
5
+ prototype: MapLink;
6
+ new (): MapLink;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1 @@
1
+ import{l as t,U as e,M as i,d as s,t as r,p as n,H as a}from"./p-CwRxGZga.js";import"./p-gwC_yeRa.js";import{r as o}from"./p-EYVT9Efh.js";function h(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var l=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=!1,i=this._image,s=Math.min(1,(+new Date-i.loaded)/200);t.DomUtil.setOpacity(i,s),s<1&&(e=!0),e&&(t.Util.cancelAnimFrame(this._fadeFrame),this._fadeFrame=t.Util.requestAnimFrame(this._updateOpacity,this)),t.DomUtil.addClass(i,"leaflet-image-loaded")}}}),f=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 l(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=s._map.getZoomScale(i,Math.floor(i/r)*r),a=e.min.multiplyBy(n).subtract(s._map._getNewPixelOrigin(s._map.getCenter(),i)).round();t.DomUtil.setTransform(s._imageOverlay._image,a,n)}))},_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}}),c=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),o.setAttribute("height",""+l),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 _=o[l].getAttribute("min"),w=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(_))||(a.min=Number.parseFloat(_)),isNaN(Number.parseFloat(w))||(a.max=Number.parseFloat(w));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(_))||(n.min=Number.parseFloat(_)),isNaN(Number.parseFloat(w))||(n.max=Number.parseFloat(w));break;case"longitude":case"easting":s||(s={min:h.crs.pcrs.horizontal.min,max:h.crs.pcrs.horizontal.max}),isNaN(Number.parseFloat(_))||(s.min=Number.parseFloat(_)),isNaN(Number.parseFloat(w))||(s.max=Number.parseFloat(w)),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(_))||(r.min=Number.parseFloat(_)),isNaN(Number.parseFloat(w))||(r.max=Number.parseFloat(w)),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}}),u=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(),s=l.querySelectorAll("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");for(let t=0;t<s.length;t++)i.appendChild(s[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:o});function d(t,e){this.x=t,this.y=e}function m(t,e,i){return Math.min(Math.max(t,i),e)}d.prototype={clone(){return new d(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:d},d.convert=function(t){if(t instanceof d)return t;if(Array.isArray(t))return new d(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new d(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};var b=class extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}};function _(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(m(0,100,i)!==i)throw new b(t);if(m(0,100,s)!==s)throw new b(t);return[...T(e,i,s),Number.isNaN(r)?1:r]}throw new b(t)}const w=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=w(e.substring(0,3)),s=w(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=RegExp(`^#${y("([a-f0-9])",3)}([a-f0-9])?$`,"i"),v=RegExp(`^#${y("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),x=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=e/100*(1-Math.abs(2*s-1)),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]=_(t).map(s),[h,l,f,c]=_(e).map(s),u=c-o,d=2*i-1,b=((d*u==-1?d:d+u/(1+d*u))+1)/2,w=1-b;return function(t,e,i,s){return`rgba(${m(0,255,t).toFixed()}, ${m(0,255,e).toFixed()}, ${m(0,255,i).toFixed()}, ${parseFloat(m(0,1,s).toFixed(3))})`}(255*(r*w+h*b),255*(n*w+l*b),255*(a*w+f*b),c*i+o*(1-i))}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 d(a,o));else{if(7!==r)throw 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 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 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=C(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 C(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($,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw 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 $(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 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,R=1/I,N="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class B{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 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!!this.readVarint()}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&N?N.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 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*R),!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*R),!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 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){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=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,r=Math.pow,n=(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())})),a={};((e,i)=>{for(var s in i)t(e,s,{get:i[s],enumerable:!0})})(a,{Compression:()=>at,EtagMismatch:()=>_t,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}),J=(r=>((r,n,a,o)=>{if(n)for(let a of i(n))s.call(r,a)||undefined===a||t(r,a,{get:()=>n[a],enumerable:!(o=e(n,a))||o.enumerable});return r})(t({},"__esModule",{value:!0}),r))(a);var o=Uint8Array,h=Uint16Array,l=Int32Array,f=new o([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]),c=new o([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]),u=new o([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=function(t,e){for(var i=new h(31),s=0;s<31;++s)i[s]=e+=1<<t[s-1];var r=new l(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}},m=d(f,2),b=m.b,_=m.r;b[28]=258,_[258]=28;var w,p=d(c,0).b,y=new h(32768);for(x=0;x<32768;++x)y[x]=((65280&(w=(61680&(w=(52428&(w=(43690&x)>>1|(21845&x)<<1))>>2|(13107&w)<<2))>>4|(3855&w)<<4))>>8|(255&w)<<8)>>1;var g=function(t,e){for(var i=t.length,s=0,r=new h(e);s<i;++s)t[s]&&++r[t[s]-1];var n,a=new h(e);for(s=1;s<e;++s)a[s]=a[s-1]+r[s-1]<<1;n=new h(1<<e);var o=15-e;for(s=0;s<i;++s)if(t[s])for(var l=s<<4|t[s],f=e-t[s],c=a[t[s]-1]++<<f,u=c|(1<<f)-1;c<=u;++c)n[y[c]>>o]=l;return n},v=new o(288);for(x=0;x<144;++x)v[x]=8;for(x=144;x<256;++x)v[x]=9;for(x=256;x<280;++x)v[x]=7;for(x=280;x<288;++x)v[x]=8;var x,k=new o(32);for(x=0;x<32;++x)k[x]=5;var M=g(v,9),z=g(k,5),j=function(t){for(var e=t[0],i=1;i<t.length;++i)t[i]>e&&(e=t[i]);return e},T=function(t,e,i){var s=e/8|0;return(t[s]|t[s+1]<<8)>>(7&e)&i},P=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)},S=function(t){return(t+7)/8|0},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"],C=function(t,e,i){var s=Error(e||E[t]);if(s.code=t,Error.captureStackTrace&&Error.captureStackTrace(s,C),!i)throw s;return s},A=function(t,e,i,s){var r=t.length;if(!r||e.f&&!e.l)return i||new o(0);var n=!i||2!=e.i,a=e.i;i||(i=new o(3*r));var h=function(t){var e=i.length;if(t>e){var s=new o(Math.max(2*e,t));s.set(i),i=s}},l=e.f||0,d=e.p||0,m=e.b||0,_=e.l,w=e.d,y=e.m,v=e.n,x=8*r;do{if(!_){l=T(t,d,1);var k=T(t,d+1,3);if(d+=3,!k){var L=t[(O=S(d)+4)-4]|t[O-3]<<8,E=O+L;if(E>r){a&&C(0);break}n&&h(m+L),i.set(t.subarray(O,E),m),e.b=m+=L,e.p=d=8*E,e.f=l;continue}if(1==k)_=M,w=z,y=9,v=5;else if(2==k){var A=T(t,d,31)+257,$=T(t,d+10,15)+4,D=A+T(t,d+5,31)+1;d+=14;for(var F=new o(D),I=new o(19),R=0;R<$;++R)I[u[R]]=T(t,d+3*R,7);d+=3*$;var N=j(I),B=(1<<N)-1,V=g(I,N);for(R=0;R<D;){var O,U=V[T(t,d,B)];if(d+=15&U,(O=U>>4)<16)F[R++]=O;else{var X=0,q=0;for(16==O?(q=3+T(t,d,3),d+=2,X=F[R-1]):17==O?(q=3+T(t,d,7),d+=3):18==O&&(q=11+T(t,d,127),d+=7);q--;)F[R++]=X}}var Y=F.subarray(0,A),Z=F.subarray(A);y=j(Y),v=j(Z),_=g(Y,y),w=g(Z,v)}else C(1);if(d>x){a&&C(0);break}}n&&h(m+131072);for(var H=(1<<y)-1,G=(1<<v)-1,W=d;;W=d){var K=(X=_[P(t,d)&H])>>4;if((d+=15&X)>x){a&&C(0);break}if(X||C(2),K<256)i[m++]=K;else{if(256==K){W=d,_=null;break}var J=K-254;K>264&&(J=T(t,d,(1<<(et=f[R=K-257]))-1)+b[R],d+=et);var Q=w[P(t,d)&G],tt=Q>>4;if(Q||C(3),d+=15&Q,Z=p[tt],tt>3){var et=c[tt];Z+=P(t,d)&(1<<et)-1,d+=et}if(d>x){a&&C(0);break}n&&h(m+131072);var it=m+J;if(m<Z){var st=0-Z,rt=Math.min(Z,it);for(st+m<0&&C(3);m<rt;++m)i[m]=s[st+m]}for(;m<it;m+=4)i[m]=i[m-Z],i[m+1]=i[m+1-Z],i[m+2]=i[m+2-Z],i[m+3]=i[m+3-Z];m=it}}e.l=_,e.p=W,e.b=m,e.f=l,_&&(l=1,e.m=y,e.d=w,e.n=v)}while(!l);return m==i.length?i:function(t,e,i){(null==i||i>t.length)&&(i=t.length);var s=new o(i-0);return s.set(t.subarray(0,i)),s}(i,0,m)},$=new o(0);function D(t,e){return 31==t[0]&&139==t[1]&&8==t[2]?function(t,e){var i=function(t){31==t[0]&&139==t[1]&&8==t[2]||C(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 i+8>t.length&&C(6,"invalid gzip data"),A(t.subarray(i,-8),{i:2},new o(function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}(t)),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(function(t){return(8!=(15&t[0])||t[0]>>4>7||(t[0]<<8|t[1])%31)&&C(6,"invalid zlib data"),1==(t[1]>>5&1)&&C(6,"invalid zlib data: "+(32&t[1]?"need":"unexpected")+" dictionary"),2+(t[1]>>3&4)}(t),-4),{i:2},e,e)}(t,e)}var F="undefined"!=typeof TextDecoder&&new TextDecoder;try{F.decode($,{stream:!0})}catch(t){}var I=(t,e)=>t*r(2,e),R=(t,e)=>Math.floor(t/r(2,e)),N=(t,e)=>I(t.getUint16(e+1,!0),8)+t.getUint8(e),B=(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=N(s,r+1);if(e!==n)return e-n;const a=N(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[B(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:N(t,17*e+1),y:N(t,17*e+4),offset:B(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&R(s.offset,8),i[17*e+9]=255&R(s.offset,16),i[17*e+10]=255&R(s.offset,24),i[17*e+11]=255&R(s.offset,32),i[17*e+12]=255&R(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 n(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,_=85;if(a.bounds){const t=a.bounds.split(",");d=+t[0],m=+t[1],b=+t[2],_=+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:_,centerZoom:u,centerLon:f,centerLat:c,etag:e.etag}}))},getZxy:function(t,e,i,s,r,a,o){return n(this,null,(function*(){let n=yield i.getArrayBuffer(e,t.rootDirectoryOffset,t.rootDirectoryLength,t);1===t.specVersion&&(n=Y(n));const h=O(new DataView(n),s,r,a);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(n),{z:s,x:r,y:a});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(n),l.z,l.x,l.y);if(h){let n=yield i.getArrayBuffer(e,h.offset,h.length,t);1===t.specVersion&&(n=Y(n));const l=O(new DataView(n),s,r,a);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){this.tilev4=(t,e)=>n(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=RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),s=t.url.match(i);if(!s)throw 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=(t=>(e,i)=>{if(i instanceof AbortController)return t(e,i);const s=new AbortController;return t(e,s).then((t=>i(void 0,t.data,t.cacheControl||"",t.expires||"")),(t=>i(t))).catch((t=>i(t))),{cancel:()=>s.abort()}})(this.tilev4),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 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=r(2,t);let s=e,n=e,a=e;const o=[0,0];let h=1;for(;h<i;)s=1&a/2,n=1&(a^s),et(h,o,s,n),o[0]+=h*s,o[1]+=h*n,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>r(2,t)-1||i>r(2,t)-1)throw Error("tile x/y outside zoom level bounds");const s=st[t];let n=0,a=0,o=0;const h=[e,i];let l=r(2,t)/2;for(;l>0;)n=(h[0]&l)>0?1:0,a=(h[1]&l)>0?1:0,o+=l*l*(3*n^a),et(l,h,n,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 n(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 n(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 n(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 _t(`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*r(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 _t=class extends Error{};function wt(t,e){return n(this,null,(function*(){const i=yield t.getBytes(0,16384);if(19792!==new DataView(i.data).getUint16(0,!0))throw 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 n(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 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 n(this,null,(function*(){const e=t.getKey(),i=this.cache.get(e);if(i)return i.lastUsed=this.counter++,i.data;const s=yield wt(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 n(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 n(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 n(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 n(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)=>{wt(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 n(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 n(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 n(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 n(this,null,(function*(){return yield this.cache.getHeader(this.source)}))}getZxyAttempt(t,e,i,s){return n(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 n(this,null,(function*(){try{return yield this.getZxyAttempt(t,e,i,s)}catch(r){if(r instanceof _t)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,i,s);throw r}}))}getMetadataAttempt(){return n(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 n(this,null,(function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof _t)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}}))}getTileJson(t){return n(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||(o=Math.ceil(a/Math.pow(o,(s=Math.ceil(Math.log(a)/Math.log(o)))-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)r.children.push(this._build(t,u,Math.min(u+h-1,c),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=(Math.max((d=h).maxX,(u=t).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),_=a(t,m,i,this.toBBox),w=(void 0,void 0,void 0,void 0,o=Math.max((r=b).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=w,s=m,d=p<d?p:d):w===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=h(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 _t=bt,wt=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(wt,"ArrayAttr");var pt=wt,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,_=0,w=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,_=Math.acos((u*m+d*b)/(f*c)),(_>e||l-p>i)&&(a.push({length:l-p,beginDistance:p,beginIndex:w,endIndex:o+1,endDistance:l}),w=o,p=l),f=c;return o-w>0&&a.push({length:l-p+c,beginIndex:w,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 d(n[a.beginIndex].x,n[a.beginIndex].y),o=n[a.endIndex-1],h=new d((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,u=[],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&&u.push(m),m=[]),m.push(new d(a,o));else{if(7!==r)throw Error("unknown command "+r);m&&m.push(m[0].clone())}}return m&&u.push(m),{geom:u,bbox:{minX:h,minY:f,maxX:l,maxY:c}}}),"loadGeomAndBbox");function jt(t,e){let i=new D(new B(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).replace("{x}",""+t.x).replace("{y}",""+t.y),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,Ct=85.0511287798,At=Et*Math.PI,$t=ot((t=>{let e=Math.PI/180,i=Math.sin(Math.max(Math.min(Ct,t[0]),-Ct)*e);return new d(Et*t[1]*e,Et*Math.log((1+i)/(1-i))/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 d(e.x+r*(i.x-e.x),e.y+r*(i.y-e.y)))}function Rt(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 Nt(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 Bt(t,e){let i=!1;for(let s of e)if(Nt(s))Rt(t,s)&&(i=!1);else{if(i)return!0;Rt(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(Rt,"isInRing"),ot(Nt,"isCcw"),ot(Bt,"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=$t([e,t]),n=new d((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 d((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}):Bt(t,r.geom)&&f.push({feature:r,layerName:e})}return f}};ot(Ut,"TileCache");var Xt=Ut,qt=(t=>(t[t.Left=1]="Left",t[t.Center=2]="Center",t[t.Right=3]="Right",t))(qt||{}),Yt=(t=>(t[t.N=1]="N",t[t.Ne=2]="Ne",t[t.E=3]="E",t[t.Se=4]="Se",t[t.S=5]="S",t[t.Sw=6]="Sw",t[t.W=7]="W",t[t.Nw=8]="Nw",t))(Yt||{}),Zt=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"),Ht=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(Ht,"PolygonSymbolizer");var Gt=Ht;function Wt(t,e){return i=>{let s=i-t;return s>=0&&s<e.length?e[s]:0}}function Kt(t,e){let i=0;for(;e[i+1][0]<t;)i++;return i}function Jt(t,e,i){return t*(i-e)+e}function Qt(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 te(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=Kt(i,e);return Jt(Qt(i,s,t,e),e[s][1],e[s+1][1])}}function ee(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 ie(t){return te(1,t)}ot(Wt,"arr"),ot(Kt,"getStopIndex"),ot(Jt,"interpolate"),ot(Qt,"computeInterpolationFactor"),ot(te,"exp"),ot(ee,"step"),ot(ie,"linear");var se=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(se,"LineSymbolizer");var re=se,ne=class{constructor(t){this.name=t.name,this.sheet=t.sheet,this.dpr=window.devicePixelRatio}place(t,e,i){let s=new d(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(ne,"IconSymbolizer");var ae=ne,oe=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 d(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 d(0,0)]],t.zoom,i)}),"draw")}]}};ot(oe,"CircleSymbolizer");var he=oe,le=class{constructor(t){this.font=new _t(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 d(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(le,"ShieldSymbolizer");var fe=le,ce=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 d(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=de(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(ce,"FlexSymbolizer");var ue=ce,de=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"),me=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=de(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(me,"GroupSymbolizer");var be=me,_e=class{constructor(t){this.symbolizer=t}place(t,e,i){let s=e[0][0],r=this.symbolizer.place(t,[[new d(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 we=_e,pe=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(pe,"Padding");var ye=pe,ge=class{constructor(t){this.font=new _t(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,u=l.actualBoundingBoxDescent,m=(c+u)*this.lineHeight.get(t.zoom,i),b=new d(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+u+(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(ge,"TextSymbolizer");var ve=ge,xe=class{constructor(t){this.centered=new we(new ve(t))}place(t,e,i){return this.centered.place(t,e,i)}};ot(xe,"CenteredTextSymbolizer");var ke=xe,Me=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 d(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:u,justify:m,placements:b}=this.ddValues(t.zoom,i)||{};c&&(o=new ut(c,0)),u&&(h=new ut(u,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 d(w,p),v=ot((t=>{t.translate(g.x,g.y),n.draw(t,{justify:_})}),"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(w,a,t),i=this.computeYaxisOffset(p,a,t);return _=this.computeJustify(l,t),g=new d(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(Me,"OffsetSymbolizer");var ze=Me,je=class{constructor(t){this.symbolizer=new ze(new ve(t),t)}place(t,e,i){return this.symbolizer.place(t,e,i)}};ot(je,"OffsetTextSymbolizer");var Le=je,Te=(t=>(t[t.Above=1]="Above",t[t.Center=2]="Center",t[t.Below=3]="Below",t))(Te||{}),Pe=class{constructor(t){var e;this.font=new _t(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(Pe,"LineLabelSymbolizer");var Se=Pe,Ee=ot(((t,e)=>{let i=t[e];return"string"==typeof i?i:""}),"getString"),Ce=ot(((t,e)=>{let i=t[e];return"number"==typeof i?i:0}),"getNumber"),Ae=ot((t=>[{dataLayer:"earth",symbolizer:new Gt({fill:t.earth})},{dataLayer:"landuse",symbolizer:new Gt({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=Ee(e.props,"pmap:kind");return["allotments","village_green","playground"].includes(i)}),"filter")},{dataLayer:"landuse",symbolizer:new Gt({fill:t.park_b,opacity:.7}),filter:ot(((t,e)=>{let i=Ee(e.props,"pmap:kind");return["national_park","park","cemetery","protected_area","nature_reserve","forest","golf_course"].includes(i)}),"filter")},{dataLayer:"landuse",symbolizer:new Gt({fill:t.hospital}),filter:ot(((t,e)=>"hospital"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Gt({fill:t.industrial}),filter:ot(((t,e)=>"industrial"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Gt({fill:t.school}),filter:ot(((t,e)=>{let i=Ee(e.props,"pmap:kind");return["school","university","college"].includes(i)}),"filter")},{dataLayer:"landuse",symbolizer:new Gt({fill:t.beach}),filter:ot(((t,e)=>"beach"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Gt({fill:t.zoo}),filter:ot(((t,e)=>"zoo"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Gt({fill:t.zoo}),filter:ot(((t,e)=>{let i=Ee(e.props,"pmap:kind");return["military","naval_base","airfield"].includes(i)}),"filter")},{dataLayer:"natural",symbolizer:new Gt({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=Ee(e.props,"pmap:kind");return["wood","nature_reserve","forest"].includes(i)}),"filter")},{dataLayer:"natural",symbolizer:new Gt({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=Ee(e.props,"pmap:kind");return["scrub","grassland","grass"].includes(i)}),"filter")},{dataLayer:"natural",symbolizer:new Gt({fill:t.scrub_b}),filter:ot(((t,e)=>{let i=Ee(e.props,"pmap:kind");return["scrub","grassland","grass"].includes(i)}),"filter")},{dataLayer:"natural",symbolizer:new Gt({fill:t.glacier}),filter:ot(((t,e)=>"glacier"===e.props["pmap:kind"]),"filter")},{dataLayer:"natural",symbolizer:new Gt({fill:t.sand}),filter:ot(((t,e)=>"sand"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Gt({fill:t.aerodrome}),filter:ot(((t,e)=>"aerodrome"===e.props["pmap:kind"]),"filter")},{dataLayer:"water",symbolizer:new Gt({fill:t.water})},{dataLayer:"transit",symbolizer:new re({color:t.runway,width:ot((t=>te(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 re({color:t.runway,width:ot((t=>te(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 re({color:t.pier,width:ot((t=>te(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 re({color:t.water,width:ot((t=>te(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 re({color:t.water,width:.5}),filter:ot(((t,e)=>"stream"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Gt({fill:t.pedestrian}),filter:ot(((t,e)=>"pedestrian"===e.props["pmap:kind"]),"filter")},{dataLayer:"landuse",symbolizer:new Gt({fill:t.pier}),filter:ot(((t,e)=>"pier"===e.props["pmap:kind"]),"filter")},{dataLayer:"buildings",symbolizer:new Gt({fill:t.buildings,opacity:.5})},{dataLayer:"roads",symbolizer:new re({color:t.major,width:ot((t=>te(1.6,[[14,0],[20,7]])(t)),"width")}),filter:ot(((t,e)=>{let i=Ee(e.props,"pmap:kind");return["other","path"].includes(i)}),"filter")},{dataLayer:"roads",symbolizer:new re({color:t.major,width:ot((t=>te(1.6,[[13,0],[18,8]])(t)),"width")}),filter:ot(((t,e)=>"minor_road"===e.props["pmap:kind"]),"filter")},{dataLayer:"roads",symbolizer:new re({color:t.major,width:ot((t=>te(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 re({color:t.major,width:ot((t=>te(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 re({color:t.major,width:ot((t=>te(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 re({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 re({dash:[.3,.75],color:t.railway,dashWidth:ot((t=>te(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 re({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"),$e=ot((t=>{let e=["name"];return[{dataLayer:"roads",symbolizer:new Se({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=Ee(e.props,"pmap:kind");return["minor_road","other","path"].includes(i)}),"filter")},{dataLayer:"roads",symbolizer:new Se({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=Ee(e.props,"pmap:kind");return["highway","major_road","medium_road"].includes(i)}),"filter")},{dataLayer:"roads",symbolizer:new Se({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=Ee(e.props,"pmap:kind");return["highway","major_road","medium_road"].includes(i)}),"filter")},{dataLayer:"physical_point",symbolizer:new ke({labelProps:e,fill:t.ocean_label,lineHeight:1.5,letterSpacing:1,font:ot((t=>`400 ${ie([[3,10],[10,12]])(t)}px sans-serif`),"font"),textTransform:"uppercase"}),filter:ot(((t,e)=>{let i=Ee(e.props,"pmap:kind");return["ocean","bay","strait","fjord"].includes(i)}),"filter")},{dataLayer:"physical_point",symbolizer:new ke({labelProps:e,fill:t.ocean_label,lineHeight:1.5,letterSpacing:1,font:ot((t=>`400 ${ie([[3,0],[6,12],[10,12]])(t)}px sans-serif`),"font")}),filter:ot(((t,e)=>{let i=Ee(e.props,"pmap:kind");return["sea","lake","water"].includes(i)}),"filter")},{dataLayer:"places",symbolizer:new ke({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 ke({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 ke({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)=>Ce(t,"pmap:population_rank")-Ce(e,"pmap:population_rank")),"sort"),filter:ot(((t,e)=>"locality"===e.props["pmap:kind"]),"filter")},{dataLayer:"places",maxzoom:8,symbolizer:new be([new he({radius:2,fill:t.city_circle,stroke:t.city_circle_stroke,width:1.5}),new Le({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"),De={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"}},Fe=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"),Ie=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 d(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 d(t*r*a,e*r*a);s.push({dataTile:{z:o,x:Ie(t,o),y:Ie(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 d(t*a*256*r,e*a*256*r);s.push({dataTile:{z:this.maxDataLevel,x:Ie(t,this.maxDataLevel),y:Ie(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 d(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 d(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 d(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,Be=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 Error("Invalid source "+t.url);e=new Tt(t.url,!0)}let r=new Xt(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"),Ve=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"),Oe=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 d(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(Oe,"Index");var Ue=Oe,Xe=class{constructor(t,e,i,s,r){this.index=new Ue(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=Fe(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=Ve(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(Xe,"Labeler");var qe=Xe,Ye=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 qe(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(Ye,"Labelers");var Ze=Ye;function He(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);t.rect(e,i,Math.min(r.x-a.x+h,n.maxX-a.x)-e,Math.min(r.y-a.y+h,n.maxY-a.y)-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=Fe(i,l,new d(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(He,"paint");var Ge=6378137,We=85.0511287798,Ke=Ge*Math.PI,Je=ot((t=>{let e=Math.PI/180,i=Math.sin(Math.max(Math.min(We,t.y),-We)*e);return new d(Ge*t.x*e,Ge*Math.log((1+i)/(1-i))/2)}),"project"),Qe=ot((t=>{let e=180/Math.PI;return{lat:(2*Math.atan(Math.exp(t.y/Ge))-Math.PI/2)*e,lng:t.x*e/Ge}}),"unproject"),ti=ot(((t,e)=>i=>{let s=Je(i);return new d((s.x+Ke)/(2*Ke),1-(s.y+Ke)/(2*Ke)).mult(256*at(2,e)).sub(t)}),"instancedProject"),ei=ot(((t,e)=>i=>{let s=new d(i.x,i.y).add(t).div(256*at(2,e)),r=new d(s.x*(2*Ke)-Ke,2*Ke*(1-s.y)-Ke);return Qe(r)}),"instancedUnproject"),ii=ot(((t,e)=>Math.log2(e*(360/t)/256)),"getZoom"),si=class{constructor(t){if(t.theme){let e=De[t.theme];this.paintRules=Ae(e),this.labelRules=$e(e),this.backgroundColor=e.background}else this.paintRules=t.paintRules||[],this.labelRules=t.labelRules||[],this.backgroundColor=t.backgroundColor;this.views=Be(t),this.debug=t.debug||""}drawContext(t,e,i,s,r){return ht(this,null,(function*(){let n=Je(s),a=new d((n.x+Ke)/(2*Ke),1-(n.y+Ke)/(2*Ke)).clone().mult(256*at(2,r)).sub(new d(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(),u=new qe(r,t,this.labelRules,16,void 0);if(u.add(f),this.backgroundColor&&(t.save(),t.fillStyle=this.backgroundColor,t.fillRect(0,0,e,i),t.restore()),He(t,r,f,u.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:ti(a,r),unproject:ei(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 d((e.x+i.x)/2,(e.y+i.y)/2);return this.drawContext(t,s,r,a,ii(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 d((e.x+i.x)/2,(e.y+i.y)/2);return this.drawCanvas(t,a,ii(n,s),r)}))}};ot(si,"Static");var ri=si,ni=ot((t=>new Promise((e=>{setTimeout((()=>{e()}),t)}))),"timer"),ai=ot((t=>t.then((t=>({status:"fulfilled",value:t})),(t=>({status:"rejected",reason:t})))),"reflect"),oi=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=De[t.theme];this.paintRules=Ae(e),this.labelRules=$e(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=Be(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 Ze(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(ai)),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(),u=t.distanceTo(c)*this.tileDelay;if(yield ni(u),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 d(256*t.x,256*t.y);e.width=this.tileSize,e.height=this.tileSize;let _=e.getContext("2d");if(!_)return void console.error("Failed to get Canvas context");_.setTransform(this.tileSize/256,0,0,this.tileSize/256,0,0),_.clearRect(0,0,256,256),this.backgroundColor&&(_.save(),_.fillStyle=this.backgroundColor,_.fillRect(0,0,256,256),_.restore());let w=0;if(w=He(_,t.z,a,this.xray?null:h,this.paintRules,m,b,!1,this.debug),this.debug){_.save(),_.fillStyle=this.debug,_.font="600 12px sans-serif",_.fillText(`${t.z} ${t.x} ${t.y}`,4,14),_.font="12px sans-serif";let e=28;for(let[t,i]of a){let s=i[0].dataTile;_.fillText(`${t+(t?" ":"")+s.z} ${s.x} ${s.y}`,4,e),e+=14}_.font="600 10px sans-serif",w>8&&(_.fillText(w.toFixed()+" ms paint",4,e),e+=14),o>8&&_.fillText(o.toFixed()+" ms layout",4,e),_.strokeStyle=this.debug,_.lineWidth=.5,_.beginPath(),_.moveTo(0,0),_.lineTo(0,256),_.stroke(),_.lineWidth=.5,_.beginPath(),_.moveTo(0,0),_.lineTo(256,0),_.stroke(),_.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 Ze(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"),hi=ot(((t,e,i)=>{let s=new FontFace(t,`url(${e})`,{weight:i});return document.fonts.add(s),s.load()}),"Font"),li=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"),fi=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 li("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 li(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(fi,"Sheet");var ci=Object.freeze({__proto__:null,CenteredSymbolizer:we,CenteredTextSymbolizer:ke,CircleSymbolizer:he,FlexSymbolizer:ue,Font:hi,GeomType:kt,GroupSymbolizer:be,IconSymbolizer:ae,Index:Ue,Justify:qt,Labeler:qe,Labelers:Ze,LineLabelPlacement:Te,LineLabelSymbolizer:Se,LineSymbolizer:re,OffsetSymbolizer:ze,OffsetTextSymbolizer:Le,Padding:ye,PmtilesSource:Tt,PolygonSymbolizer:Gt,Sheet:fi,ShieldSymbolizer:fe,Static:ri,TextPlacements:Yt,TextSymbolizer:ve,TileCache:Xt,View:Ne,ZxySource:St,arr:Wt,covering:Ve,createPattern:Zt,exp:te,getZoom:ii,isCcw:Nt,isInRing:Rt,labelRules:$e,leafletLayer:oi,linear:ie,paint:He,paintRules:Ae,pointInPolygon:Bt,pointMinDistToLines:Ot,pointMinDistToPoints:Vt,sourcesToViews:Be,step:ee,toIndex:Mt,transformGeom:Fe,wrap:Ie});window.L={GridLayer:t.GridLayer,DomUtil:t.DomUtil},window.protomapsL=ci;var ui=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=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=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=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=oi(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 di=n(class extends a{constructor(t){super(),!1!==t&&this.__registerHost(),this.__attachShadow()}get el(){return 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 ui(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=function(t,e){return new c(t,e)}(this._templateVars,{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}).addTo(this.parentExtent._extentLayer),this.el._templatedLayer=this._templatedLayer):"image"===this.rel?(this._templatedLayer=function(t,e){return new f(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 u(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()}))}}_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=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}]}}},[513,"map-link",{type:[513],rel:[513],href:[513],hreflang:[513],tref:[513],media:[513],tms:[516],projection:[513],disabled:[1540],whenReady:[64]},void 0,{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}]}]);function mi(){"undefined"!=typeof customElements&&["map-link"].forEach((t=>{"map-link"===t&&(customElements.get(r(t))||customElements.define(r(t),di))}))}mi();const bi=di,_i=mi;export{bi as MapLink,_i as defineCustomElement}