@nulib/clover 0.0.0-stage → 4.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +120 -2
  3. package/dist/components/Annotations/Annotations.mjs +674 -0
  4. package/dist/components/Annotations/EntryBodies.mjs +52 -0
  5. package/dist/components/Annotations/languages.mjs +43 -0
  6. package/dist/components/Body/Body.mjs +51 -0
  7. package/dist/components/Body/BodyAlert.mjs +25 -0
  8. package/dist/components/Body/Caption.mjs +90 -0
  9. package/dist/components/Body/CaptionDetails.mjs +50 -0
  10. package/dist/components/Body/Pending.mjs +9 -0
  11. package/dist/components/Body/glyphs.mjs +66 -0
  12. package/dist/components/Body/renderers.mjs +30 -0
  13. package/dist/components/Body/useControlsVisibility.mjs +204 -0
  14. package/dist/components/Body/useNearViewport.mjs +27 -0
  15. package/dist/components/Canvas/AnnotationMenu.mjs +128 -0
  16. package/dist/components/Canvas/AnnotationState.mjs +338 -0
  17. package/dist/components/Canvas/Annotations.mjs +497 -0
  18. package/dist/components/Canvas/CanvasView.mjs +669 -0
  19. package/dist/components/Canvas/ChoiceMenu.mjs +77 -0
  20. package/dist/components/Canvas/Connected.mjs +228 -0
  21. package/dist/components/Canvas/ControlMenu.mjs +67 -0
  22. package/dist/components/Canvas/Controls.mjs +233 -0
  23. package/dist/components/Canvas/FrameAnimation.mjs +344 -0
  24. package/dist/components/Canvas/LoadedCanvas.mjs +177 -0
  25. package/dist/components/Canvas/Placeholder.mjs +105 -0
  26. package/dist/components/Canvas/fromManifest.mjs +44 -0
  27. package/dist/components/Canvas/index.mjs +19 -0
  28. package/dist/components/Canvas/layout.mjs +369 -0
  29. package/dist/components/Canvas/media/MediaBody.mjs +285 -0
  30. package/dist/components/Canvas/media/Player.mjs +193 -0
  31. package/dist/components/Canvas/media/Transport.mjs +511 -0
  32. package/dist/components/Canvas/media/TransportButton.mjs +39 -0
  33. package/dist/components/Canvas/media/useBarHeight.mjs +28 -0
  34. package/dist/components/Canvas/media/useCaptionTracks.mjs +131 -0
  35. package/dist/components/Canvas/media/useMediaController.mjs +77 -0
  36. package/dist/components/Canvas/media/useMediaElement.mjs +100 -0
  37. package/dist/components/Canvas/panClearOfControls.mjs +92 -0
  38. package/dist/components/Canvas/rendererSurface.mjs +6 -0
  39. package/dist/components/Canvas/surface.mjs +5 -0
  40. package/dist/components/Canvas/track.mjs +43 -0
  41. package/dist/components/Canvas/useSvgReader.mjs +23 -0
  42. package/dist/components/Collection/Collection.mjs +76 -0
  43. package/dist/components/CollectionSelect/CollectionSelect.mjs +114 -0
  44. package/dist/components/Contents/Contents.mjs +120 -0
  45. package/dist/components/Download/Download.mjs +105 -0
  46. package/dist/components/Items/Item.mjs +184 -0
  47. package/dist/components/Items/Items.mjs +455 -0
  48. package/dist/components/Items/Pager.mjs +190 -0
  49. package/dist/components/Items/StandaloneItems.mjs +80 -0
  50. package/dist/components/Items/clamped.mjs +90 -0
  51. package/dist/components/Label/Label.mjs +39 -0
  52. package/dist/components/Map/LoadedMap.mjs +26 -0
  53. package/dist/components/Map/Map.mjs +38 -0
  54. package/dist/components/Map/MapView.mjs +538 -0
  55. package/dist/components/Map/basemap.mjs +50 -0
  56. package/dist/components/Map/overlayImage.mjs +17 -0
  57. package/dist/components/Panel/About.mjs +143 -0
  58. package/dist/components/Panel/Panel.mjs +259 -0
  59. package/dist/components/Panel/PanelToggle.mjs +43 -0
  60. package/dist/components/Panel/PartOfManifest.mjs +52 -0
  61. package/dist/components/Primitives/Primitives.mjs +263 -0
  62. package/dist/components/Primitives/resource.mjs +11 -0
  63. package/dist/components/Provider/Provider.mjs +174 -0
  64. package/dist/components/Root/Announcer.mjs +58 -0
  65. package/dist/components/Root/Root.mjs +29 -0
  66. package/dist/components/Root/useRootState.mjs +188 -0
  67. package/dist/components/Scene/Connected.mjs +48 -0
  68. package/dist/components/Scene/Loaded.mjs +56 -0
  69. package/dist/components/Scene/RotatePad.mjs +204 -0
  70. package/dist/components/Scene/Scene.mjs +20 -0
  71. package/dist/components/Scene/SceneView.mjs +539 -0
  72. package/dist/components/Scene/cloverEngine.mjs +105 -0
  73. package/dist/components/Scene/engine.mjs +141 -0
  74. package/dist/components/Scene/engines.mjs +23 -0
  75. package/dist/components/Scene/gestures.mjs +74 -0
  76. package/dist/components/Scene/models.mjs +78 -0
  77. package/dist/components/Scene/orbit.mjs +60 -0
  78. package/dist/components/Search/Search.mjs +246 -0
  79. package/dist/components/Split/Split.mjs +203 -0
  80. package/dist/components/Split/splitting.mjs +203 -0
  81. package/dist/components/Status/Status.mjs +47 -0
  82. package/dist/components/Timeline/Connected.mjs +25 -0
  83. package/dist/components/Timeline/Timeline.mjs +40 -0
  84. package/dist/components/Timeline/playerSurface.mjs +84 -0
  85. package/dist/components/Transcript/Transcript.mjs +377 -0
  86. package/dist/components/Viewer/Viewer.mjs +19 -0
  87. package/dist/core/annotation-bodies.mjs +29 -0
  88. package/dist/core/annotation-collection.mjs +55 -0
  89. package/dist/core/annotation-name.mjs +31 -0
  90. package/dist/core/annotation-sets.mjs +155 -0
  91. package/dist/core/annotations-content.mjs +27 -0
  92. package/dist/core/annotations.mjs +73 -0
  93. package/dist/core/clover.mjs +393 -0
  94. package/dist/core/content-state-reader.mjs +82 -0
  95. package/dist/core/content-state.mjs +43 -0
  96. package/dist/core/direction.mjs +12 -0
  97. package/dist/core/geo-detect.mjs +30 -0
  98. package/dist/core/geo.mjs +283 -0
  99. package/dist/core/items.mjs +74 -0
  100. package/dist/core/keep-fragments.mjs +40 -0
  101. package/dist/core/link.mjs +28 -0
  102. package/dist/core/load.mjs +176 -0
  103. package/dist/core/map-config.mjs +12 -0
  104. package/dist/core/markdown.mjs +139 -0
  105. package/dist/core/pages.mjs +51 -0
  106. package/dist/core/painted-bodies.mjs +20 -0
  107. package/dist/core/painting.mjs +17 -0
  108. package/dist/core/presentation.mjs +27 -0
  109. package/dist/core/ranges.mjs +133 -0
  110. package/dist/core/region.mjs +32 -0
  111. package/dist/core/request.mjs +40 -0
  112. package/dist/core/sanitize.mjs +72 -0
  113. package/dist/core/search-service.mjs +22 -0
  114. package/dist/core/search.mjs +154 -0
  115. package/dist/core/selectors.mjs +94 -0
  116. package/dist/core/sequence.mjs +70 -0
  117. package/dist/core/show-link.mjs +16 -0
  118. package/dist/core/store.mjs +40 -0
  119. package/dist/core/svg-shape.mjs +183 -0
  120. package/dist/core/text.mjs +36 -0
  121. package/dist/core/thumbnail.mjs +55 -0
  122. package/dist/core/value.mjs +39 -0
  123. package/dist/core/vtt.mjs +111 -0
  124. package/dist/hooks/useFullscreen.mjs +21 -0
  125. package/dist/hooks/useFullscreenSupported.mjs +11 -0
  126. package/dist/hooks/useLoaded.mjs +27 -0
  127. package/dist/hooks/useWithinFullscreen.mjs +24 -0
  128. package/dist/i18n/config.mjs +170 -0
  129. package/dist/i18n/hostLanguage.mjs +6 -0
  130. package/dist/i18n/locales/en.json.mjs +5 -0
  131. package/dist/i18n/locales/es.json.mjs +5 -0
  132. package/dist/i18n/locales/fi.json.mjs +5 -0
  133. package/dist/i18n/locales/fr.json.mjs +5 -0
  134. package/dist/i18n/locales/index.mjs +13 -0
  135. package/dist/i18n/locales/nb.json.mjs +5 -0
  136. package/dist/i18n/locales/nn.json.mjs +5 -0
  137. package/dist/i18n/locales/no.json.mjs +5 -0
  138. package/dist/i18n/locales/pt.json.mjs +5 -0
  139. package/dist/i18n/reader.mjs +13 -0
  140. package/dist/i18n/useCloverTranslation.mjs +28 -0
  141. package/dist/index.d.mts +2204 -0
  142. package/dist/index.mjs +133 -0
  143. package/dist/lib/asArray.mjs +5 -0
  144. package/dist/lib/classnames.mjs +5 -0
  145. package/dist/lib/fullscreen.mjs +65 -0
  146. package/dist/lib/gltf/bounds.mjs +44 -0
  147. package/dist/lib/gltf/load.mjs +156 -0
  148. package/dist/lib/gltf/mat4.mjs +150 -0
  149. package/dist/lib/gltf/renderer.mjs +342 -0
  150. package/dist/lib/gltf/shaders.mjs +192 -0
  151. package/dist/lib/hls.mjs +6 -0
  152. package/dist/lib/pointer.mjs +38 -0
  153. package/dist/lib/renderer/CanvasRenderer.mjs +857 -0
  154. package/dist/lib/renderer/backends/backend.mjs +21 -0
  155. package/dist/lib/renderer/backends/canvas2d/Canvas2DBackend.mjs +91 -0
  156. package/dist/lib/renderer/backends/contexts.mjs +27 -0
  157. package/dist/lib/renderer/backends/dom/DomLayers.mjs +91 -0
  158. package/dist/lib/renderer/backends/webgl2/WebGL2Backend.mjs +248 -0
  159. package/dist/lib/renderer/backends/webgl2/shaders.mjs +28 -0
  160. package/dist/lib/renderer/camera/Camera.mjs +64 -0
  161. package/dist/lib/renderer/camera/CameraAnimator.mjs +90 -0
  162. package/dist/lib/renderer/input/GestureController.mjs +252 -0
  163. package/dist/lib/renderer/io/TileCache.mjs +207 -0
  164. package/dist/lib/renderer/io/decode.mjs +156 -0
  165. package/dist/lib/renderer/loop/FrameLoop.mjs +50 -0
  166. package/dist/lib/renderer/math/affine.mjs +68 -0
  167. package/dist/lib/renderer/math/rect.mjs +45 -0
  168. package/dist/lib/renderer/overlays/Navigator.mjs +141 -0
  169. package/dist/lib/renderer/overlays/OverlayLayer.mjs +94 -0
  170. package/dist/lib/renderer/scene/planFrame.mjs +168 -0
  171. package/dist/lib/renderer/scene/regions.mjs +30 -0
  172. package/dist/lib/renderer/scene/sceneItem.mjs +114 -0
  173. package/dist/lib/renderer/scene/uploadBudget.mjs +30 -0
  174. package/dist/lib/renderer/sources/imageService.mjs +160 -0
  175. package/dist/lib/renderer/sources/sizedImage.mjs +38 -0
  176. package/dist/lib/renderer/sources/tilePyramid.mjs +172 -0
  177. package/dist/lib/time.mjs +21 -0
  178. package/dist/map/index.d.mts +184 -0
  179. package/dist/map/index.mjs +16 -0
  180. package/dist/react/context.mjs +46 -0
  181. package/dist/react/hooks.mjs +69 -0
  182. package/dist/react/language.mjs +30 -0
  183. package/dist/styles.css +1 -0
  184. package/dist/templates/default/Default.mjs +229 -0
  185. package/dist/templates/document/Document.mjs +286 -0
  186. package/dist/templates/document/DocumentPanel.mjs +9 -0
  187. package/dist/templates/document/Sheets.mjs +360 -0
  188. package/dist/templates/gallery/Gallery.mjs +62 -0
  189. package/dist/templates/index.d.mts +273 -0
  190. package/dist/templates/index.mjs +11 -0
  191. package/dist/templates/shared/Lightbox.mjs +111 -0
  192. package/dist/templates/shared/LightboxBody.mjs +9 -0
  193. package/dist/templates/shared/dragToClose.mjs +129 -0
  194. package/dist/templates/shared/useDragToClose.mjs +35 -0
  195. package/dist/templates/shared/useDrawer.mjs +113 -0
  196. package/dist/templates/shared/useFollowFocus.mjs +24 -0
  197. package/dist/templates/shared/useSlide.mjs +52 -0
  198. package/dist/templates/shared/useSpine.mjs +26 -0
  199. package/dist/templates.css +1 -0
  200. package/dist/three/index.d.mts +6 -0
  201. package/dist/three/index.mjs +8 -0
  202. package/dist/ui/Button.mjs +53 -0
  203. package/dist/ui/ControlCluster.mjs +87 -0
  204. package/dist/ui/Cue.mjs +13 -0
  205. package/dist/ui/ErrorBoundary.mjs +26 -0
  206. package/dist/ui/ExitFullscreen.mjs +46 -0
  207. package/dist/ui/FieldPill.mjs +153 -0
  208. package/dist/ui/HideToggle.mjs +57 -0
  209. package/dist/ui/Loading.mjs +20 -0
  210. package/dist/ui/Markup.mjs +95 -0
  211. package/dist/ui/ReadMore.mjs +84 -0
  212. package/dist/ui/Sections.mjs +448 -0
  213. package/dist/ui/Steps.mjs +84 -0
  214. package/dist/ui/Tip.mjs +196 -0
  215. package/dist/ui/bringIntoView.mjs +27 -0
  216. package/dist/ui/controlGlyphs.mjs +120 -0
  217. package/dist/ui/heading.mjs +19 -0
  218. package/dist/ui/languageCode.mjs +8 -0
  219. package/dist/ui/mediaIcons.mjs +104 -0
  220. package/dist/ui/useClusterReach.mjs +50 -0
  221. package/dist/ui/useContainerName.mjs +19 -0
  222. package/dist/ui/useOneOpen.mjs +22 -0
  223. package/dist/ui/useRovingFocus.mjs +64 -0
  224. package/dist/ui/useScrollTrack.mjs +150 -0
  225. package/dist/ui/useUniqueId.mjs +10 -0
  226. package/dist/ui/visuallyHidden.mjs +15 -0
  227. package/dist/web-components/About-uKa1wfDr.mjs +1 -0
  228. package/dist/web-components/AnnotationMenu-BGIYRXW6.mjs +1 -0
  229. package/dist/web-components/AnnotationState-D2UIgIEC.mjs +1 -0
  230. package/dist/web-components/Annotations-BhwAv3ah.mjs +1 -0
  231. package/dist/web-components/Annotations-C_tBJHo3.mjs +2 -0
  232. package/dist/web-components/Body-DMEERFuB.mjs +1 -0
  233. package/dist/web-components/BodyAlert-BP8voSLv.mjs +1 -0
  234. package/dist/web-components/Button-Cl02BFDd.mjs +1 -0
  235. package/dist/web-components/Camera-Dw51CAfF.mjs +1 -0
  236. package/dist/web-components/Canvas2DBackend-RRN2bEkc.mjs +1 -0
  237. package/dist/web-components/CanvasView-B8lMMSou.mjs +1 -0
  238. package/dist/web-components/CaptionDetails-KLMDv-ec.mjs +1 -0
  239. package/dist/web-components/ChoiceMenu-CXrVOmJl.mjs +1 -0
  240. package/dist/web-components/Collection-DL4Ui4hF.mjs +1 -0
  241. package/dist/web-components/CollectionSelect-DL-bbpwJ.mjs +1 -0
  242. package/dist/web-components/Connected-B0S1HXQb.mjs +1 -0
  243. package/dist/web-components/Connected-BcjRA5si.mjs +1 -0
  244. package/dist/web-components/Connected-Q7iizBb8.mjs +1 -0
  245. package/dist/web-components/Contents-ZC8TiGaW.mjs +1 -0
  246. package/dist/web-components/ControlMenu-DIoU797-.mjs +1 -0
  247. package/dist/web-components/Cue-CJxnDMEy.mjs +1 -0
  248. package/dist/web-components/Document-DHBRAFEK.mjs +1 -0
  249. package/dist/web-components/DocumentPanel-CqvE2pu9.mjs +1 -0
  250. package/dist/web-components/DomLayers-BsR2AOy-.mjs +1 -0
  251. package/dist/web-components/Download-DBksL1C0.mjs +1 -0
  252. package/dist/web-components/EntryBodies-VwEkTVrw.mjs +1 -0
  253. package/dist/web-components/ErrorBoundary-Cy9PGoZv.mjs +1 -0
  254. package/dist/web-components/FieldPill-DCJBz6Vj.mjs +1 -0
  255. package/dist/web-components/FrameAnimation-DRbmgGpF.mjs +1 -0
  256. package/dist/web-components/Gallery-BM7-VJkB.mjs +1 -0
  257. package/dist/web-components/HideToggle-BdYgG7us.mjs +1 -0
  258. package/dist/web-components/Items-_1Jz3FMs.mjs +1 -0
  259. package/dist/web-components/Label-CAiJ49eA.mjs +1 -0
  260. package/dist/web-components/LightboxBody-DyhUZiDf.mjs +1 -0
  261. package/dist/web-components/Loaded-wQurAeJz.mjs +1 -0
  262. package/dist/web-components/LoadedCanvas-DWz5IK5m.mjs +1 -0
  263. package/dist/web-components/LoadedMap-DIeW313M.mjs +1 -0
  264. package/dist/web-components/Loading-BmA--pzr.mjs +1 -0
  265. package/dist/web-components/Map-DzVGblIS.mjs +1 -0
  266. package/dist/web-components/MapView-BJaN7VBI.mjs +1 -0
  267. package/dist/web-components/Markup-D91DbxLk.mjs +2 -0
  268. package/dist/web-components/MediaBody-BYcVPo2X.mjs +1 -0
  269. package/dist/web-components/MediaBody-FEzH8VVw.mjs +1 -0
  270. package/dist/web-components/Navigator-CIJFA3q1.mjs +1 -0
  271. package/dist/web-components/Pager-BGwCurxE.mjs +1 -0
  272. package/dist/web-components/Panel-B-GXOkzF.mjs +1 -0
  273. package/dist/web-components/PanelToggle-BYjV2t1j.mjs +1 -0
  274. package/dist/web-components/PartOfManifest-ClbGepVM.mjs +1 -0
  275. package/dist/web-components/Pending-BspZajh5.mjs +1 -0
  276. package/dist/web-components/Primitives-CTh59wvs.mjs +1 -0
  277. package/dist/web-components/Provider-C6rIiDXH.mjs +1 -0
  278. package/dist/web-components/ReadMore-BJ2i-0uN.mjs +1 -0
  279. package/dist/web-components/Root-DkkYDtur.mjs +1 -0
  280. package/dist/web-components/Scene-B_PU_TiX.mjs +1 -0
  281. package/dist/web-components/SceneView-qcW_sT3j.mjs +1 -0
  282. package/dist/web-components/Search-UOneIUcP.mjs +1 -0
  283. package/dist/web-components/Sections-we9U9fXq.mjs +2 -0
  284. package/dist/web-components/StandaloneItems-DU8oCFc_.mjs +1 -0
  285. package/dist/web-components/Status-Cs5ZvFvL.mjs +1 -0
  286. package/dist/web-components/Timeline-WtYZ1bIJ.mjs +1 -0
  287. package/dist/web-components/Tip-C8J3qsIK.mjs +1 -0
  288. package/dist/web-components/Transcript-CRL2zToL.mjs +1 -0
  289. package/dist/web-components/annotation-collection-ZPyvpLFc.mjs +1 -0
  290. package/dist/web-components/annotations-content-BZChKhJZ.mjs +1 -0
  291. package/dist/web-components/assets/maplibre-gl-worker-kTz9OPxr.js +13831 -0
  292. package/dist/web-components/body-UntgrmoV.mjs +1 -0
  293. package/dist/web-components/bringIntoView-CQH5ZgMM.mjs +1 -0
  294. package/dist/web-components/canvas-d_U4v_mh.mjs +1 -0
  295. package/dist/web-components/classnames-DukgfdpI.mjs +1 -0
  296. package/dist/web-components/cloverEngine-Dbv-26NP.mjs +164 -0
  297. package/dist/web-components/content-state-reader-DjdKWjit.mjs +1 -0
  298. package/dist/web-components/contexts-ByL3eA_T.mjs +1 -0
  299. package/dist/web-components/controls-qRYf2jO2.mjs +1 -0
  300. package/dist/web-components/custom-elements.json +2739 -0
  301. package/dist/web-components/dragToClose-C-Pf1IeO.mjs +1 -0
  302. package/dist/web-components/engine-D8JLgzqq.mjs +4228 -0
  303. package/dist/web-components/engines-BwVb9R_A.mjs +1 -0
  304. package/dist/web-components/es-BwMkoRod.mjs +1 -0
  305. package/dist/web-components/fi-gPFOn9RK.mjs +1 -0
  306. package/dist/web-components/fr-DUHmgdJo.mjs +1 -0
  307. package/dist/web-components/fromManifest-UrMJgktp.mjs +1 -0
  308. package/dist/web-components/glyphs-BoX0a88P.mjs +1 -0
  309. package/dist/web-components/heading-Cjt0f-Eu.mjs +1 -0
  310. package/dist/web-components/hls-CdKrthkC.mjs +40 -0
  311. package/dist/web-components/hooks-Dp8pjU8l.mjs +1 -0
  312. package/dist/web-components/imageService-C3yg9DxB.mjs +1 -0
  313. package/dist/web-components/index-DWxMuwDL.mjs +1 -0
  314. package/dist/web-components/index.d.mts +604 -0
  315. package/dist/web-components/index.mjs +1 -0
  316. package/dist/web-components/index.umd.js +18 -0
  317. package/dist/web-components/items--Tu7ZM3L.mjs +1 -0
  318. package/dist/web-components/items-W2vrwArM.mjs +1 -0
  319. package/dist/web-components/keep-fragments-B5nlv2ck.mjs +1 -0
  320. package/dist/web-components/label-CYQ7tVl6.mjs +1 -0
  321. package/dist/web-components/languageCode-cCpiU0b0.mjs +1 -0
  322. package/dist/web-components/layout-KL0V-iJu.mjs +1 -0
  323. package/dist/web-components/link-DRRTY4lY.mjs +1 -0
  324. package/dist/web-components/logo-CnQUCB3Y.mjs +1 -0
  325. package/dist/web-components/maplibre-gl-CQ4OueXY.mjs +823 -0
  326. package/dist/web-components/markdown-CCYJwzFn.mjs +5 -0
  327. package/dist/web-components/models-BP2qp9nT.mjs +1 -0
  328. package/dist/web-components/nb-BSvnQ6jd.mjs +1 -0
  329. package/dist/web-components/nn-Dg2_HdZu.mjs +1 -0
  330. package/dist/web-components/no-BSvnQ6jd.mjs +1 -0
  331. package/dist/web-components/nodes-Bf-Fb7e5.mjs +1 -0
  332. package/dist/web-components/overlayImage-DdPs2EGY.mjs +1 -0
  333. package/dist/web-components/panClearOfControls-ac9uf-Qs.mjs +1 -0
  334. package/dist/web-components/panel-CiqEFDzv.mjs +1 -0
  335. package/dist/web-components/part-CUBY90_b.mjs +1 -0
  336. package/dist/web-components/playerSurface-i2TJz-F4.mjs +1 -0
  337. package/dist/web-components/provider-LUmAQSoP.mjs +1 -0
  338. package/dist/web-components/pt-B3J80JgO.mjs +1 -0
  339. package/dist/web-components/read-more-BaaO77el.mjs +1 -0
  340. package/dist/web-components/rendererSurface-DAvatpMF.mjs +22 -0
  341. package/dist/web-components/renderers-Bg4QqawN.mjs +1 -0
  342. package/dist/web-components/resource-DzIvB_4m.mjs +1 -0
  343. package/dist/web-components/sanitize-Dc7nOsgO.mjs +3 -0
  344. package/dist/web-components/search-DgcgsI3I.mjs +1 -0
  345. package/dist/web-components/shared-J3w3gnXD.mjs +1 -0
  346. package/dist/web-components/show-link-DWRRXSBy.mjs +1 -0
  347. package/dist/web-components/sizedImage-DfjlV2-i.mjs +1 -0
  348. package/dist/web-components/split-m-_XivaW.mjs +1 -0
  349. package/dist/web-components/splitting-BnQUxxgH.mjs +1 -0
  350. package/dist/web-components/status-DDS7jLNd.mjs +1 -0
  351. package/dist/web-components/styles-Ypl9KrSK.mjs +1 -0
  352. package/dist/web-components/svg-shape-DLY3g7oq.mjs +1 -0
  353. package/dist/web-components/text-BTAkxEfQ.mjs +5 -0
  354. package/dist/web-components/three.mjs +1 -0
  355. package/dist/web-components/thumbnail-BZvLSwWW.mjs +1 -0
  356. package/dist/web-components/time-B9GZoYcm.mjs +1 -0
  357. package/dist/web-components/tip-BXByhOJ9.mjs +1 -0
  358. package/dist/web-components/toggle-AS72kq6v.mjs +1 -0
  359. package/dist/web-components/upgrader-XNxI-5jo.mjs +1 -0
  360. package/dist/web-components/useContainerName-DCbE5JXi.mjs +1 -0
  361. package/dist/web-components/useNearViewport-CyoK3l8W.mjs +1 -0
  362. package/dist/web-components/useScrollTrack-dLFWnT8N.mjs +1 -0
  363. package/dist/web-components/viewer/AnnotationMenu-Dd4tnzNV.mjs +1 -0
  364. package/dist/web-components/viewer/AnnotationState-DZaSy5lH.mjs +1 -0
  365. package/dist/web-components/viewer/Annotations-D1h-Yi5J.mjs +1 -0
  366. package/dist/web-components/viewer/Annotations-sj79EMen.mjs +2 -0
  367. package/dist/web-components/viewer/Canvas2DBackend-CkvI0wUT.mjs +1 -0
  368. package/dist/web-components/viewer/CaptionDetails-B_JdNjJ7.mjs +1 -0
  369. package/dist/web-components/viewer/ChoiceMenu-xa51a1DV.mjs +1 -0
  370. package/dist/web-components/viewer/Collection-CxuLCspj.mjs +1 -0
  371. package/dist/web-components/viewer/Connected-BSUBc3Ci.mjs +1 -0
  372. package/dist/web-components/viewer/Connected-CPIxNjF2.mjs +1 -0
  373. package/dist/web-components/viewer/Contents-DNh9mnsF.mjs +1 -0
  374. package/dist/web-components/viewer/ControlMenu-DdgIvBdf.mjs +1 -0
  375. package/dist/web-components/viewer/Cue-90H9_dXz.mjs +1 -0
  376. package/dist/web-components/viewer/Document-CNCpzkiN.mjs +1 -0
  377. package/dist/web-components/viewer/DocumentPanel-BdG4TVLE.mjs +1 -0
  378. package/dist/web-components/viewer/DomLayers-Dybz_aJv.mjs +1 -0
  379. package/dist/web-components/viewer/EntryBodies-DGXjFP3N.mjs +1 -0
  380. package/dist/web-components/viewer/FieldPill-Icmd98OY.mjs +1 -0
  381. package/dist/web-components/viewer/FrameAnimation-DJZN3Rd4.mjs +1 -0
  382. package/dist/web-components/viewer/Gallery-CEp3-bh2.mjs +1 -0
  383. package/dist/web-components/viewer/HideToggle-DB6HTmAO.mjs +1 -0
  384. package/dist/web-components/viewer/LightboxBody-ClQ4yrTh.mjs +1 -0
  385. package/dist/web-components/viewer/MapView-BVSdybIC.mjs +1 -0
  386. package/dist/web-components/viewer/MediaBody-BBbSMT1i.mjs +1 -0
  387. package/dist/web-components/viewer/MediaBody-BzMXMHIF.mjs +1 -0
  388. package/dist/web-components/viewer/Navigator-Duc69Yes.mjs +1 -0
  389. package/dist/web-components/viewer/PartOfManifest-X9_q-2t6.mjs +1 -0
  390. package/dist/web-components/viewer/Search-S4N5QU4R.mjs +1 -0
  391. package/dist/web-components/viewer/StandaloneItems-BO4VyWRW.mjs +1 -0
  392. package/dist/web-components/viewer/Transcript-BbDaS064.mjs +1 -0
  393. package/dist/web-components/viewer/annotation-collection-BjZ1DAHq.mjs +1 -0
  394. package/dist/web-components/viewer/annotations-content-jn3n5Y2-.mjs +1 -0
  395. package/dist/web-components/viewer/cloverEngine-CjuYjUhI.mjs +164 -0
  396. package/dist/web-components/viewer/content-state-reader-CPiShIjP.mjs +1 -0
  397. package/dist/web-components/viewer/host-yWi4R1bP.mjs +1 -0
  398. package/dist/web-components/viewer/index.d.mts +7 -0
  399. package/dist/web-components/viewer/index.mjs +1 -0
  400. package/dist/web-components/viewer/index.umd.js +18 -0
  401. package/dist/web-components/viewer/link-CwE-fg5G.mjs +1 -0
  402. package/dist/web-components/viewer/overlayImage-BpOgqsZ0.mjs +1 -0
  403. package/dist/web-components/viewer/renderers-L-IlGI1r.mjs +1 -0
  404. package/dist/web-components/viewer/search-DWkwRPo_.mjs +1 -0
  405. package/dist/web-components/viewer/styles-BRCkEU3w.mjs +1 -0
  406. package/dist/web-components/viewer/viewer--TreVlJ_.mjs +28 -0
  407. package/dist/web-components/viewer/vtt-1ZJwtElI.mjs +5 -0
  408. package/dist/web-components/viewer-DyV864Qe.mjs +1 -0
  409. package/dist/web-components/vtt-GFssZH8Y.mjs +5 -0
  410. package/package.json +110 -4
@@ -0,0 +1,823 @@
1
+ /**
2
+ * MapLibre GL JS
3
+ * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.11.1/LICENSE.txt
4
+ */var Wv=Object.create,Xg=Object.defineProperty,Hv=Object.getOwnPropertyDescriptor,Xv=Object.getOwnPropertyNames,Yv=Object.getPrototypeOf,Kv=Object.prototype.hasOwnProperty,Wc=(e,t4)=>()=>(t4||(e((t4={exports:{}}).exports,t4),e=null),t4.exports),Jv=(e,t4,i,r)=>{if(t4&&typeof t4=="object"||typeof t4=="function")for(var a=Xv(t4),s=0,n=a.length,o;s<n;s++)o=a[s],!Kv.call(e,o)&&o!==i&&Xg(e,o,{get:(l=>t4[l]).bind(null,o),enumerable:!(r=Hv(t4,o))||r.enumerable});return e},Qv=(e,t4,i)=>(i=e==null?{}:Wv(Yv(e)),Jv(Xg(i,"default",{value:e,enumerable:true}),e));function C(e,t4){this.x=e,this.y=t4}C.prototype={clone(){return new C(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t4){return this.clone()._rotateAround(e,t4)},matMult(e){return this.clone()._matMult(e)},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(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t4=e.x-this.x,i=e.y-this.y;return t4*t4+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t4){return Math.atan2(this.x*t4-this.y*e,this.x*e+this.y*t4)},_matMult(e){let t4=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t4,this.y=i,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t4=Math.cos(e),i=Math.sin(e),r=t4*this.x-i*this.y,a=i*this.x+t4*this.y;return this.x=r,this.y=a,this},_rotateAround(e,t4){let i=Math.cos(e),r=Math.sin(e),a=t4.x+i*(this.x-t4.x)-r*(this.y-t4.y),s=t4.y+r*(this.x-t4.x)+i*(this.y-t4.y);return this.x=a,this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:C},C.convert=function(e){if(e instanceof C)return e;if(Array.isArray(e))return new C(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new C(+e.x,+e.y);throw Error("Expected [x, y] or {x, y} point format")};function ex(e,t4,i,r){let a=3*e,s=3*(i-e)-a,n=1-a-s,o=3*t4,l=3*(r-t4)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let d=h;for(let m=0;m<8;m++){let g=((n*d+s)*d+a)*d-h;if(Math.abs(g)<c)return((u*d+l)*d+o)*d;let _=(3*n*d+2*s)*d+a;if(Math.abs(_)<1e-6)break;d-=g/_}let p=0,f=1;d=h;for(let m=0;m<20;m++){let g=((n*d+s)*d+a)*d;if(Math.abs(g-h)<c)break;h>g?p=d:f=d,d=(p+f)*.5}return((u*d+l)*d+o)*d}}let Np;function Hc(){return Np??(Np=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Np}let Hn;function Yg(){if(Hn==null&&(Hn=false,Hc())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:true});if(e){for(let i=0;i<25;i++){let r=i*4;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(i%5,Math.floor(i/5),1,1)}let t4=e.getImageData(0,0,5,5).data;for(let i=0;i<100;i++)if(i%4!=3&&t4[i]!==i){Hn=true;break}}}return Hn||false}var yt=typeof Float32Array<"u"?Float32Array:Array;function Kg(){var e=new yt(9);return yt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function tx(e){var t4=e[0],i=e[1],r=e[2],a=e[3],s=e[4],n=e[5],o=e[6],l=e[7],u=e[8];return t4*(u*s-n*l)+i*(-u*a+n*o)+r*(l*a-s*o)}function ix(e,t4){var i=Math.sin(t4),r=Math.cos(t4);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function rx(e,t4){var i=t4[0],r=t4[1],a=t4[2],s=t4[3],n=i+i,o=r+r,l=a+a,u=i*n,h=r*n,c=r*o,d=a*n,p=a*o,f=a*l,m=s*n,g=s*o,_=s*l;return e[0]=1-c-f,e[3]=h-_,e[6]=d+g,e[1]=h+_,e[4]=1-u-f,e[7]=p-m,e[2]=d-g,e[5]=p+m,e[8]=1-u-c,e}function Ir(){var e=new yt(16);return yt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function yh(e){var t4=new yt(16);return t4[0]=e[0],t4[1]=e[1],t4[2]=e[2],t4[3]=e[3],t4[4]=e[4],t4[5]=e[5],t4[6]=e[6],t4[7]=e[7],t4[8]=e[8],t4[9]=e[9],t4[10]=e[10],t4[11]=e[11],t4[12]=e[12],t4[13]=e[13],t4[14]=e[14],t4[15]=e[15],t4}function ax(e,t4){return e[0]=t4[0],e[1]=t4[1],e[2]=t4[2],e[3]=t4[3],e[4]=t4[4],e[5]=t4[5],e[6]=t4[6],e[7]=t4[7],e[8]=t4[8],e[9]=t4[9],e[10]=t4[10],e[11]=t4[11],e[12]=t4[12],e[13]=t4[13],e[14]=t4[14],e[15]=t4[15],e}function Ii(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function No(e,t4){var i=t4[0],r=t4[1],a=t4[2],s=t4[3],n=t4[4],o=t4[5],l=t4[6],u=t4[7],h=t4[8],c=t4[9],d=t4[10],p=t4[11],f=t4[12],m=t4[13],g=t4[14],_=t4[15],y=i*o-r*n,x=i*l-a*n,v=i*u-s*n,w=r*l-a*o,b=r*u-s*o,T=a*u-s*l,P=h*m-c*f,E=h*g-d*f,I=h*_-p*f,R=c*g-d*m,z=c*_-p*m,S=d*_-p*g,A=y*S-x*z+v*R+w*I-b*E+T*P;return A?(A=1/A,e[0]=(o*S-l*z+u*R)*A,e[1]=(a*z-r*S-s*R)*A,e[2]=(m*T-g*b+_*w)*A,e[3]=(d*b-c*T-p*w)*A,e[4]=(l*I-n*S-u*E)*A,e[5]=(i*S-a*I+s*E)*A,e[6]=(g*v-f*T-_*x)*A,e[7]=(h*T-d*v+p*x)*A,e[8]=(n*z-o*I+u*P)*A,e[9]=(r*I-i*z-s*P)*A,e[10]=(f*b-m*v+_*y)*A,e[11]=(c*v-h*b-p*y)*A,e[12]=(o*E-n*R-l*P)*A,e[13]=(i*R-r*E+a*P)*A,e[14]=(m*x-f*w-g*y)*A,e[15]=(h*w-c*x+d*y)*A,e):null}function Da(e,t4,i){var r=t4[0],a=t4[1],s=t4[2],n=t4[3],o=t4[4],l=t4[5],u=t4[6],h=t4[7],c=t4[8],d=t4[9],p=t4[10],f=t4[11],m=t4[12],g=t4[13],_=t4[14],y=t4[15],x=i[0],v=i[1],w=i[2],b=i[3];return e[0]=x*r+v*o+w*c+b*m,e[1]=x*a+v*l+w*d+b*g,e[2]=x*s+v*u+w*p+b*_,e[3]=x*n+v*h+w*f+b*y,x=i[4],v=i[5],w=i[6],b=i[7],e[4]=x*r+v*o+w*c+b*m,e[5]=x*a+v*l+w*d+b*g,e[6]=x*s+v*u+w*p+b*_,e[7]=x*n+v*h+w*f+b*y,x=i[8],v=i[9],w=i[10],b=i[11],e[8]=x*r+v*o+w*c+b*m,e[9]=x*a+v*l+w*d+b*g,e[10]=x*s+v*u+w*p+b*_,e[11]=x*n+v*h+w*f+b*y,x=i[12],v=i[13],w=i[14],b=i[15],e[12]=x*r+v*o+w*c+b*m,e[13]=x*a+v*l+w*d+b*g,e[14]=x*s+v*u+w*p+b*_,e[15]=x*n+v*h+w*f+b*y,e}function ot(e,t4,i){var r=i[0],a=i[1],s=i[2],n,o,l,u,h,c,d,p,f,m,g,_;return t4===e?(e[12]=t4[0]*r+t4[4]*a+t4[8]*s+t4[12],e[13]=t4[1]*r+t4[5]*a+t4[9]*s+t4[13],e[14]=t4[2]*r+t4[6]*a+t4[10]*s+t4[14],e[15]=t4[3]*r+t4[7]*a+t4[11]*s+t4[15]):(n=t4[0],o=t4[1],l=t4[2],u=t4[3],h=t4[4],c=t4[5],d=t4[6],p=t4[7],f=t4[8],m=t4[9],g=t4[10],_=t4[11],e[0]=n,e[1]=o,e[2]=l,e[3]=u,e[4]=h,e[5]=c,e[6]=d,e[7]=p,e[8]=f,e[9]=m,e[10]=g,e[11]=_,e[12]=n*r+h*a+f*s+t4[12],e[13]=o*r+c*a+m*s+t4[13],e[14]=l*r+d*a+g*s+t4[14],e[15]=u*r+p*a+_*s+t4[15]),e}function Dt(e,t4,i){var r=i[0],a=i[1],s=i[2];return e[0]=t4[0]*r,e[1]=t4[1]*r,e[2]=t4[2]*r,e[3]=t4[3]*r,e[4]=t4[4]*a,e[5]=t4[5]*a,e[6]=t4[6]*a,e[7]=t4[7]*a,e[8]=t4[8]*s,e[9]=t4[9]*s,e[10]=t4[10]*s,e[11]=t4[11]*s,e[12]=t4[12],e[13]=t4[13],e[14]=t4[14],e[15]=t4[15],e}function Na(e,t4,i){var r=Math.sin(i),a=Math.cos(i),s=t4[4],n=t4[5],o=t4[6],l=t4[7],u=t4[8],h=t4[9],c=t4[10],d=t4[11];return t4!==e&&(e[0]=t4[0],e[1]=t4[1],e[2]=t4[2],e[3]=t4[3],e[12]=t4[12],e[13]=t4[13],e[14]=t4[14],e[15]=t4[15]),e[4]=s*a+u*r,e[5]=n*a+h*r,e[6]=o*a+c*r,e[7]=l*a+d*r,e[8]=u*a-s*r,e[9]=h*a-n*r,e[10]=c*a-o*r,e[11]=d*a-l*r,e}function Jg(e,t4,i){var r=Math.sin(i),a=Math.cos(i),s=t4[0],n=t4[1],o=t4[2],l=t4[3],u=t4[8],h=t4[9],c=t4[10],d=t4[11];return t4!==e&&(e[4]=t4[4],e[5]=t4[5],e[6]=t4[6],e[7]=t4[7],e[12]=t4[12],e[13]=t4[13],e[14]=t4[14],e[15]=t4[15]),e[0]=s*a-u*r,e[1]=n*a-h*r,e[2]=o*a-c*r,e[3]=l*a-d*r,e[8]=s*r+u*a,e[9]=n*r+h*a,e[10]=o*r+c*a,e[11]=l*r+d*a,e}function br(e,t4,i){var r=Math.sin(i),a=Math.cos(i),s=t4[0],n=t4[1],o=t4[2],l=t4[3],u=t4[4],h=t4[5],c=t4[6],d=t4[7];return t4!==e&&(e[8]=t4[8],e[9]=t4[9],e[10]=t4[10],e[11]=t4[11],e[12]=t4[12],e[13]=t4[13],e[14]=t4[14],e[15]=t4[15]),e[0]=s*a+u*r,e[1]=n*a+h*r,e[2]=o*a+c*r,e[3]=l*a+d*r,e[4]=u*a-s*r,e[5]=h*a-n*r,e[6]=c*a-o*r,e[7]=d*a-l*r,e}function sx(e,t4){return e[0]=t4[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t4[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t4[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function nx(e,t4,i,r,a){var s=1/Math.tan(t4/2);if(e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,a!=null&&a!==1/0){var n=1/(r-a);e[10]=(a+r)*n,e[14]=2*a*r*n}else e[10]=-1,e[14]=-2*r;return e}var vh=nx;function ox(e,t4,i,r,a,s,n){var o=1/(t4-i),l=1/(r-a),u=1/(s-n);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t4+i)*o,e[13]=(a+r)*l,e[14]=(n+s)*u,e[15]=1,e}var $i=ox;function lx(e,t4){return e[0]===t4[0]&&e[1]===t4[1]&&e[2]===t4[2]&&e[3]===t4[3]&&e[4]===t4[4]&&e[5]===t4[5]&&e[6]===t4[6]&&e[7]===t4[7]&&e[8]===t4[8]&&e[9]===t4[9]&&e[10]===t4[10]&&e[11]===t4[11]&&e[12]===t4[12]&&e[13]===t4[13]&&e[14]===t4[14]&&e[15]===t4[15]}function ux(e,t4){var i=e[0],r=e[1],a=e[2],s=e[3],n=e[4],o=e[5],l=e[6],u=e[7],h=e[8],c=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=t4[0],x=t4[1],v=t4[2],w=t4[3],b=t4[4],T=t4[5],P=t4[6],E=t4[7],I=t4[8],R=t4[9],z=t4[10],S=t4[11],A=t4[12],D=t4[13],M=t4[14],L=t4[15];return Math.abs(i-y)<=1e-6*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-x)<=1e-6*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(a-v)<=1e-6*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(s-w)<=1e-6*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(n-b)<=1e-6*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-T)<=1e-6*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(l-P)<=1e-6*Math.max(1,Math.abs(l),Math.abs(P))&&Math.abs(u-E)<=1e-6*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(h-I)<=1e-6*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(c-R)<=1e-6*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(d-z)<=1e-6*Math.max(1,Math.abs(d),Math.abs(z))&&Math.abs(p-S)<=1e-6*Math.max(1,Math.abs(p),Math.abs(S))&&Math.abs(f-A)<=1e-6*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(m-D)<=1e-6*Math.max(1,Math.abs(m),Math.abs(D))&&Math.abs(g-M)<=1e-6*Math.max(1,Math.abs(g),Math.abs(M))&&Math.abs(_-L)<=1e-6*Math.max(1,Math.abs(_),Math.abs(L))}function Qg(){var e=new yt(3);return yt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function xh(e){var t4=new yt(3);return t4[0]=e[0],t4[1]=e[1],t4[2]=e[2],t4}function Ci(e){var t4=e[0],i=e[1],r=e[2];return Math.sqrt(t4*t4+i*i+r*r)}function Gp(e,t4,i){var r=new yt(3);return r[0]=e,r[1]=t4,r[2]=i,r}function fi(e,t4,i){return e[0]=t4[0]+i[0],e[1]=t4[1]+i[1],e[2]=t4[2]+i[2],e}function Xc(e,t4,i){return e[0]=t4[0]-i[0],e[1]=t4[1]-i[1],e[2]=t4[2]-i[2],e}function Ne(e,t4,i){return e[0]=t4[0]*i,e[1]=t4[1]*i,e[2]=t4[2]*i,e}function Go(e,t4,i,r){return e[0]=t4[0]+i[0]*r,e[1]=t4[1]+i[1]*r,e[2]=t4[2]+i[2]*r,e}function hx(e,t4){var i=t4[0]-e[0],r=t4[1]-e[1],a=t4[2]-e[2];return Math.sqrt(i*i+r*r+a*a)}function cx(e,t4){return e[0]=-t4[0],e[1]=-t4[1],e[2]=-t4[2],e}function Bt(e,t4){var i=t4[0],r=t4[1],a=t4[2],s=i*i+r*r+a*a;return s>0&&(s=1/Math.sqrt(s)),e[0]=t4[0]*s,e[1]=t4[1]*s,e[2]=t4[2]*s,e}function lt(e,t4){return e[0]*t4[0]+e[1]*t4[1]+e[2]*t4[2]}function Ht(e,t4,i){var r=t4[0],a=t4[1],s=t4[2],n=i[0],o=i[1],l=i[2];return e[0]=a*l-s*o,e[1]=s*n-r*l,e[2]=r*o-a*n,e}function dx(e,t4,i){var r=t4[0],a=t4[1],s=t4[2],n=i[3]*r+i[7]*a+i[11]*s+i[15];return n||(n=1),e[0]=(i[0]*r+i[4]*a+i[8]*s+i[12])/n,e[1]=(i[1]*r+i[5]*a+i[9]*s+i[13])/n,e[2]=(i[2]*r+i[6]*a+i[10]*s+i[14])/n,e}function px(e,t4,i){var r=t4[0],a=t4[1],s=t4[2];return e[0]=r*i[0]+a*i[3]+s*i[6],e[1]=r*i[1]+a*i[4]+s*i[7],e[2]=r*i[2]+a*i[5]+s*i[8],e}function Au(e,t4,i){var r=i[0],a=i[1],s=i[2],n=i[3],o=t4[0],l=t4[1],u=t4[2],h=a*u-s*l,c=s*o-r*u,d=r*l-a*o;return h+=h,c+=c,d+=d,e[0]=o+n*h+a*d-s*c,e[1]=l+n*c+s*h-r*d,e[2]=u+n*d+r*c-a*h,e}function gs(e,t4,i,r){var a=[],s=[];return a[0]=t4[0]-i[0],a[1]=t4[1]-i[1],a[2]=t4[2]-i[2],s[0]=a[0],s[1]=a[1]*Math.cos(r)-a[2]*Math.sin(r),s[2]=a[1]*Math.sin(r)+a[2]*Math.cos(r),e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2],e}function va(e,t4,i,r){var a=[],s=[];return a[0]=t4[0]-i[0],a[1]=t4[1]-i[1],a[2]=t4[2]-i[2],s[0]=a[2]*Math.sin(r)+a[0]*Math.cos(r),s[1]=a[1],s[2]=a[2]*Math.cos(r)-a[0]*Math.sin(r),e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2],e}function Iu(e,t4,i,r){var a=[],s=[];return a[0]=t4[0]-i[0],a[1]=t4[1]-i[1],a[2]=t4[2]-i[2],s[0]=a[0]*Math.cos(r)-a[1]*Math.sin(r),s[1]=a[0]*Math.sin(r)+a[1]*Math.cos(r),s[2]=a[2],e[0]=s[0]+i[0],e[1]=s[1]+i[1],e[2]=s[2]+i[2],e}function fx(e){return e[0]=0,e[1]=0,e[2]=0,e}var cr=Xc,Zo=Ci;(function(){var e=Qg();return function(t4,i,r,a,s,n){var o,l;for(i||(i=3),r||(r=0),l=a?Math.min(a*i+r,t4.length):t4.length,o=r;o<l;o+=i)e[0]=t4[o],e[1]=t4[o+1],e[2]=t4[o+2],s(e,e,n),t4[o]=e[0],t4[o+1]=e[1],t4[o+2]=e[2];return t4}})();function mx(){var e=new yt(4);return yt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function gx(e,t4,i,r){var a=new yt(4);return a[0]=e,a[1]=t4,a[2]=i,a[3]=r,a}function _x(e,t4,i){return e[0]=t4[0]*i[0],e[1]=t4[1]*i[1],e[2]=t4[2]*i[2],e[3]=t4[3]*i[3],e}function yx(e,t4,i){return e[0]=t4[0]*i,e[1]=t4[1]*i,e[2]=t4[2]*i,e[3]=t4[3]*i,e}function vx(e,t4){var i=t4[0],r=t4[1],a=t4[2],s=t4[3],n=i*i+r*r+a*a+s*s;return n>0&&(n=1/Math.sqrt(n)),e[0]=i*n,e[1]=r*n,e[2]=a*n,e[3]=s*n,e}function Ct(e,t4,i){var r=t4[0],a=t4[1],s=t4[2],n=t4[3];return e[0]=i[0]*r+i[4]*a+i[8]*s+i[12]*n,e[1]=i[1]*r+i[5]*a+i[9]*s+i[13]*n,e[2]=i[2]*r+i[6]*a+i[10]*s+i[14]*n,e[3]=i[3]*r+i[7]*a+i[11]*s+i[15]*n,e}var xx=_x;(function(){var e=mx();return function(t4,i,r,a,s,n){var o,l;for(i||(i=4),r||(r=0),l=a?Math.min(a*i+r,t4.length):t4.length,o=r;o<l;o+=i)e[0]=t4[o],e[1]=t4[o+1],e[2]=t4[o+2],e[3]=t4[o+3],s(e,e,n),t4[o]=e[0],t4[o+1]=e[1],t4[o+2]=e[2],t4[o+3]=e[3];return t4}})();function Zp(){var e=new yt(4);return yt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function bx(e,t4,i){i*=.5;var r=Math.sin(i);return e[0]=r*t4[0],e[1]=r*t4[1],e[2]=r*t4[2],e[3]=Math.cos(i),e}function wx(e,t4,i){var r=t4[0],a=t4[1],s=t4[2],n=t4[3],o=i[0],l=i[1],u=i[2],h=i[3];return e[0]=r*h+n*o+a*u-s*l,e[1]=a*h+n*l+s*o-r*u,e[2]=s*h+n*u+r*l-a*o,e[3]=n*h-r*o-a*l-s*u,e}function Ao(e,t4,i,r){var a=t4[0],s=t4[1],n=t4[2],o=t4[3],l=i[0],u=i[1],h=i[2],c=i[3],d,p=a*l+s*u+n*h+o*c,f,m,g;return p<0&&(p=-p,l=-l,u=-u,h=-h,c=-c),1-p>1e-6?(d=Math.acos(p),f=Math.sin(d),m=Math.sin((1-r)*d)/f,g=Math.sin(r*d)/f):(m=1-r,g=r),e[0]=m*a+g*l,e[1]=m*s+g*u,e[2]=m*n+g*h,e[3]=m*o+g*c,e}function Tx(e,t4){var i=t4[0]+t4[4]+t4[8],r;if(i>0)r=Math.sqrt(i+1),e[3]=.5*r,r=.5/r,e[0]=(t4[5]-t4[7])*r,e[1]=(t4[6]-t4[2])*r,e[2]=(t4[1]-t4[3])*r;else{var a=0;t4[4]>t4[0]&&(a=1),t4[8]>t4[a*3+a]&&(a=2);var s=(a+1)%3,n=(a+2)%3;r=Math.sqrt(t4[a*3+a]-t4[s*3+s]-t4[n*3+n]+1),e[a]=.5*r,r=.5/r,e[3]=(t4[s*3+n]-t4[n*3+s])*r,e[s]=(t4[s*3+a]+t4[a*3+s])*r,e[n]=(t4[n*3+a]+t4[a*3+n])*r}return e}function Yc(e,t4,i,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",s=Math.PI/360;t4*=s,r*=s,i*=s;var n=Math.sin(t4),o=Math.cos(t4),l=Math.sin(i),u=Math.cos(i),h=Math.sin(r),c=Math.cos(r);switch(a){case"xyz":e[0]=n*u*c+o*l*h,e[1]=o*l*c-n*u*h,e[2]=o*u*h+n*l*c,e[3]=o*u*c-n*l*h;break;case"xzy":e[0]=n*u*c-o*l*h,e[1]=o*l*c-n*u*h,e[2]=o*u*h+n*l*c,e[3]=o*u*c+n*l*h;break;case"yxz":e[0]=n*u*c+o*l*h,e[1]=o*l*c-n*u*h,e[2]=o*u*h-n*l*c,e[3]=o*u*c+n*l*h;break;case"yzx":e[0]=n*u*c+o*l*h,e[1]=o*l*c+n*u*h,e[2]=o*u*h-n*l*c,e[3]=o*u*c-n*l*h;break;case"zxy":e[0]=n*u*c-o*l*h,e[1]=o*l*c+n*u*h,e[2]=o*u*h+n*l*c,e[3]=o*u*c-n*l*h;break;case"zyx":e[0]=n*u*c-o*l*h,e[1]=o*l*c+n*u*h,e[2]=o*u*h-n*l*c,e[3]=o*u*c+n*l*h;break;default:throw Error("Unknown angle order "+a)}return e}var qp=gx,Wp=vx;(function(){var e=Qg(),t4=Gp(1,0,0),i=Gp(0,1,0);return function(r,a,s){var n=lt(a,s);return n<-.999999?(Ht(e,t4,a),Zo(e)<1e-6&&Ht(e,i,a),Bt(e,e),bx(r,e,Math.PI),r):n>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(Ht(e,a,s),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+n,Wp(r,r))}})(),function(){var e=Zp(),t4=Zp();return function(i,r,a,s,n,o){return Ao(e,r,n,o),Ao(t4,a,s,o),Ao(i,e,t4,2*o*(1-o)),i}}(),function(){var e=Kg();return function(t4,i,r,a){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=a[0],e[4]=a[1],e[7]=a[2],e[2]=-i[0],e[5]=-i[1],e[8]=-i[2],Wp(t4,Tx(t4,e))}}();function bh(){var e=new yt(2);return yt!=Float32Array&&(e[0]=0,e[1]=0),e}function Hp(e,t4){var i=new yt(2);return i[0]=e,i[1]=t4,i}function Xp(e,t4,i){return e[0]=t4[0]*i,e[1]=t4[1]*i,e}function Yp(e){var t4=e[0],i=e[1];return Math.sqrt(t4*t4+i*i)}function Ex(e){var t4=e[0],i=e[1];return t4*t4+i*i}function Sx(e,t4){return e[0]*t4[0]+e[1]*t4[1]}function Kp(e){return e[0]=0,e[1]=0,e}var Dx=Ex;(function(){var e=bh();return function(t4,i,r,a,s,n){var o,l;for(i||(i=2),r||(r=0),l=a?Math.min(a*i+r,t4.length):t4.length,o=r;o<l;o+=i)e[0]=t4[o],e[1]=t4[o+1],s(e,e,n),t4[o]=e[0],t4[o+1]=e[1];return t4}})();const k=8192;function si(e,t4,i){return t4*(k/(e.tileSize*2**(i-e.tileID.overscaledZ)))}function Ft(e){return e instanceof Error?e:Error(typeof e=="string"?e:String(e))}function Vr(){return new Float64Array(4)}function De(){return new Float64Array(3)}function jr(){return new Float64Array(16)}function Xn(){let e=new Float64Array(16);return Ii(e),e}function e_(){let e=new Float32Array(16);return Ii(e),e}function Dr(e,t4,i,r,a=false){if(!i[0]&&!i[1])return[0,0];let s=a?r==="map"?-e.bearingInRadians:0:r==="viewport"?e.bearingInRadians:0;if(s){let n=Math.sin(s),o=Math.cos(s);i=[i[0]*o-i[1]*n,i[0]*n+i[1]*o]}return[a?i[0]:si(t4,i[0],e.zoom),a?i[1]:si(t4,i[1],e.zoom)]}function wh(e,t4){return e[0]*t4[0]+e[1]*t4[1]+e[2]*t4[2]+e[3]}function li(e,t4,i){let r=tx([e[0],e[1],e[2],t4[0],t4[1],t4[2],i[0],i[1],i[2]]);if(r===0)return null;let a=Ht([],[t4[0],t4[1],t4[2]],[i[0],i[1],i[2]]),s=Ht([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),n=Ht([],[e[0],e[1],e[2]],[t4[0],t4[1],t4[2]]),o=Ne([],a,-e[3]);return fi(o,o,Ne([],s,-t4[3])),fi(o,o,Ne([],n,-i[3])),Ne(o,o,1/r),o}function Cx(e,t4,i){let r=e[0]*i[0]+e[1]*i[1]+e[2]*i[2],a=t4[0]*i[0]+t4[1]*i[1]+t4[2]*i[2];return a===0?null:(-r-i[3])/a}function Yn(e,t4,i,r){let a=Math.sqrt(e*e+t4*t4),s=Math.sqrt(i*i+r*r);e/=a,t4/=a,i/=s,r/=s;let n=e*i+t4*r,o=Math.acos(n);return-t4*i+e*r>0?o:-o}function ei(e,t4){let i=Qr(e,360),r=Qr(t4,360),a=r-i,s=r>i?a-360:a+360;return Math.abs(a)<Math.abs(s)?a:s}function Kn(e,t4){let i=Qr(e,Math.PI*2),r=Qr(t4,Math.PI*2);return Math.min(Math.abs(i-r),Math.abs(i-r+Math.PI*2),Math.abs(i-r-Math.PI*2))}function Qr(e,t4){return(e%t4+t4)%t4}function Io(e,t4,i,r,a){return ka(r,a,ne((e-t4)/(i-t4),0,1))}function ka(e,t4,i){return e*(1-i)+t4*i}function Px(e){let t4=1/0,i=1/0,r=-1/0,a=-1/0;for(let s of e)t4=Math.min(t4,s.x),i=Math.min(i,s.y),r=Math.max(r,s.x),a=Math.max(a,s.y);return[t4,i,r,a]}function Ax(e){if(!e.length)return new Set;let t4=Math.max(...e.map(l=>l.canonical.z)),i=1/0,r=-1/0,a=1/0,s=-1/0,n=[];for(let l of e){let{x:u,y:h,z:c}=l.canonical,d=2**(t4-c),p=u*d,f=h*d;n.push({id:l,x:p,y:f}),p<i&&(i=p),p>r&&(r=p),f<a&&(a=f),f>s&&(s=f)}let o=new Set;for(let l of n)(l.x===i||l.x===r||l.y===a||l.y===s)&&o.add(l.id);return o}function Ix(e){if(e<=0)return 0;if(e>=1)return 1;let t4=e*e,i=t4*e;return 4*(e<.5?i:3*(e-t4)+i-.75)}function Kc(e,t4,i,r){return ex(e,t4,i,r)}const Th=Kc(.25,.1,.25,1);function ne(e,t4,i){return Math.min(i,Math.max(t4,e))}function mi(e,t4,i){let r=i-t4,a=((e-t4)%r+r)%r+t4;return a===t4?i:a}function W(e,...t4){for(let i of t4)for(let r in i)e[r]=i[r];return e}function fn(e,t4){let i={};for(let r of t4)r in e&&(i[r]=e[r]);return i}let Mx=1;function t_(){return Mx++}function Fx(e){return Math.log(e)/Math.LN2%1==0}function zx(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)}function $t(e){return 2**e}function It(e){return Math.log(e)/Math.LN2}function ii(e,t4,i){if(t4<=0)return e;let r=1/t4;return i===void 0||Math.abs(i)<1e-10?Math.round(e*r)/r:(i>0?Math.ceil(e*r-1e-9):Math.floor(e*r+1e-10))/r}function Jc(e,t4,i){let r={};for(let a in e)r[a]=t4.call(this,e[a],a,e);return r}function i_(e,t4,i){let r={};for(let a in e)t4.call(this,e[a],a,e)&&(r[a]=e[a]);return r}function Vi(e,t4){if(Array.isArray(e)){if(!Array.isArray(t4)||e.length!==t4.length)return false;for(let i=0;i<e.length;i++)if(!Vi(e[i],t4[i]))return false;return true}if(typeof e=="object"&&e&&t4!==null){if(typeof t4!="object"||Object.keys(e).length!==Object.keys(t4).length)return false;for(let i in e)if(!Vi(e[i],t4[i]))return false;return true}return e===t4}function Wt(e){return Array.isArray(e)?e.map(Wt):typeof e=="object"&&e?Jc(e,Wt):e}const Jp={};function ge(e){Jp[e]||(typeof console<"u"&&console.warn(e),Jp[e]=true)}function wr(e,t4,i){return(i.y-e.y)*(t4.x-e.x)>(t4.y-e.y)*(i.x-e.x)}function Rx(e,t4,i,r){let a=t4.y-e.y,s=t4.x-e.x,n=r.y-i.y,o=r.x-i.x,l=n*s-o*a;if(l===0)return null;let u=e.y-i.y,h=e.x-i.x,c=(o*u-n*h)/l;return new C(e.x+c*s,e.y+c*a)}function kx([e,t4,i]){return t4+=90,t4*=Math.PI/180,i*=Math.PI/180,[e*Math.cos(t4)*Math.sin(i),e*Math.sin(t4)*Math.sin(i),e*Math.cos(i)]}function Ga(e){return typeof WorkerGlobalScope<"u"&&e!==void 0&&e instanceof WorkerGlobalScope}function Lx(e){let t4=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,i={};if(e.replace(t4,(r,a,s,n)=>{let o=s||n;return i[a]=!o||o.toLowerCase(),""}),i["max-age"]){let r=parseInt(i["max-age"],10);isNaN(r)?delete i["max-age"]:i["max-age"]=r}return i}let Mu=null;function Bx(e){if(Mu==null){let t4=e.navigator?e.navigator.userAgent:null;Mu=!!e.safari||!!(t4&&(/\b(iPad|iPhone|iPod)\b/.test(t4)||t4.match("Safari")&&!t4.match("Chrome")))}return Mu}function qr(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}const Ox=async(e,t4)=>{let i=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(i,t4)}catch(r){throw Error(`Could not load image because of ${Ft(r).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},$x=e=>new Promise((t4,i)=>{let r=new Image;r.onload=()=>{t4(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>r.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=")},r.onerror=()=>i(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let a=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=URL.createObjectURL(a)});function Vx(e,t4,i,r,a){let s=Math.max(-t4,0)*4,n=(Math.max(0,i)-i)*r*4+s,o=r*4,l=Math.max(0,t4),u=Math.max(0,i),h=Math.min(e.width,t4+r),c=Math.min(e.height,i+a);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:n,stride:o}]}}async function jx(e,t4,i,r,a){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let s=new VideoFrame(e,{timestamp:0});try{let n=s==null?void 0:s.format;if(!n||!(n.startsWith("BGR")||n.startsWith("RGB")))throw Error(`Unrecognized format ${n}`);let o=n.startsWith("BGR"),l=new Uint8ClampedArray(r*a*4);if(await s.copyTo(l,Vx(e,t4,i,r,a)),o)for(let u=0;u<l.length;u+=4){let h=l[u];l[u]=l[u+2],l[u+2]=h}return l}finally{s.close()}}function qo(e,t4,i,r){return e.addEventListener(t4,i,r),{unsubscribe:()=>{e.removeEventListener(t4,i,r)}}}function Ze(e){return e*Math.PI/180}function Ui(e){return e/Math.PI*180}function r_(e,t4){return e.roll==t4.roll&&e.pitch==t4.pitch&&e.bearing==t4.bearing}function Ux(e){let t4=new Float64Array(9);rx(t4,e);let i=Ui(-Math.asin(ne(t4[2],-1,1))),r,a;return Math.hypot(t4[5],t4[8])<.001?(r=0,a=-Ui(Math.atan2(t4[3],t4[4]))):(r=Ui(t4[5]===0&&t4[8]===0?0:Math.atan2(t4[5],t4[8])),a=Ui(t4[1]===0&&t4[0]===0?0:Math.atan2(t4[1],t4[0]))),{roll:r,pitch:i+90,bearing:a}}function a_(e,t4,i){let r=Hp(t4.x-i.x,t4.y-i.y),a=Hp(e.x-i.x,e.y-i.y),s=r[0]*a[1]-r[1]*a[0];return Ui(Math.atan2(s,Sx(r,a)))}function Qp(e,t4,i){let r=new Float64Array(4);return Yc(r,e,t4-90,i),r}const Wi=85.051129,s_={touchstart:true,touchmove:true,touchmoveWindow:true,touchend:true,touchcancel:true},n_={dblclick:true,click:true,mouseover:true,mouseout:true,mousedown:true,mousemove:true,mousemoveWindow:true,mouseup:true,mouseupWindow:true,contextmenu:true,wheel:true};function Nx(e,t4){return s_[t4]&&"touches"in e}function Gx(e,t4){var a,s;if(!n_[t4])return false;let i=e,r=((s=(a=i==null?void 0:i.target)==null?void 0:a.ownerDocument)==null?void 0:s.defaultView)||window;return i instanceof r.MouseEvent||i instanceof r.WheelEvent}function Zx(e){return s_[e]||n_[e]}const ef="AbortError";var mn=class extends Error{constructor(e=ef){super(e instanceof Error?e.message:e),this.name=ef,e instanceof Error&&e.stack&&(this.stack=e.stack)}};function Cr(e){return e instanceof Error&&e.name==="AbortError"}function Qc(e){if(e.aborted)throw new mn(e.reason)}const xi={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function o_(e){return xi.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}function gR(e,t4){xi.REGISTERED_PROTOCOLS[e]=t4}function _R(e){delete xi.REGISTERED_PROTOCOLS[e]}const Eh="global-dispatcher";var Wo=class extends Error{constructor(e,t4,i,r){super(`AJAXError: ${t4} (${e}): ${i}`),this.status=e,this.statusText=t4,this.url=i,this.body=r}};function ed(){var e;if(Ga(self))return(e=self.worker)==null?void 0:e.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch{}return window.location.href}const qx=e=>{var t4;return e.startsWith("file:")||((t4=ed())==null?void 0:t4.startsWith("file:"))&&!/^\w+:/.test(e)};async function Wx(e,t4){let i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:ed(),referrerPolicy:e.referrerPolicy,signal:t4.signal});e.type==="json"&&!i.headers.has("Accept")&&i.headers.set("Accept","application/json");let r;try{r=await fetch(i)}catch(n){throw Cr(n)?n:new Wo(0,Ft(n).message,e.url,new Blob)}if(!r.ok){let n=await r.blob();throw new Wo(r.status,r.statusText,e.url,n)}let a;a=e.type==="arrayBuffer"||e.type==="image"?r.arrayBuffer():e.type==="json"?r.json():r.text();let s=await a;return Qc(t4.signal),{data:s,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),etag:r.headers.get("ETag")}}function Hx(e,t4){return new Promise((i,r)=>{var s;let a=new XMLHttpRequest;a.open(e.method||"GET",e.url,true),(e.type==="arrayBuffer"||e.type==="image")&&(a.responseType="arraybuffer");for(let n in e.headers)a.setRequestHeader(n,e.headers[n]);e.type==="json"&&(a.responseType="text",(s=e.headers)!=null&&s.Accept||a.setRequestHeader("Accept","application/json")),a.withCredentials=e.credentials==="include",a.onerror=()=>{r(Error(a.statusText))},a.onload=()=>{if(!t4.signal.aborted)if((a.status>=200&&a.status<300||a.status===0)&&a.response!==null){let n=a.response;if(e.type==="json")try{n=JSON.parse(a.response)}catch(o){r(o);return}i({data:n,cacheControl:a.getResponseHeader("Cache-Control"),expires:a.getResponseHeader("Expires"),etag:a.getResponseHeader("ETag")})}else{let n=new Blob([a.response],{type:a.getResponseHeader("Content-Type")});r(new Wo(a.status,a.statusText,e.url,n))}},t4.signal.addEventListener("abort",()=>{a.abort(),r(new mn(t4.signal.reason))}),a.send(e.body)})}const Sl=async function(e,t4){var i,r;if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){let a=o_(e.url);if(a){let s=await a(e,t4);return!s.data&&e.type==="arrayBuffer"?W(s,{data:new ArrayBuffer(0)}):s}if(Ga(self)&&((i=self.worker)!=null&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:Eh},t4)}if(!qx(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return Wx(e,t4);if(Ga(self)&&((r=self.worker)!=null&&r.actor))return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:true,targetMapId:Eh},t4)}return Hx(e,t4)},Dl=(e,t4)=>Sl(W(e,{type:"json"}),t4),l_=(e,t4)=>Sl(W(e,{type:"arrayBuffer"}),t4);function u_(e){if(!e||e.startsWith("data:image/"))return true;if(e.startsWith("blob:")&&(e=e.slice(5),e.startsWith("null")))return false;if(e.indexOf("://")<=0)return true;let t4=new URL(e),i=window.location;return t4.protocol===i.protocol&&t4.host===i.host}const Xx=e=>{let t4=window.document.createElement("video");return t4.muted=true,new Promise(i=>{t4.onloadstart=()=>{i(t4)};for(let r of e){let a=window.document.createElement("source");u_(r)||(t4.crossOrigin="Anonymous"),a.src=r,t4.appendChild(a)}})};function tf(e,t4,i){var r;(r=i[e])!=null&&r.includes(t4)||(i[e]||(i[e]=[]),i[e].push(t4))}function Fu(e,t4,i){if(i!=null&&i[e]){let r=i[e].indexOf(t4);r!==-1&&i[e].splice(r,1)}}var bi=class{constructor(e,t4={}){W(this,t4),this.type=e}},Y=class extends bi{constructor(e,t4={}){super("error",W({error:e},t4))}},pt=class{on(e,t4){return this._listeners||(this._listeners={}),tf(e,t4,this._listeners),{unsubscribe:()=>{this.off(e,t4)}}}off(e,t4){return Fu(e,t4,this._listeners),Fu(e,t4,this._oneTimeListeners),this}once(e,t4){return t4?(this._oneTimeListeners||(this._oneTimeListeners={}),tf(e,t4,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,t4){var a,s,n,o;let i=typeof e=="string"?new bi(e,t4||{}):e,r=i.type;if(this.listens(r)){i.target=this;let l=((s=(a=this._listeners)==null?void 0:a[r])==null?void 0:s.slice())??[];for(let c of l)c.call(this,i);let u=((o=(n=this._oneTimeListeners)==null?void 0:n[r])==null?void 0:o.slice())??[];for(let c of u)Fu(r,c,this._oneTimeListeners),c.call(this,i);let h=this._eventedParent;h&&(W(i,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(i))}else i instanceof Y&&console.error(i.error);return this}listens(e){var t4,i,r,a,s;return!!((i=(t4=this._listeners)==null?void 0:t4[e])!=null&&i.length||(a=(r=this._oneTimeListeners)==null?void 0:r[e])!=null&&a.length||(s=this._eventedParent)!=null&&s.listens(e))}setEventedParent(e,t4){return this._eventedParent=e,this._eventedParentData=t4,this}},h_={$version:8,$root:{version:{required:true,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:true,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:true,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:true,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:false},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:true,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:false},"*":{type:"*"}},source_raster_dem:{type:{required:true,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:false},"*":{type:"*"}},source_geojson:{type:{required:true,type:"enum",values:{geojson:{}}},data:{required:true,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:false},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:false},generateId:{type:"boolean",default:false},promoteId:{type:"promoteId"}},source_video:{type:{required:true,type:"enum",values:{video:{}}},urls:{required:true,type:"array",value:"string"},coordinates:{required:true,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:true,type:"enum",values:{image:{}}},url:{type:"string"},coordinates:{required:true,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:true},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:true},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:false,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:false,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:false,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:false,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:false,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:false,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:false,expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:false,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:false,requires:["icon-image"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:false,requires:["icon-image","text-field"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:true,expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:false,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:true,expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:true,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:true,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:false,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:false,requires:["text-field"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:false,requires:["text-field","icon-image"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:true,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:false,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:false,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:false,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:false,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:false}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:false,expression:{interpolated:false,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:true,expression:{interpolated:true,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:true,parameters:["zoom"]},transition:true},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:true,parameters:["zoom"]},transition:true}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:true,parameters:["zoom"]},transition:true},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:true,parameters:["zoom"]},transition:true},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:true,parameters:["zoom"]},transition:true},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:true,parameters:["zoom"]},transition:true},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:true,parameters:["zoom"]},transition:true},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:true,parameters:["zoom"]},transition:true},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:true,parameters:["zoom"]},transition:true}},terrain:{source:{type:"string",required:true},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:false,expression:{interpolated:true,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:true,expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:true,expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:true,requires:[{"!":"fill-pattern"},{"fill-antialias":true}],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:true,expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:true,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:true,expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,units:"meters",transition:true,expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,units:"meters",transition:true,requires:["fill-extrusion-height"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:true,transition:false,expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom","global-state"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:true,requires:[{"!":"line-pattern"}],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:true,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:true,expression:{interpolated:false,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:false,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:true}}],expression:{interpolated:true,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:true,expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:true,expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:true,expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:true,units:"pixels",expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:false,expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:false,expression:{interpolated:true,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,requires:["icon-image"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:true,requires:["icon-image"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:true,requires:["icon-image"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:true,units:"pixels",requires:["icon-image"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:true,units:"pixels",requires:["icon-image"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:true,units:"pixels",requires:["icon-image"],expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,requires:["text-field"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:true,overridable:true,requires:["text-field"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:true,requires:["text-field"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:true,units:"pixels",requires:["text-field"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:true,units:"pixels",requires:["text-field"],expression:{interpolated:true,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:true,units:"pixels",requires:["text-field"],expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:true,units:"degrees",expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:false,units:"milliseconds",expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:false,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:false,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:false,expression:{interpolated:true,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:false,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:true,requires:[{"!":"background-pattern"}],expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:true,expression:{interpolated:false,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:true,expression:{interpolated:true,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const F=h_,Yx=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var B=class{constructor(e,t4,i,r,a="error"){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),this.severity=a,t4!=null&&t4.__line__&&(this.line=t4.__line__)}};const gn={kind:"null"},V={kind:"number"},ue={kind:"string"},me={kind:"boolean"},Pi={kind:"color"},Cl={kind:"projectionDefinition"},Wr={kind:"object"},he={kind:"value"},Kx={kind:"error"},Pl={kind:"collator"},_n={kind:"formatted"},Al={kind:"padding"},Ws={kind:"colorArray"},Il={kind:"numberArray"},yn={kind:"resolvedImage"},Ml={kind:"variableAnchorOffsetCollection"};function kt(e,t4){return{kind:"array",itemType:e,N:t4}}function Je(e){if(e.kind==="array"){let t4=Je(e.itemType);return typeof e.N=="number"?`array<${t4}, ${e.N}>`:e.itemType.kind==="value"?"array":`array<${t4}>`}return e.kind}const Jx=[gn,V,ue,me,Pi,Cl,_n,Wr,kt(he),Al,Il,Ws,yn,Ml];function Hs(e,t4){if(t4.kind==="error")return null;if(e.kind==="array"){if(t4.kind==="array"&&(t4.N===0&&t4.itemType.kind==="value"||!Hs(e.itemType,t4.itemType))&&(typeof e.N!="number"||e.N===t4.N))return null}else{if(e.kind===t4.kind)return null;if(e.kind==="value"){for(let i of Jx)if(!Hs(i,t4))return null}}return`Expected ${Je(e)} but found ${Je(t4)} instead.`}function td(e,t4){return t4.some(i=>i.kind===e.kind)}function Hr(e,t4){return t4.some(i=>i==="null"?e===null:i==="array"?Array.isArray(e):i==="object"?e&&!Array.isArray(e)&&typeof e=="object":i===typeof e)}function _r(e,t4){return e.kind==="array"&&t4.kind==="array"?e.itemType.kind===t4.itemType.kind&&typeof e.N=="number":e.kind===t4.kind}const c_=.96422,d_=.82521,p_=4/29,Sh=6/29,f_=3*Sh*Sh,Qx=Math.PI/180,eb=180/Math.PI;function m_(e){return e%=360,e<0&&(e+=360),e}function g_([e,t4,i,r]){e=zu(e),t4=zu(t4),i=zu(i);let a,s,n=Ru((.2225045*e+.7168786*t4+.0606169*i)/1);e===t4&&t4===i?a=s=n:(a=Ru((.4360747*e+.3850649*t4+.1430804*i)/c_),s=Ru((.0139322*e+.0971045*t4+.7141733*i)/d_));let o=116*n-16;return[o<0?0:o,500*(a-n),200*(n-s),r]}function zu(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Ru(e){return e>.008856451679035631?e**(1/3):e/f_+p_}function __([e,t4,i,r]){let a=(e+16)/116,s=isNaN(t4)?a:a+t4/500,n=isNaN(i)?a:a-i/200;return a=1*Lu(a),s=c_*Lu(s),n=d_*Lu(n),[ku(3.1338561*s-1.6168667*a-.4906146*n),ku(-.9787684*s+1.9161415*a+.033454*n),ku(.0719453*s-.2289914*a+1.4052427*n),r]}function ku(e){return e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055,e<0?0:e>1?1:e}function Lu(e){return e>Sh?e*e*e:f_*(e-p_)}function tb(e){let[t4,i,r,a]=g_(e),s=Math.sqrt(i*i+r*r);return[Math.round(s*1e4)?m_(Math.atan2(r,i)*eb):NaN,s,t4,a]}function ib([e,t4,i,r]){return e=isNaN(e)?0:e*Qx,__([i,Math.cos(e)*t4,Math.sin(e)*t4,r])}function rb([e,t4,i,r]){e=m_(e),t4/=100,i/=100;function a(s){let n=(s+e/30)%12,o=t4*Math.min(i,1-i);return i-o*Math.max(-1,Math.min(n-3,9-n,1))}return[a(0),a(8),a(4),r]}const ab=Object.hasOwn||function(e,t4){return Object.prototype.hasOwnProperty.call(e,t4)};function Os(e,t4){return ab(e,t4)?e[t4]:void 0}function sb(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t4=Os(nb,e);if(t4){let[r,a,s]=t4;return[r/255,a/255,s/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let r=e.length<6?1:2,a=1;return[Jn(e.slice(a,a+=r)),Jn(e.slice(a,a+=r)),Jn(e.slice(a,a+=r)),Jn(e.slice(a,a+r)||"ff")]}if(e.startsWith("rgb")){let r=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[a,s,n,o,l,u,h,c,d,p,f,m]=r,g=[o||" ",h||" ",p].join("");if(g===" "||g===" /"||g===",,"||g===",,,"){let _=[n,u,d].join(""),y=_==="%%%"?100:_===""?255:0;if(y){let x=[Ca(+s/y,0,1),Ca(+l/y,0,1),Ca(+c/y,0,1),f?rf(+f,m):1];if(af(x))return x}}return}}let i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[r,a,s,n,o,l,u,h,c]=i,d=[s||" ",o||" ",u].join("");if(d===" "||d===" /"||d===",,"||d===",,,"){let p=[+a,Ca(+n,0,100),Ca(+l,0,100),h?rf(+h,c):1];if(af(p))return rb(p)}}}function Jn(e){return parseInt(e.padEnd(2,e),16)/255}function rf(e,t4){return Ca(t4?e/100:e,0,1)}function Ca(e,t4,i){return Math.min(Math.max(t4,e),i)}function af(e){return!e.some(Number.isNaN)}const nb={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Er(e,t4,i){return e+i*(t4-e)}function Za(e,t4,i){return e.map((r,a)=>Er(r,t4[a],i))}function ob(e){return e==="rgb"||e==="hcl"||e==="lab"}var xt,oe=(xt=class{constructor(t4,i,r,a=1,s=true){this.r=t4,this.g=i,this.b=r,this.a=a,s||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[t4,i,r,a]))}static parse(t4){if(t4 instanceof xt)return t4;if(typeof t4!="string")return;let i=sb(t4);if(i)return new xt(...i,false)}get rgb(){let{r:t4,g:i,b:r,a}=this,s=a||1/0;return this.overwriteGetter("rgb",[t4/s,i/s,r/s,a])}get hcl(){return this.overwriteGetter("hcl",tb(this.rgb))}get lab(){return this.overwriteGetter("lab",g_(this.rgb))}overwriteGetter(t4,i){return Object.defineProperty(this,t4,{value:i}),i}toString(){let[t4,i,r,a]=this.rgb;return`rgba(${[t4,i,r].map(s=>Math.round(s*255)).join(",")},${a})`}static interpolate(t4,i,r,a="rgb"){switch(a){case"rgb":{let[s,n,o,l]=Za(t4.rgb,i.rgb,r);return new xt(s,n,o,l,false)}case"hcl":{let[s,n,o,l]=t4.hcl,[u,h,c,d]=i.hcl,p,f;if(!isNaN(s)&&!isNaN(u)){let x=u-s;u>s&&x>180?x-=360:u<s&&s-u>180&&(x+=360),p=s+r*x}else isNaN(s)?isNaN(u)?p=NaN:(p=u,(o===1||o===0)&&(f=h)):(p=s,(c===1||c===0)&&(f=n));let[m,g,_,y]=ib([p,f??Er(n,h,r),Er(o,c,r),Er(l,d,r)]);return new xt(m,g,_,y,false)}case"lab":{let[s,n,o,l]=__(Za(t4.lab,i.lab,r));return new xt(s,n,o,l,false)}}}},xt.black=new xt(0,0,0,1),xt.white=new xt(1,1,1,1),xt.transparent=new xt(0,0,0,0),xt.red=new xt(1,0,0,1),xt);const lb=["bottom","center","top"];var Dh=class{constructor(t4,i,r,a,s,n){this.text=t4,this.image=i,this.scale=r,this.fontStack=a,this.textColor=s,this.verticalAlign=n}},dr=class Mo{constructor(t4){this.sections=t4}static fromString(t4){return new Mo([new Dh(t4,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t4=>t4.text.length!==0||t4.image&&t4.image.name.length!==0)}static factory(t4){return t4 instanceof Mo?t4:Mo.fromString(t4)}toString(){return this.sections.length===0?"":this.sections.map(t4=>t4.text).join("")}},Ki=class Ms{constructor(t4){this.values=t4.slice()}static parse(t4){if(t4 instanceof Ms)return t4;if(typeof t4=="number")return new Ms([t4,t4,t4,t4]);if(Array.isArray(t4)&&!(t4.length<1||t4.length>4)){for(let i of t4)if(typeof i!="number")return;switch(t4.length){case 1:t4=[t4[0],t4[0],t4[0],t4[0]];break;case 2:t4=[t4[0],t4[1],t4[0],t4[1]];break;case 3:t4=[t4[0],t4[1],t4[2],t4[1]]}return new Ms(t4)}}toString(){return JSON.stringify(this.values)}static interpolate(t4,i,r){return new Ms(Za(t4.values,i.values,r))}},Ji=class Fs{constructor(t4){this.values=t4.slice()}static parse(t4){if(t4 instanceof Fs)return t4;if(typeof t4=="number")return new Fs([t4]);if(Array.isArray(t4)){for(let i of t4)if(typeof i!="number")return;return new Fs(t4)}}toString(){return JSON.stringify(this.values)}static interpolate(t4,i,r){return new Fs(Za(t4.values,i.values,r))}},_i=class zs{constructor(t4){this.values=t4.slice()}static parse(t4){if(t4 instanceof zs)return t4;if(typeof t4=="string"){let r=oe.parse(t4);return r?new zs([r]):void 0}if(!Array.isArray(t4))return;let i=[];for(let r of t4){if(typeof r!="string")return;let a=oe.parse(r);if(!a)return;i.push(a)}return new zs(i)}toString(){return JSON.stringify(this.values)}static interpolate(t4,i,r,a="rgb"){let s=[];if(t4.values.length!=i.values.length)throw Error(`colorArray: Arrays have mismatched length (${t4.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let n=0;n<t4.values.length;n++)s.push(oe.interpolate(t4.values[n],i.values[n],r,a));return new zs(s)}},qe=class extends Error{constructor(e,t4){super(e),this.name="RuntimeError",this.path=t4}toJSON(){return this.message}};const ub=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var Hi=class Fo{constructor(t4){this.values=t4.slice()}static parse(t4){if(t4 instanceof Fo)return t4;if(!(!Array.isArray(t4)||t4.length<1||t4.length%2!=0)){for(let i=0;i<t4.length;i+=2){let r=t4[i],a=t4[i+1];if(typeof r!="string"||!ub.has(r)||!Array.isArray(a)||a.length!==2||typeof a[0]!="number"||typeof a[1]!="number")return}return new Fo(t4)}}toString(){return JSON.stringify(this.values)}static interpolate(t4,i,r,a){let s=t4.values,n=i.values;if(s.length!==n.length)throw new qe(`Cannot interpolate values of different length. from: ${t4.toString()}, to: ${i.toString()}`,a);let o=[];for(let l=0;l<s.length;l+=2){if(s[l]!==n[l])throw new qe(`Cannot interpolate values containing mismatched anchors. from[${l}]: ${s[l]}, to[${l}]: ${n[l]}`,a);o.push(s[l]);let[u,h]=s[l+1],[c,d]=n[l+1];o.push([Er(u,c,r),Er(h,d,r)])}return new Fo(o)}},Xi=class y_{constructor(t4){this.name=t4.name,this.available=t4.available}toString(){return this.name}static fromString(t4){return t4?new y_({name:t4,available:false}):null}},Mr=class Pa{constructor(t4,i,r){this.from=t4,this.to=i,this.transition=r}toString(){return this.from===this.to&&this.transition===1?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(t4,i,r){return new Pa(t4,i,r)}static parse(t4){if(t4 instanceof Pa)return t4;if(Array.isArray(t4)&&t4.length===3&&typeof t4[0]=="string"&&typeof t4[1]=="string"&&typeof t4[2]=="number")return new Pa(t4[0],t4[1],t4[2]);if(typeof t4=="object"&&typeof t4.from=="string"&&typeof t4.to=="string"&&typeof t4.transition=="number")return new Pa(t4.from,t4.to,t4.transition);if(typeof t4=="string")return new Pa(t4,t4,1)}},id=class{constructor(t4,i,r){this.sensitivity=t4?i?"variant":"case":i?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t4,i){return this.collator.compare(t4,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};function v_(e,t4,i,r){return typeof e=="number"&&e>=0&&e<=255&&typeof t4=="number"&&t4>=0&&t4<=255&&typeof i=="number"&&i>=0&&i<=255?r===void 0||typeof r=="number"&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t4,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[e,t4,i,r]:[e,t4,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function qa(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof Mr||e instanceof oe||e instanceof id||e instanceof dr||e instanceof Ki||e instanceof Ji||e instanceof _i||e instanceof Hi||e instanceof Xi)return true;if(Array.isArray(e)){for(let t4 of e)if(!qa(t4))return false;return true}if(typeof e=="object"){for(let t4 in e)if(!qa(e[t4]))return false;return true}return false}function at(e){if(e===null)return gn;if(typeof e=="string")return ue;if(typeof e=="boolean")return me;if(typeof e=="number")return V;if(e instanceof oe)return Pi;if(e instanceof Mr)return Cl;if(e instanceof id)return Pl;if(e instanceof dr)return _n;if(e instanceof Ki)return Al;if(e instanceof Ji)return Il;if(e instanceof _i)return Ws;if(e instanceof Hi)return Ml;if(e instanceof Xi)return yn;if(Array.isArray(e)){let t4=e.length,i;for(let r of e){let a=at(r);if(!i)i=a;else{if(i===a)continue;i=he;break}}return kt(i||he,t4)}return Wr}function $s(e){let t4=typeof e;return e===null?"":t4==="string"||t4==="number"||t4==="boolean"?String(e):e instanceof oe||e instanceof Mr||e instanceof dr||e instanceof Ki||e instanceof Ji||e instanceof _i||e instanceof Hi||e instanceof Xi?e.toString():JSON.stringify(e)}var Wa=class x_{constructor(t4,i){this.type=t4,this.value=i}static parse(t4,i){if(t4.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${t4.length-1} instead.`);if(!qa(t4[1]))return i.error(`invalid value of type "${typeof t4[1]}"`);let r=t4[1],a=at(r),s=i.expectedType;return a.kind==="array"&&a.N===0&&s&&s.kind==="array"&&(typeof s.N!="number"||s.N===0)&&(a=s),new x_(a,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return true}};const hb=["Unknown","Point","LineString","Polygon"];var b_=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?hb[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t4){let i=this._parseColorCache.get(t4);return i||(i=oe.parse(t4),this._parseColorCache.set(t4,i)),i}};function Fl(e,t4,i){let r=e.length-1,a=0,s=r,n=0,o,l;for(;a<=s;)if(n=Math.floor((a+s)/2),o=e[n],l=e[n+1],o<=t4){if(n===r||t4<l)return n;a=n+1}else if(o>t4)s=n-1;else throw new qe("Input is not a number.",i);return 0}var rd=class w_{constructor(t4,i,r,a){this.type=t4,this.input=i,this.key=a,this.labels=[],this.outputs=[];for(let[s,n]of r)this.labels.push(s),this.outputs.push(n)}static parse(t4,i){if(t4.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t4.length-1}.`);if((t4.length-1)%2!=0)return i.error("Expected an even number of arguments.");let r=i.parse(t4[1],1,V);if(!r)return null;let a=[],s=null;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);for(let n=1;n<t4.length;n+=2){let o=n===1?-1/0:t4[n],l=t4[n+1],u=n,h=n+1;if(typeof o!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(a.length&&a[a.length-1][0]>=o)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let c=i.parse(l,h,s);if(!c)return null;s||(s=c.type),a.push([o,c])}return new w_(s,r,a,i.key)}evaluate(t4){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t4);let a=this.input.evaluate(t4);if(a<=i[0])return r[0].evaluate(t4);let s=i.length;return a>=i[s-1]?r[s-1].evaluate(t4):r[Fl(i,a,this.key)].evaluate(t4)}eachChild(t4){t4(this.input);for(let i of this.outputs)t4(i)}outputDefined(){return this.outputs.every(t4=>t4.outputDefined())}};function cb(e,t4,i,r){let a=3*e,s=3*(i-e)-a,n=1-a-s,o=3*t4,l=3*(r-t4)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let d=h;for(let m=0;m<8;m++){let g=((n*d+s)*d+a)*d-h;if(Math.abs(g)<c)return((u*d+l)*d+o)*d;let _=(3*n*d+2*s)*d+a;if(Math.abs(_)<1e-6)break;d-=g/_}let p=0,f=1;d=h;for(let m=0;m<20;m++){let g=((n*d+s)*d+a)*d;if(Math.abs(g-h)<c)break;h>g?p=d:f=d,d=(p+f)*.5}return((u*d+l)*d+o)*d}}var yi=class Ch{constructor(t4,i,r,a,s,n){this.type=t4,this.operator=i,this.interpolation=r,this.input=a,this.key=n,this.labels=[],this.outputs=[];for(let[o,l]of s)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(t4,i,r,a){let s=0;if(t4.name==="exponential")s=Bu(i,t4.base,r,a);else if(t4.name==="linear")s=Bu(i,1,r,a);else if(t4.name==="cubic-bezier"){let n=t4.controlPoints;s=cb(n[0],n[1],n[2],n[3])(Bu(i,1,r,a))}return s}static parse(t4,i){let[r,a,s,...n]=t4;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){let u=a[1];if(typeof u!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:u}}else if(a[0]==="cubic-bezier"){let u=a.slice(1);if(u.length!==4||u.some(h=>typeof h!="number"||h<0||h>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:u}}else return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);if(t4.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t4.length-1}.`);if((t4.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(s=i.parse(s,2,V),!s)return null;let o=[],l=null;(r==="interpolate-hcl"||r==="interpolate-lab")&&i.expectedType!=Ws?l=Pi:i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=0;u<n.length;u+=2){let h=n[u],c=n[u+1],d=u+3,p=u+4;if(typeof h!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(o.length&&o[o.length-1][0]>=h)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);let f=i.parse(c,p,l);if(!f)return null;l||(l=f.type),o.push([h,f])}return!_r(l,V)&&!_r(l,Cl)&&!_r(l,Pi)&&!_r(l,Al)&&!_r(l,Il)&&!_r(l,Ws)&&!_r(l,Ml)&&!_r(l,kt(V))?i.error(`Type ${Je(l)} is not interpolatable.`):new Ch(l,r,a,s,o,i.key)}evaluate(t4){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t4);let a=this.input.evaluate(t4);if(a<=i[0])return r[0].evaluate(t4);let s=i.length;if(a>=i[s-1])return r[s-1].evaluate(t4);let n=Fl(i,a,this.key),o=i[n],l=i[n+1],u=Ch.interpolationFactor(this.interpolation,a,o,l),h=r[n].evaluate(t4),c=r[n+1].evaluate(t4);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Er(h,c,u);case"color":return oe.interpolate(h,c,u);case"padding":return Ki.interpolate(h,c,u);case"colorArray":return _i.interpolate(h,c,u);case"numberArray":return Ji.interpolate(h,c,u);case"variableAnchorOffsetCollection":return Hi.interpolate(h,c,u,this.key);case"array":return Za(h,c,u);case"projectionDefinition":return Mr.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return oe.interpolate(h,c,u,"hcl");case"colorArray":return _i.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return oe.interpolate(h,c,u,"lab");case"colorArray":return _i.interpolate(h,c,u,"lab")}}}eachChild(t4){t4(this.input);for(let i of this.outputs)t4(i)}outputDefined(){return this.outputs.every(t4=>t4.outputDefined())}};function Bu(e,t4,i,r){let a=r-i,s=e-i;return a===0?0:t4===1?s/a:(t4**+s-1)/(t4**+a-1)}const He={color:oe.interpolate,number:Er,padding:Ki.interpolate,numberArray:Ji.interpolate,colorArray:_i.interpolate,variableAnchorOffsetCollection:Hi.interpolate,array:Za};var T_=class E_{constructor(t4){this.type=_n,this.sections=t4}static parse(t4,i){if(t4.length<2)return i.error("Expected at least one argument.");let r=t4[1];if(!Array.isArray(r)&&typeof r=="object")return i.error("First argument must be an image or text section.");let a=[],s=false;for(let n=1;n<=t4.length-1;++n){let o=t4[n];if(s&&typeof o=="object"&&!Array.isArray(o)){s=false;let l=null;if(o["font-scale"]&&(l=i.parse(o["font-scale"],1,V),!l))return null;let u=null;if(o["text-font"]&&(u=i.parse(o["text-font"],1,kt(ue)),!u))return null;let h=null;if(o["text-color"]&&(h=i.parse(o["text-color"],1,Pi),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!lb.includes(o["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o["vertical-align"]}' instead.`);if(c=i.parse(o["vertical-align"],1,ue),!c)return null}let d=a[a.length-1];d.scale=l,d.font=u,d.textColor=h,d.verticalAlign=c}else{let l=i.parse(t4[n],1,he);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=true,a.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new E_(a)}evaluate(t4){return new dr(this.sections.map(i=>{let r=i.content.evaluate(t4);return at(r)===yn?new Dh("",r,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(t4):null):new Dh($s(r),null,i.scale?i.scale.evaluate(t4):null,i.font?i.font.evaluate(t4).join(","):null,i.textColor?i.textColor.evaluate(t4):null,i.verticalAlign?i.verticalAlign.evaluate(t4):null)}))}eachChild(t4){for(let i of this.sections)t4(i.content),i.scale&&t4(i.scale),i.font&&t4(i.font),i.textColor&&t4(i.textColor),i.verticalAlign&&t4(i.verticalAlign)}outputDefined(){return false}};function S_(e,t4,i=0,r=e.length-1,a=db){for(;r>i;){if(r-i>600){let l=r-i+1,u=t4-i+1,h=Math.log(l),c=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);S_(e,t4,Math.max(i,Math.floor(t4-u*c/l+d)),Math.min(r,Math.floor(t4+(l-u)*c/l+d)),a)}let s=e[t4],n=i,o=r;for(_s(e,i,t4),a(e[r],s)>0&&_s(e,i,r);n<o;){for(_s(e,n,o),n++,o--;a(e[n],s)<0;)n++;for(;a(e[o],s)>0;)o--}a(e[i],s)===0?_s(e,i,o):(o++,_s(e,o,r)),o<=t4&&(i=o+1),t4<=o&&(r=o-1)}}function _s(e,t4,i){let r=e[t4];e[t4]=e[i],e[i]=r}function db(e,t4){return e<t4?-1:+(e>t4)}function zl(e,t4){if(e.length<=1)return[e];let i=[],r,a;for(let s of e){let n=fb(s);n!==0&&(s.area=Math.abs(n),a===void 0&&(a=n<0),a===n<0?(r&&i.push(r),r=[s]):r.push(s))}if(r&&i.push(r),t4>1)for(let s=0;s<i.length;s++)i[s].length<=t4||(S_(i[s],t4,1,i[s].length-1,pb),i[s]=i[s].slice(0,t4));return i}function pb(e,t4){return t4.area-e.area}function fb(e){let t4=0;for(let i=0,r=e.length,a=r-1,s,n;i<r;a=i++)s=e[i],n=e[a],t4+=(n.x-s.x)*(s.y+n.y);return t4}const Qn={string:ue,number:V,boolean:me,object:Wr};var ar=class D_{constructor(t4,i,r){this.type=t4,this.args=i,this.key=r}static parse(t4,i){if(t4.length<2)return i.error("Expected at least one argument.");let r=1,a,s=t4[0];if(s==="array"){let o;if(t4.length>2){let u=t4[1];if(typeof u!="string"||!(u in Qn)||u==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);o=Qn[u],r++}else o=he;let l;if(t4.length>3){if(t4[2]!==null&&(typeof t4[2]!="number"||t4[2]<0||t4[2]!==Math.floor(t4[2])))return i.error('The length argument to "array" must be a positive integer literal',2);l=t4[2],r++}a=kt(o,l)}else{if(!Qn[s])throw Error(`Types doesn't contain name = ${s}`);a=Qn[s]}let n=[];for(;r<t4.length;r++){let o=i.parse(t4[r],r,he);if(!o)return null;n.push(o)}return new D_(a,n,i.key)}evaluate(t4){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(t4);if(!Hs(this.type,at(r)))return r;if(i===this.args.length-1)throw new qe(`Expected value to be of type ${Je(this.type)}, but found ${Je(at(r))} instead.`,this.key)}throw Error()}eachChild(t4){this.args.forEach(t4)}outputDefined(){return this.args.every(t4=>t4.outputDefined())}};const sf={"to-boolean":me,"to-color":Pi,"to-number":V,"to-string":ue};var Fa=class C_{constructor(t4,i,r){this.type=t4,this.args=i,this.key=r}static parse(t4,i){if(t4.length<2)return i.error("Expected at least one argument.");let r=t4[0];if(!sf[r])throw Error(`Can't parse ${r} as it is not part of the known types`);if((r==="to-boolean"||r==="to-string")&&t4.length!==2)return i.error("Expected one argument.");let a=sf[r],s=[];for(let n=1;n<t4.length;n++){let o=i.parse(t4[n],n,he);if(!o)return null;s.push(o)}return new C_(a,s,i.key)}evaluate(t4){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t4);case"color":{let i,r;for(let a of this.args){if(i=a.evaluate(t4),r=null,i instanceof oe)return i;if(typeof i=="string"){let s=t4.parseColor(i);if(s)return s}else if(Array.isArray(i)&&(r=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:v_(i[0],i[1],i[2],i[3]),!r))return new oe(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new qe(r||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"padding":{let i;for(let r of this.args){i=r.evaluate(t4);let a=Ki.parse(i);if(a)return a}throw new qe(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"numberArray":{let i;for(let r of this.args){i=r.evaluate(t4);let a=Ji.parse(i);if(a)return a}throw new qe(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"colorArray":{let i;for(let r of this.args){i=r.evaluate(t4);let a=_i.parse(i);if(a)return a}throw new qe(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"variableAnchorOffsetCollection":{let i;for(let r of this.args){i=r.evaluate(t4);let a=Hi.parse(i);if(a)return a}throw new qe(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"number":{let i=null;for(let r of this.args){if(i=r.evaluate(t4),i===null)return 0;let a=Number(i);if(!isNaN(a))return a}throw new qe(`Could not convert ${JSON.stringify(i)} to number.`,this.key)}case"formatted":return dr.fromString($s(this.args[0].evaluate(t4)));case"resolvedImage":return Xi.fromString($s(this.args[0].evaluate(t4)));case"projectionDefinition":{let i=this.args[0].evaluate(t4);if(Mr.parse(i))return i;throw new qe(`Could not parse projectionDefinition from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}default:return $s(this.args[0].evaluate(t4))}}eachChild(t4){this.args.forEach(t4)}outputDefined(){return this.args.every(t4=>t4.outputDefined())}},P_=class A_{constructor(t4,i){this.type=i.type,this.bindings=[].concat(t4),this.result=i}evaluate(t4){return this.result.evaluate(t4)}eachChild(t4){for(let i of this.bindings)t4(i[1]);t4(this.result)}static parse(t4,i){if(t4.length<4)return i.error(`Expected at least 3 arguments, but found ${t4.length-1} instead.`);let r=[];for(let s=1;s<t4.length-1;s+=2){let n=t4[s];if(typeof n!="string")return i.error(`Expected string, but found ${typeof n} instead.`,s);if(/[^a-zA-Z0-9_]/.test(n))return i.error("Variable names must contain only alphanumeric characters or '_'.",s);let o=i.parse(t4[s+1],s+1);if(!o)return null;r.push([n,o])}let a=i.parse(t4[t4.length-1],t4.length-1,i.expectedType,r);return a?new A_(r,a):null}outputDefined(){return this.result.outputDefined()}},I_=class M_{constructor(t4,i){this.type=i.type,this.name=t4,this.boundExpression=i}static parse(t4,i){if(t4.length!==2||typeof t4[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");let r=t4[1];return i.scope.has(r)?new M_(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t4){return this.boundExpression.evaluate(t4)}eachChild(){}outputDefined(){return false}},mb=class F_{constructor(t4,i,r,a){this.type=t4,this.index=i,this.input=r,this.key=a}static parse(t4,i){if(t4.length!==3)return i.error(`Expected 2 arguments, but found ${t4.length-1} instead.`);let r=i.parse(t4[1],1,V),a=i.parse(t4[2],2,kt(i.expectedType||he));if(!r||!a)return null;let s=a.type;return new F_(s.itemType,r,a,i.key)}evaluate(t4){let i=this.index.evaluate(t4),r=this.input.evaluate(t4);if(i<0)throw new qe(`Array index out of bounds: ${i} < 0.`,this.key);if(i>=r.length)throw new qe(`Array index out of bounds: ${i} > ${r.length-1}.`,this.key);if(i!==Math.floor(i))throw new qe(`Array index must be an integer, but found ${i} instead.`,this.key);return r[i]}eachChild(t4){t4(this.index),t4(this.input)}outputDefined(){return false}},gb=class z_{constructor(t4,i,r){this.needle=t4,this.haystack=i,this.key=r,this.type=me}static parse(t4,i){if(t4.length!==3)return i.error(`Expected 2 arguments, but found ${t4.length-1} instead.`);let r=i.parse(t4[1],1,he),a=i.parse(t4[2],2,he);return!r||!a?null:td(r.type,[me,ue,V,gn,he])?new z_(r,a,i.key):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Je(r.type)} instead`)}evaluate(t4){let i=this.needle.evaluate(t4),r=this.haystack.evaluate(t4);if(!r)return false;if(!Hr(i,["boolean","string","number","null"]))throw new qe(`Expected first argument to be of type boolean, string, number or null, but found ${Je(at(i))} instead.`,this.key);if(!Hr(r,["string","array"]))throw new qe(`Expected second argument to be of type array or string, but found ${Je(at(r))} instead.`,this.key);return r.indexOf(i)>=0}eachChild(t4){t4(this.needle),t4(this.haystack)}outputDefined(){return true}},_b=class Ph{constructor(t4,i,r,a){this.needle=t4,this.haystack=i,this.key=r,this.fromIndex=a,this.type=V}static parse(t4,i){if(t4.length<=2||t4.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t4.length-1} instead.`);let r=i.parse(t4[1],1,he),a=i.parse(t4[2],2,he);if(!r||!a)return null;if(!td(r.type,[me,ue,V,gn,he]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Je(r.type)} instead`);if(t4.length===4){let s=i.parse(t4[3],3,V);return s?new Ph(r,a,i.key,s):null}return new Ph(r,a,i.key)}evaluate(t4){let i=this.needle.evaluate(t4),r=this.haystack.evaluate(t4);if(!Hr(i,["boolean","string","number","null"]))throw new qe(`Expected first argument to be of type boolean, string, number or null, but found ${Je(at(i))} instead.`,this.key);let a;if(this.fromIndex&&(a=this.fromIndex.evaluate(t4)),Hr(r,["string"])){let s=r.indexOf(i,a);return s===-1?-1:[...r.slice(0,s)].length}if(Hr(r,["array"]))return r.indexOf(i,a);throw new qe(`Expected second argument to be of type array or string, but found ${Je(at(r))} instead.`,this.key)}eachChild(t4){t4(this.needle),t4(this.haystack),this.fromIndex&&t4(this.fromIndex)}outputDefined(){return false}},yb=class R_{constructor(t4,i,r,a,s,n){this.inputType=t4,this.type=i,this.input=r,this.cases=a,this.outputs=s,this.otherwise=n}static parse(t4,i){if(t4.length<5)return i.error(`Expected at least 4 arguments, but found only ${t4.length-1}.`);if(t4.length%2!=1)return i.error("Expected an even number of arguments.");let r,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);let s={},n=[];for(let u=2;u<t4.length-1;u+=2){let h=t4[u],c=t4[u+1];Array.isArray(h)||(h=[h]);let d=i.concat(u);if(h.length===0)return d.error("Expected at least one branch label.");for(let f of h){if(typeof f!="number"&&typeof f!="string")return d.error("Branch labels must be numbers or strings.");if(typeof f=="number"&&Math.abs(f)>2**53-1)return d.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof f=="number"&&Math.floor(f)!==f)return d.error("Numeric branch labels must be integer values.");if(!r)r=at(f);else if(d.checkSubtype(r,at(f)))return null;if(s[String(f)]!==void 0)return d.error("Branch labels must be unique.");s[String(f)]=n.length}let p=i.parse(c,u,a);if(!p)return null;a||(a=p.type),n.push(p)}let o=i.parse(t4[1],1,he);if(!o)return null;let l=i.parse(t4[t4.length-1],t4.length-1,a);return!l||o.type.kind!=="value"&&i.concat(1).checkSubtype(r,o.type)?null:new R_(r,a,o,s,n,l)}evaluate(t4){let i=this.input.evaluate(t4);return(at(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(t4)}eachChild(t4){t4(this.input),this.outputs.forEach(t4),t4(this.otherwise)}outputDefined(){return this.outputs.every(t4=>t4.outputDefined())&&this.otherwise.outputDefined()}},vb=class k_{constructor(t4,i,r){this.type=t4,this.branches=i,this.otherwise=r}static parse(t4,i){if(t4.length<4)return i.error(`Expected at least 3 arguments, but found only ${t4.length-1}.`);if(t4.length%2!=0)return i.error("Expected an odd number of arguments.");let r;i.expectedType&&i.expectedType.kind!=="value"&&(r=i.expectedType);let a=[];for(let n=1;n<t4.length-1;n+=2){let o=i.parse(t4[n],n,me);if(!o)return null;let l=i.parse(t4[n+1],n+1,r);if(!l)return null;a.push([o,l]),r||(r=l.type)}let s=i.parse(t4[t4.length-1],t4.length-1,r);if(!s)return null;if(!r)throw Error("Can't infer output type");return new k_(r,a,s)}evaluate(t4){for(let[i,r]of this.branches)if(i.evaluate(t4))return r.evaluate(t4);return this.otherwise.evaluate(t4)}eachChild(t4){for(let[i,r]of this.branches)t4(i),t4(r);t4(this.otherwise)}outputDefined(){return this.branches.every(([t4,i])=>i.outputDefined())&&this.otherwise.outputDefined()}},xb=class Ah{constructor(t4,i,r,a,s){this.type=t4,this.input=i,this.beginIndex=r,this.key=a,this.endIndex=s}static parse(t4,i){if(t4.length<=2||t4.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t4.length-1} instead.`);let r=i.parse(t4[1],1,he),a=i.parse(t4[2],2,V);if(!r||!a)return null;if(!td(r.type,[kt(he),ue,he]))return i.error(`Expected first argument to be of type array or string, but found ${Je(r.type)} instead`);if(t4.length===4){let s=i.parse(t4[3],3,V);return s?new Ah(r.type,r,a,i.key,s):null}return new Ah(r.type,r,a,i.key)}evaluate(t4){let i=this.input.evaluate(t4),r=this.beginIndex.evaluate(t4),a;if(this.endIndex&&(a=this.endIndex.evaluate(t4)),Hr(i,["string"]))return[...i].slice(r,a).join("");if(Hr(i,["array"]))return i.slice(r,a);throw new qe(`Expected first argument to be of type array or string, but found ${Je(at(i))} instead.`,this.key)}eachChild(t4){t4(this.input),t4(this.beginIndex),this.endIndex&&t4(this.endIndex)}outputDefined(){return false}},L_=class Ih{constructor(t4,i){this.type=t4,this.args=i}static parse(t4,i){if(t4.length<2)return i.error("Expected at least one argument.");let r=null,a=i.expectedType;a&&a.kind!=="value"&&(r=a);let s=[];for(let n of t4.slice(1)){let o=i.parse(n,1+s.length,r,void 0,{typeAnnotation:"omit"});if(!o)return null;r||(r=o.type),s.push(o)}if(!r)throw Error("No output type");return a&&s.some(n=>Hs(a,n.type))?new Ih(he,s):new Ih(r,s)}evaluate(t4){let i=null,r=0,a;for(let s of this.args)if(r++,i=s.evaluate(t4),i&&i instanceof Xi&&!i.available&&(a||(a=i.name),i=null,r===this.args.length&&(i=a)),i!==null)break;return i}eachChild(t4){this.args.forEach(t4)}outputDefined(){return this.args.every(t4=>t4.outputDefined())}};function nf(e,t4){return e==="=="||e==="!="?t4.kind==="boolean"||t4.kind==="string"||t4.kind==="number"||t4.kind==="null"||t4.kind==="value":t4.kind==="string"||t4.kind==="number"||t4.kind==="value"}function bb(e,t4,i){return t4===i}function wb(e,t4,i){return t4!==i}function Tb(e,t4,i){return t4<i}function Eb(e,t4,i){return t4>i}function Sb(e,t4,i){return t4<=i}function Db(e,t4,i){return t4>=i}function B_(e,t4,i,r){return r.compare(t4,i)===0}function Cb(e,t4,i,r){return!B_(e,t4,i,r)}function Pb(e,t4,i,r){return r.compare(t4,i)<0}function Ab(e,t4,i,r){return r.compare(t4,i)>0}function Ib(e,t4,i,r){return r.compare(t4,i)<=0}function Mb(e,t4,i,r){return r.compare(t4,i)>=0}function ts(e,t4,i){let r=e!=="=="&&e!=="!=";return class O_{constructor(s,n,o,l){this.lhs=s,this.rhs=n,this.key=o,this.collator=l,this.type=me,this.hasUntypedArgument=s.type.kind==="value"||n.type.kind==="value"}static parse(s,n){if(s.length!==3&&s.length!==4)return n.error("Expected two or three arguments.");let o=s[0],l=n.parse(s[1],1,he);if(!l)return null;if(!nf(o,l.type))return n.concat(1).error(`"${o}" comparisons are not supported for type '${Je(l.type)}'.`);let u=n.parse(s[2],2,he);if(!u)return null;if(!nf(o,u.type))return n.concat(2).error(`"${o}" comparisons are not supported for type '${Je(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return n.error(`Cannot compare types '${Je(l.type)}' and '${Je(u.type)}'.`);r&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new ar(u.type,[l],n.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new ar(l.type,[u],n.key)));let h=null;if(s.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return n.error("Cannot use collator to compare non-string types.");if(h=n.parse(s[3],3,Pl),!h)return null}return new O_(l,u,n.key,h)}evaluate(s){let n=this.lhs.evaluate(s),o=this.rhs.evaluate(s);if(r&&this.hasUntypedArgument){let l=at(n),u=at(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new qe(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!r&&this.hasUntypedArgument){let l=at(n),u=at(o);if(l.kind!=="string"||u.kind!=="string")return t4(s,n,o)}return this.collator?i(s,n,o,this.collator.evaluate(s)):t4(s,n,o)}eachChild(s){s(this.lhs),s(this.rhs),this.collator&&s(this.collator)}outputDefined(){return true}}}const Fb=ts("==",bb,B_),zb=ts("!=",wb,Cb),Rb=ts("<",Tb,Pb),kb=ts(">",Eb,Ab),Lb=ts("<=",Sb,Ib),Bb=ts(">=",Db,Mb);var $_=class V_{constructor(t4,i,r){this.type=Pl,this.locale=r,this.caseSensitive=t4,this.diacriticSensitive=i}static parse(t4,i){if(t4.length!==2)return i.error("Expected one argument.");let r=t4[1];if(typeof r!="object"||Array.isArray(r))return i.error("Collator options argument must be an object.");let a=i.parse(r["case-sensitive"]!==void 0&&r["case-sensitive"],1,me);if(!a)return null;let s=i.parse(r["diacritic-sensitive"]!==void 0&&r["diacritic-sensitive"],1,me);if(!s)return null;let n=null;return r.locale&&(n=i.parse(r.locale,1,ue),!n)?null:new V_(a,s,n)}evaluate(t4){return new id(this.caseSensitive.evaluate(t4),this.diacriticSensitive.evaluate(t4),this.locale?this.locale.evaluate(t4):null)}eachChild(t4){t4(this.caseSensitive),t4(this.diacriticSensitive),this.locale&&t4(this.locale)}outputDefined(){return false}},Ob=class j_{constructor(t4,i,r,a,s,n){this.type=ue,this.number=t4,this.locale=i,this.currency=r,this.unit=a,this.minFractionDigits=s,this.maxFractionDigits=n}static parse(t4,i){if(t4.length!==3)return i.error("Expected two arguments.");let r=i.parse(t4[1],1,V);if(!r)return null;let a=t4[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let s=null;if(a.locale&&(s=i.parse(a.locale,1,ue),!s))return null;let n=null;if(a.currency&&(n=i.parse(a.currency,1,ue),!n))return null;let o=null;if(a.unit&&(o=i.parse(a.unit,1,ue),!o))return null;if(n&&o)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(a["min-fraction-digits"]&&(l=i.parse(a["min-fraction-digits"],1,V),!l))return null;let u=null;return a["max-fraction-digits"]&&(u=i.parse(a["max-fraction-digits"],1,V),!u)?null:new j_(r,s,n,o,l,u)}evaluate(t4){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t4):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t4):void 0,unit:this.unit?this.unit.evaluate(t4):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t4):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t4):void 0}).format(this.number.evaluate(t4))}eachChild(t4){t4(this.number),this.locale&&t4(this.locale),this.currency&&t4(this.currency),this.unit&&t4(this.unit),this.minFractionDigits&&t4(this.minFractionDigits),this.maxFractionDigits&&t4(this.maxFractionDigits)}outputDefined(){return false}},$b=class U_{constructor(t4){this.type=yn,this.input=t4}static parse(t4,i){if(t4.length!==2)return i.error("Expected two arguments.");let r=i.parse(t4[1],1,ue);return r?new U_(r):i.error("No image name provided.")}evaluate(t4){let i=this.input.evaluate(t4),r=Xi.fromString(i);return r&&t4.availableImages&&(r.available=t4.availableImages.indexOf(i)>-1),r}eachChild(t4){t4(this.input)}outputDefined(){return false}},Vb=class N_{constructor(t4,i){this.input=t4,this.key=i,this.type=V}static parse(t4,i){if(t4.length!==2)return i.error(`Expected 1 argument, but found ${t4.length-1} instead.`);let r=i.parse(t4[1],1);return r?r.type.kind!=="array"&&r.type.kind!=="string"&&r.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${Je(r.type)} instead.`):new N_(r,i.key):null}evaluate(t4){let i=this.input.evaluate(t4);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new qe(`Expected value to be of type string or array, but found ${Je(at(i))} instead.`,this.key)}eachChild(t4){t4(this.input)}outputDefined(){return false}};const Zi=8192;function jb(e,t4){let i=Ub(e[0]),r=Gb(e[1]),a=2**t4.z;return[Math.round(i*a*Zi),Math.round(r*a*Zi)]}function ad(e,t4){let i=2**t4.z,r=(e[0]/Zi+t4.x)/i,a=(e[1]/Zi+t4.y)/i;return[Nb(r),Zb(a)]}function Ub(e){return(180+e)/360}function Nb(e){return e*360-180}function Gb(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Zb(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function vn(e,t4){e[0]=Math.min(e[0],t4[0]),e[1]=Math.min(e[1],t4[1]),e[2]=Math.max(e[2],t4[0]),e[3]=Math.max(e[3],t4[1])}function Xs(e,t4){return!(e[0]<=t4[0]||e[2]>=t4[2]||e[1]<=t4[1]||e[3]>=t4[3])}function qb(e,t4,i){return t4[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t4[0])*(e[1]-t4[1])/(i[1]-t4[1])+t4[0]}function Wb(e,t4,i){let r=e[0]-t4[0],a=e[1]-t4[1],s=e[0]-i[0],n=e[1]-i[1];return r*n-s*a===0&&r*s<=0&&a*n<=0}function Rl(e,t4,i,r){let a=[t4[0]-e[0],t4[1]-e[1]];return Kb([r[0]-i[0],r[1]-i[1]],a)!==0&&!!(of(e,t4,i,r)&&of(i,r,e,t4))}function Hb(e,t4,i){for(let r of i)for(let a=0;a<r.length-1;++a)if(Rl(e,t4,r[a],r[a+1]))return true;return false}function is(e,t4,i=false){let r=false;for(let a of t4)for(let s=0;s<a.length-1;s++){if(Wb(e,a[s],a[s+1]))return i;qb(e,a[s],a[s+1])&&(r=!r)}return r}function Xb(e,t4){for(let i of t4)if(is(e,i))return true;return false}function G_(e,t4){for(let i of e)if(!is(i,t4))return false;for(let i=0;i<e.length-1;++i)if(Hb(e[i],e[i+1],t4))return false;return true}function Yb(e,t4){for(let i of t4)if(G_(e,i))return true;return false}function Kb(e,t4){return e[0]*t4[1]-e[1]*t4[0]}function of(e,t4,i,r){let a=e[0]-i[0],s=e[1]-i[1],n=t4[0]-i[0],o=t4[1]-i[1],l=r[0]-i[0],u=r[1]-i[1],h=a*u-l*s,c=n*u-l*o;return h>0&&c<0||h<0&&c>0}function sd(e,t4,i){let r=[];for(let a=0;a<e.length;a++){let s=[];for(let n=0;n<e[a].length;n++){let o=jb(e[a][n],i);vn(t4,o),s.push(o)}r.push(s)}return r}function Z_(e,t4,i){let r=[];for(let a=0;a<e.length;a++){let s=sd(e[a],t4,i);r.push(s)}return r}function q_(e,t4,i,r){if(e[0]<i[0]||e[0]>i[2]){let a=r*.5,s=e[0]-i[0]>a?-r:i[0]-e[0]>a?r:0;s===0&&(s=e[0]-i[2]>a?-r:i[2]-e[0]>a?r:0),e[0]+=s}vn(t4,e)}function Jb(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function lf(e,t4,i,r){let a=2**r.z*Zi,s=[r.x*Zi,r.y*Zi],n=[];for(let o of e)for(let l of o){let u=[l.x+s[0],l.y+s[1]];q_(u,t4,i,a),n.push(u)}return n}function uf(e,t4,i,r){let a=2**r.z*Zi,s=[r.x*Zi,r.y*Zi],n=[];for(let o of e){let l=[];for(let u of o){let h=[u.x+s[0],u.y+s[1]];vn(t4,h),l.push(h)}n.push(l)}if(t4[2]-t4[0]<=a/2){Jb(t4);for(let o of n)for(let l of o)q_(l,t4,i,a)}return n}function Qb(e,t4){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(t4.type==="Polygon"){let s=sd(t4.coordinates,r,a),n=lf(e.geometry(),i,r,a);if(!Xs(i,r))return false;for(let o of n)if(!is(o,s))return false}if(t4.type==="MultiPolygon"){let s=Z_(t4.coordinates,r,a),n=lf(e.geometry(),i,r,a);if(!Xs(i,r))return false;for(let o of n)if(!Xb(o,s))return false}return true}function ew(e,t4){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(t4.type==="Polygon"){let s=sd(t4.coordinates,r,a),n=uf(e.geometry(),i,r,a);if(!Xs(i,r))return false;for(let o of n)if(!G_(o,s))return false}if(t4.type==="MultiPolygon"){let s=Z_(t4.coordinates,r,a),n=uf(e.geometry(),i,r,a);if(!Xs(i,r))return false;for(let o of n)if(!Yb(o,s))return false}return true}var nd=class zo{constructor(t4,i){this.type=me,this.geojson=t4,this.geometries=i}static parse(t4,i){if(t4.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${t4.length-1} instead.`);if(qa(t4[1])){let r=t4[1];if(r.type==="FeatureCollection"){let a=[];for(let s of r.features){let{type:n,coordinates:o}=s.geometry;n==="Polygon"&&a.push(o),n==="MultiPolygon"&&a.push(...o)}if(a.length)return new zo(r,{type:"MultiPolygon",coordinates:a})}else if(r.type==="Feature"){let a=r.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new zo(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new zo(r,r)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t4){if(t4.geometry()!=null&&t4.canonicalID()!=null){if(t4.geometryType()==="Point")return Qb(t4,this.geometries);if(t4.geometryType()==="LineString")return ew(t4,this.geometries)}return false}eachChild(){}outputDefined(){return true}},W_=class{constructor(t4=[],i=(r,a)=>r<a?-1:+(r>a)){if(this.data=t4,this.length=this.data.length,this.compare=i,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t4){this.data.push(t4),this._up(this.length++)}pop(){if(this.length===0)return;let t4=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),t4}peek(){return this.data[0]}_up(t4){let{data:i,compare:r}=this,a=i[t4];for(;t4>0;){let s=t4-1>>1,n=i[s];if(r(a,n)>=0)break;i[t4]=n,t4=s}i[t4]=a}_down(t4){let{data:i,compare:r}=this,a=this.length>>1,s=i[t4];for(;t4<a;){let n=(t4<<1)+1,o=n+1;if(o<this.length&&r(i[o],i[n])<0&&(n=o),r(i[n],s)>=0)break;i[t4]=i[n],t4=n}i[t4]=s}};const hf=Math.PI/180;var od=class{constructor(t4){let i=hf*6378.137*1e3,r=Math.cos(t4*hf),a=1/(1-.0066943799901413165*(1-r*r)),s=Math.sqrt(a);this.kx=i*s*r,this.ky=i*s*a*.9933056200098587}distance(t4,i){let r=this.wrap(t4[0]-i[0])*this.kx,a=(t4[1]-i[1])*this.ky;return Math.sqrt(r*r+a*a)}pointOnLine(t4,i){let r=1/0,a,s,n,o;for(let l=0;l<t4.length-1;l++){let u=t4[l][0],h=t4[l][1],c=this.wrap(t4[l+1][0]-u)*this.kx,d=(t4[l+1][1]-h)*this.ky,p=0;(c!==0||d!==0)&&(p=(this.wrap(i[0]-u)*this.kx*c+(i[1]-h)*this.ky*d)/(c*c+d*d),p>1?(u=t4[l+1][0],h=t4[l+1][1]):p>0&&(u+=c/this.kx*p,h+=d/this.ky*p)),c=this.wrap(i[0]-u)*this.kx,d=(i[1]-h)*this.ky;let f=c*c+d*d;f<r&&(r=f,a=u,s=h,n=l,o=p)}return{point:[a,s],index:n,t:Math.max(0,Math.min(1,o))}}wrap(t4){for(;t4<-180;)t4+=360;for(;t4>180;)t4-=360;return t4}};function H_(e,t4){return t4[0]-e[0]}function Ho(e){return e[1]-e[0]+1}function pr(e,t4){return e[1]>=e[0]&&e[1]<t4}function Mh(e,t4){if(e[0]>e[1])return[null,null];let i=Ho(e);if(t4){if(i===2)return[e,null];let a=Math.floor(i/2);return[[e[0],e[0]+a],[e[0]+a,e[1]]]}if(i===1)return[e,null];let r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function Fh(e,t4){if(!pr(t4,e.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=t4[0];r<=t4[1];++r)vn(i,e[r]);return i}function zh(e){let t4=[1/0,1/0,-1/0,-1/0];for(let i of e)for(let r of i)vn(t4,r);return t4}function cf(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function ld(e,t4,i){if(!cf(e)||!cf(t4))return NaN;let r=0,a=0;return e[2]<t4[0]&&(r=t4[0]-e[2]),e[0]>t4[2]&&(r=e[0]-t4[2]),e[1]>t4[3]&&(a=e[1]-t4[3]),e[3]<t4[1]&&(a=t4[1]-e[3]),i.distance([0,0],[r,a])}function Ur(e,t4,i){let r=i.pointOnLine(t4,e);return i.distance(e,r.point)}function ud(e,t4,i,r,a){let s=Math.min(Ur(e,[i,r],a),Ur(t4,[i,r],a)),n=Math.min(Ur(i,[e,t4],a),Ur(r,[e,t4],a));return Math.min(s,n)}function tw(e,t4,i,r,a){if(!(pr(t4,e.length)&&pr(r,i.length)))return 1/0;let s=1/0;for(let n=t4[0];n<t4[1];++n){let o=e[n],l=e[n+1];for(let u=r[0];u<r[1];++u){let h=i[u],c=i[u+1];if(Rl(o,l,h,c))return 0;s=Math.min(s,ud(o,l,h,c,a))}}return s}function iw(e,t4,i,r,a){if(!(pr(t4,e.length)&&pr(r,i.length)))return NaN;let s=1/0;for(let n=t4[0];n<=t4[1];++n)for(let o=r[0];o<=r[1];++o)if(s=Math.min(s,a.distance(e[n],i[o])),s===0)return s;return s}function rw(e,t4,i){if(is(e,t4,true))return 0;let r=1/0;for(let a of t4){let s=a[0],n=a[a.length-1];if(s!==n&&(r=Math.min(r,Ur(e,[n,s],i)),r===0))return r;let o=i.pointOnLine(a,e);if(r=Math.min(r,i.distance(e,o.point)),r===0)return r}return r}function aw(e,t4,i,r){if(!pr(t4,e.length))return NaN;for(let s=t4[0];s<=t4[1];++s)if(is(e[s],i,true))return 0;let a=1/0;for(let s=t4[0];s<t4[1];++s){let n=e[s],o=e[s+1];for(let l of i)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let d=l[c],p=l[u];if(Rl(n,o,d,p))return 0;a=Math.min(a,ud(n,o,d,p,r))}}return a}function df(e,t4){for(let i of e)for(let r of i)if(is(r,t4,true))return true;return false}function sw(e,t4,i,r=1/0){let a=zh(e),s=zh(t4);if(r!==1/0&&ld(a,s,i)>=r)return r;if(Xs(a,s)){if(df(e,t4))return 0}else if(df(t4,e))return 0;let n=1/0;for(let o of e)for(let l=0,u=o.length,h=u-1;l<u;h=l++){let c=o[h],d=o[l];for(let p of t4)for(let f=0,m=p.length,g=m-1;f<m;g=f++){let _=p[g],y=p[f];if(Rl(c,d,_,y))return 0;n=Math.min(n,ud(c,d,_,y,i))}}return n}function pf(e,t4,i,r,a,s){if(!s)return;let n=ld(Fh(r,s),a,i);n<t4&&e.push([n,s,[0,0]])}function eo(e,t4,i,r,a,s,n){if(!s||!n)return;let o=ld(Fh(r,s),Fh(a,n),i);o<t4&&e.push([o,s,n])}function Xo(e,t4,i,r,a=1/0){let s=Math.min(r.distance(e[0],i[0][0]),a);if(s===0)return s;let n=new W_([[0,[0,e.length-1],[0,0]]],H_),o=zh(i);for(;n.length>0;){let l=n.pop();if(l[0]>=s)continue;let u=l[1],h=t4?50:100;if(Ho(u)<=h){if(!pr(u,e.length))return NaN;if(t4){let c=aw(e,u,i,r);if(isNaN(c)||c===0)return c;s=Math.min(s,c)}else for(let c=u[0];c<=u[1];++c){let d=rw(e[c],i,r);if(s=Math.min(s,d),s===0)return 0}}else{let c=Mh(u,t4);pf(n,s,r,e,o,c[0]),pf(n,s,r,e,o,c[1])}}return s}function Yo(e,t4,i,r,a,s=1/0){let n=Math.min(s,a.distance(e[0],i[0]));if(n===0)return n;let o=new W_([[0,[0,e.length-1],[0,i.length-1]]],H_);for(;o.length>0;){let l=o.pop();if(l[0]>=n)continue;let u=l[1],h=l[2],c=t4?50:100,d=r?50:100;if(Ho(u)<=c&&Ho(h)<=d){if(!pr(u,e.length)&&pr(h,i.length))return NaN;let p;if(t4&&r)p=tw(e,u,i,h,a),n=Math.min(n,p);else if(t4&&!r){let f=e.slice(u[0],u[1]+1);for(let m=h[0];m<=h[1];++m)if(p=Ur(i[m],f,a),n=Math.min(n,p),n===0)return n}else if(!t4&&r){let f=i.slice(h[0],h[1]+1);for(let m=u[0];m<=u[1];++m)if(p=Ur(e[m],f,a),n=Math.min(n,p),n===0)return n}else p=iw(e,u,i,h,a),n=Math.min(n,p)}else{let p=Mh(u,t4),f=Mh(h,r);eo(o,n,a,e,i,p[0],f[0]),eo(o,n,a,e,i,p[0],f[1]),eo(o,n,a,e,i,p[1],f[0]),eo(o,n,a,e,i,p[1],f[1])}}return n}function nw(e,t4){let i=e.geometry(),r=i.flat().map(n=>ad([n.x,n.y],e.canonical));if(i.length===0)return NaN;let a=new od(r[0][1]),s=1/0;for(let n of t4){switch(n.type){case"Point":s=Math.min(s,Yo(r,false,[n.coordinates],false,a,s));break;case"LineString":s=Math.min(s,Yo(r,false,n.coordinates,true,a,s));break;case"Polygon":s=Math.min(s,Xo(r,false,n.coordinates,a,s))}if(s===0)return s}return s}function ow(e,t4){let i=e.geometry(),r=i.flat().map(n=>ad([n.x,n.y],e.canonical));if(i.length===0)return NaN;let a=new od(r[0][1]),s=1/0;for(let n of t4){switch(n.type){case"Point":s=Math.min(s,Yo(r,true,[n.coordinates],false,a,s));break;case"LineString":s=Math.min(s,Yo(r,true,n.coordinates,true,a,s));break;case"Polygon":s=Math.min(s,Xo(r,true,n.coordinates,a,s))}if(s===0)return s}return s}function lw(e,t4){let i=e.geometry();if(i.length===0||i[0].length===0)return NaN;let r=zl(i,0).map(n=>n.map(o=>o.map(l=>ad([l.x,l.y],e.canonical)))),a=new od(r[0][0][0][1]),s=1/0;for(let n of t4)for(let o of r){switch(n.type){case"Point":s=Math.min(s,Xo([n.coordinates],false,o,a,s));break;case"LineString":s=Math.min(s,Xo(n.coordinates,true,o,a,s));break;case"Polygon":s=Math.min(s,sw(o,n.coordinates,a,s))}if(s===0)return s}return s}function Ou(e){return e.type==="MultiPolygon"?e.coordinates.map(t4=>({type:"Polygon",coordinates:t4})):e.type==="MultiLineString"?e.coordinates.map(t4=>({type:"LineString",coordinates:t4})):e.type==="MultiPoint"?e.coordinates.map(t4=>({type:"Point",coordinates:t4})):[e]}var hd=class Ro{constructor(t4,i){this.type=V,this.geojson=t4,this.geometries=i}static parse(t4,i){if(t4.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${t4.length-1} instead.`);if(qa(t4[1])){let r=t4[1];if(r.type==="FeatureCollection")return new Ro(r,r.features.map(a=>Ou(a.geometry)).flat());if(r.type==="Feature")return new Ro(r,Ou(r.geometry));if("type"in r&&"coordinates"in r)return new Ro(r,Ou(r))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t4){if(t4.geometry()!=null&&t4.canonicalID()!=null){if(t4.geometryType()==="Point")return nw(t4,this.geometries);if(t4.geometryType()==="LineString")return ow(t4,this.geometries);if(t4.geometryType()==="Polygon")return lw(t4,this.geometries)}return NaN}eachChild(){}outputDefined(){return true}},uw=class X_{constructor(t4){let i=null;for(let r of t4)if(!i)i=r.type;else{if(i===r.type)continue;i=he;break}this.type=kt(i??he,t4.length),this.arr=t4}static parse(t4,i){if(t4.length!==2)return i.error(`'semiliteral' expression requires exactly one argument, but found ${t4.length-1} instead.`);if(!qa(t4[1]))return i.error(`invalid value of type "${typeof t4[1]}"`);let r=t4[1],a=at(r);if(a.kind==="array"){let s=r,n=i.concat(1),o=[];for(let l=0;l<s.length;l++){let u=n.parse(s[l],l,he);if(!u)return null;o.push(u)}return new X_(o)}return new Wa(a,r)}evaluate(t4){return this.arr.map(i=>i.evaluate(t4))}eachChild(t4){this.arr.forEach(t4)}outputDefined(){return this.arr.every(t4=>t4.outputDefined())}},cd=class Y_{constructor(t4){this.key=t4,this.type=he}static parse(t4,i){if(t4.length!==2)return i.error(`Expected 1 argument, but found ${t4.length-1} instead.`);let r=t4[1];return r==null?i.error("Global state property must be defined."):typeof r=="string"?new Y_(r):i.error(`Global state property must be string, but found ${typeof t4[1]} instead.`)}evaluate(t4){var r;let i=(r=t4.globals)==null?void 0:r.globalState;return!i||Object.keys(i).length===0?null:Os(i,this.key)??null}eachChild(){}outputDefined(){return false}};const La={"==":Fb,"!=":zb,">":kb,"<":Rb,">=":Bb,"<=":Lb,array:ar,at:mb,boolean:ar,case:vb,coalesce:L_,collator:$_,format:T_,image:$b,in:gb,"index-of":_b,interpolate:yi,"interpolate-hcl":yi,"interpolate-lab":yi,length:Vb,let:P_,literal:Wa,match:yb,number:ar,"number-format":Ob,object:ar,semiliteral:uw,slice:xb,step:rd,string:ar,"to-boolean":Fa,"to-color":Fa,"to-number":Fa,"to-string":Fa,var:I_,within:nd,distance:hd,"global-state":cd};var ji=class extends Error{constructor(t4,i){super(i),this.message=i,this.key=t4}},hw=class K_{constructor(t4,i=[]){this.parent=t4,this.bindings={};for(let[r,a]of i)this.bindings[r]=a}concat(t4){return new K_(this,t4)}get(t4){if(this.bindings[t4])return this.bindings[t4];if(this.parent)return this.parent.get(t4);throw Error(`${t4} not found in scope.`)}has(t4){return this.bindings[t4]?true:this.parent?this.parent.has(t4):false}},J_=class Q_{constructor(t4,i,r=[],a,s=new hw,n=[]){this.registry=t4,this.path=r,this.key=r.map(o=>`[${o}]`).join(""),this.scope=s,this.errors=n,this.expectedType=a,this._isConstant=i}parse(t4,i,r,a,s={}){return i==null?this._parse(t4,s):this.concat(i,r,a)._parse(t4,s)}_parse(t4,i){(t4===null||typeof t4=="string"||typeof t4=="boolean"||typeof t4=="number")&&(t4=["literal",t4]);let r=this.key;function a(s,n,o){return o==="assert"?new ar(n,[s],r):o==="coerce"?new Fa(n,[s],r):s}if(Array.isArray(t4)){if(t4.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let s=t4[0];if(typeof s!="string")return this.error(`Expression name must be a string, but found ${typeof s} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let n=this.registry[s];if(n){let o=n.parse(t4,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind==="string"||l.kind==="number"||l.kind==="boolean"||l.kind==="object"||l.kind==="array")&&u.kind==="value")o=a(o,l,i.typeAnnotation||"assert");else if(l.kind==="projectionDefinition"&&["string","array","value"].includes(u.kind)||["color","formatted","resolvedImage"].includes(l.kind)&&["value","string"].includes(u.kind)||["padding","numberArray"].includes(l.kind)&&["value","number","array"].includes(u.kind)||l.kind==="colorArray"&&["value","string","array"].includes(u.kind)||l.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(u.kind))o=a(o,l,i.typeAnnotation||"coerce");else if(this.checkSubtype(l,u))return null}if(!(o instanceof Wa)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new b_;try{o=new Wa(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0)}return t4===void 0?this.error("'undefined' value invalid. Use null instead."):typeof t4=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t4} instead.`)}concat(t4,i,r){let a=typeof t4=="number"?this.path.concat(t4):this.path,s=r?this.scope.concat(r):this.scope;return new Q_(this.registry,this._isConstant,a,i||null,s,this.errors)}error(t4,...i){let r=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new ji(r,t4))}checkSubtype(t4,i){let r=Hs(t4,i);return r&&this.error(r),r}},sa=class Rs{constructor(t4,i,r,a,s){this.name=t4,this.type=i,this._evaluate=r,this.args=a,this.key=s}evaluate(t4){return this._evaluate(t4,this.args,this.key)}eachChild(t4){this.args.forEach(t4)}outputDefined(){return false}static parse(t4,i){let r=t4[0],a=Rs.definitions[r];if(!a)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let s=Array.isArray(a)?a[0]:a.type,n=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,o=n.filter(([u])=>!Array.isArray(u)||u.length===t4.length-1),l=null;for(let[u,h]of o){l=new J_(i.registry,Ko,i.path,null,i.scope);let c=[],d=false;for(let p=1;p<t4.length;p++){let f=t4[p],m=Array.isArray(u)?u[p-1]:u.type,g=l.parse(f,1+c.length,m);if(!g){d=true;break}c.push(g)}if(!d){if(Array.isArray(u)&&u.length!==c.length){l.error(`Expected ${u.length} arguments, but found ${c.length} instead.`);continue}for(let p=0;p<c.length;p++){let f=Array.isArray(u)?u[p]:u.type,m=c[p];l.concat(p+1).checkSubtype(f,m.type)}if(l.errors.length===0)return new Rs(r,s,h,c,i.key)}}if(o.length===1)i.errors.push(...l.errors);else{let u=(o.length?o:n).map(([c])=>dw(c)).join(" | "),h=[];for(let c=1;c<t4.length;c++){let d=i.parse(t4[c],1+h.length);if(!d)return null;h.push(Je(d.type))}i.error(`Expected arguments of type ${u}, but found (${h.join(", ")}) instead.`)}return null}static register(t4,i){Rs.definitions=i;for(let r in i)t4[r]=Rs}};function ff(e,[t4,i,r,a],s){t4=t4.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);let n=a?a.evaluate(e):1,o=v_(t4,i,r,n);if(o)throw new qe(o,s);return new oe(t4/255,i/255,r/255,n,false)}function mf(e,t4){return e in t4&&t4[e]!==void 0}function $u(e,t4){let i=t4[e];return i===void 0?null:i}function cw(e,t4,i,r){for(;i<=r;){let a=i+r>>1;if(t4[a]===e)return true;t4[a]>e?r=a-1:i=a+1}return false}function Rr(e){return{type:e}}sa.register(La,{error:[Kx,[ue],(e,[t4],i)=>{throw new qe(t4.evaluate(e),i)}],typeof:[ue,[he],(e,[t4])=>Je(at(t4.evaluate(e)))],"to-rgba":[kt(V,4),[Pi],(e,[t4])=>{let[i,r,a,s]=t4.evaluate(e).rgb;return[i*255,r*255,a*255,s]}],rgb:[Pi,[V,V,V],ff],rgba:[Pi,[V,V,V,V],ff],has:{type:me,overloads:[[[ue],(e,[t4])=>mf(t4.evaluate(e),e.properties())],[[ue,Wr],(e,[t4,i])=>mf(t4.evaluate(e),i.evaluate(e))]]},get:{type:he,overloads:[[[ue],(e,[t4])=>$u(t4.evaluate(e),e.properties())],[[ue,Wr],(e,[t4,i])=>$u(t4.evaluate(e),i.evaluate(e))]]},"feature-state":[he,[ue],(e,[t4])=>$u(t4.evaluate(e),e.featureState||{})],properties:[Wr,[],e=>e.properties()],"geometry-type":[ue,[],e=>e.geometryType()],id:[he,[],e=>e.id()],zoom:[V,[],e=>e.globals.zoom],"heatmap-density":[V,[],e=>e.globals.heatmapDensity||0],elevation:[V,[],e=>e.globals.elevation||0],"line-progress":[V,[],e=>e.globals.lineProgress||0],accumulated:[he,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[V,Rr(V),(e,t4)=>{let i=0;for(let r of t4)i+=r.evaluate(e);return i}],"*":[V,Rr(V),(e,t4)=>{let i=1;for(let r of t4)i*=r.evaluate(e);return i}],"-":{type:V,overloads:[[[V,V],(e,[t4,i])=>t4.evaluate(e)-i.evaluate(e)],[[V],(e,[t4])=>-t4.evaluate(e)]]},"/":[V,[V,V],(e,[t4,i])=>t4.evaluate(e)/i.evaluate(e)],"%":[V,[V,V],(e,[t4,i])=>t4.evaluate(e)%i.evaluate(e)],ln2:[V,[],()=>Math.LN2],pi:[V,[],()=>Math.PI],e:[V,[],()=>Math.E],"^":[V,[V,V],(e,[t4,i])=>t4.evaluate(e)**+i.evaluate(e)],sqrt:[V,[V],(e,[t4])=>Math.sqrt(t4.evaluate(e))],log10:[V,[V],(e,[t4])=>Math.log(t4.evaluate(e))/Math.LN10],ln:[V,[V],(e,[t4])=>Math.log(t4.evaluate(e))],log2:[V,[V],(e,[t4])=>Math.log(t4.evaluate(e))/Math.LN2],sin:[V,[V],(e,[t4])=>Math.sin(t4.evaluate(e))],cos:[V,[V],(e,[t4])=>Math.cos(t4.evaluate(e))],tan:[V,[V],(e,[t4])=>Math.tan(t4.evaluate(e))],asin:[V,[V],(e,[t4])=>Math.asin(t4.evaluate(e))],acos:[V,[V],(e,[t4])=>Math.acos(t4.evaluate(e))],atan:[V,[V],(e,[t4])=>Math.atan(t4.evaluate(e))],min:[V,Rr(V),(e,t4)=>Math.min(...t4.map(i=>i.evaluate(e)))],max:[V,Rr(V),(e,t4)=>Math.max(...t4.map(i=>i.evaluate(e)))],abs:[V,[V],(e,[t4])=>Math.abs(t4.evaluate(e))],round:[V,[V],(e,[t4])=>{let i=t4.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[V,[V],(e,[t4])=>Math.floor(t4.evaluate(e))],ceil:[V,[V],(e,[t4])=>Math.ceil(t4.evaluate(e))],"filter-==":[me,[ue,he],(e,[t4,i])=>e.properties()[t4.value]===i.value],"filter-id-==":[me,[he],(e,[t4])=>e.id()===t4.value],"filter-type-==":[me,[ue],(e,[t4])=>e.geometryType()===t4.value],"filter-<":[me,[ue,he],(e,[t4,i])=>{let r=e.properties()[t4.value],a=i.value;return typeof r==typeof a&&r<a}],"filter-id-<":[me,[he],(e,[t4])=>{let i=e.id(),r=t4.value;return typeof i==typeof r&&i<r}],"filter->":[me,[ue,he],(e,[t4,i])=>{let r=e.properties()[t4.value],a=i.value;return typeof r==typeof a&&r>a}],"filter-id->":[me,[he],(e,[t4])=>{let i=e.id(),r=t4.value;return typeof i==typeof r&&i>r}],"filter-<=":[me,[ue,he],(e,[t4,i])=>{let r=e.properties()[t4.value],a=i.value;return typeof r==typeof a&&r<=a}],"filter-id-<=":[me,[he],(e,[t4])=>{let i=e.id(),r=t4.value;return typeof i==typeof r&&i<=r}],"filter->=":[me,[ue,he],(e,[t4,i])=>{let r=e.properties()[t4.value],a=i.value;return typeof r==typeof a&&r>=a}],"filter-id->=":[me,[he],(e,[t4])=>{let i=e.id(),r=t4.value;return typeof i==typeof r&&i>=r}],"filter-has":[me,[he],(e,[t4])=>{let i=t4.value,r=e.properties();return i in r&&r[i]!==void 0}],"filter-has-id":[me,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[me,[kt(ue)],(e,[t4])=>t4.value.indexOf(e.geometryType())>=0],"filter-id-in":[me,[kt(he)],(e,[t4])=>t4.value.indexOf(e.id())>=0],"filter-in-small":[me,[ue,kt(he)],(e,[t4,i])=>i.value.indexOf(e.properties()[t4.value])>=0],"filter-in-large":[me,[ue,kt(he)],(e,[t4,i])=>cw(e.properties()[t4.value],i.value,0,i.value.length-1)],all:{type:me,overloads:[[[me,me],(e,[t4,i])=>t4.evaluate(e)&&i.evaluate(e)],[Rr(me),(e,t4)=>{for(let i of t4)if(!i.evaluate(e))return false;return true}]]},any:{type:me,overloads:[[[me,me],(e,[t4,i])=>t4.evaluate(e)||i.evaluate(e)],[Rr(me),(e,t4)=>{for(let i of t4)if(i.evaluate(e))return true;return false}]]},"!":[me,[me],(e,[t4])=>!t4.evaluate(e)],"is-supported-script":[me,[ue],(e,[t4])=>{let i=e.globals&&e.globals.isSupportedScript;return!i||i(t4.evaluate(e))}],upcase:[ue,[ue],(e,[t4])=>t4.evaluate(e).toUpperCase()],downcase:[ue,[ue],(e,[t4])=>t4.evaluate(e).toLowerCase()],concat:[ue,Rr(he),(e,t4)=>t4.map(i=>$s(i.evaluate(e))).join("")],split:[kt(ue),[ue,ue],(e,[t4,i])=>t4.evaluate(e).split(i.evaluate(e))],join:[ue,[kt(ue),ue],(e,[t4,i])=>t4.evaluate(e).join(i.evaluate(e))],"resolved-locale":[ue,[Pl],(e,[t4])=>t4.evaluate(e).resolvedLocale()]});function dw(e){return Array.isArray(e)?`(${e.map(Je).join(", ")})`:`(${Je(e.type)}...)`}function Ko(e){if(e instanceof I_)return Ko(e.boundExpression);if(e instanceof sa&&e.name==="error"||e instanceof $_||e instanceof nd||e instanceof hd||e instanceof cd)return false;let t4=e instanceof Fa||e instanceof ar,i=true;return e.eachChild(r=>{i&&(i=t4?Ko(r):r instanceof Wa)}),i?kl(e)&&Ll(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):false}function kl(e){if(e instanceof sa&&(e.name==="get"&&e.args.length===1||e.name==="feature-state"||e.name==="has"&&e.args.length===1||e.name==="properties"||e.name==="geometry-type"||e.name==="id"||/^filter-/.test(e.name))||e instanceof nd||e instanceof hd)return false;let t4=true;return e.eachChild(i=>{t4&&!kl(i)&&(t4=false)}),t4}function Ys(e){if(e instanceof sa&&e.name==="feature-state")return false;let t4=true;return e.eachChild(i=>{t4&&!Ys(i)&&(t4=false)}),t4}function Ll(e,t4){if(e instanceof sa&&t4.indexOf(e.name)>=0)return false;let i=true;return e.eachChild(r=>{i&&!Ll(r,t4)&&(i=false)}),i}function Ha(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function ey(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function dd(e){return!!e.expression&&e.expression.interpolated}const pd=/^(.*)-transition$/;function Ks(e,...t4){for(let i of t4)for(let r in i)e[r]=i[r];return e}function pe(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function Bl(e){return typeof e=="object"&&!!e&&!Array.isArray(e)&&at(e)===Wr}function pw(e){return e}function fw(e){switch(e.type){case"color":return oe.parse;case"padding":return Ki.parse;case"numberArray":return Ji.parse;case"colorArray":return _i.parse;default:return null}}function mw(e){switch(e){case"exponential":return iy;case"interval":return _w;case"categorical":return gw;case"identity":return yw;default:throw Error(`Unknown function type "${e}"`)}}function ty(e,t4){let i=e.stops&&typeof e.stops[0][0]=="object",r=i||e.property!==void 0,a=i||!r,s=e.type||(dd(t4)?"exponential":"interval"),n=fw(t4);if(n&&(e=Ks({},e),e.stops&&(e.stops=e.stops.map(h=>[h[0],n(h[1])])),e.default?e.default=n(e.default):e.default=n(t4.default)),e.colorSpace&&!ob(e.colorSpace))throw Error(`Unknown color space: "${e.colorSpace}"`);let o=mw(s),l,u;if(s==="categorical"){l=Object.create(null);for(let h of e.stops)l[h[0]]=h[1];u=typeof e.stops[0][0]}if(i){let h={},c=[];for(let f=0;f<e.stops.length;f++){let m=e.stops[f],g=m[0].zoom;h[g]===void 0&&(h[g]={zoom:g,type:e.type,property:e.property,default:e.default,stops:[]},c.push(g)),h[g].stops.push([m[0].value,m[1]])}let d=[];for(let f of c)d.push([h[f].zoom,ty(h[f],t4)]);let p={name:"linear"};return{kind:"composite",interpolationType:p,interpolationFactor:yi.interpolationFactor.bind(void 0,p),zoomStops:d.map(f=>f[0]),evaluate({zoom:f},m){return iy({stops:d,base:e.base},t4,f).evaluate(f,m)}}}if(a){let h=s==="exponential"?{name:"exponential",base:e.base===void 0?1:e.base}:null;return{kind:"camera",interpolationType:h,interpolationFactor:yi.interpolationFactor.bind(void 0,h),zoomStops:e.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(e,t4,c,l,u)}}return{kind:"source",evaluate(h,c){let d=c&&c.properties?c.properties[e.property]:void 0;return d===void 0?xn(e.default,t4.default):o(e,t4,d,l,u)}}}function xn(e,t4,i){if(e!==void 0)return e;if(t4!==void 0)return t4;if(i!==void 0)return i}function gw(e,t4,i,r,a){return xn(typeof i===a?r[i]:void 0,e.default,t4.default)}function _w(e,t4,i){if(pe(i)!=="number")return xn(e.default,t4.default);let r=e.stops.length;if(r===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];let a=Fl(e.stops.map(s=>s[0]),i,"");return e.stops[a][1]}function iy(e,t4,i){let r=e.base===void 0?1:e.base;if(pe(i)!=="number")return xn(e.default,t4.default);let a=e.stops.length;if(a===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[a-1][0])return e.stops[a-1][1];let s=Fl(e.stops.map(h=>h[0]),i,""),n=vw(i,r,e.stops[s][0],e.stops[s+1][0]),o=e.stops[s][1],l=e.stops[s+1][1],u=He[t4.type]||pw;return typeof o.evaluate=="function"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),d=l.evaluate.apply(void 0,h);if(c!==void 0&&d!==void 0)return u(c,d,n,e.colorSpace)}}:u(o,l,n,e.colorSpace)}function yw(e,t4,i){switch(t4.type){case"color":i=oe.parse(i);break;case"formatted":i=dr.fromString(i.toString());break;case"resolvedImage":i=Xi.fromString(i.toString());break;case"padding":i=Ki.parse(i);break;case"colorArray":i=_i.parse(i);break;case"numberArray":i=Ji.parse(i);break;default:pe(i)!==t4.type&&(t4.type!=="enum"||!t4.values[i])&&(i=void 0)}return xn(i,e.default,t4.default)}function vw(e,t4,i,r){let a=r-i,s=e-i;return a===0?0:t4===1?s/a:(t4**+s-1)/(t4**+a-1)}function Rh(e){return{result:"success",value:e}}function Aa(e){return{result:"error",value:e}}var fd=class{constructor(t4,i,r,a){this.expression=t4,this._warningHistory={},this._evaluator=new b_,this._defaultValue=r?ly(r):null,this._enumValues=r&&r.type==="enum"?r.values:null,this._globalState=a,this._rootKey=i}evaluateWithoutErrorHandling(t4,i,r,a,s,n){return this._globalState&&(t4=Xa(t4,this._globalState)),this._evaluator.globals=t4,this._evaluator.feature=i,this._evaluator.featureState=r,this._evaluator.canonical=a,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=n,this.expression.evaluate(this._evaluator)}evaluate(t4,i,r,a,s,n){this._globalState&&(t4=Xa(t4,this._globalState)),this._evaluator.globals=t4,this._evaluator.feature=i||null,this._evaluator.featureState=r||null,this._evaluator.canonical=a,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=n||null;try{let o=this.expression.evaluate(this._evaluator);if(o==null||typeof o=="number"&&o!==o)return this._defaultValue;if(this._enumValues&&!(o in this._enumValues))throw new qe(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(o)} instead.`,"");return o}catch(o){let l=o instanceof qe?o.path:"",u=`${l}|${o.message}`;return this._warningHistory[u]||(this._warningHistory[u]=true,typeof console<"u"&&console.warn(ry(this._rootKey,l,o.message,this._defaultValue))),this._defaultValue}}};function ry(e,t4,i,r){return`${e}${t4}: ${i}${r==null?"":` Falling back to ${String(r)}.`}`}function ay(e){if(!e)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".')}function Ol(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in La}function $l(e,t4,i,r){ay(t4);let a=new J_(La,Ko,[],i?ww(i):void 0),s=a.parse(e,void 0,void 0,void 0,i&&i.type==="string"?{typeAnnotation:"coerce"}:void 0);return s?Rh(new fd(s,t4,i,r)):Aa(a.errors)}var Js=class{constructor(t4,i,r){this.kind=t4,this._styleExpression=i,this.isStateDependent=t4!=="constant"&&!Ys(i.expression),this.globalStateRefs=bn(i.expression),this._globalState=r}evaluateWithoutErrorHandling(t4,i,r,a,s,n){return this._globalState&&(t4=Xa(t4,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t4,i,r,a,s,n)}evaluate(t4,i,r,a,s,n){return this._globalState&&(t4=Xa(t4,this._globalState)),this._styleExpression.evaluate(t4,i,r,a,s,n)}},Jo=class{constructor(t4,i,r,a,s){this.kind=t4,this.zoomStops=r,this._styleExpression=i,this.isStateDependent=t4!=="camera"&&!Ys(i.expression),this.globalStateRefs=bn(i.expression),this.interpolationType=a,this._globalState=s}evaluateWithoutErrorHandling(t4,i,r,a,s,n){return this._globalState&&(t4=Xa(t4,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t4,i,r,a,s,n)}evaluate(t4,i,r,a,s,n){return this._globalState&&(t4=Xa(t4,this._globalState)),this._styleExpression.evaluate(t4,i,r,a,s,n)}interpolationFactor(t4,i,r){return this.interpolationType?yi.interpolationFactor(this.interpolationType,t4,i,r):0}};function xw(e){return e._styleExpression!==void 0}function sy(e,t4,i,r){let a=$l(e,t4,i,r);if(a.result==="error")return a;let s=a.value.expression,n=kl(s);if(!n&&!Ha(i))return Aa([new ji("","data expressions not supported")]);let o=Ll(s,["zoom"]);if(!o&&!ey(i))return Aa([new ji("","zoom expressions not supported")]);let l=ko(s);if(!l&&!o)return Aa([new ji("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof ji)return Aa([l]);if(l instanceof yi&&!dd(i))return Aa([new ji("",'"interpolate" expressions cannot be used with this property')]);if(!l)return Rh(n?new Js("constant",a.value,r):new Js("source",a.value,r));let u=l instanceof yi?l.interpolation:void 0;return Rh(n?new Jo("camera",a.value,l.labels,u,r):new Jo("composite",a.value,l.labels,u,r))}var ny=class oy{constructor(t4,i,r){this.isStateDependent=false,this.globalStateRefs=new Set,this._globalState=null,ay(i),this._parameters=t4,this._specification=r,this._rootKey=i,this._defaultValue=ly(r),this._warningHistory={};let a=ty(this._parameters,this._specification);this.kind=a.kind,this.interpolationFactor=a.interpolationFactor,this.zoomStops=a.zoomStops,this.interpolationType=a.interpolationType,this._innerEvaluate=a.evaluate}evaluate(t4,i){try{return this._innerEvaluate(t4,i)}catch(r){let a=r instanceof Error?r.message:String(r),s=`|${a}`;return this._warningHistory[s]||(this._warningHistory[s]=true,typeof console<"u"&&console.warn(ry(this._rootKey,"",a,this._defaultValue))),this._defaultValue}}static deserialize(t4){return new oy(t4._parameters,t4._rootKey,t4._specification)}static serialize(t4){return{_parameters:t4._parameters,_specification:t4._specification,_rootKey:t4._rootKey}}};function bw(e,t4,i,r){if(Bl(e))return new ny(e,t4,i);if(Ol(e)){let a=sy(e,t4,i,r);if(a.result==="error")throw Error(a.value.map(s=>`${s.key}: ${s.message}`).join(", "));return a.value}{let a=e;return i.type==="color"&&typeof e=="string"?a=oe.parse(e):i.type==="padding"&&(typeof e=="number"||Array.isArray(e))?a=Ki.parse(e):i.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?a=Ji.parse(e):i.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?a=_i.parse(e):i.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?a=Hi.parse(e):i.type==="projectionDefinition"&&typeof e=="string"&&(a=Mr.parse(e)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>a}}}function ko(e){let t4=null;if(e instanceof P_)t4=ko(e.result);else if(e instanceof L_){for(let i of e.args)if(t4=ko(i),t4)break}else(e instanceof rd||e instanceof yi)&&e.input instanceof sa&&e.input.name==="zoom"&&(t4=e);return t4 instanceof ji||e.eachChild(i=>{let r=ko(i);r instanceof ji?t4=r:!t4&&r?t4=new ji("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t4&&r&&t4!==r&&(t4=new ji("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t4}function bn(e,t4=new Set){return e instanceof cd&&t4.add(e.key),e.eachChild(i=>{bn(i,t4)}),t4}function ww(e){let t4={color:Pi,string:ue,number:V,enum:ue,boolean:me,formatted:_n,padding:Al,numberArray:Il,colorArray:Ws,projectionDefinition:Cl,resolvedImage:yn,variableAnchorOffsetCollection:Ml};return e.type==="array"?kt(t4[e.value]||he,e.length):t4[e.type]}function ly(e){if(e.type==="color"&&Bl(e.default))return new oe(0,0,0,0);switch(e.type){case"color":return oe.parse(e.default)||null;case"padding":return Ki.parse(e.default)||null;case"numberArray":return Ji.parse(e.default)||null;case"colorArray":return _i.parse(e.default)||null;case"variableAnchorOffsetCollection":return Hi.parse(e.default)||null;case"projectionDefinition":return Mr.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function Xa(e,t4){let{zoom:i,heatmapDensity:r,elevation:a,lineProgress:s,isSupportedScript:n,accumulated:o}=e??{};return{zoom:i,heatmapDensity:r,elevation:a,lineProgress:s,isSupportedScript:n,accumulated:o,globalState:t4}}function Tw(e){let t4=false;for(let i of e){let r=uy(i);if(r==="expression")return"expression";r==="legacy"&&(t4=true)}return t4?"legacy":"neutral"}function uy(e){if(typeof e=="boolean")return"neutral";if(!Array.isArray(e)||e.length===0)return"legacy";switch(e[0]){case"has":return e.length<2||e[1]==="$id"||e[1]==="$type"?"legacy":e.length===2?"neutral":"expression";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]))?"expression":"legacy";case"!in":case"!has":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2])?"expression":"legacy";case"none":return"legacy";case"any":case"all":return Tw(e.slice(1));default:return"expression"}}function md(e){return uy(e)!=="legacy"}function gf(e){return e==="$type"?["geometry-type"]:e==="$id"?["id"]:["get",e]}function Ew(e){switch(e[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return e.length!==3||typeof e[1]!="string"?null:[e[0],gf(e[1]),e[2]];case"in":case"!in":{if(e.length<2||typeof e[1]!="string")return null;let t4=["in",gf(e[1]),["literal",e.slice(2)]];return e[0]==="!in"?["!",t4]:t4}case"has":case"!has":{if(e.length!==2||typeof e[1]!="string"||e[1]==="$type"||e[1]==="$id")return null;let t4=["has",e[1]];return e[0]==="!has"?["!",t4]:t4}default:return null}}function hy(e){if((e[0]==="<"||e[0]==="<="||e[0]===">"||e[0]===">=")&&e[1]==="$type")return`"$type" cannot be use with operator "${e[0]}"`;let t4=Ew(e);return t4?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(e)} with ${JSON.stringify(t4)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(e)} to expression syntax.`}function Vu(e,t4,i){let r=i[e];return Array.isArray(r)?md(r)?gd(r,t4.concat(e)):{path:t4.concat(e),legacyFilter:r}:null}function gd(e,t4=[]){if(!Array.isArray(e)||e.length<1)return null;switch(e[0]){case"all":case"any":case"none":for(let i=1;i<e.length;i++){let r=Vu(i,t4,e);if(r)return r}break;case"!":{let i=Vu(1,t4,e);if(i)return i;break}case"case":for(let i=1;i<e.length-1;i+=2){let r=Vu(i,t4,e);if(r)return r}}return null}function Sw(e,t4){let i=gd(e);if(!i||typeof console>"u")return;let r=i.path.map(a=>`[${a}]`).join("");console.warn(`${t4}${r}: ${hy(i.legacyFilter)}`)}const Dw={type:"boolean",default:false,transition:false,"property-type":"data-driven",expression:{interpolated:false,parameters:["zoom","feature"]}};function Qs(e,t4,i){if(e==null)return{filter:()=>true,needGeometry:false,getGlobalStateRefs:()=>new Set};md(e)?Sw(e,t4):e=Qo(e);let r=$l(e,t4,Dw,i);if(r.result==="error")throw Error(r.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,s,n)=>r.value.evaluate(a,s,{},n),needGeometry:cy(e),getGlobalStateRefs:()=>bn(r.value.expression)}}function Cw(e,t4){return e<t4?-1:+(e>t4)}function cy(e){if(!Array.isArray(e))return false;if(e[0]==="within"||e[0]==="distance")return true;for(let t4=1;t4<e.length;t4++)if(cy(e[t4]))return true;return false}function Qo(e){if(!e)return true;let t4=e[0];return e.length<=1?t4!=="any":t4==="=="?ju(e[1],e[2],"=="):t4==="!="?to(ju(e[1],e[2],"==")):t4==="<"||t4===">"||t4==="<="||t4===">="?ju(e[1],e[2],t4):t4==="any"?Pw(e.slice(1)):t4==="all"?["all"].concat(e.slice(1).map(Qo)):t4==="none"?["all"].concat(e.slice(1).map(Qo).map(to)):t4==="in"?_f(e[1],e.slice(2)):t4==="!in"?to(_f(e[1],e.slice(2))):t4==="has"?yf(e[1]):t4!=="!has"||to(yf(e[1]))}function ju(e,t4,i){switch(e){case"$type":return[`filter-type-${i}`,t4];case"$id":return[`filter-id-${i}`,t4];default:return[`filter-${i}`,e,t4]}}function Pw(e){return["any"].concat(e.map(Qo))}function _f(e,t4){if(t4.length===0)return false;switch(e){case"$type":return["filter-type-in",["literal",t4]];case"$id":return["filter-id-in",["literal",t4]];default:return t4.length>200&&!t4.some(i=>typeof i!=typeof t4[0])?["filter-in-large",e,["literal",t4.sort(Cw)]]:["filter-in-small",e,["literal",t4]]}}function yf(e){switch(e){case"$type":return true;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function to(e){return["!",e]}function dy(e){let t4=e.key,i=e.value;return i?[new B(t4,i,"constants have been deprecated as of v8")]:[]}function rt(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function ea(e){if(Array.isArray(e))return e.map(ea);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t4={};for(let i in e)t4[i]=ea(e[i]);return t4}return rt(e)}function ai(e){let t4=e.key,i=e.value,r=e.valueSpec||{},a=e.objectElementValidators||{},s=e.style,n=e.styleSpec,o=e.validateSpec,l=[],u=pe(i);if(u!=="object")return[new B(t4,i,`object expected, ${u} found`)];for(let h in i){let c=h.split(".")[0],d=Os(r,c)||r["*"],p;if(Os(a,c))p=a[c];else if(Os(r,c)){if(i[h]===void 0)continue;p=o}else if(a["*"])p=a["*"];else if(r["*"])p=o;else{l.push(new B(t4,i[h],`unknown property "${h}"`));continue}l=l.concat(p({key:(t4&&`${t4}.`)+h,value:i[h],valueSpec:d,style:s,styleSpec:n,object:i,objectKey:h,validateSpec:o},i))}for(let h in r)a[h]||r[h].required&&r[h].default===void 0&&i[h]===void 0&&l.push(new B(t4,i,`missing required property "${h}"`));return l}function _d(e){let t4=e.value,i=e.valueSpec,r=e.validateSpec,a=e.style,s=e.styleSpec,n=e.key,o=e.arrayElementValidator||r;if(pe(t4)!=="array")return[new B(n,t4,`array expected, ${pe(t4)} found`)];if(i.length&&t4.length!==i.length)return[new B(n,t4,`array length ${i.length} expected, length ${t4.length} found`)];let l={type:i.value,values:i.values};s.$version<7&&(l.function=i.function),pe(i.value)==="object"&&(l=i.value);let u=[];for(let h=0;h<t4.length;h++)u=u.concat(o({array:t4,arrayIndex:h,value:t4[h],valueSpec:l,validateSpec:e.validateSpec,style:a,styleSpec:s,key:`${n}[${h}]`}));return u}function Vl(e){let t4=e.key,i=e.value,r=e.valueSpec,a=pe(i);return a==="number"&&i!==i&&(a="NaN"),a==="number"?"minimum"in r&&i<r.minimum?[new B(t4,i,`${i} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&i>r.maximum?[new B(t4,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]:[new B(t4,i,`number expected, ${a} found`)]}function py(e){let t4=e.valueSpec,i=rt(e.value.type),r,a={},s,n,o=i!=="categorical"&&e.value.property===void 0,l=!o,u=pe(e.value.stops)==="array"&&pe(e.value.stops[0])==="array"&&pe(e.value.stops[0][0])==="object",h=ai({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:c,default:f}});return i==="identity"&&o&&h.push(new B(e.key,e.value,'missing required property "property"')),i!=="identity"&&!e.value.stops&&h.push(new B(e.key,e.value,'missing required property "stops"')),i==="exponential"&&e.valueSpec.expression&&!dd(e.valueSpec)&&h.push(new B(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Ha(e.valueSpec)?h.push(new B(e.key,e.value,"property functions not supported")):o&&!ey(e.valueSpec)&&h.push(new B(e.key,e.value,"zoom functions not supported"))),(i==="categorical"||u)&&e.value.property===void 0&&h.push(new B(e.key,e.value,'"property" property is required')),h;function c(m){if(i==="identity")return[new B(m.key,m.value,'identity function may not have a "stops" property')];let g=[],_=m.value;return g=g.concat(_d({key:m.key,value:_,valueSpec:m.valueSpec,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,arrayElementValidator:d})),pe(_)==="array"&&_.length===0&&g.push(new B(m.key,_,"array must have at least one stop")),g}function d(m){let g=[],_=m.value,y=m.key;if(pe(_)!=="array")return[new B(y,_,`array expected, ${pe(_)} found`)];if(_.length!==2)return[new B(y,_,`array length 2 expected, length ${_.length} found`)];if(u){if(pe(_[0])!=="object")return[new B(y,_,`object expected, ${pe(_[0])} found`)];if(_[0].zoom===void 0)return[new B(y,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new B(y,_,"object stop key must have value")];if(n&&n>rt(_[0].zoom))return[new B(y,_[0].zoom,"stop zoom values must appear in ascending order")];rt(_[0].zoom)!==n&&(n=rt(_[0].zoom),s=void 0,a={}),g=g.concat(ai({key:`${y}[0]`,value:_[0],valueSpec:{zoom:{}},validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,objectElementValidators:{zoom:Vl,value:p}}))}else g=g.concat(p({key:`${y}[0]`,value:_[0],validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec},_));return Ol(ea(_[1]))?g.concat([new B(`${y}[1]`,_[1],"expressions are not allowed in function stops.")]):g.concat(m.validateSpec({key:`${y}[1]`,value:_[1],valueSpec:t4,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec}))}function p(m,g){let _=pe(m.value),y=rt(m.value),x=m.value===null?g:m.value;if(!r)r=_;else if(_!==r)return[new B(m.key,x,`${_} stop domain type must match previous stop domain type ${r}`)];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new B(m.key,x,"stop domain value must be a number, string, or boolean")];if(_!=="number"&&i!=="categorical"){let v=`number expected, ${_} found`;return Ha(t4)&&i===void 0&&(v+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new B(m.key,x,v)]}return i==="categorical"&&_==="number"&&(!isFinite(y)||Math.floor(y)!==y)?[new B(m.key,x,`integer expected, found ${y}`)]:i!=="categorical"&&_==="number"&&s!==void 0&&y<s?[new B(m.key,x,"stop domain values must appear in ascending order")]:(s=y,i==="categorical"&&y in a?[new B(m.key,x,"stop domain values must be unique")]:(a[y]=true,[]))}function f(m){return m.validateSpec({key:m.key,value:m.value,valueSpec:t4,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec})}}function Ya(e){let t4=(e.expressionContext==="property"?sy:$l)(ea(e.value),e.key,e.valueSpec);if(t4.result==="error")return t4.value.map(r=>new B(`${e.key}${r.key}`,e.value,r.message));let i=t4.value.expression||t4.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!i.outputDefined())return[new B(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!Ys(i))return[new B(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!Ys(i))return[new B(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!Ll(i,["zoom","feature-state"]))return[new B(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!kl(i))return[new B(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Aw(e){let t4=e.value,i=e.key,r=pe(t4);return r==="boolean"?[]:[new B(i,t4,`boolean expected, ${r} found`)]}function kh(e){let t4=e.key,i=e.value,r=pe(i);return r==="string"?oe.parse(String(i))?[]:[new B(t4,i,`color expected, "${i}" found`)]:[new B(t4,i,`color expected, ${r} found`)]}function en(e){let t4=e.key,i=e.value,r=e.valueSpec,a=[];return Array.isArray(r.values)?r.values.indexOf(rt(i))===-1&&a.push(new B(t4,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(r.values).indexOf(rt(i))===-1&&a.push(new B(t4,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),a}function Iw(e,t4){let i=e;for(let r of t4)i=i[r];return i}function Mw(e,t4){let i=gd(t4);return i?[new B(`${e.key}${i.path.map(r=>`[${r}]`).join("")}`,Iw(e.value,i.path),hy(i.legacyFilter),null,"warning")]:[]}function yd(e){let t4=ea(e.value);return md(t4)?[...Mw(e,t4),...Ya(Ks({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:fy(e)}function fy(e){let t4=e.value,i=e.key;if(pe(t4)!=="array")return[new B(i,t4,`array expected, ${pe(t4)} found`)];let r=e.styleSpec,a,s=[];if(t4.length<1)return[new B(i,t4,"filter array must have at least 1 element")];switch(s=s.concat(en({key:`${i}[0]`,value:t4[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),rt(t4[0])){case"<":case"<=":case">":case">=":t4.length>=2&&rt(t4[1])==="$type"&&s.push(new B(i,t4,`"$type" cannot be use with operator "${t4[0]}"`));case"==":case"!=":t4.length!==3&&s.push(new B(i,t4,`filter array for operator "${t4[0]}" must have 3 elements`));case"in":case"!in":t4.length>=2&&(a=pe(t4[1]),a!=="string"&&s.push(new B(`${i}[1]`,t4[1],`string expected, ${a} found`)));for(let n=2;n<t4.length;n++)a=pe(t4[n]),rt(t4[1])==="$type"?s=s.concat(en({key:`${i}[${n}]`,value:t4[n],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):a!=="string"&&a!=="number"&&a!=="boolean"&&s.push(new B(`${i}[${n}]`,t4[n],`string, number, or boolean expected, ${a} found`));break;case"any":case"all":case"none":for(let n=1;n<t4.length;n++)s=s.concat(fy({key:`${i}[${n}]`,value:t4[n],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":a=pe(t4[1]),t4.length===2?a!=="string"&&s.push(new B(`${i}[1]`,t4[1],`string expected, ${a} found`)):s.push(new B(i,t4,`filter array for "${t4[0]}" operator must have 2 elements`))}return s}function my(e,t4){let i=e.key,r=e.validateSpec,a=e.style,s=e.styleSpec,n=e.value,o=e.objectKey,l=s[`${t4}_${e.layerType}`];if(!l)return[];let u=o.match(pd);if(t4==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return r({key:i,value:n,valueSpec:s.transition,style:a,styleSpec:s});let h=e.valueSpec||l[o];if(!h)return[new B(i,n,`unknown property "${o}"`)];let c;if(pe(n)==="string"&&Ha(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(n)))return[new B(i,n,`"${o}" does not support interpolation syntax
5
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];let d=[];return e.layerType==="symbol"&&o==="text-font"&&Bl(ea(n))&&rt(n.type)==="identity"&&d.push(new B(i,n,'"text-font" does not support identity functions')),d.concat(r({key:e.key,value:n,valueSpec:h,style:a,styleSpec:s,expressionContext:"property",propertyType:t4,propertyKey:o}))}function gy(e){return my(e,"paint")}function _y(e){return my(e,"layout")}function yy(e){var l,u;let t4=[],i=e.value,r=e.key,a=e.style,s=e.styleSpec;if(pe(i)!=="object")return[new B(r,i,`object expected, ${pe(i)} found`)];!i.type&&!i.ref&&t4.push(new B(r,i,'either "type" or "ref" is required'));let n=rt(i.type),o=rt(i.ref);if(i.id){let h=rt(i.id);for(let c=0;c<e.arrayIndex;c++){let d=a.layers[c];rt(d.id)===h&&t4.push(new B(r,i.id,`duplicate layer id "${i.id}", previously used at line ${d.id.__line__}`))}}if("ref"in i){["type","source","source-layer","filter","layout"].forEach(c=>{c in i&&t4.push(new B(r,i[c],`"${c}" is prohibited for ref layers`))});let h;a.layers.forEach(c=>{rt(c.id)===o&&(h=c)}),h?h.ref?t4.push(new B(r,i.ref,"ref cannot reference another ref layer")):n=rt(h.type):t4.push(new B(r,i.ref,`ref layer "${o}" not found`))}else if(n!=="background")if(!i.source)t4.push(new B(r,i,'missing required property "source"'));else{let h=a.sources&&a.sources[i.source],c=h&&rt(h.type);h?c==="vector"&&n==="raster"?t4.push(new B(r,i.source,`layer "${i.id}" requires a raster source`)):c!=="raster-dem"&&n==="hillshade"||c!=="raster-dem"&&n==="color-relief"?t4.push(new B(r,i.source,`layer "${i.id}" requires a raster-dem source`)):c==="raster"&&n!=="raster"?t4.push(new B(r,i.source,`layer "${i.id}" requires a vector source`)):c==="vector"&&!i["source-layer"]?t4.push(new B(r,i,`layer "${i.id}" must specify a "source-layer"`)):c==="raster-dem"&&n!=="hillshade"&&n!=="color-relief"?t4.push(new B(r,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):n==="line"&&i.paint&&i.paint["line-gradient"]&&(c!=="geojson"||!h.lineMetrics)&&t4.push(new B(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t4.push(new B(r,i.source,`source "${i.source}" not found`))}return n==="raster"&&((l=i.paint)!=null&&l.resampling)&&((u=i.paint)!=null&&u["raster-resampling"])&&t4.push(new B(r,i.paint,`layer "${i.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),t4=t4.concat(ai({key:r,value:i,valueSpec:s.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:s.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"})},filter:yd,layout(h){return ai({layer:i,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return _y(Ks({layerType:n},c))}}})},paint(h){return ai({layer:i,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return gy(Ks({layerType:n},c))}}})}}})),t4}function Pr(e){let t4=e.value,i=e.key,r=pe(t4);return r==="string"?[]:[new B(i,t4,`string expected, ${r} found`)]}function Fw(e){let t4=e.sourceName??"",i=e.value,r=e.styleSpec,a=r.source_raster_dem,s=e.style,n=[],o=pe(i);if(i===void 0)return n;if(o!=="object")return n.push(new B("source_raster_dem",i,`object expected, ${o} found`)),n;let l=rt(i.encoding)==="custom",u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let c in i)!l&&u.includes(c)?n.push(new B(c,i[c],`In "${t4}": "${c}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):a[c]?n=n.concat(e.validateSpec({key:c,value:i[c],valueSpec:a[c],validateSpec:e.validateSpec,style:s,styleSpec:r})):n.push(new B(c,i[c],`unknown property "${c}"`));return n}const vf={promoteId:zw};function vy(e){let t4=e.value,i=e.key,r=e.styleSpec,a=e.style,s=e.validateSpec;if(!t4.type)return[new B(i,t4,'"type" is required')];let n=rt(t4.type),o;switch(n){case"vector":case"raster":return o=ai({key:i,value:t4,valueSpec:r[`source_${n.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:vf,validateSpec:s}),o;case"raster-dem":return o=Fw({sourceName:i,value:t4,style:e.style,styleSpec:r,validateSpec:s}),o;case"geojson":if(o=ai({key:i,value:t4,valueSpec:r.source_geojson,style:a,styleSpec:r,validateSpec:s,objectElementValidators:vf}),t4.cluster)for(let l in t4.clusterProperties){let[u,h]=t4.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;o.push(...Ya({key:`${i}.${l}.map`,value:h,expressionContext:"cluster-map"})),o.push(...Ya({key:`${i}.${l}.reduce`,value:c,expressionContext:"cluster-reduce"}))}return o;case"video":return ai({key:i,value:t4,valueSpec:r.source_video,style:a,validateSpec:s,styleSpec:r});case"image":return ai({key:i,value:t4,valueSpec:r.source_image,style:a,validateSpec:s,styleSpec:r});case"canvas":return[new B(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return en({key:`${i}.type`,value:t4.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function zw({key:e,value:t4}){if(pe(t4)==="string")return Pr({key:e,value:t4});{let i=[];for(let r in t4)i.push(...Pr({key:`${e}.${r}`,value:t4[r]}));return i}}function xy(e){let t4=e.value,i=e.styleSpec,r=i.light,a=e.style,s=[],n=pe(t4);if(t4===void 0)return s;if(n!=="object")return s=s.concat([new B("light",t4,`object expected, ${n} found`)]),s;for(let o in t4){let l=o.match(pd);s=l&&r[l[1]]&&r[l[1]].transition?s.concat(e.validateSpec({key:o,value:t4[o],valueSpec:i.transition,validateSpec:e.validateSpec,style:a,styleSpec:i})):r[o]?s.concat(e.validateSpec({key:o,value:t4[o],valueSpec:r[o],validateSpec:e.validateSpec,style:a,styleSpec:i})):s.concat([new B(o,t4[o],`unknown property "${o}"`)])}return s}function by(e){let t4=e.value,i=e.styleSpec,r=i.sky,a=e.style,s=pe(t4);if(t4===void 0)return[];if(s!=="object")return[new B("sky",t4,`object expected, ${s} found`)];let n=[];for(let o in t4){let l=o.match(pd);n=l&&r[l[1]]&&r[l[1]].transition?n.concat(e.validateSpec({key:o,value:t4[o],valueSpec:i.transition,style:a,styleSpec:i})):r[o]?n.concat(e.validateSpec({key:o,value:t4[o],valueSpec:r[o],style:a,styleSpec:i})):n.concat([new B(o,t4[o],`unknown property "${o}"`)])}return n}function wy(e){let t4=e.value,i=e.styleSpec,r=i.terrain,a=e.style,s=[],n=pe(t4);if(t4===void 0)return s;if(n!=="object")return s=s.concat([new B("terrain",t4,`object expected, ${n} found`)]),s;for(let o in t4)s=r[o]?s.concat(e.validateSpec({key:o,value:t4[o],valueSpec:r[o],validateSpec:e.validateSpec,style:a,styleSpec:i})):s.concat([new B(o,t4[o],`unknown property "${o}"`)]);return s}function Rw(e){return Pr(e).length===0?[]:Ya(e)}function kw(e){return Pr(e).length===0?[]:Ya(e)}function Lw(e){let t4=e.key,i=e.value;if(pe(i)==="array"){if(i.length<1||i.length>4)return[new B(t4,i,`padding requires 1 to 4 values; ${i.length} values found`)];let r={type:"number"},a=[];for(let s=0;s<i.length;s++)a=a.concat(e.validateSpec({key:`${t4}[${s}]`,value:i[s],validateSpec:e.validateSpec,valueSpec:r}));return a}return Vl({key:t4,value:i,valueSpec:{}})}function Bw(e){let t4=e.key,i=e.value;if(pe(i)==="array"){let r={type:"number"};if(i.length<1)return[new B(t4,i,"array length at least 1 expected, length 0 found")];let a=[];for(let s=0;s<i.length;s++)a=a.concat(e.validateSpec({key:`${t4}[${s}]`,value:i[s],validateSpec:e.validateSpec,valueSpec:r}));return a}return Vl({key:t4,value:i,valueSpec:{}})}function Ow(e){let t4=e.key,i=e.value;if(pe(i)==="array"){if(i.length<1)return[new B(t4,i,"array length at least 1 expected, length 0 found")];let r=[];for(let a=0;a<i.length;a++)r=r.concat(kh({key:`${t4}[${a}]`,value:i[a]}));return r}return kh({key:t4,value:i})}function $w(e){let t4=e.key,i=e.value,r=pe(i),a=e.styleSpec;if(r!=="array"||i.length<1||i.length%2!=0)return[new B(t4,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let n=0;n<i.length;n+=2)s=s.concat(en({key:`${t4}[${n}]`,value:i[n],valueSpec:a.layout_symbol["text-anchor"]})),s=s.concat(_d({key:`${t4}[${n+1}]`,value:i[n+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:a}));return s}function Ty(e){let t4=[],i=e.value,r=e.key;if(Array.isArray(i)){let a=[],s=[];for(let n in i)i[n].id&&a.includes(i[n].id)&&t4.push(new B(r,i,`all the sprites' ids must be unique, but ${i[n].id} is duplicated`)),a.push(i[n].id),i[n].url&&s.includes(i[n].url)&&t4.push(new B(r,i,`all the sprites' URLs must be unique, but ${i[n].url} is duplicated`)),s.push(i[n].url),t4=t4.concat(ai({key:`${r}[${n}]`,value:i[n],valueSpec:{id:{type:"string",required:true},url:{type:"string",required:true}},validateSpec:e.validateSpec}));return t4}return Pr({key:r,value:i})}function Vw(e){let t4=e.value,i=e.styleSpec,r=i.projection,a=e.style,s=pe(t4);if(t4===void 0)return[];if(s!=="object")return[new B("projection",t4,`object expected, ${s} found`)];let n=[];for(let o in t4)n=r[o]?n.concat(e.validateSpec({key:o,value:t4[o],valueSpec:r[o],style:a,styleSpec:i})):n.concat([new B(o,t4[o],`unknown property "${o}"`)]);return n}function jw(e){let t4=e.key,i=e.value;i=i instanceof String?i.valueOf():i;let r=pe(i);return r==="array"&&!Nw(i)&&!Uw(i)?[new B(t4,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]:["array","string"].includes(r)?[]:[new B(t4,i,`projection expected, invalid type "${r}" found`)]}function Uw(e){return!!["interpolate","step","literal"].includes(e[0])}function Nw(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"}function Lh(e){return!!e&&e.constructor===Object}function Ey(e){return Lh(e.value)?[]:[new B(e.key,e.value,`object expected, ${pe(e.value)} found`)]}const xf=1114111,Gw=/^u\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\?{1,6}))$/i;function Zw(e,t4){if(pe(t4)!=="string")return[];let i=`${t4}`,r=()=>[new B(e,t4,'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"')],a=i.match(Gw);if(!a)return r();let[,s,n,o]=a;if(o!==void 0)return o.length>6?r():[];let l=parseInt(s,16),u=n===void 0?l:parseInt(n,16);return l>xf||u>xf?[new B(e,t4,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new B(e,t4,`unicode range start must not be greater than its end, but ${i} is`)]:[]}function Sy(e){let t4=e.key??"font-faces",i=e.value,r=e.validateSpec,a=e.styleSpec??h_,s=e.style;if(!Lh(i))return[new B(t4,i,`object expected, ${pe(i)} found`)];let n=[];for(let o in i){let l=i[o],u=pe(l);if(u==="string")n.push(...Pr({key:`${t4}.${o}`,value:l}));else if(u==="array"){let h={url:{type:"string",required:true},"unicode-range":{type:"array",value:"string"}};for(let[c,d]of l.entries()){let p=`${t4}.${o}[${c}]`;n.push(...ai({key:p,value:d,valueSpec:h,styleSpec:a,style:s,validateSpec:r}));let f=Lh(d)?d["unicode-range"]:void 0;if(pe(f)==="array")for(let[m,g]of f.entries())n.push(...Zw(`${p}.unicode-range[${m}]`,g))}}else n.push(new B(`${t4}.${o}`,l,`string or array expected, ${u} found`))}return n}const bf={"*"(){return[]},array:_d,boolean:Aw,number:Vl,color:kh,constants:dy,enum:en,filter:yd,function:py,layer:yy,object:ai,source:vy,light:xy,sky:by,terrain:wy,projection:Vw,projectionDefinition:jw,string:Pr,formatted:Rw,resolvedImage:kw,padding:Lw,numberArray:Bw,colorArray:Ow,variableAnchorOffsetCollection:$w,sprite:Ty,state:Ey,fontFaces:Sy};function el(e){let t4=e.value,i=e.valueSpec,r=e.styleSpec;return e.validateSpec=el,i.expression&&Bl(rt(t4))?py(e):i.expression&&Ol(ea(t4))?Ya(e):i.type&&bf[i.type]?bf[i.type](e):ai(Ks({},e,{valueSpec:i.type?r[i.type]:i}))}function Dy(e){let t4=e.value,i=e.key,r=Pr(e);return r.length||(t4.indexOf("{fontstack}")===-1&&r.push(new B(i,t4,'"glyphs" url must include a "{fontstack}" token')),t4.indexOf("{range}")===-1&&r.push(new B(i,t4,'"glyphs" url must include a "{range}" token'))),r}function Qt(e,t4=F){let i=[];return i=i.concat(el({key:"",value:e,valueSpec:t4.$root,styleSpec:t4,style:e,validateSpec:el,objectElementValidators:{glyphs:Dy,"*"(){return[]}}})),e.constants&&(i=i.concat(dy({key:"constants",value:e.constants}))),Cy(i)}Qt.source=hi(ui(vy)),Qt.sprite=hi(ui(Ty)),Qt.glyphs=hi(ui(Dy)),Qt.fontFaces=hi(ui(Sy)),Qt.light=hi(ui(xy)),Qt.sky=hi(ui(by)),Qt.terrain=hi(ui(wy)),Qt.state=hi(ui(Ey)),Qt.layer=hi(ui(yy)),Qt.filter=hi(ui(yd)),Qt.paintProperty=hi(ui(gy)),Qt.layoutProperty=hi(ui(_y));function ui(e){return function(t4){return e(Object.assign({},t4,{validateSpec:el}))}}function Cy(e){return[].concat(e).sort((t4,i)=>t4.line-i.line)}function hi(e){return function(...t4){return Cy(e.apply(this,t4))}}const qw={type:"enum","property-type":"data-constant",expression:{interpolated:false,parameters:["global-state"]},values:{visible:{},none:{}},transition:false,default:"visible"};var Ww=class{constructor(t4,i,r){this._rootKey=i,this._globalState=r,this.setValue(t4)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(t4){if(t4==null||t4==="visible"||t4==="none"){this._literalValue=t4==="none"?"none":"visible",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let i=$l(t4,this._rootKey,qw,this._globalState);if(i.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(i.value.map(r=>`${r.key}: ${r.message}`).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=bn(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function Hw(e,t4,i){return new Ww(e,t4,i)}const qt=Qt,Py=new Set(Object.keys(F).filter(e=>e.startsWith("source_")).map(e=>e.slice(7).replaceAll("_","-")));function Xw(e){return Object.entries(e.sources??{}).filter(([,t4])=>!Py.has(t4.type)).map(([t4])=>`sources.${t4}`)}function wf(e,t4){let i=Xw(t4);return vd(e,qt(t4).filter(({message:r})=>!i.some(a=>r.startsWith(`${a}:`)||r.startsWith(`${a}.`))))}function vd(e,t4){let i=false;for(let r of t4){if(r.severity==="warning"){ge(r.message);continue}e.fire(new Y(Error(r.message))),i=true}return i}function wn(e,t4,i,r){return(r==null?void 0:r.validate)!==false&&vd(e,t4({styleSpec:F,...i}))}var Bh=class Ay{constructor(t4,i,r){let a=this.cells=[];if(t4 instanceof ArrayBuffer){this.arrayBuffer=t4;let n=new Int32Array(this.arrayBuffer);t4=n[0],i=n[1],r=n[2],this.d=i+2*r;for(let u=0;u<this.d*this.d;u++){let h=n[3+u],c=n[3+u+1];a.push(h===c?null:n.subarray(h,c))}let o=n[3+a.length],l=n[3+a.length+1];this.keys=n.subarray(o,l),this.bboxes=n.subarray(l),this.insert=this._insertReadonly}else{this.d=i+2*r;for(let n=0;n<this.d*this.d;n++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t4,this.padding=r,this.scale=i/t4,this.uid=0;let s=r/i*t4;this.min=-s,this.max=t4+s}insert(t4,i,r,a,s){this._forEachCell(i,r,a,s,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t4),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(s)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t4,i,r,a,s,n){this.cells[s].push(n)}query(t4,i,r,a,s){let n=this.min,o=this.max;if(t4<=n&&i<=n&&o<=r&&o<=a&&!s)return[...this.keys];{let l=[];return this._forEachCell(t4,i,r,a,this._queryCell,l,{},s),l}}_queryCell(t4,i,r,a,s,n,o,l){let u=this.cells[s];if(u!==null){let h=this.keys,c=this.bboxes;for(let d of u)if(o[d]===void 0){let p=d*4;(l?l(c[p+0],c[p+1],c[p+2],c[p+3]):t4<=c[p+2]&&i<=c[p+3]&&r>=c[p+0]&&a>=c[p+1])?(o[d]=true,n.push(h[d])):o[d]=false}}}_forEachCell(t4,i,r,a,s,n,o,l){let u=this._convertToCellCoord(t4),h=this._convertToCellCoord(i),c=this._convertToCellCoord(r),d=this._convertToCellCoord(a);for(let p=u;p<=c;p++)for(let f=h;f<=d;f++){let m=this.d*f+p;if((!l||l(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&s.call(this,t4,i,r,a,m,n,o,l))return}}_convertFromCellCoord(t4){return(t4-this.padding)/this.scale}_convertToCellCoord(t4){return Math.max(0,Math.min(this.d-1,Math.floor(t4*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t4=this.cells,i=3+this.cells.length+1+1,r=0;for(let n of this.cells)r+=n.length;let a=new Int32Array(i+r+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let s=i;for(let n=0;n<t4.length;n++){let o=t4[n];a[3+n]=s,a.set(o,s),s+=o.length}return a[3+t4.length]=s,a.set(this.keys,s),s+=this.keys.length,a[3+t4.length+1]=s,a.set(this.bboxes,s),s+=this.bboxes.length,a.buffer}static serialize(t4,i){let r=t4.toArrayBuffer();return i&&i.push(r),{buffer:r}}static deserialize(t4){return new Ay(t4.buffer)}};const sr={};function G(e,t4,i={}){if(sr[e])throw Error(`${e} is already registered.`);Object.defineProperty(t4,"_classRegistryKey",{value:e,writeable:false}),sr[e]={klass:t4,omit:i.omit||[],shallow:i.shallow||[]}}G("Object",Object),G("Set",Set),G("TransferableGridIndex",Bh),G("Color",oe),G("Error",Error),G("AJAXError",Wo),G("ResolvedImage",Xi),G("StylePropertyFunction",ny),G("StyleExpression",fd,{omit:["_evaluator"]}),G("ZoomDependentExpression",Jo),G("ZoomConstantExpression",Js),G("CompoundExpression",sa,{omit:["_evaluate"]});for(let e in La)La[e]._classRegistryKey||G(`Expression_${e}`,La[e]);function Iy(e){var t4;return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||((t4=e.constructor)==null?void 0:t4.name)==="ArrayBuffer")}function xd(e){let t4=e.constructor;return e.$name||t4._classRegistryKey}function Yw(e){if(typeof e!="object"||!e)return false;let t4=xd(e);return t4&&t4!=="Object"}function My(e){return!Yw(e)&&(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||Iy(e)||qr(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function Vs(e,t4){if(My(e))return(Iy(e)||qr(e))&&t4&&t4.push(e),ArrayBuffer.isView(e)&&t4&&t4.push(e.buffer),e instanceof ImageData&&t4&&t4.push(e.data.buffer),e;if(Array.isArray(e)){let s=[];for(let n of e)s.push(Vs(n,t4));return s}if(typeof e!="object")throw Error(`can't serialize object of type ${typeof e}`);let i=xd(e);if(!i)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!sr[i])throw Error(`${i} is not registered.`);let{klass:r}=sr[i],a=r.serialize?r.serialize(e,t4):{};if(r.serialize){if(a===(t4==null?void 0:t4[t4.length-1]))throw Error("statically serialized object won't survive transfer of $name property")}else{for(let s in e){if(!e.hasOwnProperty(s)||sr[i].omit.includes(s))continue;let n=e[s];n!==void 0&&(a[s]=sr[i].shallow.includes(s)?n:Vs(n,t4))}e instanceof Error&&(a.message=e.message)}if(a.$name)throw Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(a.$name=i),a}function js(e){if(My(e))return e;if(Array.isArray(e))return e.map(js);if(typeof e!="object")throw Error(`can't deserialize object of type ${typeof e}`);let t4=xd(e)||"Object";if(!sr[t4])throw Error(`can't deserialize unregistered class ${t4}`);let{klass:i}=sr[t4];if(!i)throw Error(`can't deserialize unregistered class ${t4}`);if(i.deserialize)return i.deserialize(e);let r=Object.create(i.prototype);for(let a of Object.keys(e)){if(a==="$name")continue;let s=e[a];r[a]=sr[t4].shallow.includes(a)?s:js(s)}return r}var Oh=class{constructor(){this.first=true}update(t4,i){let r=Math.floor(t4);return this.first?(this.first=false,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t4,this.lastFloorZoom=r,true):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=i),t4!==this.lastZoom&&(this.lastZoom=t4,this.lastFloorZoom=r,true))}},Fe=class{constructor(t4,i){this.zoom=t4,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new Oh,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Oh,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t4=this.zoom,i=t4-Math.floor(t4),r=this.crossFadingFactor();return t4>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*i}}},tn=class{constructor(t4,i,r,a){this.property=t4,this.value=i,this.expression=bw(i===void 0?t4.specification.default:i,r,t4.specification,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}readsGlobalState(t4){let i=this.getGlobalStateRefs();return t4.some(r=>i.has(r))}possiblyEvaluate(t4,i,r){return this.property.possiblyEvaluate(this,t4,i,r)}},$h=class{constructor(t4,i,r){this.property=t4,this.value=new tn(t4,void 0,i,r)}transitioned(t4,i){return i.value===this.value?i:new Tf(this.property,this.value,i,W({},t4.transition,this.transition),t4.now)}untransitioned(){return new Tf(this.property,this.value,null,{},0)}},jl=class{constructor(t4,i,r){this._properties=t4,this._values=Object.create(t4.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=i}_propertyRootKey(t4){return`${this._rootKey}.${String(t4)}`}hasProperty(t4){return t4 in this._properties.defaultTransitionablePropertyValues}getValue(t4){return Wt(this._values[t4].value.value)}setValue(t4,i){Object.hasOwn(this._values,t4)||(this._values[t4]=new $h(this._values[t4].property,this._propertyRootKey(t4),this._globalState)),this._values[t4].value=new tn(this._values[t4].property,i===null?void 0:Wt(i),this._propertyRootKey(t4),this._globalState)}setValues(t4){for(let i in t4){let r=t4[i];i.endsWith("-transition")?this.setTransition(i.slice(0,-11),r):Vi(this._values[i].value.value,r)||this.setValue(i,r)}}getTransition(t4){return Wt(this._values[t4].transition)}setTransition(t4,i){Object.hasOwn(this._values,t4)||(this._values[t4]=new $h(this._values[t4].property,this._propertyRootKey(t4),this._globalState)),this._values[t4].transition=Wt(i)||void 0}retainPriorGlobalState(t4,i,r){for(let a of Object.keys(r._values))for(let s=r._values[a];s;s=s.prior){let{value:n}=s;n.property.specification.transition&&!n.isDataDriven()&&n.expression._globalState===this._globalState&&n.readsGlobalState(t4)&&(s.value=new tn(n.property,n.value,this._propertyRootKey(a),i))}}applyGlobalStateChange(t4,i,r,a){this.retainPriorGlobalState(t4,i,r);let s=false;for(let n of Object.keys(this._values)){let{value:o}=this._values[n];o.readsGlobalState(t4)&&(this.setValue(n,o.value),s=true)}return s?this.transitioned(a,r):r}serialize(){let t4={};for(let i of Object.keys(this._values)){let r=this.getValue(i);r!==void 0&&(t4[i]=r);let a=this.getTransition(i);a!==void 0&&(t4[`${i}-transition`]=a)}return t4}transitioned(t4,i){let r=new Ef(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].transitioned(t4,i._values[a]);return r}untransitioned(){let t4=new Ef(this._properties);for(let i of Object.keys(this._values))t4._values[i]=this._values[i].untransitioned();return t4}},Tf=class{constructor(t4,i,r,a,s){this.property=t4,this.value=i,this.begin=s+a.delay||0,this.end=this.begin+a.duration||0,t4.specification.transition&&(a.delay||a.duration)&&(this.prior=r)}possiblyEvaluate(t4,i,r){let a=t4.now||0,s=this.value.possiblyEvaluate(t4,i,r),n=this.prior;if(!n)return s;if(a>this.end||this.value.isDataDriven())return this.prior=null,s;if(a<this.begin)return n.possiblyEvaluate(t4,i,r);{let o=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(n.possiblyEvaluate(t4,i,r),s,Ix(o))}}},Ef=class{constructor(t4){this._properties=t4,this._values=Object.create(t4.defaultTransitioningPropertyValues)}possiblyEvaluate(t4,i,r){let a=new Ul(this._properties);for(let s of Object.keys(this._values))a._values[s]=this._values[s].possiblyEvaluate(t4,i,r);return a}hasTransition(){for(let t4 of Object.keys(this._values))if(this._values[t4].prior)return true;return false}},Kw=class{constructor(t4,i,r){this._properties=t4,this._values=Object.create(t4.defaultPropertyValues),this._globalState=r,this._rootKey=i}_propertyRootKey(t4){return`${this._rootKey}.${String(t4)}`}hasValue(t4){return this._values[t4].value!==void 0}hasProperty(t4){return t4 in this._properties.defaultPropertyValues}getValue(t4){return Wt(this._values[t4].value)}setValue(t4,i){this._values[t4]=new tn(this._values[t4].property,i===null?void 0:Wt(i),this._propertyRootKey(t4),this._globalState)}serialize(){let t4={};for(let i of Object.keys(this._values)){let r=this.getValue(i);r!==void 0&&(t4[i]=r)}return t4}possiblyEvaluate(t4,i,r){let a=new Ul(this._properties);for(let s of Object.keys(this._values))a._values[s]=this._values[s].possiblyEvaluate(t4,i,r);return a}},gi=class{constructor(t4,i,r){this.property=t4,this.value=i,this.parameters=r}isConstant(){return this.value.kind==="constant"}constantOr(t4){return this.value.kind==="constant"?this.value.value:t4}evaluate(t4,i,r,a){return this.property.evaluate(this.value,this.parameters,t4,i,r,a)}},Ul=class{constructor(t4){this._properties=t4,this._values=Object.create(t4.defaultPossiblyEvaluatedValues)}get(t4){return this._values[t4]}};function Sf(e){if(Array.isArray(e))return e.length;let t4=e==null?void 0:e.values;return Array.isArray(t4)?t4.length:void 0}function Fy(e,t4){let i=Sf(e),r=Sf(t4);return i!==void 0&&r!==void 0&&i!==r}var j=class{constructor(t4,i){this.specification=t4,this.name=i}possiblyEvaluate(t4,i){if(t4.isDataDriven())throw Error("Value should not be data driven");return t4.expression.evaluate(i)}interpolate(t4,i,r){if(Fy(t4,i))return ge(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),i;let a=this.specification.type,s=He[a];return s?s(t4,i,r):t4}},K=class{constructor(t4,i,r){this.specification=t4,this.name=i,this.overrides=r}possiblyEvaluate(t4,i,r,a){return t4.expression.kind==="constant"||t4.expression.kind==="camera"?new gi(this,{kind:"constant",value:t4.expression.evaluate(i,null,{},r,a)},i):new gi(this,t4.expression,i)}interpolate(t4,i,r){if(t4.value.kind!=="constant"||i.value.kind!=="constant")return t4;if(t4.value.value===void 0||i.value.value===void 0)return new gi(this,{kind:"constant",value:void 0},t4.parameters);if(Fy(t4.value.value,i.value.value))return ge(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),i;let a=this.specification.type,s=He[a];if(s){let n=s(t4.value.value,i.value.value,r);return new gi(this,{kind:"constant",value:n},t4.parameters)}return t4}evaluate(t4,i,r,a,s,n){return t4.kind==="constant"?t4.value:t4.evaluate(i,r,a,s,n)}},rn=class extends K{possiblyEvaluate(t4,i,r,a){if(t4.value===void 0)return new gi(this,{kind:"constant",value:void 0},i);if(t4.expression.kind==="constant"){let s=t4.expression.evaluate(i,null,{},r,a),n=t4.property.specification.type==="resolvedImage"&&typeof s!="string"?s.name:s,o=this._calculate(n,n,n,i);return new gi(this,{kind:"constant",value:o},i)}if(t4.expression.kind==="camera"){let s=this._calculate(t4.expression.evaluate({zoom:i.zoom-1}),t4.expression.evaluate({zoom:i.zoom}),t4.expression.evaluate({zoom:i.zoom+1}),i);return new gi(this,{kind:"constant",value:s},i)}return new gi(this,t4.expression,i)}evaluate(t4,i,r,a,s,n){if(t4.kind==="source"){let o=t4.evaluate(i,r,a,s,n);return this._calculate(o,o,o,i)}return t4.kind==="composite"?this._calculate(t4.evaluate({zoom:Math.floor(i.zoom)-1},r,a),t4.evaluate({zoom:Math.floor(i.zoom)},r,a),t4.evaluate({zoom:Math.floor(i.zoom)+1},r,a),i):t4.value}_calculate(t4,i,r,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t4,to:i}:{from:r,to:i}}interpolate(t4){return t4}},zy=class{constructor(t4,i){this.specification=t4,this.name=i}possiblyEvaluate(t4,i,r,a){if(t4.value!==void 0){if(t4.expression.kind==="constant"){let s=t4.expression.evaluate(i,null,{},r,a);return this._calculate(s,s,s,i)}return this._calculate(t4.expression.evaluate(new Fe(Math.floor(i.zoom-1),i)),t4.expression.evaluate(new Fe(Math.floor(i.zoom),i)),t4.expression.evaluate(new Fe(Math.floor(i.zoom+1),i)),i)}}_calculate(t4,i,r,a){return a.zoom>a.zoomHistory.lastIntegerZoom?{from:t4,to:i}:{from:r,to:i}}interpolate(t4){return t4}},Nl=class{constructor(t4,i){this.specification=t4,this.name=i}possiblyEvaluate(t4,i,r,a){return!!t4.expression.evaluate(i,null,{},r,a)}interpolate(){return false}},wt=class{constructor(t4){this.properties=t4,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let i in t4){let r=t4[i];r.specification.overridable&&this.overridableProperties.push(i);let a=this.defaultPropertyValues[i]=new tn(r,void 0,r.name,void 0),s=this.defaultTransitionablePropertyValues[i]=new $h(r,r.name,void 0);this.defaultTransitioningPropertyValues[i]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=a.possiblyEvaluate({})}}};G("DataDrivenProperty",K),G("DataConstantProperty",j),G("CrossFadedDataDrivenProperty",rn),G("CrossFadedProperty",zy),G("ColorRampProperty",Nl);const Df=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Uu=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";var zi=class extends pt{constructor(t4,i,r){if(super(),this.id=t4.id,this.type=t4.type,this._globalState=r,this._featureFilter={filter:()=>true,needGeometry:false,getGlobalStateRefs:()=>new Set},this._visibilityExpression=Hw(this.visibility,`layers[${this.id}].layout.visibility`,r),t4.type!=="custom"&&(this.metadata=t4.metadata,this.minzoom=t4.minzoom,this.maxzoom=t4.maxzoom,t4.type!=="background"&&(this.source=t4.source,this.sourceLayer=t4["source-layer"],this.filter=t4.filter,this._featureFilter=Qs(t4.filter,`layers[${this.id}].filter`,r)),i.layout&&(this._unevaluatedLayout=new Kw(i.layout,`layers[${this.id}].layout`,r)),i.paint)){this._transitionablePaint=new jl(i.paint,`layers[${this.id}].paint`,r);for(let a in t4.paint)this.setPaintProperty(a,t4.paint[a],{validate:false});for(let a in t4.layout)this.setLayoutProperty(a,t4.layout[a],{validate:false});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ul(i.paint)}}setFilter(t4){this.filter=t4,this._featureFilter=Qs(t4,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t4){var i;if(t4==="visibility")return this.visibility;if((i=this._transitionablePaint)!=null&&i.hasProperty(t4))throw Error(t4+Df);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t4}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t4)}getLayoutAffectingGlobalStateRefs(){let t4=new Set;for(let i of this._visibilityExpression.getGlobalStateRefs())t4.add(i);if(this._unevaluatedLayout)for(let i in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[i];for(let a of r.getGlobalStateRefs())t4.add(a)}for(let i of this._featureFilter.getGlobalStateRefs())t4.add(i);return t4}getPaintAffectingGlobalStateRefs(){let t4=new globalThis.Map;if(this._transitionablePaint)for(let i in this._transitionablePaint._values){let r=this._transitionablePaint._values[i].value;for(let a of r.getGlobalStateRefs()){let s=t4.get(a)??[];s.push({name:i,value:r.value}),t4.set(a,s)}}return t4}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t4,i,r={}){var a;if(t4==="visibility"){this.visibility=i,this._visibilityExpression.setValue(i),this.recalculateVisibility();return}if((a=this._transitionablePaint)!=null&&a.hasProperty(t4)){this.fire(new Y(Error(t4+Df)));return}i!=null&&this._validate(qt.layoutProperty,`layers.${this.id}.layout.${t4}`,t4,i,r)||this._unevaluatedLayout.setValue(t4,i)}getPaintProperty(t4){var i,r;if(t4.endsWith("-transition")){let a=t4.slice(0,-11);if(a==="visibility"||(i=this._unevaluatedLayout)!=null&&i.hasProperty(a))throw Error(t4+Uu);return this._transitionablePaint.getTransition(a)}if(t4==="visibility"||(r=this._unevaluatedLayout)!=null&&r.hasProperty(t4))throw Error(t4+Uu);return this._transitionablePaint.getValue(t4)}setPaintProperty(t4,i,r={}){var a;if(t4==="visibility"||(a=this._unevaluatedLayout)!=null&&a.hasProperty(t4))return this.fire(new Y(Error(t4+Uu))),false;if(i!=null&&this._validate(qt.paintProperty,`layers.${this.id}.paint.${t4}`,t4,i,r))return false;if(t4.endsWith("-transition"))return this._transitionablePaint.setTransition(t4.slice(0,-11),i||void 0),false;{let s=this._transitionablePaint._values[t4],n=s.property.specification["property-type"]==="cross-faded-data-driven",o=s.value.isDataDriven(),l=s.value;this._transitionablePaint.setValue(t4,i),this._handleSpecialPaintPropertyUpdate(t4);let u=this._transitionablePaint._values[t4].value;return u.isDataDriven()||o||n||this._handleOverridablePaintPropertyUpdate(t4,l,u)}}_handleSpecialPaintPropertyUpdate(t4){}_handleOverridablePaintPropertyUpdate(t4,i,r){return false}isHidden(t4=this.minzoom,i=false){return this.minzoom&&t4<(i?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&t4>=this.maxzoom?true:this._evaluatedVisibility==="none"}updateTransitions(t4){this._transitioningPaint=this._transitionablePaint.transitioned(t4,this._transitioningPaint)}retainPriorGlobalState(t4,i){var r;(r=this._transitionablePaint)==null||r.retainPriorGlobalState(t4,i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t4,i){t4.getCrossfadeParameters&&(this._crossfadeParameters=t4.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t4,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(t4,void 0,i)}serialize(){var i,r;let t4={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(i=this._unevaluatedLayout)==null?void 0:i.serialize(),paint:(r=this._transitionablePaint)==null?void 0:r.serialize()};return this.visibility&&(t4.layout||(t4.layout={}),t4.layout.visibility=this.visibility),i_(t4,(a,s)=>a!==void 0&&!(s==="layout"&&!Object.keys(a).length)&&!(s==="paint"&&!Object.keys(a).length))}_validate(t4,i,r,a,s={}){return wn(this,t4,{key:i,layerType:this.type,objectKey:r,value:a},s)}is3D(){return false}isTileClipped(){return false}hasOffscreenPass(){return false}resize(){}isStateDependent(){for(let t4 in this.paint._values){let i=this.paint.get(t4);if(i instanceof gi&&Ha(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return true}return false}};let Jw;const Qw=()=>Jw||(Jw=new wt({"raster-opacity":new j(F.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new j(F.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new j(F.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new j(F.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new j(F.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new j(F.paint_raster["raster-contrast"],"raster-contrast"),resampling:new j(F.paint_raster.resampling,"resampling"),"raster-resampling":new j(F.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new j(F.paint_raster["raster-fade-duration"],"raster-fade-duration")}));var e2={get paint(){return Qw()}};const Vh=e=>e.type==="raster";var t2=class extends zi{constructor(t4,i){super(t4,e2,i)}};const i2={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};var Tn=class{constructor(t4,i){this._structArray=t4,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},Qe=class{constructor(){this.isTransferred=false,this.capacity=-1,this.resize(0)}static serialize(t4,i){return t4._trim(),i&&(t4.isTransferred=true,i.push(t4.arrayBuffer)),{length:t4.length,arrayBuffer:t4.arrayBuffer}}static deserialize(t4){let i=Object.create(this.prototype);return i.arrayBuffer=t4.arrayBuffer,i.length=t4.length,i.capacity=t4.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t4){this.reserve(t4),this.length=t4}reserve(t4){if(t4>this.capacity){this.capacity=Math.max(t4,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function Ke(e,t4=1){let i=0,r=0;return{members:e.map(a=>{let s=r2(a.type),n=i=Cf(i,Math.max(t4,s)),o=a.components||1;return r=Math.max(r,s),i+=s*o,{name:a.name,type:a.type,components:o,offset:n}}),size:Cf(i,Math.max(r,t4)),alignment:t4}}function r2(e){return i2[e].BYTES_PER_ELEMENT}function Cf(e,t4){return Math.ceil(e/t4)*t4}var an=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t4,i){let r=this.length;return this.resize(r+1),this.emplace(r,t4,i)}emplace(t4,i,r){let a=t4*2;return this.int16[a+0]=i,this.int16[a+1]=r,t4}};an.prototype.bytesPerElement=4,G("StructArrayLayout2i4",an);var tl=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t4,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t4,i,r)}emplace(t4,i,r,a){let s=t4*3;return this.int16[s+0]=i,this.int16[s+1]=r,this.int16[s+2]=a,t4}};tl.prototype.bytesPerElement=6,G("StructArrayLayout3i6",tl);var jh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t4,i,r,a){let s=this.length;return this.resize(s+1),this.emplace(s,t4,i,r,a)}emplace(t4,i,r,a,s){let n=t4*4;return this.int16[n+0]=i,this.int16[n+1]=r,this.int16[n+2]=a,this.int16[n+3]=s,t4}};jh.prototype.bytesPerElement=8,G("StructArrayLayout4i8",jh);var Uh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s,n){let o=this.length;return this.resize(o+1),this.emplace(o,t4,i,r,a,s,n)}emplace(t4,i,r,a,s,n,o){let l=t4*6;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=s,this.int16[l+4]=n,this.int16[l+5]=o,t4}};Uh.prototype.bytesPerElement=12,G("StructArrayLayout2i4i12",Uh);var Nh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s,n){let o=this.length;return this.resize(o+1),this.emplace(o,t4,i,r,a,s,n)}emplace(t4,i,r,a,s,n,o){let l=t4*4,u=t4*8;return this.int16[l+0]=i,this.int16[l+1]=r,this.uint8[u+4]=a,this.uint8[u+5]=s,this.uint8[u+6]=n,this.uint8[u+7]=o,t4}};Nh.prototype.bytesPerElement=8,G("StructArrayLayout2i4ub8",Nh);var sn=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t4,i){let r=this.length;return this.resize(r+1),this.emplace(r,t4,i)}emplace(t4,i,r){let a=t4*2;return this.float32[a+0]=i,this.float32[a+1]=r,t4}};sn.prototype.bytesPerElement=8,G("StructArrayLayout2f8",sn);var Gh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s,n,o,l,u,h){let c=this.length;return this.resize(c+1),this.emplace(c,t4,i,r,a,s,n,o,l,u,h)}emplace(t4,i,r,a,s,n,o,l,u,h,c){let d=t4*10;return this.uint16[d+0]=i,this.uint16[d+1]=r,this.uint16[d+2]=a,this.uint16[d+3]=s,this.uint16[d+4]=n,this.uint16[d+5]=o,this.uint16[d+6]=l,this.uint16[d+7]=u,this.uint16[d+8]=h,this.uint16[d+9]=c,t4}};Gh.prototype.bytesPerElement=20,G("StructArrayLayout10ui20",Gh);var Zh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s,n,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,t4,i,r,a,s,n,o,l)}emplace(t4,i,r,a,s,n,o,l,u){let h=t4*8;return this.uint16[h+0]=i,this.uint16[h+1]=r,this.uint16[h+2]=a,this.uint16[h+3]=s,this.uint16[h+4]=n,this.uint16[h+5]=o,this.uint16[h+6]=l,this.uint16[h+7]=u,t4}};Zh.prototype.bytesPerElement=16,G("StructArrayLayout8ui16",Zh);var qh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s,n,o,l,u,h,c,d,p){let f=this.length;return this.resize(f+1),this.emplace(f,t4,i,r,a,s,n,o,l,u,h,c,d,p)}emplace(t4,i,r,a,s,n,o,l,u,h,c,d,p,f){let m=t4*14,g=t4*7;return this.int16[m+0]=i,this.int16[m+1]=r,this.int16[m+2]=a,this.int16[m+3]=s,this.uint16[m+4]=n,this.uint16[m+5]=o,this.uint16[m+6]=l,this.uint16[m+7]=u,this.int16[m+8]=h,this.int16[m+9]=c,this.int16[m+10]=d,this.int16[m+11]=p,this.float32[g+6]=f,t4}};qh.prototype.bytesPerElement=28,G("StructArrayLayout4i4ui4i1f28",qh);var Wh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t4,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t4,i,r)}emplace(t4,i,r,a){let s=t4*3;return this.float32[s+0]=i,this.float32[s+1]=r,this.float32[s+2]=a,t4}};Wh.prototype.bytesPerElement=12,G("StructArrayLayout3f12",Wh);var Hh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t4){let i=this.length;return this.resize(i+1),this.emplace(i,t4)}emplace(t4,i){let r=t4*1;return this.uint32[r+0]=i,t4}};Hh.prototype.bytesPerElement=4,G("StructArrayLayout1ul4",Hh);var Xh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s,n,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,t4,i,r,a,s,n,o,l,u)}emplace(t4,i,r,a,s,n,o,l,u,h){let c=t4*10,d=t4*5;return this.int16[c+0]=i,this.int16[c+1]=r,this.int16[c+2]=a,this.int16[c+3]=s,this.int16[c+4]=n,this.int16[c+5]=o,this.uint32[d+3]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,t4}};Xh.prototype.bytesPerElement=20,G("StructArrayLayout6i1ul2ui20",Xh);var Yh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s,n){let o=this.length;return this.resize(o+1),this.emplace(o,t4,i,r,a,s,n)}emplace(t4,i,r,a,s,n,o){let l=t4*6;return this.int16[l+0]=i,this.int16[l+1]=r,this.int16[l+2]=a,this.int16[l+3]=s,this.int16[l+4]=n,this.int16[l+5]=o,t4}};Yh.prototype.bytesPerElement=12,G("StructArrayLayout2i2i2i12",Yh);var Kh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s){let n=this.length;return this.resize(n+1),this.emplace(n,t4,i,r,a,s)}emplace(t4,i,r,a,s,n){let o=t4*4,l=t4*8;return this.float32[o+0]=i,this.float32[o+1]=r,this.float32[o+2]=a,this.int16[l+6]=s,this.int16[l+7]=n,t4}};Kh.prototype.bytesPerElement=16,G("StructArrayLayout2f1f2i16",Kh);var Jh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s,n){let o=this.length;return this.resize(o+1),this.emplace(o,t4,i,r,a,s,n)}emplace(t4,i,r,a,s,n,o){let l=t4*16,u=t4*4,h=t4*8;return this.uint8[l+0]=i,this.uint8[l+1]=r,this.float32[u+1]=a,this.float32[u+2]=s,this.int16[h+6]=n,this.int16[h+7]=o,t4}};Jh.prototype.bytesPerElement=16,G("StructArrayLayout2ub2f2i16",Jh);var il=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t4,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t4,i,r)}emplace(t4,i,r,a){let s=t4*3;return this.uint16[s+0]=i,this.uint16[s+1]=r,this.uint16[s+2]=a,t4}};il.prototype.bytesPerElement=6,G("StructArrayLayout3ui6",il);var Qh=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m,g,_,y){let x=this.length;return this.resize(x+1),this.emplace(x,t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m,g,_,y)}emplace(t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m,g,_,y,x){let v=t4*26,w=t4*13,b=t4*52;return this.int16[v+0]=i,this.int16[v+1]=r,this.uint16[v+2]=a,this.uint16[v+3]=s,this.uint32[w+2]=n,this.uint32[w+3]=o,this.uint32[w+4]=l,this.uint16[v+10]=u,this.uint16[v+11]=h,this.uint16[v+12]=c,this.float32[w+7]=d,this.float32[w+8]=p,this.uint8[b+36]=f,this.uint8[b+37]=m,this.uint8[b+38]=g,this.uint32[w+10]=_,this.int16[v+22]=y,this.float32[w+12]=x,t4}};Qh.prototype.bytesPerElement=52,G("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Qh);var ec=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m,g,_,y,x,v,w,b,T,P,E,I,R,z,S){let A=this.length;return this.resize(A+1),this.emplace(A,t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m,g,_,y,x,v,w,b,T,P,E,I,R,z,S)}emplace(t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m,g,_,y,x,v,w,b,T,P,E,I,R,z,S,A){let D=t4*34,M=t4*17;return this.int16[D+0]=i,this.int16[D+1]=r,this.int16[D+2]=a,this.int16[D+3]=s,this.int16[D+4]=n,this.int16[D+5]=o,this.int16[D+6]=l,this.int16[D+7]=u,this.uint16[D+8]=h,this.uint16[D+9]=c,this.uint16[D+10]=d,this.uint16[D+11]=p,this.uint16[D+12]=f,this.uint16[D+13]=m,this.uint16[D+14]=g,this.uint16[D+15]=_,this.uint16[D+16]=y,this.uint16[D+17]=x,this.uint16[D+18]=v,this.uint16[D+19]=w,this.uint16[D+20]=b,this.uint16[D+21]=T,this.uint16[D+22]=P,this.uint32[M+12]=E,this.float32[M+13]=I,this.float32[M+14]=R,this.uint16[D+30]=z,this.uint16[D+31]=S,this.float32[M+16]=A,t4}};ec.prototype.bytesPerElement=68,G("StructArrayLayout8i15ui1ul2f2ui1f68",ec);var rl=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t4){let i=this.length;return this.resize(i+1),this.emplace(i,t4)}emplace(t4,i){let r=t4*1;return this.float32[r+0]=i,t4}};rl.prototype.bytesPerElement=4,G("StructArrayLayout1f4",rl);var tc=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t4,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t4,i,r)}emplace(t4,i,r,a){let s=t4*6,n=t4*3;return this.uint16[s+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,t4}};tc.prototype.bytesPerElement=12,G("StructArrayLayout1ui2f12",tc);var ic=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t4,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,t4,i,r)}emplace(t4,i,r,a){let s=t4*2,n=t4*4;return this.uint32[s+0]=i,this.uint16[n+2]=r,this.uint16[n+3]=a,t4}};ic.prototype.bytesPerElement=8,G("StructArrayLayout1ul2ui8",ic);var rc=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t4,i){let r=this.length;return this.resize(r+1),this.emplace(r,t4,i)}emplace(t4,i,r){let a=t4*2;return this.uint16[a+0]=i,this.uint16[a+1]=r,t4}};rc.prototype.bytesPerElement=4,G("StructArrayLayout2ui4",rc);var ac=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t4){let i=this.length;return this.resize(i+1),this.emplace(i,t4)}emplace(t4,i){let r=t4*1;return this.uint16[r+0]=i,t4}};ac.prototype.bytesPerElement=2,G("StructArrayLayout1ui2",ac);var sc=class extends Qe{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t4,i,r,a){let s=this.length;return this.resize(s+1),this.emplace(s,t4,i,r,a)}emplace(t4,i,r,a,s){let n=t4*4;return this.float32[n+0]=i,this.float32[n+1]=r,this.float32[n+2]=a,this.float32[n+3]=s,t4}};sc.prototype.bytesPerElement=16,G("StructArrayLayout4f16",sc);var Ry=class extends Tn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new C(this.anchorPointX,this.anchorPointY)}};Ry.prototype.size=20;var ky=class extends Xh{get(t4){return new Ry(this,t4)}};G("CollisionBoxArray",ky);var Ly=class extends Tn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t4){this._structArray.uint8[this._pos1+37]=t4}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t4){this._structArray.uint8[this._pos1+38]=t4}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t4){this._structArray.uint32[this._pos4+10]=t4}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Ly.prototype.size=52;var By=class extends Qh{get(t4){return new Ly(this,t4)}};G("PlacedSymbolArray",By);var Oy=class extends Tn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t4){this._structArray.uint32[this._pos4+12]=t4}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};Oy.prototype.size=68;var $y=class extends ec{get(t4){return new Oy(this,t4)}};G("SymbolInstanceArray",$y);var Vy=class extends rl{getoffsetX(t4){return this.float32[t4*1+0]}};G("GlyphOffsetArray",Vy);var jy=class extends tl{getx(t4){return this.int16[t4*3+0]}gety(t4){return this.int16[t4*3+1]}gettileUnitDistanceFromAnchor(t4){return this.int16[t4*3+2]}};G("SymbolLineVertexArray",jy);var Uy=class extends Tn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};Uy.prototype.size=12;var Ny=class extends tc{get(t4){return new Uy(this,t4)}};G("TextAnchorOffsetArray",Ny);var Gy=class extends Tn{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};Gy.prototype.size=8;var Zy=class extends ic{get(t4){return new Gy(this,t4)}};G("FeatureIndexArray",Zy);var Tr=class extends an{},a2=class extends tl{},s2=class extends jh{},n2=class extends an{},o2=class extends an{},l2=class extends Uh{},u2=class extends Nh{},h2=class extends sn{},xa=class extends Gh{},Pf=class extends Zh{},c2=class extends qh{},d2=class extends Wh{},p2=class extends Hh{},Af=class extends Yh{},f2=class extends Kh{},m2=class extends Jh{},g2=class extends il{},Qi=class extends il{},nc=class extends rc{},_2=class extends ac{};const y2=Ke([{name:"a_pos",components:2,type:"Int16"}],4),v2=y2.members;var We=class Ia{constructor(t4=[]){this._forceNewSegmentOnNextPrepare=false,this.segments=t4}prepareSegment(t4,i,r,a){let s=this.segments[this.segments.length-1];return t4>Ia.MAX_VERTEX_ARRAY_LENGTH&&ge(`Max vertices per segment is ${Ia.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t4}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Ia.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!s||s.vertexLength+t4>Ia.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==a?this.createNewSegment(i,r,a):s}createNewSegment(t4,i,r){let a={vertexOffset:t4.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return r!==void 0&&(a.sortKey=r),this._forceNewSegmentOnNextPrepare=false,this.segments.push(a),a}getOrCreateLatestSegment(t4,i,r){return this.prepareSegment(0,t4,i,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=true}get(){return this.segments}destroy(){for(let t4 of this.segments)for(let i in t4.vaos)t4.vaos[i].destroy()}static simpleSegment(t4,i,r,a){return new Ia([{vertexOffset:t4,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}};We.MAX_VERTEX_ARRAY_LENGTH=2**16-1,G("SegmentVector",We);function If(e,t4){return e=ne(Math.floor(e),0,255),t4=ne(Math.floor(t4),0,255),256*e+t4}const x2=Ke([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),b2=Ke([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var w2=Wc((e,t4)=>{function i(r,a){for(var s=r.length&3,n=r.length-s,o=a,l,u=3432918353,h=461845907,c,d=0;d<n;)c=r.charCodeAt(d)&255|(r.charCodeAt(++d)&255)<<8|(r.charCodeAt(++d)&255)<<16|(r.charCodeAt(++d)&255)<<24,++d,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,s){case 3:c^=(r.charCodeAt(d+2)&255)<<16;case 2:c^=(r.charCodeAt(d+1)&255)<<8;case 1:c^=r.charCodeAt(d)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=r.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}t4!==void 0&&(t4.exports=i)}),T2=Wc((e,t4)=>{function i(r,a){for(var s=r.length,n=a^s,o=0,l;s>=4;)l=r.charCodeAt(o)&255|(r.charCodeAt(++o)&255)<<8|(r.charCodeAt(++o)&255)<<16|(r.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^l,s-=4,++o;switch(s){case 3:n^=(r.charCodeAt(o+2)&255)<<16;case 2:n^=(r.charCodeAt(o+1)&255)<<8;case 1:n^=r.charCodeAt(o)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}t4.exports=i}),al=Qv(Wc((e,t4)=>{var i=w2(),r=T2();t4.exports=i,t4.exports.murmur3=i,t4.exports.murmur2=r})()),qy=class Wy{constructor(){this.ids=[],this.positions=[],this.indexed=false}add(t4,i,r,a){this.ids.push(Mf(t4)),this.positions.push(i,r,a)}getPositions(t4){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let i=Mf(t4),r=0,a=this.ids.length-1;for(;r<a;){let n=r+a>>1;this.ids[n]>=i?a=n:r=n+1}let s=[];for(;this.ids[r]===i;){let n=this.positions[3*r],o=this.positions[3*r+1],l=this.positions[3*r+2];s.push({index:n,start:o,end:l}),r++}return s}static serialize(t4,i){let r=new Float64Array(t4.ids),a=new Uint32Array(t4.positions);return oc(r,a,0,r.length-1),i&&i.push(r.buffer,a.buffer),{ids:r,positions:a}}static deserialize(t4){let i=new Wy;return i.ids=t4.ids,i.positions=t4.positions,i.indexed=true,i}};function Mf(e){let t4=+e;return!isNaN(t4)&&t4<=2**53-1?t4:(0,al.default)(String(e))}function oc(e,t4,i,r){for(;i<r;){let a=e[i+r>>1],s=i-1,n=r+1;for(;;){do s++;while(e[s]<a);do n--;while(e[n]>a);if(s>=n)break;io(e,s,n),io(t4,3*s,3*n),io(t4,3*s+1,3*n+1),io(t4,3*s+2,3*n+2)}n-i<r-n?(oc(e,t4,i,n),i=n+1):(oc(e,t4,n+1,r),r=n)}}function io(e,t4,i){let r=e[t4];e[t4]=e[i],e[i]=r}G("FeaturePositionMap",qy);var fr=class{constructor(t4,i){this.gl=t4.gl,this.location=i}},X=class extends fr{constructor(t4,i){super(t4,i),this.current=0}set(t4){this.current!==t4&&(this.current=t4,this.gl.uniform1i(this.location,t4))}},U=class extends fr{constructor(t4,i){super(t4,i),this.current=0}set(t4){this.current!==t4&&(this.current=t4,this.gl.uniform1f(this.location,t4))}},de=class extends fr{constructor(t4,i){super(t4,i),this.current=[0,0]}set(t4){(t4[0]!==this.current[0]||t4[1]!==this.current[1])&&(this.current=t4,this.gl.uniform2f(this.location,t4[0],t4[1]))}},Vt=class extends fr{constructor(t4,i){super(t4,i),this.current=[0,0,0]}set(t4){(t4[0]!==this.current[0]||t4[1]!==this.current[1]||t4[2]!==this.current[2])&&(this.current=t4,this.gl.uniform3f(this.location,t4[0],t4[1],t4[2]))}},nn=class extends fr{constructor(t4,i){super(t4,i),this.current=[0,0,0,0]}set(t4){(t4[0]!==this.current[0]||t4[1]!==this.current[1]||t4[2]!==this.current[2]||t4[3]!==this.current[3])&&(this.current=t4,this.gl.uniform4f(this.location,t4[0],t4[1],t4[2],t4[3]))}},Ar=class extends fr{constructor(t4,i){super(t4,i),this.current=oe.transparent}set(t4){(t4.r!==this.current.r||t4.g!==this.current.g||t4.b!==this.current.b||t4.a!==this.current.a)&&(this.current=t4,this.gl.uniform4f(this.location,t4.r,t4.g,t4.b,t4.a))}},Ff=class extends fr{constructor(t4,i){super(t4,i),this.current=[]}set(t4){if(t4!=this.current){this.current=t4;let i=new Float32Array(t4.length*4);for(let r=0;r<t4.length;r++)i[4*r]=t4[r].r,i[4*r+1]=t4[r].g,i[4*r+2]=t4[r].b,i[4*r+3]=t4[r].a;this.gl.uniform4fv(this.location,i)}}},zf=class extends fr{constructor(t4,i){super(t4,i),this.current=[]}set(t4){if(t4!=this.current){this.current=t4;let i=new Float32Array(t4);this.gl.uniform1fv(this.location,i)}}};const E2=new Float32Array(16);var Mi=class extends fr{constructor(t4,i){super(t4,i),this.current=E2}set(t4){if(t4[12]!==this.current[12]||t4[0]!==this.current[0]){this.current=t4,this.gl.uniformMatrix4fv(this.location,false,t4);return}for(let i=1;i<16;i++)if(t4[i]!==this.current[i]){this.current=t4,this.gl.uniformMatrix4fv(this.location,false,t4);break}}};function lc(e){return[If(255*e.r,255*e.g),If(255*e.b,255*e.a)]}var ks=class{constructor(t4,i,r){this.value=t4,this.uniformNames=i.map(a=>`u_${a}`),this.type=r}setUniform(t4,i,r){t4.set(r.constantOr(this.value))}getBinding(t4,i,r){return this.type==="color"?new Ar(t4,i):new U(t4,i)}},Or=class{constructor(t4,i){this.uniformNames=i.map(r=>`u_${r}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t4,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=t4.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=t4.tlbr}setConstantDashPositions(t4,i){this.dashTo=[0,t4.y,t4.height,t4.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(t4,i,r,a){let s=null;a==="u_pattern_to"?s=this.patternTo:a==="u_pattern_from"?s=this.patternFrom:a==="u_dasharray_to"?s=this.dashTo:a==="u_dasharray_from"?s=this.dashFrom:a==="u_pixel_ratio_to"?s=this.pixelRatioTo:a==="u_pixel_ratio_from"&&(s=this.pixelRatioFrom),s!==null&&t4.set(s)}getBinding(t4,i,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new nn(t4,i):new U(t4,i)}},tr=class{constructor(t4,i,r,a){this.expression=t4,this.type=r,this.maxValue=0,this.paintVertexAttributes=i.map(s=>({name:`a_${s}`,type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(t4,i,r){let a=this.paintVertexArray.length,s=this.expression.evaluate(new Fe(0,r),i,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t4),this._setPaintValue(a,t4,s)}updatePaintArray(t4,i,r,a,s){let n=this.expression.evaluate(new Fe(0,s),r,a);this._setPaintValue(t4,i,n)}_setPaintValue(t4,i,r){if(this.type==="color"){let a=lc(r);for(let s=t4;s<i;s++)this.paintVertexArray.emplace(s,a[0],a[1])}else{for(let a=t4;a<i;a++)this.paintVertexArray.emplace(a,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t4){var i,r;(i=this.paintVertexArray)!=null&&i.arrayBuffer.byteLength&&((r=this.paintVertexBuffer)!=null&&r.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t4.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},Si=class{constructor(t4,i,r,a,s,n){this.expression=t4,this.uniformNames=i.map(o=>`u_${o}_t`),this.type=r,this.useIntegerZoom=a,this.zoom=s,this.maxValue=0,this.paintVertexAttributes=i.map(o=>({name:`a_${o}`,type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new n}populatePaintArray(t4,i,r){let a=this.expression.evaluate(new Fe(this.zoom,r),i,{},r.canonical,[],r.formattedSection),s=this.expression.evaluate(new Fe(this.zoom+1,r),i,{},r.canonical,[],r.formattedSection),n=this.paintVertexArray.length;this.paintVertexArray.resize(t4),this._setPaintValue(n,t4,a,s)}updatePaintArray(t4,i,r,a,s){let n=this.expression.evaluate(new Fe(this.zoom,s),r,a),o=this.expression.evaluate(new Fe(this.zoom+1,s),r,a);this._setPaintValue(t4,i,n,o)}_setPaintValue(t4,i,r,a){if(this.type==="color"){let s=lc(r),n=lc(a);for(let o=t4;o<i;o++)this.paintVertexArray.emplace(o,s[0],s[1],n[0],n[1])}else{for(let s=t4;s<i;s++)this.paintVertexArray.emplace(s,r,a);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(a))}}upload(t4){var i,r;(i=this.paintVertexArray)!=null&&i.arrayBuffer.byteLength&&((r=this.paintVertexBuffer)!=null&&r.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t4.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t4,i){let r=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,a=ne(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t4.set(a)}getBinding(t4,i,r){return new U(t4,i)}},vr=class{constructor(t4,i,r,a,s,n){this.expression=t4,this.type=i,this.useIntegerZoom=r,this.zoom=a,this.layerId=n,this.zoomInPaintVertexArray=new s,this.zoomOutPaintVertexArray=new s}populatePaintArray(t4,i,r){let a=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t4),this.zoomOutPaintVertexArray.resize(t4),this._setPaintValues(a,t4,this.getPositionIds(i),r)}updatePaintArray(t4,i,r,a,s){this._setPaintValues(t4,i,this.getPositionIds(r),s)}_setPaintValues(t4,i,r,a){let s=this.getPositions(a);if(!s||!r)return;let n=s[r.min],o=s[r.mid],l=s[r.max];if(n&&o&&l)for(let u=t4;u<i;u++)this.emplace(this.zoomInPaintVertexArray,u,n,o),this.emplace(this.zoomOutPaintVertexArray,u,l,o)}upload(t4){var i,r;if((i=this.zoomInPaintVertexArray)!=null&&i.arrayBuffer.byteLength&&((r=this.zoomOutPaintVertexArray)!=null&&r.arrayBuffer.byteLength)){let a=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t4.createVertexBuffer(this.zoomInPaintVertexArray,a,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t4.createVertexBuffer(this.zoomOutPaintVertexArray,a,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Hy=class extends vr{getPositions(t4){return t4.imagePositions}getPositionIds(t4){var i;return(i=t4.patterns)==null?void 0:i[this.layerId]}getVertexAttributes(){return x2.members}emplace(t4,i,r,a){t4.emplace(i,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],a.tlbr[0],a.tlbr[1],a.tlbr[2],a.tlbr[3],r.pixelRatio,a.pixelRatio)}},Xy=class extends vr{getPositions(t4){return t4.dashPositions}getPositionIds(t4){var i;return(i=t4.dashes)==null?void 0:i[this.layerId]}getVertexAttributes(){return b2.members}emplace(t4,i,r,a){t4.emplace(i,0,r.y,r.height,r.width,0,a.y,a.height,a.width)}},Yy=class{constructor(t4,i,r){this.binders={},this._buffers=[];let a=[];for(let s in t4.paint._values){if(!r(s))continue;let n=t4.paint.get(s);if(!(n instanceof gi)||!Ha(n.property.specification))continue;let o=S2(s,t4.type),l=n.value,u=n.property.specification.type,h=n.property.useIntegerZoom,c=n.property.specification["property-type"],d=c==="cross-faded"||c==="cross-faded-data-driven";if(l.kind==="constant")this.binders[s]=d?new Or(l.value,o):new ks(l.value,o,u),a.push(`/u_${s}`);else if(l.kind==="source"||d){let p=Rf(s,u,"source");this.binders[s]=d?s==="line-dasharray"?new Xy(l,u,h,i,p,t4.id):new Hy(l,u,h,i,p,t4.id):new tr(l,o,u,p),a.push(`/a_${s}`)}else{let p=Rf(s,u,"composite");this.binders[s]=new Si(l,o,u,h,i,p),a.push(`/z_${s}`)}}this.cacheKey=a.sort().join("")}getMaxValue(t4){let i=this.binders[t4];return i instanceof tr||i instanceof Si?i.maxValue:0}populatePaintArrays(t4,i,r){for(let a in this.binders){let s=this.binders[a];(s instanceof tr||s instanceof Si||s instanceof vr)&&s.populatePaintArray(t4,i,r)}}setConstantPatternPositions(t4,i){for(let r in this.binders){let a=this.binders[r];a instanceof Or&&a.setConstantPatternPositions(t4,i)}}setConstantDashPositions(t4,i){for(let r in this.binders){let a=this.binders[r];a instanceof Or&&a.setConstantDashPositions(t4,i)}}updatePaintArrays(t4,i,r,a,s){let n=false;for(let o of t4){let l=i.getPositions(o.id);for(let u of l){let h=r.feature(u.index);for(let c in this.binders){let d=this.binders[c];(d instanceof tr||d instanceof Si||d instanceof vr)&&d.expression.isStateDependent===true&&(d.expression=a.paint.get(c).value,d.updatePaintArray(u.start,u.end,h,o.state,s),n=true)}}}return n}defines(){let t4=[];for(let i in this.binders){let r=this.binders[i];(r instanceof ks||r instanceof Or)&&t4.push(...r.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return t4}getBinderAttributes(){let t4=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof tr||r instanceof Si)for(let a of r.paintVertexAttributes)t4.push(a.name);else if(r instanceof vr){let a=r.getVertexAttributes();for(let s of a)t4.push(s.name)}}return t4}getBinderUniforms(){let t4=[];for(let i in this.binders){let r=this.binders[i];if(r instanceof ks||r instanceof Or||r instanceof Si)for(let a of r.uniformNames)t4.push(a)}return t4}getPaintVertexBuffers(){return this._buffers}getUniforms(t4,i){let r=[];for(let a in this.binders){let s=this.binders[a];if(s instanceof ks||s instanceof Or||s instanceof Si){for(let n of s.uniformNames)if(i[n]){let o=s.getBinding(t4,i[n],n);r.push({name:n,property:a,binding:o})}}}return r}setUniforms(t4,i,r,a){for(let{name:s,property:n,binding:o}of i)this.binders[n].setUniform(o,a,r.get(n),s)}updatePaintBuffers(t4){this._buffers=[];for(let i in this.binders){let r=this.binders[i];if(t4&&r instanceof vr){let a=t4.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;a&&this._buffers.push(a)}else(r instanceof tr||r instanceof Si)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t4){for(let i in this.binders){let r=this.binders[i];(r instanceof tr||r instanceof Si||r instanceof vr)&&r.upload(t4)}this.updatePaintBuffers()}destroy(){for(let t4 in this.binders){let i=this.binders[t4];(i instanceof tr||i instanceof Si||i instanceof vr)&&i.destroy()}}},ta=class{constructor(t4,i,r=()=>true){this.programConfigurations={};for(let a of t4)this.programConfigurations[a.id]=new Yy(a,i,r);this.needsUpload=false,this._featureMap=new qy,this._bufferOffset=0}populatePaintArrays(t4,i,r,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(t4,i,a);i.id!==void 0&&this._featureMap.add(i.id,r,this._bufferOffset,t4),this._bufferOffset=t4,this.needsUpload=true}updatePaintArrays(t4,i,r,a){for(let s of r)this.needsUpload=this.programConfigurations[s.id].updatePaintArrays(t4,this._featureMap,i,s,a)||this.needsUpload}get(t4){return this.programConfigurations[t4]}upload(t4){if(this.needsUpload){for(let i in this.programConfigurations)this.programConfigurations[i].upload(t4);this.needsUpload=false}}destroy(){for(let t4 in this.programConfigurations)this.programConfigurations[t4].destroy()}};function S2(e,t4){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(`${t4}-`,"").replace(/-/g,"_")]}function D2(e){return{"line-pattern":{source:xa,composite:xa},"fill-pattern":{source:xa,composite:xa},"fill-extrusion-pattern":{source:xa,composite:xa},"line-dasharray":{source:Pf,composite:Pf}}[e]}function Rf(e,t4,i){var a;let r={color:{source:sn,composite:sc},number:{source:rl,composite:sn}};return((a=D2(e))==null?void 0:a[i])||r[t4][i]}G("ConstantBinder",ks),G("CrossFadedConstantBinder",Or),G("SourceExpressionBinder",tr),G("CrossFadedPatternBinder",Hy),G("CrossFadedDasharrayBinder",Xy),G("CompositeExpressionBinder",Si),G("ProgramConfiguration",Yy,{omit:["_buffers"]}),G("ProgramConfigurationSet",ta);const uc=2**14-1,kf=-uc-1;function na(e){let t4=k/e.extent,i=e.loadGeometry();for(let r of i)for(let a of r){let s=Math.round(a.x*t4),n=Math.round(a.y*t4);a.x=ne(s,kf,uc),a.y=ne(n,kf,uc),(s<a.x||s>a.x+1||n<a.y||n>a.y+1)&&ge("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function oa(e,t4){return{type:e.type,id:e.id,properties:e.properties,geometry:t4?na(e):[]}}const Lf=-32768;function C2(e,t4,i,r,a){e.emplaceBack(Lf+t4*8+r,Lf+i*8+a)}var bd=class{constructor(t4){this.zoom=t4.zoom,this.overscaling=t4.overscaling,this.layers=t4.layers,this.layerIds=this.layers.map(i=>i.id),this.index=t4.index,this.hasDependencies=false,this.layoutVertexArray=new n2,this.indexArray=new Qi,this.segments=new We,this.programConfigurations=new ta(t4.layers,t4.zoom),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(t4,i,r){let a=this.layers[0],s=[],n=null,o=false,l=a.type==="heatmap";if(a.type==="circle"){let d=a;n=d.layout.get("circle-sort-key"),o=!n.isConstant(),l||(l=d.paint.get("circle-pitch-alignment")==="map")}let u=l?i.subdivisionGranularity.circle:1,h=new Fe(this.zoom),c=this.layers[0]._featureFilter.needGeometry;for(let{feature:d,id:p,index:f,sourceLayerIndex:m}of t4){let g=oa(d,c);if(!this.layers[0]._featureFilter.filter(h,g,r))continue;let _=o?n.evaluate(g,{},r):void 0,y={id:p,properties:d.properties,type:d.type,sourceLayerIndex:m,index:f,geometry:c?g.geometry:na(d),patterns:{},sortKey:_};s.push(y)}o&&s.sort((d,p)=>d.sortKey-p.sortKey);for(let d of s){let{geometry:p,index:f,sourceLayerIndex:m}=d,g=t4[f].feature;this.addFeature(d,p,f,r,u),i.featureIndex.insert(g,p,f,m,this.index)}}update(t4,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t4,i,this.stateDependentLayers,{imagePositions:r})}addFeatures(t4){}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t4){this.uploaded||(this.layoutVertexBuffer=t4.createVertexBuffer(this.layoutVertexArray,v2),this.indexBuffer=t4.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t4),this.uploaded=true}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t4,i,r,a,s=1){let n;switch(s){case 1:n=[0,7];break;case 3:n=[0,2,5,7];break;case 5:n=[0,1,3,4,6,7];break;case 7:n=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${s}; valid values are 1, 3, 5, 7.`)}let o=n.length;for(let l of i)for(let u of l){let h=u.x,c=u.y;if(h<0||h>=8192||c<0||c>=8192)continue;let d=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,t4.sortKey),p=d.vertexLength;for(let f=0;f<o;f++)for(let m=0;m<o;m++)C2(this.layoutVertexArray,h,c,n[m],n[f]);for(let f=0;f<o-1;f++)for(let m=0;m<o-1;m++){let g=p+f*o+m,_=p+(f+1)*o+m;this.indexArray.emplaceBack(g,_+1,g+1),this.indexArray.emplaceBack(g,_,_+1)}d.vertexLength+=o*o,d.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t4,r,{imagePositions:{},canonical:a})}};G("CircleBucket",bd,{omit:["layers"]});function Ky(e,t4){for(let i of e)if(Ka(t4,i))return true;for(let i of t4)if(Ka(e,i))return true;return wd(e,t4)}function Gl(e,t4,i){return Ka(e,t4)?true:hc(t4,e,i)}function Jy(e,t4){if(e.length===1)return Bf(t4,e[0]);for(let i of t4)for(let r of i)if(Ka(e,r))return true;for(let i of e)if(Bf(t4,i))return true;for(let i of t4)if(wd(e,i))return true;return false}function P2(e,t4,i){for(let r of t4){if(e.length>=3){for(let a of r)if(Ka(e,a))return true}if(A2(e,r,i))return true}return false}function A2(e,t4,i){if(e.length>1){if(wd(e,t4))return true;for(let r of t4)if(hc(r,e,i))return true}for(let r of e)if(hc(r,t4,i))return true;return false}function wd(e,t4){if(e.length===0||t4.length===0)return false;for(let i=0;i<e.length-1;i++){let r=e[i],a=e[i+1];for(let s=0;s<t4.length-1;s++){let n=t4[s],o=t4[s+1];if(I2(r,a,n,o))return true}}return false}function I2(e,t4,i,r){return wr(e,i,r)!==wr(t4,i,r)&&wr(e,t4,i)!==wr(e,t4,r)}function hc(e,t4,i){let r=i*i;if(t4.length===1)return e.distSqr(t4[0])<r;for(let a=1;a<t4.length;a++){let s=t4[a-1],n=t4[a];if(Qy(e,s,n)<r)return true}return false}function Qy(e,t4,i){let r=t4.distSqr(i);if(r===0)return e.distSqr(t4);let a=((e.x-t4.x)*(i.x-t4.x)+(e.y-t4.y)*(i.y-t4.y))/r;return a<0?e.distSqr(t4):a>1?e.distSqr(i):e.distSqr(i.sub(t4)._mult(a)._add(t4))}function Bf(e,t4){let i=false,r,a,s;for(let n of e){r=n;for(let o=0,l=r.length-1;o<r.length;l=o++)a=r[o],s=r[l],a.y>t4.y!=s.y>t4.y&&t4.x<(s.x-a.x)*(t4.y-a.y)/(s.y-a.y)+a.x&&(i=!i)}return i}function Ka(e,t4){let i=false;for(let r=0,a=e.length-1;r<e.length;a=r++){let s=e[r],n=e[a];s.y>t4.y!=n.y>t4.y&&t4.x<(n.x-s.x)*(t4.y-s.y)/(n.y-s.y)+s.x&&(i=!i)}return i}function M2(e,t4,i,r,a){for(let n of e)if(t4<=n.x&&i<=n.y&&r>=n.x&&a>=n.y)return true;let s=[new C(t4,i),new C(t4,a),new C(r,a),new C(r,i)];if(e.length>2){for(let n of s)if(Ka(e,n))return true}for(let n=0;n<e.length-1;n++){let o=e[n],l=e[n+1];if(F2(o,l,s))return true}return false}function F2(e,t4,i){let r=i[0],a=i[2];if(e.x<r.x&&t4.x<r.x||e.x>a.x&&t4.x>a.x||e.y<r.y&&t4.y<r.y||e.y>a.y&&t4.y>a.y)return false;let s=wr(e,t4,i[0]);return s!==wr(e,t4,i[1])||s!==wr(e,t4,i[2])||s!==wr(e,t4,i[3])}function Ba(e,t4,i){let r=t4.paint.get(e).value;return r.kind==="constant"?r.value:i.programConfigurations.get(t4.id).getMaxValue(e)}function Zl(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function ql(e,t4,i,r,a){if(!t4[0]&&!t4[1])return e;let s=C.convert(t4)._mult(a);i==="viewport"&&s._rotate(-r);let n=[];for(let o of e)n.push(o.sub(s));return n}function z2(e){let t4=[];for(let i=0;i<e.length;i++){let r=e[i],a=t4.at(-1);(i===0||a&&!r.equals(a))&&t4.push(r)}return t4}function R2(e,t4){let i=[];for(let r of e){let a=z2(r),s=[];for(let n=0;n<a.length;n++){let o=a[n],l=a[n-1],u=a[n+1],h=n===0?new C(0,0):o.sub(l)._unit()._perp(),c=n===a.length-1?new C(0,0):u.sub(o)._unit()._perp(),d=h._add(c)._unit(),p=d.x*c.x+d.y*c.y;p!==0&&d._mult(1/p),s.push(d._mult(t4)._add(o))}i.push(s)}return i}function k2({queryGeometry:e,size:t4},i){return Gl(e,i,t4)}function L2({queryGeometry:e,size:t4,transform:i,unwrappedTileID:r,getElevation:a},s){return Gl(e,s,t4*(i.projectTileCoordinates(s.x,s.y,r,a==null?void 0:a(s.x,s.y)).signedDistanceFromCamera/i.cameraToCenterDistance))}function B2({queryGeometry:e,size:t4,transform:i,unwrappedTileID:r,getElevation:a},s){let n=i.projectTileCoordinates(s.x,s.y,r,a==null?void 0:a(s.x,s.y)).signedDistanceFromCamera,o=t4*(i.cameraToCenterDistance/n);return Gl(e,Td(s,i,r,a),o)}function O2({queryGeometry:e,size:t4,transform:i,unwrappedTileID:r,getElevation:a},s){return Gl(e,Td(s,i,r,a),t4)}function e0({queryGeometry:e,size:t4,transform:i,unwrappedTileID:r,getElevation:a,pitchAlignment:s="map",pitchScale:n="map"},o){let l=s==="map"?n==="map"?k2:L2:n==="map"?B2:O2,u={queryGeometry:e,size:t4,transform:i,unwrappedTileID:r,getElevation:a};for(let h of o)for(let c of h)if(l(u,c))return true;return false}function Td(e,t4,i,r){let a=t4.projectTileCoordinates(e.x,e.y,i,r==null?void 0:r(e.x,e.y)).point;return new C((a.x*.5+.5)*t4.width,(-a.y*.5+.5)*t4.height)}function $2(e,t4,i,r){return e.map(a=>Td(a,t4,i,r))}let V2;const j2=()=>V2||(V2=new wt({"circle-sort-key":new K(F.layout_circle["circle-sort-key"],"circle-sort-key")}));let U2;const N2=()=>U2||(U2=new wt({"circle-radius":new K(F.paint_circle["circle-radius"],"circle-radius"),"circle-color":new K(F.paint_circle["circle-color"],"circle-color"),"circle-blur":new K(F.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new K(F.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new j(F.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new j(F.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new j(F.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new j(F.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new K(F.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new K(F.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new K(F.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")}));var G2={get paint(){return N2()},get layout(){return j2()}};const Z2=e=>e.type==="circle";var q2=class extends zi{constructor(t4,i){super(t4,G2,i)}createBucket(t4){return new bd(t4)}queryRadius(t4){let i=t4;return Ba("circle-radius",this,i)+Ba("circle-stroke-width",this,i)+Zl(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t4,feature:i,featureState:r,geometry:a,transform:s,pixelsToTileUnits:n,unwrappedTileID:o,getElevation:l}){let u=ql(t4,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-s.bearingInRadians,n),h=this.paint.get("circle-radius").evaluate(i,r)+this.paint.get("circle-stroke-width").evaluate(i,r),c=this.paint.get("circle-pitch-scale"),d=this.paint.get("circle-pitch-alignment"),p,f;return d==="map"?(p=u,f=h*n):(p=$2(u,s,o,l),f=h),e0({queryGeometry:p,size:f,transform:s,unwrappedTileID:o,getElevation:l,pitchAlignment:d,pitchScale:c},a)}},t0=class extends bd{};G("HeatmapBucket",t0,{omit:["layers"]});let W2;const H2=()=>W2||(W2=new wt({"heatmap-radius":new K(F.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new K(F.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new j(F.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Nl(F.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new j(F.paint_heatmap["heatmap-opacity"],"heatmap-opacity")}));var X2={get paint(){return H2()}};function Ed(e,{width:t4,height:i},r,a){if(!a)a=new Uint8Array(t4*i*r);else if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t4*i*r)throw RangeError(`mismatched image size. expected: ${a.length} but got: ${t4*i*r}`);return e.width=t4,e.height=i,e.data=a,e}function i0(e,{width:t4,height:i},r){if(t4===e.width&&i===e.height)return;let a=Ed({},{width:t4,height:i},r);Sd(e,a,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t4),height:Math.min(e.height,i)},r),e.width=t4,e.height=i,e.data=a.data}function Sd(e,t4,i,r,a,s){if(a.width===0||a.height===0)return t4;if(a.width>e.width||a.height>e.height||i.x>e.width-a.width||i.y>e.height-a.height)throw RangeError("out of range source coordinates for image copy");if(a.width>t4.width||a.height>t4.height||r.x>t4.width-a.width||r.y>t4.height-a.height)throw RangeError("out of range destination coordinates for image copy");let n=e.data,o=t4.data;if(n===o)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l<a.height;l++){let u=((i.y+l)*e.width+i.x)*s,h=((r.y+l)*t4.width+r.x)*s;for(let c=0;c<a.width*s;c++)o[h+c]=n[u+c]}return t4}var Dd=class r0{constructor(t4,i){Ed(this,t4,1,i)}resize(t4){i0(this,t4,1)}clone(){return new r0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t4,i,r,a,s){Sd(t4,i,r,a,s,1)}},je=class a0{constructor(t4,i){Ed(this,t4,4,i)}resize(t4){i0(this,t4,4)}replace(t4,i){i?this.data.set(t4):this.data=t4 instanceof Uint8ClampedArray?new Uint8Array(t4.buffer):t4}clone(){return new a0({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t4,i,r,a,s){Sd(t4,i,r,a,s,4)}setPixel(t4,i,r){let a=(t4*this.width+i)*4;this.data[a+0]=Math.round(r.r*255/r.a),this.data[a+1]=Math.round(r.g*255/r.a),this.data[a+2]=Math.round(r.b*255/r.a),this.data[a+3]=Math.round(r.a*255)}};function Nu(e){let t4=new Uint8Array(e.length);for(let i=0;i<e.length;i+=4){let r=e[i+3];t4[i+0]=Math.round(e[i+0]*r/255),t4[i+1]=Math.round(e[i+1]*r/255),t4[i+2]=Math.round(e[i+2]*r/255),t4[i+3]=r}return t4}G("AlphaImage",Dd),G("RGBAImage",je);function s0(e){let t4={},i=e.resolution||256,r=e.clips?e.clips.length:1,a=e.image||new je({width:i,height:r});if(!Fx(i))throw Error(`width is not a power of 2 - ${i}`);let s=(n,o,l)=>{t4[e.evaluationKey]=l;let u=e.expression.evaluate(t4);a.setPixel(n/4/i,o/4,u)};if(e.clips)for(let n=0,o=0;n<r;++n,o+=i*4)for(let l=0,u=0;l<i;l++,u+=4){let h=l/(i-1),{start:c,end:d}=e.clips[n],p=c*(1-h)+d*h;s(o,u,p)}else for(let n=0,o=0;n<i;n++,o+=4){let l=n/(i-1);s(0,o,l)}return a}const sl="big-fb",Y2=e=>e.type==="heatmap";var K2=class extends zi{createBucket(t4){return new t0(t4)}constructor(t4,i){super(t4,X2,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t4){t4==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let t4=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=s0({expression:t4,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete(sl)}queryRadius(t4){return Ba("heatmap-radius",this,t4)}queryIntersectsFeature({queryGeometry:t4,feature:i,featureState:r,geometry:a,transform:s,pixelsToTileUnits:n,unwrappedTileID:o,getElevation:l}){return e0({queryGeometry:t4,size:this.paint.get("heatmap-radius").evaluate(i,r)*n,transform:s,unwrappedTileID:o,getElevation:l},a)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}};let J2;const Q2=()=>J2||(J2=new wt({"hillshade-illumination-direction":new j(F.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new j(F.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new j(F.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new j(F.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new j(F.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new j(F.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new j(F.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new j(F.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new j(F.paint_hillshade.resampling,"resampling")}));var eT={get paint(){return Q2()}};const tT=e=>e.type==="hillshade";var iT=class extends zi{constructor(t4,i){super(t4,eT,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t4=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,a=this.paint.get("hillshade-shadow-color").values,s=Math.max(t4.length,i.length,r.length,a.length);t4=t4.concat(Array(s-t4.length).fill(t4.at(-1))),i=i.concat(Array(s-i.length).fill(i.at(-1))),r=r.concat(Array(s-r.length).fill(r.at(-1))),a=a.concat(Array(s-a.length).fill(a.at(-1)));let n=i.map(Ze);return{directionRadians:t4.map(Ze),altitudeRadians:n,shadowColor:a,highlightColor:r}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}};let rT;const aT=()=>rT||(rT=new wt({"color-relief-opacity":new j(F["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Nl(F["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new j(F["paint_color-relief"].resampling,"resampling")}));var sT={get paint(){return aT()}};function ro(e){return"data"in e}var dt=class{constructor(t4,i,r,a){this.context=t4,this.format=r,this.texture=t4.gl.createTexture(),this._ownedHandle=this.texture,this.update(i,a)}update(t4,i,r){var h;let{width:a,height:s}=t4,n=(((h=this.size)==null?void 0:h[0])!==a||this.size[1]!==s)&&!r,{context:o}=this,{gl:l}=o;this.useMipmap=!!(i!=null&&i.useMipmap),n&&this.size&&this.format===l.RGBA&&(l.deleteTexture(this.texture),this.texture=l.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),l.bindTexture(l.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(false),o.pixelStoreUnpack.set(1);let u=this.format===l.RGBA&&(i==null?void 0:i.premultiply)!==false;if(n)if(this.size=[a,s],this.format===l.RGBA&&a>0&&s>0){let c=this.useMipmap?Math.floor(Math.log2(Math.max(a,s)))+1:1;if(l.texStorage2D(l.TEXTURE_2D,c,l.RGBA8,a,s),ro(t4)){o.pixelStoreUnpackPremultiplyAlpha.set(false);let{data:d}=t4;u&&d&&(d=Nu(d)),d&&l.texSubImage2D(l.TEXTURE_2D,0,0,0,a,s,l.RGBA,l.UNSIGNED_BYTE,d)}else o.pixelStoreUnpackPremultiplyAlpha.set(u),l.texSubImage2D(l.TEXTURE_2D,0,0,0,l.RGBA,l.UNSIGNED_BYTE,t4)}else ro(t4)?(o.pixelStoreUnpackPremultiplyAlpha.set(false),this._uploadRawData(t4,u,a,s,l)):(o.pixelStoreUnpackPremultiplyAlpha.set(u),this._uploadDomImage(t4,l));else{let{x:c,y:d}=r||{x:0,y:0};ro(t4)?(o.pixelStoreUnpackPremultiplyAlpha.set(false),this._updateRawData(t4,u,c,d,a,s,l)):(o.pixelStoreUnpackPremultiplyAlpha.set(u),this._updateDomImage(t4,c,d,l))}this.useMipmap&&!(ro(t4)&&t4.data===null)&&l.generateMipmap(l.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t4,i){i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,i.UNSIGNED_BYTE,t4)}_uploadRawData(t4,i,r,a,s){let{data:n}=t4;i&&n&&(n=Nu(n)),s.texImage2D(s.TEXTURE_2D,0,this.format,r,a,0,this.format,s.UNSIGNED_BYTE,n)}_updateDomImage(t4,i,r,a){a.texSubImage2D(a.TEXTURE_2D,0,i,r,a.RGBA,a.UNSIGNED_BYTE,t4)}_updateRawData(t4,i,r,a,s,n,o){let{data:l}=t4;i&&l&&(l=Nu(l)),o.texSubImage2D(o.TEXTURE_2D,0,r,a,s,n,o.RGBA,o.UNSIGNED_BYTE,l)}bind(t4,i,r){let{context:a}=this,{gl:s}=a;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),s.bindTexture(s.TEXTURE_2D,this.texture),(r===s.LINEAR_MIPMAP_NEAREST||r===s.LINEAR_MIPMAP_LINEAR)&&!this.useMipmap&&(r=s.LINEAR);let n=r||t4;t4!==this.magFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,t4),this.magFilter=t4),n!==this.minFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,n),this.minFilter=n),i!==this.wrap&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,i),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,i),this.wrap=i)}generateMipmap(){if(!this.useMipmap)return;let{gl:t4}=this.context;t4.bindTexture(t4.TEXTURE_2D,this.texture),t4.generateMipmap(t4.TEXTURE_2D)}destroy(){let{gl:t4}=this.context;t4.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},ur,nT=(ur=class{constructor(t4,i,r,a=1,s=1,n=1,o=0){if(this.uid=t4,i.height!==i.width)throw RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r)){ge(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=i.height;let l=this.dim=i.height-4;switch(this.data=new Uint32Array(i.data.buffer),ur.byteViewCache.set(this,new Uint8Array(this.data.buffer)),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=a,this.greenFactor=s,this.blueFactor=n,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=-2;h<l+2;h++){let c=this._idx(0,Math.max(0,Math.min(l-1,h)));(h<0||h>=l)&&this.data.copyWithin(this._idx(0,h),c,c+l),this.data.fill(this.data[c],this._idx(-2,h),this._idx(0,h)),this.data.fill(this.data[c+l-1],this._idx(l,h),this._idx(l+1,h)+1)}let u=this._getByteView();this.min=2**53-1,this.max=-9007199254740991;for(let h=0;h<l;h++)for(let c=0;c<l;c++){let d=this._idx(h,c)*4,p=this._unpackAtIndex(u,d);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(t4,i){let r=this._getByteView(),a=this._idx(t4,i)*4;return this._unpackAtIndex(r,a)}sampleBilinear(t4,i){let r=Math.floor(t4),a=Math.floor(i);if(r<-1||r>=this.dim||a<-1||a>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${t4}, y: ${i}, dim: ${this.dim}`);let s=this._getByteView(),n=((a+2)*this.stride+r+2)*4,o=this.stride*4,l=t4-r,u=i-a,h=this._unpackAtIndex(s,n),c=this._unpackAtIndex(s,n+4),d=this._unpackAtIndex(s,n+o),p=this._unpackAtIndex(s,n+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+d*(1-l)*u+p*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t4,i){if(t4<-2||t4>=this.dim+2||i<-2||i>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${t4}, y: ${i}, dim: ${this.dim}`);return(i+2)*this.stride+(t4+2)}unpack(t4,i,r){return t4*this.redFactor+i*this.greenFactor+r*this.blueFactor-this.baseShift}pack(t4){return n0(t4,this.getUnpackVector())}getPixels(){return new je({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(t4,i,r){if(this.dim!==t4.dim)throw Error("dem dimension mismatch");let a=i*this.dim,s=i*this.dim+this.dim,n=r*this.dim,o=r*this.dim+this.dim;switch(i){case-1:a=s-2;break;case 1:s=a+2}switch(r){case-1:n=o-2;break;case 1:o=n+2}let l=-i*this.dim,u=-r*this.dim;for(let h=n;h<o;h++)for(let c=a;c<s;c++)this.data[this._idx(c,h)]=t4.data[this._idx(c+l,h+u)]}_getByteView(){let t4=ur.byteViewCache.get(this);return(t4==null?void 0:t4.buffer)!==this.data.buffer&&(t4=new Uint8Array(this.data.buffer),ur.byteViewCache.set(this,t4)),t4}_unpackAtIndex(t4,i){return this.unpack(t4[i],t4[i+1],t4[i+2])}},ur.byteViewCache=new WeakMap,ur);function n0(e,t4){let i=t4[0],r=t4[1],a=t4[2],s=t4[3],n=Math.min(i,r,a),o=Math.round((e+s)/n);return{r:Math.floor(o*n/i)%256,g:Math.floor(o*n/r)%256,b:Math.floor(o*n/a)%256}}G("DEMData",nT);const oT=e=>e.type==="color-relief";var lT=class extends zi{constructor(t4,i){super(t4,sT,i)}_createColorRamp(t4){let i={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof Js&&r._styleExpression.expression instanceof yi){this.colorRampExpression=r;let n=r._styleExpression.expression;i.elevationStops=n.labels,i.colorStops=[];for(let o of i.elevationStops)i.colorStops.push(n.evaluate({globals:{elevation:o}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[oe.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=t4)return i;let a={elevationStops:[],colorStops:[]},s=(i.elevationStops.length-1)/(t4-1);for(let n=0;n<i.elevationStops.length-.5;n+=s)a.elevationStops.push(i.elevationStops[Math.round(n)]),a.colorStops.push(i.colorStops[Math.round(n)]);return ge(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t4}, provided: ${i.elevationStops.length}`),a}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t4,i,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let a=this._createColorRamp(i),s=new je({width:a.colorStops.length,height:1}),n=new je({width:a.colorStops.length,height:1});for(let o=0;o<a.elevationStops.length;o++){let l=n0(a.elevationStops[o],r);n.setPixel(0,o,new oe(l.r/255,l.g/255,l.b/255,1)),s.setPixel(0,o,a.colorStops[o])}return this.colorRampTextures={elevationTexture:new dt(t4,n,t4.gl.RGBA),colorTexture:new dt(t4,s,t4.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}};const uT=Ke([{name:"a_pos",components:2,type:"Int16"}],4),hT=uT.members;function nl(e,t4,i){let r=i.patternDependencies,a=false;for(let s of t4){let n=s.paint.get(`${e}-pattern`);n.isConstant()||(a=true);let o=n.constantOr(null);o&&(a=true,r[o.to]=true,r[o.from]=true)}return a}function Cd(e,t4,i,r,a){let{zoom:s}=r,n=a.patternDependencies;for(let o of t4){let l=o.paint.get(`${e}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:s-1},i,{},a.availableImages),h=l.evaluate({zoom:s},i,{},a.availableImages),c=l.evaluate({zoom:s+1},i,{},a.availableImages);u=u!=null&&u.name?u.name:u,h=h!=null&&h.name?h.name:h,c=c!=null&&c.name?c.name:c,n[u]=true,n[h]=true,n[c]=true,i.patterns[o.id]={min:u,mid:h,max:c}}}return i}const on=new Set;let cc=false;function cT(e,t4,i=2){let r=t4&&t4.length,a=r?t4[0]*i:e.length;on.size&&on.clear();let s=o0(e,0,a,i,true),n=[];if(!s||s.next===s.prev)return n;let o=0,l=0,u=0;if(r&&(s=gT(e,t4,s,i)),e.length>80*i){o=e[0],l=e[1];let h=o,c=l;for(let d=i;d<a;d+=i){let p=e[d],f=e[d+1];p<o&&(o=p),f<l&&(l=f),p>h&&(h=p),f>c&&(c=f)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return dc(s,n,o,l,u),n}function o0(e,t4,i,r,a){let s=null;if(a===AT(e,t4,i,r)>0)for(let n=t4;n<i;n+=r)s=Vf(n/r|0,e[n],e[n+1],s);else for(let n=i-r;n>=t4;n-=r)s=Vf(n/r|0,e[n],e[n+1],s);return s&&ln(s,s.next)&&(hn(s),s=s.next),s}function ia(e,t4=e){let i=t4===e,r=e,a;do a=false,r!==r.next&&(on.size===0||!on.has(r))&&(ln(r,r.next)||ct(r.prev,r,r.next)===0)?((i||r===t4)&&(t4=r.prev),cc=true,hn(r),r=r.prev,a=true):(i||r!==t4)&&(r=r.next,a=!i);while(a||r!==t4);return t4}function dc(e,t4,i,r,a){a&&TT(e,i,r,a);let s=e,n=false;for(;e.prev!==e.next;){let o=e.prev,l=e.next;if(ct(o,e,l)<0&&(a?pT(e,i,r,a):dT(e))){t4.push(o.i,e.i,l.i),hn(e),e=l,s=l;continue}if(e=l,e===s){if(cc=false,e=ia(e),cc){s=e;continue}if(!n){e=fT(e,t4),s=e,n=true;continue}mT(e,t4,i,r,a);break}}}function dT(e){let t4=e.prev,i=e,r=e.next,a=t4.x,s=i.x,n=r.x,o=t4.y,l=i.y,u=r.y,h=Math.min(a,s,n),c=Math.min(o,l,u),d=Math.max(a,s,n),p=Math.max(o,l,u),f=r.next;for(;f!==t4;){if(f.x>=h&&f.x<=d&&f.y>=c&&f.y<=p&&(a!==f.x||o!==f.y)&&ll(a,o,s,l,n,u,f.x,f.y)&&ct(f.prev,f,f.next)>=0)return false;f=f.next}return true}function pT(e,t4,i,r){let a=e.prev,s=e,n=e.next,o=a.x,l=s.x,u=n.x,h=a.y,c=s.y,d=n.y,p=Math.min(o,l,u),f=Math.min(h,c,d),m=Math.max(o,l,u),g=Math.max(h,c,d),_=gc(p,f,t4,i,r),y=gc(m,g,t4,i,r),x=e.prevZ;for(;x&&x.z>=_;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==n&&(o!==x.x||h!==x.y)&&ll(o,h,l,c,u,d,x.x,x.y)&&ct(x.prev,x,x.next)>=0)return false;x=x.prevZ}let v=e.nextZ;for(;v&&v.z<=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&(o!==v.x||h!==v.y)&&ll(o,h,l,c,u,d,v.x,v.y)&&ct(v.prev,v,v.next)>=0)return false;v=v.nextZ}return true}function fT(e,t4){let i=e,r=false;do{let a=i.prev,s=i.next.next;u0(a,i,i.next,s,false)&&un(a,s)&&un(s,a)&&(t4.push(a.i,i.i,s.i),hn(i),hn(i.next),i=e=s,r=true),i=i.next}while(i!==e);return r?ia(i):i}function mT(e,t4,i,r,a){let s=e;do{let n=s.next.next;for(;n!==s.prev;){if(s.i!==n.i&&DT(s,n)){let o=h0(s,n);s=ia(s,s.next),o=ia(o,o.next),dc(s,t4,i,r,a),dc(o,t4,i,r,a);return}n=n.next}s=s.next}while(s!==e)}let pc=false;function gT(e,t4,i,r){let a=[];for(let s=0,n=t4.length;s<n;s++){let o=o0(e,t4[s]*r,s<n-1?t4[s+1]*r:e.length,r,false);o===o.next&&on.add(o),a.push(ST(o))}a.sort(_T),vT(e.length/r,t4.length),l0(i,i),pc=true;for(let s=0;s<a.length;s++)i=yT(a[s],i);return pc=false,ia(i)}function _T(e,t4){return e.x-t4.x||e.y-t4.y||(e.next.y-e.y)/(e.next.x-e.x)-(t4.next.y-t4.y)/(t4.next.x-t4.x)}function yT(e,t4){let i=bT(e,t4);if(!i)return t4;let r=h0(i,e),a=r.next;return l0(i,a.next),ia(r,r.next),ia(i,i.next)}let it=new Float64Array,ol=0;const fc=[],mc=[];function vT(e,t4){let i=Math.ceil((e+2*t4)/16)+t4+2;it.length<i*4&&(it=new Float64Array(i*4)),ol=0}function l0(e,t4){let i=e;do{let r=ol++;fc[r]=i;let a=1/0,s=1/0,n=-1/0,o=-1/0,l=0;do{let h=i.next;i.z=r,i.x<a&&(a=i.x),i.x>n&&(n=i.x),i.y<s&&(s=i.y),i.y>o&&(o=i.y),h.x<a&&(a=h.x),h.x>n&&(n=h.x),h.y<s&&(s=h.y),h.y>o&&(o=h.y),i=h}while(++l<16&&i!==t4);mc[r]=i;let u=r*4;it[u]=a,it[u+1]=s,it[u+2]=n,it[u+3]=o}while(i!==t4)}function xT(e,t4){let i=e.z*4;t4.x<it[i]&&(it[i]=t4.x),t4.y<it[i+1]&&(it[i+1]=t4.y),t4.x>it[i+2]&&(it[i+2]=t4.x),t4.y>it[i+3]&&(it[i+3]=t4.y)}function Of(e){let t4=mc[e];for(;t4.prev.next!==t4;)t4=t4.next;return mc[e]=t4,t4}function $f(e){let t4=fc[e];for(;t4.prev.next!==t4;)t4=t4.next;return fc[e]=t4,t4}function bT(e,t4){let i=t4,r=e.x,a=e.y,s=-1/0,n;if(ln(e,i))return i;for(let d=0,p=0;d<ol;d++,p+=4){if(a<it[p+1]||a>it[p+3]||it[p]>r||it[p+2]<=s)continue;let f=Of(d);i=$f(d);do{if(i.prev.next===i){if(ln(e,i.next))return i.next;if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){let m=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(m<=r&&m>s&&(s=m,n=i.x<i.next.x?i:i.next,m===r))return n}}i=i.next}while(i!==f)}if(!n)return null;let o=n.x,l=n.y,u=Math.min(a,l),h=Math.max(a,l),c=1/0;for(let d=0,p=0;d<ol;d++,p+=4){if(it[p+2]<o||it[p]>r||it[p+3]<u||it[p+1]>h)continue;let f=Of(d);i=$f(d);do{if(i.prev.next===i&&r>=i.x&&i.x>=o&&r!==i.x&&ll(a<l?r:s,a,o,l,a<l?s:r,a,i.x,i.y)){let m=Math.abs(a-i.y)/(r-i.x);(un(i,e)||i.y===a&&i.next.y===a&&i.next.x>r)&&(m<c||m===c&&(i.x>n.x||i.x===n.x&&wT(n,i)))&&(n=i,c=m)}i=i.next}while(i!==f)}return n}function wT(e,t4){return ct(e.prev,e,t4.prev)<0&&ct(t4.next,e,e.next)<0}const pi=[];let ys=[],kr=new Uint32Array,vs=new Uint32Array;const xs=new Uint32Array(256);function TT(e,t4,i,r){let a=e,s=0;do a.z=gc(a.x,a.y,t4,i,r),pi[s++]=a,a=a.next;while(a!==e);ET(s);let n=null;for(let o=0;o<s;o++){let l=pi[o];l.prevZ=n,n&&(n.nextZ=l),n=l}n.nextZ=null}function ET(e){if(e<=32){for(let t4=1;t4<e;t4++){let i=pi[t4],r=i.z,a=t4-1;for(;a>=0&&pi[a].z>r;)pi[a+1]=pi[a],a--;pi[a+1]=i}return}kr.length<e&&(kr=new Uint32Array(e),vs=new Uint32Array(e),ys=Array(e));for(let t4=0;t4<e;t4++)kr[t4]=pi[t4].z;ao(e,pi,kr,ys,vs,0),ao(e,ys,vs,pi,kr,8),ao(e,pi,kr,ys,vs,16),ao(e,ys,vs,pi,kr,24)}function ao(e,t4,i,r,a,s){xs.fill(0);for(let o=0;o<e;o++)xs[i[o]>>>s&255]++;let n=0;for(let o=0;o<256;o++){let l=xs[o];xs[o]=n,n+=l}for(let o=0;o<e;o++){let l=i[o],u=xs[l>>>s&255]++;r[u]=t4[o],a[u]=l}}function gc(e,t4,i,r,a){return e=(e-i)*a|0,t4=(t4-r)*a|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t4=(t4|t4<<8)&16711935,t4=(t4|t4<<4)&252645135,t4=(t4|t4<<2)&858993459,t4=(t4|t4<<1)&1431655765,e|t4<<1}function ST(e){let t4=e,i=e;do(t4.x<i.x||t4.x===i.x&&t4.y<i.y)&&(i=t4),t4=t4.next;while(t4!==e);return i}function ll(e,t4,i,r,a,s,n,o){return(a-n)*(t4-o)>=(e-n)*(s-o)&&(e-n)*(r-o)>=(i-n)*(t4-o)&&(i-n)*(s-o)>=(a-n)*(r-o)}function DT(e,t4){let i=ln(e,t4)&&ct(e.prev,e,e.next)>0&&ct(t4.prev,t4,t4.next)>0;return e.next.i!==t4.i&&(i||un(e,t4)&&un(t4,e)&&(ct(e.prev,e,t4.prev)!==0||ct(e,t4.prev,t4)!==0))&&!CT(e,t4)&&(i||PT(e,t4))}function ct(e,t4,i){return(t4.y-e.y)*(i.x-t4.x)-(t4.x-e.x)*(i.y-t4.y)}function ln(e,t4){return e.x===t4.x&&e.y===t4.y}function u0(e,t4,i,r,a=true){let s=ct(e,t4,i),n=ct(e,t4,r),o=ct(i,r,e),l=ct(i,r,t4);return(s>0&&n<0||s<0&&n>0)&&(o>0&&l<0||o<0&&l>0)?true:a?!!(s===0&&so(e,i,t4)||n===0&&so(e,r,t4)||o===0&&so(i,e,r)||l===0&&so(i,t4,r)):false}function so(e,t4,i){return t4.x<=Math.max(e.x,i.x)&&t4.x>=Math.min(e.x,i.x)&&t4.y<=Math.max(e.y,i.y)&&t4.y>=Math.min(e.y,i.y)}function CT(e,t4){let i=Math.min(e.x,t4.x),r=Math.max(e.x,t4.x),a=Math.min(e.y,t4.y),s=Math.max(e.y,t4.y),n=e;do{let o=n.next;if(n.x>r&&o.x>r||n.x<i&&o.x<i||n.y>s&&o.y>s||n.y<a&&o.y<a){n=o;continue}if(n.i!==e.i&&o.i!==e.i&&n.i!==t4.i&&o.i!==t4.i&&u0(n,o,e,t4))return true;n=o}while(n!==e);return false}function un(e,t4){return ct(e.prev,e,e.next)<0?ct(e,t4,e.next)>=0&&ct(e,e.prev,t4)>=0:ct(e,t4,e.prev)<0||ct(e,e.next,t4)<0}function PT(e,t4){let i=e,r=false,a=(e.x+t4.x)/2,s=(e.y+t4.y)/2;do{let n=i.next;i.y>s!=n.y>s&&a<(n.x-i.x)*(s-i.y)/(n.y-i.y)+i.x&&(r=!r),i=n}while(i!==e);return r}function h0(e,t4){let i=_c(e.i,e.x,e.y),r=_c(t4.i,t4.x,t4.y),a=e.next,s=t4.prev;return e.next=t4,t4.prev=e,i.next=a,a.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function Vf(e,t4,i,r){let a=_c(e,t4,i);return r?(a.next=r.next,a.prev=r,r.next.prev=a,r.next=a):(a.prev=a,a.next=a),a}function hn(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ),pc&&xT(e.prev,e.next)}function _c(e,t4,i){return{i:e,x:t4,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function AT(e,t4,i,r){let a=0;for(let s=t4,n=i-r;s<i;s+=r)a+=(e[n]-e[s])*(e[s+1]+e[n+1]),n=s;return a}var nr=class{constructor(t4,i){if(i>t4)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t4,this._minGranularity=i}getGranularityForZoomLevel(t4){let i=1<<t4;return Math.max(Math.floor(this._baseZoomGranularity/i),this._minGranularity,1)}},Kr,Pd=(Kr=class{constructor(t4){this.fill=t4.fill,this.line=t4.line,this.tile=t4.tile,this.stencil=t4.stencil,this.circle=t4.circle}},Kr.noSubdivision=new Kr({fill:new nr(0,0),line:new nr(0,0),tile:new nr(0,0),stencil:new nr(0,0),circle:1}),Kr);G("SubdivisionGranularityExpression",nr),G("SubdivisionGranularitySetting",Pd);const Us=-32768,Ns=32767;var IT=class{constructor(t4,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=false,this._granularity=t4,this._granularityCellSize=k/t4,this._canonical=i}_getKey(t4,i){return t4+=32768,i+=32768,t4<<16|i<<0}_vertexToIndex(t4,i){if(t4<-32768||i<-32768||t4>32767||i>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let r=Math.round(t4)|0,a=Math.round(i)|0,s=this._getKey(r,a),n=this._vertexDictionary.get(s);if(n!==void 0)return n;let o=this._vertexBuffer.length/2;return this._vertexDictionary.set(s,o),this._vertexBuffer.push(r,a),o}_subdivideTrianglesScanline(t4,i){if(this._granularity<2)return zT(this._vertexBuffer,FT(t4,i));let r=[],a=t4.length;for(let s=0;s<a;s+=3){let n=[i[t4[s+0]],i[t4[s+1]],i[t4[s+2]]],o=[this._vertexBuffer[n[0]*2+0],this._vertexBuffer[n[0]*2+1],this._vertexBuffer[n[1]*2+0],this._vertexBuffer[n[1]*2+1],this._vertexBuffer[n[2]*2+0],this._vertexBuffer[n[2]*2+1]],l=1/0,u=1/0,h=-1/0,c=-1/0;for(let g=0;g<3;g++){let _=o[g*2],y=o[g*2+1];l=Math.min(l,_),h=Math.max(h,_),u=Math.min(u,y),c=Math.max(c,y)}if(l===h||u===c)continue;let d=Math.floor(l/this._granularityCellSize),p=Math.ceil(h/this._granularityCellSize),f=Math.floor(u/this._granularityCellSize),m=Math.ceil(c/this._granularityCellSize);if(d===p&&f===m){r.push(...n);continue}for(let g=f;g<m;g++){let _=this._scanlineGenerateVertexRingForCellRow(g,o,n);RT(this._vertexBuffer,_,r)}}return r}_scanlineGenerateVertexRingForCellRow(t4,i,r){let a=t4*this._granularityCellSize,s=a+this._granularityCellSize,n=[];for(let o=0;o<3;o++){let l=i[o*2],u=i[o*2+1],h=i[(o+1)*2%6],c=i[((o+1)*2+1)%6],d=i[(o+2)*2%6],p=i[((o+2)*2+1)%6],f=h-l,m=c-u,g=f===0,_=m===0,y=(a-u)/m,x=(s-u)/m,v=Math.min(y,x),w=Math.max(y,x);if(!_&&(v>=1||w<=0)||_&&(u<a||u>s)){c>=a&&c<=s&&n.push(r[(o+1)%3]);continue}if(!_&&v>0){let P=l+f*v,E=u+m*v;n.push(this._vertexToIndex(P,E))}let b=l+f*Math.max(v,0),T=l+f*Math.min(w,1);if(g||this._generateIntraEdgeVertices(n,l,u,h,c,b,T),!_&&w<1){let P=l+f*w,E=u+m*w;n.push(this._vertexToIndex(P,E))}(_||c>=a&&c<=s)&&n.push(r[(o+1)%3]),!_&&(c<=a||c>=s)&&this._generateInterEdgeVertices(n,l,u,h,c,d,p,T,a,s)}return n}_generateIntraEdgeVertices(t4,i,r,a,s,n,o){let l=a-i,u=s-r,h=u===0,c=h?Math.min(i,a):Math.min(n,o),d=h?Math.max(i,a):Math.max(n,o),p=Math.floor(c/this._granularityCellSize)+1,f=Math.ceil(d/this._granularityCellSize)-1;if(h?i<a:n<o)for(let m=p;m<=f;m++){let g=m*this._granularityCellSize,_=r+u*(g-i)/l;t4.push(this._vertexToIndex(g,_))}else for(let m=f;m>=p;m--){let g=m*this._granularityCellSize,_=r+u*(g-i)/l;t4.push(this._vertexToIndex(g,_))}}_generateInterEdgeVertices(t4,i,r,a,s,n,o,l,u,h){let c=s-r,d=n-a,p=o-s,f=(u-s)/p,m=(h-s)/p,g=Math.min(f,m),_=Math.max(f,m),y=a+d*g,x=Math.floor(Math.min(y,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(y,l)/this._granularityCellSize)-1,w=l<y,b=p===0;if(b&&(o===u||o===h))return;if(b||g>=1||_<=0){let P=i-n,E=r-o,I=(u-o)/E,R=(h-o)/E,z=n+P*Math.min(I,R);x=Math.floor(Math.min(z,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(z,l)/this._granularityCellSize)-1,w=l<z}let T=c>0?h:u;if(w)for(let P=x;P<=v;P++){let E=P*this._granularityCellSize;t4.push(this._vertexToIndex(E,T))}else for(let P=v;P>=x;P--){let E=P*this._granularityCellSize;t4.push(this._vertexToIndex(E,T))}}_generateOutline(t4,i){let r=[],a=0;for(let s of t4){let n=this._granularity<2?this._ringPathIndices(s,a,i):this._pointArrayToIndices(Nr(s,this._granularity,true));a+=s.length;let o=[];for(let l=1;l<n.length;l++)o.push(n[l-1]),o.push(n[l]);r.push(o)}return r}_ringPathIndices(t4,i,r){let a=r.slice(i,i+t4.length);return a.length>=2&&d0(t4)&&a.push(a[0]),a}_handlePoles(t4){let i=false,r=false;this._canonical&&(this._canonical.y===0&&(i=true),this._canonical.y===(1<<this._canonical.z)-1&&(r=true)),(i||r)&&this._fillPoles(t4,i,r)}_ensureNoPoleVertices(){let t4=this._vertexBuffer;for(let i=0;i<t4.length;i+=2){let r=t4[i+1];r===-32768&&(t4[i+1]=-32767),r===32767&&(t4[i+1]=32766)}}_generatePoleQuad(t4,i,r,a,s,n){a>s==(n===-32768)?(t4.push(r),t4.push(i),t4.push(this._vertexToIndex(a,n)),t4.push(this._vertexToIndex(s,n)),t4.push(r),t4.push(this._vertexToIndex(a,n))):(t4.push(i),t4.push(r),t4.push(this._vertexToIndex(a,n)),t4.push(r),t4.push(this._vertexToIndex(s,n)),t4.push(this._vertexToIndex(a,n)))}_fillPoles(t4,i,r){let a=this._vertexBuffer,s=k,n=t4.length;for(let o=2;o<n;o+=3){let l=t4[o-2],u=t4[o-1],h=t4[o],c=a[l*2],d=a[l*2+1],p=a[u*2],f=a[u*2+1],m=a[h*2],g=a[h*2+1];i&&(d===0&&f===0&&this._generatePoleQuad(t4,l,u,c,p,Us),f===0&&g===0&&this._generatePoleQuad(t4,u,h,p,m,Us),g===0&&d===0&&this._generatePoleQuad(t4,h,l,m,c,Us)),r&&(d===s&&f===s&&this._generatePoleQuad(t4,l,u,c,p,Ns),f===s&&g===s&&this._generatePoleQuad(t4,u,h,p,m,Ns),g===s&&d===s&&this._generatePoleQuad(t4,h,l,m,c,Ns))}}_initializeVertices(t4){let i=[];for(let r=0;r<t4.length;r+=2)i.push(this._vertexToIndex(t4[r],t4[r+1]));return i}subdividePolygonInternal(t4,i){var l;if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=true;let{flattened:r,holeIndices:a}=MT(t4),s=this._initializeVertices(r),n;try{let u=cT(r,a);n=this._subdivideTrianglesScanline(u,s)}catch(u){console.error(u)}let o=[];return i&&(o=this._generateOutline(t4,s)),this._ensureNoPoleVertices(),this._handlePoles(n),this._granularity>=2&&((l=this._canonical)==null?void 0:l.z)===0&&(n=this._removeTrianglesOutsideTileX(n),o=o.map(u=>this._removeLinesOutsideTileX(u))),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_vertexOutsideTileX(t4){let i=this._vertexBuffer[t4*2];return i<0||i>8192}_removeTrianglesOutsideTileX(t4){let i=[];for(let r=0;r<t4.length;r+=3)this._vertexOutsideTileX(t4[r])||this._vertexOutsideTileX(t4[r+1])||this._vertexOutsideTileX(t4[r+2])||i.push(t4[r],t4[r+1],t4[r+2]);return i}_removeLinesOutsideTileX(t4){let i=[];for(let r=0;r<t4.length;r+=2)this._vertexOutsideTileX(t4[r])||this._vertexOutsideTileX(t4[r+1])||i.push(t4[r],t4[r+1]);return i}_pointArrayToIndices(t4){let i=[];for(let r of t4)i.push(this._vertexToIndex(r.x,r.y));return i}};function c0(e,t4,i,r=true){return new IT(i,t4).subdividePolygonInternal(e,r)}function Nr(e,t4,i=false){if(!e||e.length<1||e.length<2)return[];let r=i&&d0(e);if(t4<2)return r?[...e,e[0]]:[...e];let a=Math.floor(k/t4),s=[];s.push(new C(e[0].x,e[0].y));let n=e.length,o=r?n:n-1;for(let l=0;l<o;l++){let u=e[l],h=l<n-1?e[l+1]:e[0],c=u.x,d=u.y,p=h.x,f=h.y,m=c!==p,g=d!==f;if(!m&&!g)continue;let _=p-c,y=f-d,x=Math.abs(_),v=Math.abs(y),w=c,b=d;for(;;){let P=_>0?(Math.floor(w/a)+1)*a:(Math.ceil(w/a)-1)*a,E=y>0?(Math.floor(b/a)+1)*a:(Math.ceil(b/a)-1)*a,I=Math.abs(w-P),R=Math.abs(b-E),z=Math.abs(w-p),S=Math.abs(b-f),A=m?I/x:1/0,D=g?R/v:1/0;if((z<=I||!m)&&(S<=R||!g))break;if(A<D&&m||!g){w=P,b+=y*A;let M=new C(w,Math.round(b));(s[s.length-1].x!==M.x||s[s.length-1].y!==M.y)&&s.push(M)}else{w+=_*D,b=E;let M=new C(Math.round(w),b);(s[s.length-1].x!==M.x||s[s.length-1].y!==M.y)&&s.push(M)}}let T=new C(p,f);(s[s.length-1].x!==T.x||s[s.length-1].y!==T.y)&&s.push(T)}return s}function d0(e){return!e[0].equals(e[e.length-1])}function MT(e){let t4=[],i=[];for(let r of e)if(r.length!==0){r!==e[0]&&t4.push(i.length/2);for(let a of r)i.push(a.x),i.push(a.y)}return{flattened:i,holeIndices:t4}}function FT(e,t4){let i=Array(e.length);for(let r=0;r<e.length;r++)i[r]=t4[e[r]];return i}function zT(e,t4){let i=[];for(let r=0;r<t4.length;r+=3){let a=t4[r],s=t4[r+1],n=t4[r+2],o=e[a*2],l=e[a*2+1],u=e[s*2],h=e[s*2+1],c=e[n*2],d=e[n*2+1],p=u-o,f=h-l,m=c-o;p*(d-l)-f*m>0?(i.push(a),i.push(n),i.push(s)):(i.push(a),i.push(s),i.push(n))}return i}function RT(e,t4,i){if(t4.length===0)throw Error("Subdivision vertex ring is empty.");let r=0,a=e[t4[0]*2];for(let l=1;l<t4.length;l++){let u=e[t4[l]*2];u<a&&(a=u,r=l)}let s=t4.length,n=r,o=(n+1)%s;for(;;){let l=n-1>=0?n-1:s-1,u=(o+1)%s,h=e[t4[l]*2],c=e[t4[l]*2+1],d=e[t4[u]*2],p=e[t4[u]*2+1],f=e[t4[n]*2],m=e[t4[n]*2+1],g=e[t4[o]*2],_=e[t4[o]*2+1],y=false;if(h<d)y=true;else if(h>d)y=false;else{let x=_-m,v=-(g-f),w=m<_?1:-1;((h-f)*x+(c-m)*v)*w>((d-f)*x+(p-m)*v)*w&&(y=true)}if(y){let x=t4[l],v=t4[n],w=t4[o];x!==v&&x!==w&&v!==w&&i.push(w,v,x),n--,n<0&&(n=s-1)}else{let x=t4[u],v=t4[n],w=t4[o];x!==v&&x!==w&&v!==w&&i.push(w,v,x),o++,o>=s&&(o=0)}if(l===u)break}}function p0(e,t4,i,r,a,s,n,o,l){let u=a.length/2,h=n&&o&&l;if(u<We.MAX_VERTEX_ARRAY_LENGTH){let c=t4.prepareSegment(u,i,r),d=c.vertexLength;for(let m=0;m<s.length;m+=3)r.emplaceBack(d+s[m],d+s[m+1],d+s[m+2]);c.vertexLength+=u,c.primitiveLength+=s.length/3;let p,f;h&&(f=n.prepareSegment(u,i,o),p=f.vertexLength,f.vertexLength+=u);for(let m=0;m<a.length;m+=2)e(a[m],a[m+1]);if(h)for(let m of l){for(let g=1;g<m.length;g+=2)o.emplaceBack(p+m[g-1],p+m[g]);f.primitiveLength+=m.length/2}}else kT(t4,i,r,a,s,e),h&&LT(n,i,o,a,l,e),t4.forceNewSegmentOnNextPrepare(),n==null||n.forceNewSegmentOnNextPrepare()}function Gs(e,t4,i,r,a,s,n){if(s){let o=r.count;return i(t4[a*2],t4[a*2+1]),e[a]=r.count,r.count++,n.vertexLength++,o}return e[a]}function kT(e,t4,i,r,a,s){let n=[];for(let c=0;c<r.length/2;c++)n.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t4,i),h=u.vertexLength;for(let c=2;c<a.length;c+=3){let d=a[c-2],p=a[c-1],f=a[c],m=n[d]<l,g=n[p]<l,_=n[f]<l,y=+!!m+ +!!g+ +!!_;u.vertexLength+y>We.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t4,i),l=o.count,m=true,g=true,_=true,h=0);let x=Gs(n,r,s,o,d,m,u),v=Gs(n,r,s,o,p,g,u),w=Gs(n,r,s,o,f,_,u);i.emplaceBack(h+x-l,h+v-l,h+w-l),u.primitiveLength++}}function LT(e,t4,i,r,a,s){let n=[];for(let c=0;c<r.length/2;c++)n.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t4,i),h=u.vertexLength;for(let c of a)for(let d=1;d<c.length;d+=2){let p=c[d-1],f=c[d],m=n[p]<l,g=n[f]<l,_=+!!m+ +!!g;u.vertexLength+_>We.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t4,i),l=o.count,m=true,g=true,h=0);let y=Gs(n,r,s,o,p,m,u),x=Gs(n,r,s,o,f,g,u);i.emplaceBack(h+y-l,h+x-l),u.primitiveLength++}}var f0=class{constructor(t4){this.zoom=t4.zoom,this.overscaling=t4.overscaling,this.layers=t4.layers,this.layerIds=this.layers.map(i=>i.id),this.index=t4.index,this.hasDependencies=false,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new o2,this.indexArray=new Qi,this.indexArray2=new nc,this.programConfigurations=new ta(t4.layers,t4.zoom),this.segments=new We,this.segments2=new We,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(t4,i,r){this.hasDependencies=nl("fill",this.layers,i);let a=this.layers[0].layout.get("fill-sort-key"),s=!a.isConstant(),n=[],o=new Fe(this.zoom),l=this.layers[0]._featureFilter.needGeometry;for(let{feature:u,id:h,index:c,sourceLayerIndex:d}of t4){let p=oa(u,l);if(!this.layers[0]._featureFilter.filter(o,p,r))continue;let f=s?a.evaluate(p,{},r,i.availableImages):void 0,m={id:h,properties:u.properties,type:u.type,sourceLayerIndex:d,index:c,geometry:l?p.geometry:na(u),patterns:{},sortKey:f};n.push(m)}s&&n.sort((u,h)=>u.sortKey-h.sortKey);for(let u of n){let{geometry:h,index:c,sourceLayerIndex:d}=u;if(this.hasDependencies){let f=Cd("fill",this.layers,u,{zoom:this.zoom},i);this.patternFeatures.push(f)}else this.addFeature(u,h,c,r,{},i.subdivisionGranularity);let p=t4[c].feature;i.featureIndex.insert(p,h,c,d,this.index)}}update(t4,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t4,i,this.stateDependentLayers,{imagePositions:r})}addFeatures({options:t4,canonical:i,patternPositions:r,patternMap:a}){this.detectSdfPatterns(a);for(let s of this.patternFeatures)this.addFeature(s,s.geometry,s.index,i,r,t4.subdivisionGranularity)}detectSdfPatterns(t4){for(let i of this.patternFeatures)for(let r in i.patterns){let a=i.patterns[r];this.recordSdfPattern(r,t4[a.min]),this.recordSdfPattern(r,t4[a.mid]),this.recordSdfPattern(r,t4[a.max])}for(let i of this.layers){let r=i.paint.get("fill-pattern").constantOr(null);r&&(this.recordSdfPattern(i.id,t4[r.from.toString()]),this.recordSdfPattern(i.id,t4[r.to.toString()]))}}recordSdfPattern(t4,i){if(!i)return;let r=i.sdf===true,a=this.sdfPatterns[t4];a===void 0?this.sdfPatterns[t4]=r:a!==r&&ge(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer "${t4}"`)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t4){this.uploaded||(this.layoutVertexBuffer=t4.createVertexBuffer(this.layoutVertexArray,hT),this.indexBuffer=t4.createIndexBuffer(this.indexArray),this.indexBuffer2=t4.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t4),this.uploaded=true}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t4,i,r,a,s,n){for(let o of zl(i,500)){let l=c0(o,a,n.fill.getGranularityForZoomLevel(a.z)),u=this.layoutVertexArray;p0((h,c)=>{u.emplaceBack(h,c)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles,this.segments2,this.indexArray2,l.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t4,r,{imagePositions:s,canonical:a})}};G("FillBucket",f0,{omit:["layers","patternFeatures"]});let BT;const OT=()=>BT||(BT=new wt({"fill-sort-key":new K(F.layout_fill["fill-sort-key"],"fill-sort-key")}));let $T;const VT=()=>$T||($T=new wt({"fill-antialias":new j(F.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new K(F.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new j(F.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new K(F.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new K(F.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new j(F.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new j(F.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new rn(F.paint_fill["fill-pattern"],"fill-pattern")}));var jT={get paint(){return VT()},get layout(){return OT()}};const UT=e=>e.type==="fill";var NT=class extends zi{constructor(t4,i){super(t4,jT,i)}recalculate(t4,i){super.recalculate(t4,i);let r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t4){return new f0(t4)}queryRadius(){return Zl(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t4,geometry:i,transform:r,pixelsToTileUnits:a}){return Jy(ql(t4,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,a),i)}isTileClipped(){return true}};const GT=Ke([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ZT=Ke([{name:"a_centroid",components:2,type:"Int16"}],4),qT=GT.members;var Ai=class yc{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t4){return this.minX=Math.min(this.minX,t4.x),this.minY=Math.min(this.minY,t4.y),this.maxX=Math.max(this.maxX,t4.x),this.maxY=Math.max(this.maxY,t4.y),this}expandBy(t4){return this.minX-=t4,this.minY-=t4,this.maxX+=t4,this.maxY+=t4,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t4){return this.expandBy(-t4)}map(t4){let i=new yc;return i.extend(t4(new C(this.minX,this.minY))),i.extend(t4(new C(this.maxX,this.minY))),i.extend(t4(new C(this.minX,this.maxY))),i.extend(t4(new C(this.maxX,this.maxY))),i}static fromPoints(t4){let i=new yc;for(let r of t4)i.extend(r);return i}contains(t4){return t4.x>=this.minX&&t4.x<=this.maxX&&t4.y>=this.minY&&t4.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t4){return!this.empty()&&!t4.empty()&&t4.minX>=this.minX&&t4.maxX<=this.maxX&&t4.minY>=this.minY&&t4.maxY<=this.maxY}intersects(t4){return!this.empty()&&!t4.empty()&&t4.minX<=this.maxX&&t4.maxX>=this.minX&&t4.minY<=this.maxY&&t4.maxY>=this.minY}};const WT=Ai.fromPoints([new C(0,0),new C(k,k)]);function vc(e,t4){return e.x===t4.x&&(e.x<0||e.x>8192)||e.y===t4.y&&(e.y<0||e.y>8192)}function jf(e){return e.every(t4=>t4.x<0)||e.every(t4=>t4.x>8192)||e.every(t4=>t4.y<0)||e.every(t4=>t4.y>8192)}var En=class{constructor(t4,i,r,a,s){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=t4,this._geometry=-1,this._keys=a,this._values=s;t4.pos<i;){let n=t4.readVarint();if(n===8)this.id=t4.readVarint();else if(n===18){let o=t4.readVarint()+t4.pos;for(;t4.pos<o;){let l=a[t4.readVarint()],u=s[t4.readVarint()];this.properties[l]=u}}else n===24?this.type=t4.readVarint():(n===34&&(this._geometry=t4.pos),t4.skip(n))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");let t4=this._pbf;t4.pos=this._geometry;let i=t4.readVarint()+t4.pos,r=[],a,s=1,n=0,o=0,l=0;for(;t4.pos<i;){if(n<=0){let u=t4.readVarint();if(s=u&7,n=u>>3,n===0)continue}if(n--,s===1)o+=t4.readSVarint(),l+=t4.readSVarint(),a&&r.push(a),a=[new C(o,l)];else if(s===2)o+=t4.readSVarint(),l+=t4.readSVarint(),a&&a.push(new C(o,l));else if(s===7)a&&a.push(a[0].clone());else throw Error(`unknown command ${s}`)}return a&&r.push(a),r}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let t4=this._pbf;t4.pos=this._geometry;let i=t4.readVarint()+t4.pos,r=1,a=0,s=0,n=0,o=1/0,l=-1/0,u=1/0,h=-1/0;for(;t4.pos<i;){if(a<=0){let c=t4.readVarint();if(r=c&7,a=c>>3,a===0)continue}if(a--,r===1||r===2)s+=t4.readSVarint(),n+=t4.readSVarint(),s<o&&(o=s),s>l&&(l=s),n<u&&(u=n),n>h&&(h=n);else if(r!==7)throw Error(`unknown command ${r}`)}return[o,u,l,h]}toGeoJSON(t4,i,r){let a=this.extent*2**r,s=this.extent*t4,n=this.extent*i,o=this.loadGeometry();function l(d){return[(d.x+s)*360/a-180,360/Math.PI*Math.atan(Math.exp((1-(d.y+n)*2/a)*Math.PI))-90]}function u(d){return d.map(l)}let h;if(this.type===1){let d=[];for(let f of o)d.push(f[0]);let p=u(d);h=d.length===1?{type:"Point",coordinates:p[0]}:{type:"MultiPoint",coordinates:p}}else if(this.type===2){let d=o.map(u);h=d.length===1?{type:"LineString",coordinates:d[0]}:{type:"MultiLineString",coordinates:d}}else if(this.type===3){let d=m0(o),p=[];for(let f of d)p.push(f.map(u));h=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}else throw Error("unknown feature type");let c={type:"Feature",geometry:h,properties:this.properties};return this.id!=null&&(c.id=this.id),c}};En.types=["Unknown","Point","LineString","Polygon"];function m0(e){let t4=e.length;if(t4<=1)return[e];let i=[],r,a;for(let s=0;s<t4;s++){let n=HT(e[s]);n!==0&&(a===void 0&&(a=n<0),a===n<0?(r&&i.push(r),r=[e[s]]):r&&r.push(e[s]))}return r&&i.push(r),i}function HT(e){let t4=0;for(let i=0,r=e.length,a=r-1,s,n;i<r;a=i++)s=e[i],n=e[a],t4+=(n.x-s.x)*(s.y+n.y);return t4}var XT=class{constructor(t4,i){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t4,this._keys=[],this._values=[],this._features=[],i===void 0&&(i=t4.length);t4.pos<i;){let r=t4.readVarint();r===10?this.name=t4.readString():r===18?(this._features.push(t4.pos),t4.skip(r)):r===26?this._keys.push(t4.readString()):r===34?this._values.push(YT(t4)):r===40?this.extent=t4.readVarint():r===120?this.version=t4.readVarint():t4.skip(r)}this.length=this._features.length}feature(t4){if(t4<0||t4>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t4];let i=this._pbf.readVarint()+this._pbf.pos;return new En(this._pbf,i,this.extent,this._keys,this._values)}};function YT(e){let t4=null,i=e.readVarint()+e.pos;for(;e.pos<i;){let r=e.readVarint();t4=r===10?e.readString():r===21?e.readFloat():r===25?e.readDouble():r===32?e.readVarint(true):r===40?e.readVarint():r===48?e.readSVarint():r===56?e.readBoolean():(e.skip(r),null)}if(t4==null)throw Error("unknown feature value");return t4}var KT=class{constructor(t4,i=t4.length){let r=Object.create(null);for(;t4.pos<i;){let a=t4.readVarint();if(a===26){let s=new XT(t4,t4.readVarint()+t4.pos);s.length&&(r[s.name]=s)}else t4.skip(a)}this.layers=r}};const Lt=63710088e-1;var H=class Ls{constructor(t4,i){if(isNaN(t4)||isNaN(i))throw Error(`Invalid LngLat object: (${t4}, ${i})`);if(this.lng=+t4,this.lat=+i,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ls(mi(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t4){let i=Math.PI/180,r=this.lat*i,a=t4.lat*i,s=Math.sin(r)*Math.sin(a)+Math.cos(r)*Math.cos(a)*Math.cos((t4.lng-this.lng)*i);return Lt*Math.acos(Math.min(s,1))}static convert(t4){if(t4 instanceof Ls)return t4;if(Array.isArray(t4)&&(t4.length===2||t4.length===3))return new Ls(Number(t4[0]),Number(t4[1]));if(!Array.isArray(t4)&&typeof t4=="object"&&t4)return new Ls(Number("lng"in t4?t4.lng:t4.lon),Number(t4.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};const g0=2*Math.PI*Lt;function _0(e){return g0*Math.cos(e*Math.PI/180)}function Ja(e){return(180+e)/360}function Qa(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Xr(e,t4){return e/_0(t4)}function xc(e){return e*360-180}function cn(e){let t4=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t4*Math.PI/180))-90}function y0(e,t4){return e*_0(cn(t4))}function JT(e){return 1/Math.cos(e*Math.PI/180)}var Ie=class v0{constructor(t4,i,r=0){this.x=+t4,this.y=+i,this.z=+r}static fromLngLat(t4,i=0){let r=H.convert(t4);return new v0(Ja(r.lng),Qa(r.lat),Xr(i,r.lat))}toLngLat(){return new H(xc(this.x),cn(this.y))}toAltitude(){return y0(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/g0*JT(cn(this.y))}};const Yr=89.25;function x0(e,t4,i){let r=1/(1<<i.z);return new Ie(e/k*r+i.x*r,t4/k*r+i.y*r)}function QT(e,t4,i){return x0(e,t4,i).toLngLat()}function Ni(e,t4){let i=ne(t4.lat,-85.051129,Wi);return new C(Ja(t4.lng)*e,Qa(i)*e)}function dn(e,t4){return new Ie(t4.x/e,t4.y/e).toLngLat()}function Zs(e){return e.cameraToCenterDistance*Math.min(Math.tan(Ze(90-e.pitch))*.85,Math.tan(Ze(Yr-e.pitch)))}function Gu(e,t4){let i=e.canonical,r=t4/$t(i.z),a=i.x+2**i.z*e.wrap,s=new Float64Array(16);return Ii(s),ot(s,s,[a*r,i.y*r,0]),Dt(s,s,[r/k,r/k,1]),s}function b0(e,t4,i,r,a){let s=Ie.fromLngLat(e,t4),n=a*Xr(1,e.lat),{x:o,y:l,z:u}=bc(i,r),h=n*-o,c=n*-l,d=n*u;return new Ie(s.x+h,s.y+c,s.z+d)}function eE(e){let t4=Xr(1,e.center.lat)*e.worldSize;return b0(e.center,e.elevation,e.pitch,e.bearing,e.cameraToCenterDistance/t4)}function bc(e,t4){let i=Ze(e),r=Ze(t4),a=Math.cos(-i),s=Math.sin(i);return{x:s*Math.sin(r),y:-s*Math.cos(r),z:a}}function tE(e,t4){return t4<=0||!e||e.length===0?e:e.map(i=>rE(i,t4))}function iE(e,t4){let i=QT(k/2,k/2,t4),r=Ie.fromLngLat(i).meterInMercatorCoordinateUnits(),a=(1<<t4.z)*k;return e*r*a}function rE(e,t4){if(!e||e.length<3)return e;let i=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,r=i?e.length-1:e.length;if(r<3)return e;let a=[],s=vc(e[r-1],e[0]);for(let o=0;o<r;o++){let l=e[(o-1+r)%r],u=e[o],h=e[(o+1)%r],c=vc(u,h);s||c?a.push(u.clone()):sE(a,l,u,h,t4),s=c}let n=aE(a);return n.length<3?e:(i&&n.push(n[0].clone()),n)}function aE(e){let t4=[];for(let i of e){let r=i.round(),a=t4[t4.length-1];((a==null?void 0:a.x)!==r.x||(a==null?void 0:a.y)!==r.y)&&t4.push(r)}for(;t4.length>1&&t4[0].x===t4[t4.length-1].x&&t4[0].y===t4[t4.length-1].y;)t4.pop();return t4}function sE(e,t4,i,r,a){let s=t4.sub(i),n=r.sub(i),o=s.mag(),l=n.mag();if(o<1e-6||l<1e-6){e.push(i.clone());return}s._div(o),n._div(l);let u=s.x*n.x+s.y*n.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){e.push(i.clone());return}let h=.2,c=Math.min(a,o*h,l*h),d=i.add(s.mult(c)),p=i.add(n.mult(c)),f=Math.sqrt((1+u)/2),m=i.add(s.add(n)._unit()._mult(c/f)),g=d.sub(m).angleWith(p.sub(m)),_=Math.max(2,Math.ceil(Math.abs(g)/(Math.PI/6)-1e-6));for(let y=0;y<=_;y++)e.push(d.rotateAround(y/_*g,m))}const Zu=8192;function bs(e,t4,i,r,a,s,n,o){e.emplaceBack(t4,i,Math.floor(r*Zu)*2+n,a*Zu*2,s*Zu*2,Math.round(o))}var w0=class{constructor(t4){this.zoom=t4.zoom,this.overscaling=t4.overscaling,this.layers=t4.layers,this.layerIds=this.layers.map(i=>i.id),this.index=t4.index,this.hasDependencies=false,this.layoutVertexArray=new l2,this.centroidVertexArray=new Tr,this.indexArray=new Qi,this.programConfigurations=new ta(t4.layers,t4.zoom),this.segments=new We,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}populate(t4,i,r){this.features=[],this.hasDependencies=nl("fill-extrusion",this.layers,i);let a=new Fe(this.zoom),s=this.layers[0],n=s.layout.get("fill-extrusion-rounded-corner-distance"),o=n>0?iE(n,r):0,l=s._featureFilter.needGeometry;for(let{feature:u,id:h,index:c,sourceLayerIndex:d}of t4){let p=oa(u,l);if(!s._featureFilter.filter(a,p,r))continue;let f={id:h,sourceLayerIndex:d,index:c,geometry:tE(l?p.geometry:na(u),o),properties:u.properties,type:u.type,patterns:{}};this.hasDependencies?this.features.push(Cd("fill-extrusion",this.layers,f,{zoom:this.zoom},i)):this.addFeature(f,f.geometry,c,r,{},i.subdivisionGranularity),i.featureIndex.insert(u,f.geometry,c,d,this.index,true)}}addFeatures({options:t4,canonical:i,patternPositions:r}){for(let a of this.features){let{geometry:s}=a;this.addFeature(a,s,a.index,i,r,t4.subdivisionGranularity)}}update(t4,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t4,i,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t4){this.uploaded||(this.layoutVertexBuffer=t4.createVertexBuffer(this.layoutVertexArray,qT),this.centroidVertexBuffer=t4.createVertexBuffer(this.centroidVertexArray,ZT.members,true),this.indexBuffer=t4.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t4),this.uploaded=true}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t4,i,r,a,s,n){for(let o of zl(i,500)){let l={x:0,y:0,sampleCount:0},u=this.layoutVertexArray.length;this.processPolygon(l,a,t4,o,n);let h=this.layoutVertexArray.length-u,c=Math.floor(l.x/l.sampleCount),d=Math.floor(l.y/l.sampleCount);for(let p=0;p<h;p++)this.centroidVertexArray.emplaceBack(c,d)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t4,r,{imagePositions:s,canonical:a})}processPolygon(t4,i,r,a,s){if(a.length<1||jf(a[0]))return;for(let c of a)c.length!==0&&nE(t4,c);let n={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=s.fill.getGranularityForZoomLevel(i.z),l=En.types[r.type]==="Polygon";for(let c of a){if(c.length===0||jf(c))continue;let d=Nr(c,o,l);this._generateSideFaces(d,n)}if(!l)return;let u=c0(a,i,o,false),h=this.layoutVertexArray;p0((c,d)=>{bs(h,c,d,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,u.verticesFlattened,u.indicesTriangles)}_generateSideFaces(t4,i){let r=0;for(let a=1;a<t4.length;a++){let s=t4[a],n=t4[a-1];if(vc(s,n))continue;i.segment.vertexLength+4>We.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let o=s.sub(n)._perp()._unit(),l=n.dist(s);r+l>32768&&(r=0),bs(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,0,r),bs(this.layoutVertexArray,s.x,s.y,o.x,o.y,0,1,r),r+=l,bs(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,0,r),bs(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,1,r);let u=i.segment.vertexLength;this.indexArray.emplaceBack(u,u+2,u+1),this.indexArray.emplaceBack(u+1,u+2,u+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}};function nE(e,t4){for(let i=0;i<t4.length;i++){let r=t4[i];(i!==t4.length-1||t4[0].x!==r.x||t4[0].y!==r.y)&&(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}G("FillExtrusionBucket",w0,{omit:["layers","features"]});let oE;const lE=()=>oE||(oE=new wt({"fill-extrusion-rounded-corner-distance":new j(F["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")}));let uE;const hE=()=>uE||(uE=new wt({"fill-extrusion-opacity":new j(F["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new K(F["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new j(F["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new j(F["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new rn(F["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new K(F["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new K(F["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new j(F["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")}));var cE={get paint(){return hE()},get layout(){return lE()}};const dE=e=>e.type==="fill-extrusion";var pE=class extends zi{constructor(t4,i){super(t4,cE,i)}createBucket(t4){return new w0(t4)}queryRadius(){return Zl(this.paint.get("fill-extrusion-translate"))}is3D(){return true}queryIntersectsFeature({queryGeometry:t4,feature:i,featureState:r,geometry:a,transform:s,pixelsToTileUnits:n,pixelPosMatrix:o}){let l=ql(t4,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-s.bearingInRadians,n),u=this.paint.get("fill-extrusion-height").evaluate(i,r),h=this.paint.get("fill-extrusion-base").evaluate(i,r),c=gE(l,o,0),d=mE(a,h,u,o),p=d[0],f=d[1];return fE(p,f,c)}};function ws(e,t4){return e.x*t4.x+e.y*t4.y}function Uf(e,t4){if(e.length===1){let i=0,r=t4[i++],a;for(;!a||r.equals(a);)if(a=t4[i++],!a)return 1/0;for(;i<t4.length;i++){let s=t4[i],n=e[0],o=a.sub(r),l=s.sub(r),u=n.sub(r),h=ws(o,o),c=ws(o,l),d=ws(l,l),p=ws(u,o),f=ws(u,l),m=h*d-c*c,g=(d*p-c*f)/m,_=(h*f-c*p)/m,y=1-g-_,x=r.z*y+a.z*g+s.z*_;if(isFinite(x))return x}return 1/0}{let i=1/0;for(let r of t4)i=Math.min(i,r.z);return i}}function fE(e,t4,i){let r=1/0;Jy(i,t4)&&(r=Uf(i,t4[0]));for(let a=0;a<t4.length;a++){let s=t4[a],n=e[a];for(let o=0;o<s.length-1;o++){let l=s[o],u=s[o+1],h=n[o],c=[l,u,n[o+1],h,l];Ky(i,c)&&(r=Math.min(r,Uf(i,c)))}}return r!==1/0&&r}function mE(e,t4,i,r){let a=[],s=[],n=r[8]*t4,o=r[9]*t4,l=r[10]*t4,u=r[11]*t4,h=r[8]*i,c=r[9]*i,d=r[10]*i,p=r[11]*i;for(let f of e){let m=[],g=[];for(let _ of f){let y=_.x,x=_.y,v=r[0]*y+r[4]*x+r[12],w=r[1]*y+r[5]*x+r[13],b=r[2]*y+r[6]*x+r[14],T=r[3]*y+r[7]*x+r[15],P=v+n,E=w+o,I=b+l,R=T+u,z=v+h,S=w+c,A=b+d,D=T+p,M=new C(P/R,E/R);M.z=I/R,m.push(M);let L=new C(z/D,S/D);L.z=A/D,g.push(L)}a.push(m),s.push(g)}return[a,s]}function gE(e,t4,i){let r=[];for(let a of e){let s=[a.x,a.y,i,1];Ct(s,s,t4),r.push(new C(s[0]/s[3],s[1]/s[3]))}return r}const _E="geojsonvt_clip_start",yE="geojsonvt_clip_end",vE=Ke([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),xE=vE.members,bE=Ke([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),wE=bE.members,TE=Math.cos(75/2*(Math.PI/180)),T0=1/2,Nf=2**14/T0;var E0=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t4=>t4.id),this.index=e.index,this.hasDependencies=false,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let t4 of this.layers)this.gradients[t4.id]={};this.layoutVertexArray=new u2,this.layoutVertexArray2=new h2,this.indexArray=new Qi,this.programConfigurations=new ta(e.layers,e.zoom),this.segments=new We,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t4=>t4.isStateDependent()).map(t4=>t4.id)}populate(e,t4,i){this.hasDependencies=nl("line",this.layers,t4)||this.hasLineDasharray(this.layers);let r=this.layers[0].layout.get("line-sort-key"),a=!r.isConstant(),s=[],n=new Fe(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of e){let d=oa(l,o);if(!this.layers[0]._featureFilter.filter(n,d,i))continue;let p=a?r.evaluate(d,{},i):void 0,f={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?d.geometry:na(l),patterns:{},dashes:{},sortKey:p};s.push(f)}a&&s.sort((l,u)=>l.sortKey-u.sortKey);for(let l of s){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(nl("line",this.layers,t4)?Cd("line",this.layers,l,{zoom:this.zoom},t4):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,t4),this.patternFeatures.push(l)):this.addFeature(l,u,h,i,{},{},t4.subdivisionGranularity);let d=e[h].feature;t4.featureIndex.insert(d,u,h,c,this.index)}}update(e,t4,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t4,this.stateDependentLayers,{imagePositions:i,dashPositions:r})}addFeatures({options:e,canonical:t4,patternPositions:i,dashPositions:r}){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,t4,i,r,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,wE)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,xE),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=true}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,"geojsonvt_clip_start")&&Object.hasOwn(e.properties,"geojsonvt_clip_end"))return{start:+e.properties[_E],end:+e.properties[yE]}}addFeature(e,t4,i,r,a,s,n){let o=this.layers[0].layout,l=o.get("line-join").evaluate(e,{}),u=o.get("line-cap").evaluate(e,{}),h=o.get("line-miter-limit").evaluate(e,{}),c=o.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let d of t4)this.addLine(d,e,l,u,h,c,r,n);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:a,dashPositions:s,canonical:r})}addLine(e,t4,i,r,a,s,n,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=n?o.line.getGranularityForZoomLevel(n.z):1;if(e=Nr(e,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let x=0;x<e.length-1;x++)this.totalDistance+=e[x].dist(e[x+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=En.types[t4.type]==="Polygon",h=e.length;for(;h>=2&&e[h-1].equals(e[h-2]);)h--;let c=0;for(;c<h-1&&e[c].equals(e[c+1]);)c++;if(h-c<(u?3:2))return;i==="bevel"&&(a=1.05);let d=this.overscaling<=16?15*k/(512*this.overscaling):0,p=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),f,m,g,_,y;this.e1=this.e2=-1,u&&(f=e[h-2],y=e[c].sub(f)._unit()._perp());for(let x=c;x<h;x++){if(g=x===h-1?u?e[c+1]:void 0:e[x+1],g&&e[x].equals(g))continue;y&&(_=y),f&&(m=f),f=e[x],y=g?g.sub(f)._unit()._perp():_,_||(_=y);let v=_.add(y);(v.x!==0||v.y!==0)&&v._unit();let w=_.x*y.x+_.y*y.y,b=v.x*y.x+v.y*y.y,T=b===0?1/0:1/b,P=2*Math.sqrt(2-2*b),E=b<TE&&m&&g,I=_.x*y.y-_.y*y.x>0;if(E&&x>c){let S=f.dist(m);if(S>2*d){let A=f.sub(f.sub(m)._mult(d/S)._round());this.updateDistance(m,A),this.addCurrentVertex(A,_,0,0,p),m=A}}let R=m&&g,z=R?i:u?"butt":r;if(R&&z==="round"&&(T<s?z="miter":T<=2&&(z="fakeround")),z==="miter"&&T>a&&(z="bevel"),z==="bevel"&&(T>2&&(z="flipbevel"),T<a&&(z="miter")),m&&this.updateDistance(m,f),z==="miter")v._mult(T),this.addCurrentVertex(f,v,0,0,p);else if(z==="flipbevel"){if(T>100)v=y.mult(-1);else{let S=T*_.add(y).mag()/_.sub(y).mag();v._perp()._mult(S*(I?-1:1))}this.addCurrentVertex(f,v,0,0,p),this.addCurrentVertex(f,v.mult(-1),0,0,p)}else if(z==="bevel"||z==="fakeround"){let S=-Math.sqrt(T*T-1),A=I?S:0,D=I?0:S;if(m&&this.addCurrentVertex(f,_,A,D,p),z==="fakeround"){let M=Math.round(P*180/Math.PI/20);for(let L=1;L<M;L++){let O=L/M;if(O!==.5){let J=O-.5,fe=1.0904+w*(-3.2452+w*(3.55645-w*1.43519)),xe=.848013+w*(-1.06021+w*.215638);O+=O*J*(O-1)*(fe*J*J+xe)}let N=y.sub(_)._mult(O)._add(_)._unit()._mult(I?-1:1);this.addHalfVertex(f,N.x,N.y,false,I,0,p)}}g&&this.addCurrentVertex(f,y,-A,-D,p)}else if(z==="butt")this.addCurrentVertex(f,v,0,0,p);else if(z==="square"){let S=m?1:-1;this.addCurrentVertex(f,v,S,S,p)}else z==="round"&&(m&&(this.addCurrentVertex(f,_,0,0,p),this.addCurrentVertex(f,_,1,1,p,true)),g&&(this.addCurrentVertex(f,y,-1,-1,p,true),this.addCurrentVertex(f,y,0,0,p)));if(E&&x<h-1){let S=f.dist(g);if(S>2*d){let A=f.add(g.sub(f)._mult(d/S)._round());this.updateDistance(f,A),this.addCurrentVertex(A,y,0,0,p),f=A}}}}addCurrentVertex(e,t4,i,r,a,s=false){let n=t4.x+t4.y*i,o=t4.y-t4.x*i,l=-t4.x+t4.y*r,u=-t4.y-t4.x*r;this.addHalfVertex(e,n,o,s,false,i,a),this.addHalfVertex(e,l,u,s,true,-r,a),this.distance>Nf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t4,i,r,a,s))}addHalfVertex({x:e,y:t4},i,r,a,s,n,o){let l=(this.lineClips?this.scaledDistance*(Nf-1):this.scaledDistance)*T0;if(this.layoutVertexArray.emplaceBack((e<<1)+ +!!a,(t4<<1)+ +!!s,Math.round(63*i)+128,Math.round(63*r)+128,(n===0?0:n<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),s?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t4){this.distance+=e.dist(t4),this.updateScaledDistance()}hasLineDasharray(e){for(let t4 of e){let i=t4.paint.get("line-dasharray");if(i&&!i.isConstant())return true}return false}addLineDashDependencies(e,t4,i,r){for(let a of e){let s=a.paint.get("line-dasharray");if(!s||s.value.kind==="constant")continue;let n=a.layout.get("line-cap").evaluate(t4,{})==="round",o={dasharray:s.value.evaluate({zoom:i-1},t4,{}),round:n},l={dasharray:s.value.evaluate({zoom:i},t4,{}),round:n},u={dasharray:s.value.evaluate({zoom:i+1},t4,{}),round:n},h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,d=`${u.dasharray.join(",")},${u.round}`;r.dashDependencies[h]=o,r.dashDependencies[c]=l,r.dashDependencies[d]=u,t4.dashes[a.id]={min:h,mid:c,max:d}}}};G("LineBucket",E0,{omit:["layers","patternFeatures"]});let EE;const SE=()=>EE||(EE=new wt({"line-cap":new K(F.layout_line["line-cap"],"line-cap"),"line-join":new K(F.layout_line["line-join"],"line-join"),"line-miter-limit":new K(F.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new K(F.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new K(F.layout_line["line-sort-key"],"line-sort-key")}));let DE;const CE=()=>DE||(DE=new wt({"line-opacity":new K(F.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new j(F.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new K(F.paint_line["line-color"],"line-color"),"line-translate":new j(F.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new j(F.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new K(F.paint_line["line-width"],"line-width"),"line-gap-width":new K(F.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new K(F.paint_line["line-offset"],"line-offset"),"line-blur":new K(F.paint_line["line-blur"],"line-blur"),"line-dasharray":new rn(F.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new rn(F.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Nl(F.paint_line["line-gradient"],"line-gradient")}));var Gf={get paint(){return CE()},get layout(){return SE()}},PE=class extends K{possiblyEvaluate(e,t4){return t4=new Fe(Math.floor(t4.zoom),{now:t4.now,fadeDuration:t4.fadeDuration,zoomHistory:t4.zoomHistory,transition:t4.transition}),super.possiblyEvaluate(e,t4)}evaluate(e,t4,i,r){return t4=W({},t4,{zoom:Math.floor(t4.zoom)}),super.evaluate(e,t4,i,r)}};let no;const AE=e=>e.type==="line";var IE=class extends zi{constructor(e,t4){super(e,Gf,t4),this.gradientVersion=0,no||(no=new PE(Gf.paint.properties["line-width"].specification,"line-floorwidth"),no.useIntegerZoom=true)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t4=this.gradientExpression();this.stepInterpolant=xw(t4)?t4._styleExpression.expression instanceof rd:false,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t4){super.recalculate(e,t4),this.paint._values["line-floorwidth"]=no.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new E0(e)}queryRadius(e){let t4=e,i=Zf(Ba("line-width",this,t4),Ba("line-gap-width",this,t4)),r=Ba("line-offset",this,t4);return i/2+Math.abs(r)+Zl(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t4,featureState:i,geometry:r,transform:a,pixelsToTileUnits:s}){let n=ql(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-a.bearingInRadians,s),o=s/2*Zf(this.paint.get("line-width").evaluate(t4,i),this.paint.get("line-gap-width").evaluate(t4,i)),l=this.paint.get("line-offset").evaluate(t4,i);return l&&(r=R2(r,l*s)),P2(n,r,o)}isTileClipped(){return true}};function Zf(e,t4){return t4>0?t4+2*e:e}const ME=Ke([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),FE=Ke([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ke([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const zE=Ke([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ke([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const qf=Ke([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),RE=Ke([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ke([{name:"triangle",components:3,type:"Uint16"}]),Ke([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Float32",name:"heightOffset"}]),Ke([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),Ke([{type:"Float32",name:"offsetX"}]),Ke([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ke([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const ul=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(ul.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t4){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let i=e.pluginURL,r=new Promise(s=>{this.loadScriptResolve=s}),a=new Promise(s=>setTimeout(()=>s(),this.TIMEOUT));if(await t4(i),await Promise.race([r,a]),this.isParsed()){let s={pluginStatus:"loaded",pluginURL:i};return this.setState(s),s}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${i}`)}};function kE(e){return/[\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u070D\u070F-\u074A\u074D-\u077F\u07C0-\u07FA\u07FD-\u07FF\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u08E1\u08E3-\u08FF\u1800\u1801\u1804\u1806-\u1819\u1820-\u1878\u1880-\u18AA\uA840-\uA877\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD802[\uDEC0-\uDEE6\uDEEB-\uDEF6\uDF80-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]|\uD803[\uDD00-\uDD27\uDD30-\uDD39\uDE60-\uDE7E\uDEC2-\uDEC7\uDED0-\uDED8\uDEFA-\uDEFF\uDF30-\uDF59\uDF70-\uDF89\uDFB0-\uDFCB]|\uD805[\uDE60-\uDE6C]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9C-\uDC9F]|\uD83A[\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/gim.test(String.fromCodePoint(e))}function LE(e){return/[\u0591-\u05C7\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u070D\u070F-\u074A\u074D-\u07B1\u07C0-\u07FA\u07FD-\u082D\u0830-\u083E\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u08E1\u08E3-\u08FF\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC57-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD1F-\uDD39\uDD3F-\uDD59\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F-\uDE48\uDE50-\uDE58\uDE60-\uDE9F\uDEC0-\uDEE6\uDEEB-\uDEF6\uDF00-\uDF35\uDF39-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD27\uDD30-\uDD39\uDD40-\uDD65\uDD69-\uDD85\uDD8E\uDD8F\uDE60-\uDE7E\uDE80-\uDEA9\uDEAB-\uDEAD\uDEB0\uDEB1\uDEC2-\uDEC7\uDED0-\uDED8\uDEFA-\uDF27\uDF30-\uDF59\uDF70-\uDF89\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/gim.test(String.fromCodePoint(e))}function BE(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function OE(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function Wl(e){return/[\u02EA\u02EB\u1100-\u11FF\u1401-\u167F\u18B0-\u18FF\u2065\u20DD-\u20E0\u20E2-\u20E4\u2B97\u2BF0-\u2BFF\u2E50\u2E51\u2E80-\u3007\u3012\u3013\u3020-\u302F\u3031-\u30FB\u30FD-\uA4CF\uA960-\uA97F\uAC00-\uD7FF\uF900-\uFAFF\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7\uFFF0-\uFFF8]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|[\uD80C-\uD810\uD81C-\uD822\uD83C\uD83D\uD840-\uD87E\uD880-\uD8BE][\uDC00-\uDFFF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFFF]|\uD823[\uDC00-\uDDFF]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFF]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83E[\uDD00-\uDEFF]|[\uD87F\uD8BF][\uDC00-\uDFFD]/gim.test(String.fromCodePoint(e))}function $E(e){return/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))}function VE(e){return/[\r\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0600-\u0605\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DD\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0890\u0891\u0897-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E33-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB3-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1037\u1039-\u103E\u1056-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1084-\u1086\u108D\u109D\u1100-\u11FF\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60\u1A62\u1A65-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA960-\uA97C\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCBD\uDCC2\uDCCD\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC2\uDDC3\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF1F\uDF22-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE84-\uDE99\uDF60-\uDF67]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6\uDF00-\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD2F]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDD63\uDD67-\uDD6A\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF\uDDEE\uDDEF\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDDE6-\uDDFF\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF]/.test(e)}function Wf(e){return/[\u0E01-\u0E3A\u0E40-\u0E4E\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0EDC-\u0EDF\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA\u1000-\u103F\u1050-\u108F\u109A-\u109F\u1780-\u17D3\u17D7\u17DC\u17DD\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19DE\u19DF\u1A20-\u1A5E\u1A60-\u1A7C\u1AA0-\u1AAD\u1B00-\u1B4C\u1B4E-\u1B7F\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE-\uA9EF\uA9FA-\uA9FE\uAA60-\uAAC2\uAADB-\uAADF]|\uD805[\uDF00-\uDF1A\uDF1D-\uDF2B\uDF3A\uDF3B\uDF3F-\uDF46]/gim.test(String.fromCodePoint(e))}function jE(e,t4){return/(?:[\u1039\u17D2\u1A60\u1BAB\u200D\uAAF6]|\uD802\uDE3F|\uD804[\uDD33\uDFD0]|\uD806[\uDD3E\uDE47\uDE99]|\uD807[\uDD45\uDD97\uDF42])$/.test(e)||new RegExp("^\\p{gc=Mc}","u").test(t4)}const UE={C:"18g,1;g2,3;4nb,1",D:"17k,1;5,1;1,1;1,5;4,d;1,7;1,2;z,2;8,g;i,12;1,2;9,1;1,1;1,2;14,3;2,1;28,9;3,f;2,4;1,1;2,3;2,6;7a,1;2,5;1,1;g,a;5,2;2,6;1,f",R:"17m,4;1,1;1,1;5,4;l,1;14,3;1,3;g,i;12,1;2,9;1,1;1,1;2,2;1,1;o,2;2x,3;f,2;4,1;1,2;3,2;6u,j;b,1;r,3;1,1;2,2;6,1",T:"174,b;1,1;1a,l;g,1;2t,7;2,6;2,2;1,4;bt,9;16,o;1,t;1clb,1"},NE={1569:[65152,0,0,0],1570:[65153,65154,0,0],1571:[65155,65156,0,0],1572:[65157,65158,0,0],1573:[65159,65160,0,0],1574:[65161,65162,65163,65164],1575:[65165,65166,0,0],1576:[65167,65168,65169,65170],1577:[65171,65172,0,0],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194,0,0],1584:[65195,65196,0,0],1585:[65197,65198,0,0],1586:[65199,65200,0,0],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262,0,0],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1611:[65136,0,0,65137],1612:[65138,0,0,0],1613:[65140,0,0,0],1614:[65142,0,0,65143],1615:[65144,0,0,65145],1616:[65146,0,0,65147],1617:[65148,0,0,65149],1618:[65150,0,0,65151],1649:[64336,64337,0,0],1655:[64477,0,0,0],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393,0,0],1676:[64388,64389,0,0],1677:[64386,64387,0,0],1678:[64390,64391,0,0],1681:[64396,64397,0,0],1688:[64394,64395,0,0],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415,0,0],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421,0,0],1729:[64422,64423,64424,64425],1733:[64480,64481,0,0],1734:[64473,64474,0,0],1735:[64471,64472,0,0],1736:[64475,64476,0,0],1737:[64482,64483,0,0],1739:[64478,64479,0,0],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431,0,0],1747:[64432,64433,0,0]},GE={\u0644\u0622:[65269,65270],\u0644\u0623:[65271,65272],\u0644\u0625:[65273,65274],\u0644\u0627:[65275,65276]},Hf=1604,ZE=/[\u0600-\u06ff\u0750-\u077f\u0870-\u089f\u08a0-\u08ff\ufb50-\ufdff\ufe70-\ufeff]/;function qE(e,t4,i){let r=0;for(let a of e.split(";")){let[s,n]=a.split(",").map(l=>parseInt(l,36)),o=r+s;for(let l=o;l<o+n;l++)i.set(l,t4);r=o+n}}const S0=new Map;for(let[e,t4]of Object.entries(UE))qE(t4,e,S0);function WE(e){return S0.get(e)??"U"}function HE(e){return e==="D"||e==="L"||e==="C"}function XE(e){return e==="D"||e==="R"||e==="C"}function YE(e,t4,i){return e==="D"?t4&&i?3:t4?1:i?2:0:e==="R"?+!!t4:e==="L"?i?2:0:null}function KE(e){return[...e].map(t4=>{let i=t4.codePointAt(0);return{codePoint:i,type:WE(i),form:null}})}function JE(e){let t4=e.filter(i=>i.type!=="T");for(let i=0;i<t4.length;i++){let r=t4[i],a=i>0&&HE(t4[i-1].type),s=i+1<t4.length&&XE(t4[i+1].type);r.form=YE(r.type,a,s)}}function QE(e){let t4=false;for(let i of e)i.type==="T"?i.form=t4?3:0:t4=i.form===2||i.form===3}function eS(e){let t4=[];for(let i=0;i<e.length;i++){let r=e[i];if(r.codePoint!==Hf){t4.push(r);continue}let a=i+1;for(;a<e.length&&e[a].type==="T";)a++;let s=e[a],n=s&&GE[String.fromCodePoint(Hf,s.codePoint)];if(!n){t4.push(r);continue}let o=r.form===3||r.form===1;t4.push({codePoint:n[+!!o],type:"R",form:0}),t4.push(...e.slice(i+1,a)),i=a}return t4}function tS(e){if(e.form===null)return e.codePoint;let t4=NE[e.codePoint];return t4&&(t4[e.form]||t4[0])||e.codePoint}function iS(e){if(!ZE.test(e))return e;let t4=KE(e);return JE(t4),QE(t4),eS(t4).map(i=>String.fromCodePoint(tS(i))).join("")}function rS(e,t4,i){let r=t4.layout.get("text-transform").evaluate(i,{});return r==="uppercase"?e=e.toLocaleUpperCase():r==="lowercase"&&(e=e.toLocaleLowerCase()),(ul.applyArabicShaping??iS)(e)}function aS(e,t4,i){for(let r of e.sections)r.text=rS(r.text,t4,i);return e}function qu(e,t4,i){let r=i?t4.last.points:t4.first.points,a=i?r[r.length-1]:r[0];return`${e}:${a.x}:${a.y}`}function sS(e){let t4=e.first.points,i=t4.length;for(let s=e.first.next;s;s=s.next)i+=s.points.length-1;let r=Array(i);for(let s=0;s<t4.length;s++)r[s]=t4[s];let a=t4.length;for(let s=e.first.next;s;s=s.next){let n=s.points;for(let o=1;o<n.length;o++)r[a++]=n[o]}return r}function Xf(e,t4,i,r,a){let s=t4[i];delete t4[i],t4[r]=s;let n=e[s];return n.last.next=a.first,n.last=a.last,s}function Yf(e,t4,i,r,a){let s=t4[r];delete t4[r],t4[i]=s;let n=e[s];return a.last.next=n.first,n.first=a.first,s}function nS(e){let t4={},i={},r=[];for(let s of e){let n=s.text?s.text.toString():null,o={points:s.geometry[0],next:null},l={feature:s,first:o,last:o};if(!n){r.push(l);continue}let u=qu(n,l),h=qu(n,l,true);if(u in i&&h in t4&&i[u]!==t4[h]){let c=Yf(r,t4,u,h,l),d=Xf(r,i,u,h,r[c]);delete t4[u],delete i[h],i[qu(n,r[d],true)]=d,r[c].feature.geometry=null}else if(u in i)Xf(r,i,u,h,l);else if(h in t4)Yf(r,t4,u,h,l);else{let c=r.push(l)-1;t4[u]=c,i[h]=c}}let a=[];for(let s of r){let n=s.feature;n.geometry&&(s.first.next&&(n.geometry[0]=sS(s)),a.push(n))}return a}const D0=typeof Intl<"u"&&"Segmenter"in Intl;let Kf,Jf;function wc(e){if(!D0||!VE(e))return[...e];Kf??(Kf=new Intl.Segmenter(void 0,{granularity:"grapheme"}));let t4=[];for(let{segment:i}of Kf.segment(e)){let r=t4.length-1;r>=0&&jE(t4[r],i)?t4[r]+=i:t4.push(i)}return t4}function oS(e){let t4=new Set;if(D0){Jf??(Jf=new Intl.Segmenter(void 0,{granularity:"word"}));for(let{index:r}of Jf.segment(e))t4.add(r);return t4}let i=0;for(let r of e.split(new RegExp("\\b|(?=\\p{Ideo})","u")))t4.add(i),i+=r.length;return t4}function hl(e){let t4=e.codePointAt(0);return e.length>(t4>65535?2:1)}function Ad(e){return/\s/u.test(String.fromCodePoint(e))}function Tc(e){for(let t4 of e)if(Wl(t4.codePointAt(0)))return true;return false}function lS(e){for(let t4 of e)if(!uS(t4.codePointAt(0)))return false;return true}function uS(e){return!kE(e)}function Qf(e){return!(Wl(e)||$E(e))}function C0(e){return new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(e))}function P0(e){return LE(e)}function A0(e){for(let t4 of e)if(P0(t4.codePointAt(0)))return true;return false}const za={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u22EF":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};function hS(e){let t4="",i={premature:true,value:void 0},r=e[Symbol.iterator](),a=r.next(),s=e[Symbol.iterator]();s.next();let n=s.next();for(;!a.done;)(n.done||!Qf(n.value.codePointAt(0))||za[n.value])&&(i.premature||!Qf(i.value.codePointAt(0))||za[i.value])&&za[a.value]?t4+=za[a.value]:t4+=a.value,i={value:a.value,premature:false},a=r.next(),n=s.next();return t4}const cS={10:true,13:true,32:true,38:true,41:true,43:true,45:true,47:true,173:true,183:true,8203:true,8208:true,8211:true,8231:true},dS={40:true};function em(e,t4,i,r,a,s){if("fontStack"in t4){let n=i[t4.fontStack],o=n==null?void 0:n[e];if(o)return o.metrics.advance*t4.scale+a;let l=0;for(let u of e){let h=n==null?void 0:n[u];h&&(l+=h.metrics.advance*t4.scale+a)}return l}{let n=r[t4.imageName];return n?n.displaySize[0]*t4.scale*24/s+a:0}}function tm(e,t4,i,r){let a=(e-t4)**2;return r?e<t4?a/2:a*2:a+Math.abs(i)*i}function im(e){return/^\s+$/u.test(e)}function pS(e,t4,i){let r=0;return(e===10||e===13)&&(r-=1e4),i&&(r+=150),(e===40||e===65288)&&(r+=50),(t4===41||t4===65289)&&(r+=50),r}function rm(e,t4,i,r,a,s){let n=null,o=tm(t4,i,a,s);for(let l of r){let u=tm(t4-l.x,i,a,s)+l.badness;u<=o&&(n=l,o=u)}return{index:e,x:t4,priorBreak:n,badness:o}}function I0(e){return e?I0(e.priorBreak).concat(e.index):[]}var Id=class Ec{constructor(t4="",i=[],r=[]){this.text=t4,this.sections=i,this.sectionIndex=r,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??(this._graphemes=wc(this.text)),this._graphemes}static fromFeature(t4,i){let r=new Ec;for(let a of t4.sections)a.image?r.addImageSection(a):r.addTextSection(a,i);return r}length(){return this.graphemes().length}getSection(t4){return this.sections[this.sectionIndex[t4]]}getSectionIndex(t4){return this.sectionIndex[t4]}verticalizePunctuation(){this.text=hS(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes("\u200B")}trim(){let t4=this.graphemes(),i=0;for(;i<t4.length&&im(t4[i]);)i++;let r=t4.length;for(;r>i&&im(t4[r-1]);)r--;this.text=t4.slice(i,r).join(""),this.sectionIndex=this.sectionIndex.slice(i,r),this._graphemes=null}substring(t4,i){let r=this.graphemes().slice(t4,i).join(""),a=this.sectionIndex.slice(t4,i);return new Ec(r,this.sections,a)}toCodeUnitIndex(t4){return this.graphemes().slice(0,t4).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t4,i)=>Math.max(t4,this.sections[i].scale),0)}getMaxImageSize(t4){let i=0,r=0;for(let a=0;a<this.length();a++){let s=this.getSection(a);if("imageName"in s){let n=t4[s.imageName];if(!n)continue;let o=n.displaySize;i=Math.max(i,o[0]),r=Math.max(r,o[1])}}return{maxImageWidth:i,maxImageHeight:r}}_appendSection(t4,i){let r=this.graphemes(),a=r.length>0?r[r.length-1]:"",s=wc(a+t4);this.text+=t4,this._graphemes=r.slice(0,a?-1:void 0).concat(s);let n=s.length-+!!a;for(let o=0;o<n;o++)this.sectionIndex.push(i)}addTextSection(t4,i){this.sections.push({scale:t4.scale||1,verticalAlign:t4.verticalAlign||"bottom",fontStack:t4.fontStack||i}),this._appendSection(t4.text,this.sections.length-1)}addImageSection(t4){let i=t4.image?t4.image.name:"";if(i.length===0){ge("Can't add FormattedSection with an empty image.");return}let r=this.getNextImageSectionCharCode();if(!r){ge("Reached maximum number of images 6401");return}this.sections.push({scale:1,verticalAlign:t4.verticalAlign||"bottom",imageName:i}),this._appendSection(String.fromCharCode(r),this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t4,i,r,a,s){let n=[],o=this.determineAverageLineWidth(t4,i,r,a,s),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,d=0;for(let p=0;p<u.length;p++){let f=u[p];if(p>0){let m=u[p-1].codePointAt(0),g=f.codePointAt(0),_=OE(m),y=Wf(m)&&Wf(g);(cS[m]||_||"imageName"in this.getSection(p-1)||u[p+1]!==void 0&&dS[g]||y&&(h??(h=oS(this.text))).has(d))&&n.push(rm(p,c,o,n,pS(m,g,_&&l),false))}Ad(f.codePointAt(0))||(c+=em(f,this.getSection(p),r,a,t4,s)),d+=f.length}return I0(rm(this.length(),c,o,n,0,true))}determineAverageLineWidth(t4,i,r,a,s){let n=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);n+=em(u,h,r,a,t4,s),o++}let l=Math.max(1,Math.ceil(n/i));return n/l}};function fS(){return function(e){var t4={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},i={},r={};i.L=1,r[1]="L",Object.keys(t4).forEach(function(q,ye){i[q]=1<<ye+1,r[i[q]]=q}),Object.freeze(i);var a=i.LRI|i.RLI|i.FSI,s=i.L|i.R|i.AL,n=i.B|i.S|i.WS|i.ON|i.FSI|i.LRI|i.RLI|i.PDI,o=i.BN|i.RLE|i.LRE|i.RLO|i.LRO|i.PDF,l=i.S|i.WS|i.B|a|i.PDI|o,u=null;function h(){if(!u){u=new Map;var q=0;for(var ye in t4)if(t4.hasOwnProperty(ye))for(var re=t4[ye],$="",ve=void 0,ee=false,ae=0,Z=0;Z<=re.length+1;Z+=1){var we=re[Z];if(we!==","&&Z!==re.length)we==="+"?(ee=true,ae=q=ae+parseInt($,36),$=""):$+=we;else{ee?ve=q+parseInt($,36):(ae=q=ae+parseInt($,36),ve=q),ee=false,$="",ae=ve;for(var Te=q;Te<ve+1;Te+=1)u.set(Te,i[ye])}}}}function c(q){return h(),u.get(q.codePointAt(0))||i.L}function d(q){return r[c(q)]}var p={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function f(q,ye){var re=0,$=new Map,ve=ye&&new Map,ee;return q.split(",").forEach(function ae(Z){if(Z.indexOf("+")!==-1)for(var we=+Z;we--;)ae(ee);else{ee=Z;var Te=Z.split(">"),se=Te[0],et=Te[1];se=String.fromCodePoint(re+=parseInt(se,36)),et=String.fromCodePoint(re+=parseInt(et,36)),$.set(se,et),ye&&ve.set(et,se)}}),{map:$,reverseMap:ve}}var m,g,_;function y(){if(!m){var q=f(p.pairs,true),ye=q.map,re=q.reverseMap;m=ye,g=re,_=f(p.canonical,false).map}}function x(q){return y(),m.get(q)||null}function v(q){return y(),g.get(q)||null}function w(q){return y(),_.get(q)||null}var b=i.L,T=i.R,P=i.EN,E=i.ES,I=i.ET,R=i.AN,z=i.CS,S=i.B,A=i.S,D=i.ON,M=i.BN,L=i.NSM,O=i.AL,N=i.LRO,J=i.RLO,fe=i.LRE,xe=i.RLE,le=i.PDF,$e=i.LRI,Pe=i.RLI,Ve=i.FSI,ke=i.PDI;function ft(q,ye){for(var re=125,$=new Uint32Array(q.length),ve=0;ve<q.length;ve++)$[ve]=c(q[ve]);var ee=new Map;function ae(Gt,Ei){var Zt=$[Gt];$[Gt]=Ei,ee.set(Zt,ee.get(Zt)-1),Zt&n&&ee.set(n,ee.get(n)-1),ee.set(Ei,(ee.get(Ei)||0)+1),Ei&n&&ee.set(n,(ee.get(n)||0)+1)}for(var Z=new Uint8Array(q.length),we=new Map,Te=[],se=null,et=0;et<q.length;et++)se||Te.push(se={start:et,end:q.length-1,level:ye==="rtl"?1:ye==="ltr"?0:jp(et,false)}),$[et]&S&&(se.end=et,se=null);for(var Fr=xe|fe|J|N|a|ke|le|S,er=function(Gt){return Gt+(Gt&1?1:2)},Ri=function(Gt){return Gt+(Gt&1?2:1)},ki=0;ki<Te.length;ki++){se=Te[ki];var Oe=[{_level:se.level,_override:0,_isolate:0}],Le=void 0,oi=0,Ti=0,ca=0;ee.clear();for(var nt=se.start;nt<=se.end;nt++){var ht=$[nt];if(Le=Oe[Oe.length-1],ee.set(ht,(ee.get(ht)||0)+1),ht&n&&ee.set(n,(ee.get(n)||0)+1),ht&Fr)if(ht&(xe|fe)){Z[nt]=Le._level;var da=(ht===xe?Ri:er)(Le._level);da<=re&&!oi&&!Ti?Oe.push({_level:da,_override:0,_isolate:0}):oi||Ti++}else if(ht&(J|N)){Z[nt]=Le._level;var gp=(ht===J?Ri:er)(Le._level);gp<=re&&!oi&&!Ti?Oe.push({_level:gp,_override:ht&J?T:b,_isolate:0}):oi||Ti++}else if(ht&a){ht&Ve&&(ht=jp(nt+1,true)===1?Pe:$e),Z[nt]=Le._level,Le._override&&ae(nt,Le._override);var _p=(ht===Pe?Ri:er)(Le._level);_p<=re&&oi===0&&Ti===0?(ca++,Oe.push({_level:_p,_override:0,_isolate:1,_isolInitIndex:nt})):oi++}else if(ht&ke){if(oi>0)oi--;else if(ca>0){for(Ti=0;!Oe[Oe.length-1]._isolate;)Oe.pop();var au=Oe[Oe.length-1]._isolInitIndex;au!=null&&(we.set(au,nt),we.set(nt,au)),Oe.pop(),ca--}Le=Oe[Oe.length-1],Z[nt]=Le._level,Le._override&&ae(nt,Le._override)}else ht&le?(oi===0&&(Ti>0?Ti--:!Le._isolate&&Oe.length>1&&(Oe.pop(),Le=Oe[Oe.length-1])),Z[nt]=Le._level):ht&S&&(Z[nt]=se.level);else Z[nt]=Le._level,Le._override&&ht!==M&&ae(nt,Le._override)}for(var pa=[],Li=null,zr=se.start;zr<=se.end;zr++){var su=$[zr];if(!(su&o)){var yp=Z[zr],vp=su&a,jv=su===ke;Li&&yp===Li._level?(Li._end=zr,Li._endsWithIsolInit=vp):pa.push(Li={_start:zr,_end:zr,_level:yp,_startsWithPDI:jv,_endsWithIsolInit:vp})}}for(var nu=[],Fn=0;Fn<pa.length;Fn++){var zn=pa[Fn];if(!zn._startsWithPDI||zn._startsWithPDI&&!we.has(zn._start)){for(var ou=[Li=zn],xp=void 0;Li&&Li._endsWithIsolInit&&(xp=we.get(Li._end))!=null;)for(var Rn=Fn+1;Rn<pa.length;Rn++)if(pa[Rn]._start===xp){ou.push(Li=pa[Rn]);break}for(var fa=[],lu=0;lu<ou.length;lu++)for(var bp=ou[lu],uu=bp._start;uu<=bp._end;uu++)fa.push(uu);for(var Uv=Z[fa[0]],wp=se.level,kn=fa[0]-1;kn>=0;kn--)if(!($[kn]&o)){wp=Z[kn];break}var hu=fa[fa.length-1],Nv=Z[hu],Tp=se.level;if(!($[hu]&a)){for(var Ln=hu+1;Ln<=se.end;Ln++)if(!($[Ln]&o)){Tp=Z[Ln];break}}nu.push({_seqIndices:fa,_sosType:Math.max(wp,Uv)%2?T:b,_eosType:Math.max(Tp,Nv)%2?T:b})}}for(var cu=0;cu<nu.length;cu++){var du=nu[cu],te=du._seqIndices,ns=du._sosType,Gv=du._eosType,ma=Z[te[0]]&1?T:b;if(ee.get(L))for(var Bn=0;Bn<te.length;Bn++){var Ep=te[Bn];if($[Ep]&L){for(var pu=ns,On=Bn-1;On>=0;On--)if(!($[te[On]]&o)){pu=$[te[On]];break}ae(Ep,pu&(a|ke)?D:pu)}}if(ee.get(P))for(var $n=0;$n<te.length;$n++){var Sp=te[$n];if($[Sp]&P)for(var Vn=$n-1;Vn>=-1;Vn--){var Dp=Vn===-1?ns:$[te[Vn]];if(Dp&s){Dp===O&&ae(Sp,R);break}}}if(ee.get(O))for(var fu=0;fu<te.length;fu++){var Cp=te[fu];$[Cp]&O&&ae(Cp,T)}if(ee.get(E)||ee.get(z))for(var os=1;os<te.length-1;os++){var mu=te[os];if($[mu]&(E|z)){for(var ga=0,gu=0,_u=os-1;_u>=0&&(ga=$[te[_u]],ga&o);_u--);for(var yu=os+1;yu<te.length&&(gu=$[te[yu]],gu&o);yu++);ga===gu&&($[mu]===E?ga===P:ga&(P|R))&&ae(mu,ga)}}if(ee.get(P)){for(var Bi=0;Bi<te.length;Bi++)if($[te[Bi]]&P){for(var jn=Bi-1;jn>=0&&$[te[jn]]&(I|o);jn--)ae(te[jn],P);for(Bi++;Bi<te.length&&$[te[Bi]]&(I|o|P);Bi++)$[te[Bi]]!==P&&ae(te[Bi],P)}}if(ee.get(I)||ee.get(E)||ee.get(z))for(var ls=0;ls<te.length;ls++){var Pp=te[ls];if($[Pp]&(I|E|z)){ae(Pp,D);for(var Un=ls-1;Un>=0&&$[te[Un]]&o;Un--)ae(te[Un],D);for(var Nn=ls+1;Nn<te.length&&$[te[Nn]]&o;Nn++)ae(te[Nn],D)}}if(ee.get(P))for(var vu=0,Ap=ns;vu<te.length;vu++){var Ip=te[vu],xu=$[Ip];xu&P?Ap===b&&ae(Ip,b):xu&s&&(Ap=xu)}if(ee.get(n)){for(var us=T|P|R,Mp=us|b,Gn=[],_a=[],ya=0;ya<te.length;ya++)if($[te[ya]]&n){var hs=q[te[ya]],Fp=void 0;if(x(hs)!==null)if(_a.length<63)_a.push({char:hs,seqIndex:ya});else break;else if((Fp=v(hs))!==null)for(var cs=_a.length-1;cs>=0;cs--){var bu=_a[cs].char;if(bu===Fp||bu===v(w(hs))||x(w(bu))===hs){Gn.push([_a[cs].seqIndex,ya]),_a.length=cs;break}}}Gn.sort(function(Gt,Ei){return Gt[0]-Ei[0]});for(var wu=0;wu<Gn.length;wu++){for(var zp=Gn[wu],Zn=zp[0],Tu=zp[1],Rp=false,Oi=0,Eu=Zn+1;Eu<Tu;Eu++){var kp=te[Eu];if($[kp]&Mp){Rp=true;var Lp=$[kp]&us?T:b;if(Lp===ma){Oi=Lp;break}}}if(Rp&&!Oi){Oi=ns;for(var Su=Zn-1;Su>=0;Su--){var Bp=te[Su];if($[Bp]&Mp){var Op=$[Bp]&us?T:b;Oi=Op===ma?ma:Op;break}}}if(Oi){if($[te[Zn]]=$[te[Tu]]=Oi,Oi!==ma){for(var ds=Zn+1;ds<te.length;ds++)if(!($[te[ds]]&o)){c(q[te[ds]])&L&&($[te[ds]]=Oi);break}}if(Oi!==ma){for(var ps=Tu+1;ps<te.length;ps++)if(!($[te[ps]]&o)){c(q[te[ps]])&L&&($[te[ps]]=Oi);break}}}}for(var mr=0;mr<te.length;mr++)if($[te[mr]]&n){for(var $p=mr,Du=mr,Cu=ns,fs=mr-1;fs>=0;fs--)if($[te[fs]]&o)$p=fs;else{Cu=$[te[fs]]&us?T:b;break}for(var Vp=Gv,ms=mr+1;ms<te.length;ms++)if($[te[ms]]&(n|o))Du=ms;else{Vp=$[te[ms]]&us?T:b;break}for(var Pu=$p;Pu<=Du;Pu++)$[te[Pu]]=Cu===Vp?Cu:ma;mr=Du}}}for(var Kt=se.start;Kt<=se.end;Kt++){var Zv=Z[Kt],qn=$[Kt];if(Zv&1?qn&(b|P|R)&&Z[Kt]++:qn&T?Z[Kt]++:qn&(R|P)&&(Z[Kt]+=2),qn&o&&(Z[Kt]=Kt===0?se.level:Z[Kt-1]),Kt===se.end||c(q[Kt])&(A|S))for(var Wn=Kt;Wn>=0&&c(q[Wn])&l;Wn--)Z[Wn]=se.level}}return{levels:Z,paragraphs:Te};function jp(Gt,Ei){for(var Zt=Gt;Zt<q.length;Zt++){var gr=$[Zt];if(gr&(T|O))return 1;if(gr&(S|b)||Ei&&gr===ke)return 0;if(gr&a){var Up=qv(Zt);Zt=Up===-1?q.length:Up}}return 0}function qv(Gt){for(var Ei=1,Zt=Gt+1;Zt<q.length;Zt++){var gr=$[Zt];if(gr&S)break;if(gr&ke){if(--Ei===0)return Zt}else gr&a&&Ei++}return-1}}var Rt="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",Ut;function Nt(){if(!Ut){var q=f(Rt,true),ye=q.map;q.reverseMap.forEach(function(re,$){ye.set($,re)}),Ut=ye}}function Tt(q){return Nt(),Ut.get(q)||null}function st(q,ye,re,$){var ve=q.length;re=Math.max(0,re==null?0:+re),$=Math.min(ve-1,$==null?ve-1:+$);for(var ee=new Map,ae=re;ae<=$;ae++)if(ye[ae]&1){var Z=Tt(q[ae]);Z!==null&&ee.set(ae,Z)}return ee}function Yt(q,ye,re,$){var ve=q.length;re=Math.max(0,re==null?0:+re),$=Math.min(ve-1,$==null?ve-1:+$);var ee=[];return ye.paragraphs.forEach(function(ae){var Z=Math.max(re,ae.start),we=Math.min($,ae.end);if(Z<we){for(var Te=ye.levels.slice(Z,we+1),se=we;se>=Z&&c(q[se])&l;se--)Te[se]=ae.level;for(var et=ae.level,Fr=1/0,er=0;er<Te.length;er++){var Ri=Te[er];Ri>et&&(et=Ri),Ri<Fr&&(Fr=Ri|1)}for(var ki=et;ki>=Fr;ki--)for(var Oe=0;Oe<Te.length;Oe++)if(Te[Oe]>=ki){for(var Le=Oe;Oe+1<Te.length&&Te[Oe+1]>=ki;)Oe++;Oe>Le&&ee.push([Le+Z,Oe+Z])}}}),ee}function wi(q,ye,re,$){var ve=ni(q,ye,re,$),ee=[].concat(q);return ve.forEach(function(ae,Z){ee[Z]=(ye.levels[ae]&1?Tt(q[ae]):null)||q[ae]}),ee.join("")}function ni(q,ye,re,$){for(var ve=Yt(q,ye,re,$),ee=[],ae=0;ae<q.length;ae++)ee[ae]=ae;return ve.forEach(function(Z){for(var we=Z[0],Te=Z[1],se=ee.slice(we,Te+1),et=se.length;et--;)ee[Te-et]=se[et]}),ee}return e.closingToOpeningBracket=v,e.getBidiCharType=c,e.getBidiCharTypeName=d,e.getCanonicalBracket=w,e.getEmbeddingLevels=ft,e.getMirroredCharacter=Tt,e.getMirroredCharactersMap=st,e.getReorderSegments=Yt,e.getReorderedIndices=ni,e.getReorderedString=wi,e.openingToClosingBracket=x,Object.defineProperty(e,"__esModule",{value:true}),e}({})}const Md=fS(),mS=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/,gS=new Set(["WS","FSI","LRI","RLI","PDI"]),_S=new Set(["S","B"]);function yS(e,t4,i,r){let a=[],s=i;for(let n of wc(e.slice(i,r)))a.push({index:s,text:n,level:t4[s]}),s+=n.length;return a}function vS(e,t4){let i=true;for(let r=e.length-1;r>=0;r--){let a=Md.getBidiCharTypeName(e[r].text[0]);_S.has(a)?(e[r].level=t4,i=true):i&&gS.has(a)?e[r].level=t4:i=false}}function xS(e,t4){let i=t4,r=1/0;for(let{level:s}of e)s>i&&(i=s),(s|1)<r&&(r=s|1);let a=e.slice();for(let s=i;s>=r;s--)for(let n=0;n<a.length;n++){if(a[n].level<s)continue;let o=n;for(;o+1<a.length&&a[o+1].level>=s;)o++;for(let l=n,u=o;l<u;l++,u--)[a[l],a[u]]=[a[u],a[l]];n=o}return a}function bS(e){return e.level%2==0?e.text:Md.getMirroredCharacter(e.text)??e.text}function wS(e,t4){var i;return((i=e.find(r=>t4>=r.start&&t4<=r.end))==null?void 0:i.level)??0}function TS(e,t4,i,r,a){let s=yS(e,t4,r,a);vS(s,i);let n="",o=[];for(let l of xS(s,i)){if(mS.test(l.text))continue;let u=bS(l);n+=u,o.push(...Array(u.length).fill(l.index))}return{text:n,sourceIndices:o}}function ES(e,t4){let i=t4.filter(s=>s>0&&s<e.length),r=[...new Set([0,...i,e.length])].sort((s,n)=>s-n),a=[];for(let s=0;s+1<r.length;s++)a.push([r[s],r[s+1]]);return a}function M0(e,t4){let{levels:i,paragraphs:r}=Md.getEmbeddingLevels(e);return ES(e,t4.concat(r.map(a=>a.start))).map(([a,s])=>TS(e,i,wS(r,a),a,s))}function SS(e,t4){return M0(e,t4).map(i=>i.text)}function DS(e,t4,i){return M0(e,i).map(r=>[r.text,r.sourceIndices.map(a=>t4[a]??0)])}const am=4294967296,sm=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");var F0=class{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t4,i=this.length){let r;for(;r=this.nextField(i);)e(r,t4,this);return t4}readMessage(e,t4){return this.readFields(e,t4,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,true);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,true);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,true)+this.dataView.getUint32(this.pos+4,true)*am;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,true)+this.dataView.getInt32(this.pos+4,true)*am;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,true);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,true);return this.pos+=8,e}readVarint(e){let t4=this.buf,i=t4[this.pos++];if(i<128)return i;let r=i&127,a;return a=t4[this.pos++],r|=(a&127)<<7,a<128||(a=t4[this.pos++],r|=(a&127)<<14,a<128)||(a=t4[this.pos++],r|=(a&127)<<21,a<128)?r:(a=t4[this.pos],r|=(a&15)<<28,CS(r,e,this))}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t4=this.pos;return this.pos=e,e-t4>=12&&sm?sm.decode(this.buf.subarray(t4,e)):AS(this.buf,t4,e)}readBytes(){let e=this.readVarint()+this.pos,t4=this.buf.subarray(this.pos,e);return this.pos=e,t4}readPackedVarint(e=[],t4){let i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t4));return e}readPackedSVarint(e=[]){let t4=this.readPackedEnd();for(;this.pos<t4;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t4=this.readPackedEnd();for(;this.pos<t4;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t4=this.readPackedEnd();for(;this.pos<t4;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t4=this.readPackedEnd();for(;this.pos<t4;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t4=this.readPackedEnd();for(;this.pos<t4;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t4=this.readPackedEnd();for(;this.pos<t4;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t4=this.readPackedEnd();for(;this.pos<t4;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t4=this.readPackedEnd();for(;this.pos<t4;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;let t4=this.readVarint();return this.type=t4&7,this._valueStart=this.pos,t4>>>3}skip(e){let t4=e&7;if(t4===0)for(;this.buf[this.pos++]>127;);else if(t4===2)this.pos=this.readVarint()+this.pos;else if(t4===5)this.pos+=4;else if(t4===1)this.pos+=8;else throw Error(`Unimplemented type: ${t4}`)}};function CS(e,t4,i){let r=i.buf,a,s;if(s=r[i.pos++],a=(s&112)>>4,s<128||(s=r[i.pos++],a|=(s&127)<<3,s<128)||(s=r[i.pos++],a|=(s&127)<<10,s<128)||(s=r[i.pos++],a|=(s&127)<<17,s<128)||(s=r[i.pos++],a|=(s&127)<<24,s<128)||(s=r[i.pos++],a|=(s&1)<<31,s<128))return PS(e,a,t4);throw Error("Expected varint not more than 10 bytes")}function PS(e,t4,i){return i?t4*4294967296+(e>>>0):(t4>>>0)*4294967296+(e>>>0)}function AS(e,t4,i){let r="",a=t4;for(;a<i;){let s=e[a],n=null,o=s>239?4:s>223?3:s>191?2:1;if(a+o>i)break;let l,u,h;o===1?s<128&&(n=s):o===2?(l=e[a+1],(l&192)==128&&(n=(s&31)<<6|l&63,n<=127&&(n=null))):o===3?(l=e[a+1],u=e[a+2],(l&192)==128&&(u&192)==128&&(n=(s&15)<<12|(l&63)<<6|u&63,(n<=2047||n>=55296&&n<=57343)&&(n=null))):o===4&&(l=e[a+1],u=e[a+2],h=e[a+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(n=(s&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(n<=65535||n>=1114112)&&(n=null))),n===null?(n=65533,o=1):n>65535&&(n-=65536,r+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),r+=String.fromCharCode(n),a+=o}return r}function IS(e,t4,i){e===1&&i.readMessage(MS,t4)}function MS(e,t4,i){if(e===3){let{id:r,bitmap:a,width:s,height:n,left:o,top:l,advance:u}=i.readMessage(FS,{});t4.push({id:r,bitmap:new Dd({width:s+6,height:n+6},a),metrics:{width:s,height:n,left:o,top:l,advance:u}})}}function FS(e,t4,i){e===1?t4.id=i.readVarint():e===2?t4.bitmap=i.readBytes():e===3?t4.width=i.readVarint():e===4?t4.height=i.readVarint():e===5?t4.left=i.readSVarint():e===6?t4.top=i.readSVarint():e===7&&(t4.advance=i.readVarint())}function zS(e){return new F0(e).readFields(IS,[])}function cl(e){return typeof(e==null?void 0:e.renderWithWebGL)=="function"}function RS(e){let{userImage:t4}=e;return!(t4!=null&&t4.render)||!t4.render()?false:(cl(t4.data)||e.data.replace(new Uint8Array(t4.data.buffer)),true)}function z0(e){let t4=0,i=0;for(let n of e)t4+=n.w*n.h,i=Math.max(i,n.w);e.sort((n,o)=>o.h-n.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t4/.95)),i),h:1/0}],a=0,s=0;for(let n of e)for(let o=r.length-1;o>=0;o--){let l=r[o];if(!(n.w>l.w||n.h>l.h)){if(n.x=l.x,n.y=l.y,s=Math.max(s,n.y+n.h),a=Math.max(a,n.x+n.w),n.w===l.w&&n.h===l.h){let u=r.pop();u&&o<r.length&&(r[o]=u)}else n.h===l.h?(l.x+=n.w,l.w-=n.w):n.w===l.w?(l.y+=n.h,l.h-=n.h):(r.push({x:l.x+n.w,y:l.y,w:l.w-n.w,h:n.h}),l.y+=n.h,l.h-=n.h);break}}return{w:a,h:s,fill:t4/(a*s)||0}}var Fd=class{constructor(e,{pixelRatio:t4,version:i,isWebGLImage:r=false,stretchX:a,stretchY:s,content:n,textFitWidth:o,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=t4,this.stretchX=a,this.stretchY=s,this.content=n,this.version=i,this.needsFirstWebGLRender=r,this.textFitWidth=o,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}},kS=class{constructor(e,t4){let i={},r={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let a=[];this.addImages(e,i,a),this.addImages(t4,r,a);let{w:s,h:n}=z0(a),o=new je({width:s||1,height:n||1});for(let l in e){let u=e[l];if(u.isWebGLImage)continue;let h=i[l].paddedRect;je.copy(u.data,o,{x:0,y:0},{x:h.x+1,y:h.y+1},u.data)}for(let l in t4){let u=t4[l],h=r[l].paddedRect,c=h.x+1,d=h.y+1,p=u.data.width,f=u.data.height;je.copy(u.data,o,{x:0,y:0},{x:c,y:d},u.data),je.copy(u.data,o,{x:0,y:f-1},{x:c,y:d-1},{width:p,height:1}),je.copy(u.data,o,{x:0,y:0},{x:c,y:d+f},{width:p,height:1}),je.copy(u.data,o,{x:p-1,y:0},{x:c-1,y:d},{width:1,height:f}),je.copy(u.data,o,{x:0,y:0},{x:c+p,y:d},{width:1,height:f})}this.image=o,this.iconPositions=i,this.patternPositions=r}addImages(e,t4,i){for(let r in e){let a=e[r],s={x:0,y:0,w:a.data.width+2,h:a.data.height+2};i.push(s),t4[r]=new Fd(s,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t4){if(e.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==e.updateVersion){this.patchedUpdateVersion=e.updateVersion;for(let i in this.iconPositions)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t4);for(let i in this.patternPositions)this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t4)}}patchUpdatedImage(e,t4,i){var l;if(!e||!t4||!e.needsFirstWebGLRender&&e.version===t4.version)return;e.needsFirstWebGLRender=false,e.version=t4.version;let[r,a]=e.tl,s=(l=t4.userImage)==null?void 0:l.data;if(!cl(s)){i.update(t4.data,void 0,{x:r,y:a});return}let{width:n,height:o}=t4.data;i.context.setCustomLayerDefaults(),s.renderWithWebGL({gl:i.context.gl,texture:i.texture,x:r,y:a,width:n,height:o}),i.context.setDirty()}};G("ImagePosition",Fd),G("ImageAtlas",kS);var R0=function(e){return e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e}(R0||{});function LS(e){for(let t4 of e)if(t4.positionedGlyphs.length!==0)return false;return true}function BS(e,t4){let i=[],r=0;for(let a of t4)i.push(e.substring(r,a)),r=a;return r<e.length()&&i.push(e.substring(r,e.length())),i}const nm=new RegExp("^\\p{gc=M}$","u");function OS(e){let t4=[],i=0;for(;i<e.length;){if(!nm.test(e[i])){t4.push(i),i++;continue}let r=i;for(;r<e.length&&nm.test(e[r]);)r++;let a=e[r];if(a!==void 0&&P0(a.codePointAt(0))){t4.push(r);for(let s=r-1;s>=i;s--)t4.push(s);i=r+1}else{for(let s=i;s<r;s++)t4.push(s);i=r}}return t4}function $S(e){let t4=[],i=0;for(let r of e.graphemes())t4.push(...Array(r.length).fill(e.sectionIndex[i])),i++;return t4}function VS(e,t4){let i=t4.map(s=>e.toCodeUnitIndex(s)),r=ul.isParsed()?ul:null;if(e.sections.length===1)return r?r.processBidirectionalText(e.toString(),i).map(s=>om(s,e.sections,[...s].map(()=>0))):SS(e.toString(),i).map(s=>Sc([...s],e.sections,[...s].map(()=>0)));let a=$S(e);return r?r.processStyledBidirectionalText(e.text,a,i).map(([s,n])=>om(s,e.sections,n)):DS(e.text,a,i).map(([s,n])=>{let o=[...s];return Sc(o,e.sections,k0(o).map(l=>n[l]??0))})}function Sc(e,t4,i){let r=new Id(e.join(""),t4,[]),a=0;for(let s of r.graphemes())r.sectionIndex.push(i[a]??0),a+=[...s].length;return r}function k0(e){let t4=[],i=0;for(let r of e)t4.push(i),i+=r.length;return t4}function om(e,t4,i){let r=[...e],a=k0(r),s=OS(r);return Sc(s.map(n=>r[n]),t4,s.map(n=>i[a[n]]??0))}function oo(e,t4,i,r,a,s,n,o,l,u,h,c,d,p,f){let m=Id.fromFeature(e,a);c===2&&m.verticalizePunctuation();let g=m.determineLineBreaks(u,s,t4,r,p),_=A0(m.text)?VS(m,g):BS(m,g),y=[],x={positionedLines:y,text:m.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:false,verticalizable:false};return XS(x,t4,i,r,_,n,o,l,c,u,d,f),!LS(y)&&x}function Hl(e){let t4=.5,i=.5;switch(e){case"right":case"top-right":case"bottom-right":t4=1;break;case"left":case"top-left":case"bottom-left":t4=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t4,verticalAlign:i}}function jS(e,t4,i){let r=t4.getMaxScale()*24,{maxImageWidth:a,maxImageHeight:s}=t4.getMaxImageSize(e),n=Math.max(r,s*i);return{verticalLineContentWidth:Math.max(r,a*i),horizontalLineContentHeight:n}}function L0(e){switch(e){case"top":return 0;case"center":return .5;default:return 1}}function US(e,t4,i,r){var s;if(e!=null&&e.rect)return e;let a=(s=t4[i.fontStack])==null?void 0:s[r];return a?{rect:null,metrics:a.metrics}:null}function NS(e,t4,i){return!(e===1||!t4&&!Wl(i)||t4&&(Ad(i)||C0(i)))}function Lo(e){return new RegExp("\\p{Nd}","u").test(String.fromCodePoint(e))}function B0(e){return new RegExp("\\p{Lu}","u").test(String.fromCodePoint(e))}function GS(e){return/[\p{P}\p{S}]/u.test(String.fromCodePoint(e))}function ZS(e){let t4=e.some(Lo)&&e.every(r=>Lo(r)||GS(r)),i=e.length<=3&&e.every(r=>B0(r)||Lo(r));return t4||i}function qS(e){return(Lo(e)||B0(e))&&!C0(e)}function WS(e,t4){let i=false;for(let r=0;r<e.length;r++){if(t4[r])continue;let a=za[e[r]];a&&(r===0||t4[r-1])&&(r===e.length-1||t4[r+1])&&(e[r]=a,t4[r]=true,i=true)}return i}function HS(e){let t4=e.graphemes().slice(),i=t4.map(s=>s.codePointAt(0)),r=i.map(Wl),a=s=>!r[s]&&!Ad(i[s])&&!("imageName"in e.getSection(s));for(let s=0;s<i.length;s++){if(!a(s))continue;let n=s;for(;n+1<i.length&&a(n+1);)n++;if(ZS(i.slice(s,n+1)))for(let o=s;o<=n;o++)r[o]=qS(i[o]);s=n}return WS(t4,r)&&(e.text=t4.join(""),e._graphemes=null),r}function XS(e,t4,i,r,a,s,n,o,l,u,h,c){var w;let d=0,p=0,f=0,m=0,g=o==="right"?1:o==="left"?0:.5,_=24/c,y=0;for(let b of a){b.trim();let T=b.getMaxScale(),P={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=P;let E=P.positionedGlyphs,I=0;if(!b.length()){p+=s,++y;continue}let R=jS(r,b,_),z=l===2&&!h?HS(b):null,S=b.graphemes();for(let M=0;M<S.length;M++){let L=b.getSection(M),O=S[M],N=O.codePointAt(0),J=z?z[M]:NS(l,h,N),fe="fontStack"in L&&hl(O)&&!((w=t4[L.fontStack])!=null&&w[O])?[...O]:[O];for(let xe of fe){let le={glyph:xe.codePointAt(0),grapheme:xe,imageName:null,x:d,y:p+-17,vertical:J,scale:1,fontStack:"",sectionIndex:b.getSectionIndex(M),metrics:null,rect:null},$e;if("fontStack"in L){if($e=YS(L,xe,J,R,t4,i),!$e)continue;le.fontStack=L.fontStack}else{if(e.iconsInText=true,L.scale*=_,$e=KS(L,J,T,R,r),!$e)continue;I=Math.max(I,$e.imageOffset),le.imageName=L.imageName}let{rect:Pe,metrics:Ve,baselineOffset:ke}=$e;if(le.y+=ke,le.scale=L.scale,le.metrics=Ve,le.rect=Pe,E.push(le),!J)d+=Ve.advance*L.scale+u;else{e.verticalizable=true;let ft="imageName"in L?Ve.advance:24;d+=ft*L.scale+u}}}if(E.length!==0){let M=d-u;f=Math.max(M,f),JS(E,0,E.length-1,g)}d=0;let A=(T-1)*24;P.lineOffset=Math.max(I,A);let D=s*T+I;p+=D,m=Math.max(D,m),++y}let{horizontalAlign:x,verticalAlign:v}=Hl(n);QS(e.positionedLines,g,x,v,f,m,s,p,a.length),e.top+=-v*p,e.bottom=e.top+p,e.left+=-x*f,e.right=e.left+f}function YS(e,t4,i,r,a,s){var u;let n=(u=s[e.fontStack])==null?void 0:u[t4],o=US(n,a,e,t4);if(o===null)return null;let l;if(i)l=r.verticalLineContentWidth-e.scale*24;else{let h=L0(e.verticalAlign);l=(r.horizontalLineContentHeight-e.scale*24)*h}return{rect:o.rect,metrics:o.metrics,baselineOffset:l}}function KS(e,t4,i,r,a){let s=a[e.imageName];if(!s)return null;let n=s.paddedRect,o=s.displaySize,l={width:o[0],height:o[1],left:1,top:-3,advance:t4?o[1]:o[0]},u;if(t4)u=r.verticalLineContentWidth-o[1]*e.scale;else{let c=L0(e.verticalAlign);u=(r.horizontalLineContentHeight-o[1]*e.scale)*c}let h=(t4?o[0]:o[1])*e.scale-24*i;return{rect:n,metrics:l,baselineOffset:u,imageOffset:h}}function JS(e,t4,i,r){if(r===0)return;let a=e[i],s=a.metrics.advance*a.scale,n=(e[i].x+s)*r;for(let o=t4;o<=i;o++)e[o].x-=n}function QS(e,t4,i,r,a,s,n,o,l){let u=(t4-i)*a,h=0;h=s===n?-r*l*n+.5*n:-o*r- -17;for(let c of e)for(let d of c.positionedGlyphs)d.x+=u,d.y+=h}function eD(e,t4,i){let{horizontalAlign:r,verticalAlign:a}=Hl(i),s=t4[0],n=t4[1],o=s-e.displaySize[0]*r,l=o+e.displaySize[0],u=n-e.displaySize[1]*a;return{image:e,top:u,bottom:u+e.displaySize[1],left:o,right:l}}function O0(e){let t4=e.left,i=e.top,r=e.right-t4,a=e.bottom-i,s=e.image.content[2]-e.image.content[0],n=e.image.content[3]-e.image.content[1],o=e.image.textFitWidth??"stretchOrShrink",l=e.image.textFitHeight??"stretchOrShrink",u=s/n;if(l==="proportional"){if(o==="stretchOnly"&&r/a<u||o==="proportional"){let h=Math.ceil(a*u);t4*=h/r,r=h}}else if(o==="proportional"&&l==="stretchOnly"&&u!==0&&r/a>u){let h=Math.ceil(r/u);i*=h/a,a=h}return{x1:t4,y1:i,x2:t4+r,y2:i+a}}function lm(e,t4,i,r,a,s){let n=e.image,o;if(n.content){let g=n.content,_=n.pixelRatio||1;o=[g[0]/_,g[1]/_,n.displaySize[0]-g[2]/_,n.displaySize[1]-g[3]/_]}let l=t4.left*s,u=t4.right*s,h,c,d,p;i==="width"||i==="both"?(p=a[0]+l-r[3],c=a[0]+u+r[1]):(p=a[0]+(l+u-n.displaySize[0])/2,c=p+n.displaySize[0]);let f=t4.top*s,m=t4.bottom*s;return i==="height"||i==="both"?(h=a[1]+f-r[0],d=a[1]+m+r[2]):(h=a[1]+(f+m-n.displaySize[1])/2,d=h+n.displaySize[1]),{image:n,top:h,right:c,bottom:d,left:p,collisionPadding:o}}const um=32640;function hm(e,t4){let{expression:i}=t4;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new Fe(e+1))};if(i.kind==="source")return{kind:"source"};if(i.kind==="composite"){let{minZoom:r,maxZoom:a}=tD(i.zoomStops,e);return{kind:"composite",minZoom:r,maxZoom:a,interpolationType:i.interpolationType}}{let r=iD(i),a=i.evaluate(new Fe(e+1));return{kind:"camera",zoomStops:i.zoomStops,sizes:r,layoutSize:a,interpolationType:i.interpolationType}}}function tD(e,t4){let i=0;for(;i<e.length&&e[i]<=t4;)i++;i=Math.max(0,i-1);let r=i;for(;r<e.length&&e[r]<t4+1;)r++;return r=Math.min(e.length-1,r),{minZoom:e[i],maxZoom:e[r]}}function iD(e){return e.zoomStops.map(t4=>e.evaluate(new Fe(t4===-1/0?e.zoomStops[1]-1:t4)))}function zd(e,{uSize:t4,uSizeT:i},{lowerSize:r,upperSize:a}){return e.kind==="source"?r/128:e.kind==="composite"?He.number(r/128,a/128,i):t4}function Xl(e,t4){let i=0,r=0;return e.kind==="constant"?r=e.layoutSize:e.kind==="camera"?r=rD(e,t4):e.kind==="composite"&&(i=aD(e,t4)),{uSizeT:i,uSize:r}}function rD({zoomStops:e,sizes:t4,layoutSize:i,interpolationType:r},a){let s=e.length-1;for(;s>0&&e[s]>a;)s--;let n=Math.min(s+1,e.length-1),o=r?ne(yi.interpolationFactor(r,a,e[s],e[n]),0,1):0;return Math.min(He.number(t4[s],t4[n],o),i)}function aD({interpolationType:e,minZoom:t4,maxZoom:i},r){return e?ne(yi.interpolationFactor(e,r,t4,i),0,1):0}var Oa=class $0 extends C{constructor(t4,i,r,a){super(t4,i),this.angle=r,a!==void 0&&(this.segment=a)}clone(){return new $0(this.x,this.y,this.angle,this.segment)}};G("Anchor",Oa);function V0(e,t4,i,r,a){if(t4.segment===void 0||i===0)return true;let s=t4,n=t4.segment+1,o=0;for(;o>-i/2;){if(n--,n<0)return false;o-=e[n].dist(s),s=e[n]}o+=e[n].dist(e[n+1]),n++;let l=[],u=0;for(;o<i/2;){let h=e[n-1],c=e[n],d=e[n+1];if(!d)return false;let p=h.angleTo(c)-c.angleTo(d);for(p=Math.abs((p+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:o,angleDelta:p}),u+=p;o-l[0].distance>r;)u-=l.shift().angleDelta;if(u>a)return false;n++,o+=c.dist(d)}return true}function j0(e){let t4=0;for(let i=0;i<e.length-1;i++)t4+=e[i].dist(e[i+1]);return t4}function U0(e,t4,i){return e?3/5*t4*i:0}function N0(e,t4){return Math.max(e?e.right-e.left:0,t4?t4.right-t4.left:0)}function sD(e,t4,i,r,a,s){let n=U0(i,a,s),o=N0(i,r)*s,l=0,u=j0(e)/2;for(let h=0;h<e.length-1;h++){let c=e[h],d=e[h+1],p=c.dist(d);if(l+p>u){let f=(u-l)/p,m=new Oa(He.number(c.x,d.x,f),He.number(c.y,d.y,f),d.angleTo(c),h);return m._round(),!n||V0(e,m,o,n,t4)?m:void 0}l+=p}}function nD(e,t4,i,r,a,s,n,o,l){let u=U0(r,s,n),h=N0(r,a),c=h*n,d=e[0].x===0||e[0].x===l||e[0].y===0||e[0].y===l;t4-c<t4/4&&(t4=c+t4/4);let p=s*2;return G0(e,d?t4/2*o%t4:(h/2+p)*n*o%t4,t4,u,i,c,d,false,l)}function G0(e,t4,i,r,a,s,n,o,l){let u=s/2,h=j0(e),c=0,d=t4-i,p=[];for(let f=0;f<e.length-1;f++){let m=e[f],g=e[f+1],_=m.dist(g),y=g.angleTo(m);for(;d+i<c+_;){d+=i;let x=(d-c)/_,v=He.number(m.x,g.x,x),w=He.number(m.y,g.y,x);if(v>=0&&v<l&&w>=0&&w<l&&d-u>=0&&d+u<=h){let b=new Oa(v,w,y,f);b._round(),(!r||V0(e,b,s,r,a))&&p.push(b)}}c+=_}return!o&&!p.length&&!n&&(p=G0(e,c/2,i,r,a,s,n,true,l)),p}function Z0(e,t4,i,r,a){let s=[];for(let n of e){let o;for(let l=0;l<n.length-1;l++){let u=n[l],h=n[l+1];u.x<t4&&h.x<t4||(u.x<t4?u=new C(t4,u.y+(h.y-u.y)*((t4-u.x)/(h.x-u.x)))._round():h.x<t4&&(h=new C(t4,u.y+(h.y-u.y)*((t4-u.x)/(h.x-u.x)))._round()),!(u.y<i&&h.y<i)&&(u.y<i?u=new C(u.x+(h.x-u.x)*((i-u.y)/(h.y-u.y)),i)._round():h.y<i&&(h=new C(u.x+(h.x-u.x)*((i-u.y)/(h.y-u.y)),i)._round()),!(u.x>=r&&h.x>=r)&&(u.x>=r?u=new C(r,u.y+(h.y-u.y)*((r-u.x)/(h.x-u.x)))._round():h.x>=r&&(h=new C(r,u.y+(h.y-u.y)*((r-u.x)/(h.x-u.x)))._round()),!(u.y>=a&&h.y>=a)&&(u.y>=a?u=new C(u.x+(h.x-u.x)*((a-u.y)/(h.y-u.y)),a)._round():h.y>=a&&(h=new C(u.x+(h.x-u.x)*((a-u.y)/(h.y-u.y)),a)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],s.push(o)),o.push(h)))))}}return s}function cm(e,t4,i,r){let a=[],s=e.image,n=s.pixelRatio,o=s.paddedRect.w-2,l=s.paddedRect.h-2,u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},h=s.stretchX||[[0,o]],c=s.stretchY||[[0,l]],d=(A,D)=>A+D[1]-D[0],p=h.reduce(d,0),f=c.reduce(d,0),m=o-p,g=l-f,_=0,y=p,x=0,v=f,w=0,b=m,T=0,P=g;if(s.content&&r){let A=s.content,D=A[2]-A[0],M=A[3]-A[1];(s.textFitWidth||s.textFitHeight)&&(u=O0(e)),_=lo(h,0,A[0]),x=lo(c,0,A[1]),y=lo(h,A[0],A[2]),v=lo(c,A[1],A[3]),w=A[0]-_,T=A[1]-x,b=D-y,P=M-v}let E=u.x1,I=u.y1,R=u.x2-E,z=u.y2-I,S=(A,D,M,L)=>{let O=uo(A.stretch-_,y,R,E),N=ho(A.fixed-w,b,A.stretch,p),J=uo(D.stretch-x,v,z,I),fe=ho(D.fixed-T,P,D.stretch,f),xe=uo(M.stretch-_,y,R,E),le=ho(M.fixed-w,b,M.stretch,p),$e=uo(L.stretch-x,v,z,I),Pe=ho(L.fixed-T,P,L.stretch,f),Ve=new C(O,J),ke=new C(xe,J),ft=new C(xe,$e),Rt=new C(O,$e),Ut=new C(N/n,fe/n),Nt=new C(le/n,Pe/n),Tt=t4*Math.PI/180;if(Tt){let q=Math.sin(Tt),ye=Math.cos(Tt),re=[ye,-q,q,ye];Ve._matMult(re),ke._matMult(re),Rt._matMult(re),ft._matMult(re)}let st=A.stretch+A.fixed,Yt=M.stretch+M.fixed,wi=D.stretch+D.fixed,ni=L.stretch+L.fixed;return{tl:Ve,tr:ke,bl:Rt,br:ft,tex:{x:s.paddedRect.x+1+st,y:s.paddedRect.y+1+wi,w:Yt-st,h:ni-wi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ut,pixelOffsetBR:Nt,minFontScaleX:b/n/R,minFontScaleY:P/n/z,isSDF:i}};if(!r||!s.stretchX&&!s.stretchY)a.push(S({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let A=dm(h,m,p),D=dm(c,g,f);for(let M=0;M<A.length-1;M++){let L=A[M],O=A[M+1];for(let N=0;N<D.length-1;N++){let J=D[N],fe=D[N+1];a.push(S(L,J,O,fe))}}}return a}function lo(e,t4,i){let r=0;for(let a of e)r+=Math.max(t4,Math.min(i,a[1]))-Math.max(t4,Math.min(i,a[0]));return r}function dm(e,t4,i){let r=[{fixed:-1,stretch:0}];for(let[a,s]of e){let n=r[r.length-1];r.push({fixed:a-n.stretch,stretch:n.stretch}),r.push({fixed:a-n.stretch,stretch:n.stretch+(s-a)})}return r.push({fixed:t4+1,stretch:i}),r}function uo(e,t4,i,r){return e/t4*i+r}function ho(e,t4,i,r){return e-t4*i/r}function oD(e,t4,i,r,a,s,n,o){let l=r.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,u=[];for(let h of t4.positionedLines)for(let c of h.positionedGlyphs){if(!c.rect)continue;let d=c.rect||{},p=4,f=true,m=1,g=0,_=(a||o)&&c.vertical,y=c.metrics.advance*c.scale/2;if(o&&t4.verticalizable){let L=(c.scale-1)*24,O=(24-c.metrics.width*c.scale)/2;g=h.lineOffset/2-(c.imageName?-O:L)}if(c.imageName){let L=n[c.imageName];f=L.sdf,m=L.pixelRatio,p=1/m}let x=a?[c.x+y,c.y]:[0,0],v=a?[0,0]:[c.x+y+i[0],c.y+i[1]-g],w=[0,0];_&&(w=v,v=[0,0]);let b=c.metrics.isDoubleResolution?2:1,T=(c.metrics.left-p)*c.scale-y+v[0],P=(-c.metrics.top-p)*c.scale+v[1],E=T+d.w/b*c.scale/m,I=P+d.h/b*c.scale/m,R=new C(T,P),z=new C(E,P),S=new C(T,I),A=new C(E,I);if(_){let L=new C(-y,y- -17),O=-Math.PI/2,N=12-y,J=c.imageName?N:0,fe=new C(22-N,-J),xe=new C(...w);R._rotateAround(O,L)._add(fe)._add(xe),z._rotateAround(O,L)._add(fe)._add(xe),S._rotateAround(O,L)._add(fe)._add(xe),A._rotateAround(O,L)._add(fe)._add(xe)}if(l){let L=Math.sin(l),O=Math.cos(l),N=[O,-L,L,O];R._matMult(N),z._matMult(N),S._matMult(N),A._matMult(N)}let D=new C(0,0),M=new C(0,0);u.push({tl:R,tr:z,bl:S,br:A,tex:d,writingMode:t4.writingMode,glyphOffset:x,sectionIndex:c.sectionIndex,isSDF:f,pixelOffsetTL:D,pixelOffsetBR:M,minFontScaleX:0,minFontScaleY:0})}return u}var co=class{constructor(e,t4,i,r,a,s,n,o,l,u){var h;if(this.boxStartIndex=e.length,l){let c=s.top,d=s.bottom,p=s.collisionPadding;p&&(c-=p[1],d+=p[3]);let f=d-c;f>0&&(f=Math.max(10,f),this.circleDiameter=f)}else{let c=(h=s.image)!=null&&h.content&&(s.image.textFitWidth||s.image.textFitHeight)?O0(s):{x1:s.left,y1:s.top,x2:s.right,y2:s.bottom};c.y1=c.y1*n-o[0],c.y2=c.y2*n+o[2],c.x1=c.x1*n-o[3],c.x2=c.x2*n+o[1];let d=s.collisionPadding;if(d&&(c.x1-=d[0]*n,c.y1-=d[1]*n,c.x2+=d[2]*n,c.y2+=d[3]*n),u){let p=new C(c.x1,c.y1),f=new C(c.x2,c.y1),m=new C(c.x1,c.y2),g=new C(c.x2,c.y2),_=u*Math.PI/180;p._rotate(_),f._rotate(_),m._rotate(_),g._rotate(_),c.x1=Math.min(p.x,f.x,m.x,g.x),c.x2=Math.max(p.x,f.x,m.x,g.x),c.y1=Math.min(p.y,f.y,m.y,g.y),c.y2=Math.max(p.y,f.y,m.y,g.y)}e.emplaceBack(t4.x,t4.y,c.x1,c.y1,c.x2,c.y2,i,r,a)}this.boxEndIndex=e.length}},lD=class{constructor(e=[],t4=(i,r)=>i<r?-1:+(i>r)){if(this.data=e,this.length=this.data.length,this.compare=t4,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t4=this.data.pop();return--this.length>0&&(this.data[0]=t4,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t4,compare:i}=this,r=t4[e];for(;e>0;){let a=e-1>>1,s=t4[a];if(i(r,s)>=0)break;t4[e]=s,e=a}t4[e]=r}_down(e){let{data:t4,compare:i}=this,r=this.length>>1,a=t4[e];for(;e<r;){let s=(e<<1)+1,n=s+1;if(n<this.length&&i(t4[n],t4[s])<0&&(s=n),i(t4[s],a)>=0)break;t4[e]=t4[s],e=s}t4[e]=a}};function uD(e,t4=1){let i=Ai.fromPoints(e[0]),r=Math.min(i.width(),i.height()),a=r/2,s=new lD([],hD),{minX:n,minY:o,maxX:l,maxY:u}=i;if(r===0)return new C(n,o);for(let d=n;d<l;d+=r)for(let p=o;p<u;p+=r)s.push(new Ma(d+a,p+a,a,e));let h=dD(e),c=h;for(;s.length;){let d=s.pop();(d.d>c.d||!c.d)&&(c=d),!(d.max-c.d<=t4)&&(a=d.h/2,s.push(new Ma(d.p.x-a,d.p.y-a,a,e)),s.push(new Ma(d.p.x+a,d.p.y-a,a,e)),s.push(new Ma(d.p.x-a,d.p.y+a,a,e)),s.push(new Ma(d.p.x+a,d.p.y+a,a,e)))}return h.d>0&&c.d-h.d<=t4?h.p:c.p}function hD(e,t4){return t4.max-e.max}var Ma=class{constructor(e,t4,i,r){this.p=new C(e,t4),this.h=i,this.d=cD(this.p,r),this.max=this.d+this.h*Math.SQRT2}};function cD(e,t4){let i=false,r=1/0;for(let a of t4)for(let s=0,n=a.length,o=n-1;s<n;o=s++){let l=a[s],u=a[o];l.y>e.y!=u.y>e.y&&e.x<(u.x-l.x)*(e.y-l.y)/(u.y-l.y)+l.x&&(i=!i),r=Math.min(r,Qy(e,l,u))}return(i?1:-1)*Math.sqrt(r)}function dD(e){let t4=0,i=0,r=0,a=e[0];for(let s=0,n=a.length,o=n-1;s<n;o=s++){let l=a[s],u=a[o],h=l.x*u.y-u.x*l.y;i+=(l.x+u.x)*h,r+=(l.y+u.y)*h,t4+=h*3}return new Ma(i/t4,r/t4,0,e)}let Dc=function(e){return e[e.center=1]="center",e[e.left=2]="left",e[e.right=3]="right",e[e.top=4]="top",e[e.bottom=5]="bottom",e[e["top-left"]=6]="top-left",e[e["top-right"]=7]="top-right",e[e["bottom-left"]=8]="bottom-left",e[e["bottom-right"]=9]="bottom-right",e}({});const Rd=1/0;function q0(e,t4){function i(a,s){let n=0,o=0;s<0&&(s=0);let l=s/Math.SQRT2;switch(a){case"top-right":case"top-left":o=l-7;break;case"bottom-right":case"bottom-left":o=-l+7;break;case"bottom":o=-s+7;break;case"top":o=s-7}switch(a){case"top-right":case"bottom-right":n=-l;break;case"top-left":case"bottom-left":n=l;break;case"left":n=s;break;case"right":n=-s}return[n,o]}function r(a,s,n){let o=0,l=0;switch(s=Math.abs(s),n=Math.abs(n),a){case"top-right":case"top-left":case"top":l=n-7;break;case"bottom-right":case"bottom-left":case"bottom":l=-n+7}switch(a){case"top-right":case"bottom-right":case"right":o=-s;break;case"top-left":case"bottom-left":case"left":o=s}return[o,l]}return t4[1]===Rd?i(e,t4[0]):r(e,t4[0],t4[1])}function W0(e,t4,i){var n;let r=e.layout,a=(n=r.get("text-variable-anchor-offset"))==null?void 0:n.evaluate(t4,{},i);if(a){let o=a.values,l=[];for(let u=0;u<o.length;u+=2){let h=l[u]=o[u],c=o[u+1].map(d=>d*24);h.startsWith("top")?c[1]-=7:h.startsWith("bottom")&&(c[1]+=7),l[u+1]=c}return new Hi(l)}let s=r.get("text-variable-anchor");if(s){let o;o=e._unevaluatedLayout.getValue("text-radial-offset")===void 0?r.get("text-offset").evaluate(t4,{},i).map(u=>u*24):[r.get("text-radial-offset").evaluate(t4,{},i)*24,Rd];let l=[];for(let u of s)l.push(u,q0(u,o));return new Hi(l)}return null}function pD(e){var h,c;e.bucket.createArrays();let t4=512*e.bucket.overscaling;e.bucket.tilePixelRatio=k/t4,e.bucket.compareText={},e.bucket.iconsNeedLinear=false;let i=e.bucket.layers[0],r=i.layout,a=i._unevaluatedLayout._values,s={layoutIconSize:a["icon-size"].possiblyEvaluate(new Fe(e.bucket.zoom+1),e.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Fe(e.bucket.zoom+1),e.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Fe(18))};if(e.bucket.textSizeData.kind==="composite"){let{minZoom:d,maxZoom:p}=e.bucket.textSizeData;s.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Fe(d),e.canonical),a["text-size"].possiblyEvaluate(new Fe(p),e.canonical)]}if(e.bucket.iconSizeData.kind==="composite"){let{minZoom:d,maxZoom:p}=e.bucket.iconSizeData;s.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Fe(d),e.canonical),a["icon-size"].possiblyEvaluate(new Fe(p),e.canonical)]}let n=r.get("text-line-height")*24,o=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",l=r.get("text-keep-upright"),u=r.get("text-size");for(let d of e.bucket.features){let p=r.get("text-font").evaluate(d,{},e.canonical).join(","),f=u.evaluate(d,{},e.canonical),m=s.layoutTextSize.evaluate(d,{},e.canonical),g=s.layoutIconSize.evaluate(d,{},e.canonical),_={horizontal:{},vertical:void 0},y=d.text,x=[0,0];if(y){let T=y.toString(),P=r.get("text-letter-spacing").evaluate(d,{},e.canonical)*24,E=lS(T)?P:0,I=r.get("text-anchor").evaluate(d,{},e.canonical),R=W0(i,d,e.canonical);if(!R){let D=r.get("text-radial-offset").evaluate(d,{},e.canonical);x=D?q0(I,[D*24,Rd]):r.get("text-offset").evaluate(d,{},e.canonical).map(M=>M*24)}let z=o?"center":r.get("text-justify").evaluate(d,{},e.canonical),S=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(d,{},e.canonical)*24:1/0,A=()=>{e.bucket.allowVerticalPlacement&&Tc(T)&&(_.vertical=oo(y,e.glyphMap,e.glyphPositions,e.imagePositions,p,S,n,I,"left",E,x,2,true,m,f))};if(!o&&R){let D=new Set;if(z==="auto")for(let L=0;L<R.values.length;L+=2)D.add(Cc(R.values[L]));else D.add(z);let M=false;for(let L of D)if(!_.horizontal[L])if(M)_.horizontal[L]=_.horizontal[0];else{let O=oo(y,e.glyphMap,e.glyphPositions,e.imagePositions,p,S,n,"center",L,E,x,1,false,m,f);O&&(_.horizontal[L]=O,M=O.positionedLines.length===1)}A()}else{z==="auto"&&(z=Cc(I));let D=oo(y,e.glyphMap,e.glyphPositions,e.imagePositions,p,S,n,I,z,E,x,1,false,m,f);D&&(_.horizontal[z]=D),A(),Tc(T)&&o&&l&&(_.vertical=oo(y,e.glyphMap,e.glyphPositions,e.imagePositions,p,S,n,I,z,E,x,2,false,m,f))}}let v,w=false;if((h=d.icon)!=null&&h.name){let T=e.imageMap[d.icon.name];T&&(v=eD(e.imagePositions[d.icon.name],r.get("icon-offset").evaluate(d,{},e.canonical),r.get("icon-anchor").evaluate(d,{},e.canonical)),w=!!T.sdf,e.bucket.sdfIcons===void 0?e.bucket.sdfIcons=w:e.bucket.sdfIcons!==w&&ge("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),T.pixelRatio===e.bucket.pixelRatio?r.get("icon-rotate").constantOr(1)!==0&&(e.bucket.iconsNeedLinear=true):e.bucket.iconsNeedLinear=true)}let b=H0(_.horizontal)||_.vertical;(c=e.bucket).iconsInText||(c.iconsInText=b?b.iconsInText:false),(b||v)&&fD(e.bucket,d,_,v,e.imageMap,s,m,g,x,w,e.canonical,e.subdivisionGranularity,e.hasPromoteId)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()}function Cc(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function fD(e,t4,i,r,a,s,n,o,l,u,h,c,d){let p=s.textMaxSize.evaluate(t4,{});p===void 0&&(p=n);let f=e.layers[0].layout,m=f.get("icon-offset").evaluate(t4,{},h),g=H0(i.horizontal),_=n/24,y=e.tilePixelRatio*_,x=e.tilePixelRatio*p/24,v=e.tilePixelRatio*o,w=e.tilePixelRatio*f.get("symbol-spacing"),b=f.get("text-padding")*e.tilePixelRatio,T=CD(f,t4,h,e.tilePixelRatio),P=f.get("text-max-angle")/180*Math.PI,E=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",I=f.get("icon-rotation-alignment").constantOr("viewport")==="map"&&f.get("symbol-placement")!=="point",R=f.get("symbol-placement"),z=w/2,S=f.get("icon-text-fit"),A;r&&S!=="none"&&(e.allowVerticalPlacement&&i.vertical&&(A=lm(r,i.vertical,S,f.get("icon-text-fit-padding"),m,_)),g&&(r=lm(r,g,S,f.get("icon-text-fit-padding"),m,_)));let D=h?c.line.getGranularityForZoomLevel(h.z):1,M=(L,O)=>{O.x<0||O.x>=8192||O.y<0||O.y>=8192||gD(e,O,L,i,r,a,A,e.layers[0],e.collisionBoxArray,t4.index,t4.sourceLayerIndex,e.index,y,[b,b,b,b],E,l,v,T,I,m,t4,s,u,h,n,d)};if(R==="line")for(let L of Z0(t4.geometry,0,0,k,k)){let O=Nr(L,D),N=nD(O,w,P,i.vertical||g,r,24,x,e.overscaling,k);for(let J of N){let fe=g;(!fe||!_D(e,fe.text,z,J))&&M(O,J)}}else if(R==="line-center"){for(let L of t4.geometry)if(L.length>1){let O=Nr(L,D),N=sD(O,P,i.vertical||g,r,24,x);N&&M(O,N)}}else if(t4.type==="Polygon")for(let L of zl(t4.geometry,0)){let O=uD(L,16);M(Nr(L[0],D,true),new Oa(O.x,O.y,0))}else if(t4.type==="LineString")for(let L of t4.geometry){let O=Nr(L,D);M(O,new Oa(O[0].x,O[0].y,0))}else if(t4.type==="Point")for(let L of t4.geometry)for(let O of L)M([O],new Oa(O.x,O.y,0))}function mD(e,t4){let i=e.length,r=t4==null?void 0:t4.values;if((r==null?void 0:r.length)>0)for(let a=0;a<r.length;a+=2){let s=Dc[r[a]],n=r[a+1];e.emplaceBack(s,n[0],n[1])}return[i,e.length]}function pm(e,t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m){let g=oD(t4,i,o,a,s,n,r,e.allowVerticalPlacement),_=e.textSizeData,y=null;_.kind==="source"?(y=[128*a.layout.get("text-size").evaluate(n,{})],y[0]>32640&&ge(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):_.kind==="composite"&&(y=[128*f.compositeTextSizes[0].evaluate(n,{},m),128*f.compositeTextSizes[1].evaluate(n,{},m)],(y[0]>32640||y[1]>32640)&&ge(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,y,o,s,n,h,t4,u.lineStartIndex,u.lineLength,p,m,l);for(let x of c)d[x]=e.text.placedSymbolArray.length-1;return g.length*4}function H0(e){for(let t4 in e)return e[t4];return null}function gD(e,t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m,g,_,y,x,v,w,b,T,P,E){let I=e.addToLineVertexArray(t4,i),R=o.layout.get("symbol-height-offset").evaluate(v,{},T);R>e.maxHeightOffset&&(e.maxHeightOffset=R);let z,S,A,D,M=0,L=0,O=0,N=0,J=-1,fe=-1,xe={},le=(0,al.default)("");if(e.allowVerticalPlacement&&r.vertical){let re=o.layout.get("text-rotate").evaluate(v,{},T)+90,$=r.vertical;A=new co(l,t4,u,h,c,$,d,p,f,re),n&&(D=new co(l,t4,u,h,c,n,g,_,f,re))}if(a){let re=o.layout.get("icon-rotate").evaluate(v,{}),$=o.layout.get("icon-text-fit")!=="none",ve=cm(a,re,b,$),ee=n?cm(n,re,b,$):void 0;S=new co(l,t4,u,h,c,a,g,_,false,re),M=ve.length*4;let ae=e.iconSizeData,Z=null;ae.kind==="source"?(Z=[128*o.layout.get("icon-size").evaluate(v,{})],Z[0]>32640&&ge(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):ae.kind==="composite"&&(Z=[128*w.compositeIconSizes[0].evaluate(v,{},T),128*w.compositeIconSizes[1].evaluate(v,{},T)],(Z[0]>32640||Z[1]>32640)&&ge(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,ve,Z,x,y,v,0,t4,I.lineStartIndex,I.lineLength,-1,T,R),J=e.icon.placedSymbolArray.length-1,ee&&(L=ee.length*4,e.addSymbols(e.icon,ee,Z,x,y,v,2,t4,I.lineStartIndex,I.lineLength,-1,T,R),fe=e.icon.placedSymbolArray.length-1)}let $e=Object.keys(r.horizontal);for(let re of $e){let $=r.horizontal[re];z||(z=(le=(0,al.default)($.text),new co(l,t4,u,h,c,$,d,p,f,o.layout.get("text-rotate").evaluate(v,{},T))));let ve=$.positionedLines.length===1;if(O+=pm(e,t4,$,s,o,f,v,m,R,I,r.vertical?1:3,ve?$e:[re],xe,J,w,T),ve)break}r.vertical&&(N+=pm(e,t4,r.vertical,s,o,f,v,m,R,I,2,["vertical"],xe,fe,w,T));let Pe=z?z.boxStartIndex:e.collisionBoxArray.length,Ve=z?z.boxEndIndex:e.collisionBoxArray.length,ke=A?A.boxStartIndex:e.collisionBoxArray.length,ft=A?A.boxEndIndex:e.collisionBoxArray.length,Rt=S?S.boxStartIndex:e.collisionBoxArray.length,Ut=S?S.boxEndIndex:e.collisionBoxArray.length,Nt=D?D.boxStartIndex:e.collisionBoxArray.length,Tt=D?D.boxEndIndex:e.collisionBoxArray.length,st=-1,Yt=(re,$)=>re!=null&&re.circleDiameter?Math.max(re.circleDiameter,$):$;st=Yt(z,st),st=Yt(A,st),st=Yt(S,st),st=Yt(D,st);let wi=+(st>-1);wi&&(st*=P/24),e.glyphOffsetArray.length>=e.maxGlyphs&&ge("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&e.addToSortKeyRanges(e.symbolInstances.length,v.sortKey);let ni=W0(o,v,T),[q,ye]=mD(e.textAnchorOffsets,ni);E&&(le=yD(le,v)),e.symbolInstances.emplaceBack(t4.x,t4.y,xe.right>=0?xe.right:-1,xe.center>=0?xe.center:-1,xe.left>=0?xe.left:-1,xe.vertical||-1,J,fe,le,Pe,Ve,ke,ft,Rt,Ut,Nt,Tt,u,O,N,M,L,wi,0,d,st,q,ye,R)}function _D(e,t4,i,r){let a=e.compareText;if(!(t4 in a))a[t4]=[];else{let s=a[t4];for(let n=s.length-1;n>=0;n--)if(r.dist(s[n])<i)return true}return a[t4].push(r),false}function yD(e,t4){var i;return t4.id==null||(i=t4.properties)!=null&&i.cluster?e:(0,al.default)(String(t4.id),e)}function dl(e,t4,i){let r="never",a=e.get(t4);return a?r=a:e.get(i)&&(r="always"),r}const vD=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function po(e,t4,i,r,a,s,n,o,l,u,h,c,d,p){let f=o?Math.min(um,Math.round(o[0])):0,m=o?Math.min(um,Math.round(o[1])):0;e.emplaceBack(t4,i,Math.round(r*32),Math.round(a*32),s,n,(f<<1)+ +!!l,m,u*16,h*16,c*256,d*256,p)}function pl(e,t4,i){e.emplaceBack(t4.x,t4.y,i),e.emplaceBack(t4.x,t4.y,i),e.emplaceBack(t4.x,t4.y,i),e.emplaceBack(t4.x,t4.y,i)}function xD(e){for(let t4 of e.sections)if(A0(t4.text))return true;return false}var Pc=class{constructor(e){this.layoutVertexArray=new c2,this.indexArray=new Qi,this.programConfigurations=e,this.segments=new We,this.dynamicLayoutVertexArray=new d2,this.opacityVertexArray=new p2,this.hasVisibleVertices=false,this.placedSymbolArray=new By}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t4,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ME.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t4),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,FE.members,true),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,vD,true),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};G("SymbolBuffers",Pc);var Ac=class{constructor(e,t4,i){this.layoutVertexArray=new e,this.layoutAttributes=t4,this.indexArray=new i,this.segments=new We,this.collisionVertexArray=new m2}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,zE.members,true)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};G("CollisionBuffers",Ac);var fl=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(n=>n.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=true,this.hasRTLText=false,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let t4=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hm(this.zoom,t4["text-size"]),this.iconSizeData=hm(this.zoom,t4["icon-size"]);let i=this.layers[0].layout,r=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=dl(i,"text-overlap","text-allow-overlap")!=="never"||dl(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!r.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(n=>R0[n])),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id),this.sourceID=e.sourceID}createArrays(){this.text=new Pc(new ta(this.layers,this.zoom,e=>e.startsWith("text"))),this.icon=new Pc(new ta(this.layers,this.zoom,e=>e.startsWith("icon"))),this.glyphOffsetArray=new Vy,this.lineVertexArray=new jy,this.symbolInstances=new $y,this.textAnchorOffsets=new Ny}calculateGlyphDependencies(e,t4,i,r,a){var l;let s=(r||this.allowVerticalPlacement)&&a,n=Id.fromFeature(e,i),o=n.graphemes();for(let u=0;u<o.length;u++){let h=n.getSection(u);if("imageName"in h)continue;let c=t4[l=h.fontStack]||(t4[l]={}),d=o[u];hl(d)&&(c[d]=true);for(let p of d){if(c[p]=true,!s)continue;let f=za[p];f&&(c[f]=true)}}}populate(e,t4,i){var m;let r=this.layers[0],a=r.layout,s=a.get("text-font"),n=a.get("text-field"),o=a.get("icon-image"),l=(n.value.kind!=="constant"||n.value.value instanceof dr&&!n.value.value.isEmpty()||n.value.value.toString().length>0)&&(s.value.kind!=="constant"||s.value.value.length>0),u=o.value.kind!=="constant"||!!o.value.value||Object.keys(o.parameters).length>0,h=a.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=t4.iconDependencies,d=t4.glyphDependencies,p=t4.availableImages,f=new Fe(this.zoom);for(let{feature:g,id:_,index:y,sourceLayerIndex:x}of e){let v=r._featureFilter.needGeometry,w=oa(g,v);if(!r._featureFilter.filter(f,w,i))continue;v||(w.geometry=na(g));let b;if(l){let I=r.getValueAndResolveTokens("text-field",w,i,p),R=dr.factory(I);this.hasRTLText||(this.hasRTLText=xD(R)),b=aS(R,r,w)}let T;if(u){let I=r.getValueAndResolveTokens("icon-image",w,i,p);T=I instanceof Xi?I:Xi.fromString(I)}if(!b&&!T)continue;let P=this.sortFeaturesByKey?h.evaluate(w,{},i):void 0,E={id:_,text:b,icon:T,index:y,sourceLayerIndex:x,geometry:w.geometry,properties:g.properties,type:En.types[g.type],sortKey:P};if(this.features.push(E),T&&(c[T.name]=true),b){let I=s.evaluate(w,{},i).join(","),R=a.get("text-rotation-alignment")!=="viewport"&&a.get("symbol-placement")!=="point";this.allowVerticalPlacement=(m=this.writingModes)==null?void 0:m.includes(2);let z=Tc(b.toString());this.calculateGlyphDependencies(b,d,I,R,z);for(let S of b.sections)S.image&&(c[S.image.name]=true)}}a.get("symbol-placement")==="line"&&(this.features=nS(this.features)),this.sortFeaturesByKey&&this.features.sort((g,_)=>g.sortKey-_.sortKey)}update(e,t4,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t4,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(e,t4,this.layers,{imagePositions:i}))}addFeatures({options:e,canonical:t4,glyphMap:i,glyphPositions:r,iconMap:a,iconPositions:s,showCollisionBoxes:n}){pD({bucket:this,glyphMap:i,glyphPositions:r,imageMap:a,imagePositions:s,showCollisionBoxes:n,canonical:t4,subdivisionGranularity:e.subdivisionGranularity,hasPromoteId:e.featureIndex.promoteId!=null})}isEmpty(){return this.symbolInstances.length===0}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=true}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t4){let i=this.lineVertexArray.length;if(e.segment!==void 0){let r=e.dist(t4[e.segment+1]),a=e.dist(t4[e.segment]),s={};for(let n=e.segment+1;n<t4.length;n++)s[n]={x:t4[n].x,y:t4[n].y,tileUnitDistanceFromAnchor:r},n<t4.length-1&&(r+=t4[n+1].dist(t4[n]));for(let n=e.segment||0;n>=0;n--)s[n]={x:t4[n].x,y:t4[n].y,tileUnitDistanceFromAnchor:a},n>0&&(a+=t4[n-1].dist(t4[n]));for(let n=0;n<t4.length;n++){let o=s[n];this.lineVertexArray.emplaceBack(o.x,o.y,o.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t4,i,r,a,s,n,o,l,u,h,c,d){let p=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*t4.length,f,p,this.canOverlap?s.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&n===2?Math.PI/2:0,x=s.text&&s.text.sections;for(let v=0;v<t4.length;v++){let{tl:w,tr:b,bl:T,br:P,tex:E,pixelOffsetTL:I,pixelOffsetBR:R,minFontScaleX:z,minFontScaleY:S,glyphOffset:A,isSDF:D,sectionIndex:M}=t4[v],L=m.vertexLength,O=A[1];po(f,o.x,o.y,w.x,O+w.y,E.x,E.y,i,D,I.x,I.y,z,S,d),po(f,o.x,o.y,b.x,O+b.y,E.x+E.w,E.y,i,D,R.x,I.y,z,S,d),po(f,o.x,o.y,T.x,O+T.y,E.x,E.y+E.h,i,D,I.x,R.y,z,S,d),po(f,o.x,o.y,P.x,O+P.y,E.x+E.w,E.y+E.h,i,D,R.x,R.y,z,S,d),pl(e.dynamicLayoutVertexArray,o,y),p.emplaceBack(L,L+2,L+1),p.emplaceBack(L+1,L+2,L+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),(v===t4.length-1||M!==t4[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(f.length,s,s.index,{imagePositions:{},canonical:c,formattedSection:x==null?void 0:x[M]})}e.placedSymbolArray.emplaceBack(o.x,o.y,g,this.glyphOffsetArray.length-g,_,l,u,o.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],n,0,false,0,h,d)}_addCollisionDebugVertex(e,t4,i,r,a,s){return t4.emplaceBack(0,0),e.emplaceBack(i.x,i.y,r,a,Math.round(s.x),Math.round(s.y))}addCollisionDebugVertices(e,t4,i,r,a,s,n){let o=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=o.vertexLength,u=a.layoutVertexArray,h=a.collisionVertexArray,c=n.anchorX,d=n.anchorY;this._addCollisionDebugVertex(u,h,s,c,d,new C(e,t4)),this._addCollisionDebugVertex(u,h,s,c,d,new C(i,t4)),this._addCollisionDebugVertex(u,h,s,c,d,new C(i,r)),this._addCollisionDebugVertex(u,h,s,c,d,new C(e,r)),o.vertexLength+=4;let p=a.indexArray;p.emplaceBack(l,l+1),p.emplaceBack(l+1,l+2),p.emplaceBack(l+2,l+3),p.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(e,t4,i,r){for(let a=e;a<t4;a++){let s=this.collisionBoxArray.get(a),n=s.x1,o=s.y1,l=s.x2,u=s.y2;this.addCollisionDebugVertices(n,o,l,u,r?this.textCollisionBox:this.iconCollisionBox,s.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ac(Af,qf.members,nc),this.iconCollisionBox=new Ac(Af,qf.members,nc);for(let e=0;e<this.symbolInstances.length;e++){let t4=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t4.textBoxStartIndex,t4.textBoxEndIndex,t4,true),this.addDebugCollisionBoxes(t4.verticalTextBoxStartIndex,t4.verticalTextBoxEndIndex,t4,true),this.addDebugCollisionBoxes(t4.iconBoxStartIndex,t4.iconBoxEndIndex,t4,false),this.addDebugCollisionBoxes(t4.verticalIconBoxStartIndex,t4.verticalIconBoxEndIndex,t4,false)}}_deserializeCollisionBoxesForSymbol(e,t4,i,r,a,s,n,o,l){let u={};for(let h=t4;h<i;h++){let c=e.get(h);u.textBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.textFeatureIndex=c.featureIndex;break}for(let h=r;h<a;h++){let c=e.get(h);u.verticalTextBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalTextFeatureIndex=c.featureIndex;break}for(let h=s;h<n;h++){let c=e.get(h);u.iconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.iconFeatureIndex=c.featureIndex;break}for(let h=o;h<l;h++){let c=e.get(h);u.verticalIconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalIconFeatureIndex=c.featureIndex;break}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t4=0;t4<this.symbolInstances.length;t4++){let i=this.symbolInstances.get(t4);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t4){let i=e.placedSymbolArray.get(t4),r=i.vertexStartIndex+i.numGlyphs*4;for(let a=i.vertexStartIndex;a<r;a+=4)e.indexArray.emplaceBack(a,a+2,a+1),e.indexArray.emplaceBack(a+1,a+2,a+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t4=Math.sin(e),i=Math.cos(e),r=[],a=[],s=[];for(let n=0;n<this.symbolInstances.length;++n){s.push(n);let o=this.symbolInstances.get(n);r.push(Math.round(t4*o.anchorX+i*o.anchorY)|0),a.push(o.featureIndex)}return s.sort((n,o)=>r[n]-r[o]||a[o]-a[n]),s}addToSortKeyRanges(e,t4){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];(i==null?void 0:i.sortKey)===t4?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t4,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let t4 of this.symbolInstanceIndexes){let i=this.symbolInstances.get(t4);this.featureSortOrder.push(i.featureIndex);let r=[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex];for(let a=0;a<r.length;a++){let s=r[a];s>=0&&r.indexOf(s)===a&&this.addIndicesForPlacedSymbol(this.text,s)}i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};G("SymbolBucket",fl,{omit:["layers","collisionBoxArray","features","compareText"]});function bD(e,t4){return t4.replace(/{([^{}]+)}/g,(i,r)=>e&&r in e?String(e[r]):"")}let wD;const TD=()=>wD||(wD=new wt({"symbol-placement":new j(F.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new j(F.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new j(F.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new K(F.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new j(F.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new j(F.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new j(F.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new j(F.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new j(F.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new K(F.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new K(F.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new j(F.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new j(F.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new K(F.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new K(F.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new K(F.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new j(F.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new K(F.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new K(F.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new j(F.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new j(F.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new j(F.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new K(F.layout_symbol["text-field"],"text-field"),"text-font":new K(F.layout_symbol["text-font"],"text-font"),"text-size":new K(F.layout_symbol["text-size"],"text-size"),"text-max-width":new K(F.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new j(F.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new K(F.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new K(F.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new K(F.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new j(F.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new K(F.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new K(F.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new j(F.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new j(F.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new K(F.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new j(F.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new j(F.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new K(F.layout_symbol["text-transform"],"text-transform"),"text-offset":new K(F.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new j(F.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new j(F.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new j(F.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new j(F.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new K(F.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new j(F.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")}));let ED;const SD=()=>ED||(ED=new wt({"icon-opacity":new K(F.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new K(F.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new K(F.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new K(F.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new K(F.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new j(F.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new j(F.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new K(F.paint_symbol["text-opacity"],"text-opacity"),"text-color":new K(F.paint_symbol["text-color"],"text-color",{runtimeType:Pi,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new K(F.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new K(F.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new K(F.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new j(F.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new j(F.paint_symbol["text-translate-anchor"],"text-translate-anchor")}));var Wu={get paint(){return SD()},get layout(){return TD()}},X0=class{constructor(e){if(e.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:gn,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t4=this.defaultValue.property.overrides;if(t4!=null&&t4.hasOverride(e.formattedSection))return t4.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let t4=this.defaultValue.value;e(t4._styleExpression.expression)}}outputDefined(){return false}serialize(){return null}};G("FormatSectionOverride",X0,{omit:["defaultValue"]});const Y0=e=>e.type==="symbol";var DD=class Ic extends zi{constructor(t4,i){super(t4,Wu,i)}recalculate(t4,i){super.recalculate(t4,i);let r=this.layout.get("icon-rotation-alignment");if((r.value.kind!=="constant"||r.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new gi(r.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},r.parameters)),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")==="point"?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),this.layout.get("symbol-placement")==="point"){let a=this.layout.get("text-writing-mode");if(a){let s=[];for(let n of a)s.includes(n)||s.push(n);this.layout._values["text-writing-mode"]=s}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t4,i,r,a){let s=this.layout.get(t4).evaluate(i,{},r,a),n=this._unevaluatedLayout._values[t4];return!n.isDataDriven()&&!Ol(n.value)&&s?bD(i.properties,s):s}createBucket(t4){return new fl(t4)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t4 of Wu.paint.overridableProperties){if(!Ic.hasPaintOverride(this.layout,t4))continue;let i=this.paint.get(t4),r=new fd(new X0(i),`layers[${this.id}].paint.${i.property.name}`,i.property.specification),a=null;a=i.value.kind==="constant"||i.value.kind==="source"?new Js("source",r):new Jo("composite",r,i.value.zoomStops),this.paint._values[t4]=new gi(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(t4,i,r){return!this.layout||i.isDataDriven()||r.isDataDriven()?false:Ic.hasPaintOverride(this.layout,t4)}static hasPaintOverride(t4,i){let r=t4.get("text-field"),a=Wu.paint.properties[i],s=false,n=o=>{var l;for(let u of o)if((l=a.overrides)!=null&&l.hasOverride(u)){s=true;return}};if(r.value.kind==="constant"&&r.value.value instanceof dr)n(r.value.value.sections);else if(r.value.kind==="source"||r.value.kind==="composite"){let o=u=>{if(!s)if(u instanceof Wa&&at(u.value)===_n){let h=u.value;n(h.sections)}else u instanceof T_?n(u.sections):u.eachChild(o)},l=r.value;l._styleExpression&&o(l._styleExpression.expression)}return s}};function CD(e,t4,i,r=1){var s;let a=(s=e.get("icon-padding").evaluate(t4,{},i))==null?void 0:s.values;return[a[0]*r,a[1]*r,a[2]*r,a[3]*r]}let PD;const AD=()=>PD||(PD=new wt({"background-color":new j(F.paint_background["background-color"],"background-color"),"background-pattern":new zy(F.paint_background["background-pattern"],"background-pattern"),"background-opacity":new j(F.paint_background["background-opacity"],"background-opacity")}));var ID={get paint(){return AD()}};const MD=e=>e.type==="background";var FD=class extends zi{constructor(e,t4){super(e,ID,t4)}};function zD(e){let t4=[],i=e.id;return i===void 0&&t4.push(new B(`layers.${i}`,null,'missing required property "id"')),e.render===void 0&&t4.push(new B(`layers.${i}`,null,'missing required method "render"')),e.renderingMode&&e.renderingMode!=="2d"&&e.renderingMode!=="3d"&&t4.push(new B(`layers.${i}`,null,'property "renderingMode" must be either "2d" or "3d"')),t4}const RD=e=>e.type==="custom";var kD=class extends zi{constructor(e,t4){super(e,{},t4),this.onAdd=i=>{this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)},this.onRemove=i=>{this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return false}serialize(){throw Error("Custom layers cannot be serialized")}};function Hu(e,t4){if(e.type==="custom")return new kD(e,t4);switch(e.type){case"background":return new FD(e,t4);case"circle":return new q2(e,t4);case"color-relief":return new lT(e,t4);case"fill":return new NT(e,t4);case"fill-extrusion":return new pE(e,t4);case"heatmap":return new K2(e,t4);case"hillshade":return new iT(e,t4);case"line":return new IE(e,t4);case"raster":return new t2(e,t4);case"symbol":return new DD(e,t4)}}var LD=class{constructor(e){this._methodToThrottle=e,this._triggered=false,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=false,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=true,(e=this._channel)==null||e.port1.postMessage(true))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};const BD={once:true};var OD=class{constructor(e,t4){this.target=e,this.mapId=t4,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new LD(()=>this.process()),this.subscription=qo(this.target,"message",i=>this.receive(i),false),this.globalScope=Ga(self)?e:window}registerMessageHandler(e,t4){this.messageHandlers[e]=t4}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t4){return new Promise((i,r)=>{let a=Math.round(Math.random()*1e18).toString(36).substring(0,10),s=t4?qo(t4.signal,"abort",()=>{s==null||s.unsubscribe(),delete this.resolveRejects[a];let l={id:a,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),r(new mn(t4.signal.reason))},BD):null;this.resolveRejects[a]={resolve:l=>{s==null||s.unsubscribe(),i(l)},reject:l=>{s==null||s.unsubscribe(),r(l)}};let n=[],o={...e,id:a,sourceMapId:this.mapId,origin:location.origin,data:Vs(e.data,n)};this.target.postMessage(o,{transfer:n})})}receive(e){let t4=e.data,i=t4.id,r=["file://","resource://android","null"],a=[t4.origin,location.origin],s=t4.origin===location.origin,n=a.some(o=>r.includes(o));if((s||n)&&!(t4.targetMapId&&this.mapId!==t4.targetMapId)){if(t4.type==="<cancel>"){delete this.tasks[i];let o=this.abortControllers[i];delete this.abortControllers[i],o&&o.abort();return}if(Ga(self)||t4.mustQueue){this.tasks[i]=t4,this.taskQueue.push(i),this.invoker.trigger();return}this.processTask(i,t4)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t4=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t4&&this.processTask(e,t4)}async processTask(e,t4){if(t4.type==="<response>"){let a=this.resolveRejects[e];if(delete this.resolveRejects[e],!a)return;t4.error?a.reject(Ft(js(t4.error))):a.resolve(js(t4.data));return}if(!this.messageHandlers[t4.type]){this.completeTask(e,null,null);return}let i=js(t4.data),r=new AbortController;this.abortControllers[e]=r;try{let a=await this.messageHandlers[t4.type](t4.sourceMapId,i,r);this.completeTask(e,null,a)}catch(a){this.completeTask(e,Ft(a))}}completeTask(e,t4,i){let r=[];delete this.abortControllers[e];let a={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t4?Vs(t4):null,data:Vs(i,r)};this.target.postMessage(a,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function $D(e,t4,i){return!(e<0||e>25||i<0||i>=2**e||t4<0||t4>=2**e)}function fm(e,t4){let{x:i,y:r}=Ie.fromLngLat(t4);return!(e<0||e>25||r<0||r>=1||i<0||i>=1)}var Yl=class{constructor(e,t4,i){if(!$D(e,t4,i))throw Error(`x=${t4}, y=${i}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t4,this.y=i,this.key=$a(0,e,e,t4,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t4,i){let r=VD(this.x,this.y,this.z),a=jD(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t4>1?"@2x":"").replace(/{quadkey}/g,a).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){let t4=this.z-e.z;return t4>0&&e.x===this.x>>t4&&e.y===this.y>>t4}getTilePoint(e){let t4=2**this.z;return new C((e.x*t4-this.x)*k,(e.y*t4-this.y)*k)}toString(){return`${this.z}/${this.x}/${this.y}`}},ml=class{constructor(e,t4){this.wrap=e,this.canonical=t4,this.key=$a(e,t4.z,t4.z,t4.x,t4.y)}},St=class di{constructor(t4,i,r,a,s){if(this.terrainRttPosMatrix32f=null,t4<r)throw Error(`overscaledZ should be >= z; overscaledZ = ${t4}; z = ${r}`);this.overscaledZ=t4,this.wrap=i,this.canonical=new Yl(r,+a,+s),this.key=$a(i,t4,r,a,s)}clone(){return new di(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t4){return this.overscaledZ===t4.overscaledZ&&this.wrap===t4.wrap&&this.canonical.equals(t4.canonical)}scaledTo(t4){if(t4>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t4}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t4;return t4>this.canonical.z?new di(t4,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new di(t4,this.wrap,t4,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t4,i){if(t4>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t4}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t4;return t4>this.canonical.z?$a(this.wrap*+i,t4,this.canonical.z,this.canonical.x,this.canonical.y):$a(this.wrap*+i,t4,t4,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t4){if(t4.wrap!==this.wrap||this.overscaledZ-t4.overscaledZ<=0)return false;if(t4.overscaledZ===0)return this.overscaledZ>0;let i=this.canonical.z-t4.canonical.z;return i<0?false:t4.canonical.x===this.canonical.x>>i&&t4.canonical.y===this.canonical.y>>i}children(t4){if(this.overscaledZ>=t4)return[new di(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=this.canonical.x*2,a=this.canonical.y*2;return[new di(i,this.wrap,i,r,a),new di(i,this.wrap,i,r+1,a),new di(i,this.wrap,i,r,a+1),new di(i,this.wrap,i,r+1,a+1)]}isLessThan(t4){return this.wrap<t4.wrap?true:this.wrap>t4.wrap?false:this.overscaledZ<t4.overscaledZ?true:this.overscaledZ>t4.overscaledZ?false:this.canonical.x<t4.canonical.x?true:this.canonical.x>t4.canonical.x?false:this.canonical.y<t4.canonical.y}wrapped(){return new di(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t4){return new di(this.overscaledZ,t4,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new ml(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t4){return this.canonical.getTilePoint(new Ie(t4.x-this.wrap,t4.y))}normalizeCoordinates(t4,i,r=k){if(t4>=0&&t4<r&&i>=0&&i<r)return{tileID:this,x:t4,y:i};let a=Math.floor(t4/r),s=Math.floor(i/r),n=t4-a*r,o=i-s*r,l=this.canonical.z,u=1<<l,h=this.canonical.y+s;if(h<0||h>=u)return null;let c=this.canonical.x+a,d=this.wrap;return c<0?(d-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(d+=Math.floor(c/u),c%=u),{tileID:new di(this.overscaledZ,d,l,c,h),x:n,y:o}}};function $a(e,t4,i,r,a){e*=2,e<0&&(e=e*-1-1);let s=1<<i;return(s*s*e+s*a+r).toString(36)+i.toString(36)+t4.toString(36)}const Xu=Math.PI*6378137;function VD(e,t4,i){t4=2**i-t4-1;let r=mm(e*256,t4*256,i),a=mm((e+1)*256,(t4+1)*256,i);return`${r[0]},${r[1]},${a[0]},${a[1]}`}function mm(e,t4,i){let r=2*Xu/256/2**i;return[e*r-Xu,t4*r-Xu]}function jD(e,t4,i){let r="";for(let a=e;a>0;a--){let s=1<<a-1;r+=(t4&s?1:0)+(i&s?2:0)}return r}function gm(e,t4){let i=Math.abs(e.wrap*2)-+(e.wrap<0),r=Math.abs(t4.wrap*2)-+(t4.wrap<0);return e.overscaledZ-t4.overscaledZ||r-i||t4.canonical.y-e.canonical.y||t4.canonical.x-e.canonical.x}G("CanonicalTileID",Yl),G("OverscaledTileID",St,{omit:["terrainRttPosMatrix32f"]});const Bo="_geojsonTileLayer";var UD=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t4=0;t4<e.length;t4++){let i=e[t4];this._stringToNumber[i]=t4,this._numberToString[t4]=i}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}},K0=class{constructor(e,t4,i,r,a){this.type="Feature",this._vectorTileFeature=e,this._x=i,this._y=r,this._z=t4;for(let s in e.properties)typeof e.properties[s]=="string"&&e.properties[s].startsWith("__$json__:")&&(e.properties[s]=JSON.parse(e.properties[s].slice(10)));this.properties=e.properties,this.id=a}projectPoint(e,t4,i,r){return[(e.x+t4)*360/r-180,360/Math.PI*Math.atan(Math.exp((1-(e.y+i)*2/r)*Math.PI))-90]}projectLine(e,t4,i,r){return e.map(a=>this.projectPoint(a,t4,i,r))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t4=e.extent*2**this._z,i=e.extent*this._x,r=e.extent*this._y,a=e.loadGeometry();switch(e.type){case 1:{let s=[];for(let o of a)s.push(o[0]);let n=this.projectLine(s,i,r,t4);this._geometry=s.length===1?{type:"Point",coordinates:n[0]}:{type:"MultiPoint",coordinates:n};break}case 2:{let s=a.map(n=>this.projectLine(n,i,r,t4));this._geometry=s.length===1?{type:"LineString",coordinates:s[0]}:{type:"MultiLineString",coordinates:s};break}case 3:{let s=m0(a),n=[];for(let o of s)n.push(o.map(l=>this.projectLine(l,i,r,t4)));this._geometry=n.length===1?{type:"Polygon",coordinates:n[0]}:{type:"MultiPolygon",coordinates:n};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t4 in this)t4!=="_geometry"&&t4!=="_vectorTileFeature"&&t4!=="_x"&&t4!=="_y"&&t4!=="_z"&&(e[t4]=this[t4]);return e}},la=class{constructor(e,t4,i){this._name=e,this.dataBuffer=t4,typeof i=="number"?this._size=i:(this.nullabilityBuffer=i,this._size=i.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){var t4;return((t4=this.nullabilityBuffer)==null?void 0:t4.get(e))||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},Kl=class extends la{},kd=class extends Kl{getValueFromBuffer(e){return this.dataBuffer[e]}},Ld=class extends Kl{getValueFromBuffer(e){return this.dataBuffer[e]}},J0=class extends la{constructor(e,t4,i,r){super(e,t4,r),this.delta=i}},Bd=class extends J0{constructor(e,t4,i,r,a){super(e,a?Int32Array.of(t4):Uint32Array.of(t4),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}},Od=class extends la{constructor(e,t4,i,r){super(e,r?Int32Array.of(t4):Uint32Array.of(t4),i)}getValueFromBuffer(e){return this.dataBuffer[0]}},ND=class{constructor(e,t4,i,r,a=4096){if(this._name=e,this._geometryVector=t4,this._idVector=i,this._propertyVectors=r,this._extent=a,e.length===0)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this.propertyVectors.map(t4=>[t4.name,t4]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t4=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let r;if(this.idVector){let n=this.idVector.getValue(i);n!==null&&(r=this.containsMaxSafeIntegerValues(this.idVector)?Number(n):n)}let a={coordinates:t4[i],type:this.geometryVector.geometryType(i)},s={};for(let n of this.propertyVectors){if(!n)continue;let o=n.name,l=n.getValue(i);l!==null&&(s[o]=l)}e.push({id:r,geometry:a,properties:s})}return e}containsMaxSafeIntegerValues(e){return e instanceof kd||e instanceof Od||e instanceof Bd||e instanceof Ld}};const Bs={FEATURE:0},Ee={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},Sr={GEOMETRY:0,STRUCT:1,MAP:2},Q0={ID:0};var e1=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}},ce;(function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON"})(ce||(ce={}));var vi;(function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT"})(vi||(vi={}));const $d=new Uint32Array(33);$d[0]=0;for(let e=1;e<=32;e++)$d[e]=e===32?4294967295:4294967295>>>32-e;const Mc=$d,t1=65536;function Vd(e,t4){return e-e%t4}function GD(e){return Vd(e+31,32)}function ZD(e){if(!Number.isFinite(e)||e<=0)return t1;let t4=Vd(Math.floor(e),256);return t4===0?256:t4}function qD(e){let t4=e>>>0;return((t4&255)<<24|(t4&65280)<<8|t4>>>8&65280|t4>>>24&255)>>>0}function WD(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0;i[a++]=s>>>0&3,i[a++]=s>>>2&3,i[a++]=s>>>4&3,i[a++]=s>>>6&3,i[a++]=s>>>8&3,i[a++]=s>>>10&3,i[a++]=s>>>12&3,i[a++]=s>>>14&3,i[a++]=s>>>16&3,i[a++]=s>>>18&3,i[a++]=s>>>20&3,i[a++]=s>>>22&3,i[a++]=s>>>24&3,i[a++]=s>>>26&3,i[a++]=s>>>28&3,i[a++]=s>>>30&3,i[a++]=n>>>0&3,i[a++]=n>>>2&3,i[a++]=n>>>4&3,i[a++]=n>>>6&3,i[a++]=n>>>8&3,i[a++]=n>>>10&3,i[a++]=n>>>12&3,i[a++]=n>>>14&3,i[a++]=n>>>16&3,i[a++]=n>>>18&3,i[a++]=n>>>20&3,i[a++]=n>>>22&3,i[a++]=n>>>24&3,i[a++]=n>>>26&3,i[a++]=n>>>28&3,i[a]=n>>>30&3}function HD(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0;i[a++]=s>>>0&7,i[a++]=s>>>3&7,i[a++]=s>>>6&7,i[a++]=s>>>9&7,i[a++]=s>>>12&7,i[a++]=s>>>15&7,i[a++]=s>>>18&7,i[a++]=s>>>21&7,i[a++]=s>>>24&7,i[a++]=s>>>27&7,i[a++]=(s>>>30|(n&1)<<2)&7,i[a++]=n>>>1&7,i[a++]=n>>>4&7,i[a++]=n>>>7&7,i[a++]=n>>>10&7,i[a++]=n>>>13&7,i[a++]=n>>>16&7,i[a++]=n>>>19&7,i[a++]=n>>>22&7,i[a++]=n>>>25&7,i[a++]=n>>>28&7,i[a++]=(n>>>31|(o&3)<<1)&7,i[a++]=o>>>2&7,i[a++]=o>>>5&7,i[a++]=o>>>8&7,i[a++]=o>>>11&7,i[a++]=o>>>14&7,i[a++]=o>>>17&7,i[a++]=o>>>20&7,i[a++]=o>>>23&7,i[a++]=o>>>26&7,i[a]=o>>>29&7}function XD(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0,l=e[t4+3]>>>0;i[a++]=s>>>0&15,i[a++]=s>>>4&15,i[a++]=s>>>8&15,i[a++]=s>>>12&15,i[a++]=s>>>16&15,i[a++]=s>>>20&15,i[a++]=s>>>24&15,i[a++]=s>>>28&15,i[a++]=n>>>0&15,i[a++]=n>>>4&15,i[a++]=n>>>8&15,i[a++]=n>>>12&15,i[a++]=n>>>16&15,i[a++]=n>>>20&15,i[a++]=n>>>24&15,i[a++]=n>>>28&15,i[a++]=o>>>0&15,i[a++]=o>>>4&15,i[a++]=o>>>8&15,i[a++]=o>>>12&15,i[a++]=o>>>16&15,i[a++]=o>>>20&15,i[a++]=o>>>24&15,i[a++]=o>>>28&15,i[a++]=l>>>0&15,i[a++]=l>>>4&15,i[a++]=l>>>8&15,i[a++]=l>>>12&15,i[a++]=l>>>16&15,i[a++]=l>>>20&15,i[a++]=l>>>24&15,i[a]=l>>>28&15}function YD(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0,l=e[t4+3]>>>0,u=e[t4+4]>>>0;i[a++]=s>>>0&31,i[a++]=s>>>5&31,i[a++]=s>>>10&31,i[a++]=s>>>15&31,i[a++]=s>>>20&31,i[a++]=s>>>25&31,i[a++]=(s>>>30|(n&7)<<2)&31,i[a++]=n>>>3&31,i[a++]=n>>>8&31,i[a++]=n>>>13&31,i[a++]=n>>>18&31,i[a++]=n>>>23&31,i[a++]=(n>>>28|(o&1)<<4)&31,i[a++]=o>>>1&31,i[a++]=o>>>6&31,i[a++]=o>>>11&31,i[a++]=o>>>16&31,i[a++]=o>>>21&31,i[a++]=o>>>26&31,i[a++]=(o>>>31|(l&15)<<1)&31,i[a++]=l>>>4&31,i[a++]=l>>>9&31,i[a++]=l>>>14&31,i[a++]=l>>>19&31,i[a++]=l>>>24&31,i[a++]=(l>>>29|(u&3)<<3)&31,i[a++]=u>>>2&31,i[a++]=u>>>7&31,i[a++]=u>>>12&31,i[a++]=u>>>17&31,i[a++]=u>>>22&31,i[a]=u>>>27&31}function KD(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0,l=e[t4+3]>>>0,u=e[t4+4]>>>0,h=e[t4+5]>>>0;i[a++]=s>>>0&63,i[a++]=s>>>6&63,i[a++]=s>>>12&63,i[a++]=s>>>18&63,i[a++]=s>>>24&63,i[a++]=(s>>>30|(n&15)<<2)&63,i[a++]=n>>>4&63,i[a++]=n>>>10&63,i[a++]=n>>>16&63,i[a++]=n>>>22&63,i[a++]=(n>>>28|(o&3)<<4)&63,i[a++]=o>>>2&63,i[a++]=o>>>8&63,i[a++]=o>>>14&63,i[a++]=o>>>20&63,i[a++]=o>>>26&63,i[a++]=l>>>0&63,i[a++]=l>>>6&63,i[a++]=l>>>12&63,i[a++]=l>>>18&63,i[a++]=l>>>24&63,i[a++]=(l>>>30|(u&15)<<2)&63,i[a++]=u>>>4&63,i[a++]=u>>>10&63,i[a++]=u>>>16&63,i[a++]=u>>>22&63,i[a++]=(u>>>28|(h&3)<<4)&63,i[a++]=h>>>2&63,i[a++]=h>>>8&63,i[a++]=h>>>14&63,i[a++]=h>>>20&63,i[a]=h>>>26&63}function JD(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0,l=e[t4+3]>>>0,u=e[t4+4]>>>0,h=e[t4+5]>>>0,c=e[t4+6]>>>0;i[a++]=s>>>0&127,i[a++]=s>>>7&127,i[a++]=s>>>14&127,i[a++]=s>>>21&127,i[a++]=(s>>>28|(n&7)<<4)&127,i[a++]=n>>>3&127,i[a++]=n>>>10&127,i[a++]=n>>>17&127,i[a++]=n>>>24&127,i[a++]=(n>>>31|(o&63)<<1)&127,i[a++]=o>>>6&127,i[a++]=o>>>13&127,i[a++]=o>>>20&127,i[a++]=(o>>>27|(l&3)<<5)&127,i[a++]=l>>>2&127,i[a++]=l>>>9&127,i[a++]=l>>>16&127,i[a++]=l>>>23&127,i[a++]=(l>>>30|(u&31)<<2)&127,i[a++]=u>>>5&127,i[a++]=u>>>12&127,i[a++]=u>>>19&127,i[a++]=(u>>>26|(h&1)<<6)&127,i[a++]=h>>>1&127,i[a++]=h>>>8&127,i[a++]=h>>>15&127,i[a++]=h>>>22&127,i[a++]=(h>>>29|(c&15)<<3)&127,i[a++]=c>>>4&127,i[a++]=c>>>11&127,i[a++]=c>>>18&127,i[a]=c>>>25&127}function QD(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0,l=e[t4+3]>>>0,u=e[t4+4]>>>0,h=e[t4+5]>>>0,c=e[t4+6]>>>0,d=e[t4+7]>>>0;i[a++]=s>>>0&255,i[a++]=s>>>8&255,i[a++]=s>>>16&255,i[a++]=s>>>24&255,i[a++]=n>>>0&255,i[a++]=n>>>8&255,i[a++]=n>>>16&255,i[a++]=n>>>24&255,i[a++]=o>>>0&255,i[a++]=o>>>8&255,i[a++]=o>>>16&255,i[a++]=o>>>24&255,i[a++]=l>>>0&255,i[a++]=l>>>8&255,i[a++]=l>>>16&255,i[a++]=l>>>24&255,i[a++]=u>>>0&255,i[a++]=u>>>8&255,i[a++]=u>>>16&255,i[a++]=u>>>24&255,i[a++]=h>>>0&255,i[a++]=h>>>8&255,i[a++]=h>>>16&255,i[a++]=h>>>24&255,i[a++]=c>>>0&255,i[a++]=c>>>8&255,i[a++]=c>>>16&255,i[a++]=c>>>24&255,i[a++]=d>>>0&255,i[a++]=d>>>8&255,i[a++]=d>>>16&255,i[a]=d>>>24&255}function eC(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0,l=e[t4+3]>>>0,u=e[t4+4]>>>0,h=e[t4+5]>>>0,c=e[t4+6]>>>0,d=e[t4+7]>>>0,p=e[t4+8]>>>0;i[a++]=s>>>0&511,i[a++]=s>>>9&511,i[a++]=s>>>18&511,i[a++]=(s>>>27|(n&15)<<5)&511,i[a++]=n>>>4&511,i[a++]=n>>>13&511,i[a++]=n>>>22&511,i[a++]=(n>>>31|(o&255)<<1)&511,i[a++]=o>>>8&511,i[a++]=o>>>17&511,i[a++]=(o>>>26|(l&7)<<6)&511,i[a++]=l>>>3&511,i[a++]=l>>>12&511,i[a++]=l>>>21&511,i[a++]=(l>>>30|(u&127)<<2)&511,i[a++]=u>>>7&511,i[a++]=u>>>16&511,i[a++]=(u>>>25|(h&3)<<7)&511,i[a++]=h>>>2&511,i[a++]=h>>>11&511,i[a++]=h>>>20&511,i[a++]=(h>>>29|(c&63)<<3)&511,i[a++]=c>>>6&511,i[a++]=c>>>15&511,i[a++]=(c>>>24|(d&1)<<8)&511,i[a++]=d>>>1&511,i[a++]=d>>>10&511,i[a++]=d>>>19&511,i[a++]=(d>>>28|(p&31)<<4)&511,i[a++]=p>>>5&511,i[a++]=p>>>14&511,i[a]=p>>>23&511}function tC(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0,l=e[t4+3]>>>0,u=e[t4+4]>>>0,h=e[t4+5]>>>0,c=e[t4+6]>>>0,d=e[t4+7]>>>0,p=e[t4+8]>>>0,f=e[t4+9]>>>0;i[a++]=s>>>0&1023,i[a++]=s>>>10&1023,i[a++]=s>>>20&1023,i[a++]=(s>>>30|(n&255)<<2)&1023,i[a++]=n>>>8&1023,i[a++]=n>>>18&1023,i[a++]=(n>>>28|(o&63)<<4)&1023,i[a++]=o>>>6&1023,i[a++]=o>>>16&1023,i[a++]=(o>>>26|(l&15)<<6)&1023,i[a++]=l>>>4&1023,i[a++]=l>>>14&1023,i[a++]=(l>>>24|(u&3)<<8)&1023,i[a++]=u>>>2&1023,i[a++]=u>>>12&1023,i[a++]=u>>>22&1023,i[a++]=h>>>0&1023,i[a++]=h>>>10&1023,i[a++]=h>>>20&1023,i[a++]=(h>>>30|(c&255)<<2)&1023,i[a++]=c>>>8&1023,i[a++]=c>>>18&1023,i[a++]=(c>>>28|(d&63)<<4)&1023,i[a++]=d>>>6&1023,i[a++]=d>>>16&1023,i[a++]=(d>>>26|(p&15)<<6)&1023,i[a++]=p>>>4&1023,i[a++]=p>>>14&1023,i[a++]=(p>>>24|(f&3)<<8)&1023,i[a++]=f>>>2&1023,i[a++]=f>>>12&1023,i[a]=f>>>22&1023}function iC(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0,l=e[t4+3]>>>0,u=e[t4+4]>>>0,h=e[t4+5]>>>0,c=e[t4+6]>>>0,d=e[t4+7]>>>0,p=e[t4+8]>>>0,f=e[t4+9]>>>0,m=e[t4+10]>>>0;i[a++]=s>>>0&2047,i[a++]=s>>>11&2047,i[a++]=(s>>>22|(n&1)<<10)&2047,i[a++]=n>>>1&2047,i[a++]=n>>>12&2047,i[a++]=(n>>>23|(o&3)<<9)&2047,i[a++]=o>>>2&2047,i[a++]=o>>>13&2047,i[a++]=(o>>>24|(l&7)<<8)&2047,i[a++]=l>>>3&2047,i[a++]=l>>>14&2047,i[a++]=(l>>>25|(u&15)<<7)&2047,i[a++]=u>>>4&2047,i[a++]=u>>>15&2047,i[a++]=(u>>>26|(h&31)<<6)&2047,i[a++]=h>>>5&2047,i[a++]=h>>>16&2047,i[a++]=(h>>>27|(c&63)<<5)&2047,i[a++]=c>>>6&2047,i[a++]=c>>>17&2047,i[a++]=(c>>>28|(d&127)<<4)&2047,i[a++]=d>>>7&2047,i[a++]=d>>>18&2047,i[a++]=(d>>>29|(p&255)<<3)&2047,i[a++]=p>>>8&2047,i[a++]=p>>>19&2047,i[a++]=(p>>>30|(f&511)<<2)&2047,i[a++]=f>>>9&2047,i[a++]=f>>>20&2047,i[a++]=(f>>>31|(m&1023)<<1)&2047,i[a++]=m>>>10&2047,i[a]=m>>>21&2047}function rC(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0,l=e[t4+3]>>>0,u=e[t4+4]>>>0,h=e[t4+5]>>>0,c=e[t4+6]>>>0,d=e[t4+7]>>>0,p=e[t4+8]>>>0,f=e[t4+9]>>>0,m=e[t4+10]>>>0,g=e[t4+11]>>>0;i[a++]=s>>>0&4095,i[a++]=s>>>12&4095,i[a++]=(s>>>24|(n&15)<<8)&4095,i[a++]=n>>>4&4095,i[a++]=n>>>16&4095,i[a++]=(n>>>28|(o&255)<<4)&4095,i[a++]=o>>>8&4095,i[a++]=o>>>20&4095,i[a++]=l>>>0&4095,i[a++]=l>>>12&4095,i[a++]=(l>>>24|(u&15)<<8)&4095,i[a++]=u>>>4&4095,i[a++]=u>>>16&4095,i[a++]=(u>>>28|(h&255)<<4)&4095,i[a++]=h>>>8&4095,i[a++]=h>>>20&4095,i[a++]=c>>>0&4095,i[a++]=c>>>12&4095,i[a++]=(c>>>24|(d&15)<<8)&4095,i[a++]=d>>>4&4095,i[a++]=d>>>16&4095,i[a++]=(d>>>28|(p&255)<<4)&4095,i[a++]=p>>>8&4095,i[a++]=p>>>20&4095,i[a++]=f>>>0&4095,i[a++]=f>>>12&4095,i[a++]=(f>>>24|(m&15)<<8)&4095,i[a++]=m>>>4&4095,i[a++]=m>>>16&4095,i[a++]=(m>>>28|(g&255)<<4)&4095,i[a++]=g>>>8&4095,i[a]=g>>>20&4095}function aC(e,t4,i,r){let a=r,s=e[t4]>>>0,n=e[t4+1]>>>0,o=e[t4+2]>>>0,l=e[t4+3]>>>0,u=e[t4+4]>>>0,h=e[t4+5]>>>0,c=e[t4+6]>>>0,d=e[t4+7]>>>0,p=e[t4+8]>>>0,f=e[t4+9]>>>0,m=e[t4+10]>>>0,g=e[t4+11]>>>0,_=e[t4+12]>>>0,y=e[t4+13]>>>0,x=e[t4+14]>>>0,v=e[t4+15]>>>0;i[a++]=s>>>0&65535,i[a++]=s>>>16&65535,i[a++]=n>>>0&65535,i[a++]=n>>>16&65535,i[a++]=o>>>0&65535,i[a++]=o>>>16&65535,i[a++]=l>>>0&65535,i[a++]=l>>>16&65535,i[a++]=u>>>0&65535,i[a++]=u>>>16&65535,i[a++]=h>>>0&65535,i[a++]=h>>>16&65535,i[a++]=c>>>0&65535,i[a++]=c>>>16&65535,i[a++]=d>>>0&65535,i[a++]=d>>>16&65535,i[a++]=p>>>0&65535,i[a++]=p>>>16&65535,i[a++]=f>>>0&65535,i[a++]=f>>>16&65535,i[a++]=m>>>0&65535,i[a++]=m>>>16&65535,i[a++]=g>>>0&65535,i[a++]=g>>>16&65535,i[a++]=_>>>0&65535,i[a++]=_>>>16&65535,i[a++]=y>>>0&65535,i[a++]=y>>>16&65535,i[a++]=x>>>0&65535,i[a++]=x>>>16&65535,i[a++]=v>>>0&65535,i[a]=v>>>16&65535}function sC(e,t4,i,r){let a=r,s=t4;for(let n=0;n<8;n++){let o=e[s++]>>>0;i[a++]=o>>>0&1,i[a++]=o>>>1&1,i[a++]=o>>>2&1,i[a++]=o>>>3&1,i[a++]=o>>>4&1,i[a++]=o>>>5&1,i[a++]=o>>>6&1,i[a++]=o>>>7&1,i[a++]=o>>>8&1,i[a++]=o>>>9&1,i[a++]=o>>>10&1,i[a++]=o>>>11&1,i[a++]=o>>>12&1,i[a++]=o>>>13&1,i[a++]=o>>>14&1,i[a++]=o>>>15&1,i[a++]=o>>>16&1,i[a++]=o>>>17&1,i[a++]=o>>>18&1,i[a++]=o>>>19&1,i[a++]=o>>>20&1,i[a++]=o>>>21&1,i[a++]=o>>>22&1,i[a++]=o>>>23&1,i[a++]=o>>>24&1,i[a++]=o>>>25&1,i[a++]=o>>>26&1,i[a++]=o>>>27&1,i[a++]=o>>>28&1,i[a++]=o>>>29&1,i[a++]=o>>>30&1,i[a++]=o>>>31&1}}function nC(e,t4,i,r){let a=r,s=t4;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0;i[a++]=o>>>0&3,i[a++]=o>>>2&3,i[a++]=o>>>4&3,i[a++]=o>>>6&3,i[a++]=o>>>8&3,i[a++]=o>>>10&3,i[a++]=o>>>12&3,i[a++]=o>>>14&3,i[a++]=o>>>16&3,i[a++]=o>>>18&3,i[a++]=o>>>20&3,i[a++]=o>>>22&3,i[a++]=o>>>24&3,i[a++]=o>>>26&3,i[a++]=o>>>28&3,i[a++]=o>>>30&3,i[a++]=l>>>0&3,i[a++]=l>>>2&3,i[a++]=l>>>4&3,i[a++]=l>>>6&3,i[a++]=l>>>8&3,i[a++]=l>>>10&3,i[a++]=l>>>12&3,i[a++]=l>>>14&3,i[a++]=l>>>16&3,i[a++]=l>>>18&3,i[a++]=l>>>20&3,i[a++]=l>>>22&3,i[a++]=l>>>24&3,i[a++]=l>>>26&3,i[a++]=l>>>28&3,i[a++]=l>>>30&3}}function oC(e,t4,i,r){let a=r,s=t4;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0;i[a++]=o>>>0&7,i[a++]=o>>>3&7,i[a++]=o>>>6&7,i[a++]=o>>>9&7,i[a++]=o>>>12&7,i[a++]=o>>>15&7,i[a++]=o>>>18&7,i[a++]=o>>>21&7,i[a++]=o>>>24&7,i[a++]=o>>>27&7,i[a++]=(o>>>30|(l&1)<<2)&7,i[a++]=l>>>1&7,i[a++]=l>>>4&7,i[a++]=l>>>7&7,i[a++]=l>>>10&7,i[a++]=l>>>13&7,i[a++]=l>>>16&7,i[a++]=l>>>19&7,i[a++]=l>>>22&7,i[a++]=l>>>25&7,i[a++]=l>>>28&7,i[a++]=(l>>>31|(u&3)<<1)&7,i[a++]=u>>>2&7,i[a++]=u>>>5&7,i[a++]=u>>>8&7,i[a++]=u>>>11&7,i[a++]=u>>>14&7,i[a++]=u>>>17&7,i[a++]=u>>>20&7,i[a++]=u>>>23&7,i[a++]=u>>>26&7,i[a++]=u>>>29&7}}function lC(e,t4,i,r){let a=r,s=t4;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0,h=e[s++]>>>0;i[a++]=o>>>0&15,i[a++]=o>>>4&15,i[a++]=o>>>8&15,i[a++]=o>>>12&15,i[a++]=o>>>16&15,i[a++]=o>>>20&15,i[a++]=o>>>24&15,i[a++]=o>>>28&15,i[a++]=l>>>0&15,i[a++]=l>>>4&15,i[a++]=l>>>8&15,i[a++]=l>>>12&15,i[a++]=l>>>16&15,i[a++]=l>>>20&15,i[a++]=l>>>24&15,i[a++]=l>>>28&15,i[a++]=u>>>0&15,i[a++]=u>>>4&15,i[a++]=u>>>8&15,i[a++]=u>>>12&15,i[a++]=u>>>16&15,i[a++]=u>>>20&15,i[a++]=u>>>24&15,i[a++]=u>>>28&15,i[a++]=h>>>0&15,i[a++]=h>>>4&15,i[a++]=h>>>8&15,i[a++]=h>>>12&15,i[a++]=h>>>16&15,i[a++]=h>>>20&15,i[a++]=h>>>24&15,i[a++]=h>>>28&15}}function uC(e,t4,i,r){let a=r,s=t4;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0,h=e[s++]>>>0,c=e[s++]>>>0;i[a++]=o>>>0&31,i[a++]=o>>>5&31,i[a++]=o>>>10&31,i[a++]=o>>>15&31,i[a++]=o>>>20&31,i[a++]=o>>>25&31,i[a++]=(o>>>30|(l&7)<<2)&31,i[a++]=l>>>3&31,i[a++]=l>>>8&31,i[a++]=l>>>13&31,i[a++]=l>>>18&31,i[a++]=l>>>23&31,i[a++]=(l>>>28|(u&1)<<4)&31,i[a++]=u>>>1&31,i[a++]=u>>>6&31,i[a++]=u>>>11&31,i[a++]=u>>>16&31,i[a++]=u>>>21&31,i[a++]=u>>>26&31,i[a++]=(u>>>31|(h&15)<<1)&31,i[a++]=h>>>4&31,i[a++]=h>>>9&31,i[a++]=h>>>14&31,i[a++]=h>>>19&31,i[a++]=h>>>24&31,i[a++]=(h>>>29|(c&3)<<3)&31,i[a++]=c>>>2&31,i[a++]=c>>>7&31,i[a++]=c>>>12&31,i[a++]=c>>>17&31,i[a++]=c>>>22&31,i[a++]=c>>>27&31}}function hC(e,t4,i,r){let a=r,s=t4;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0,h=e[s++]>>>0,c=e[s++]>>>0,d=e[s++]>>>0;i[a++]=o>>>0&63,i[a++]=o>>>6&63,i[a++]=o>>>12&63,i[a++]=o>>>18&63,i[a++]=o>>>24&63,i[a++]=(o>>>30|(l&15)<<2)&63,i[a++]=l>>>4&63,i[a++]=l>>>10&63,i[a++]=l>>>16&63,i[a++]=l>>>22&63,i[a++]=(l>>>28|(u&3)<<4)&63,i[a++]=u>>>2&63,i[a++]=u>>>8&63,i[a++]=u>>>14&63,i[a++]=u>>>20&63,i[a++]=u>>>26&63,i[a++]=h>>>0&63,i[a++]=h>>>6&63,i[a++]=h>>>12&63,i[a++]=h>>>18&63,i[a++]=h>>>24&63,i[a++]=(h>>>30|(c&15)<<2)&63,i[a++]=c>>>4&63,i[a++]=c>>>10&63,i[a++]=c>>>16&63,i[a++]=c>>>22&63,i[a++]=(c>>>28|(d&3)<<4)&63,i[a++]=d>>>2&63,i[a++]=d>>>8&63,i[a++]=d>>>14&63,i[a++]=d>>>20&63,i[a++]=d>>>26&63}}function cC(e,t4,i,r){let a=r,s=t4;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0,h=e[s++]>>>0,c=e[s++]>>>0,d=e[s++]>>>0,p=e[s++]>>>0;i[a++]=o>>>0&127,i[a++]=o>>>7&127,i[a++]=o>>>14&127,i[a++]=o>>>21&127,i[a++]=(o>>>28|(l&7)<<4)&127,i[a++]=l>>>3&127,i[a++]=l>>>10&127,i[a++]=l>>>17&127,i[a++]=l>>>24&127,i[a++]=(l>>>31|(u&63)<<1)&127,i[a++]=u>>>6&127,i[a++]=u>>>13&127,i[a++]=u>>>20&127,i[a++]=(u>>>27|(h&3)<<5)&127,i[a++]=h>>>2&127,i[a++]=h>>>9&127,i[a++]=h>>>16&127,i[a++]=h>>>23&127,i[a++]=(h>>>30|(c&31)<<2)&127,i[a++]=c>>>5&127,i[a++]=c>>>12&127,i[a++]=c>>>19&127,i[a++]=(c>>>26|(d&1)<<6)&127,i[a++]=d>>>1&127,i[a++]=d>>>8&127,i[a++]=d>>>15&127,i[a++]=d>>>22&127,i[a++]=(d>>>29|(p&15)<<3)&127,i[a++]=p>>>4&127,i[a++]=p>>>11&127,i[a++]=p>>>18&127,i[a++]=p>>>25&127}}function dC(e,t4,i,r){let a=r,s=t4;for(let n=0;n<8;n++){let o=e[s++]>>>0,l=e[s++]>>>0,u=e[s++]>>>0,h=e[s++]>>>0,c=e[s++]>>>0,d=e[s++]>>>0,p=e[s++]>>>0,f=e[s++]>>>0;i[a++]=o>>>0&255,i[a++]=o>>>8&255,i[a++]=o>>>16&255,i[a++]=o>>>24&255,i[a++]=l>>>0&255,i[a++]=l>>>8&255,i[a++]=l>>>16&255,i[a++]=l>>>24&255,i[a++]=u>>>0&255,i[a++]=u>>>8&255,i[a++]=u>>>16&255,i[a++]=u>>>24&255,i[a++]=h>>>0&255,i[a++]=h>>>8&255,i[a++]=h>>>16&255,i[a++]=h>>>24&255,i[a++]=c>>>0&255,i[a++]=c>>>8&255,i[a++]=c>>>16&255,i[a++]=c>>>24&255,i[a++]=d>>>0&255,i[a++]=d>>>8&255,i[a++]=d>>>16&255,i[a++]=d>>>24&255,i[a++]=p>>>0&255,i[a++]=p>>>8&255,i[a++]=p>>>16&255,i[a++]=p>>>24&255,i[a++]=f>>>0&255,i[a++]=f>>>8&255,i[a++]=f>>>16&255,i[a++]=f>>>24&255}}function pC(e,t4,i,r){let a=r,s=t4;for(let n=0;n<128;n++){let o=e[s++]>>>0;i[a++]=o&65535,i[a++]=o>>>16&65535}}function fC(e,t4,i,r,a){let s=Mc[a]>>>0,n=t4,o=0,l=e[n]>>>0,u=r;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+a<=32){let d=l>>>o&s;i[u+c]=d|0,o+=a,o===32&&(o=0,n++,c!==31&&(l=e[n]>>>0))}else{let d=32-o,p=l>>>o;n++,l=e[n]>>>0;let f=a-d,m=-1>>>32-f>>>0,g=(p|(l&m)<<d)&s;i[u+c]=g|0,o=f}u+=32,o=0,h<7&&(l=e[n]>>>0)}}const Fc=ZD(t1),mC=3*Fc/256+Fc|0;function i1(){let e=new Uint8Array(mC);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function gC(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t4=Math.max(16,e|0);return{encodedWords:new Uint32Array(t4),decoderWorkspace:i1()}}function _C(e,t4){if(t4<=e.encodedWords.length)return e.encodedWords;let i=new Uint32Array(Math.max(16,t4*2));return e.encodedWords=i,i}function yC(e,t4,i,r){r.byteContainer.length<i&&(r.byteContainer=new Uint8Array(i*2),r.byteContainerI32=void 0);let a=r.byteContainer,s=i>>>2;if(a.byteOffset&3)for(let o=0;o<s;o=o+1|0){let l=e[t4+o|0]|0,u=o<<2;a[u]=l&255,a[u+1|0]=l>>>8&255,a[u+2|0]=l>>>16&255,a[u+3|0]=l>>>24&255}else{let o=r.byteContainerI32;(!o||o.buffer!==a.buffer||o.byteOffset!==a.byteOffset||o.length<s)&&(o=r.byteContainerI32=new Int32Array(a.buffer,a.byteOffset,a.byteLength>>>2)),o.set(e.subarray(t4,t4+s))}let n=i&3;if(n>0){let o=e[t4+s|0]|0,l=s<<2;for(let u=0;u<n;u=u+1|0)a[l+u|0]=o>>>(u<<3)&255}return a}function vC(e,t4,i){let r=e[t4++]|0,a=i.dataToBePacked;for(let s=2;s<=32;s=s+1|0){if(!(r>>>s-1&1))continue;if(t4>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${s}, streamWordIndex=${t4}, needWords=1, availableWords=${e.length-t4}, encodedWords=${e.length})`);let n=e[t4++]>>>0,o=GD(n),l=n*s+31>>>5;if(t4+l>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${s}, size=${n}, streamWordIndex=${t4}, needWords=${l}, availableWords=${e.length-t4}, encodedWords=${e.length})`);let u=a[s];(!u||u.length<o)&&(u=a[s]=new Uint32Array(o));let h=0;for(;h<n;h=h+32|0)AC(e,t4,u,h,s),t4=t4+s|0;let c=h-n|0;t4=t4-(c*s>>>5)|0,i.exceptionSizes[s]=n}return t4}function xC(e,t4,i,r,a){switch(a){case 1:sC(e,t4,i,r);break;case 2:nC(e,t4,i,r);break;case 3:oC(e,t4,i,r);break;case 4:lC(e,t4,i,r);break;case 5:uC(e,t4,i,r);break;case 6:hC(e,t4,i,r);break;case 7:cC(e,t4,i,r);break;case 8:dC(e,t4,i,r);break;case 16:pC(e,t4,i,r);break;default:fC(e,t4,i,r,a)}return t4+(a<<3)|0}function bC(e,t4,i,r){if(i+2>t4)throw Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${t4})`);let a=e[i++],s=e[i++];if(a>32)throw Error(`FastPFOR decode: invalid bitWidth=${a} at block=${r} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:a,exceptionCount:s,bytePosIn:i}}function wC(e,t4,i,r,a,s){if(i+1>t4)throw Error(`FastPFOR decode: exception header underflow at block=${s} (need 1 byte for maxBits, bytePos=${i}, byteSize=${t4})`);let n=e[i++];if(n<r||n>32)throw Error(`FastPFOR decode: invalid maxBits=${n} at block=${s} (bitWidth=${r}, expected ${r}..32)`);let o=n-r|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${s} (bitWidth=${r}, maxBits=${n})`);if(i+a>t4)throw Error(`FastPFOR decode: exception positions underflow at block=${s} (need=${a}, have=${t4-i})`);return{maxBits:n,exceptionBitWidth:o,bytePosIn:i}}function TC(e,t4,i,r,a,s,n,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=wC(a,s,n,i,r,l);if(n=c,h===1){let g=1<<i;for(let _=0;_<r;_=_+1|0){let y=a[n++];e[y+t4|0]|=g}return n}let d=o.dataToBePacked[h];if(!d)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${i}, maxBits=${u}) at block ${l}`);let p=o.dataPointers,f=p[h]|0,m=o.exceptionSizes[h]|0;if(f+r>m)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${f}, need ${r}, size=${m}) at block ${l}`);for(let g=0;g<r;g=g+1|0){let _=a[n++],y=d[f++]|0;e[_+t4|0]|=y<<i}return p[h]=f,n}function EC(e,t4,i,r,a,s,n,o,l,u){let h=i|0,c=0;for(let d=0;d<n;d=d+1|0){let p=bC(o,l,c,d);c=p.bytePosIn;let f=p.bitWidth,m=p.exceptionCount,g=s+d*256|0;switch(f){case 0:a.fill(0,g,g+256);break;case 32:for(let _=0;_<256;_=_+1|0)a[g+_|0]=e[h+_|0]|0;h=h+256|0;break;default:h=xC(e,h,a,g,f)}m>0&&(c=TC(a,g,f,m,o,l,c,u,d))}if(h!==r)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t4}, packedStart=${i}, consumedPackedEnd=${h}, expectedPackedEnd=${r}, packedWords=${r-i}, encoded.length=${e.length})`)}function SC(e,t4,i,r,a,s){let n=i|0,o=e[n]|0;if(o<=0||n+o>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${n} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let l=n+1|0,u=n+o|0,h=e[u]>>>0,c=h+3>>>2,d=u+1,p=d+c;if(p>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${n}, packedEnd=${u}, byteContainerStart=${d}) causes bitmapPos=${p} out of bounds (encoded.length=${e.length})`);let f=yC(e,d,h,s),m=h,g=vC(e,p,s);return s.dataPointers.fill(0),EC(e,n,l,u,t4,r|0,a/256|0,f,m,s),g}function DC(e,t4,i,r,a,s){let n=r+Vd(a,256),o=r,l=i;for(;o!==n;){let u=Math.min(Fc,n-o);l=SC(e,t4,l,o,u,s),o=o+u|0}return l}function CC(e,t4,i,r,a,s){if(s===0)return t4;let n=0,o=t4,l=t4+i,u=a,h=a,c=a+s,d=0,p=0;for(;o<l&&h<c;){let f=e[o]>>>n&255;if(n+=8,o+=n>>>5,n&=31,d|=(f&127)<<p,f&128)r[h++]=d|0,d=0,p=0;else if(p+=7,p>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${d}, decoded=${h-u}/${s}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${s}, consumedWords=${o-t4}/${i}, vbyteStart=${t4}, vbyteEnd=${l})`);return o}function PC(e,t4,i){let r=0,a=0,s=new Uint32Array(t4),n=i??i1();if(e.length>0){let u=e[r]|0;if(r=r+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(a+u>s.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${a}, alignedLength=${u}, out.length=${s.length})`);r=DC(e,s,r,a,u,n),a=a+u|0}let o=e.length-r|0,l=t4-a|0;return CC(e,r,o,s,a,l),s}function AC(e,t4,i,r,a){switch(a){case 2:WD(e,t4,i,r);return;case 3:HD(e,t4,i,r);return;case 4:XD(e,t4,i,r);return;case 5:YD(e,t4,i,r);return;case 6:KD(e,t4,i,r);return;case 7:JD(e,t4,i,r);return;case 8:QD(e,t4,i,r);return;case 9:eC(e,t4,i,r);return;case 10:tC(e,t4,i,r);return;case 11:iC(e,t4,i,r);return;case 12:rC(e,t4,i,r);return;case 16:aC(e,t4,i,r);return;case 32:for(let u=0;u<32;u=u+1|0)i[r+u|0]=e[t4+u|0]|0;return}let s=Mc[a]>>>0,n=t4,o=0,l=e[n]>>>0;for(let u=0;u<32;u++)if(o+a<=32){let h=l>>>o&s;i[r+u]=h|0,o+=a,o===32&&(o=0,n++,u!==31&&(l=e[n]>>>0))}else{let h=32-o,c=l>>>o;n++,l=e[n]>>>0;let d=Mc[a-h]>>>0,p=(c|(l&d)<<h)&s;i[r+u]=p|0,o=a-h}}function IC(e,t4,i,r){if(t4<0||i<0||t4+i>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t4}, byteLength=${i}, bytes.length=${e.length})`);let a=Math.floor(i/4),s=i%4!=0,n=s?a+1:a;if(r.length<n)throw RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${n}`);if(a>0){let o=e.byteOffset+t4;if(o&3)for(let l=0;l<a;l++){let u=t4+l*4;r[l]=e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]|0}else{let l=new Uint32Array(e.buffer,o,a);for(let u=0;u<a;u++)r[u]=qD(l[u])|0}}if(s){let o=t4+a*4,l=i-a*4,u=0;for(let h=0;h<l;h++)u|=e[o+h]<<24-h*8;r[a]=u|0}return n}function Mt(e,t4,i){let r=new Uint32Array(i),a=0,s=t4.get();for(let n=0;n<r.length;n++){let o=e[s++],l=o&127;if(o<128){r[a++]=l;continue}if(o=e[s++],l|=(o&127)<<7,o<128){r[a++]=l;continue}if(o=e[s++],l|=(o&127)<<14,o<128){r[a++]=l;continue}if(o=e[s++],l|=(o&127)<<21,o<128){r[a++]=l;continue}o=e[s++],l|=(o&15)<<28,r[a++]=l}return t4.set(s),r}function jd(e,t4,i){let r=new BigUint64Array(i);for(let a=0;a<r.length;a++)r[a]=MC(e,t4);return r}function MC(e,t4){let i=0n,r=0,a=t4.get();for(;a<e.length;){let s=e[a++];if(i|=BigInt(s&127)<<BigInt(r),!(s&128))break;if(r+=7,r>=64)throw Error("Varint too long")}return t4.set(a),i}function FC(e,t4,i){let r=new Float64Array(i);for(let a=0;a<i;a++)r[a]=zC(e,t4);return r}function zC(e,t4){let i,r;return r=e[t4.get()],t4.increment(),i=r&127,r<128||(r=e[t4.get()],t4.increment(),i|=(r&127)<<7,r<128)||(r=e[t4.get()],t4.increment(),i|=(r&127)<<14,r<128)||(r=e[t4.get()],t4.increment(),i|=(r&127)<<21,r<128)?i:(r=e[t4.get()],i|=(r&15)<<28,RC(i,e,t4))}function RC(e,t4,i){let r,a;if(a=t4[i.get()],i.increment(),r=(a&112)>>4,a<128||(a=t4[i.get()],i.increment(),r|=(a&127)<<3,a<128)||(a=t4[i.get()],i.increment(),r|=(a&127)<<10,a<128)||(a=t4[i.get()],i.increment(),r|=(a&127)<<17,a<128)||(a=t4[i.get()],i.increment(),r|=(a&127)<<24,a<128)||(a=t4[i.get()],i.increment(),r|=(a&1)<<31,a<128))return r*4294967296+(e>>>0);throw Error("Expected varint not more than 10 bytes")}function kC(e,t4,i,r){return LC(e,t4,i,r,gC(i>>>2))}function LC(e,t4,i,r,a){let s=r.get();if(i&3)throw Error(`FastPFOR: invalid encodedByteLength=${i} at offset=${s} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let n=i>>>2,o=_C(a,n);IC(e,s,i,o);let l=PC(o.subarray(0,n),t4,a.decoderWorkspace);return r.add(i),l}function Me(e){return e>>>1^-(e&1)}function Pt(e){return e>>1n^-(e&1n)}function $r(e){return e%2==1?(e+1)/-2:e/2}function BC(e){let t4=new Int32Array(e.length);for(let i=0;i<e.length;i++)t4[i]=Me(e[i]);return t4}function OC(e){let t4=new BigInt64Array(e.length);for(let i=0;i<e.length;i++)t4[i]=Pt(e[i]);return t4}function zc(e,t4,i){if(i===void 0){i=0;for(let s=0;s<t4;s++)i+=e[s]}let r=new Uint32Array(i),a=0;for(let s=0;s<t4;s++){let n=e[s],o=e[s+t4];r.fill(o,a,a+n),a+=n}return r}function Rc(e,t4,i){if(i===void 0){i=0;for(let s=0;s<t4;s++)i+=Number(e[s])}let r=new BigUint64Array(i),a=0;for(let s=0;s<t4;s++){let n=Number(e[s]),o=e[s+t4];r.fill(o,a,a+n),a+=n}return r}function r1(e,t4,i){let r=new Float64Array(i),a=0;for(let s=0;s<t4;s++){let n=e[s],o=e[s+t4];r.fill(o,a,a+n),a+=n}return r}function _m(e){let t4=new Int32Array(e.length);t4[0]=Me(e[0]);let i=e.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let a=e[r],s=e[r+1],n=e[r+2],o=e[r+3];t4[r]=Me(a)+t4[r-1],t4[r+1]=Me(s)+t4[r],t4[r+2]=Me(n)+t4[r+1],t4[r+3]=Me(o)+t4[r+2]}for(;r!==e.length;++r)t4[r]=Me(e[r])+t4[r-1];return t4}function ym(e){let t4=new BigInt64Array(e.length);t4[0]=Pt(e[0]);let i=e.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let a=e[r],s=e[r+1],n=e[r+2],o=e[r+3];t4[r]=Pt(a)+t4[r-1],t4[r+1]=Pt(s)+t4[r],t4[r+2]=Pt(n)+t4[r+1],t4[r+3]=Pt(o)+t4[r+2]}for(;r!==t4.length;++r)t4[r]=Pt(e[r])+t4[r-1];return t4}function $C(e){e[0]=$r(e[0]);let t4=e.length/4*4,i=1;if(t4>=4)for(;i<t4-4;i+=4){let r=e[i],a=e[i+1],s=e[i+2],n=e[i+3];e[i]=$r(r)+e[i-1],e[i+1]=$r(a)+e[i],e[i+2]=$r(s)+e[i+1],e[i+3]=$r(n)+e[i+2]}for(;i!==e.length;++i)e[i]=$r(e[i])+e[i-1]}function VC(e,t4,i){if(i===void 0){i=0;for(let s=0;s<t4;s++)i+=e[s]}let r=new Int32Array(i),a=0;for(let s=0;s<t4;s++){let n=e[s],o=e[s+t4];o=Me(o),r.fill(o,a,a+n),a+=n}return r}function jC(e,t4,i){if(i===void 0){i=0;for(let s=0;s<t4;s++)i+=Number(e[s])}let r=new BigInt64Array(i),a=0;for(let s=0;s<t4;s++){let n=Number(e[s]),o=e[s+t4];o=Pt(o),r.fill(o,a,a+n),a+=n}return r}function UC(e,t4,i){let r=new Float64Array(i),a=0;for(let s=0;s<t4;s++){let n=e[s],o=e[s+t4];o=$r(o),r.fill(o,a,a+n),a+=n}return r}function Ud(e){let t4=e.length/4*4,i=1;if(t4>=4)for(let r=e[0];i<t4-4;i+=4)r=e[i]+=r,r=e[i+1]+=r,r=e[i+2]+=r,r=e[i+3]+=r;for(;i!==e.length;)e[i]+=e[i-1],++i}function NC(e){let t4=0;for(let i=0;i<e.length;i++)e[i]+=t4,t4=e[i]}function GC(e){if(e.length<2)return new Int32Array(e);let t4=new Int32Array(e.length);t4[0]=Me(e[0]),t4[1]=Me(e[1]);let i=e.length/4*4,r=2;if(i>=4)for(;r<i-4;r+=4){let a=e[r],s=e[r+1],n=e[r+2],o=e[r+3];t4[r]=Me(a)+t4[r-2],t4[r+1]=Me(s)+t4[r-1],t4[r+2]=Me(n)+t4[r],t4[r+3]=Me(o)+t4[r+1]}for(;r!==e.length;r+=2)t4[r]=Me(e[r])+t4[r-2],t4[r+1]=Me(e[r+1])+t4[r-1];return t4}function ZC(e){let t4=new Int32Array(e.length+1);t4[0]=0,t4[1]=Me(e[0]);let i=t4[1];for(let r=2;r!==t4.length;++r){let a=e[r-1],s=Me(a);i+=s,t4[r]=t4[r-1]+i}return new Uint32Array(t4)}function qC(e,t4,i){let r=new Int32Array(i+1);r[0]=0;let a=1,s=r[0];for(let n=0;n<t4;n++){let o=e[n],l=e[n+t4];l=Me(l);for(let u=a;u<a+o;u++)r[u]=l+s,s=r[u];a+=o}return r}function WC(e,t4,i){let r=new Uint32Array(i+1);r[0]=0;let a=1,s=r[0];for(let n=0;n<t4;n++){let o=e[n],l=e[n+t4];for(let u=a;u<a+o;u++)r[u]=l+s,s=r[u];a+=o}return r}function HC(e,t4,i){let r=new Int32Array(i),a=0,s=0;for(let n=0;n<t4;n++){let o=e[n],l=e[n+t4],u=Me(l);for(let h=0;h<o;h++)s+=u,r[a++]=s}return r}function XC(e,t4,i){let r=new BigInt64Array(i),a=0,s=0n;for(let n=0;n<t4;n++){let o=Number(e[n]),l=e[n+t4],u=Pt(l);for(let h=0;h<o;h++)s+=u,r[a++]=s}return r}function vm(e){let t4=new Uint32Array(e.length);t4[0]=Me(e[0])>>>0;for(let i=1;i<e.length;i++)t4[i]=t4[i-1]+Me(e[i])>>>0;return t4}function xm(e){let t4=new BigUint64Array(e.length);t4[0]=BigInt.asUintN(64,Pt(e[0]));for(let i=1;i<e.length;i++)t4[i]=BigInt.asUintN(64,t4[i-1]+Pt(e[i]));return t4}function YC(e){if(e.length<2)return new Uint32Array(e);let t4=new Uint32Array(e.length);t4[0]=Me(e[0])>>>0,t4[1]=Me(e[1])>>>0;for(let i=2;i<e.length;i+=2)t4[i]=t4[i-2]+Me(e[i])>>>0,t4[i+1]=t4[i-1]+Me(e[i+1])>>>0;return t4}function KC(e){return e[1]}function JC(e){return Me(e[1])}function QC(e){if(e.length===2){let t4=Me(e[1]);return[t4,t4]}return[Me(e[2]),Me(e[3])]}function eP(e){return e[1]}function tP(e){return Pt(e[1])}function iP(e){if(e.length===2){let t4=Pt(e[1]);return[t4,t4]}return[Pt(e[2]),Pt(e[3])]}var ut;(function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"})(ut||(ut={}));var Ot;(function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"})(Ot||(Ot={}));var or;(function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"})(or||(or={}));var _t;(function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"})(_t||(_t={}));const rP=[ut.PRESENT,ut.DATA,ut.OFFSET,ut.LENGTH],bm=[ce.NONE,ce.DELTA,ce.COMPONENTWISE_DELTA,ce.RLE,ce.MORTON],aP=[vi.NONE,vi.FAST_PFOR,vi.VARINT],sP=[Ot.NONE,Ot.SINGLE,Ot.SHARED,Ot.VERTEX,Ot.MORTON,Ot.FSST],nP=[or.VERTEX,or.INDEX,or.STRING,or.KEY],oP=[_t.VAR_BINARY,_t.GEOMETRIES,_t.PARTS,_t.RINGS,_t.TRIANGLES,_t.SYMBOL,_t.DICTIONARY];function Xe(e,t4){let i=hP(e,t4);return i.logicalLevelTechnique1===ce.MORTON?lP(i,e,t4):(ce.RLE===i.logicalLevelTechnique1||ce.RLE===i.logicalLevelTechnique2)&&vi.NONE!==i.physicalLevelTechnique?uP(i,e,t4):i}function lP(e,t4,i){let r=Mt(t4,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:r[0],coordinateShift:r[1]}}function uP(e,t4,i){let r=Mt(t4,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}function hP(e,t4){let i=e[t4.get()],r=rP[i>>4],a={};switch(r){case ut.DATA:a={dictionaryType:sP[i&15]};break;case ut.OFFSET:a={offsetType:nP[i&15]};break;case ut.LENGTH:a={lengthType:oP[i&15]}}t4.increment();let s=e[t4.get()],n=bm[s>>5],o=bm[s>>2&7],l=aP[s&3];t4.increment();let u=Mt(e,t4,2),h=u[0],c=u[1];return{physicalStreamType:r,logicalStreamType:a,logicalLevelTechnique1:n,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var Ue;(function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(Ue||(Ue={}));var Fi=class{constructor(e,t4){this.values=e,this._size=t4}get(e){let t4=Math.floor(e/8),i=e%8;return(this.values[t4]>>i&1)==1}set(e,t4){let i=Math.floor(e/8),r=e%8;this.values[i]=this.values[i]|+!!t4<<r}getInt(e){let t4=Math.floor(e/8),i=e%8;return this.values[t4]>>i&1}size(){return this._size}getBuffer(){return this.values}};function ua(e,t4,i){if(!t4)return e;let r=t4.size(),a=e.constructor,s=new a(r),n=0;for(let o=0;o<r;o++)s[o]=t4.get(o)?e[n++]:i;return s}function cP(e,t4,i){if(!i)return e;let r=i.size(),a=new Fi(e,t4),s=new Fi(new Uint8Array(Math.ceil(r/8)),r),n=0;for(let o=0;o<r;o++){let l=i.get(o)?a.get(n++):false;s.set(o,l)}return s.getBuffer()}function rs(e,t4,i,r,a){let s=dP(e,Math.ceil(t4/8),i,r);return a?cP(s,t4,a):s}function dP(e,t4,i,r){let a=new Uint8Array(t4),s=0,n=r.get()+i;for(;s<t4&&!(r.get()>=n);){let o=e[r.increment()];if(o<=127){let l=o+3,u=e[r.increment()],h=Math.min(s+l,t4);a.fill(u,s,h),s=h}else{let l=256-o;for(let u=0;u<l&&s<t4;u++)a[s++]=e[r.increment()]}}return r.set(n),a}function a1(e,t4,i,r){let a=t4.get(),s=a+i*Float32Array.BYTES_PER_ELEMENT,n=new Uint8Array(e.subarray(a,s)).buffer,o=new Float32Array(n);return t4.set(s),r?ua(o,r,0):o}function s1(e,t4,i,r){let a=t4.get(),s=a+i*Float64Array.BYTES_PER_ELEMENT,n=new Uint8Array(e.subarray(a,s)).buffer,o=new Float64Array(n);return t4.set(s),r?ua(o,r,0):o}function pP(e,t4,i){let r=t4.get(),a=i*Uint32Array.BYTES_PER_ELEMENT,s=new DataView(e.buffer,e.byteOffset,e.byteLength),n=new Uint32Array(i);for(let o=0;o<i;o++)n[o]=s.getUint32(r+o*Uint32Array.BYTES_PER_ELEMENT,true);return t4.add(a),n}function fP(e,t4,i){let r=t4.get(),a=i*BigUint64Array.BYTES_PER_ELEMENT,s=new DataView(e.buffer,e.byteOffset,e.byteLength),n=new BigUint64Array(i);for(let o=0;o<i;o++)n[o]=s.getBigUint64(r+o*BigUint64Array.BYTES_PER_ELEMENT,true);return t4.add(a),n}const mP=new TextDecoder;function Nd(e,t4,i){return i-t4>=12?mP.decode(e.subarray(t4,i)):gP(e,t4,i)}function gP(e,t4,i){let r="",a=t4;for(;a<i;){let s=e[a],n=null,o=s>239?4:s>223?3:s>191?2:1;if(a+o>i)break;let l,u,h;o===1?s<128&&(n=s):o===2?(l=e[a+1],(l&192)==128&&(n=(s&31)<<6|l&63,n<=127&&(n=null))):o===3?(l=e[a+1],u=e[a+2],(l&192)==128&&(u&192)==128&&(n=(s&15)<<12|(l&63)<<6|u&63,(n<=2047||n>=55296&&n<=57343)&&(n=null))):o===4&&(l=e[a+1],u=e[a+2],h=e[a+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(n=(s&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(n<=65535||n>=1114112)&&(n=null))),n===null?(n=65533,o=1):n>65535&&(n-=65536,r+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),r+=String.fromCharCode(n),a+=o}return r}function gl(e,t4,i,r,a){return bP(as(e,t4,i),i,r,a)}function Et(e,t4,i,r,a){return wP(as(e,t4,i),i,r,a)}function xr(e,t4,i){return SP(as(e,t4,i),i)}function as(e,t4,i){let r=i.physicalLevelTechnique;switch(r){case vi.FAST_PFOR:return kC(e,i.numValues,i.byteLength,t4);case vi.VARINT:return Mt(e,t4,i.numValues);case vi.NONE:return pP(e,t4,i.numValues);default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function Sn(e,t4,i){let r=i.physicalLevelTechnique;switch(r){case vi.VARINT:return jd(e,t4,i.numValues);case vi.NONE:return fP(e,t4,i.numValues);default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function _P(e,t4,i){let r=as(e,t4,i);return r.length===1?Me(r[0]):JC(r)}function Gd(e,t4,i){let r=as(e,t4,i);return r.length===1?i.logicalLevelTechnique1===ce.DELTA?Me(r[0]):r[0]:KC(r)}function n1(e,t4,i){return QC(as(e,t4,i))}function o1(e,t4,i){return iP(jd(e,t4,i.numValues))}function l1(e,t4,i,r){return TP(Sn(e,t4,i),i,r)}function Zd(e,t4,i,r){return h1(Sn(e,t4,i),i,r)}function yP(e,t4,i,r){let a=vP(e,t4,i,false);return r?ua(a,r,0):a}function vP(e,t4,i,r){if(i.physicalLevelTechnique===vi.VARINT)return EP(FC(e,t4,i.numValues),i,r);let a=Sn(e,t4,i),s=h1(a,i);return Float64Array.from(s,Number)}function xP(e,t4,i){let r=Sn(e,t4,i);return r.length===1?Pt(r[0]):tP(r)}function u1(e,t4,i){let r=Sn(e,t4,i);return r.length===1?i.logicalLevelTechnique1===ce.DELTA?Pt(r[0]):r[0]:eP(r)}function bP(e,t4,i,r){let a;switch(t4.logicalLevelTechnique1){case ce.DELTA:if(t4.logicalLevelTechnique2===ce.RLE){let s=t4;if(!r)return HC(e,s.runs,s.numRleValues);e=zc(e,s.runs,s.numRleValues),a=_m(e)}else a=_m(e);break;case ce.RLE:a=VC(e,t4.runs,t4.numRleValues);break;case ce.MORTON:Ud(e),a=new Int32Array(e);break;case ce.COMPONENTWISE_DELTA:a=GC(e);break;case ce.NONE:a=BC(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t4.logicalLevelTechnique1}`)}return r?ua(a,r,0):a}function wP(e,t4,i,r){let a;switch(t4.logicalLevelTechnique1){case ce.DELTA:if(t4.logicalLevelTechnique2===ce.RLE){let s=t4;a=vm(zc(e,s.runs,s.numRleValues))}else a=vm(e);break;case ce.RLE:a=zc(e,t4.runs,t4.numRleValues);break;case ce.MORTON:Ud(e),a=e;break;case ce.COMPONENTWISE_DELTA:a=YC(e);break;case ce.NONE:a=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t4.logicalLevelTechnique1}`)}return r?ua(a,r,0):a}function TP(e,t4,i){let r;switch(t4.logicalLevelTechnique1){case ce.DELTA:if(t4.logicalLevelTechnique2===ce.RLE){let a=t4;if(!i)return XC(e,a.runs,a.numRleValues);e=Rc(e,a.runs,a.numRleValues),r=ym(e)}else r=ym(e);break;case ce.RLE:r=jC(e,t4.runs,t4.numRleValues);break;case ce.NONE:r=OC(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t4.logicalLevelTechnique1}`)}return i?ua(r,i,0n):r}function h1(e,t4,i){let r;switch(t4.logicalLevelTechnique1){case ce.DELTA:if(t4.logicalLevelTechnique2===ce.RLE){let a=t4;r=xm(Rc(e,a.runs,a.numRleValues))}else r=xm(e);break;case ce.RLE:r=Rc(e,t4.runs,t4.numRleValues);break;case ce.NONE:r=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t4.logicalLevelTechnique1}`)}return i?ua(r,i,0n):r}function EP(e,t4,i){switch(t4.logicalLevelTechnique1){case ce.DELTA:if(t4.logicalLevelTechnique2===ce.RLE){let r=t4;e=r1(e,r.runs,r.numRleValues)}return $C(e),e;case ce.RLE:return CP(e,t4,i);case ce.NONE:return e;default:throw Error(`The specified Logical level technique is not supported: ${t4.logicalLevelTechnique1}`)}}function SP(e,t4){if(t4.logicalLevelTechnique1===ce.DELTA&&t4.logicalLevelTechnique2===ce.NONE)return ZC(e);if(t4.logicalLevelTechnique1===ce.RLE&&t4.logicalLevelTechnique2===ce.NONE){let i=t4;return WC(e,i.runs,i.numRleValues)}if(t4.logicalLevelTechnique1===ce.NONE&&t4.logicalLevelTechnique2===ce.NONE){NC(e);let i=new Uint32Array(t4.numValues+1);return i[0]=0,i.set(e,1),i}if(t4.logicalLevelTechnique1===ce.DELTA&&t4.logicalLevelTechnique2===ce.RLE){let i=t4,r=qC(e,i.runs,i.numRleValues);return Ud(r),new Uint32Array(r)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function Jl(e,t4,i,r,a="int32"){let s=e.logicalLevelTechnique1;if(s===ce.RLE)return e.runs===1?Ue.CONST:Ue.FLAT;if(s!==ce.DELTA||e.logicalLevelTechnique2!==ce.RLE)return e.numValues===1?Ue.CONST:Ue.FLAT;let n=t4 instanceof Fi?t4.size():t4,o=e;if(o.numRleValues!==n)return Ue.FLAT;if(o.runs===1)return Ue.SEQUENCE;if(o.runs!==2)return e.numValues===1?Ue.CONST:Ue.FLAT;let l=r.get();if(e.physicalLevelTechnique===vi.VARINT)return DP(i,r,a)?Ue.SEQUENCE:e.numValues===1?Ue.CONST:Ue.FLAT;let u=r.get(),h=new Int32Array(i.buffer,i.byteOffset+u,4);return r.set(l),h[2]===2&&h[3]===2?Ue.SEQUENCE:e.numValues===1?Ue.CONST:Ue.FLAT}function DP(e,t4,i){let r=new e1(t4.get());if(i==="int64"){let s=jd(e,r,4);return s[2]===2n&&s[3]===2n}let a=Mt(e,r,4);return a[2]===2&&a[3]===2}function CP(e,t4,i){return i?UC(e,t4.runs,t4.numRleValues):r1(e,t4.runs,t4.numRleValues)}var c1=class extends Kl{getValueFromBuffer(e){return this.dataBuffer[e]}},d1=class extends J0{constructor(e,t4,i,r,a){super(e,a?BigInt64Array.of(t4):BigUint64Array.of(t4),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}};function qd(e,t4,i){return{x:wm(e,t4)-i,y:wm(e>>1,t4)-i}}function wm(e,t4){let i=0;for(let r=0;r<t4;r++)i|=(e&1<<2*r)>>r;return i}var At;(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"})(At||(At={}));var PP;(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"})(PP||(PP={}));var ha;(function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"})(ha||(ha={}));function AP(e){let t4=Array(e.numGeometries),i=1,r=1,a=1,s=0,n=0,o=0,l=e.mortonSettings,u=e.topologyVector,h=u.geometryOffsets,c=u.partOffsets,d=u.ringOffsets,p=e.vertexOffsets,f=!p||p.length===0,m=e.containsPolygonGeometry(),g=e.vertexBuffer;for(let _=0;_<e.numGeometries;_++){let y=e.geometryType(_);switch(y){case At.POINT:{let x,v;if(f)x=g[n++],v=g[n++];else if(e.vertexBufferType===ha.MORTON){let w=g[p[o++]],b=qd(w,l.numBits,l.coordinateShift);x=b.x,v=b.y}else{let w=p[o++]*2;x=g[w],v=g[w+1]}t4[s++]=[[new C(x,v)]],h&&a++,c&&i++,d&&r++}break;case At.MULTIPOINT:{let x=h[a]-h[a-1];a++;let v;if(f){v=Array(x);for(let w=0;w<x;w++){let b=g[n++],T=g[n++];v[w]=new C(b,T)}}else v=Lr(e.vertexBufferType,g,p,o,x,false,l),o+=x;t4[s++]=v.map(w=>[w]),i+=x,r+=x}break;case At.LINESTRING:{let x;m?(x=d[r]-d[r-1],r++):x=c[i]-c[i-1],i++;let v;f?(v=ba(g,n,x,false),n+=x*2):(v=Lr(e.vertexBufferType,g,p,o,x,false,l),o+=x),t4[s++]=[v],h&&a++}break;case At.POLYGON:{let x=c[i]-c[i-1];i++;let v=Array(x-1),w,b=d[r]-d[r-1];if(r++,f){w=ba(g,n,b,true),n+=b*2;for(let T=0;T<v.length;T++)b=d[r]-d[r-1],r++,v[T]=ba(g,n,b,true),n+=b*2}else{w=Lr(e.vertexBufferType,g,p,o,b,true,l),o+=b;for(let T=0;T<v.length;T++)b=d[r]-d[r-1],r++,v[T]=Lr(e.vertexBufferType,g,p,o,b,true,l),o+=b}t4[s++]=[w].concat(v),h&&a++}break;case At.MULTILINESTRING:{let x=h[a]-h[a-1];a++;let v=Array(x);for(let w=0;w<x;w++){let b;if(m?(b=d[r]-d[r-1],r++):b=c[i]-c[i-1],i++,f)v[w]=ba(g,n,b,false),n+=b*2;else{let T=Lr(e.vertexBufferType,g,p,o,b,false,l);v[w]=T,o+=b}}t4[s++]=v}break;case At.MULTIPOLYGON:{let x=h[a]-h[a-1];a++;let v=Array(x);for(let w=0;w<x;w++){let b=c[i]-c[i-1];i++;let T,P=Array(b-1),E=d[r]-d[r-1];r++,f?(T=ba(g,n,E,true),n+=E*2):(T=Lr(e.vertexBufferType,g,p,o,E,true,l),o+=E);for(let I=0;I<P.length;I++){let R=d[r]-d[r-1];r++,f?(P[I]=ba(g,n,R,true),n+=R*2):(P[I]=Lr(e.vertexBufferType,g,p,o,R,true,l),o+=R)}v[w]=[T].concat(P)}t4[s++]=v.flat()}break;default:throw Error(`The specified geometry type (${y}) is currently not supported.`)}}return t4}function Lr(e,t4,i,r,a,s,n){return e===ha.MORTON?MP(t4,i,r,a,s,n):IP(t4,i,r,a,s)}function ba(e,t4,i,r){let a=Array(r?i+1:i);for(let s=0;s<i*2;s+=2){let n=e[t4+s],o=e[t4+s+1];a[s/2]=new C(n,o)}return r&&(a[a.length-1]=a[0]),a}function IP(e,t4,i,r,a){let s=Array(a?r+1:r);for(let n=0;n<r*2;n+=2){let o=t4[i+n/2]*2,l=e[o],u=e[o+1];s[n/2]=new C(l,u)}return a&&(s[s.length-1]=s[0]),s}function MP(e,t4,i,r,a,s){let n=Array(a?r+1:r);for(let o=0;o<r;o++){let l=e[t4[i+o]],u=qd(l,s.numBits,s.coordinateShift);n[o]=new C(u.x,u.y)}return a&&(n[n.length-1]=n[0]),n}var p1=class{constructor(e,t4,i,r,a){this._vertexBufferType=e,this._topologyVector=t4,this._vertexOffsets=i,this._vertexBuffer=r,this._mortonSettings=a}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t4=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t4],this.vertexBuffer[t4+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let i=this.vertexOffsets[e],r=this.vertexBuffer[i],a=qd(r,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}let t4=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t4],this.vertexBuffer[t4+1]]}getGeometries(){return AP(this)}get mortonSettings(){return this._mortonSettings}};function FP(e,t4,i,r,a){return new f1(e,t4,ha.VEC_2,i,r,a)}function zP(e,t4,i,r,a,s){return new f1(e,t4,ha.MORTON,i,r,a,s)}var f1=class extends p1{constructor(e,t4,i,r,a,s,n){super(i,r,a,s,n),this._numGeometries=e,this._geometryType=t4}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===At.POLYGON||this._geometryType===At.MULTIPOLYGON}containsSingleGeometryType(){return true}};function m1(e,t4,i,r){return new g1(ha.VEC_2,e,t4,i,r)}function RP(e,t4,i,r,a){return new g1(ha.MORTON,e,t4,i,r,a)}var g1=class extends p1{constructor(e,t4,i,r,a,s){super(e,i,r,a,s),this._geometryTypes=t4}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===At.POLYGON||this.geometryType(e)===At.MULTIPOLYGON)return true;return false}containsSingleGeometryType(){return false}},_1=class{constructor(e,t4,i,r){this._triangleOffsets=e,this._indexBuffer=t4,this._vertexBuffer=i,this._topologyVector=r}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let e=new Uint32Array(this.numGeometries);for(let t4=0;t4<this.numGeometries;t4++)e[t4]=this.geometryType(t4);return m1(e,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function Tm(e,t4,i,r,a,s){return new kP(e,t4,i,r,a,s)}var kP=class extends _1{constructor(e,t4,i,r,a,s){super(i,r,a,s),this._numGeometries=e,this._geometryType=t4}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return true}};function Em(e,t4,i,r,a){return new LP(e,t4,i,r,a)}var LP=class extends _1{constructor(e,t4,i,r,a){super(t4,i,r,a),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return false}};function BP(e,t4,i,r,a){let s=Xe(e,i),n=Jl(s,r,e,i),o,l,u,h;if(n===Ue.CONST){let x=Gd(e,i,s),v,w,b,T;for(let P=0;P<t4-1;P++){let E=Xe(e,i);switch(E.physicalStreamType){case ut.LENGTH:switch(E.logicalStreamType.lengthType){case _t.GEOMETRIES:v=xr(e,i,E);break;case _t.PARTS:w=xr(e,i,E);break;case _t.RINGS:b=xr(e,i,E);break;case _t.TRIANGLES:T=xr(e,i,E)}break;case ut.OFFSET:switch(E.logicalStreamType.offsetType){case or.VERTEX:o=Et(e,i,E);break;case or.INDEX:h=Et(e,i,E)}break;case ut.DATA:if(Ot.VERTEX===E.logicalStreamType.dictionaryType)l=gl(e,i,E,a);else{let I=E;u={numBits:I.numBits,coordinateShift:I.coordinateShift},l=Et(e,i,E,a)}}}return h?v!==void 0||w!==void 0?Tm(r,x,T,h,l,{geometryOffsets:v,partOffsets:w,ringOffsets:b}):Tm(r,x,T,h,l):u===void 0?FP(r,x,{geometryOffsets:v,partOffsets:w,ringOffsets:b},o,l):zP(r,x,{geometryOffsets:v,partOffsets:w,ringOffsets:b},o,l,u)}let c=Et(e,i,s),d,p,f,m;for(let x=0;x<t4-1;x++){let v=Xe(e,i);switch(v.physicalStreamType){case ut.LENGTH:switch(v.logicalStreamType.lengthType){case _t.GEOMETRIES:d=Et(e,i,v);break;case _t.PARTS:p=Et(e,i,v);break;case _t.RINGS:f=Et(e,i,v);break;case _t.TRIANGLES:m=xr(e,i,v)}break;case ut.OFFSET:switch(v.logicalStreamType.offsetType){case or.VERTEX:o=Et(e,i,v);break;case or.INDEX:h=Et(e,i,v)}break;case ut.DATA:if(Ot.VERTEX===v.logicalStreamType.dictionaryType)l=gl(e,i,v,a);else{let w=v;u={numBits:w.numBits,coordinateShift:w.coordinateShift},l=Et(e,i,v,a)}}}let g,_,y;return d?(g=Yu(c,d,2),p&&f?(_=Sm(c,g,p,false),y=$P(c,g,_,f)):p&&(_=OP(c,g,p))):p&&f?(_=Yu(c,p,1),y=Sm(c,_,f,true)):p&&(_=Yu(c,p,0)),h&&!_?Em(c,m,h,l):h?Em(c,m,h,l,{geometryOffsets:g,partOffsets:_,ringOffsets:y}):u===void 0?m1(c,{geometryOffsets:g,partOffsets:_,ringOffsets:y},o,l):RP(c,{geometryOffsets:g,partOffsets:_,ringOffsets:y},o,l,u)}function Yu(e,t4,i){let r=new Uint32Array(e.length+1),a=0;r[0]=a;let s=0;for(let n=0;n<e.length;n++)a=r[n+1]=a+(e[n]>i?t4[s++]:1);return r}function Sm(e,t4,i,r){let a=new Uint32Array(t4[t4.length-1]+1),s=0;a[0]=s;let n=1,o=0;for(let l=0;l<e.length;l++){let u=e[l],h=t4[l+1]-t4[l];if(u===5||u===2||r&&(u===4||u===1))for(let c=0;c<h;c++)s=a[n++]=s+i[o++];else for(let c=0;c<h;c++)a[n++]=++s}return a}function OP(e,t4,i){let r=new Uint32Array(t4[t4.length-1]+1),a=0;r[0]=a;let s=1,n=0;for(let o=0;o<e.length;o++){let l=e[o],u=t4[o+1]-t4[o];if(l===4||l===1)for(let h=0;h<u;h++)a=r[s++]=a+i[n++];else for(let h=0;h<u;h++)r[s++]=++a}return r}function $P(e,t4,i,r){let a=new Uint32Array(i[i.length-1]+1),s=0;a[0]=s;let n=1,o=1,l=0;for(let u=0;u<e.length;u++){let h=e[u],c=t4[u+1]-t4[u];if(h!==0&&h!==3)for(let d=0;d<c;d++){let p=i[n]-i[n-1];n++;for(let f=0;f<p;f++)s=a[o++]=s+r[l++]}else for(let d=0;d<c;d++)a[o++]=++s,n++}return a}var VP=class extends la{constructor(e,t4,i){super(e,t4.getBuffer(),i),this.dataVector=t4}getValueFromBuffer(e){return this.dataVector.get(e)}},jP=class extends Kl{getValueFromBuffer(e){return this.dataBuffer[e]}},y1=class extends la{constructor(e,t4,i,r){super(e,r?BigInt64Array.of(t4):BigUint64Array.of(t4),i)}getValueFromBuffer(e){return this.dataBuffer[0]}},Wd=class extends la{constructor(e,t4,i,r){super(e,i,r),this.offsetBuffer=t4}},Dm=class extends Wd{constructor(e,t4,i,r){super(e,t4,i,r??t4.length-1)}getValueFromBuffer(e){let t4=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return Nd(this.dataBuffer,t4,i)}},Va=class extends Wd{constructor(e,t4,i,r,a){super(e,i,r,a??t4.length),this.indexBuffer=t4,this.indexBuffer=t4}getValueFromBuffer(e){let t4=this.indexBuffer[e],i=this.offsetBuffer[t4],r=this.offsetBuffer[t4+1];return Nd(this.dataBuffer,i,r)}};function UP(e,t4){let i=0;for(let r=0;r<t4.length;r++){let a=t4[r];a===255?(i++,r++):i+=e[a]}return i}function NP(e,t4,i){let r=new Uint32Array(t4.length);for(let n=1;n<t4.length;n++)r[n]=r[n-1]+t4[n-1];let a=new Uint8Array(UP(t4,i)),s=0;for(let n=0;n<i.length;n++){let o=i[n];if(o===255)n++,a[s++]=i[n];else{let l=t4[o],u=r[o];for(;l-- >0;)a[s++]=e[u++]}}return a}var v1=class extends Wd{constructor(e,t4,i,r,a,s,n,o){super(e,i,r,n??t4.length),this.indexBuffer=t4,this.symbolOffsetBuffer=a,this.symbolTableBuffer=s,this.sharedDictionaryCache=o}getValueFromBuffer(e){var a;this.decodedDictionary??(this.decodedDictionary=(a=this.sharedDictionaryCache)==null?void 0:a.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let t4=this.indexBuffer[e],i=this.offsetBuffer[t4],r=this.offsetBuffer[t4+1];return Nd(this.decodedDictionary,i,r)}decodeDictionary(){return this.symbolLengthBuffer??(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),NP(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(e){let t4=new Uint32Array(e.length-1),i=e[0];for(let r=1;r<e.length;r++){let a=e[r];t4[r-1]=a-i,i=a}return t4}};function x1(e,t4,i,r,a){let s,n,o,l,u,h=a,c,d;for(let p=0;p<r;p++){let f=Xe(t4,i);switch(f.physicalStreamType){case ut.PRESENT:{let m=new Fi(rs(t4,f.numValues,f.byteLength,i),f.numValues);h=a??m;break}case ut.OFFSET:n=Et(t4,i,f,void 0,h);break;case ut.LENGTH:{let m=xr(t4,i,f);_t.DICTIONARY===f.logicalStreamType.lengthType?s=m:_t.SYMBOL===f.logicalStreamType.lengthType?l=m:c=m;break}case ut.DATA:{let m=t4.subarray(i.get(),i.get()+f.byteLength);i.add(f.byteLength);let g=f.logicalStreamType.dictionaryType;Ot.FSST===g?u=m:Ot.SINGLE===g||Ot.SHARED===g?o=m:Ot.NONE===g&&(d=m);break}}}return GP(e,u,n,s,o,l,h)??ZP(e,o,n,s,h)??qP(e,c,d,n,h)}function GP(e,t4,i,r,a,s,n){if(t4){if(!i||!r||!a||!s)throw Error(`Incomplete FSST dictionary string column "${e}"`);return new v1(e,i,r,a,s,t4,n)}}function ZP(e,t4,i,r,a){if(t4){if(!i||!r)throw Error(`Incomplete dictionary string column "${e}"`);return a?new Va(e,i,r,t4,a):new Va(e,i,r,t4)}}function qP(e,t4,i,r,a){if(t4&&i){if(r)return a?new Va(e,r,t4,i,a):new Va(e,r,t4,i);if(a&&a.size()!==t4.length-1){let s=new Uint32Array(a.size()),n=0;for(let o=0;o<a.size();o++)a.get(o)?s[o]=n++:s[o]=0;return new Va(e,s,t4,i,a)}return a?new Dm(e,t4,i,a):new Dm(e,t4,i)}}function WP(e,t4,i,r){let a,s,n,o,l=false;for(;!l;){let p=Xe(e,t4);switch(p.physicalStreamType){case ut.LENGTH:_t.DICTIONARY===p.logicalStreamType.lengthType?a=xr(e,t4,p):n=xr(e,t4,p);break;case ut.DATA:Ot.SINGLE===p.logicalStreamType.dictionaryType||Ot.SHARED===p.logicalStreamType.dictionaryType?(s=e.subarray(t4.get(),t4.get()+p.byteLength),l=true):o=e.subarray(t4.get(),t4.get()+p.byteLength),t4.add(p.byteLength)}}if(i.type!=="complexType")throw Error(`Shared dictionary column ${i.name} must be a complex (struct) column.`);if(!a||!s)throw Error(`Incomplete shared dictionary for column "${i.name}"`);let u=i.complexType.children,h=[],c=o?{}:void 0,d=0;for(let p of u){let f=Mt(e,t4,1)[0];if(f===0)continue;let m=p.name?`${i.name}${p.name}`:i.name;if(p.type!=="scalarField"||p.scalarField.physicalType!==Ee.STRING)throw Error("Currently only scalar string fields are implemented for a struct.");if(f>1&&!p.nullable||f===1&&p.nullable)throw Error(`The number of streams for the child field ${p.name} does not match its nullability. nullibilty: ${p.nullable}, numStreams: ${f}`);let g;if(p.nullable){let y=Xe(e,t4);g=new Fi(rs(e,y.numValues,y.byteLength,t4),y.numValues)}let _=Et(e,t4,Xe(e,t4),void 0,g);if(o){if(!n)throw Error(`Incomplete shared FSST dictionary for column "${m}"`);h[d++]=new v1(m,_,a,s,n,o,g,c)}else h[d++]=new Va(m,_,a,s,g)}return h}var Cm=class extends la{constructor(e,t4,i){super(e,new Uint8Array,i??t4.length),this.values=t4}getValueFromBuffer(e){return this.values[e]}},lr;(function(e){e[e.STRING=1]="STRING",e[e.INT32=2]="INT32",e[e.UINT32=4]="UINT32",e[e.INT64=8]="INT64",e[e.UINT64=16]="UINT64",e[e.FLOAT=32]="FLOAT",e[e.DOUBLE=64]="DOUBLE",e[e.PRESENCE=128]="PRESENCE"})(lr||(lr={}));var Gr;(function(e){e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e[e.START_MAP=2]="START_MAP",e[e.START_LIST=3]="START_LIST",e[e.COUNT=4]="COUNT"})(Gr||(Gr={}));function HP(e,t4,i,r){let a=XP(i);if(r===0)return a.map(h=>new Cm(h,[]));let s=YP(e,t4,r),n=(s.presentStream?s.presentCount:s.lengthStream.length)/a.length,o=[],l=0,u=0;for(let h=0;h<a.length;h++){let c=tA(s,h,n,l,u);o.push(new Cm(a[h],c.value,c.nullabilityBuffer)),l=c.countsEnd,u=c.valuesEnd}return o}function XP(e){let t4=e.type==="complexType"?e.complexType.children:void 0;return!t4||t4.length===0?[e.name]:t4.map(i=>e.name+(i.name??""))}function YP(e,t4,i){let r=e[t4.get()];t4.add(1);let a=Et(e,t4,Xe(e,t4)),s=i-1,n=[];r&lr.STRING&&(s-=KP(e,t4,n)),s-=JP(e,t4,r,n),s-=QP(e,t4,r,n);let o,l=0;if(r&lr.PRESENCE){let h=eA(e,t4);o=h.value,l=h.count,s--}let u=new Uint32Array;if(s>0&&(u=Et(e,t4,Xe(e,t4)),s--),s!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${s}`);return{lengthStream:a,dictionary:n,presentStream:o,presentCount:l,flattenedValues:u}}function KP(e,t4,i){let r=e[t4.get()];t4.add(1);let a=x1("",e,t4,r);if(a)for(let s=0;s<a.size;s++)i.push(a.getValue(s));return r}function JP(e,t4,i,r){let a=0;return i&lr.INT32?(Ra(r,gl(e,t4,Xe(e,t4))),a++):i&lr.INT64&&(Ra(r,l1(e,t4,Xe(e,t4))),a++),i&lr.UINT32?(Ra(r,Et(e,t4,Xe(e,t4))),a++):i&lr.UINT64&&(Ra(r,Zd(e,t4,Xe(e,t4))),a++),a}function QP(e,t4,i,r){let a=0;return i&lr.FLOAT&&(Ra(r,a1(e,t4,Xe(e,t4).numValues)),a++),i&lr.DOUBLE&&(Ra(r,s1(e,t4,Xe(e,t4).numValues)),a++),a}function eA(e,t4){let i=Xe(e,t4);if(i.physicalStreamType!==ut.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${i.physicalStreamType}`);let r=i.numValues,a=t4.get(),s=new Fi(rs(e,r,i.byteLength,t4),r);return t4.set(a+i.byteLength),{value:s,count:r}}function tA(e,t4,i,r,a){let{lengthStream:s,flattenedValues:n,presentStream:o,dictionary:l}=e,u=t4*i,h=i,c;if(o){c=new Fi(new Uint8Array(Math.ceil(i/8)),i),h=0;for(let y=0;y<i;y++)o.get(u+y)&&(c.set(y,true),h++)}let d=r+h;if(d>s.length)throw Error("Merged map counts underflow while decoding child streams");let p=Array(i),f=r,m=a;for(let y=0;y<i;y++){if(o&&!o.get(u+y)){p[y]=null;continue}let x=m+s[f++];if(x>n.length)throw Error("Map value stream underflow while decoding feature payload");let v=iA(n,m,x,l);p[y]=v.value,m=v.nextIndex}let g=0;for(let y=r;y<d;y++)g+=s[y];let _=a+g;if(m!==_)throw Error("Unused flattened map values remain after decode");return{value:p,nullabilityBuffer:c,countsEnd:d,valuesEnd:_}}function iA(e,t4,i,r){return i-t4===1||e[t4]===Gr.START_LIST?Hd(e,t4,i,r):b1(e,t4,i,r)}function b1(e,t4,i,r){let a=Object.create(null),s=t4;for(;s<i;){let n=w1(e[s++],r);if(typeof n!="string")throw Error(`Map key dictionary index does not resolve to a string: ${n}`);let o=Hd(e,s,i,r);a[n]=o.value,s=o.nextIndex}return{value:a,nextIndex:s}}function Hd(e,t4,i,r){if(t4>=i)throw Error("Unexpected end of map value stream");let a=e[t4];if(a===Gr.FALSE)return{value:false,nextIndex:t4+1};if(a===Gr.TRUE)return{value:true,nextIndex:t4+1};if(a===Gr.START_MAP){let s=Pm(e,t4,i);return{value:b1(e,t4+2,s,r).value,nextIndex:s}}if(a===Gr.START_LIST){let s=Pm(e,t4,i),n=[],o=t4+2;for(;o<s;){let l=Hd(e,o,s,r);n.push(l.value),o=l.nextIndex}return{value:n,nextIndex:s}}return{value:w1(a,r),nextIndex:t4+1}}function Pm(e,t4,i){if(t4+1>=i)throw Error("Missing length for nested map/list payload");let r=e[t4+1];if(r<2)throw Error(`Invalid nested payload length: ${r}`);let a=t4+r;if(a>i)throw Error("Nested payload exceeds containing payload bounds");return a}function w1(e,t4){let i=e-Gr.COUNT;if(i<0||i>=t4.length)throw Error(`Scalar dictionary index out of range: ${e}`);return t4[i]}function Ra(e,t4){for(let i of t4)e.push(i)}function rA(e,t4,i,r,a,s){var n;return i.type==="scalarType"?aA(r,e,t4,a,i.scalarType,i):((n=i.complexType)==null?void 0:n.physicalType)===Sr.MAP?HP(e,t4,i,r):r===0?null:WP(e,t4,i)}function aA(e,t4,i,r,a,s){let n;if(e===0)return null;if(s.nullable){let l=Xe(t4,i),u=l.numValues,h=i.get(),c=rs(t4,u,l.byteLength,i);i.set(h+l.byteLength),n=new Fi(c,l.numValues)}let o=n??r;switch(a.physicalType){case Ee.UINT_32:case Ee.INT_32:return uA(t4,i,s,a,o);case Ee.STRING:{let l=s.nullable?e-1:e;return x1(s.name,t4,i,l,n)??null}case Ee.BOOLEAN:return sA(t4,i,s,r,o);case Ee.UINT_64:case Ee.INT_64:return lA(t4,i,s,o,a);case Ee.FLOAT:return nA(t4,i,s,o);case Ee.DOUBLE:return oA(t4,i,s,o);default:throw Error(`The specified data type for the field is currently not supported: ${a}`)}}function sA(e,t4,i,r,a){let s=Xe(e,t4),n=s.numValues,o=t4.get(),l=Dn(a)?a:void 0,u=rs(e,n,s.byteLength,t4,l);t4.set(o+s.byteLength);let h=new Fi(u,n);return new VP(i.name,h,a)}function nA(e,t4,i,r){let a=Xe(e,t4),s=Dn(r)?r:void 0,n=a1(e,t4,a.numValues,s);return new jP(i.name,n,r)}function oA(e,t4,i,r){let a=Xe(e,t4),s=Dn(r)?r:void 0,n=s1(e,t4,a.numValues,s);return new Ld(i.name,n,r)}function lA(e,t4,i,r,a){let s=Xe(e,t4),n=Jl(s,r,e,t4,"int64"),o=a.physicalType===Ee.INT_64;if(n===Ue.FLAT){let u=Dn(r)?r:void 0,h=o?l1(e,t4,s,u):Zd(e,t4,s,u);return new c1(i.name,h,r)}if(n===Ue.SEQUENCE){let u=o1(e,t4,s);return new d1(i.name,u[0],u[1],s.numRleValues,o)}let l=o?xP(e,t4,s):u1(e,t4,s);return new y1(i.name,l,r,o)}function uA(e,t4,i,r,a){let s=Xe(e,t4),n=Jl(s,a,e,t4),o=r.physicalType===Ee.INT_32;if(n===Ue.FLAT){let u=Dn(a)?a:void 0,h=o?gl(e,t4,s,void 0,u):Et(e,t4,s,void 0,u);return new kd(i.name,h,a)}if(n===Ue.SEQUENCE){let u=n1(e,t4,s);return new Bd(i.name,u[0],u[1],s.numRleValues,o)}let l=o?_P(e,t4,s):Gd(e,t4,s);return new Od(i.name,l,a,o)}function Dn(e){return e instanceof Fi}const mt={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function T1(e){switch(e){case mt.ID:case mt.ID|mt.ID_NULLABLE:case mt.ID|mt.ID_LONG:case mt.ID|mt.ID_LONG|mt.ID_NULLABLE:return{nullable:(e&mt.ID_NULLABLE)!==0,columnScope:Bs.FEATURE,type:"scalarType",scalarType:{longID:(e&mt.ID_LONG)!==0,type:"logicalType",logicalType:Q0.ID}};case mt.GEOMETRY:return{nullable:false,columnScope:Bs.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Sr.GEOMETRY,children:[]}};case mt.STRUCT:return{nullable:false,columnScope:Bs.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Sr.STRUCT,children:[]}};case mt.MAP:return{nullable:true,columnScope:Bs.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Sr.MAP,children:[]}};default:return fA(e)}}function hA(e){return e>=mt.SCALAR_BASE}function E1(e){return e===mt.STRUCT||e===mt.MAP}function cA(e){if(e.type==="scalarType"){let t4=e.scalarType;if(t4.type==="physicalType")switch(t4.physicalType){case Ee.BOOLEAN:case Ee.INT_8:case Ee.UINT_8:case Ee.INT_32:case Ee.UINT_32:case Ee.INT_64:case Ee.UINT_64:case Ee.FLOAT:case Ee.DOUBLE:return false;case Ee.STRING:return true;default:return false}if(t4.type==="logicalType")return false}else if(e.type==="complexType"){let t4=e.complexType;if(t4.type==="physicalType")switch(t4.physicalType){case Sr.GEOMETRY:case Sr.STRUCT:case Sr.MAP:return true;default:return false}}return console.warn("Unexpected column type in hasStreamCount",e),false}function dA(e){var t4;return e.type==="scalarType"&&((t4=e.scalarType)==null?void 0:t4.type)==="logicalType"&&e.scalarType.logicalType===Q0.ID}function pA(e){var t4;return e.type==="complexType"&&((t4=e.complexType)==null?void 0:t4.type)==="physicalType"&&e.complexType.physicalType===Sr.GEOMETRY}function fA(e){let t4;switch(e){case 10:case 11:t4=Ee.BOOLEAN;break;case 12:case 13:t4=Ee.INT_8;break;case 14:case 15:t4=Ee.UINT_8;break;case 16:case 17:t4=Ee.INT_32;break;case 18:case 19:t4=Ee.UINT_32;break;case 20:case 21:t4=Ee.INT_64;break;case 22:case 23:t4=Ee.UINT_64;break;case 24:case 25:t4=Ee.FLOAT;break;case 26:case 27:t4=Ee.DOUBLE;break;case 28:case 29:t4=Ee.STRING;break;default:return null}return{nullable:!!(e&1),columnScope:Bs.FEATURE,type:"scalarType",scalarType:{longID:false,type:"physicalType",physicalType:t4}}}const mA=new TextDecoder,Am="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function Xd(e,t4){let i=Mt(e,t4,1)[0];if(i===0)return"";let r=t4.get(),a=r+i,s=e.subarray(r,a);return t4.add(i),mA.decode(s)}function gA(e){let t4=e.name,i=e.nullable;return e.type==="scalarType"?{type:"scalarField",scalarField:e.scalarType,name:t4,nullable:i}:{type:"complexField",complexField:e.complexType,name:t4,nullable:i}}function S1(e,t4){let i=Mt(e,t4,1)[0]>>>0,r=i>=mt.SCALAR_BASE?T1(i):null;if(!r)throw Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let a={...r,name:Xd(e,t4)};if(a.type==="complexType"&&E1(i)){let s=a.complexType,n=Mt(e,t4,1)[0]>>>0;s.children=Array(n);for(let o=0;o<n;o++)s.children[o]=S1(e,t4)}return gA(a)}function _A(e,t4){let i=Mt(e,t4,1)[0]>>>0,r=T1(i);if(!r)throw Error(`Unsupported column type code ${i}. Supported: ${Am}`);let a;if(hA(i))a=Xd(e,t4);else if(i<mt.GEOMETRY)a="id";else if(i===mt.GEOMETRY)a="geometry";else throw Error(`Unsupported column type code ${i}. Supported: ${Am}`);let s={...r,name:a};if(s.type==="complexType"&&E1(i)){let n=Mt(e,t4,1)[0]>>>0,o=s.complexType;o.children=Array(n);for(let l=0;l<n;l++)o.children[l]=S1(e,t4)}return s}function yA(e,t4){let i={};i.featureTables=[];let r={};if(r.name=Xd(e,t4),r.name.length===0)throw Error("Missing layer name");let a=Mt(e,t4,1)[0]>>>0,s=Mt(e,t4,1)[0]>>>0;r.columns=Array(s);for(let n=0;n<s;n++)r.columns[n]=_A(e,t4);return i.featureTables.push(r),[i,a]}function vA(e,t4,i=true){let r=new e1(0),a=[];for(;r.get()<e.length;){let s=Mt(e,r,1)[0]>>>0,n=r.get()+s;if(n>e.length)throw Error(`Block overruns tile: ${n} > ${e.length}`);let o=Mt(e,r,1)[0]>>>0;if(o!==1&&o!==2){r.set(n);continue}let[l,u]=yA(e,r),h=l.featureTables[0],c=null,d=null,p=[],f=0;for(let g of h.columns){let _=g.name;if(dA(g)){let y=null;if(g.nullable){let v=Xe(e,r),w=r.get(),b=rs(e,v.numValues,v.byteLength,r);r.set(w+v.byteLength),y=new Fi(b,v.numValues)}let x=Xe(e,r);f=y?y.size():x.decompressedCount,c=xA(e,g,r,_,x,y??f,i)}else if(pA(g)){let y=Mt(e,r,1)[0];if(f===0){let x=r.get();f=Xe(e,r).decompressedCount,r.set(x)}d=BP(e,y,r,f,t4)}else{let y=cA(g)?Mt(e,r,1)[0]:1;if(y===0)continue;let x=rA(e,r,g,y,f);if(x)if(Array.isArray(x))for(let v of x)p.push(v);else p.push(x)}}let m=new ND(h.name,d,c,p,u);a.push(m),r.set(n)}return a}function xA(e,t4,i,r,a,s,n=false){var h;let o=(h=t4.scalarType)!=null&&h.longID?Ee.UINT_64:Ee.UINT_32,l=typeof s=="number"?void 0:s,u=Jl(a,s,e,i,o===Ee.UINT_64?"int64":"int32");if(o===Ee.UINT_32)switch(u){case Ue.FLAT:return new kd(r,Et(e,i,a,void 0,l),s);case Ue.SEQUENCE:{let c=n1(e,i,a);return new Bd(r,c[0],c[1],a.numRleValues,false)}case Ue.CONST:return new Od(r,Gd(e,i,a),s,false)}switch(u){case Ue.FLAT:return n?new Ld(r,yP(e,i,a,l),s):new c1(r,Zd(e,i,a,l),s);case Ue.SEQUENCE:{let c=o1(e,i,a);return new d1(r,c[0],c[1],a.numRleValues,false)}case Ue.CONST:return new y1(r,u1(e,i,a),s,false)}throw Error("Vector type not supported for id column.")}var bA=class{constructor(e,t4){var i;switch(this._featureData=e,this.properties=this._featureData.properties||{},(i=this._featureData.geometry)==null?void 0:i.type){case At.POINT:case At.MULTIPOINT:this.type=1;break;case At.LINESTRING:case At.MULTILINESTRING:this.type=2;break;case At.POLYGON:case At.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t4,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t4 of this._featureData.geometry.coordinates){let i=[];for(let r of t4)i.push(new C(r.x,r.y));e.push(i)}return e}},wA=class{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new bA(this.features[e],this.extent)}},TA=class{constructor(e){this.layers={};let t4=vA(new Uint8Array(e));this.layers=t4.reduce((i,r)=>({...i,[r.name]:new wA(r)}),{})}},EA=class{constructor(e,t4){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Bh(k,16,0),this.grid3D=new Bh(k,16,0),this.featureIndexArray=new Zy,this.promoteId=t4}insert(e,t4,i,r,a,s){let n=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,a);let o=s?this.grid3D:this.grid;for(let l of t4){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(n,u[0],u[1],u[2],u[3])}}loadVTLayers(){if(!this.vtLayers){switch(this.encoding){case"mlt":this.vtLayers=new TA(this.rawTileData).layers;break;default:this.vtLayers=new KT(new F0(this.rawTileData)).layers}this.sourceLayerCoder=new UD(this.vtLayers?Object.keys(this.vtLayers).sort():[Bo])}return this.vtLayers}query(e,t4,i,r){this.loadVTLayers();let a=e.params,s=k/e.tileSize/e.scale,n=Qs(a.filter,"queryRenderedFeatures filter",a.globalState),o=e.queryGeometry,l=e.queryPadding*s,u=Ai.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=Ai.fromPoints(e.cameraQueryGeometry).expandBy(l),d=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(m,g,_,y)=>M2(e.cameraQueryGeometry,m-l,g-l,_+l,y+l));for(let m of d)h.push(m);h.sort(DA);let p={},f;for(let m of h){if(m===f)continue;f=m;let g=this.featureIndexArray.get(m),_=null;this.loadMatchingFeature(p,g.bucketIndex,g.sourceLayerIndex,g.featureIndex,n,a.layers,a.availableImages,t4,i,r,(y,x,v)=>(_||(_=na(y)),x.queryIntersectsFeature({queryGeometry:o,feature:y,featureState:v,geometry:_,zoom:this.z,transform:e.transform,pixelsToTileUnits:s,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return p}loadMatchingFeature(e,t4,i,r,a,s,n,o,l,u,h){let c=this.bucketLayerIDs[t4];if(s&&!c.some(m=>s.has(m)))return;let d=this.sourceLayerCoder.decode(i),p=this.vtLayers[d].feature(r);if(a.needGeometry){let m=oa(p,true);if(!a.filter(new Fe(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!a.filter(new Fe(this.tileID.overscaledZ),p))return;let f=this.getId(p,d);for(let m of c){if(s&&!s.has(m))continue;let g=o[m];if(!g)continue;let _={};f&&u&&(_=u.getState(g.sourceLayer||"_geojsonTileLayer",f));let y=W({},l[m]);y.paint=Im(y.paint,g.paint,p,_,n),y.layout=Im(y.layout,g.layout,p,_,n);let x=!h||h(p,g,_);if(!x)continue;let v=new K0(p,this.z,this.x,this.y,f);v.layer=y;let w=e[m];w===void 0&&(w=e[m]=[]),w.push({featureIndex:r,feature:v,intersectionZ:x})}}lookupSymbolFeatures(e,t4,i,r,a,s,n,o){let l={};this.loadVTLayers();let u=Qs(a.filterSpec,"queryRenderedFeatures symbol filter",a.globalState);for(let h of e)this.loadMatchingFeature(l,i,r,h,u,s,n,o,t4);return l}hasLayer(e){for(let t4 of this.bucketLayerIDs)for(let i of t4)if(e===i)return true;return false}getId(e,t4){var r;let i=e.id;if(this.promoteId){let a=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t4];i=e.properties[a],typeof i=="boolean"&&(i=Number(i)),i===void 0&&((r=e.properties)!=null&&r.cluster)&&this.promoteId&&(i=Number(e.properties.cluster_id))}return i}};G("FeatureIndex",EA,{omit:["rawTileData","sourceLayerCoder"]});function SA(e){return typeof e=="object"&&!!e&&"evaluate"in e}function Im(e,t4,i,r,a){return Jc(e,(s,n)=>{let o=t4 instanceof Ul?t4.get(n):null;return SA(o)?o.evaluate(i,r,void 0,a):o})}function DA(e,t4){return t4-e}var CA=class{constructor(e,t4){this.max=e,this.onRemove=t4,this.reset()}reset(){for(let e in this.data)for(let t4 of this.data[e])t4.timeout&&clearTimeout(t4.timeout),this.onRemove(t4.value);return this.data={},this.order=[],this}add(e,t4,i){let r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let a={value:t4,timeout:void 0};if(i!==void 0&&(a.timeout=setTimeout(()=>{this.remove(e,a)},i)),this.data[r].push(a),this.order.push(r),this.order.length>this.max){let s=this._getAndRemoveByKey(this.order[0]);s&&this.onRemove(s)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t4=this.data[e].shift();return t4.timeout&&clearTimeout(t4.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t4.value}getByKey(e){let t4=this.data[e];return t4?t4[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t4){if(!this.has(e))return this;let i=e.wrapped().key,r=t4===void 0?0:this.data[i].indexOf(t4),a=this.data[i][r];return this.data[i].splice(r,1),a.timeout&&clearTimeout(a.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(a.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t4=this._getAndRemoveByKey(this.order[0]);t4&&this.onRemove(t4)}return this}filter(e){let t4=[];for(let i in this.data)for(let r of this.data[i])e(r.value)||t4.push(r);for(let i of t4)this.remove(i.value.tileID,i)}};/**
6
+ * MapLibre GL JS
7
+ * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.11.1/LICENSE.txt
8
+ */var D1="6.11.1";function C1(){var e=new yt(4);return yt!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function PA(e,t4){var i=t4[0],r=t4[1],a=t4[2],s=t4[3],n=i*s-a*r;return n?(n=1/n,e[0]=s*n,e[1]=-r*n,e[2]=-a*n,e[3]=i*n,e):null}function AA(e){return e[0]*e[3]-e[2]*e[1]}function IA(e,t4,i){var r=t4[0],a=t4[1],s=t4[2],n=t4[3],o=Math.sin(i),l=Math.cos(i);return e[0]=r*l+s*o,e[1]=a*l+n*o,e[2]=r*-o+s*l,e[3]=a*-o+n*l,e}let Ku,Mm,Ju;const Xt={frame(e,t4,i,r){let a=r||window,s=a.requestAnimationFrame(o=>{n(),t4(o)}),{unsubscribe:n}=qo(e.signal,"abort",()=>{n(),a.cancelAnimationFrame(s),i(new mn(e.signal.reason))},false)},frameAsync(e,t4){return new Promise((i,r)=>{this.frame(e,i,r,t4)})},getImageData(e,t4=0){return this.getImageCanvasContext(e).getImageData(-t4,-t4,e.width+2*t4,e.height+2*t4)},getImageCanvasContext(e){let t4;if(Hc()&&!Yg())t4=new OffscreenCanvas(e.width,e.height).getContext("2d",{willReadFrequently:true});else{let i=window.document.createElement("canvas");i.width=e.width,i.height=e.height,t4=i.getContext("2d",{willReadFrequently:true})}if(!t4)throw Error("failed to create canvas 2d context");return t4.drawImage(e,0,0,e.width,e.height),t4},resolveURL(e){return Ku||(Ku=document.createElement("a")),Ku.href=e,Ku.href},get hardwareConcurrency(){return typeof navigator<"u"&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return Ju===void 0?matchMedia?(Mm??(Mm=matchMedia("(prefers-reduced-motion: reduce)")),Mm.matches):false:Ju},set prefersReducedMotion(e){Ju=e}},Ql=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt===null?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function ze(){return Ql.getCurrentTime()}function M4(e){Ql.setNow(e)}function F4(){Ql.restoreNow()}function z4(){return Ql.isFrozen()}const MA=new Set("a.abbr.b.bdi.bdo.br.cite.code.del.div.em.i.img.ins.kbd.li.mark.ol.p.q.s.samp.small.span.strong.sub.sup.time.u.ul.var.wbr".split(".")),FA=new Set(["alt","class","datetime","dir","height","href","hreflang","lang","referrerpolicy","rel","role","src","target","title","translate","type","width"]),zA=new Set(["href","src"]),RA=new Set(["http:","https:","mailto:"]);let Fm;function Qu(){return Fm??(Fm={getAttribute:Element.prototype.getAttribute,getAttributeNames:Element.prototype.getAttributeNames,querySelectorAll:Element.prototype.querySelectorAll,remove:Element.prototype.remove,removeAttribute:Element.prototype.removeAttribute,localName:Object.getOwnPropertyDescriptor(Element.prototype,"localName").get,namespaceURI:Object.getOwnPropertyDescriptor(Element.prototype,"namespaceURI").get}),Fm}var t,Be,ie=(Be=class{static create(t4,i,r){let a=window.document.createElement(t4);return i!==void 0&&(a.className=i),r&&r.appendChild(a),a}static createNS(t4,i){return window.document.createElementNS(t4,i)}static disableDrag(){Be.docStyle&&Be.selectProp&&(Be.userSelect=Be.docStyle[Be.selectProp],Be.docStyle[Be.selectProp]="none")}static enableDrag(){Be.docStyle&&Be.selectProp&&(Be.docStyle[Be.selectProp]=Be.userSelect)}static suppressClickInternal(t4){t4.preventDefault(),t4.stopPropagation(),window.removeEventListener("click",Be.suppressClickInternal,true)}static suppressClick(){window.addEventListener("click",Be.suppressClickInternal,true),window.setTimeout(()=>{window.removeEventListener("click",Be.suppressClickInternal,true)},0)}static getScale(t4){let i=t4.getBoundingClientRect();return{x:i.width/t4.offsetWidth||1,y:i.height/t4.offsetHeight||1,boundingClientRect:i}}static getPoint(t4,i,r){let a=i.boundingClientRect;return new C((r.clientX-a.left)/i.x-t4.clientLeft,(r.clientY-a.top)/i.y-t4.clientTop)}static mousePos(t4,i){let r=Be.getScale(t4);return Be.getPoint(t4,r,i)}static touchPos(t4,i){let r=[],a=Be.getScale(t4);for(let s of i)r.push(Be.getPoint(t4,a,s));return r}static sanitize(t4){let i=new DOMParser().parseFromString(t4,"text/html").body,{querySelectorAll:r,remove:a}=Qu();for(let n of Array.from(r.call(i,"*")))Be.isAllowedElement(n)?Be.removeDisallowedAttributes(n):a.call(n);let s=document.createDocumentFragment();return s.append(...i.childNodes),s}static isAllowedElement(t4){let{namespaceURI:i,localName:r}=Qu();return i.call(t4)==="http://www.w3.org/1999/xhtml"&&MA.has(r.call(t4))}static removeDisallowedAttributes(t4){let{getAttributeNames:i,getAttribute:r,removeAttribute:a}=Qu();for(let s of i.call(t4))Be.isAllowedAttribute(s,r.call(t4,s))||a.call(t4,s)}static isAllowedAttribute(t4,i){if(!FA.has(t4)&&!t4.startsWith("aria-"))return false;if(!zA.has(t4))return true;try{return RA.has(new URL(i,"https://maplibre.invalid/").protocol)}catch{return false}}},Be.docStyle=typeof window<"u"&&((t=window.document)==null?void 0:t.documentElement.style),Be.selectProp=!Be.docStyle||"userSelect"in Be.docStyle?"userSelect":"webkitUserSelect",Be);let qi;(function(e){let t4,i,r,a;e.resetRequestQueue=()=>{t4=[],i=0,r=0,a={}},e.addThrottleControl=c=>{let d=r++;return a[d]=c,d},e.removeThrottleControl=c=>{delete a[c],u()};let s=()=>{for(let c of Object.keys(a))if(a[c]())return true;return false};async function n(c,d,p,f,m=true,g){let _=await c.transformRequest(d,p);return Qc(f.signal),qi.getImage(_,f,m,g)}e.transformAndGetImage=n,e.getImage=(c,d,p=true,f)=>new Promise((m,g)=>{c.headers||(c.headers={}),c.headers.accept="image/webp,*/*",W(c,{type:"image"});let _={abortController:d,requestParameters:c,supportImageRefresh:p,imageBitmapOptions:f,state:"queued",onError:y=>{g(y)},onSuccess:y=>{m(y)}};t4.push(_),u()});let o=(c,d)=>typeof createImageBitmap=="function"?Ox(c,d):$x(c),l=async c=>{c.state="running";let{requestParameters:d,supportImageRefresh:p,imageBitmapOptions:f,onError:m,onSuccess:g,abortController:_}=c,y=p===false&&!f&&!Ga(self)&&!o_(d.url)&&(!d.headers||Object.keys(d.headers).reduce((v,w)=>v&&w==="accept",true));i++;let x=y?h(d,_):Sl(d,_);try{let v=await x;delete c.abortController,c.state="completed",v.data instanceof HTMLImageElement||qr(v.data)?g(v):!v.data||v.data.byteLength===0?g({data:null,cacheControl:v.cacheControl,expires:v.expires}):g({data:await o(v.data,f),cacheControl:v.cacheControl,expires:v.expires})}catch(v){delete c.abortController,m(Ft(v))}finally{i--,u()}},u=()=>{let c=s()?xi.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:xi.MAX_PARALLEL_IMAGE_REQUESTS;for(let d=i;d<c&&t4.length>0;d++){let p=t4.shift();if(p.abortController.signal.aborted){d--;continue}l(p)}},h=(c,d)=>new Promise((p,f)=>{let m=new Image,g=c.url,_=c.credentials;_&&_==="include"?m.crossOrigin="use-credentials":(_&&_==="same-origin"||!u_(g))&&(m.crossOrigin="anonymous"),d.signal.addEventListener("abort",()=>{m.src="",f(new mn(d.signal.reason))}),m.fetchPriority="high",m.onload=()=>{m.onerror=m.onload=null,p({data:m})},m.onerror=()=>{m.onerror=m.onload=null,!d.signal.aborted&&f(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},m.src=g})})(qi||(qi={})),qi.resetRequestQueue();var kA=class{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t4){return this._transformRequestFn&&this._transformRequestFn(e,t4)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}},bt=class extends bi{},Q=class extends bt{},zm=class extends bt{constructor(e={}){super("style.load",e)}},Di=class extends bt{constructor(e,t4={}){super(e,t4),this.dataType="style"}},Ge=class extends bt{constructor(e,t4={}){super(e,t4),this.dataType="source"}},ri=class extends bt{preventDefault(){this._defaultPrevented=true}get defaultPrevented(){return this._defaultPrevented}constructor(e,t4,i,r={}){i=i instanceof MouseEvent?i:new MouseEvent(e,i);let a=ie.mousePos(t4.getCanvas(),i),s=t4.unproject(a);super(e,W({point:a,lngLat:s,originalEvent:i},r)),this._defaultPrevented=false,this.target=t4}},fo=class extends bt{preventDefault(){this._defaultPrevented=true}get defaultPrevented(){return this._defaultPrevented}constructor(e,t4,i){let r=e==="touchend"?i.changedTouches:i.touches,a=ie.touchPos(t4.getCanvasContainer(),r),s=a.map(l=>t4.unproject(l)),n=a.reduce((l,u,h,c)=>l.add(u.div(c.length)),new C(0,0)),o=t4.unproject(n);super(e,{points:a,point:n,lngLats:s,lngLat:o,originalEvent:i}),this._defaultPrevented=false}},LA=class extends bt{preventDefault(){this._defaultPrevented=true}get defaultPrevented(){return this._defaultPrevented}constructor(e,t4){super("wheel",{originalEvent:t4}),this._defaultPrevented=false}},Rm=class extends bt{},BA=class extends bt{constructor(e={}){super("terrain",e)}},OA=class extends bt{constructor(e={}){super("projectiontransition",e)}},eh=class extends bt{},$A=class extends bt{constructor(e={}){super("styleimagemissing",e)}};function VA(e,t4){let i={};for(let r in e)r!=="ref"&&(i[r]=e[r]);return Yx.forEach(r=>{r in t4&&(i[r]=t4[r])}),i}function km(e){e=e.slice();let t4=Object.create(null);for(let i=0;i<e.length;i++)t4[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=VA(e[i],t4[e[i].ref]));return e}function Ae(e,t4){if(Array.isArray(e)){if(!Array.isArray(t4)||e.length!==t4.length)return false;for(let i=0;i<e.length;i++)if(!Ae(e[i],t4[i]))return false;return true}if(typeof e=="object"&&e&&t4!==null){if(typeof t4!="object"||Object.keys(e).length!==Object.keys(t4).length)return false;for(let i in e)if(!Ae(e[i],t4[i]))return false;return true}return e===t4}function ti(e,t4){e.push(t4)}function P1(e,t4,i){ti(i,{command:"addSource",args:[e,t4[e]]})}function A1(e,t4,i){ti(t4,{command:"removeSource",args:[e]}),i[e]=true}function jA(e,t4,i,r){A1(e,i,r),P1(e,t4,i)}function UA(e,t4,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&r!=="data"&&!Ae(e[i][r],t4[i][r]))return false;for(r in t4[i])if(Object.prototype.hasOwnProperty.call(t4[i],r)&&r!=="data"&&!Ae(e[i][r],t4[i][r]))return false;return true}function NA(e,t4,i,r){e||(e={}),t4||(t4={});let a;for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&(Object.prototype.hasOwnProperty.call(t4,a)||A1(a,i,r));for(a in t4)Object.prototype.hasOwnProperty.call(t4,a)&&(Object.prototype.hasOwnProperty.call(e,a)?Ae(e[a],t4[a])||(e[a].type==="geojson"&&t4[a].type==="geojson"&&UA(e,t4,a)?ti(i,{command:"setGeoJSONSourceData",args:[a,t4[a].data]}):jA(a,t4,i,r)):P1(a,t4,i))}function Lm(e,t4,i,r,a){ti(t4,{command:a,args:[i,r,e[r]]})}function mo(e,t4,i,r,a){e||(e={}),t4||(t4={});for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&(Ae(e[s],t4[s])||Lm(t4,i,r,s,a));for(let s in t4)Object.prototype.hasOwnProperty.call(t4,s)&&!Object.prototype.hasOwnProperty.call(e,s)&&(Ae(e[s],t4[s])||Lm(t4,i,r,s,a))}function Bm(e){return e.id}function Om(e,t4){return e[t4.id]=t4,e}function GA(e,t4,i){e||(e=[]),t4||(t4=[]);let r=e.map(Bm),a=t4.map(Bm),s=e.reduce(Om,{}),n=t4.reduce(Om,{}),o=r.slice(),l=Object.create(null),u,h,c,d,p;for(let f=0,m=0;f<r.length;f++)u=r[f],Object.prototype.hasOwnProperty.call(n,u)?m++:(ti(i,{command:"removeLayer",args:[u]}),o.splice(o.indexOf(u,m),1));for(let f=0,m=0;f<a.length;f++)u=a[a.length-1-f],o[o.length-1-f]!==u&&(Object.prototype.hasOwnProperty.call(s,u)?(ti(i,{command:"removeLayer",args:[u]}),o.splice(o.lastIndexOf(u,o.length-m),1)):m++,d=o[o.length-f],ti(i,{command:"addLayer",args:[n[u],d]}),o.splice(o.length-f,0,u),l[u]=true);for(let f=0;f<a.length;f++)if(u=a[f],h=s[u],c=n[u],!(l[u]||Ae(h,c))){if(!Ae(h.source,c.source)||!Ae(h["source-layer"],c["source-layer"])||!Ae(h.type,c.type)){ti(i,{command:"removeLayer",args:[u]}),d=o[o.lastIndexOf(u)+1],ti(i,{command:"addLayer",args:[c,d]});continue}for(p in mo(h.layout,c.layout,i,u,"setLayoutProperty"),mo(h.paint,c.paint,i,u,"setPaintProperty"),Ae(h.filter,c.filter)||ti(i,{command:"setFilter",args:[u,c.filter]}),(!Ae(h.minzoom,c.minzoom)||!Ae(h.maxzoom,c.maxzoom))&&ti(i,{command:"setLayerZoomRange",args:[u,c.minzoom,c.maxzoom]}),h)Object.prototype.hasOwnProperty.call(h,p)&&p!=="layout"&&p!=="paint"&&p!=="filter"&&p!=="metadata"&&p!=="minzoom"&&p!=="maxzoom"&&(p.indexOf("paint.")===0?mo(h[p],c[p],i,u,"setPaintProperty"):Ae(h[p],c[p])||ti(i,{command:"setLayerProperty",args:[u,p,c[p]]}));for(p in c)Object.prototype.hasOwnProperty.call(c,p)&&!Object.prototype.hasOwnProperty.call(h,p)&&p!=="layout"&&p!=="paint"&&p!=="filter"&&p!=="metadata"&&p!=="minzoom"&&p!=="maxzoom"&&(p.indexOf("paint.")===0?mo(h[p],c[p],i,u,"setPaintProperty"):Ae(h[p],c[p])||ti(i,{command:"setLayerProperty",args:[u,p,c[p]]}))}}function ZA(e,t4){if(!e)return[{command:"setStyle",args:[t4]}];let i=[];try{if(!Ae(e.version,t4.version))return[{command:"setStyle",args:[t4]}];Ae(e.center,t4.center)||i.push({command:"setCenter",args:[t4.center]}),Ae(e.state,t4.state)||i.push({command:"setGlobalState",args:[t4.state]}),Ae(e.centerAltitude,t4.centerAltitude)||i.push({command:"setCenterAltitude",args:[t4.centerAltitude]}),Ae(e.zoom,t4.zoom)||i.push({command:"setZoom",args:[t4.zoom]}),Ae(e.bearing,t4.bearing)||i.push({command:"setBearing",args:[t4.bearing]}),Ae(e.pitch,t4.pitch)||i.push({command:"setPitch",args:[t4.pitch]}),Ae(e.roll,t4.roll)||i.push({command:"setRoll",args:[t4.roll]}),Ae(e.sprite,t4.sprite)||i.push({command:"setSprite",args:[t4.sprite]}),Ae(e.glyphs,t4.glyphs)||i.push({command:"setGlyphs",args:[t4.glyphs]}),Ae(e["font-faces"],t4["font-faces"])||i.push({command:"setFontFaces",args:[t4["font-faces"]]}),Ae(e.transition,t4.transition)||i.push({command:"setTransition",args:[t4.transition]}),Ae(e.light,t4.light)||i.push({command:"setLight",args:[t4.light]});let r=!Ae(e.terrain,t4.terrain);r&&!t4.terrain&&i.push({command:"setTerrain",args:[void 0]}),Ae(e.sky,t4.sky)||i.push({command:"setSky",args:[t4.sky]}),Ae(e.projection,t4.projection)||i.push({command:"setProjection",args:[t4.projection]});let a={},s=[];NA(e.sources,t4.sources,s,a);let n=[];e.layers&&e.layers.forEach(o=>{"source"in o&&a[o.source]?i.push({command:"removeLayer",args:[o.id]}):n.push(o)}),i=i.concat(s),GA(n,t4.layers,i),r&&t4.terrain&&i.push({command:"setTerrain",args:[t4.terrain]})}catch(r){console.warn("Unable to compute style diff:",r),i=[{command:"setStyle",args:[t4]}]}return i}function qA(){let e={},t4=F.$version;for(let i in F.$root){let r=F.$root[i];if(r.required){let a=null;a=i==="version"?t4:r.type==="array"?[]:{},a!=null&&(e[i]=a)}}return e}function Oo(e){let t4=[];if(typeof e=="string")t4.push({id:"default",url:e});else if(e&&e.length>0){let i=[];for(let{id:r,url:a}of e){let s=`${r}${a}`;i.includes(s)||(i.push(s),t4.push({id:r,url:a}))}}return t4}function $m(e,t4,i){try{let r=new URL(e);return r.pathname+=`${t4}${i}`,r.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function WA(e,t4,i,r){let a=Oo(e),s=i>1?"@2x":"",n={},o={};for(let{id:l,url:u}of a){let h=await t4.transformRequest($m(u,s,".json"),"SpriteJSON");n[l]=Dl(h,r);let c=await t4.transformRequest($m(u,s,".png"),"SpriteImage");o[l]=qi.getImage(c,r)}return await Promise.all([...Object.values(n),...Object.values(o)]),HA(n,o)}async function HA(e,t4){let i={};for(let r in e){i[r]={};let a=(await t4[r]).data;if(!a)throw Error(`Could not load sprite image for ${r}: the response is empty`);let s=Xt.getImageCanvasContext(a),n=(await e[r]).data;for(let o in n){let{width:l,height:u,x:h,y:c,sdf:d,pixelRatio:p,stretchX:f,stretchY:m,content:g,textFitWidth:_,textFitHeight:y}=n[o],x={width:l,height:u,x:h,y:c,context:s};i[r][o]={data:null,pixelRatio:p,sdf:d,stretchX:f,stretchY:m,content:g,textFitWidth:_,textFitHeight:y,spriteData:x}}}return i}var XA=class extends pt{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=false,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let e of Object.keys(this.images))this.removeImage(e);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:t4,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t4));this.requestors=[]}}getImage(e){let t4=this.images[e];if(t4&&!t4.data&&t4.spriteData){let i=t4.spriteData;t4.data=new je({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),t4.spriteData=null}return t4}addImage(e,t4){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t4)&&(this.images[e]=t4,this._imagesIds=null,t4.isWebGLImage&&this.updateImage(e,t4,false))}_validate(e,t4){let i=true,r=t4.data||t4.spriteData;return this._validateStretch(t4.stretchX,r==null?void 0:r.width)||(this.fire(new Y(Error(`Image "${e}" has invalid "stretchX" value`))),i=false),this._validateStretch(t4.stretchY,r==null?void 0:r.height)||(this.fire(new Y(Error(`Image "${e}" has invalid "stretchY" value`))),i=false),this._validateContent(t4.content,t4)||(this.fire(new Y(Error(`Image "${e}" has invalid "content" value`))),i=false),i}_validateStretch(e,t4){if(!e)return true;let i=0;for(let r of e){if(r[0]<i||r[1]<r[0]||t4<r[1])return false;i=r[1]}return true}_validateContent(e,t4){if(!e)return true;if(e.length!==4)return false;let i=t4.spriteData,r=(i==null?void 0:i.width)||t4.data.width,a=(i==null?void 0:i.height)||t4.data.height;return e[0]<0||r<e[0]||e[1]<0||a<e[1]||e[2]<0||r<e[2]||e[3]<0||a<e[3]||e[2]<e[0]?false:e[3]>=e[1]}updateImage(e,t4,i=true){let r=this.images[e];if(i){let a=r.data||r.spriteData;if(a.width!==t4.data.width||a.height!==t4.data.height)throw Error(`size mismatch between old image (${a.width}x${a.height}) and new image (${t4.data.width}x${t4.data.height}).`)}t4.version=(r.version??0)+1,this.images[e]=t4,this.updateVersion++}removeImage(e){var i;let t4=this.images[e];t4&&(delete this.images[e],this._imagesIds=null,(i=t4.userImage)!=null&&i.onRemove&&t4.userImage.onRemove())}listImages(){return this._imagesIds??(this._imagesIds=Object.keys(this.images)),this._imagesIds}_getSpriteImageId(e,t4){return e==="default"?t4:`${e}:${t4}`}setSpriteImages(e,t4){let i=this._spriteImagesIds[e]??[],r=[];for(let n in t4){let o=this._getSpriteImageId(e,n);r.push(o),o in this.images?this.updateImage(o,t4[n],false):this.addImage(o,t4[n])}let a=new Set(r),s=i.filter(n=>!a.has(n));for(let n of s)this.removeImage(n);return this._spriteImagesIds[e]=r,{loaded:r,removed:s}}removeSpriteImages(e){let t4=this._spriteImagesIds[e]??[];for(let i of t4)this.removeImage(i);return delete this._spriteImagesIds[e],t4}removeAllSpriteImages(){let e=Object.values(this._spriteImagesIds).flat();for(let t4 of e)this.removeImage(t4);return this._spriteImagesIds={},e}setMissingImageResolver(e){this.missingImageResolver=e}getImages(e){return new Promise((t4,i)=>{let r=true;if(!this.isLoaded())for(let a of e)this.images[a]||(r=false);this.isLoaded()||r?t4(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t4})})}async _getImagesForIds(e){var a;let t4=new Set(e.filter(s=>!this.getImage(s))),i=this.missingImageResolver;i&&await Promise.allSettled(Array.from(t4,s=>i(s)));let r={};for(let s of e){let n=this.getImage(s);n&&(t4.delete(s),r[s]={data:n.data.clone(),pixelRatio:n.pixelRatio,sdf:n.sdf,version:n.version,stretchX:n.stretchX,stretchY:n.stretchY,content:n.content,textFitWidth:n.textFitWidth,textFitHeight:n.textFitHeight,hasRenderCallback:!!((a=n.userImage)!=null&&a.render),isWebGLImage:n.isWebGLImage})}for(let s of t4)this.fire(new $A({id:s})),ge(`Image "${s}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return r}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t4 of e){if(this._renderCallbacksDispatchedThisFrame[t4])continue;this._renderCallbacksDispatchedThisFrame[t4]=true;let i=this.getImage(t4);i||ge(`Image with ID: "${t4}" was not found`),RS(i)&&this.updateImage(t4,i)}}cloneImages(){let e={};for(let t4 in this.images){let i=this.images[t4];e[t4]={...i,data:i.data?i.data.clone():null}}return e}},YA=class{constructor(e){this._imageManager=e,this._entries={},this._image=new je({width:1,height:1}),this._dirty=true}destroy(){this._texture&&(this._texture=(this._texture.destroy(),null)),this._entries={},this._image=new je({width:1,height:1}),this._dirty=true}getPixelSize(){let{width:e,height:t4}=this._image;return{width:e,height:t4}}getPattern(e){let t4=this._imageManager.getImage(e);if(!t4)return null;let i=this._entries[e];if((i==null?void 0:i.image)!==t4){let r={w:t4.data.width+2,h:t4.data.height+2,x:0,y:0};this._entries[e]={bin:r,position:new Fd(r,t4),image:t4}}else if(i.position.version!==t4.version)i.position.version=t4.version;else return i.position;return this._update(),this._entries[e].position}bind(e){let t4=e.gl;this._texture?this._dirty&&(this._dirty=(this._texture.update(this._image),false)):(this._texture=new dt(e,this._image,t4.RGBA),this._dirty=false),this._texture.bind(t4.LINEAR,t4.CLAMP_TO_EDGE)}_update(){for(let a in this._entries)this._imageManager.getImage(a)||delete this._entries[a];let e=[];for(let a in this._entries)e.push(this._entries[a].bin);let{w:t4,h:i}=z0(e),r=this._image;r.resize({width:t4||1,height:i||1});for(let a in this._entries){let{bin:s}=this._entries[a],n=s.x+1,o=s.y+1,l=this._entries[a].image.data,u=l.width,h=l.height;je.copy(l,r,{x:0,y:0},{x:n,y:o},{width:u,height:h}),je.copy(l,r,{x:0,y:h-1},{x:n,y:o-1},{width:u,height:1}),je.copy(l,r,{x:0,y:0},{x:n,y:o+h},{width:u,height:1}),je.copy(l,r,{x:u-1,y:0},{x:n-1,y:o},{width:1,height:h}),je.copy(l,r,{x:0,y:0},{x:n+u,y:o},{width:1,height:h})}this._dirty=true}};const kc=1114111,KA={start:0,end:kc};let JA=0;function QA(e){let t4=/^u\+([0-9a-f]*)(\?+)$/i.exec(e);if(t4){let[,a,s]=t4;return a.length+s.length>6?null:Vm(parseInt(`${a}${"0".repeat(s.length)}`,16),parseInt(`${a}${"f".repeat(s.length)}`,16))}let i=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(e);if(!i)return null;let r=parseInt(i[1],16);return Vm(r,i[2]===void 0?r:parseInt(i[2],16))}function Vm(e,t4){return e>t4||e>kc?null:{start:e,end:Math.min(t4,kc)}}function eI(e,t4){return e.ranges.some(({start:i,end:r})=>t4>=i&&t4<=r)}var tI=class{constructor(e){this.requestManager=e,this._faces={},this._registered=new Set}setFontFaces(e){this._unregisterAll(),this._faces={};for(let[t4,i]of Object.entries(e??{})){let r=Array.isArray(i)?i:[i];this._faces[t4]=r.map(a=>this._declareFontFace(t4,a)).filter(a=>a!==null)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(e,t4){for(let i of e.split(","))for(let r of this._faces[i.trim()]??[])if(eI(r,t4)&&(r.loaded??(r.loaded=this._loadFontFace(r)),await r.loaded))return r.family;return null}_declareFontFace(e,t4){let i=typeof t4=="string"?{url:t4}:t4;if(typeof(i==null?void 0:i.url)!="string")return ge(`Ignoring the font face declared for "${e}": it has no URL.`),null;let r=`maplibre-gl-font-face-${JA++}`,a=i["unicode-range"];if(!(a!=null&&a.length))return{url:i.url,ranges:[KA],family:r};let s=[];for(let n of a){let o=QA(n);if(!o){ge(`Ignoring the unicode range "${n}" of the font face at ${i.url}: it is not a valid range.`);continue}s.push(o)}return s.length?{url:i.url,ranges:s,family:r}:null}async _loadFontFace(e){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)return ge(`Ignoring the font face at ${e.url}: this environment has no CSS Font Loading API.`),false;let t4;try{return t4=new FontFace(e.family,await this._downloadFontFile(e.url)),Object.values(this._faces).some(i=>i.includes(e))?(document.fonts.add(t4),this._registered.add(t4),await t4.load(),true):false}catch(i){return t4&&this._unregister(t4),ge(`Ignoring the font face at ${e.url}: ${Ft(i).message}`),false}}async _downloadFontFile(e){let t4=await this.requestManager.transformRequest(e,"Glyphs"),i=await l_(t4,new AbortController);if(!(i!=null&&i.data))throw Error(`the response was empty for the font file at ${e}`);return i.data}_unregister(e){var t4;(t4=document.fonts)==null||t4.delete(e),this._registered.delete(e)}_unregisterAll(){var e;for(let t4 of this._registered)(e=document.fonts)==null||e.delete(t4);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};const Lc=1e20,Yd=new Float64Array(256);for(let e=0;e<256;e++){let t4=.5-(e/255)**.45454545454545453;Yd[e]=t4*Math.abs(t4)}Yd[255]=-1e20;var iI=class{constructor({fontSize:e=24,buffer:t4=3,radius:i=8,cutoff:r=.25,fontFamily:a="sans-serif",fontWeight:s="normal",fontStyle:n="normal",lang:o=null}={}){this.buffer=t4,this.radius=i,this.cutoff=r,this.lang=o;let l=this.size=e+t4*4,u=this._createCanvas(l),h=this.ctx=u.getContext("2d",{willReadFrequently:true});h.font=`${n} ${s} ${e}px ${a}`,h.textBaseline="alphabetic",h.textAlign="left",h.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(e,e);let t4=document.createElement("canvas");return t4.width=t4.height=e,t4}draw(e){let{width:t4,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:a,actualBoundingBoxRight:s}=this.ctx.measureText(e),n=Math.ceil(i),o=Math.floor(-a),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s)-o)),u=Math.max(0,Math.min(this.size-this.buffer,n+Math.ceil(r))),h=l+2*this.buffer,c=u+2*this.buffer,d=Math.max(h*c,0),p=new Uint8ClampedArray(d),f={data:p,width:h,height:c,glyphWidth:l,glyphHeight:u,glyphTop:n,glyphLeft:o,glyphAdvance:t4};if(l===0||u===0)return f;let{ctx:m,buffer:g,gridInner:_,gridOuter:y}=this;this.lang&&(m.lang=this.lang),m.clearRect(g,g,l,u),m.fillText(e,g-o,g+n);let x=m.getImageData(g,g,l,u);y.fill(Lc,0,d),_.fill(0,0,d);let v=3;for(let P=0;P<u;P++){let E=(P+g)*h+g;for(let I=0;I<l;I++,v+=4,E++){let R=x.data[v];if(R===0)continue;let z=Yd[R];y[E]=Math.max(0,z),_[E]=Math.max(0,-z)}}jm(y,0,0,h,c,h,this.f,this.v,this.z);let w=Math.min(g,1);jm(_,g-w,g-w,l+2*w,u+2*w,h,this.f,this.v,this.z);let b=255/this.radius,T=255*(1-this.cutoff);for(let P=0;P<d;P++){let E=Math.sqrt(y[P])-Math.sqrt(_[P]);p[P]=Math.round(T-b*E)}return f}};function jm(e,t4,i,r,a,s,n,o,l){for(let u=t4;u<t4+r;u++)Um(e,i*s+u,s,a,n,o,l);for(let u=i;u<i+a;u++)Um(e,u*s+t4,1,r,n,o,l)}function Um(e,t4,i,r,a,s,n){s[0]=0,n[0]=-1e20,n[1]=Lc,a[0]=e[t4];for(let o=1,l=0,u=0;o<r;o++){a[o]=e[t4+o*i];let h=o*o;do{let c=s[l];u=(a[o]-a[c]+h-c*c)/(o-c)/2}while(u<=n[l]&&--l>-1);l++,s[l]=o,n[l]=u,n[l+1]=Lc}for(let o=0,l=0;o<r;o++){for(;n[l+1]<o;)l++;let u=s[l],h=o-u;e[t4+o*i]=a[u]+h*h}}const rI=F.layout_symbol["text-font"].default.join(","),aI=(e,t4)=>{let i=new iI(e);return i.buffer=t4,i};var sI=class{constructor(e,t4,i,r=aI){this.requestManager=e,this.localIdeographFontFamily=t4,this.entries={},this.lang=i,this.fontFaceManager=new tI(e),this.createRasterizer=r}setURL(e){this.url=e}setFontFaces(e){this.fontFaceManager.setFontFaces(e),this.entries={}}async getGlyphs(e){let t4=[];for(let a in e)for(let s of e[a])t4.push(this._getAndCacheGlyphsPromise(a,s));let i=await Promise.all(t4),r={};for(let{stack:a,id:s,glyph:n}of i)r[a]||(r[a]={}),r[a][s]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return r}async _getAndCacheGlyphsPromise(e,t4){var n;(n=this.entries)[e]??(n[e]={glyphs:{},requests:{},ranges:{}});let i=this.entries[e],r=i.glyphs[t4];if(r!==void 0)return{stack:e,id:t4,glyph:r};let a=t4.codePointAt(0),s=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(e,a):null;return s?(r=i.glyphs[t4]=await this._drawGlyph(i,e,t4,s),{stack:e,id:t4,glyph:r}):!this.url||hl(t4)||this._charUsesLocalIdeographFontFamily(a)?(r=i.glyphs[t4]=await this._drawGlyph(i,e,t4),{stack:e,id:t4,glyph:r}):await this._downloadAndCacheRangePromise(e,t4)}async _downloadAndCacheRangePromise(e,t4){var s;let i=t4.codePointAt(0),r=this.entries[e],a=Math.floor(i/256);if(r.ranges[a])return{stack:e,id:t4,glyph:null};(s=r.requests)[a]||(s[a]=this._loadGlyphRange(e,a));try{let n=await r.requests[a];for(let o in n)r.glyphs[String.fromCodePoint(+o)]=n[+o];return r.ranges[a]=true,{stack:e,id:t4,glyph:n[i]||null}}catch(n){let o=r.glyphs[t4]=await this._drawGlyph(r,e,t4);return this._warnOnMissingGlyphRange(o,a,i,Ft(n)),{stack:e,id:t4,glyph:o}}}async _loadGlyphRange(e,t4){let i=t4*256,r=i+255,a=await this.requestManager.transformRequest(this.url.replace("{fontstack}",e).replace("{range}",`${i}-${r}`),"Glyphs"),s=await l_(a,new AbortController);if(!(s!=null&&s.data))throw Error(`Could not load glyph range. range: ${t4}, ${i}-${r}`);let n={};for(let o of zS(s.data))n[o.id]=o;return n}_warnOnMissingGlyphRange(e,t4,i,r){let a=t4*256,s=a+255,n=i.toString(16).padStart(4,"0").toUpperCase();ge(`Unable to load glyph range ${t4}, ${a}-${s}. Rendering codepoint U+${n} locally instead. ${r}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&BE(e)}async _drawGlyph(e,t4,i,r){let a=(await this._getTinySDF(e,t4,i,r)).draw(i),s=new RegExp("^\\p{gc=Cf}+$","u").test(i);return{id:i.codePointAt(0),bitmap:new Dd({width:a.width||60,height:a.height||60},a.data),metrics:{width:s?0:a.glyphWidth/2||24,height:a.glyphHeight/2||24,left:a.glyphLeft/2+.5||0,top:a.glyphTop/2-27.5||-8,advance:s?0:a.glyphAdvance/2||24,isDoubleResolution:true}}}_getTinySDF(e,t4,i,r){var l,u;let a=hl(i);if(r){let h=a?"clusterTinySDFs":"fontFaceTinySDFs";return e[h]??(e[h]={}),(l=e[h])[r]||(l[r]=this._createTinySDF(r,false,a?3:1)),e[h][r]}let s=t4===rI&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(i.codePointAt(0)),n=s?this.localIdeographFontFamily:t4;if(a)return e.clusterTinySDFs??(e.clusterTinySDFs={}),(u=e.clusterTinySDFs)[n]||(u[n]=this._createTinySDF(n,true,3)),e.clusterTinySDFs[n];let o=s?"ideographTinySDF":"tinySDF";return e[o]||(e[o]=this._createTinySDF(n)),e[o]}async _createTinySDF(e,t4=true,i=1){var o;let r=e?e.split(","):[];r.push("sans-serif");let a=r.map(l=>/[-\w]+/.test(l)?l:`'${CSS.escape(l)}'`).join(","),s=t4?this._fontWeight(r[0]):void 0,n=t4?this._fontStyle(r[0]):"normal";if(typeof document<"u"&&((o=document.fonts)!=null&&o.load))try{await document.fonts.load(`${n} ${s||"normal"} 48px ${a}`)}catch(l){ge(`Failed to load font "${a}": ${Ft(l).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(i-1)/4)),radius:16,cutoff:.25,fontFamily:a,fontWeight:s,fontStyle:n,lang:this.lang},6)}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){let t4={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950},i;for(let[r,a]of Object.entries(t4))RegExp(`\\b${r}\\b`,"i").test(e)&&(i=`${a}`);return i}destroy(){for(let e in this.entries){let t4=this.entries[e];t4.tinySDF=null,t4.ideographTinySDF=null,t4.fontFaceTinySDFs={},t4.glyphs={},t4.requests={},t4.ranges={}}this.entries={},this.fontFaceManager.destroy()}};let nI;const oI=()=>nI||(nI=new wt({anchor:new j(F.light.anchor,"anchor"),position:new j(F.light.position,"position"),color:new j(F.light.color,"color"),intensity:new j(F.light.intensity,"intensity")}));var lI=class extends pt{constructor(e,t4){super(),this._transitionable=new jl(oI(),"light",t4),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return kx(this.properties.get("position"))}setLight(e,t4={}){this._validate(qt.light,e,t4)||this._transitionable.setValues(e)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}applyGlobalStateChange(e,t4,i){this._transitioning=this._transitionable.applyGlobalStateChange(e,t4,this._transitioning,i)}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t4,i){return wn(this,e,{value:t4},i)}};let uI;const hI=()=>uI||(uI=new wt({"sky-color":new j(F.sky["sky-color"],"sky-color"),"horizon-color":new j(F.sky["horizon-color"],"horizon-color"),"fog-color":new j(F.sky["fog-color"],"fog-color"),"fog-ground-blend":new j(F.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new j(F.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new j(F.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new j(F.sky["atmosphere-blend"],"atmosphere-blend")}));var cI=class extends pt{constructor(e,t4){super(),this._transitionable=new jl(hI(),"sky",t4),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Fe(0))}setSky(e,t4={}){return!this._validate(qt.sky,e,t4)&&(e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0}),this._transitionable.setValues(e),true)}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}applyGlobalStateChange(e,t4,i){this._transitioning=this._transitionable.applyGlobalStateChange(e,t4,this._transitioning,i)}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t4,i={}){return wn(this,e,{value:t4},i)}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},dI=class{constructor(e,t4){this.width=e,this.height=t4,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t4){var r;let i=e.join(",")+String(t4);return(r=this.dashEntry)[i]||(r[i]=this.addDash(e,t4)),this.dashEntry[i]}getDashRanges(e,t4,i){let r=e.length%2==1,a=[],s=r?-e[e.length-1]*i:0,n=e[0]*i,o=true;a.push({left:s,right:n,isDash:o,zeroLength:e[0]===0});let l=e[0];for(let u=1;u<e.length;u++){o=!o;let h=e[u];s=l*i,l+=h,n=l*i,a.push({left:s,right:n,isDash:o,zeroLength:h===0})}return a}addRoundDash(e,t4,i){let r=t4/2;for(let a=-i;a<=i;a++){let s=this.nextRow+i+a,n=this.width*s,o=0,l=e[o];for(let u=0;u<this.width;u++){u/l.right>1&&(l=e[++o]);let h=Math.abs(u-l.left),c=Math.abs(u-l.right),d=Math.min(h,c),p,f=a/i*(r+1);if(l.isDash){let m=r-Math.abs(f);p=Math.sqrt(d*d+m*m)}else p=r-Math.sqrt(d*d+f*f);this.data[n+u]=Math.max(0,Math.min(255,p+128))}}}addRegularDash(e){for(let n=e.length-1;n>=0;--n){let o=e[n],l=e[n+1];o.zeroLength?e.splice(n,1):(l==null?void 0:l.isDash)===o.isDash&&(l.left=o.left,e.splice(n,1))}let t4=e[0],i=e[e.length-1];t4.isDash===i.isDash&&(t4.left=i.left-this.width,i.right=t4.right+this.width);let r=this.width*this.nextRow,a=0,s=e[a];for(let n=0;n<this.width;n++){n/s.right>1&&(s=e[++a]);let o=Math.abs(n-s.left),l=Math.abs(n-s.right),u=Math.min(o,l),h=s.isDash?u:-u;this.data[r+n]=Math.max(0,Math.min(255,h+128))}}addDash(e,t4){let i=t4?7:0,r=2*i+1;if(this.nextRow+r>this.height)return ge("LineAtlas out of space"),null;let a=0;for(let n of e)a+=n;if(a!==0){let n=this.width/a,o=this.getDashRanges(e,this.width,n);t4?this.addRoundDash(o,n,i):this.addRegularDash(o)}let s={y:this.nextRow+i,height:2*i,width:a};return this.nextRow+=r,this.dirty=true,s}bind(e){let t4=e.gl;this.texture?(t4.bindTexture(t4.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=false,t4.texSubImage2D(t4.TEXTURE_2D,0,0,0,this.width,this.height,t4.ALPHA,t4.UNSIGNED_BYTE,this.data))):(this.texture=t4.createTexture(),t4.bindTexture(t4.TEXTURE_2D,this.texture),t4.texParameteri(t4.TEXTURE_2D,t4.TEXTURE_WRAP_S,t4.REPEAT),t4.texParameteri(t4.TEXTURE_2D,t4.TEXTURE_WRAP_T,t4.REPEAT),t4.texParameteri(t4.TEXTURE_2D,t4.TEXTURE_MIN_FILTER,t4.LINEAR),t4.texParameteri(t4.TEXTURE_2D,t4.TEXTURE_MAG_FILTER,t4.LINEAR),t4.texImage2D(t4.TEXTURE_2D,0,t4.ALPHA,this.width,this.height,0,t4.ALPHA,t4.UNSIGNED_BYTE,this.data))}};function pI(e){if(!e)return false;let t4=globalThis.location;if(!t4)return false;try{return new URL(e,t4.href).origin!==t4.origin}catch{return false}}function fI(){let e=import.meta.url;if(!/^https?:/.test(e))return"";let t4=e.endsWith("-dev.mjs")?"maplibre-gl-worker-dev.mjs":"maplibre-gl-worker.mjs";return new URL(`./${t4}`,e).href}function th(e,t4){if(t4)try{return new Worker(e,{type:"module"})}catch(i){console.warn("Module worker not supported, falling back to classic worker",i)}return new Worker(e)}async function mI(e){let t4=await fetch(e);if(!t4.ok)throw Error(`Failed to fetch worker script (${t4.status}): ${e}`);let i=await t4.text(),r=new Blob([i],{type:"text/javascript"});return URL.createObjectURL(r)}function gI(e){let t4=new Blob([`import ${JSON.stringify(new URL(e,import.meta.url).href)}`],{type:"text/javascript"});return URL.createObjectURL(t4)}async function _I(){let e=xi.WORKER_URL||fI(),t4=!(e!=null&&e.endsWith(".cjs"));if(!pI(e))return th(e,t4);if(t4){let r=gI(e);try{return th(r,t4)}finally{URL.revokeObjectURL(r)}}let i=await mI(e);try{return th(i,t4)}finally{URL.revokeObjectURL(i)}}const Kd="maplibre_preloaded_worker_pool";var eu=class I1{constructor(){this.active={},this.workersPromise=null}async acquire(t4){if(this.active[t4]=true,!this.workersPromise){let i=[];for(;i.length<I1.workerCount;)i.push(_I());this.workersPromise=Promise.all(i)}return(await this.workersPromise).slice()}release(t4){if(delete this.active[t4],this.numActive()===0&&this.workersPromise){let i=this.workersPromise;this.workersPromise=null,i.then(r=>{for(let a of r)a.terminate()})}}isPreloaded(){return!!this.active[Kd]}numActive(){return Object.keys(this.active).length}};const yI=Math.floor(Xt.hardwareConcurrency/2);eu.workerCount=Bx(globalThis)?Math.max(Math.min(yI,3),1):1;let _l;function Jd(){return _l||(_l=new eu),_l}function R4(){Jd().acquire(Kd)}function k4(){let e=_l;e&&(e.isPreloaded()&&e.numActive()===1?(e.release(Kd),_l=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))}var M1=class extends pt{constructor(e,t4){super(),this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t4,this.removed=false,this.workerErrorSubscriptions=[],this.actorsPromise=this.initActors(t4)}async initActors(e){let t4=await this.workerPool.acquire(e);if(this.removed)return[];if(this.actors=t4.map((i,r)=>{this.workerErrorSubscriptions.push(qo(i,"error",()=>{this.fire(new Y(Error("Worker failed to load. Check that the worker URL is correct.")))},false));let a=new OD(i,e);return a.name=`Worker ${r}`,a}),!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(e,t4){let i=await this.actorsPromise;return Promise.all(i.map(r=>r.sendAsync({type:e,data:t4})))}async getActor(){let e=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%e.length,e[this.currentActor]}async waitForInitComplete(){this.actors.length===0&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=true){this.removed=true;for(let t4 of this.actors)t4.remove();for(let t4 of this.workerErrorSubscriptions)t4.unsubscribe();this.actors=[],this.workerErrorSubscriptions=[],this.setEventedParent(null),e&&this.workerPool.release(this.id)}async registerMessageHandler(e,t4){let i=await this.actorsPromise;for(let r of i)r.registerMessageHandler(e,t4)}async unregisterMessageHandler(e){let t4=await this.actorsPromise;for(let i of t4)i.unregisterMessageHandler(e)}};let go;function F1(){return go||(go=new M1(Jd(),Eh),go.registerMessageHandler("GR",(e,t4,i)=>Sl(t4,i))),go}function vI(e,t4){let i=Ir();return ot(i,i,[1,1,0]),Dt(i,i,[e.width*.5,e.height*.5,1]),e.calculatePosMatrix?Da(i,i,e.calculatePosMatrix(t4.toUnwrapped())):i}function xI(e,t4,i){if(e)for(let r of e){let a=t4[r];if((a==null?void 0:a.source)===i&&a.type==="fill-extrusion")return true}else for(let r in t4){let a=t4[r];if(a.source===i&&a.type==="fill-extrusion")return true}return false}function bI(e,t4,i,r,a,s,n){let o=xI((a==null?void 0:a.layers)??null,t4,e.id),l=s.maxPitchScaleFactor(),u=e.tilesIn(r,l,o);u.sort(z1);let h=[];for(let c of u)h.push({wrappedTileID:c.tileID.wrapped().key,queryResults:c.tile.queryRenderedFeatures(t4,i,e.getState(),c.queryGeometry,c.cameraQueryGeometry,c.scale,a,s,l,vI(s,c.tileID),n?(d,p)=>n(c.tileID,d,p):void 0)});return SI(EI(h),e)}function wI(e,t4,i,r,a,s,n){let o={},l=s.queryRenderedSymbols(r),u=[];for(let h of Object.keys(l).map(Number))u.push(n[h]);u.sort(z1);for(let h of u){let c=h.featureIndex.lookupSymbolFeatures(l[h.bucketInstanceId],t4,h.bucketIndex,h.sourceLayerIndex,{filterSpec:a.filter,globalState:a.globalState},a.layers,a.availableImages,e);for(let d in c){o[d]||(o[d]=[]);let p=c[d];p.sort((f,m)=>{let g=h.featureSortOrder;if(g){let _=g.indexOf(f.featureIndex);return g.indexOf(m.featureIndex)-_}return m.featureIndex-f.featureIndex});for(let f of p)o[d].push(f)}}return DI(o,e,i)}function TI(e,t4){let i=e.getRenderableIds().map(s=>e.getTileByID(s)),r=[],a={};for(let s of i){let n=s.tileID.canonical.key;a[n]||(a[n]=true,s.querySourceFeatures(r,t4))}return r}function z1(e,t4){let i=e.tileID,r=t4.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function EI(e){let t4={},i={};for(let{queryResults:r,wrappedTileID:a}of e){i[a]||(i[a]={});let s=i[a];for(let n in r){let o=r[n];s[n]||(s[n]={});let l=s[n];t4[n]||(t4[n]=[]);for(let u of o)l[u.featureIndex]||(l[u.featureIndex]=true,t4[n].push(u))}}return t4}function SI(e,t4){for(let i in e)for(let r of e[i])R1(r,t4);return e}function DI(e,t4,i){for(let r in e)for(let a of e[r]){let s=i[t4[r].source];R1(a,s)}return e}function R1(e,t4){let i=e.feature,r=t4.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}async function k1(e,t4,i,r){let a=e;if(e.url?a=(await Dl(await t4.transformRequest(e.url,"Source"),i)).data:await Xt.frameAsync(i,r),!a)return null;let s=fn(W(a,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in a&&a.vector_layers&&(s.vectorLayerIds=a.vector_layers.map(n=>n.id)),s}var Yi=class ir{constructor(t4,i){t4&&(i?this.setSouthWest(t4).setNorthEast(i):Array.isArray(t4)&&(t4.length===4?this.setSouthWest([t4[0],t4[1]]).setNorthEast([t4[2],t4[3]]):this.setSouthWest(t4[0]).setNorthEast(t4[1])))}setNorthEast(t4){return this._ne=t4 instanceof H?new H(t4.lng,t4.lat):H.convert(t4),this}setSouthWest(t4){return this._sw=t4 instanceof H?new H(t4.lng,t4.lat):H.convert(t4),this}extend(t4){let i=this._sw,r=this._ne,a,s;if(t4 instanceof H)a=t4,s=t4;else if(t4 instanceof ir){if(a=t4._sw,s=t4._ne,!a||!s)return this}else{if(Array.isArray(t4)){if(t4.length===4||t4.every(Array.isArray)){let n=t4;return this.extend(ir.convert(n))}{let n=t4;return this.extend(H.convert(n))}}return t4&&("lng"in t4||"lon"in t4)&&"lat"in t4?this.extend(H.convert(t4)):this}return!i&&!r?(this._sw=new H(a.lng,a.lat),this._ne=new H(s.lng,s.lat)):(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),r.lng=Math.max(s.lng,r.lng),r.lat=Math.max(s.lat,r.lat)),this}getCenter(){return new H((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new H(this.getWest(),this.getNorth())}getSouthEast(){return new H(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t4){let{lng:i,lat:r}=H.convert(t4),a=this._sw.lat<=r&&r<=this._ne.lat,s=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=i&&i>=this._ne.lng),a&&s}intersects(t4){if(t4=ir.convert(t4),!(t4.getNorth()>=this.getSouth()&&t4.getSouth()<=this.getNorth()))return false;let i=Math.abs(this.getEast()-this.getWest()),r=Math.abs(t4.getEast()-t4.getWest());if(i>=360||r>=360)return true;let a=mi(this.getWest(),-180,180),s=mi(this.getEast(),-180,180),n=mi(t4.getWest(),-180,180),o=mi(t4.getEast(),-180,180),l=a>s,u=n>o;return l&&u?true:l?o>=a||n<=s:u?s>=n||a<=o:n<=s&&o>=a}static convert(t4){return t4 instanceof ir||!t4?t4:new ir(t4)}static fromLngLat(t4,i=0){let r=360*i/40075017,a=r/Math.cos(Math.PI/180*t4.lat);return new ir(new H(t4.lng-a,t4.lat-r),new H(t4.lng+a,t4.lat+r))}adjustAntiMeridian(){let t4=new H(this._sw.lng,this._sw.lat),i=new H(this._ne.lng,this._ne.lat);return t4.lng>i.lng?new ir(t4,new H(i.lng+360,i.lat)):new ir(t4,i)}},L1=class{constructor(e,t4,i){this.bounds=Yi.convert(this.validateBounds(e)),this.minzoom=t4||0,this.maxzoom=i||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t4=2**e.z,i={minX:Math.floor(Ja(this.bounds.getWest())*t4),minY:Math.floor(Qa(this.bounds.getNorth())*t4),maxX:Math.ceil(Ja(this.bounds.getEast())*t4),maxY:Math.ceil(Qa(this.bounds.getSouth())*t4)};return e.x>=i.minX&&e.x<i.maxX&&e.y>=i.minY&&e.y<i.maxY}},CI=class extends pt{constructor(e,t4,i,r){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=true,this.isTileClipped=true,this._loaded=false,W(this,fn(t4,["url","scheme","tileSize","promoteId","encoding"])),this._options=W({type:"vector"},t4),this._collectResourceTiming=t4.collectResourceTiming,this.tileSize!==512)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}async load(e=false){this._loaded=false,this.fire(new Ge("dataloading")),this._tileJSONRequest=new AbortController;try{let t4=await k1(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=true,t4&&(W(this,t4),t4.bounds&&(this.tileBounds=new L1(t4.bounds,this.minzoom,this.maxzoom)),this.fire(new Ge("data",{sourceDataType:"metadata"})),this.fire(new Ge("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(t4){this._tileJSONRequest=null,this._loaded=true,Cr(t4)||this.fire(new Y(Ft(t4)))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(true)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest=(this._tileJSONRequest.abort(),null))}serialize(){return W({},this._options)}async loadTile(e){let t4=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:await this.map._requestManager.transformRequest(t4,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(e),etag:e.etag};if(i.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete(),e.aborted)return;let r="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getReadyActor(),r="LT";else if(e.state==="loading")return new Promise((a,s)=>{e.reloadPromise={resolve:a,reject:s}});e.abortController=new AbortController;try{let a=await e.actor.sendAsync({type:r,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,a);let s={};return a!=null&&a.etagUnmodified&&(s.unmodified=true),s}catch(a){if(delete e.abortController,e.aborted||Cr(a))return;if(a&&a.status!==404)throw a;this._afterTileLoadWorkerResponse(e,null)}}async _getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let t4=e.tileID.scaledTo(this.maxzoom).canonical,i=t4.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t4,overzoomRequest:await this.map._requestManager.transformRequest(i,"Tile")}}_afterTileLoadWorkerResponse(e,t4){if(t4!=null&&t4.resourceTiming&&(e.resourceTiming=t4.resourceTiming),t4&&this.map._refreshExpiredTiles&&e.setExpiryData(t4),e.etag=t4==null?void 0:t4.etag,e.loadVectorData(t4,this.map.painter),e.reloadPromise){let i=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(i.resolve).catch(i.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return false}},B1=class extends pt{constructor(e,t4,i,r){super(),this.id=e,this.dispatcher=i,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=true,this.scheme="xyz",this.tileSize=512,this._loaded=false,this._premultiplyAlpha=true,this._options=W({type:"raster"},t4),W(this,fn(t4,["url","scheme","tileSize"]))}async load(e=false){this._loaded=false,this.fire(new Ge("dataloading")),this._tileJSONRequest=new AbortController;try{let t4=await k1(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=true,t4&&(W(this,t4),t4.bounds&&(this.tileBounds=new L1(t4.bounds,this.minzoom,this.maxzoom)),this.fire(new Ge("data",{sourceDataType:"metadata"})),this.fire(new Ge("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(t4){this._tileJSONRequest=null,this._loaded=true,Cr(t4)||this.fire(new Y(Ft(t4)))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest=(this._tileJSONRequest.abort(),null))}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest=(this._tileJSONRequest.abort(),null)),e(),this.load(true)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return W({},this._options)}setPremultiplyAlpha(e){return this._premultiplyAlpha===e||this.setSourceProperty(()=>{this._premultiplyAlpha=e}),this}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t4=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this._premultiplyAlpha,r=i?void 0:{premultiplyAlpha:"none"};e.abortController=new AbortController;try{let a=await qi.transformAndGetImage(this.map._requestManager,t4,"Tile",e.abortController,this.map._refreshExpiredTiles,r);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(a){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});let s=this.map.painter.context,n=s.gl,o=a.data??new je({width:1,height:1},new Uint8Array(4));e.texture=this.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:true,premultiply:i}):(e.texture=new dt(s,o,n.RGBA,{useMipmap:true,premultiply:i}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return false}},PI=class extends B1{constructor(e,t4,i,r){super(e,t4,i,r),this.type="raster-dem",this.maxzoom=22,this._options=W({type:"raster-dem"},t4),this.encoding=t4.encoding||"mapbox",this.redFactor=t4.redFactor,this.greenFactor=t4.greenFactor,this.blueFactor=t4.blueFactor,this.baseShift=t4.baseShift}async loadTile(e){let t4=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let i=await qi.transformAndGetImage(this.map._requestManager,t4,"Tile",e.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i){if(this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires}),!i.data){e.state="loaded";return}let r=i.data,a=qr(r)&&Hc()?r:await this.readImageNow(r),s={type:this.type,uid:e.uid,source:this.id,rawImageData:a,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&e.state!=="expired"&&e.state!=="reloading")return;await this.dispatcher.waitForInitComplete(),(!e.actor||e.state==="expired")&&(e.actor=this.dispatcher.getReadyActor()),e.dem=await e.actor.sendAsync({type:"LDT",data:s}),e.needsHillshadePrepare=true,e.needsTerrainPrepare=true,e.needsColorReliefPrepare=true,e.state="loaded"}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async readImageNow(e){if(typeof VideoFrame<"u"&&Yg()){let t4=e.width+4,i=e.height+4;try{return new je({width:t4,height:i},await jx(e,-2,-2,t4,i))}catch{}}return Xt.getImageData(e,2)}_getNeighboringTiles(e){let t4=e.canonical,i=2**t4.z,r=(t4.x-1+i)%i,a=t4.x===0?e.wrap-1:e.wrap,s=(t4.x+1+i)%i,n=t4.x+1===i?e.wrap+1:e.wrap,o={};return o[new St(e.overscaledZ,a,t4.z,r,t4.y).key]={backfilled:false},o[new St(e.overscaledZ,n,t4.z,s,t4.y).key]={backfilled:false},t4.y>0&&(o[new St(e.overscaledZ,a,t4.z,r,t4.y-1).key]={backfilled:false},o[new St(e.overscaledZ,e.wrap,t4.z,t4.x,t4.y-1).key]={backfilled:false},o[new St(e.overscaledZ,n,t4.z,s,t4.y-1).key]={backfilled:false}),t4.y+1<i&&(o[new St(e.overscaledZ,a,t4.z,r,t4.y+1).key]={backfilled:false},o[new St(e.overscaledZ,e.wrap,t4.z,t4.x,t4.y+1).key]={backfilled:false},o[new St(e.overscaledZ,n,t4.z,s,t4.y+1).key]={backfilled:false}),o}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}};function yl(e,t4){return t4?e.properties[t4]:e.id}function AI(e,t4){let i=new Map;if(e==null||e.type==null)return i;if(e.type==="Feature"){let r=yl(e,t4);return r==null?void 0:(i.set(r,e),i)}if(e.type==="FeatureCollection"){let r=new Set;for(let a of e.features){let s=yl(a,t4);if(s==null||r.has(s))return;r.add(s),i.set(s,a)}return i}}function II(e,t4,i){var a,s;let r=[];if(t4.removeAll)e.clear();else if(t4.remove)for(let n of t4.remove){let o=e.get(n);o&&(r.push(o.geometry),e.delete(n))}if(t4.add)for(let n of t4.add){let o=yl(n,i);if(o==null)continue;let l=e.get(o);l&&r.push(l.geometry),r.push(n.geometry),e.set(o,n)}if(t4.update)for(let n of t4.update){let o=e.get(n.id);if(!o)continue;let l=!!n.newGeometry,u=n.removeAllProperties||((a=n.removeProperties)==null?void 0:a.length)>0||((s=n.addOrUpdateProperties)==null?void 0:s.length)>0;if(!l&&!u)continue;r.push(o.geometry);let h={...o};if(e.set(n.id,h),l&&(r.push(n.newGeometry),h.geometry=n.newGeometry),u){if(h.properties=n.removeAllProperties?{}:{...h.properties||{}},n.removeProperties)for(let c of n.removeProperties)delete h.properties[c];if(n.addOrUpdateProperties)for(let{key:c,value:d}of n.addOrUpdateProperties)h.properties[c]=d}}return r}function MI(e,t4,i){if(!e)return t4||{};if(!t4)return e||{};let r=Nm(e,i),a=Nm(t4,i);FI(r,a);let s={};if((r.removeAll||a.removeAll)&&(s.removeAll=true),s.remove=new Set([...r.remove,...a.remove]),s.add=new Map([...r.add,...a.add]),s.update=new Map([...r.update,...a.update]),s.remove.size&&s.add.size)for(let n of s.add.keys())s.remove.delete(n);return RI(s)}function FI(e,t4){t4.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t4.remove.clear());for(let i of t4.remove)e.add.delete(i),e.update.delete(i);for(let[i,r]of t4.update){let a=e.update.get(i);a&&(t4.update.set(i,zI(a,r)),e.update.delete(i))}}function zI(e,t4){let i={id:e.id};if(t4.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t4.removeProperties),t4.removeProperties&&e.addOrUpdateProperties){let r=new Set(t4.removeProperties);e.addOrUpdateProperties=e.addOrUpdateProperties.filter(a=>!r.has(a.key))}return(e.removeAllProperties||t4.removeAllProperties)&&(i.removeAllProperties=true),(e.removeProperties||t4.removeProperties)&&(i.removeProperties=[...e.removeProperties||[],...t4.removeProperties||[]]),(e.addOrUpdateProperties||t4.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t4.addOrUpdateProperties||[]]),(e.newGeometry||t4.newGeometry)&&(i.newGeometry=t4.newGeometry||e.newGeometry),i}function Nm(e,t4){var r,a;if(!e)return{};let i={};return i.removeAll=e.removeAll,i.remove=new Set(e.remove||[]),i.add=new Map((r=e.add)==null?void 0:r.map(s=>[yl(s,t4),s])),i.update=new Map((a=e.update)==null?void 0:a.map(s=>[s.id,s])),i}function RI(e){let t4={};return e.removeAll&&(t4.removeAll=e.removeAll),e.remove&&(t4.remove=Array.from(e.remove)),e.add&&(t4.add=Array.from(e.add.values())),e.update&&(t4.update=Array.from(e.update.values())),t4}function O1(e){return!e||e.length===0?[]:typeof e[0]=="number"?[e]:e.flatMap(t4=>O1(t4))}function $o(e){return e.type==="GeometryCollection"?e.geometries.flatMap(t4=>$o(t4)):O1(e.coordinates)}function Gm(e){let t4=new Yi,i;switch(e.type){case"FeatureCollection":i=e.features.flatMap(r=>$o(r.geometry));break;case"Feature":i=$o(e.geometry);break;default:i=$o(e)}if(i.length===0)return t4;for(let r of i){let[a,s]=r;t4.extend([a,s])}return t4}function kI({x:e,y:t4,z:i},r=0){let a=xc((e-r)/2**i),s=cn((t4+1+r)/2**i),n=xc((e+1+r)/2**i),o=cn((t4-r)/2**i);return new Yi([a,s],[n,o])}var LI=class extends pt{constructor(e,t4,i,r){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=true,this.reparseOverscaled=true,this._removed=false,this._isUpdatingWorker=false,this._pendingWorkerUpdate={data:t4.data},this.actorPromise=i.getActor(),this.setEventedParent(r),this._data=typeof t4.data=="string"?{url:t4.data}:{geojson:t4.data},this._options=W({},t4),this._collectResourceTiming=t4.collectResourceTiming,t4.maxzoom!==void 0&&(this.maxzoom=t4.maxzoom),t4.type&&(this.type=t4.type),t4.attribution&&(this.attribution=t4.attribution),this.promoteId=t4.promoteId,t4.clusterMaxZoom!==void 0&&this.maxzoom<=t4.clusterMaxZoom&&ge(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t4.clusterMaxZoom}".`),this.workerOptions=W({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t4.buffer===void 0?128:t4.buffer),tolerance:this._pixelsToTileUnits(t4.tolerance===void 0?.375:t4.tolerance),extent:k,maxZoom:this.maxzoom,lineMetrics:t4.lineMetrics||false,generateId:t4.generateId||false,promoteId:this._promoteIdKey,cluster:t4.cluster||false,clusterOptions:{maxZoom:this._getClusterMaxZoom(t4.clusterMaxZoom),minPoints:Math.max(2,t4.clusterMinPoints||2),extent:k,radius:this._pixelsToTileUnits(t4.clusterRadius||50),log:false,generateId:t4.generateId||false}},clusterProperties:t4.clusterProperties,filter:t4.filter},t4.workerOptions)}get _promoteIdKey(){return typeof this.promoteId=="string"?this.promoteId:void 0}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(k/this.tileSize)}_tileUnitsToPixels(e){return e/(k/this.tileSize)}_getClusterMaxZoom(e){let t4=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||ge(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${t4}"`),t4}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=typeof e=="string"?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e},this._updateWorkerData()}updateData(e){return this._pendingWorkerUpdate.diff=MI(this._pendingWorkerUpdate.diff,e,this._promoteIdKey),this._updateWorkerData()}async getData(){return this._data.url&&await this.once("data"),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}async getBounds(){return Gm(await this.getData())}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=true,this._updateWorkerData()}getClusterOptions(){let{cluster:e,clusterOptions:t4}=this.workerOptions.geojsonVtOptions;return{cluster:e,clusterMaxZoom:t4.maxZoom,clusterRadius:this._tileUnitsToPixels(t4.radius)}}async getClusterExpansionZoom(e){return(await this.actorPromise).sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterChildren(e){return(await this.actorPromise).sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterLeaves(e,t4,i){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t4,offset:i}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate()){ge(`No pending worker updates for GeoJSONSource ${this.id}.`);return}let{data:e,diff:t4,updateCluster:i}=this._pendingWorkerUpdate,r=this._getLoadGeoJSONParameters(e,t4,i);e===void 0?t4?this._pendingWorkerUpdate.diff=void 0:i&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(r),await this._updatePromise}async _getLoadGeoJSONParameters(e,t4,i){let r=W({type:this.type,source:this.id},this.workerOptions);if(typeof e=="string")return r.request=await this.map._requestManager.transformRequest(Xt.resolveURL(e),"Source"),r.request.collectResourceTiming=this._collectResourceTiming,r;if(e!==void 0)return r.data=e,r;if(t4)return r.dataDiff=t4,r;if(i)return r.updateCluster=true,r}async _dispatchWorkerUpdate(e){this._isUpdatingWorker=true,this.fire(new Ge("dataloading"));try{let t4=await e,i=await(await this.actorPromise).sendAsync({type:"LD",data:t4});if(this._isUpdatingWorker=false,this._removed||i.abandoned){this.fire(new Ge("dataabort"));return}i.data&&(this._data={geojson:i.data});let r=this._applyDiffToSource(t4.dataDiff),a=this._getShouldReloadTileOptions(r),s={};this._applyResourceTiming(s,i),this.fire(new Ge("data",{...s,sourceDataType:"metadata"})),this.fire(new Ge("data",{...s,sourceDataType:"content",shouldReloadTileOptions:a}))}catch(t4){if(this._isUpdatingWorker=false,this._removed){this.fire(new Ge("dataabort"));return}this.fire(new Y(Ft(t4)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(e,t4){var a;if(!this._collectResourceTiming)return;let i=(a=t4.resourceTiming)==null?void 0:a[this.id];if(!i)return;let r=i.slice(0);r!=null&&r.length&&W(e,{resourceTiming:r})}_applyDiffToSource(e){if(!e)return;let t4=this._promoteIdKey;if(!this._data.url&&!this._data.updateable){let r=AI(this._data.geojson,t4);if(!r)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:r}}if(!this._data.updateable)return;let i=II(this._data.updateable,e,t4);if(!(e.removeAll||this._options.cluster))return i}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(t4=>Gm(t4))}}shouldReloadTile(e,{affectedBounds:t4}){if(e.state==="loading")return true;if(e.state==="unloaded")return false;let{buffer:i,extent:r}=this.workerOptions.geojsonVtOptions,a=kI(e.tileID.canonical,i/r);for(let s of t4)if(a.intersects(s))return true;return false}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(e){let t4=e.actor?"RT":"LT";e.actor=await this.actorPromise;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;try{let r=await(await this.actorPromise).sendAsync({type:t4,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t4==="RT")}catch(r){if(delete e.abortController,e.aborted||Cr(r))return;throw r}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=true}async unloadTile(e){e.unloadVectorData(),await(await this.actorPromise).sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=true,this.actorPromise.then(e=>e.sendAsync({type:"RS",data:{type:this.type,source:this.id}}))}serialize(){return W({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return false}};const ja=[0,0,1],BI=(e,t4)=>({u_tl_parent:new de(e,t4.u_tl_parent),u_scale_parent:new U(e,t4.u_scale_parent),u_buffer_scale:new U(e,t4.u_buffer_scale),u_image_warp:new Vt(e,t4.u_image_warp),u_fade_t:new U(e,t4.u_fade_t),u_opacity:new U(e,t4.u_opacity),u_image0:new X(e,t4.u_image0),u_image1:new X(e,t4.u_image1),u_brightness_low:new U(e,t4.u_brightness_low),u_brightness_high:new U(e,t4.u_brightness_high),u_saturation_factor:new U(e,t4.u_saturation_factor),u_contrast_factor:new U(e,t4.u_contrast_factor),u_spin_weights:new Vt(e,t4.u_spin_weights),u_coords_top:new nn(e,t4.u_coords_top),u_coords_bottom:new nn(e,t4.u_coords_bottom)}),OI=(e,t4,i,r,a,s)=>({u_tl_parent:e,u_scale_parent:t4,u_buffer_scale:1,u_image_warp:s,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:jI(r.paint.get("raster-saturation")),u_contrast_factor:VI(r.paint.get("raster-contrast")),u_spin_weights:$I(r.paint.get("raster-hue-rotate")),u_coords_top:[a[0].x,a[0].y,a[1].x,a[1].y],u_coords_bottom:[a[3].x,a[3].y,a[2].x,a[2].y]});function $I(e){e*=Math.PI/180;let t4=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t4-i+1)/3,(Math.sqrt(3)*t4-i+1)/3]}function VI(e){return e>0?1/(1-e):1+e}function jI(e){return e>0?1-1/(1.001-e):-e}var Cn=class{constructor(e,t4,i){this.vertexBuffer=e,this.indexBuffer=t4,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};const Zr=Ke([{name:"a_pos",type:"Int16",components:2}]),_o=k/128;function $1(e,t4){let i=UI(t4,"16bit"),r=Tr.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),a=Qi.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new Cn(e.createVertexBuffer(r,Zr.members),e.createIndexBuffer(a),We.simpleSegment(0,0,r.length,a.length))}function UI(e,t4){let i=e.granularity===void 0?1:Math.max(e.granularity,1),r=i+(e.generateBorders?2:0),a=i+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),s=r+1,n=a+1,o=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,u=i+ +!!e.generateBorders,h=i+(e.generateBorders||e.extendToSouthPole?1:0),c=s*n,d=r*a*6,p=s*n>65536;if(p&&t4==="16bit")throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let f=p||t4==="32bit",m=new Int16Array(c*2),g=0;for(let x=l;x<=h;x++)for(let v=o;v<=u;v++){let w=v/i*k;v===-1&&(w=-_o),v===i+1&&(w=k+_o);let b=x/i*k;x===-1&&(b=e.extendToNorthPole?Us:-_o),x===i+1&&(b=e.extendToSouthPole?Ns:k+_o),m[g++]=w,m[g++]=b}let _=f?new Uint32Array(d):new Uint16Array(d),y=0;for(let x=0;x<a;x++)for(let v=0;v<r;v++){let w=v+x*s,b=v+1+x*s,T=v+(x+1)*s,P=v+1+(x+1)*s;_[y++]=w,_[y++]=T,_[y++]=b,_[y++]=b,_[y++]=T,_[y++]=P}return{vertices:m.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:f}}var Pn=class extends pt{constructor(e,t4,i,r){super(),this.imageWarp=ja,this.flippedWindingOrder=false,this._warp="auto",this._imageDirty=false,this._subdividedQuad=false,this._subdividedMesh=null,this.id=e,this.dispatcher=i,this.coordinates=t4.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=false,this.setEventedParent(r),this.options=t4}async load(e){if(this.options.url===void 0){this._loaded=true,this._finishLoading();return}this._loaded=false,this.fire(new Ge("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let t4=await qi.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=true,t4!=null&&t4.data?(this._setImage(t4.data),e&&(this.coordinates=e),this._finishLoading()):this.fire(new Y(Error(`Could not load image ${this.url}: the response is empty`)))}catch(t4){if(Cr(t4))return;this._abortController=null,this._loaded=true,this.fire(new Y(Ft(t4)))}}loaded(){return this._loaded}updateImage(e){return this._abortController&&(this._abortController=(this._abortController.abort(),null)),"image"in e?(this._loaded=true,this._setImage(e.image),e.coordinates&&(this.coordinates=e.coordinates),this._finishLoading(),this):e.url?(this.options.url=e.url,this.load(e.coordinates),this):this}_setImage(e){this.image=e,this._imageDirty=true}getMesh(e,t4){return!this._subdividedQuad||t4?null:(this._subdividedMesh??(this._subdividedMesh=$1(e,{granularity:16})),this._subdividedMesh)}_disposeTexture(){var e;(e=this.texture)==null||e.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Ge("data",{sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){var e;this._abortController&&(this._abortController=(this._abortController.abort(),null)),this._disposeTexture(),(e=this._subdividedMesh)==null||e.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(e){return this._warp===e?this:(this._warp=e,this.tileCoords&&this.setCoordinates(this.coordinates),this)}getWarp(){return this._warp}setCoordinates(e){this.coordinates=e;let t4=e.map(Ie.fromLngLat);return this.tileID=NI(t4),this.terrainTileRanges=this._getOverlappingTileRanges(t4),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t4.map(i=>this.tileID.getTilePoint(i)._round()),this.imageWarp=ZI(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!V1(this.tileCoords),this.flippedWindingOrder=GI(this.tileCoords),this.fire(new Ge("data",{sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t4=e.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(t4.LINEAR,t4.CLAMP_TO_EDGE)):(this.texture=new dt(e,this.image,t4.RGBA),this.texture.bind(t4.LINEAR,t4.CLAMP_TO_EDGE)),this._imageDirty=false;let i=false;for(let r in this.tiles){let a=this.tiles[r];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=true)}i&&this.fire(new Ge("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){var t4;(t4=this.tileID)!=null&&t4.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){let e={type:"image",coordinates:this.coordinates};return this.options.url!==void 0&&(e.url=this.options.url),e}hasTransition(){return false}_getOverlappingTileRanges(e){let{minX:t4,minY:i,maxX:r,maxY:a}=Ai.fromPoints(e),s={};for(let n=0;n<=25;n++){let o=2**n,l=Math.floor(t4*o),u=Math.floor(i*o),h=Math.floor(r*o),c=Math.floor(a*o),d=(l%o+o)%o,p=h%o,f=Math.floor(l/o),m=Math.floor(h/o);s[n]={minWrap:f,maxWrap:m,minTileXWrapped:d,maxTileXWrapped:p,minTileY:u,maxTileY:c}}return s}};function NI(e){let t4=Ai.fromPoints(e),i=t4.width(),r=t4.height(),a=Math.max(0,Math.floor(-Math.log(Math.max(i,r))/Math.LN2)),s=2**a;return new Yl(a,Math.floor((t4.minX+t4.maxX)/2*s),Math.floor((t4.minY+t4.maxY)/2*s))}function GI(e){let t4=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[0].x;return t4*(e[2].y-e[0].y)-i*r<0}function ZI(e,t4){if(t4==="flat"||V1(e))return ja;let[i,r,a,s]=e,n=i.x-r.x+a.x-s.x,o=i.y-r.y+a.y-s.y,l=[r.x-a.x,r.y-a.y,s.x-a.x,s.y-a.y],[u,h,c,d]=l,p=AA(l),f=(n*d-c*o)/p,m=(u*o-n*h)/p,g=[1,1+f,1+f+m,1+m],_=Math.max(...g)/Math.min(...g),y=t4==="perspective"?0:qI(_);return!(_>=1&&_<=512)||y>=1?ja:[f,m,y]}function qI(e){let t4=(1-4/e)/.9921875;return Math.max(0,t4)}function V1(e){let[t4,i,r,a]=e;return t4.x+r.x===i.x+a.x&&t4.y+r.y===i.y+a.y}var WI=class extends Pn{constructor(e,t4,i,r){super(e,t4,i,r),this._onPlayingHandler=()=>{var a;(a=this.map)==null||a.triggerRepaint()},this.roundZoom=true,this.type="video",this.options=t4}async load(){this._loaded=false;let e=this.options;this.urls=[];for(let t4 of e.urls)this.urls.push((await this.map._requestManager.transformRequest(t4,"Source")).url);try{let t4=await Xx(this.urls);if(this._loaded=true,!t4)return;this.video=t4,this.video.loop=true,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(t4){this.fire(new Y(Ft(t4)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t4=this.video.seekable;e<t4.start(0)||e>t4.end(0)?this.fire(new Y(new B(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t4.start(0)} and ${t4.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t4=e.gl;this.texture?this.video.paused||(this.texture.bind(t4.LINEAR,t4.CLAMP_TO_EDGE),t4.texSubImage2D(t4.TEXTURE_2D,0,0,0,t4.RGBA,t4.UNSIGNED_BYTE,this.video)):(this.texture=new dt(e,this.video,t4.RGBA),this.texture.bind(t4.LINEAR,t4.CLAMP_TO_EDGE));let i=false;for(let r in this.tiles){let a=this.tiles[r];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=true)}i&&this.fire(new Ge("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},HI=class extends Pn{constructor(e,t4,i,r){super(e,t4,i,r),t4.coordinates?(!Array.isArray(t4.coordinates)||t4.coordinates.length!==4||t4.coordinates.some(a=>!Array.isArray(a)||a.length!==2||a.some(s=>typeof s!="number")))&&this.fire(new Y(new B(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new Y(new B(`sources.${e}`,null,'missing required property "coordinates"'))),t4.animate&&typeof t4.animate!="boolean"&&this.fire(new Y(new B(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t4.canvas?typeof t4.canvas!="string"&&!(t4.canvas instanceof HTMLCanvasElement)&&this.fire(new Y(new B(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new Y(new B(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t4,this.animate=t4.animate===void 0||t4.animate}async load(){if(this._loaded=true,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()){this.fire(new Y(Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=true,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this._playing=(this.prepare(),false))},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=false,super.onRemove()}prepare(){let e=false;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=true),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=true),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t4=this.map.painter.context,i=t4.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:true}):(this.texture=new dt(t4,this.canvas,i.RGBA,{premultiply:true}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=false;for(let a in this.tiles){let s=this.tiles[a];s.state!=="loaded"&&(s.state="loaded",s.texture=this.texture,r=true)}r&&this.fire(new Ge("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return true;return false}};const j1={},XI=(e,t4,i,r)=>{let a=new(U1(t4.type))(e,t4,i,r);if(a.id!==e)throw Error(`Expected Source id to be ${e} instead of ${a.id}`);return a},U1=e=>{switch(e){case"geojson":return LI;case"image":return Pn;case"raster":return B1;case"raster-dem":return PI;case"vector":return CI;case"video":return WI;case"canvas":return HI}return j1[e]},YI=(e,t4)=>{j1[e]=t4},L4=async(e,t4)=>{if(U1(e))throw Error(`A source type called "${e}" already exists.`);YI(e,t4)};function KI(e,t4){let i={};if(!t4)return i;for(let r of e){let a=r.layerIds.map(s=>t4.getLayer(s)).filter(Boolean);if(a.length!==0){r.layers=a,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(s=>a.filter(n=>n.id===s)[0]));for(let s of a)i[s.id]=r}}return i}const Bc="RTLPluginLoaded";var JI=class extends pt{constructor(...e){super(...e),this.status="unavailable",this.url=null,this.dispatcher=F1()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(t4=>{throw this.status="error",t4})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(e,t4=false){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Xt.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status==="unavailable")if(t4)this.status="deferred",this._syncState(this.status);else return this._requestImport();else if(this.status==="requested")return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new bi(Bc))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}};let Zm=null;function pn(){return Zm||(Zm=new JI),Zm}var N1=class{constructor(e,t4){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t_(),this.uses=0,this.tileSize=t4,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=false,this.hasRTLText=false,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading",this.featureStateRevision=-1}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadingDirection!==0||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t4,fadingParentID:i,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t4,this.fadingParentID=i,this.fadeEndTime=r}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=true,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=false,this.timeAdded=ze(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(e){return this.rttObjects[e]}acquireRTT(e,t4,i){return this.rttObjects[t4]=e.acquireRTT(i)}releaseRTT(e){if(this.rttObjects.length!==0){for(let t4 of this.rttObjects)t4&&e.releaseRTT(t4);this.rttObjects.length=0}}loadVectorData(e,t4,i){if((e==null?void 0:e.etagUnmodified)===true){this.state="loaded";return}if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new ky;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=KI(e.buckets,t4==null?void 0:t4.style),this.hasSymbolBuckets=false;for(let r in this.buckets){let a=this.buckets[r];if(a instanceof fl)if(this.hasSymbolBuckets=true,i)a.justReloaded=true;else break}if(this.hasRTLText=false,this.hasSymbolBuckets)for(let r in this.buckets){let a=this.buckets[r];if(a instanceof fl&&a.hasRTLText){this.hasRTLText=true,pn().lazyLoad();break}}this.queryPadding=0;for(let r in this.buckets){let a=this.buckets[r];this.queryPadding=Math.max(this.queryPadding,t4.style.getLayer(r).queryRadius(a))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(e)}let t4=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new dt(e,this.imageAtlas.image,t4.RGBA),this.imageAtlas.uploaded=true),this.glyphAtlasImage&&(this.glyphAtlasImage=(this.glyphAtlasTexture=new dt(e,this.glyphAtlasImage,t4.ALPHA),null))}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t4,i,r,a,s,n,o,l,u,h){var c;return(c=this.latestFeatureIndex)!=null&&c.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:a,scale:s,tileSize:this.tileSize,pixelPosMatrix:u,transform:o,params:n,queryPadding:this.queryPadding*l,getElevation:h},e,t4,i):{}}querySourceFeatures(e,t4){let i=this.latestFeatureIndex;if(!(i!=null&&i.rawTileData))return;let r=i.loadVTLayers(),a=t4!=null&&t4.sourceLayer?t4.sourceLayer:"",s=r._geojsonTileLayer||r[a];if(!s)return;let n=Qs(t4==null?void 0:t4.filter,`querySourceFeatures[${a}].filter`,t4==null?void 0:t4.globalState),{z:o,x:l,y:u}=this.tileID.canonical,h={z:o,x:l,y:u};for(let c=0;c<s.length;c++){let d=s.feature(c);if(n.needGeometry){let m=oa(d,true);if(!n.filter(new Fe(this.tileID.overscaledZ),m,this.tileID.canonical))continue}else if(!n.filter(new Fe(this.tileID.overscaledZ),d))continue;let p=i.getId(d,a),f=new K0(d,o,l,u,p);f.tile=h,e.push(f)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t4=this.expirationTime;if(e.cacheControl){let i=Lx(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+i["max-age"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let i=Date.now(),r=false;if(this.expirationTime>i)r=false;else if(!t4)r=true;else if(this.expirationTime<t4)r=true;else{let a=this.expirationTime-t4;a?this.expirationTime=i+Math.max(a,3e4):r=true}r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),2**31-1)}setFeatureState(e,t4,i){var a,s,n;if(!((a=this.latestFeatureIndex)!=null&&a.rawTileData)||Object.keys(e).length===0||this.featureStateRevision===i)return;this.featureStateRevision=i;let r=this.latestFeatureIndex.loadVTLayers();for(let o in this.buckets){if(!t4.style.hasLayer(o))continue;let l=this.buckets[o],u=l.layers[0].sourceLayer||"_geojsonTileLayer",h=r[u],c=e[u];if(!h||!c||c.length===0)continue;l.update(c,h,((s=this.imageAtlas)==null?void 0:s.patternPositions)||{},this.dashPositions||{});let d=(n=t4==null?void 0:t4.style)==null?void 0:n.getLayer(o);d&&(this.queryPadding=Math.max(this.queryPadding,d.queryRadius(l)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ze()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=ze()+e}setDependencies(e,t4){let i={};for(let r of t4)i[r]=true;this.dependencies[e]=i}hasDependency(e,t4){for(let i of e){let r=this.dependencies[i];if(r){for(let a of t4)if(r[a])return true}}return false}};function qm(e){let t4=[];for(let i in e)t4.push({id:i,state:e[i]});return t4}var QI=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,t4,i){var a,s,n,o,l;let r=String(t4);if((a=this.stateChanges)[e]||(a[e]={}),(s=this.stateChanges[e])[r]||(s[r]={}),W(this.stateChanges[e][r],i),this.deletedStates[e]===null){this.deletedStates[e]={};for(let u in this.state[e])if(u===r){this.deletedStates[e][r]={};for(let h in this.state[e][u])i[h]===void 0&&(this.deletedStates[e][r][h]=null)}else this.deletedStates[e][u]=null}else if(((n=this.deletedStates[e])==null?void 0:n[r])===null){this.deletedStates[e][r]={};for(let u in this.state[e][r])i[u]===void 0&&(this.deletedStates[e][r][u]=null)}else for(let u in i)((l=(o=this.deletedStates[e])==null?void 0:o[r])==null?void 0:l[u])===null&&delete this.deletedStates[e][r][u]}removeFeatureState(e,t4,i){var a,s,n;if(this.deletedStates[e]===null)return;let r=String(t4);if((a=this.deletedStates)[e]||(a[e]={}),i&&t4!==void 0)this.deletedStates[e][r]!==null&&((s=this.deletedStates[e])[r]||(s[r]={}),this.deletedStates[e][r][i]=null);else if(t4!==void 0)if((n=this.stateChanges[e])!=null&&n[r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,t4){let i=String(t4),r=this.state[e]||{},a=this.stateChanges[e]||{},s=W({},r[i],a[i]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let n=this.deletedStates[e][t4];if(n===null)return{};for(let o in n)delete s[o]}return s}initializeTileState(e,t4){let i={};for(let r in this.state)i[r]=qm(this.state[r]);e.setFeatureState(i,t4,this.revision)}coalesceChanges(e,t4){var a,s,n;let i={};for(let o in this.stateChanges){(a=this.state)[o]||(a[o]={}),i[o]||(i[o]={});for(let l in this.stateChanges[o])(s=this.state[o])[l]||(s[l]={}),W(this.state[o][l],this.stateChanges[o][l]),i[o][l]=this.state[o][l]}for(let o in this.deletedStates)if((n=this.state)[o]||(n[o]={}),i[o]||(i[o]={}),this.deletedStates[o]===null)for(let l in this.state[o])this.state[o][l]={},i[o][l]={};else for(let l in this.deletedStates[o]){if(this.deletedStates[o][l]===null)this.state[o][l]={};else for(let u of Object.keys(this.deletedStates[o][l]))delete this.state[o][l][u];i[o][l]=this.state[o][l]}if(this.stateChanges={},this.deletedStates={},Object.keys(i).length===0)return;this.revision++;let r={};for(let o in i)r[o]=qm(i[o]);e.setFeatureState(r,t4,this.revision)}},Qd=class G1{constructor(t4,i){this.min=t4,this.max=i,this.center=Ne([],fi([],this.min,this.max),.5)}quadrant(t4){let i=[t4%2==0,t4<2],r=xh(this.min),a=xh(this.max);for(let s=0;s<i.length;s++)r[s]=i[s]?this.min[s]:this.center[s],a[s]=i[s]?this.center[s]:this.max[s];return a[2]=this.max[2],new G1(r,a)}distanceX(t4){return Math.max(Math.min(this.max[0],t4[0]),this.min[0])-t4[0]}distanceY(t4){return Math.max(Math.min(this.max[1],t4[1]),this.min[1])-t4[1]}intersectsFrustum(t4){let i=true;for(let r of t4.planes){let a=this.intersectsPlane(r);if(a===0)return 0;a===1&&(i=false)}return i?2:t4.aabb.min[0]>this.max[0]||t4.aabb.min[1]>this.max[1]||t4.aabb.min[2]>this.max[2]||t4.aabb.max[0]<this.min[0]||t4.aabb.max[1]<this.min[1]||t4.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t4){let i=t4[3],r=t4[3];for(let a=0;a<3;a++)t4[a]>0?(i+=t4[a]*this.min[a],r+=t4[a]*this.max[a]):(r+=t4[a]*this.min[a],i+=t4[a]*this.max[a]);return i>=0?2:r<0?0:1}},ep=class Z1{constructor(t4,i,r){this.points=t4,this.planes=i,this.aabb=r}static fromInvProjectionMatrix(t4,i=1,r=0,a,s){let n=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],o=s?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=2**r,u=n.map(p=>eM(p,t4,i,l));a&&tM(u,o[0],a,s);let h=o.map(p=>{let f=cr([],u[p[0]],u[p[1]]),m=cr([],u[p[2]],u[p[1]]),g=Bt([],Ht([],f,m)),_=-lt(g,u[p[1]]);return g.concat(_)}),c=[1/0,1/0,1/0],d=[-1/0,-1/0,-1/0];for(let p of u)for(let f=0;f<3;f++)c[f]=Math.min(c[f],p[f]),d[f]=Math.max(d[f],p[f]);return new Z1(u,h,new Qd(c,d))}};function eM(e,t4,i,r){let a=Ct([],e,t4),s=1/a[3]/i*r;return xx(a,a,[s,s,1/a[3],s])}function tM(e,t4,i,r){let a=r?4:0,s=r?0:4,n=0,o=[],l=[];for(let c=0;c<4;c++){let d=cr([],e[c+s],e[c+a]),p=Ci(d);Ne(d,d,1/p),o.push(p),l.push(d)}for(let c=0;c<4;c++){let d=Cx(e[c+a],l[c],i);n=d!==null&&d>=0?Math.max(n,d):Math.max(n,o[c])}let u=iM(e,t4),h=rM(i,u);if(h!==null){let c=h/lt(l[0],u);n=Math.min(n,c)}for(let c=0;c<4;c++){let d=Math.min(n,o[c]);e[c+s]=[e[c+a][0]+l[c][0]*d,e[c+a][1]+l[c][1]*d,e[c+a][2]+l[c][2]*d,1]}}function iM(e,t4){let i=cr([],e[t4[0]],e[t4[1]]),r=cr([],e[t4[2]],e[t4[1]]),a=[0,0,0,0];return Bt(a,Ht([],i,r)),a[3]=-lt(a,e[t4[0]]),a}function rM(e,t4){let i=Zo(e),r=yx([],e,1/i),a=cr([],t4,Ne([],r,lt(t4,r))),s=Zo(a);if(s>0){let n=Math.sqrt(1-r[3]*r[3]),o=Ne([],r,-r[3]),l=fi([],o,Ne([],a,n/s));return wh(t4,l)}return null}function aM(e,t4,i){let r=t4.intersectsFrustum(e);if(!i||r===0)return r;let a=t4.intersectsPlane(i);return a===0?0:r===2&&a===2?2:1}function Wm(e,t4,i){let r=0,a=(i-t4)/10;for(let s=0;s<10;s++){let n=t4+(s+.5)/10*(i-t4);r+=a*Math.cos(n)**+e}return r}function Oc(e,t4){return function(i,r,a,s,n){let o=2*((e-1)/It(Math.cos(Ze(Yr-n))/Math.cos(Ze(Yr)))-1),l=Math.acos(a/s),u=2*Wm(o-1,0,Ze(n/2)),h=Math.min(Ze(Yr),l+Ze(n/2)),c=Math.min(h,l-Ze(n/2)),d=Wm(o-1,c,h),p=Math.atan(r/a),f=Math.hypot(r,a),m=i;return m+=It(s/f/Math.max(.5,Math.cos(Ze(n/2)))),m+=o*It(Math.cos(p))/2,m-=It(Math.max(1,d/u/t4))/2,m}}const sM=Oc(9.314,3);function tp(e,t4){let i=(t4.roundZoom?Math.round:Math.floor)(e.zoom+It(e.tileSize/t4.tileSize));return Math.max(0,i)}function nM(e,t4){let i=Yr-e.pitch-e.fov/2,r=ne((15-i)/15,0,1),a=Math.max(500,t4??0);return e.elevation+r*a}function oM(e,t4,i){let r=e.planes[1],a=e.points.map(l=>{let u=r[0]*l[0]+r[1]*l[1]+r[2]*l[2]+r[3];if(Math.abs(u)>1e-6)return l;let h=[l[0]-i[0],l[1]-i[1],l[2]-i[2]],c=r[0]*h[0]+r[1]*h[1]+r[2]*h[2];if(c>=-1e-9)return l;let d=t4/-c;return[l[0]+h[0]*d,l[1]+h[1]*d,l[2]+h[2]*d,l[3]]}),s=e.planes.map((l,u)=>u===1?[l[0],l[1],l[2],l[3]+t4]:l),n=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let l of a)for(let u=0;u<3;u++)n[u]=Math.min(n[u],l[u]),o[u]=Math.max(o[u],l[u]);return new ep(a,s,new Qd(n,o))}function lM(e,t4,i,r){let a=Math.hypot(t4[0],t4[1],t4[2]);if(a===0)return{frustum:e,plane:t4};let s=1+r/Lt,n=ne(-t4[3]/a,-1,1),o=Math.cos(Math.acos(n)+Math.acos(1/s));return{frustum:oM(e,Math.sqrt(s*s-1),i),plane:[t4[0],t4[1],t4[2],-o*a]}}function ss(e,t4){let i=e.getCameraFrustum(),r=e.getClippingPlane();r&&t4.maxContentElevation>0&&({frustum:i,plane:r}=lM(i,r,e.cameraPosition,t4.maxContentElevation));let a=eE(e),s=Ie.fromLngLat(e.center,e.elevation),n=nM(e,t4.maxContentElevation),o=e.getCoveringTilesDetailsProvider(),l=o.allowVariableZoom(e,t4),u=tp(e,t4),h=t4.minzoom||0,c=t4.maxzoom===void 0?e.maxZoom:t4.maxzoom,d=Math.min(Math.max(0,u),c),p=2**d,f=[p*a.x,p*a.y,0],m=[p*s.x,p*s.y,0],g=Math.hypot(s.x-a.x,s.y-a.y),_=Math.abs(s.z-a.z),y=Math.hypot(g,_),x=b=>({zoom:0,x:0,y:0,wrap:b,fullyVisible:false}),v=[],w=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let b=1;b<=3;b++)v.push(x(-b)),v.push(x(b));for(v.push(x(0));v.length>0;){let b=v.pop(),T=b.x,P=b.y,E=b.fullyVisible,I={x:T,y:P,z:b.zoom},R=o.getTileBoundingVolume(I,b.wrap,n,t4);if(!E){let D=aM(i,R,r);if(D===0)continue;E=D===2}let z=o.distanceToTile2d(a.x,a.y,I,R),S=u;l&&(S=(t4.calculateTileZoom||sM)(e.zoom+It(e.tileSize/t4.tileSize),z,_,y,e.fov)),S=(t4.roundZoom?Math.round:Math.floor)(S),S=Math.max(0,S);let A=Math.min(S,c);if(b.wrap=o.getWrap(s,I,b.wrap),b.zoom>=A){if(b.zoom<h)continue;let D=d-b.zoom,M=f[0]-.5-(T<<D),L=f[1]-.5-(P<<D),O=t4.reparseOverscaled?Math.max(b.zoom,S):b.zoom;w.push({tileID:new St(b.zoom===c?O:b.zoom,b.wrap,b.zoom,T,P),distanceSq:Dx([m[0]-.5-T,m[1]-.5-P]),tileDistanceToCamera:Math.sqrt(M*M+L*L)});continue}for(let D=0;D<4;D++){let M=(T<<1)+D%2,L=(P<<1)+(D>>1),O=b.zoom+1;v.push({zoom:O,x:M,y:L,wrap:b.wrap,fullyVisible:E})}}return w.sort((b,T)=>b.distanceSq-T.distanceSq).map(b=>b.tileID)}function Hm(e){return e==="raster"||e==="image"||e==="video"}function uM(e,t4,i,r,a,s,n){let o=ze(),l=Ax(t4);for(let u of t4){let h=e.getTileById(u.key);(h.fadingDirection===0||h.fadeOpacity===0)&&h.resetFadeLogic(),!hM(e,h,i,o,r,a,n)&&(cM(e,h,i,o,s,n)||dM(h,l,o,n)||h.resetFadeLogic())}}function hM(e,t4,i,r,a,s,n){if(!t4.hasData())return false;let{tileID:o,fadingRole:l,fadingDirection:u,fadingParentID:h}=t4;if(l===0&&u===1&&h)return i[h.key]=h,true;let c=Math.max(o.overscaledZ-a,s);for(let d=o.overscaledZ-1;d>=c;d--){let p=o.scaledTo(d),f=e.getLoadedTile(p);if(f)return t4.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:f.tileID,fadeEndTime:r+n}),f.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:r+n}),i[p.key]=p,true}return false}function cM(e,t4,i,r,a,s){if(!t4.hasData())return false;let n=t4.tileID.children(a),o=Xm(e,t4,n,i,r,a,s);if(o)return true;for(let l of n)Xm(e,t4,l.children(a),i,r,a,s)&&(o=true);return o}function Xm(e,t4,i,r,a,s,n){if(i[0].overscaledZ>=s)return false;let o=false;for(let l of i){let u=e.getLoadedTile(l);if(!u)continue;let{fadingRole:h,fadingDirection:c,fadingParentID:d}=u;(h!==0||c!==0||!d)&&(u.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:t4.tileID,fadeEndTime:a+n}),t4.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:a+n})),r[l.key]=l,o=true}return o}function dM(e,t4,i,r){let a=e.tileID;if(e.selfFading)return true;if(e.hasData())return false;if(t4.has(a)){let s=i+r;return e.setSelfFadeLogic(s),true}return false}function pM(e,t4){if(t4<=0)return false;let i=ze();for(let r of e.getAllTiles())if(r.fadeEndTime>=i)return true;return false}function fM(e,t4){var r,a,s;let i=t4.getRenderableIds();for(let n of i){if(!((r=e.neighboringTiles)!=null&&r[n]))continue;let o=t4.getTileById(n);e.neighboringTiles[n].backfilled||Ym(e,o),!((s=(a=o.neighboringTiles)==null?void 0:a[e.tileID.key])!=null&&s.backfilled)&&Ym(o,e)}}function Ym(e,t4){var n;e.needsHillshadePrepare=true,e.needsTerrainPrepare=true,e.needsColorReliefPrepare=true;let i=t4.tileID.canonical.x-e.tileID.canonical.x,r=t4.tileID.canonical.y-e.tileID.canonical.y,a=2**e.tileID.canonical.z,s=t4.tileID.key;(i!==0||r!==0)&&(Math.abs(r)>1||(Math.abs(i)>1&&(Math.abs(i+a)===1?i+=a:Math.abs(i-a)===1&&(i-=a)),t4.dem&&e.dem&&(e.dem.backfillBorder(t4.dem,i,r),(n=e.neighboringTiles)!=null&&n[s]&&(e.neighboringTiles[s].backfilled=true))))}var Km=class{constructor(){this._tiles={}}handleWrapJump(e){let t4={};for(let i in this._tiles){let r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t4[r.tileID.key]=r}this._tiles=t4}setFeatureState(e,t4,i){for(let r in this._tiles)this._tiles[r].setFeatureState(e,t4,i)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=false){return e?Object.values(this._tiles).map(t4=>t4.tileID).sort(gm).map(t4=>t4.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t4){this._tiles[e]=t4}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t4=this.getTileById(e.key);return t4!=null&&t4.hasData()?t4:null}isIdRenderable(e,t4=false){var i;return(i=this.getTileById(e))==null?void 0:i.isRenderable(t4)}getRenderableIds(e=0,t4){let i=[];for(let r of this.getAllIds())this.isIdRenderable(r,t4)&&i.push(this.getTileById(r));return t4?i.sort((r,a)=>{let s=r.tileID,n=a.tileID,o=new C(s.canonical.x,s.canonical.y)._rotate(-e),l=new C(n.canonical.x,n.canonical.y)._rotate(-e);return s.overscaledZ-n.overscaledZ||l.y-o.y||l.x-o.x}).map(r=>r.tileID.key):i.map(r=>r.tileID).sort(gm).map(r=>r.key)}},hr,$c=(hr=class extends pt{constructor(t4,i,r){super(),this._maxContentElevationSeen=0,this.id=t4,this.dispatcher=r,this.on("data",a=>{this._dataHandler(a)}),this.on("dataloading",()=>{this._sourceErrored=false}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=XI(t4,i,r,this),this._inViewTiles=new Km,this._outOfViewCache=new CA(0,a=>this._unloadTile(a)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new QI,this._didEmitContent=false,this._updated=false}onAdd(t4){var i;this.map=t4,this._maxTileCacheSize=t4?t4._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t4?t4._maxTileCacheZoomLevels:null,(i=this._source)!=null&&i.onAdd&&this._source.onAdd(t4)}onRemove(t4){var i;for(let r of this._inViewTiles.getAllTiles())r.unloadVectorData();this.clearTiles(),(i=this._source)!=null&&i.onRemove&&this._source.onRemove(t4),this._inViewTiles=new Km}loaded(){if(this._sourceErrored)return true;if(!this._sourceLoaded||!this._source.loaded())return false;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return true;if(!this._updated)return false;for(let t4 of this._inViewTiles.getAllTiles())if(t4.state!=="loaded"&&t4.state!=="errored")return false;return true}getSource(){return this._source}getState(){return this._state}pause(){this._paused=true}resume(){if(!this._paused)return;let t4=this._shouldReloadOnResume;this._paused=false,this._shouldReloadOnResume=false,t4&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(t4,i,r,a){try{let s=await this._source.loadTile(t4);this._tileLoaded(t4,i,r,a,s)}catch(s){t4.state="errored",s.status===404?this.update(this.transform,this.terrain):this._source.fire(new Y(Ft(s),{tile:t4}))}}_unloadTile(t4){this._source.unloadTile&&this._source.unloadTile(t4)}_abortTile(t4){this._source.abortTile&&this._source.abortTile(t4),this._source.fire(new Ge("dataabort",{tile:t4,coord:t4.tileID}))}serialize(){return this._source.serialize()}prepare(t4){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let i of this._inViewTiles.getAllTiles())i.upload(t4),i.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(true)}getRenderableIds(t4){var i;return this._inViewTiles.getRenderableIds((i=this.transform)==null?void 0:i.bearingInRadians,t4)}hasRenderableParent(t4){let i=t4.overscaledZ-1;if(i>=this._source.minzoom){let r=this.getLoadedTile(t4.scaledTo(i));if(r)return this._inViewTiles.isIdRenderable(r.tileID.key)}return false}reload(t4,i=void 0){if(this._paused){this._shouldReloadOnResume=true;return}this._outOfViewCache.reset();for(let r of this._inViewTiles.getAllIds()){let a=this._inViewTiles.getTileById(r);(!i||this._source.shouldReloadTile(a,i))&&(t4?this._reloadTile(r,a.state==="errored"?"loading":"expired"):a.state!=="errored"&&this._reloadTile(r,"reloading"))}}async _reloadTile(t4,i){let r=this._inViewTiles.getTileById(t4);if(!r)return;let a=r.hasData();r.state!=="loading"&&(r.state=i),await this._loadTile(r,t4,i,a)}_tileLoaded(t4,i,r,a,s){a||(t4.timeAdded=ze(),t4.selfFading&&(t4.fadeEndTime=t4.timeAdded+this._rasterFadeDuration)),r==="expired"&&(t4.refreshedUponExpiration=true),this._setTileReloadTimer(i,t4),!(s!=null&&s.unmodified)&&(this.getSource().type==="raster-dem"&&t4.dem&&fM(t4,this._inViewTiles),t4.featureStateRevision=-1,this._state.initializeTileState(t4,this.map?this.map.painter:null),t4.aborted||this._source.fire(new Ge("data",{tile:t4,coord:t4.tileID})))}getTile(t4){return this.getTileByID(t4.key)}getTileByID(t4){return this._inViewTiles.getTileById(t4)}_retainLoadedChildren(t4,i){let r=this._getLoadedDescendents(i),a=new Set;for(let s of i){let n=r[s.key];if(!(n!=null&&n.length)){a.add(s);continue}let o=s.overscaledZ+hr.maxOverzooming,l=n.filter(c=>c.tileID.overscaledZ<=o);if(!l.length){a.add(s);continue}let u=Math.min(...l.map(c=>c.tileID.overscaledZ)),h=l.filter(c=>c.tileID.overscaledZ===u).map(c=>c.tileID);for(let c of h)t4[c.key]=c;this._areDescendentsComplete(h,u,s.overscaledZ)||a.add(s)}return a}_getLoadedDescendents(t4){var r;let i={};for(let a of this._inViewTiles.getAllTiles().filter(s=>s.hasData()))for(let s of t4)a.tileID.isChildOf(s)&&(i[r=s.key]||(i[r]=[]),i[s.key].push(a));return i}_areDescendentsComplete(t4,i,r){return t4.length===1&&t4[0].isOverscaled()?t4[0].overscaledZ===i:4**(i-r)===t4.length}getLoadedTile(t4){return this._inViewTiles.getLoadedTile(t4)}updateCacheSize(t4){let i=(Math.ceil(t4.width/this._source.tileSize)+1)*(Math.ceil(t4.height/this._source.tileSize)+1),r=this._maxTileCacheZoomLevels===null?xi.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,a=Math.floor(i*r),s=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._outOfViewCache.setMaxSize(s)}handleWrapJump(t4){let i=(t4-(this._prevLng===void 0?t4:this._prevLng))/360,r=Math.round(i);this._prevLng=t4,r&&(this._inViewTiles.handleWrapJump(r),this._resetTileReloadTimers())}_updateMaxContentElevation(){var a,s;let t4=this._maxContentElevationSeen,i=(s=(a=this.map)==null?void 0:a.style)==null?void 0:s._layers;if(!i)return t4;let r=this._inViewTiles.getAllTiles();for(let n in i){let o=i[n];if(o.type!=="symbol"||o.source!==this.id||o.isHidden(this.transform.zoom))continue;let l=o;if(!l.layout)continue;let u=l.layout.get("symbol-height-offset");if(t4=Math.max(t4,u.constantOr(0)),!u.isConstant())for(let h of r){let c=h.getBucket(o);c&&c.maxHeightOffset>t4&&(t4=c.maxHeightOffset)}}return this._maxContentElevationSeen=t4,t4}update(t4,i){if(!this._sourceLoaded||this._paused)return;this.transform=t4,this.terrain=i,this.updateCacheSize(t4),this.handleWrapJump(this.transform.center.lng);let r;!this.used&&!this.usedForTerrain?r=[]:this._source.tileID?r=t4.getVisibleUnwrappedCoordinates(this._source.tileID).map(l=>new St(l.canonical.z,l.wrap,l.canonical.z,l.canonical.x,l.canonical.y)):(r=ss(t4,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?Math.max(this._source.maxzoom,t4.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(r=r.filter(l=>this._source.hasTile(l)))),this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));let a=r.length===0&&!this._updated&&this._didEmitContent;this._updated=true,a&&this.fire(new Ge("data",{sourceDataType:"idle",sourceId:this.id}));let s=tp(t4,this._source),n=this._updateRetainedTiles(r,s),o=Hm(this._source.type);o&&this._rasterFadeDuration>0&&!i&&uM(this._inViewTiles,r,n,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),o?this._cleanUpRasterTiles(n):this._cleanUpVectorTiles(n)}_cleanUpRasterTiles(t4){for(let i of this._inViewTiles.getAllIds())t4[i]||this._removeTile(i)}_cleanUpVectorTiles(t4){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);if(t4[i]){r.clearSymbolFadeHold();continue}if(!r.hasSymbolBuckets){this._removeTile(i);continue}r.holdingForSymbolFade()?r.symbolFadeFinished()&&this._removeTile(i):r.setSymbolHoldDuration(this.map._fadeDuration)}}_addTerrainIdealTiles(t4){let i=[];for(let r of t4)if(r.canonical.z>this._source.minzoom){let a=r.scaledTo(r.canonical.z-1);i.push(a);let s=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));i.push(s)}return t4.concat(i)}releaseSymbolFadeTiles(){for(let t4 of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t4).holdingForSymbolFade()&&this._removeTile(t4)}_updateRetainedTiles(t4,i){var l;let r=new Set;for(let u of t4)this._addTile(u).hasData()||r.add(u);let a=t4.reduce((u,h)=>(u[h.key]=h,u),{}),s=this._retainLoadedChildren(a,r),n={},o=Math.max(i-hr.maxUnderzooming,this._source.minzoom);for(let u of s){let h=this._inViewTiles.getTileById(u.key),c=h==null?void 0:h.wasRequested();for(let d=u.overscaledZ-1;d>=o;--d){let p=u.scaledTo(d);if(n[p.key])break;if(n[p.key]=true,h=this.getTile(p),!h&&c&&(h=this._addTile(p)),h){let f=h.hasData();if((f||!((l=this.map)!=null&&l.cancelPendingTileRequestsWhileZooming)||c)&&(a[p.key]=p),c=h.wasRequested(),f)break}}}return a}_addTile(t4){let i=this._inViewTiles.getTileById(t4.key);if(i)return i;i=this._outOfViewCache.getAndRemove(t4),i&&(i.resetFadeLogic(),this._setTileReloadTimer(t4.key,i),i.tileID=t4,this._state.initializeTileState(i,this.map?this.map.painter:null));let r=i;return i||(i=new N1(t4,this._source.tileSize*t4.overscaleFactor()),this._loadTile(i,t4.key,i.state,false)),i.uses++,this._inViewTiles.setTile(t4.key,i),r||this._source.fire(new Ge("dataloading",{tile:i,coord:i.tileID})),i}_setTileReloadTimer(t4,i){this._clearTileReloadTimer(t4);let r=i.getExpiryTimeout();if(r){let a=()=>{this._reloadTile(t4,"expired"),delete this._timers[t4]};this._timers[t4]=setTimeout(a,r)}}_clearTileReloadTimer(t4){let i=this._timers[t4];i&&(clearTimeout(i),delete this._timers[t4])}_resetTileReloadTimers(){for(let t4 in this._timers)clearTimeout(this._timers[t4]),delete this._timers[t4];for(let t4 of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t4);this._setTileReloadTimer(t4,i)}}refreshTiles(t4){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);(this._inViewTiles.isIdRenderable(i)||r.state=="errored")&&t4.some(a=>a.equals(r.tileID.canonical))&&this._reloadTile(i,"expired")}}_removeTile(t4){let i=this._inViewTiles.getTileById(t4);i&&(i.uses--,this._inViewTiles.deleteTileById(t4),this._clearTileReloadTimer(t4),!(i.uses>0)&&(i.hasData()&&i.state!=="reloading"?this._outOfViewCache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=true,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t4){if(t4.dataType==="source"){if(t4.sourceDataType==="metadata"){this._sourceLoaded=true;return}t4.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t4.sourceDataChanged,t4.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=true)}}resetMaxContentElevation(){this._maxContentElevationSeen=0}clearTiles(){this._shouldReloadOnResume=false,this._paused=false,this.resetMaxContentElevation();for(let t4 of this._inViewTiles.getAllIds())this._removeTile(t4);this._outOfViewCache.reset()}tilesIn(t4,i,r){let a=[],s=this.transform;if(!s)return a;let n=s.getCoveringTilesDetailsProvider().allowWorldCopies(),o=r?s.getCameraQueryGeometry(t4):t4,l=p=>s.screenPointToMercatorCoordinate(p,this.terrain),u=this.transformBbox(t4,l,!n),h=this.transformBbox(o,l,!n),c=this.getIds(),d=Ai.fromPoints(h);for(let p of c){let f=this._inViewTiles.getTileById(p);if(f.holdingForSymbolFade())continue;let m=n?[f.tileID]:[f.tileID.unwrapTo(-1),f.tileID.unwrapTo(0)],g=2**(s.zoom-f.tileID.overscaledZ),_=i*f.queryPadding*k/f.tileSize/g;for(let y of m){let x=d.map(v=>y.getTilePoint(new Ie(v.x,v.y)));if(x.expandBy(_),x.intersects(WT)){let v=u.map(b=>y.getTilePoint(b)),w=h.map(b=>y.getTilePoint(b));a.push({tile:f,tileID:n?y:y.unwrapTo(0),queryGeometry:v,cameraQueryGeometry:w,scale:g})}}}return a}transformBbox(t4,i,r){let a=t4.map(i);if(r){let s=Ai.fromPoints(t4);s.shrinkBy(Math.min(s.width(),s.height())*.001);let n=s.map(i);Ai.fromPoints(a).covers(n)||(a=a.map(o=>o.x>.5?new Ie(o.x-1,o.y,o.z):o))}return a}getVisibleCoordinates(t4){let i=this.getRenderableIds(t4).map(r=>this._inViewTiles.getTileById(r).tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){return this._source.hasTransition()?true:Hm(this._source.type)&&pM(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t4){this._rasterFadeDuration=t4}setFeatureState(t4,i,r){t4||(t4=Bo),this._state.updateState(t4,i,r)}removeFeatureState(t4,i,r){t4||(t4=Bo),this._state.removeFeatureState(t4,i,r)}getFeatureState(t4,i){return t4||(t4=Bo),this._state.getState(t4,i)}setDependencies(t4,i,r){let a=this._inViewTiles.getTileById(t4);a&&a.setDependencies(i,r)}reloadTilesForDependencies(t4,i){for(let r of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(r).hasDependency(t4,i)&&this._reloadTile(r,"reloading");this._outOfViewCache.filter(r=>!r.hasDependency(t4,i))}areTilesLoaded(){for(let t4 of this._inViewTiles.getAllTiles())if(t4.state!=="loaded"&&t4.state!=="errored")return false;return true}},hr.maxUnderzooming=10,hr.maxOverzooming=3,hr),mM=class{constructor(e,t4){this.reset(e,t4)}reset(e,t4){this.points=e||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t4||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=ne(e,0,1);let t4=1,i=this._distances[t4],r=e*this.paddedLength+this.padding;for(;i<r&&t4<this._distances.length;)i=this._distances[++t4];let a=t4-1,s=this._distances[a],n=i-s,o=n>0?(r-s)/n:0;return this.points[a].mult(1-o).add(this.points[t4].mult(o))}};function Vo(e,t4,i,r,a){return a?e?e(t4,i)+r:r===0?void 0:r:r}function yo(e,t4){let i=true;return e==="always"||(e==="never"||t4==="never")&&(i=false),i}var Jm=class{constructor(e,t4,i){let r=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t4/i);for(let s=0;s<this.xCellCount*this.yCellCount;s++)r.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t4,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t4,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t4,i,r,a){this._forEachCell(t4,i,r,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t4),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a)}insertCircle(e,t4,i,r){this._forEachCell(t4-r,i-r,t4+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t4),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t4,i,r,a,s){this.boxCells[a].push(s)}_insertCircleCell(e,t4,i,r,a,s){this.circleCells[a].push(s)}_query(e,t4,i,r,a,s,n){if(i<0||e>this.width||r<0||t4>this.height)return[];let o=[];if(e<=0&&t4<=0&&this.width<=i&&this.height<=r){if(a)return[{key:null,x1:e,y1:t4,x2:i,y2:r}];for(let l=0;l<this.boxKeys.length;l++)o.push({key:this.boxKeys[l],x1:this.bboxes[l*4],y1:this.bboxes[l*4+1],x2:this.bboxes[l*4+2],y2:this.bboxes[l*4+3]});for(let l=0;l<this.circleKeys.length;l++){let u=this.circles[l*3],h=this.circles[l*3+1],c=this.circles[l*3+2];o.push({key:this.circleKeys[l],x1:u-c,y1:h-c,x2:u+c,y2:h+c})}}else{let l={hitTest:a,overlapMode:s,seenUids:{box:{},circle:{}}};this._forEachCell(e,t4,i,r,this._queryCell,o,l,n)}return o}query(e,t4,i,r){return this._query(e,t4,i,r,false,null)}hitTest(e,t4,i,r,a,s){return this._query(e,t4,i,r,true,a,s).length>0}hitTestCircle(e,t4,i,r,a){let s=e-i,n=e+i,o=t4-i,l=t4+i;if(n<0||s>this.width||l<0||o>this.height)return false;let u=[],h={hitTest:true,overlapMode:r,circle:{x:e,y:t4,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(s,o,n,l,this._queryCellCircle,u,h,a),u.length>0}_queryCell(e,t4,i,r,a,s,n,o){let{seenUids:l,hitTest:u,overlapMode:h}=n,c=this.boxCells[a],d=1e-6;if(c!==null){let f=this.bboxes;for(let m of c)if(!l.box[m]){l.box[m]=true;let g=m*4,_=this.boxKeys[m];if(e<=f[g+2]+d&&t4<=f[g+3]+d&&i>=f[g+0]-d&&r>=f[g+1]-d&&(!o||o(_))&&(!u||!yo(h,_.overlapMode))&&(s.push({key:_,x1:f[g],y1:f[g+1],x2:f[g+2],y2:f[g+3]}),u))return true}}let p=this.circleCells[a];if(p!==null){let f=this.circles;for(let m of p)if(!l.circle[m]){l.circle[m]=true;let g=m*3,_=this.circleKeys[m];if(this._circleAndRectCollide(f[g],f[g+1],f[g+2],e,t4,i,r)&&(!o||o(_))&&(!u||!yo(h,_.overlapMode))){let y=f[g],x=f[g+1],v=f[g+2];if(s.push({key:_,x1:y-v,y1:x-v,x2:y+v,y2:x+v}),u)return true}}}return false}_queryCellCircle(e,t4,i,r,a,s,n,o){let{circle:l,seenUids:u,overlapMode:h}=n,c=this.boxCells[a];if(c!==null){let p=this.bboxes;for(let f of c)if(!u.box[f]){u.box[f]=true;let m=f*4,g=this.boxKeys[f];if(this._circleAndRectCollide(l.x,l.y,l.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!o||o(g))&&!yo(h,g.overlapMode))return s.push(true),true}}let d=this.circleCells[a];if(d!==null){let p=this.circles;for(let f of d)if(!u.circle[f]){u.circle[f]=true;let m=f*3,g=this.circleKeys[f];if(this._circlesCollide(p[m],p[m+1],p[m+2],l.x,l.y,l.radius)&&(!o||o(g))&&!yo(h,g.overlapMode))return s.push(true),true}}}_forEachCell(e,t4,i,r,a,s,n,o){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t4),h=this._convertToXCellCoord(i),c=this._convertToYCellCoord(r);for(let d=l;d<=h;d++)for(let p=u;p<=c;p++){let f=this.xCellCount*p+d;if(a.call(this,e,t4,i,r,f,s,n,o))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t4,i,r,a,s){let n=r-e,o=a-t4,l=i+s;return l*l>n*n+o*o}_circleAndRectCollide(e,t4,i,r,a,s,n){let o=(s-r)/2,l=Math.abs(e-(r+o));if(l>o+i)return false;let u=(n-a)/2,h=Math.abs(t4-(a+u));if(h>u+i)return false;if(l<=o||h<=u)return true;let c=l-o,d=h-u;return c*c+d*d<=i*i}};function gM(e,t4){let i=1/(t4[0]*t4[0]+t4[1]*t4[1]+t4[2]*t4[2]),r=1/(t4[8]*t4[8]+t4[9]*t4[9]+t4[10]*t4[10]),a=t4[0]*i,s=t4[4]*i,n=t4[8]*r,o=t4[1]*i,l=t4[5]*i,u=t4[9]*r,h=t4[2]*i,c=t4[6]*i,d=t4[10]*r;e[0]=a,e[1]=s,e[2]=n,e[4]=o,e[5]=l,e[6]=u,e[8]=h,e[9]=c,e[10]=d;let p=t4[12],f=t4[13],m=t4[14];return e[12]=-a*p-o*f-h*m,e[13]=-s*p-l*f-c*m,e[14]=-n*p-u*f-d*m,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}function _M(e,t4){return e[0]=1/t4[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1/t4[5],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=1/t4[14],e[12]=0,e[13]=0,e[14]=-1,e[15]=t4[10]/t4[14],e}function yM(e,t4){let i=1/(t4[0]*t4[5]-t4[1]*t4[4]);return e[0]=t4[5]*i,e[1]=-t4[1]*i,e[2]=0,e[3]=0,e[4]=-t4[4]*i,e[5]=t4[0]*i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t4[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t4[15],e}const vM=Ir();function ip(e,t4,i){let r=Ir();if(!e){let{vecSouth:a,vecEast:s}=rp(t4),n=C1();n[0]=s[0],n[1]=s[1],n[2]=a[0],n[3]=a[1],PA(n,n),r[0]=n[0],r[1]=n[1],r[4]=n[2],r[5]=n[3]}return Dt(r,r,[1/i,1/i,1]),r}function xM(e,t4,i,r){if(e){let a=Ir();if(!t4){let{vecSouth:s,vecEast:n}=rp(i);a[0]=n[0],a[1]=n[1],a[4]=s[0],a[5]=s[1]}return Dt(a,a,[r,r,1]),a}return i.pixelsToClipSpaceMatrix}function rp(e){let t4=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),r=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),s=Math.sin(e.bearingInRadians),n=bh();n[0]=-a*r*i-s*t4,n[1]=-s*r*i+a*t4;let o=Yp(n);o<1e-9?Kp(n):Xp(n,n,1/o);let l=bh();l[0]=a*r*t4-s*i,l[1]=s*r*t4+a*i;let u=Yp(l);return u<1e-9?Kp(l):Xp(l,l,1/u),{vecEast:l,vecSouth:n}}function ra(e,t4,i){return Vo(e.getElevation,t4,i,e.heightOffset??0,e.heightAnchorGround??true)}function ap(e,t4,i,r){let a;r==null?(a=[e,t4,0,1],sp(a,a,i)):(a=[e,t4,r,1],Ct(a,a,i));let s=a[3];return{point:new C(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:false}}function q1(e,t4){return .5+e/t4*.5}function bM(e,t4){return e.x>=-t4[0]&&e.x<=t4[0]&&e.y>=-t4[1]&&e.y<=t4[1]}function wM(e,t4,i,r,a,s,n,o,l,u,h,c,d){let p=i?e.textSizeData:e.iconSizeData,f=Xl(p,t4.transform.zoom),m=[256/t4.width*2+1,256/t4.height*2+1],g=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();let _=e.lineVertexArray,y=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,x=t4.transform.width/t4.transform.height,v=false;for(let w=0;w<y.length;w++){let b=y.get(w);if(b.hidden||b.writingMode===2&&!v){Ua(b.numGlyphs,g);continue}v=false;let T=new C(b.anchorX,b.anchorY),P={getElevation:d,pitchedLabelPlaneMatrix:r,lineVertexArray:_,pitchWithMap:s,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:false},transform:t4.transform,tileAnchorPoint:T,unwrappedTileID:l,width:u,height:h,translation:c},E=X1(b.anchorX,b.anchorY,P);if(!bM(E.point,m)){Ua(b.numGlyphs,g);continue}let I=E.signedDistanceFromCamera,R=q1(t4.transform.cameraToCenterDistance,I),z=zd(p,f,b),S=s?z*t4.transform.getPitchedTextCorrection(b.anchorX,b.anchorY,l)/R:z*R,A=eg({projectionContext:P,pitchedLabelPlaneMatrixInverse:a,symbol:b,fontSize:S,flip:false,keepUpright:n,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:x,rotateToLine:o});v=A.useVertical,(A.notEnoughRoom||v||A.needsFlipping&&eg({projectionContext:P,pitchedLabelPlaneMatrixInverse:a,symbol:b,fontSize:S,flip:true,keepUpright:n,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:x,rotateToLine:o}).notEnoughRoom)&&Ua(b.numGlyphs,g)}i?e.text.dynamicLayoutVertexBuffer.updateData(g):e.icon.dynamicLayoutVertexBuffer.updateData(g)}function W1(e,t4,i,r,a,s,n,o){let l=s.glyphStartIndex+s.numGlyphs,u=s.lineStartIndex,h=s.lineStartIndex+s.lineLength,c=t4.getoffsetX(s.glyphStartIndex),d=t4.getoffsetX(l-1),p=vl(e*c,i,r,a,s.segment,u,h,o,n);if(!p)return null;let f=vl(e*d,i,r,a,s.segment,u,h,o,n);return!f||o.projectionCache.anyProjectionOccluded?null:{first:p,last:f}}function Qm(e,t4,i,r){return e===1&&Math.abs(i.y-t4.y)>Math.abs(i.x-t4.x)*r?{useVertical:true}:(e===2?t4.y<i.y:t4.x>i.x)?{needsFlipping:true}:null}function eg(e){let{projectionContext:t4,pitchedLabelPlaneMatrixInverse:i,symbol:r,fontSize:a,flip:s,keepUpright:n,glyphOffsetArray:o,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:h}=e,c=a/24,d=r.lineOffsetX*c,p=r.lineOffsetY*c,f;if(r.numGlyphs>1){let m=r.glyphStartIndex+r.numGlyphs,g=r.lineStartIndex,_=r.lineStartIndex+r.lineLength,y=W1(c,o,d,p,s,r,h,t4);if(!y)return{notEnoughRoom:true};let x=vo(y.first.point.x,y.first.point.y,t4,i),v=vo(y.last.point.x,y.last.point.y,t4,i);if(n&&!s){let w=Qm(r.writingMode,x,v,u);if(w)return w}f=[y.first];for(let w=r.glyphStartIndex+1;w<m-1;w++){let b=vl(c*o.getoffsetX(w),d,p,s,r.segment,g,_,t4,h);if(!b)return{notEnoughRoom:true};f.push(b)}f.push(y.last)}else{if(n&&!s){let g=aa(t4.tileAnchorPoint.x,t4.tileAnchorPoint.y,t4).point,_=r.lineStartIndex+r.segment+1,y=new C(t4.lineVertexArray.getx(_),t4.lineVertexArray.gety(_)),x=aa(y.x,y.y,t4),v=x.signedDistanceFromCamera>0?x.point:H1(t4.tileAnchorPoint,y,g,1,t4),w=vo(g.x,g.y,t4,i),b=vo(v.x,v.y,t4,i),T=Qm(r.writingMode,w,b,u);if(T)return T}let m=vl(c*o.getoffsetX(r.glyphStartIndex),d,p,s,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,t4,h);if(!m||t4.projectionCache.anyProjectionOccluded)return{notEnoughRoom:true};f=[m]}for(let m of f)pl(l,m.point,m.angle);return{}}function H1(e,t4,i,r,a){let s=e.add(e.sub(t4)._unit()),n=aa(s.x,s.y,a).point,o=i.sub(n);return i.add(o._mult(r/o.mag()))}function Vc(e,t4,i){let r=t4.projectionCache;if(r.projections[e])return r.projections[e];let a=new C(t4.lineVertexArray.getx(e),t4.lineVertexArray.gety(e)),s=aa(a.x,a.y,t4);if(s.signedDistanceFromCamera>0)return r.projections[e]=s.point,r.anyProjectionOccluded||(r.anyProjectionOccluded=s.isOccluded),s.point;let n=e-i.direction,o=i.distanceFromAnchor===0?t4.tileAnchorPoint:new C(t4.lineVertexArray.getx(n),t4.lineVertexArray.gety(n)),l=i.absOffsetX-i.distanceFromAnchor+1;return H1(o,a,i.previousVertex,l,t4)}function aa(e,t4,i){let r=e+i.translation[0],a=t4+i.translation[1],s;return i.pitchWithMap?(s=ap(r,a,i.pitchedLabelPlaneMatrix,ra(i,r,a)),s.isOccluded=false):(s=i.transform.projectTileCoordinates(r,a,i.unwrappedTileID,ra(i,r,a)),s.point.x=(s.point.x*.5+.5)*i.width,s.point.y=(-s.point.y*.5+.5)*i.height),s}function vo(e,t4,i,r){if(i.pitchWithMap){let a=[e,t4,0,1];Ct(a,a,r);let s=a[0]/a[3],n=a[1]/a[3];return i.transform.projectTileCoordinates(s,n,i.unwrappedTileID,ra(i,s,n)).point}return{x:e/i.width*2-1,y:1-t4/i.height*2}}function X1(e,t4,i){return i.transform.projectTileCoordinates(e,t4,i.unwrappedTileID,ra(i,e,t4))}function jc(e,t4,i){return e._unit()._perp()._mult(t4*i)}function TM(e,t4,i,r,a,s,n,o,l){if(o.projectionCache.offsets[e])return o.projectionCache.offsets[e];let u=i.add(t4);if(e+l.direction<r||e+l.direction>=a)return o.projectionCache.offsets[e]=u,u;let h=Vc(e+l.direction,o,l),c=jc(h.sub(i),n,l.direction),d=i.add(c),p=h.add(c);return o.projectionCache.offsets[e]=Rx(s,u,d,p)||u,o.projectionCache.offsets[e]}function vl(e,t4,i,r,a,s,n,o,l){let u=r?e-t4:e+t4,h=u>0?1:-1,c=0;r&&(h*=-1,c=Math.PI),h<0&&(c+=Math.PI);let d=h>0?s+a:s+a+1,p;o.projectionCache.cachedAnchorPoint?p=o.projectionCache.cachedAnchorPoint:(p=aa(o.tileAnchorPoint.x,o.tileAnchorPoint.y,o).point,o.projectionCache.cachedAnchorPoint=p);let f=p,m=p,g,_,y=0,x=0,v=Math.abs(u),w=[],b;for(;y+x<=v;){if(d+=h,d<s||d>=n)return null;y+=x,m=f,_=g;let I={absOffsetX:v,direction:h,distanceFromAnchor:y,previousVertex:m};if(f=Vc(d,o,I),i===0)w.push(m),b=f.sub(m);else{let R,z=f.sub(m);R=z.mag()===0?jc(Vc(d+h,o,I).sub(f),i,h):jc(z,i,h),_||(_=m.add(R)),g=TM(d,R,f,s,n,_,i,o,I),w.push(_),b=g.sub(_)}x=b.mag()}let T=(v-y)/x,P=b._mult(T)._add(_||m),E=c+Math.atan2(f.y-m.y,f.x-m.x);return w.push(P),{point:P,angle:l?E:0,path:w}}const EM=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ua(e,t4){for(let i=0;i<e;i++){let r=t4.length;t4.resize(r+4),t4.float32.set(EM,r*3)}}function sp(e,t4,i){let r=t4[0],a=t4[1];return e[0]=i[0]*r+i[4]*a+i[12],e[1]=i[1]*r+i[5]*a+i[13],e[3]=i[3]*r+i[7]*a+i[15],e}function SM(e,t4){let i=vM;return yM(i,t4.pitchedLabelPlaneMatrix),e.map(r=>{let a=ap(r.x,r.y,i,ra(t4,r.x,r.y)),s=t4.transform.projectTileCoordinates(a.point.x,a.point.y,t4.unwrappedTileID,ra(t4,a.point.x,a.point.y));return s.point.x=(s.point.x*.5+.5)*t4.width,s.point.y=(-s.point.y*.5+.5)*t4.height,s})}function DM(e){let t4=0,i=0,r=0,a=0;for(let s=0;s<e.length;s++)e[s].isOccluded?(r=s+1,a=0):(a++,a>i&&(i=a,t4=r));return e.slice(t4,t4+i)}var CM=class{constructor(e,t4=new Jm(e.width+200,e.height+200,25),i=new Jm(e.width+200,e.height+200,25)){this.transform=e,this.grid=t4,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t4,i,r,a,s,n,o,l,u,h,c,d=0,p=true){let f=e.anchorPointX+o[0],m=e.anchorPointY+o[1],g=this.projectAndGetPerspectiveRatio(f,m,a,Vo(u,f,m,d,p),c),_=i*g.perspectiveRatio,y;if(!s&&!n){let E=g.x+(h?h.x*_:0),I=g.y+(h?h.y*_:0);y={allPointsOccluded:false,box:[E+e.x1*_,I+e.y1*_,E+e.x2*_,I+e.y2*_]}}else y=this._projectCollisionBox(e,_,r,a,s,n,o,g,u,h,c,d,p);let[x,v,w,b]=y.box,T=s?y.allPointsOccluded:g.isOccluded,P=T;return P||(P=g.perspectiveRatio<this.perspectiveRatioCutoff),P||(P=!this.isInsideGrid(x,v,w,b)),P||t4!=="always"&&this.grid.hitTest(x,v,w,b,t4,l)?{box:[x,v,w,b],placeable:false,offscreen:false,occluded:T}:{box:[x,v,w,b],placeable:true,offscreen:this.isOffscreen(x,v,w,b),occluded:T}}placeCollisionCircles(e,t4,i,r,a,s,n,o,l,u,h,c,d,p){let f=[],m=new C(t4.anchorX,t4.anchorY),g=this.getPerspectiveRatio(m.x,m.y,s,p==null?void 0:p(m.x,m.y)),_=(l?a*this.transform.getPitchedTextCorrection(t4.anchorX,t4.anchorY,s)/g:a*g)/24,y={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:false},x=t4.lineOffsetX*_,v=t4.lineOffsetY*_,w={getElevation:p,pitchedLabelPlaneMatrix:n,lineVertexArray:i,pitchWithMap:l,projectionCache:y,transform:this.transform,tileAnchorPoint:m,unwrappedTileID:s,width:this.transform.width,height:this.transform.height,translation:d},b=W1(_,r,x,v,false,t4,false,w),T=false,P=false,E=true;if(b){let I=h*.5*g+c,R=new C(-100,-100),z=new C(this.screenRightBoundary,this.screenBottomBoundary),S=new mM,A=b.first,D=b.last,M=[];for(let N=A.path.length-1;N>=1;N--)M.push(A.path[N]);for(let N=1;N<D.path.length;N++)M.push(D.path[N]);let L=I*2.5;if(l){let N=this.projectPathToScreenSpace(M,w);M=N.some(J=>J.signedDistanceFromCamera<=0)?[]:N.map(J=>J.point)}let O=[];if(M.length>0){let N=M[0].clone(),J=M[0].clone();for(let fe=1;fe<M.length;fe++)N.x=Math.min(N.x,M[fe].x),N.y=Math.min(N.y,M[fe].y),J.x=Math.max(J.x,M[fe].x),J.y=Math.max(J.y,M[fe].y);O=N.x>=R.x&&J.x<=z.x&&N.y>=R.y&&J.y<=z.y?[M]:J.x<R.x||N.x>z.x||J.y<R.y||N.y>z.y?[]:Z0([M],R.x,R.y,z.x,z.y)}for(let N of O){S.reset(N,I*.25);let J=0;J=S.length<=.5*I?1:Math.ceil(S.paddedLength/L)+1;for(let fe=0;fe<J;fe++){let xe=fe/Math.max(J-1,1),le=S.lerp(xe),$e=le.x+100,Pe=le.y+100;f.push($e,Pe,I,0);let Ve=$e-I,ke=Pe-I,ft=$e+I,Rt=Pe+I;if(E&&(E=this.isOffscreen(Ve,ke,ft,Rt)),P||(P=this.isInsideGrid(Ve,ke,ft,Rt)),e!=="always"&&this.grid.hitTestCircle($e,Pe,I,e,u)&&(T=true,!o))return{circles:[],offscreen:false,collisionDetected:T}}}}return{circles:!o&&T||!P||g<this.perspectiveRatioCutoff?[]:f,offscreen:E,collisionDetected:T}}projectPathToScreenSpace(e,t4){return DM(SM(e,t4))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t4=[],i=new Ai;for(let h of e){let c=new C(h.x+100,h.y+100);i.extend(c),t4.push(c)}let{minX:r,minY:a,maxX:s,maxY:n}=i,o=this.grid.query(r,a,s,n).concat(this.ignoredGrid.query(r,a,s,n)),l={},u={};for(let h of o){let c=h.key;if(l[c.bucketInstanceId]===void 0&&(l[c.bucketInstanceId]={}),l[c.bucketInstanceId][c.featureIndex])continue;let d=[new C(h.x1,h.y1),new C(h.x2,h.y1),new C(h.x2,h.y2),new C(h.x1,h.y2)];Ky(t4,d)&&(l[c.bucketInstanceId][c.featureIndex]=true,u[c.bucketInstanceId]===void 0&&(u[c.bucketInstanceId]=[]),u[c.bucketInstanceId].push(c.featureIndex))}return u}insertCollisionBox(e,t4,i,r,a,s){let n=i?this.ignoredGrid:this.grid,o={bucketInstanceId:r,featureIndex:a,collisionGroupID:s,overlapMode:t4};n.insert(o,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t4,i,r,a,s){let n=i?this.ignoredGrid:this.grid,o={bucketInstanceId:r,featureIndex:a,collisionGroupID:s,overlapMode:t4};for(let l=0;l<e.length;l+=4)n.insertCircle(o,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,t4,i,r,a){if(a){let s;r==null?(s=[e,t4,0,1],sp(s,s,a)):(s=[e,t4,r,1],Ct(s,s,a));let n=s[3];return{x:(s[0]/n+1)/2*this.transform.width+100,y:(-s[1]/n+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/n),isOccluded:false,signedDistanceFromCamera:n}}{let s=this.transform.projectTileCoordinates(e,t4,i,r);return{x:(s.point.x+1)/2*this.transform.width+100,y:(-s.point.y+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/s.signedDistanceFromCamera),isOccluded:s.isOccluded,signedDistanceFromCamera:s.signedDistanceFromCamera}}}getPerspectiveRatio(e,t4,i,r){let a=this.transform.projectTileCoordinates(e,t4,i,r);return .5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera)}isOffscreen(e,t4,i,r){return i<100||e>=this.screenRightBoundary||r<100||t4>this.screenBottomBoundary}isInsideGrid(e,t4,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t4<this.gridBottomBoundary}getViewportMatrix(){let e=Ii([]);return ot(e,e,[-100,-100,0]),e}_projectCollisionBox(e,t4,i,r,a,s,n,o,l,u,h,c=0,d=true){let p=1,f=0,m=0,g=1,_=e.anchorPointX+n[0],y=e.anchorPointY+n[1];if(s&&!a){let D=this.projectAndGetPerspectiveRatio(_+1,y,r,Vo(l,_+1,y,c,d),h),M=D.x-o.x,L=D.y-o.y,O=Math.atan(L/M)+(M<0?Math.PI:0),N=Math.sin(O),J=Math.cos(O);p=J,f=N,m=-N,g=J}else if(!s&&a){let D=rp(this.transform);p=D.vecEast[0],f=D.vecEast[1],m=D.vecSouth[0],g=D.vecSouth[1]}let x=o.x,v=o.y,w=t4;if(a&&(x=_,v=y,w=2**-(this.transform.zoom-i.overscaledZ),w*=this.transform.getPitchedTextCorrection(_,y,r),!u)){let D=o.signedDistanceFromCamera/this.transform.cameraToCenterDistance,M=ne(.5+.5*D,0,4);w*=M}u&&(x+=p*u.x*w+m*u.y*w,v+=f*u.x*w+g*u.y*w);let b=e.x1*w,T=e.x2*w,P=(b+T)/2,E=e.y1*w,I=e.y2*w,R=(E+I)/2,z=[{offsetX:b,offsetY:E},{offsetX:P,offsetY:E},{offsetX:T,offsetY:E},{offsetX:T,offsetY:R},{offsetX:T,offsetY:I},{offsetX:P,offsetY:I},{offsetX:b,offsetY:I},{offsetX:b,offsetY:R}],S=[];for(let{offsetX:D,offsetY:M}of z)S.push(new C(x+p*D+m*M,v+f*D+g*M));let A=false;if(a){let D=S.map(M=>this.projectAndGetPerspectiveRatio(M.x,M.y,r,Vo(l,M.x,M.y,c,d),h));A=D.some(M=>!M.isOccluded),S=D.map(M=>new C(M.x,M.y))}else A=true;return{box:Px(S),allPointsOccluded:!A}}},tg=class{constructor(e,t4,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t4:-t4))):r&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}},Ts=class{constructor(e,t4,i,r,a){this.text=new tg(e?e.text:null,t4,i,a),this.icon=new tg(e?e.icon:null,t4,r,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},ig=class{constructor(e,t4,i){this.text=e,this.icon=t4,this.skipFade=i}},PM=class{constructor(e,t4,i,r,a){this.bucketInstanceId=e,this.featureIndex=t4,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=a}},AM=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t4=++this.maxGroupID;this.collisionGroups[e]={ID:t4,predicate:i=>i.collisionGroupID===t4}}return this.collisionGroups[e]}};function rg(e,t4,i,r,a){let{horizontalAlign:s,verticalAlign:n}=Hl(e),o=-(s-.5)*t4,l=-(n-.5)*i;return new C(o+r[0]*a,l+r[1]*a)}var IM=class{constructor(e,t4,i,r,a){this.transform=e.clone(),this.terrain=t4,this.collisionIndex=new CM(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=false,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new AM(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t4=this.terrain;if(t4)return(i,r)=>t4.getElevation(e,i,r)}getBucketParts(e,t4,i,r){let a=i.getBucket(t4),s=i.latestFeatureIndex;if(!a||!s||t4.id!==a.layerIds[0])return;let n=i.collisionBoxArray,o=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-i.tileID.overscaledZ),h=i.tileSize/k,c=i.tileID.toUnwrapped(),d=o.get("text-rotation-alignment")==="map",p=si(i,1,this.transform.zoom),f=Dr(this.collisionIndex.transform,i,l.get("text-translate"),l.get("text-translate-anchor")),m=Dr(this.collisionIndex.transform,i,l.get("icon-translate"),l.get("icon-translate-anchor")),g=ip(d,this.transform,p);this.retainedQueryData[a.bucketInstanceId]=new PM(a.bucketInstanceId,s,a.sourceLayerIndex,a.index,i.tileID);let _={bucket:a,layout:o,translationText:f,translationIcon:m,unwrappedTileID:c,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:h,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:n,partiallyEvaluatedTextSize:Xl(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(r)for(let y of a.sortKeyRanges){let{sortKey:x,symbolInstanceStart:v,symbolInstanceEnd:w}=y;e.push({sortKey:x,symbolInstanceStart:v,symbolInstanceEnd:w,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m,g,_,y,x,v,w){var I,R,z;let b=Dc[e.textAnchor],T=[e.textOffset0,e.textOffset1],P=rg(b,i,r,T,a),E=this.collisionIndex.placeCollisionBox(t4,c,o,l,u,n,s,m,h.predicate,y,P,x,v,w);if((!_||this.collisionIndex.placeCollisionBox(_,c,o,l,u,n,s,g,h.predicate,y,P,x,v,w).placeable)&&E.placeable){let S;if((I=this.prevPlacement)!=null&&I.variableOffsets[d.crossTileID]&&((z=(R=this.prevPlacement)==null?void 0:R.placements[d.crossTileID])!=null&&z.text)&&(S=this.prevPlacement.variableOffsets[d.crossTileID].anchor),d.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:T,width:i,height:r,anchor:b,textBoxScale:a,prevAnchor:S},this.markUsedJustification(p,b,d,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,d),this.placedOrientations[d.crossTileID]=f),{shift:P,placedGlyphBoxes:E}}}placeLayerBucketPart(e,t4,i){let{bucket:r,layout:a,translationText:s,translationIcon:n,unwrappedTileID:o,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:h,collisionBoxArray:c,partiallyEvaluatedTextSize:d,collisionGroup:p}=e.parameters,f=a.get("text-optional"),m=a.get("icon-optional"),g=dl(a,"text-overlap","text-allow-overlap"),_=g==="always",y=dl(a,"icon-overlap","icon-allow-overlap"),x=y==="always",v=a.get("text-rotation-alignment")==="map",w=a.get("text-pitch-alignment")==="map",b=a.get("icon-text-fit")!=="none",T=a.get("symbol-z-order")==="viewport-y",P=a.get("symbol-height-anchor")==="ground",E=_&&(x||!r.hasIconData()||m),I=x&&(_||!r.hasTextData()||f);!r.collisionArrays&&c&&r.deserializeCollisionBoxes(c);let R=this.retainedQueryData[r.bucketInstanceId].tileID,z=this._getTerrainElevationFunc(R),S=this.transform.getFastPathSimpleProjectionMatrix(R),A=(D,M,L)=>{var ye,re;if(t4[D.crossTileID])return;if(h){this.placements[D.crossTileID]=new ig(false,false,false);return}let O=D.heightOffset,N=false,J=false,fe=true,xe=null,le={box:null,placeable:false,offscreen:null,occluded:false},$e={placeable:false},Pe=null,Ve=null,ke=null,ft=0,Rt=0,Ut=0;M.textFeatureIndex?ft=M.textFeatureIndex:D.useRuntimeCollisionCircles&&(ft=D.featureIndex),M.verticalTextFeatureIndex&&(Rt=M.verticalTextFeatureIndex);let Nt=M.textBox;if(Nt){let $=Z=>{let we=1;if(r.allowVerticalPlacement&&!Z&&this.prevPlacement){let Te=this.prevPlacement.placedOrientations[D.crossTileID];Te&&(this.placedOrientations[D.crossTileID]=Te,we=Te,this.markUsedOrientation(r,we,D))}return we},ve=(Z,we)=>{if(r.allowVerticalPlacement&&D.numVerticalGlyphVertices>0&&M.verticalTextBox){for(let Te of r.writingModes)if(Te===2?(le=we(),$e=le):le=Z(),le==null?void 0:le.placeable)break}else le=Z()},ee=D.textAnchorOffsetStartIndex,ae=D.textAnchorOffsetEndIndex;if(ae===ee){let Z=(we,Te)=>{let se=this.collisionIndex.placeCollisionBox(we,g,u,R,o,w,v,s,p.predicate,z,void 0,S,O,P);return se!=null&&se.placeable&&(this.markUsedOrientation(r,Te,D),this.placedOrientations[D.crossTileID]=Te),se};ve(()=>Z(Nt,1),()=>{let we=M.verticalTextBox;return r.allowVerticalPlacement&&D.numVerticalGlyphVertices>0&&we?Z(we,2):{box:null,offscreen:null}}),$(le==null?void 0:le.placeable)}else{let Z=Dc[(re=(ye=this.prevPlacement)==null?void 0:ye.variableOffsets[D.crossTileID])==null?void 0:re.anchor],we=(se,et,Fr)=>{let er=se.x2-se.x1,Ri=se.y2-se.y1,ki=D.textBoxScale,Oe=b&&y==="never"?et:null,Le=null,oi=g==="never"?1:2,Ti="never";Z&&oi++;for(let ca=0;ca<oi;ca++){for(let nt=ee;nt<ae;nt++){let ht=r.textAnchorOffsets.get(nt);if(Z&&ht.textAnchor!==Z)continue;let da=this.attemptAnchorPlacement(ht,se,er,Ri,ki,v,w,u,R,o,p,Ti,D,r,Fr,s,n,Oe,z,S,O,P);if(da&&(Le=da.placedGlyphBoxes,Le==null?void 0:Le.placeable))return N=true,xe=da.shift,Le}Z?Z=null:Ti=g}return i&&!Le&&(Le={box:this.collisionIndex.placeCollisionBox(Nt,"always",u,R,o,w,v,s,p.predicate,z,void 0,S,O,P).box,offscreen:false,placeable:false,occluded:false}),Le};ve(()=>we(Nt,M.iconBox,1),()=>{let se=M.verticalTextBox,et=le==null?void 0:le.placeable;return r.allowVerticalPlacement&&!et&&D.numVerticalGlyphVertices>0&&se?we(se,M.verticalIconBox,2):{box:null,occluded:true,offscreen:null}}),le&&(N=le.placeable,fe=le.offscreen);let Te=$(le==null?void 0:le.placeable);if(!N&&this.prevPlacement){let se=this.prevPlacement.variableOffsets[D.crossTileID];se&&(this.variableOffsets[D.crossTileID]=se,this.markUsedJustification(r,se.anchor,D,Te))}}}if(Pe=le,N=Pe==null?void 0:Pe.placeable,fe=Pe==null?void 0:Pe.offscreen,D.useRuntimeCollisionCircles&&D.centerJustifiedTextSymbolIndex>=0){let $=r.text.placedSymbolArray.get(D.centerJustifiedTextSymbolIndex),ve=zd(r.textSizeData,d,$),ee=a.get("text-padding"),ae=D.collisionCircleDiameter;Ve=this.collisionIndex.placeCollisionCircles(g,$,r.lineVertexArray,r.glyphOffsetArray,ve,o,l,i,w,p.predicate,ae,ee,s,z),Ve.circles.length&&Ve.collisionDetected&&!i&&ge("Collisions detected, but collision boxes are not shown"),N=_||Ve.circles.length>0&&!Ve.collisionDetected,fe&&(fe=Ve.offscreen)}if(M.iconFeatureIndex&&(Ut=M.iconFeatureIndex),M.iconBox){let $=ve=>this.collisionIndex.placeCollisionBox(ve,y,u,R,o,w,v,n,p.predicate,z,b&&xe?xe:void 0,S,O,P);$e&&$e.placeable&&M.verticalIconBox?(ke=$(M.verticalIconBox),J=ke.placeable):(ke=$(M.iconBox),J=ke.placeable),fe&&(fe=ke.offscreen)}let Tt=f||D.numHorizontalGlyphVertices===0&&D.numVerticalGlyphVertices===0,st=m||D.numIconVertices===0;!Tt&&!st?J=N=J&&N:st?Tt||J&&(J=N):N=J&&N;let Yt=N&&Pe.placeable,wi=J&&ke.placeable;if(Yt&&($e&&$e.placeable&&Rt?this.collisionIndex.insertCollisionBox(Pe.box,g,a.get("text-ignore-placement"),r.bucketInstanceId,Rt,p.ID):this.collisionIndex.insertCollisionBox(Pe.box,g,a.get("text-ignore-placement"),r.bucketInstanceId,ft,p.ID)),wi&&this.collisionIndex.insertCollisionBox(ke.box,y,a.get("icon-ignore-placement"),r.bucketInstanceId,Ut,p.ID),Ve&&N&&this.collisionIndex.insertCollisionCircles(Ve.circles,g,a.get("text-ignore-placement"),r.bucketInstanceId,ft,p.ID),i&&this.storeCollisionData(r.bucketInstanceId,L,M,Pe,ke,Ve),D.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");if(r.bucketInstanceId===0)throw Error("bucket.bucketInstanceId can't be 0");let ni=(N||E)&&!(Pe!=null&&Pe.occluded),q=(J||I)&&!(ke!=null&&ke.occluded);this.placements[D.crossTileID]=new ig(ni,q,fe||r.justReloaded),t4[D.crossTileID]=true};if(T){if(e.symbolInstanceStart!==0)throw Error("bucket.bucketInstanceId should be 0");let D=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let M=D.length-1;M>=0;--M){let L=D[M];A(r.symbolInstances.get(L),r.collisionArrays[L],L)}}else for(let D=e.symbolInstanceStart;D<e.symbolInstanceEnd;D++)A(r.symbolInstances.get(D),r.collisionArrays[D],D);r.justReloaded=false}storeCollisionData(e,t4,i,r,a,s){if(i.textBox||i.iconBox){let n;this.collisionBoxArrays.has(e)?n=this.collisionBoxArrays.get(e):(n=new Map,this.collisionBoxArrays.set(e,n));let o;n.has(t4)?o=n.get(t4):(o={text:null,icon:null},n.set(t4,o)),i.textBox&&(o.text=r.box),i.iconBox&&(o.icon=a.box)}if(s){let n=this.collisionCircleArrays[e];n===void 0&&(n=this.collisionCircleArrays[e]=[]);for(let o=0;o<s.circles.length;o+=4)n.push(s.circles[o+0]-100),n.push(s.circles[o+1]-100),n.push(s.circles[o+2]),n.push(+!!s.collisionDetected)}}markUsedJustification(e,t4,i,r){let a={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex},s;s=r===2?i.verticalPlacedTextSymbolIndex:a[Cc(t4)];let n=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let o of n)o>=0&&(s>=0&&o!==s?e.text.placedSymbolArray.get(o).crossTileID=0:e.text.placedSymbolArray.get(o).crossTileID=i.crossTileID)}markUsedOrientation(e,t4,i){let r=t4===1||t4===3?t4:0,a=t4===2?t4:0,s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let n of s)e.text.placedSymbolArray.get(n).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t4=this.prevPlacement,i=false;this.prevZoomAdjustment=t4?t4.zoomAdjustment(this.transform.zoom):0;let r=t4?t4.symbolFadeChange(e):1,a=t4?t4.opacities:{},s=t4?t4.variableOffsets:{},n=t4?t4.placedOrientations:{};for(let o in this.placements){let l=this.placements[o],u=a[o];u?(this.opacities[o]=new Ts(u,r,l.text,l.icon),i||(i=l.text!==u.text.placed),i||(i=l.icon!==u.icon.placed)):(this.opacities[o]=new Ts(null,r,l.text,l.icon,l.skipFade),i||(i=l.text||l.icon))}for(let o in a){let l=a[o];if(!this.opacities[o]){let u=new Ts(l,r,false,false);u.isHidden()||(this.opacities[o]=u,i||(i=l.text.placed),i||(i=l.icon.placed))}}for(let o in s)!this.variableOffsets[o]&&this.opacities[o]&&!this.opacities[o].isHidden()&&(this.variableOffsets[o]=s[o]);for(let o in n)!this.placedOrientations[o]&&this.opacities[o]&&!this.opacities[o].isHidden()&&(this.placedOrientations[o]=n[o]);if(t4&&t4.lastPlacementChangeTime===void 0)throw Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=t4?t4.lastPlacementChangeTime:e)}updateLayerOpacities(e,t4){let i={};for(let r of t4){let a=r.getBucket(e);a&&r.latestFeatureIndex&&e.id===a.layerIds[0]&&this.updateBucketOpacities(a,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(e,t4,i,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=false),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=false),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],s=a.layout,n=new Ts(null,0,false,false,true),o=s.get("text-allow-overlap"),l=s.get("icon-allow-overlap"),u=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),h=s.get("text-rotation-alignment")==="map",c=s.get("text-pitch-alignment")==="map",d=s.get("icon-text-fit")!=="none",p=new Ts(null,0,o&&(l||!e.hasIconData()||s.get("icon-optional")),l&&(o||!e.hasTextData()||s.get("text-optional")),true);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);let f=(g,_,y)=>{for(let x=0;x<_/4;x++)g.opacityVertexArray.emplaceBack(y);g.hasVisibleVertices||(g.hasVisibleVertices=y!==Es)},m=this.collisionBoxArrays.get(e.bucketInstanceId);for(let g=0;g<e.symbolInstances.length;g++){let _=e.symbolInstances.get(g),{numHorizontalGlyphVertices:y,numVerticalGlyphVertices:x,crossTileID:v}=_,w=i[v],b=this.opacities[v];w?b=n:b||(b=p,this.opacities[v]=b),i[v]=true;let T=y>0||x>0,P=_.numIconVertices>0,E=this.placedOrientations[_.crossTileID],I=E===2,R=E===1||E===3;if(T){let S=sg(b.text),A=I?Es:S;f(e.text,y,A);let D=R?Es:S;f(e.text,x,D);let M=b.text.isHidden(),L=[_.rightJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.leftJustifiedTextSymbolIndex];for(let J of L)J>=0&&(e.text.placedSymbolArray.get(J).hidden=M||I?1:0);_.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(_.verticalPlacedTextSymbolIndex).hidden=M||R?1:0);let O=this.variableOffsets[_.crossTileID];O&&this.markUsedJustification(e,O.anchor,_,E);let N=this.placedOrientations[_.crossTileID];N&&(this.markUsedJustification(e,"left",_,N),this.markUsedOrientation(e,N,_))}if(P){let S=sg(b.icon),A=!(d&&_.verticalPlacedIconSymbolIndex&&I);if(_.placedIconSymbolIndex>=0){let D=A?S:Es;f(e.icon,_.numIconVertices,D),e.icon.placedSymbolArray.get(_.placedIconSymbolIndex).hidden=b.icon.isHidden()}if(_.verticalPlacedIconSymbolIndex>=0){let D=A?Es:S;f(e.icon,_.numVerticalIconVertices,D),e.icon.placedSymbolArray.get(_.verticalPlacedIconSymbolIndex).hidden=b.icon.isHidden()}}let z=m!=null&&m.has(g)?m.get(g):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let S=e.collisionArrays[g];if(S){let A=new C(0,0);if(S.textBox||S.verticalTextBox){let D=true;if(u){let M=this.variableOffsets[v];M?(A=rg(M.anchor,M.width,M.height,M.textOffset,M.textBoxScale),h&&A._rotate(c?-this.transform.bearingInRadians:this.transform.bearingInRadians)):D=false}if(S.textBox||S.verticalTextBox){let M;S.textBox&&(M=I),S.verticalTextBox&&(M=R),ag(e.textCollisionBox.collisionVertexArray,b.text.placed,!D||M,z.text,A.x,A.y)}}if(S.iconBox||S.verticalIconBox){let D=!(R||!S.verticalIconBox),M;S.iconBox&&(M=D),S.verticalIconBox&&(M=!D),ag(e.iconCollisionBox.collisionVertexArray,b.icon.placed,M,z.icon,d?A.x:0,d?A.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t4){let i=this.zoomAtLastRecencyCheck===t4?1-this.zoomAdjustment(t4):1;return this.zoomAtLastRecencyCheck=t4,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=true}};function ag(e,t4,i,r,a,s){(!r||r.length===0)&&(r=[0,0,0,0]);let n=r[0]-100,o=r[1]-100,l=r[2]-100,u=r[3]-100;e.emplaceBack(+!!t4,+!!i,a||0,s||0,n,o),e.emplaceBack(+!!t4,+!!i,a||0,s||0,l,o),e.emplaceBack(+!!t4,+!!i,a||0,s||0,l,u),e.emplaceBack(+!!t4,+!!i,a||0,s||0,n,u)}const MM=2**25,FM=2**24,zM=2**17,RM=2**16;function sg(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t4=+!!e.placed,i=Math.floor(e.opacity*127);return i*MM+t4*FM+i*zM+t4*RM+i*512+t4*256+i*2+t4}const Es=0;var kM=class{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t4,i,r,a){let s=this._bucketParts;for(;this._currentTileIndex<e.length;){let n=e[this._currentTileIndex];if(t4.getBucketParts(s,r,n,this._sortAcrossTiles),this._currentTileIndex++,a())return true}for(this._sortAcrossTiles&&(this._sortAcrossTiles=false,s.sort((n,o)=>n.sortKey-o.sortKey));this._currentPartIndex<s.length;){let n=s[this._currentPartIndex];if(t4.placeLayerBucketPart(n,this._seenCrossTileIDs,i),this._currentPartIndex++,a())return true}return false}},LM=class{constructor(e,t4,i,r,a,s,n,o){this.placement=new IM(e,t4,s,n,o),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=a,this._done=false}isDone(){return this._done}continuePlacement(e,t4,i){let r=ze(),a=()=>!this._forceFullPlacement&&ze()-r>2;for(;this._currentPlacementIndex>=0;){let s=t4[e[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if(Y0(s)&&s.layout&&(!s.minzoom||s.minzoom<=n)&&(!s.maxzoom||s.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new kM(s)),this._inProgressLayer.continuePlacement(i[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=true}commit(e){return this.placement.commit(e),this.placement}};const ng=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Ye=new Uint32Array(96);var BM=class Y1{static from(t4){if(!t4||t4.byteLength===void 0||t4.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[i,r]=new Uint8Array(t4,0,2);if(i!==219)throw Error("Data does not appear to be in a KDBush format.");let a=r>>4;if(a!==1)throw Error(`Got v${a} data when expected v1.`);let s=ng[r&15];if(!s)throw Error("Unrecognized array type.");let[n]=new Uint16Array(t4,2,1),[o]=new Uint32Array(t4,4,1);return new Y1(o,n,s,void 0,t4)}constructor(t4,i=64,r=Float64Array,a=ArrayBuffer,s){if(isNaN(t4)||t4<0)throw Error(`Unexpected numItems value: ${t4}.`);this.numItems=+t4,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t4<65536?Uint16Array:Uint32Array;let n=ng.indexOf(this.ArrayType),o=t4*2*this.ArrayType.BYTES_PER_ELEMENT,l=t4*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${r}.`);if(s)this.data=s,this.ids=new this.IndexArrayType(s,8,t4),this.coords=new r(s,8+l+u,t4*2),this._pos=t4*2,this._finished=true;else{let h=this.data=new a(8+o+l+u);this.ids=new this.IndexArrayType(h,8,t4),this.coords=new r(h,8+l+u,t4*2),this._pos=0,this._finished=false,new Uint8Array(h,0,2).set([219,16+n]),new Uint16Array(h,2,1)[0]=i,new Uint32Array(h,4,1)[0]=t4}}add(t4,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t4,this.coords[this._pos++]=i,r}finish(){let t4=this._pos>>1;if(t4!==this.numItems)throw Error(`Added ${t4} items when expected ${this.numItems}.`);return Uc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=true,this}range(t4,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:s,coords:n,nodeSize:o}=this;Ye[0]=0,Ye[1]=s.length-1,Ye[2]=0;let l=3,u=[];for(;l>0;){let h=Ye[--l],c=Ye[--l],d=Ye[--l];if(c-d<=o){for(let g=d;g<=c;g++){let _=n[2*g],y=n[2*g+1];_>=t4&&_<=r&&y>=i&&y<=a&&u.push(s[g])}continue}let p=d+c>>1,f=n[2*p],m=n[2*p+1];f>=t4&&f<=r&&m>=i&&m<=a&&u.push(s[p]),(h===0?t4<=f:i<=m)&&(Ye[l++]=d,Ye[l++]=p-1,Ye[l++]=1-h),(h===0?r>=f:a>=m)&&(Ye[l++]=p+1,Ye[l++]=c,Ye[l++]=1-h)}return u}within(t4,i,r){let a=[];return this.withinInto(t4,i,r,a),a}withinInto(t4,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:s,coords:n,nodeSize:o}=this;Ye[0]=0,Ye[1]=s.length-1,Ye[2]=0;let l=3,u=0,h=r*r;for(;l>0;){let c=Ye[--l],d=Ye[--l],p=Ye[--l];if(d-p<=o){for(let _=p;_<=d;_++)og(n[2*_],n[2*_+1],t4,i)<=h&&(a[u++]=s[_]);continue}let f=p+d>>1,m=n[2*f],g=n[2*f+1];og(m,g,t4,i)<=h&&(a[u++]=s[f]),(c===0?t4-r<=m:i-r<=g)&&(Ye[l++]=p,Ye[l++]=f-1,Ye[l++]=1-c),(c===0?t4+r>=m:i+r>=g)&&(Ye[l++]=f+1,Ye[l++]=d,Ye[l++]=1-c)}return u}};function Uc(e,t4,i,r,a,s){if(a-r<=i)return;let n=r+a>>1;K1(e,t4,n,r,a,s),Uc(e,t4,i,r,n-1,1-s),Uc(e,t4,i,n+1,a,1-s)}function K1(e,t4,i,r,a,s){for(;a>r;){if(a-r>600){let u=a-r+1,h=i-r+1,c=Math.log(u),d=.5*Math.exp(2*c/3),p=.5*Math.sqrt(c*d*(u-d)/u)*(h-u/2<0?-1:1);K1(e,t4,i,Math.max(r,Math.floor(i-h*d/u+p)),Math.min(a,Math.floor(i+(u-h)*d/u+p)),s)}let n=t4[2*i+s],o=r,l=a;for(Ss(e,t4,r,i),t4[2*a+s]>n&&Ss(e,t4,r,a);o<l;){for(Ss(e,t4,o,l),o++,l--;t4[2*o+s]<n;)o++;for(;t4[2*l+s]>n;)l--}t4[2*r+s]===n?Ss(e,t4,r,l):(l++,Ss(e,t4,l,a)),l<=i&&(r=l+1),i<=l&&(a=l-1)}}function Ss(e,t4,i,r){ih(e,i,r),ih(t4,2*i,2*r),ih(t4,2*i+1,2*r+1)}function ih(e,t4,i){let r=e[t4];e[t4]=e[i],e[i]=r}function og(e,t4,i,r){let a=e-i,s=t4-r;return a*a+s*s}const Ds=512/k/2;var OM=class{constructor(e,t4,i){this.tileID=e,this.bucketInstanceId=i,this._symbolsByKey={};let r=new Map;for(let a=0;a<t4.length;a++){let s=t4.get(a),n=s.key,o=r.get(n);o?o.push(s):r.set(n,[s])}for(let[a,s]of r){let n={positions:s.map(o=>({x:Math.floor(o.anchorX*Ds),y:Math.floor(o.anchorY*Ds)})),crossTileIDs:s.map(o=>o.crossTileID)};if(n.positions.length>128){let o=new BM(n.positions.length,16,Uint16Array);for(let{x:l,y:u}of n.positions)o.add(l,u);o.finish(),delete n.positions,n.index=o}this._symbolsByKey[a]=n}}getScaledCoordinates(e,t4){let{x:i,y:r,z:a}=this.tileID.canonical,{x:s,y:n,z:o}=t4.canonical,l=o-a,u=Ds/2**l,h=(s*k+e.anchorX)*u,c=(n*k+e.anchorY)*u,d=i*k*Ds,p=r*k*Ds;return{x:Math.floor(h-d),y:Math.floor(c-p)}}findMatches(e,t4,i){let r=this.tileID.canonical.z<t4.canonical.z?1:2**(this.tileID.canonical.z-t4.canonical.z);for(let a=0;a<e.length;a++){let s=e.get(a);if(s.crossTileID)continue;let n=this._symbolsByKey[s.key];if(!n)continue;let o=this.getScaledCoordinates(s,t4);n.index?this.findMatchesForIndexedEntry(n,s,o,r,i):n.positions&&this.findMatchesForNonIndexedEntry(n,s,o,r,i)}}findMatchesForIndexedEntry(e,t4,i,r,a){let s=e.index.range(i.x-r,i.y-r,i.x+r,i.y+r),n=1/0;for(let o of s)o<n&&!a[e.crossTileIDs[o]]&&(n=o);if(n!==1/0){let o=e.crossTileIDs[n];a[o]=true,t4.crossTileID=o}}findMatchesForNonIndexedEntry(e,t4,i,r,a){for(let s=0;s<e.positions.length;s++){let n=e.positions[s],o=e.crossTileIDs[s];if(Math.abs(n.x-i.x)<=r&&Math.abs(n.y-i.y)<=r&&!a[o]){a[o]=true,t4.crossTileID=o;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},$M=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},VM=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t4=Math.round((e-this.lng)/360);if(t4!==0)for(let i in this.indexes){let r=this.indexes[i],a={};for(let s in r){let n=r[s];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t4),a[n.tileID.key]=n}this.indexes[i]=a}this.lng=e}addBucket(e,t4,i){var a,s,n;if((a=this.indexes[e.overscaledZ])!=null&&a[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t4.bucketInstanceId)return false;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let o=0;o<t4.symbolInstances.length;o++){let l=t4.symbolInstances.get(o);l.crossTileID=0}(s=this.usedCrossTileIDs)[n=e.overscaledZ]||(s[n]={});let r=this.usedCrossTileIDs[e.overscaledZ];for(let o in this.indexes){let l=this.indexes[o];if(Number(o)>e.overscaledZ)for(let u in l){let h=l[u];h.tileID.isChildOf(e)&&h.findMatches(t4.symbolInstances,e,r)}else{let u=l[e.scaledTo(Number(o)).key];u&&u.findMatches(t4.symbolInstances,e,r)}}for(let o=0;o<t4.symbolInstances.length;o++){let l=t4.symbolInstances.get(o);l.crossTileID||(l.crossTileID=i.generate(),r[l.crossTileID]=true)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new OM(e,t4.symbolInstances,t4.bucketInstanceId),true}removeBucketCrossTileIDs(e,t4){for(let i of t4.getCrossTileIDsLists())for(let r of i)delete this.usedCrossTileIDs[e][r]}removeStaleBuckets(e){let t4=false;for(let i in this.indexes){let r=this.indexes[i];for(let a in r)e[r[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[a]),delete r[a],t4=true)}return t4}},J1=class{constructor(){this.layerIndexes={},this.crossTileIDs=new $M,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t4,i){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new VM);let a=false,s={};r.handleWrapJump(i);for(let n of t4){let o=n.getBucket(e);e.id===(o==null?void 0:o.layerIds[0])&&(o.bucketInstanceId||(o.bucketInstanceId=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId)),r.addBucket(n.tileID,o,this.crossTileIDs)&&(a=true),s[o.bucketInstanceId]=true)}return r.removeStaleBuckets(s)&&(a=true),a}pruneUnusedLayers(e){let t4={};for(let i of e)t4[i]=true;for(let i in this.layerIndexes)t4[i]||delete this.layerIndexes[i]}},jM=`#ifdef GL_ES
9
+ precision mediump float;
10
+ #else
11
+ #if !defined(lowp)
12
+ #define lowp
13
+ #endif
14
+ #if !defined(mediump)
15
+ #define mediump
16
+ #endif
17
+ #if !defined(highp)
18
+ #define highp
19
+ #endif
20
+ #endif
21
+ out highp vec4 fragColor;layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};`,UM=`#ifdef GL_ES
22
+ precision highp float;
23
+ #else
24
+ #if !defined(lowp)
25
+ #define lowp
26
+ #endif
27
+ #if !defined(mediump)
28
+ #define mediump
29
+ #endif
30
+ #if !defined(highp)
31
+ #define highp
32
+ #endif
33
+ #endif
34
+ vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
35
+ );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
36
+ );}
37
+ #ifdef TERRAIN3D
38
+ uniform sampler2D u_terrain;uniform highp sampler2D u_depth;layout(std140) uniform TerrainUBO {highp mat4 u_terrain_matrix;highp vec4 u_terrain_unpack;highp float u_terrain_dim;highp float u_terrain_exaggeration;};
39
+ #endif
40
+ const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
41
+ #ifdef TERRAIN3D
42
+ highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
43
+ #else
44
+ return 1.0;
45
+ #endif
46
+ }float calculate_visibility(vec4 pos) {
47
+ #ifdef TERRAIN3D
48
+ vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
49
+ #else
50
+ return 1.0;
51
+ #endif
52
+ }float ele(ivec2 pos) {
53
+ #ifdef TERRAIN3D
54
+ vec4 rgb=(texelFetch(u_terrain,pos,0)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
55
+ #else
56
+ return 0.0;
57
+ #endif
58
+ }float get_elevation(vec2 pos) {
59
+ #ifdef TERRAIN3D
60
+ #ifdef GLOBE
61
+ if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
62
+ #endif
63
+ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.5;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
64
+ #else
65
+ return 0.0;
66
+ #endif
67
+ }const float PI=3.141592653589793;
68
+ #define PROJECTION_UBO
69
+ layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};`,NM=`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
70
+ #ifdef OVERDRAW_INSPECTOR
71
+ fragColor=vec4(1.0);
72
+ #endif
73
+ }`,GM="layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}",ZM=`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
74
+ #ifdef OVERDRAW_INSPECTOR
75
+ fragColor=vec4(1.0);
76
+ #endif
77
+ }`,qM="uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}",WM=`in vec3 v_data;flat in float v_visibility;
78
+ #pragma maplibre: define highp vec4 color
79
+ #pragma maplibre: define mediump float radius
80
+ #pragma maplibre: define lowp float blur
81
+ #pragma maplibre: define lowp float opacity
82
+ #pragma maplibre: define highp vec4 stroke_color
83
+ #pragma maplibre: define mediump float stroke_width
84
+ #pragma maplibre: define lowp float stroke_opacity
85
+ void main() {
86
+ #pragma maplibre: initialize highp vec4 color
87
+ #pragma maplibre: initialize mediump float radius
88
+ #pragma maplibre: initialize lowp float blur
89
+ #pragma maplibre: initialize lowp float opacity
90
+ #pragma maplibre: initialize highp vec4 stroke_color
91
+ #pragma maplibre: initialize mediump float stroke_width
92
+ #pragma maplibre: initialize lowp float stroke_opacity
93
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
94
+ #ifdef OVERDRAW_INSPECTOR
95
+ fragColor=vec4(1.0);
96
+ #endif
97
+ }`,HM=`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;flat out float v_visibility;
98
+ #pragma maplibre: define highp vec4 color
99
+ #pragma maplibre: define mediump float radius
100
+ #pragma maplibre: define lowp float blur
101
+ #pragma maplibre: define lowp float opacity
102
+ #pragma maplibre: define highp vec4 stroke_color
103
+ #pragma maplibre: define mediump float stroke_width
104
+ #pragma maplibre: define lowp float stroke_opacity
105
+ void main(void) {
106
+ #pragma maplibre: initialize highp vec4 color
107
+ #pragma maplibre: initialize mediump float radius
108
+ #pragma maplibre: initialize lowp float blur
109
+ #pragma maplibre: initialize lowp float opacity
110
+ #pragma maplibre: initialize highp vec4 stroke_color
111
+ #pragma maplibre: initialize mediump float stroke_width
112
+ #pragma maplibre: initialize lowp float stroke_opacity
113
+ ivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
114
+ #ifdef GLOBE
115
+ vec3 center_vector=projectToSphere(circle_center);
116
+ #endif
117
+ float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
118
+ #ifdef GLOBE
119
+ vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
120
+ #else
121
+ vec4 projected_center=projectTileWithElevation(circle_center,ele);
122
+ #endif
123
+ corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
124
+ #ifdef GLOBE
125
+ vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
126
+ #else
127
+ gl_Position=projectTileWithElevation(corner_position,ele);
128
+ #endif
129
+ } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`,lg="void main() {fragColor=vec4(1.0);}";const Gi={prelude:be(jM,UM),projectionMercator:be(`
130
+ void clipAntimeridian() {}`,"float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:be("in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian !=0 && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}",`#define GLOBE_RADIUS 6371008.8
131
+ #ifndef PROJECTION_UBO
132
+ uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;
133
+ #endif
134
+ out highp float v_projection_tile_x;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
135
+ );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy
136
+ );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:be(NM,GM),backgroundPattern:be(ZM,qM),circle:be(WM,HM),clippingMask:be(lg,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:be(`uniform highp float u_intensity;in vec2 v_extrude;
137
+ #pragma maplibre: define highp float weight
138
+ #define GAUSS_COEF 0.3989422804014327
139
+ void main() {
140
+ #pragma maplibre: initialize highp float weight
141
+ float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
142
+ #ifdef OVERDRAW_INSPECTOR
143
+ fragColor=vec4(1.0);
144
+ #endif
145
+ }`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in ivec2 a_pos;out vec2 v_extrude;
146
+ #pragma maplibre: define highp float weight
147
+ #pragma maplibre: define mediump float radius
148
+ const highp float ZERO=1.0/255.0/16.0;
149
+ #define GAUSS_COEF 0.3989422804014327
150
+ void main(void) {
151
+ #pragma maplibre: initialize highp float weight
152
+ #pragma maplibre: initialize mediump float radius
153
+ ivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=vec2(pos_raw >> 3);
154
+ #ifdef GLOBE
155
+ vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
156
+ #else
157
+ gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
158
+ #endif
159
+ }`),heatmapTexture:be(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
160
+ #ifdef OVERDRAW_INSPECTOR
161
+ fragColor=vec4(0.0);
162
+ #endif
163
+ }`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world_size,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:be("flat in float v_placed;flat in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;flat out float v_placed;flat out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:be("flat in float v_radius;in vec2 v_extrude;flat in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;flat out float v_radius;out vec2 v_extrude;flat out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:be(`#ifdef GL_ES
164
+ precision highp float;
165
+ #endif
166
+ uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
167
+ {l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
168
+ #ifdef OVERDRAW_INSPECTOR
169
+ fragColor=vec4(1.0);
170
+ #endif
171
+ }`,"uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=2.0/u_dimension;float scale=(u_dimension.x-4.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:be("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:be(lg,`layout(location=0) in vec2 a_pos;void main() {
172
+ #ifdef GLOBE
173
+ gl_Position=projectTileFor3D(a_pos,0.0);
174
+ #else
175
+ gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
176
+ #endif
177
+ }`),fill:be(`#pragma maplibre: define highp vec4 color
178
+ #pragma maplibre: define lowp float opacity
179
+ void main() {
180
+ #pragma maplibre: initialize highp vec4 color
181
+ #pragma maplibre: initialize lowp float opacity
182
+ fragColor=color*opacity;
183
+ #ifdef OVERDRAW_INSPECTOR
184
+ fragColor=vec4(1.0);
185
+ #endif
186
+ }`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;
187
+ #pragma maplibre: define highp vec4 color
188
+ #pragma maplibre: define lowp float opacity
189
+ void main() {
190
+ #pragma maplibre: initialize highp vec4 color
191
+ #pragma maplibre: initialize lowp float opacity
192
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:be(`in vec2 v_pos;
193
+ #ifdef GLOBE
194
+ in float v_depth;
195
+ #endif
196
+ #pragma maplibre: define highp vec4 outline_color
197
+ #pragma maplibre: define lowp float opacity
198
+ void main() {
199
+ #pragma maplibre: initialize highp vec4 outline_color
200
+ #pragma maplibre: initialize lowp float opacity
201
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
202
+ #ifdef GLOBE
203
+ if (v_depth > 1.0) {discard;}
204
+ #endif
205
+ #ifdef OVERDRAW_INSPECTOR
206
+ fragColor=vec4(1.0);
207
+ #endif
208
+ }`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;
209
+ #ifdef GLOBE
210
+ out float v_depth;
211
+ #endif
212
+ #pragma maplibre: define highp vec4 outline_color
213
+ #pragma maplibre: define lowp float opacity
214
+ void main() {
215
+ #pragma maplibre: initialize highp vec4 outline_color
216
+ #pragma maplibre: initialize lowp float opacity
217
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;
218
+ #ifdef GLOBE
219
+ v_depth=gl_Position.z/gl_Position.w;
220
+ #endif
221
+ }`),fillOutlinePattern:be(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;uniform bool u_sdf_pattern;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
222
+ #ifdef GLOBE
223
+ in float v_depth;
224
+ #endif
225
+ #pragma maplibre: define lowp float opacity
226
+ #pragma maplibre: define highp vec4 color
227
+ #pragma maplibre: define lowp vec4 pattern_from
228
+ #pragma maplibre: define lowp vec4 pattern_to
229
+ void main() {
230
+ #pragma maplibre: initialize lowp float opacity
231
+ #pragma maplibre: initialize highp vec4 color
232
+ #pragma maplibre: initialize mediump vec4 pattern_from
233
+ #pragma maplibre: initialize mediump vec4 pattern_to
234
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*alpha*opacity;} else {fragColor=mix(color1,color2,u_fade)*alpha*opacity;}
235
+ #ifdef GLOBE
236
+ if (v_depth > 1.0) {discard;}
237
+ #endif
238
+ #ifdef OVERDRAW_INSPECTOR
239
+ fragColor=vec4(1.0);
240
+ #endif
241
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
242
+ #ifdef GLOBE
243
+ out float v_depth;
244
+ #endif
245
+ #pragma maplibre: define lowp float opacity
246
+ #pragma maplibre: define highp vec4 color
247
+ #pragma maplibre: define lowp vec4 pattern_from
248
+ #pragma maplibre: define lowp vec4 pattern_to
249
+ #pragma maplibre: define lowp float pixel_ratio_from
250
+ #pragma maplibre: define lowp float pixel_ratio_to
251
+ void main() {
252
+ #pragma maplibre: initialize lowp float opacity
253
+ #pragma maplibre: initialize highp vec4 color
254
+ #pragma maplibre: initialize mediump vec4 pattern_from
255
+ #pragma maplibre: initialize mediump vec4 pattern_to
256
+ #pragma maplibre: initialize lowp float pixel_ratio_from
257
+ #pragma maplibre: initialize lowp float pixel_ratio_to
258
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;
259
+ #ifdef GLOBE
260
+ v_depth=gl_Position.z/gl_Position.w;
261
+ #endif
262
+ }`),fillPattern:be(`#ifdef GL_ES
263
+ precision highp float;
264
+ #endif
265
+ uniform vec2 u_texsize;uniform float u_fade;uniform bool u_sdf_pattern;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
266
+ #pragma maplibre: define lowp float opacity
267
+ #pragma maplibre: define highp vec4 color
268
+ #pragma maplibre: define lowp vec4 pattern_from
269
+ #pragma maplibre: define lowp vec4 pattern_to
270
+ void main() {
271
+ #pragma maplibre: initialize lowp float opacity
272
+ #pragma maplibre: initialize highp vec4 color
273
+ #pragma maplibre: initialize mediump vec4 pattern_from
274
+ #pragma maplibre: initialize mediump vec4 pattern_to
275
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*opacity;} else {fragColor=mix(color1,color2,u_fade)*opacity;}
276
+ #ifdef OVERDRAW_INSPECTOR
277
+ fragColor=vec4(1.0);
278
+ #endif
279
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
280
+ #pragma maplibre: define lowp float opacity
281
+ #pragma maplibre: define highp vec4 color
282
+ #pragma maplibre: define lowp vec4 pattern_from
283
+ #pragma maplibre: define lowp vec4 pattern_to
284
+ #pragma maplibre: define lowp float pixel_ratio_from
285
+ #pragma maplibre: define lowp float pixel_ratio_to
286
+ void main() {
287
+ #pragma maplibre: initialize lowp float opacity
288
+ #pragma maplibre: initialize highp vec4 color
289
+ #pragma maplibre: initialize mediump vec4 pattern_from
290
+ #pragma maplibre: initialize mediump vec4 pattern_to
291
+ #pragma maplibre: initialize lowp float pixel_ratio_from
292
+ #pragma maplibre: initialize lowp float pixel_ratio_to
293
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:be(`in vec4 v_color;void main() {fragColor=v_color;
294
+ #ifdef OVERDRAW_INSPECTOR
295
+ fragColor=vec4(1.0);
296
+ #endif
297
+ }`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;
298
+ #ifdef TERRAIN3D
299
+ layout(location=2) in vec2 a_centroid;
300
+ #endif
301
+ out vec4 v_color;
302
+ #pragma maplibre: define highp float base
303
+ #pragma maplibre: define highp float height
304
+ #pragma maplibre: define highp vec4 color
305
+ void main() {
306
+ #pragma maplibre: initialize highp float base
307
+ #pragma maplibre: initialize highp float height
308
+ #pragma maplibre: initialize highp vec4 color
309
+ vec3 normal=vec3(a_normal_ed.xyz);float gradient_base=max(0.0,base);float gradient_height=max(0.0,height);
310
+ #ifdef TERRAIN3D
311
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
312
+ #else
313
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
314
+ #endif
315
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
316
+ #ifdef GLOBE
317
+ vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
318
+ #else
319
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
320
+ #endif
321
+ float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
322
+ #ifdef GLOBE
323
+ mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
324
+ #endif
325
+ directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+gradient_base)*pow(gradient_height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:be(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
326
+ #pragma maplibre: define lowp float base
327
+ #pragma maplibre: define lowp float height
328
+ #pragma maplibre: define lowp vec4 pattern_from
329
+ #pragma maplibre: define lowp vec4 pattern_to
330
+ #pragma maplibre: define lowp float pixel_ratio_from
331
+ #pragma maplibre: define lowp float pixel_ratio_to
332
+ void main() {
333
+ #pragma maplibre: initialize lowp float base
334
+ #pragma maplibre: initialize lowp float height
335
+ #pragma maplibre: initialize mediump vec4 pattern_from
336
+ #pragma maplibre: initialize mediump vec4 pattern_to
337
+ #pragma maplibre: initialize lowp float pixel_ratio_from
338
+ #pragma maplibre: initialize lowp float pixel_ratio_to
339
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
340
+ #ifdef OVERDRAW_INSPECTOR
341
+ fragColor=vec4(1.0);
342
+ #endif
343
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;
344
+ #ifdef TERRAIN3D
345
+ layout(location=2) in vec2 a_centroid;
346
+ #endif
347
+ #ifdef GLOBE
348
+ out vec3 v_sphere_pos;
349
+ #endif
350
+ out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
351
+ #pragma maplibre: define lowp float base
352
+ #pragma maplibre: define lowp float height
353
+ #pragma maplibre: define lowp vec4 pattern_from
354
+ #pragma maplibre: define lowp vec4 pattern_to
355
+ #pragma maplibre: define lowp float pixel_ratio_from
356
+ #pragma maplibre: define lowp float pixel_ratio_to
357
+ void main() {
358
+ #pragma maplibre: initialize lowp float base
359
+ #pragma maplibre: initialize lowp float height
360
+ #pragma maplibre: initialize mediump vec4 pattern_from
361
+ #pragma maplibre: initialize mediump vec4 pattern_to
362
+ #pragma maplibre: initialize lowp float pixel_ratio_from
363
+ #pragma maplibre: initialize lowp float pixel_ratio_to
364
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=vec3(a_normal_ed.xyz);float edgedistance=float(a_normal_ed.w);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;float gradient_base=max(0.0,base);float gradient_height=max(0.0,height);
365
+ #ifdef TERRAIN3D
366
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
367
+ #else
368
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
369
+ #endif
370
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
371
+ #ifdef GLOBE
372
+ vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
373
+ #else
374
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
375
+ #endif
376
+ vec2 pos=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384
377
+ ? a_pos
378
+ : vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+gradient_base)*pow(gradient_height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:be(`#ifdef GL_ES
379
+ precision highp float;
380
+ #endif
381
+ uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-4.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
382
+ #ifdef OVERDRAW_INSPECTOR
383
+ fragColor=vec4(1.0);
384
+ #endif
385
+ }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:be(`uniform sampler2D u_image;in highp vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
386
+ #define PI 3.141592653589793
387
+ #define STANDARD 0
388
+ #define COMBINED 1
389
+ #define IGOR 2
390
+ #define MULTIDIRECTIONAL 3
391
+ #define BASIC 4
392
+ float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
393
+ {fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
394
+ {fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {highp vec2 size=vec2(textureSize(u_image,0));highp vec2 texturePos=(v_pos*(size-2.0)+1.0)/size;vec4 pixel=texture(u_image,texturePos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
395
+ #ifdef OVERDRAW_INSPECTOR
396
+ fragColor=vec4(1.0);
397
+ #endif
398
+ }`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:be(`flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
399
+ #ifdef GLOBE
400
+ in float v_depth;
401
+ #endif
402
+ #pragma maplibre: define highp vec4 color
403
+ #pragma maplibre: define lowp float blur
404
+ #pragma maplibre: define lowp float opacity
405
+ void main() {
406
+ #pragma maplibre: initialize highp vec4 color
407
+ #pragma maplibre: initialize lowp float blur
408
+ #pragma maplibre: initialize lowp float opacity
409
+ clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
410
+ #ifdef GLOBE
411
+ if (v_depth > 1.0) {discard;}
412
+ #endif
413
+ #ifdef OVERDRAW_INSPECTOR
414
+ fragColor=vec4(1.0);
415
+ #endif
416
+ }`,`
417
+ #define scale 0.015873016
418
+ layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
419
+ #ifdef GLOBE
420
+ out float v_depth;
421
+ #endif
422
+ #pragma maplibre: define highp vec4 color
423
+ #pragma maplibre: define lowp float blur
424
+ #pragma maplibre: define lowp float opacity
425
+ #pragma maplibre: define mediump float gapwidth
426
+ #pragma maplibre: define lowp float offset
427
+ #pragma maplibre: define mediump float width
428
+ void main() {
429
+ #pragma maplibre: initialize highp vec4 color
430
+ #pragma maplibre: initialize lowp float blur
431
+ #pragma maplibre: initialize lowp float opacity
432
+ #pragma maplibre: initialize mediump float gapwidth
433
+ #pragma maplibre: initialize lowp float offset
434
+ #pragma maplibre: initialize mediump float width
435
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
436
+ #ifdef GLOBE
437
+ v_depth=gl_Position.z/gl_Position.w;
438
+ #endif
439
+ #ifdef TERRAIN3D
440
+ v_gamma_scale=1.0;
441
+ #else
442
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
443
+ #endif
444
+ v_width2=vec2(outset,inset);}`),lineGradient:be(`uniform sampler2D u_image;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
445
+ #ifdef GLOBE
446
+ in float v_depth;
447
+ #endif
448
+ #pragma maplibre: define lowp float blur
449
+ #pragma maplibre: define lowp float opacity
450
+ void main() {
451
+ #pragma maplibre: initialize lowp float blur
452
+ #pragma maplibre: initialize lowp float opacity
453
+ clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
454
+ #ifdef GLOBE
455
+ if (v_depth > 1.0) {discard;}
456
+ #endif
457
+ #ifdef OVERDRAW_INSPECTOR
458
+ fragColor=vec4(1.0);
459
+ #endif
460
+ }`,`
461
+ #define scale 0.015873016
462
+ layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
463
+ #ifdef GLOBE
464
+ out float v_depth;
465
+ #endif
466
+ #pragma maplibre: define lowp float blur
467
+ #pragma maplibre: define lowp float opacity
468
+ #pragma maplibre: define mediump float gapwidth
469
+ #pragma maplibre: define lowp float offset
470
+ #pragma maplibre: define mediump float width
471
+ void main() {
472
+ #pragma maplibre: initialize lowp float blur
473
+ #pragma maplibre: initialize lowp float opacity
474
+ #pragma maplibre: initialize mediump float gapwidth
475
+ #pragma maplibre: initialize lowp float offset
476
+ #pragma maplibre: initialize mediump float width
477
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
478
+ #ifdef GLOBE
479
+ v_depth=gl_Position.z/gl_Position.w;
480
+ #endif
481
+ #ifdef TERRAIN3D
482
+ v_gamma_scale=1.0;
483
+ #else
484
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
485
+ #endif
486
+ v_width2=vec2(outset,inset);}`),linePattern:be(`#ifdef GL_ES
487
+ precision highp float;
488
+ #endif
489
+ uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width;
490
+ #ifdef GLOBE
491
+ in float v_depth;
492
+ #endif
493
+ #pragma maplibre: define lowp vec4 pattern_from
494
+ #pragma maplibre: define lowp vec4 pattern_to
495
+ #pragma maplibre: define lowp float pixel_ratio_from
496
+ #pragma maplibre: define lowp float pixel_ratio_to
497
+ #pragma maplibre: define lowp float blur
498
+ #pragma maplibre: define lowp float opacity
499
+ void main() {
500
+ #pragma maplibre: initialize mediump vec4 pattern_from
501
+ #pragma maplibre: initialize mediump vec4 pattern_to
502
+ #pragma maplibre: initialize lowp float pixel_ratio_from
503
+ #pragma maplibre: initialize lowp float pixel_ratio_to
504
+ #pragma maplibre: initialize lowp float blur
505
+ #pragma maplibre: initialize lowp float opacity
506
+ clipAntimeridian();vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
507
+ #ifdef GLOBE
508
+ if (v_depth > 1.0) {discard;}
509
+ #endif
510
+ #ifdef OVERDRAW_INSPECTOR
511
+ fragColor=vec4(1.0);
512
+ #endif
513
+ }`,`
514
+ #define scale 0.015873016
515
+ #define LINE_DISTANCE_SCALE 2.0
516
+ layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width;
517
+ #ifdef GLOBE
518
+ out float v_depth;
519
+ #endif
520
+ #pragma maplibre: define lowp float blur
521
+ #pragma maplibre: define lowp float opacity
522
+ #pragma maplibre: define lowp float offset
523
+ #pragma maplibre: define mediump float gapwidth
524
+ #pragma maplibre: define mediump float width
525
+ #pragma maplibre: define lowp float floorwidth
526
+ #pragma maplibre: define lowp vec4 pattern_from
527
+ #pragma maplibre: define lowp vec4 pattern_to
528
+ #pragma maplibre: define lowp float pixel_ratio_from
529
+ #pragma maplibre: define lowp float pixel_ratio_to
530
+ void main() {
531
+ #pragma maplibre: initialize lowp float blur
532
+ #pragma maplibre: initialize lowp float opacity
533
+ #pragma maplibre: initialize lowp float offset
534
+ #pragma maplibre: initialize mediump float gapwidth
535
+ #pragma maplibre: initialize mediump float width
536
+ #pragma maplibre: initialize lowp float floorwidth
537
+ #pragma maplibre: initialize mediump vec4 pattern_from
538
+ #pragma maplibre: initialize mediump vec4 pattern_to
539
+ #pragma maplibre: initialize lowp float pixel_ratio_from
540
+ #pragma maplibre: initialize lowp float pixel_ratio_to
541
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
542
+ #ifdef GLOBE
543
+ v_depth=gl_Position.z/gl_Position.w;
544
+ #endif
545
+ #ifdef TERRAIN3D
546
+ v_gamma_scale=1.0;
547
+ #else
548
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
549
+ #endif
550
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:be(`uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
551
+ #ifdef GLOBE
552
+ in float v_depth;
553
+ #endif
554
+ #pragma maplibre: define highp vec4 color
555
+ #pragma maplibre: define lowp float blur
556
+ #pragma maplibre: define lowp float opacity
557
+ #pragma maplibre: define mediump float width
558
+ #pragma maplibre: define lowp float floorwidth
559
+ #pragma maplibre: define mediump vec4 dasharray_from
560
+ #pragma maplibre: define mediump vec4 dasharray_to
561
+ void main() {
562
+ #pragma maplibre: initialize highp vec4 color
563
+ #pragma maplibre: initialize lowp float blur
564
+ #pragma maplibre: initialize lowp float opacity
565
+ #pragma maplibre: initialize mediump float width
566
+ #pragma maplibre: initialize lowp float floorwidth
567
+ #pragma maplibre: initialize mediump vec4 dasharray_from
568
+ #pragma maplibre: initialize mediump vec4 dasharray_to
569
+ clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
570
+ #ifdef GLOBE
571
+ if (v_depth > 1.0) {discard;}
572
+ #endif
573
+ #ifdef OVERDRAW_INSPECTOR
574
+ fragColor=vec4(1.0);
575
+ #endif
576
+ }`,`
577
+ #define scale 0.015873016
578
+ #define LINE_DISTANCE_SCALE 2.0
579
+ layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
580
+ #ifdef GLOBE
581
+ out float v_depth;
582
+ #endif
583
+ #pragma maplibre: define highp vec4 color
584
+ #pragma maplibre: define lowp float blur
585
+ #pragma maplibre: define lowp float opacity
586
+ #pragma maplibre: define mediump float gapwidth
587
+ #pragma maplibre: define lowp float offset
588
+ #pragma maplibre: define mediump float width
589
+ #pragma maplibre: define lowp float floorwidth
590
+ #pragma maplibre: define mediump vec4 dasharray_from
591
+ #pragma maplibre: define mediump vec4 dasharray_to
592
+ void main() {
593
+ #pragma maplibre: initialize highp vec4 color
594
+ #pragma maplibre: initialize lowp float blur
595
+ #pragma maplibre: initialize lowp float opacity
596
+ #pragma maplibre: initialize mediump float gapwidth
597
+ #pragma maplibre: initialize lowp float offset
598
+ #pragma maplibre: initialize mediump float width
599
+ #pragma maplibre: initialize lowp float floorwidth
600
+ #pragma maplibre: initialize mediump vec4 dasharray_from
601
+ #pragma maplibre: initialize mediump vec4 dasharray_to
602
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
603
+ #ifdef GLOBE
604
+ v_depth=gl_Position.z/gl_Position.w;
605
+ #endif
606
+ #ifdef TERRAIN3D
607
+ v_gamma_scale=1.0;
608
+ #else
609
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
610
+ #endif
611
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:be(`uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
612
+ #ifdef GLOBE
613
+ in float v_depth;
614
+ #endif
615
+ #pragma maplibre: define lowp float blur
616
+ #pragma maplibre: define lowp float opacity
617
+ #pragma maplibre: define mediump float width
618
+ #pragma maplibre: define lowp float floorwidth
619
+ #pragma maplibre: define mediump vec4 dasharray_from
620
+ #pragma maplibre: define mediump vec4 dasharray_to
621
+ void main() {
622
+ #pragma maplibre: initialize lowp float blur
623
+ #pragma maplibre: initialize lowp float opacity
624
+ #pragma maplibre: initialize mediump float width
625
+ #pragma maplibre: initialize lowp float floorwidth
626
+ #pragma maplibre: initialize mediump vec4 dasharray_from
627
+ #pragma maplibre: initialize mediump vec4 dasharray_to
628
+ clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
629
+ #ifdef GLOBE
630
+ if (v_depth > 1.0) {discard;}
631
+ #endif
632
+ #ifdef OVERDRAW_INSPECTOR
633
+ fragColor=vec4(1.0);
634
+ #endif
635
+ }`,`
636
+ #define scale 0.015873016
637
+ #define LINE_DISTANCE_SCALE 2.0
638
+ layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
639
+ #ifdef GLOBE
640
+ out float v_depth;
641
+ #endif
642
+ #pragma maplibre: define lowp float blur
643
+ #pragma maplibre: define lowp float opacity
644
+ #pragma maplibre: define mediump float gapwidth
645
+ #pragma maplibre: define lowp float offset
646
+ #pragma maplibre: define mediump float width
647
+ #pragma maplibre: define lowp float floorwidth
648
+ #pragma maplibre: define mediump vec4 dasharray_from
649
+ #pragma maplibre: define mediump vec4 dasharray_to
650
+ void main() {
651
+ #pragma maplibre: initialize lowp float blur
652
+ #pragma maplibre: initialize lowp float opacity
653
+ #pragma maplibre: initialize mediump float gapwidth
654
+ #pragma maplibre: initialize lowp float offset
655
+ #pragma maplibre: initialize mediump float width
656
+ #pragma maplibre: initialize lowp float floorwidth
657
+ #pragma maplibre: initialize mediump vec4 dasharray_from
658
+ #pragma maplibre: initialize mediump vec4 dasharray_to
659
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
660
+ #ifdef GLOBE
661
+ v_depth=gl_Position.z/gl_Position.w;
662
+ #endif
663
+ #ifdef TERRAIN3D
664
+ v_gamma_scale=1.0;
665
+ #else
666
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
667
+ #endif
668
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),layerOpacity:be(`uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity;
669
+ #ifdef OVERDRAW_INSPECTOR
670
+ fragColor=vec4(0.0);
671
+ #endif
672
+ }`,"layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),raster:be(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
673
+ #ifdef OVERDRAW_INSPECTOR
674
+ fragColor=vec4(1.0);
675
+ #endif
676
+ }`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5;
677
+ #ifdef GLOBE
678
+ if (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;}
679
+ #endif
680
+ float perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}`),symbolIcon:be(`uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
681
+ #ifdef OVERDRAW_INSPECTOR
682
+ fragColor=vec4(1.0);
683
+ #endif
684
+ }`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform bool u_rotate_symbol;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;flat out float v_total_opacity;
685
+ #pragma maplibre: define lowp float opacity
686
+ void main() {
687
+ #pragma maplibre: initialize lowp float opacity
688
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
689
+ camera_to_anchor_distance/u_camera_to_center_distance :
690
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
691
+ #ifdef GLOBE
692
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
693
+ #endif
694
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:be(`#define SDF_PX 8.0
695
+ uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
696
+ #pragma maplibre: define highp vec4 fill_color
697
+ #pragma maplibre: define highp vec4 halo_color
698
+ #pragma maplibre: define lowp float halo_width
699
+ #pragma maplibre: define lowp float halo_blur
700
+ void main() {
701
+ #pragma maplibre: initialize highp vec4 fill_color
702
+ #pragma maplibre: initialize highp vec4 halo_color
703
+ #pragma maplibre: initialize lowp float halo_width
704
+ #pragma maplibre: initialize lowp float halo_blur
705
+ float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}
706
+ #ifdef OVERDRAW_INSPECTOR
707
+ fragColor=vec4(1.0);
708
+ #endif
709
+ }`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1;
710
+ #pragma maplibre: define highp vec4 fill_color
711
+ #pragma maplibre: define highp vec4 halo_color
712
+ #pragma maplibre: define lowp float opacity
713
+ #pragma maplibre: define lowp float halo_width
714
+ #pragma maplibre: define lowp float halo_blur
715
+ void main() {
716
+ #pragma maplibre: initialize highp vec4 fill_color
717
+ #pragma maplibre: initialize highp vec4 halo_color
718
+ #pragma maplibre: initialize lowp float opacity
719
+ #pragma maplibre: initialize lowp float halo_width
720
+ #pragma maplibre: initialize lowp float halo_blur
721
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
722
+ camera_to_anchor_distance/u_camera_to_center_distance :
723
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
724
+ #ifdef GLOBE
725
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
726
+ #endif
727
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:be(`#define SDF_PX 8.0
728
+ #define SDF 1.0
729
+ #define ICON 0.0
730
+ uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf;
731
+ #pragma maplibre: define highp vec4 fill_color
732
+ #pragma maplibre: define highp vec4 halo_color
733
+ #pragma maplibre: define lowp float halo_width
734
+ #pragma maplibre: define lowp float halo_blur
735
+ void main() {
736
+ #pragma maplibre: initialize highp vec4 fill_color
737
+ #pragma maplibre: initialize highp vec4 halo_color
738
+ #pragma maplibre: initialize lowp float halo_width
739
+ #pragma maplibre: initialize lowp float halo_blur
740
+ float total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
741
+ #ifdef OVERDRAW_INSPECTOR
742
+ fragColor=vec4(1.0);
743
+ #endif
744
+ return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}
745
+ #ifdef OVERDRAW_INSPECTOR
746
+ fragColor=vec4(1.0);
747
+ #endif
748
+ }`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf;
749
+ #pragma maplibre: define highp vec4 fill_color
750
+ #pragma maplibre: define highp vec4 halo_color
751
+ #pragma maplibre: define lowp float opacity
752
+ #pragma maplibre: define lowp float halo_width
753
+ #pragma maplibre: define lowp float halo_blur
754
+ void main() {
755
+ #pragma maplibre: initialize highp vec4 fill_color
756
+ #pragma maplibre: initialize highp vec4 halo_color
757
+ #pragma maplibre: initialize lowp float opacity
758
+ #pragma maplibre: initialize lowp float halo_width
759
+ #pragma maplibre: initialize lowp float halo_blur
760
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
761
+ camera_to_anchor_distance/u_camera_to_center_distance :
762
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
763
+ #ifdef GLOBE
764
+ if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
765
+ #endif
766
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}`),terrain:be("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:be("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),atmosphere:be(`#ifdef GL_ES
767
+ precision highp float;
768
+ #endif
769
+ in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
770
+ );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:be("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;in vec3 v_view_direction;const float ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS=100000.0/6371000.0;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;float opacity=1.0;if (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,((angle_to_globe_center-horizon_angle)*u_camera_to_center_distance+1.0)*u_device_pixel_ratio,u_sky_blend);float closest_approach=max(dot(ray,u_globe_position),0.0);float lowest_altitude=sqrt(max(globe_distance*globe_distance-closest_approach*closest_approach,0.0))-u_globe_radius;float atmosphere_height=u_globe_radius*ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS;float inside_atmosphere=1.0-smoothstep(atmosphere_height,10.0*atmosphere_height,globe_distance-u_globe_radius);float through_atmosphere=1.0-smoothstep(0.0,atmosphere_height,lowest_altitude);opacity=inside_atmosphere*through_atmosphere*(1.0-u_atmosphere_blend);}if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor*=mix(1.0,opacity,u_sky_blend);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")};function be(e,t4){let i=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t4.match(/in ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=t4.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=s?s.concat(a):a,o=r?r.length:0,l={};return e=e.replace(i,(u,h,c,d,p)=>(l[p]=true,h==="define"?`
771
+ #ifndef HAS_UNIFORM_u_${p}
772
+ in ${c} ${d} ${p};
773
+ #else
774
+ uniform ${c} ${d} u_${p};
775
+ #endif
776
+ `:`
777
+ #ifdef HAS_UNIFORM_u_${p}
778
+ ${c} ${d} ${p} = u_${p};
779
+ #endif
780
+ `)),t4=t4.replace(i,(u,h,c,d,p)=>{let f=d==="float"?"vec2":"vec4",m=p.match(/color/)?"color":f;return l[p]?h==="define"?`
781
+ #ifndef HAS_UNIFORM_u_${p}
782
+ uniform lowp float u_${p}_t;
783
+ layout(location = ${o++}) in ${c} ${f} a_${p};
784
+ out ${c} ${d} ${p};
785
+ #else
786
+ uniform ${c} ${d} u_${p};
787
+ #endif
788
+ `:m==="vec4"?`
789
+ #ifndef HAS_UNIFORM_u_${p}
790
+ ${p} = a_${p};
791
+ #else
792
+ ${c} ${d} ${p} = u_${p};
793
+ #endif
794
+ `:`
795
+ #ifndef HAS_UNIFORM_u_${p}
796
+ ${p} = unpack_mix_${m}(a_${p}, u_${p}_t);
797
+ #else
798
+ ${c} ${d} ${p} = u_${p};
799
+ #endif
800
+ `:h==="define"?`
801
+ #ifndef HAS_UNIFORM_u_${p}
802
+ uniform lowp float u_${p}_t;
803
+ layout(location = ${o++}) in ${c} ${f} a_${p};
804
+ #else
805
+ uniform ${c} ${d} u_${p};
806
+ #endif
807
+ `:m==="vec4"?`
808
+ #ifndef HAS_UNIFORM_u_${p}
809
+ ${c} ${d} ${p} = a_${p};
810
+ #else
811
+ ${c} ${d} ${p} = u_${p};
812
+ #endif
813
+ `:`
814
+ #ifndef HAS_UNIFORM_u_${p}
815
+ ${c} ${d} ${p} = unpack_mix_${m}(a_${p}, u_${p}_t);
816
+ #else
817
+ ${c} ${d} ${p} = u_${p};
818
+ #endif
819
+ `}),{fragmentSource:e,vertexSource:t4,staticAttributes:r,staticUniforms:n}}const Q1="#define PROJECTION_MERCATOR",ev="mercator";var Nc=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return false}get shaderVariantName(){return ev}get shaderDefine(){return Q1}get shaderPreludeCode(){return Gi.projectionMercator}get vertexShaderPreludeCode(){return Gi.projectionMercator.vertexSource}get subdivisionGranularity(){return Pd.noSubdivision}get useGlobeControls(){return false}get transitionState(){return 0}destroy(){}getMeshFromTileID(e,t4,i,r,a){if(this._cachedMesh)return this._cachedMesh;let s=new Tr;s.emplaceBack(0,0),s.emplaceBack(k,0),s.emplaceBack(0,k),s.emplaceBack(k,k);let n=e.createVertexBuffer(s,Zr.members),o=We.simpleSegment(0,0,4,2),l=new Qi;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new Cn(n,u,o),this._cachedMesh}recalculate(){}hasTransition(){return false}},ug=class tv{constructor(t4=0,i=0,r=0,a=0){if(isNaN(t4)||t4<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t4,this.bottom=i,this.left=r,this.right=a}interpolate(t4,i,r){return i.top!=null&&t4.top!=null&&(this.top=He.number(t4.top,i.top,r)),i.bottom!=null&&t4.bottom!=null&&(this.bottom=He.number(t4.bottom,i.bottom,r)),i.left!=null&&t4.left!=null&&(this.left=He.number(t4.left,i.left,r)),i.right!=null&&t4.right!=null&&(this.right=He.number(t4.right,i.right,r)),this}getCenter(t4,i){let r=ne((this.left+t4-this.right)/2,0,t4),a=ne((this.top+i-this.bottom)/2,0,i);return new C(r,a)}equals(t4){return this.top===t4.top&&this.bottom===t4.bottom&&this.left===t4.left&&this.right===t4.right}clone(){return new tv(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function xl(e,t4){if(!e.renderWorldCopies||e.lngRange)return;let i=t4.lng-e.center.lng;t4.lng+=i>180?-360:i<-180?360:0}function hg(e){return Math.max(0,Math.floor(e))}var np=class{constructor(e,t4){this.applyConstrain=(i,r)=>this._constrainOverride===null?this._callbacks.defaultConstrain(i,r):this._constrainOverride(i,r),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=(t4==null?void 0:t4.renderWorldCopies)===void 0||!!(t4!=null&&t4.renderWorldCopies),this._minZoom=(t4==null?void 0:t4.minZoom)||0,this._maxZoom=(t4==null?void 0:t4.maxZoom)||22,this._minPitch=(t4==null?void 0:t4.minPitch)===void 0||(t4==null?void 0:t4.minPitch)===null?0:t4==null?void 0:t4.minPitch,this._maxPitch=(t4==null?void 0:t4.maxPitch)===void 0||(t4==null?void 0:t4.maxPitch)===null?60:t4==null?void 0:t4.maxPitch,this._constrainOverride=(t4==null?void 0:t4.constrainOverride)??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new H(0,0),this._elevation=0,this._zoom=0,this._tileZoom=hg(this._zoom),this._scale=$t(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=true,this._edgeInsets=new ug,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=true}apply(e,t4){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=hg(this._zoom),this._scale=$t(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new ug(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=e.autoCalculateNearFarZ,t4&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){if(this._minZoom===e)return;this._minZoom=e;let t4=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t4}get maxZoom(){return this._maxZoom}setMaxZoom(e){if(this._maxZoom===e)return;this._maxZoom=e;let t4=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t4}get minPitch(){return this._minPitch}setMinPitch(e){if(this._minPitch===e)return;this._minPitch=e;let t4=this._unmodified;this.setPitch(Math.max(this.pitch,e)),this._unmodified=t4}get maxPitch(){return this._maxPitch}setMaxPitch(e){if(this._maxPitch===e)return;this._maxPitch=e;let t4=this._unmodified;this.setPitch(Math.min(this.pitch,e)),this._unmodified=t4}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=true:e===null&&(e=false),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){e===void 0&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new C(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t4=mi(e,-180,180)*Math.PI/180;this._bearingInRadians!==t4&&(this._unmodified=false,this._bearingInRadians=t4,this._calcMatrices(),this._rotationMatrix=C1(),IA(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t4=ne(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t4&&(this._unmodified=false,this._pitchInRadians=t4,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t4=e/180*Math.PI;this._rollInRadians!==t4&&(this._unmodified=false,this._rollInRadians=t4,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Ui(this._fovInRadians)}setFov(e){e=ne(e,.1,150),this.fov!==e&&(this._unmodified=false,this._fovInRadians=Ze(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t4=this.applyConstrain(this._center,e).zoom;this._zoom!==t4&&(this._unmodified=false,this._zoom=t4,this._tileZoom=Math.max(0,Math.floor(t4)),this._scale=$t(t4),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){(e.lat!==this._center.lat||e.lng!==this._center.lng)&&(this._unmodified=false,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=false,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t4){this._autoCalculateNearFarZ=false,this._nearZ=e,this._farZ=t4,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=true,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t4,i){this._unmodified=false,this._edgeInsets.interpolate(e,t4,i),this.constrainInternal(),this._calcMatrices()}resize(e,t4,i=true){this._width=e,this._height=t4,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var e,t4;return((e=this._latRange)==null?void 0:e.length)!==2||((t4=this._lngRange)==null?void 0:t4.length)!==2?null:new Yi([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-Wi,Wi])}getCameraQueryGeometry(e,t4){if(t4.length===1)return[t4[0],e];{let{minX:i,minY:r,maxX:a,maxY:s}=Ai.fromPoints(t4).extend(e);return[new C(i,r),new C(a,r),new C(a,s),new C(i,s),new C(i,r)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=true;let e=this._unmodified,{center:t4,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(t4),this.setZoom(i),this._unmodified=e,this._constraining=false}_calcMatrices(){if(this._pixelPerMeter=Xr(1,this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=Ii(new Float64Array(16));Dt(e,e,[this._width/2,-this._height/2,1]),ot(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=Ii(new Float64Array(16)),Dt(e,e,[1,-1,1]),ot(e,e,[-1,-1,0]),Dt(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t4=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t4)*this._height,this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t4,i,r){let a=i===void 0?this.bearing:i,s=r=r===void 0?this.pitch:r,{distanceToCenter:n,clampedElevation:o}=this._distanceToCenterFromAltElevationPitch(t4,this.elevation,s),{x:l,y:u}=bc(s,a),h=Ie.fromLngLat(e,t4),c=y0(1,h.y),d,p,f=0;do{if(f+=1,f>10)break;p=n/c;let m=l*p,g=u*p;d=new Ie(h.x+m,h.y+g),c=1/d.meterInMercatorCoordinateUnits()}while(Math.abs(n-p*c)>1e-12);return{center:d.toLngLat(),elevation:o,zoom:It(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t4=1/this.worldSize,i=Xr(1,this.center.lat)*this.worldSize,r=Ie.fromLngLat(this.center,this.elevation),a=r.x/t4,s=r.y/t4,n=r.z/t4,o=this.pitch,l=this.bearing,{x:u,y:h,z:c}=bc(o,l),d=this.cameraToCenterDistance,p=a+d*-u,f=s+d*-h,m=n+d*c,{distanceToCenter:g,clampedElevation:_}=this._distanceToCenterFromAltElevationPitch(m/i,e,o),y=g*i,x=p+u*y,v=f+h*y,w=new Ie(x*t4,v*t4,0).toLngLat(),b=Xr(1,w.lat),T=It(this.height/2/Math.tan(this.fovInRadians/2)/g/b/this.tileSize);this._elevation=_,this._center=w,this.setZoom(T)}_distanceToCenterFromAltElevationPitch(e,t4,i){let r=-Math.cos(Ze(i)),a=e-t4,s,n=t4;return r*a>=0||Math.abs(r)<.1?(s=1e4,n=e+s*r):s=-a/r,{distanceToCenter:s,clampedElevation:n}}getCameraPoint(){let e=this.pitchInRadians,t4=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new C(t4*Math.sin(this.rollInRadians),t4*Math.cos(this.rollInRadians)))}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t4=e.canonical.z>=0?1<<e.canonical.z:2**e.canonical.z;return[e.canonical.x/t4,e.canonical.y/t4,1/t4/k,1/t4/k]}},XM=class{distanceToTile2d(e,t4,i,r){let a=r,s=a.distanceX([e,t4]),n=a.distanceY([e,t4]);return Math.hypot(s,n)}getWrap(e,t4,i){return i}getTileBoundingVolume(e,t4,i,r){let a=Math.min(0,i),s=Math.max(0,i);if(r!=null&&r.terrain){let o=new St(e.z,t4,e.z,e.x,e.y),l=r.terrain.getMinMaxElevation(o);a=l.minElevation??a,s=l.maxElevation??s}let n=1<<e.z;return new Qd([t4+e.x/n,e.y/n,a],[t4+(e.x+1)/n,(e.y+1)/n,s])}allowVariableZoom(e,t4){let i=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,r=ne(78.5-i/2,0,60);return!!t4.terrain||e.pitch>r}allowWorldCopies(){return true}prepareNextFrame(){}};const YM=Ke([{name:"a_pos3d",type:"Int16",components:3}]);var KM=class extends pt{constructor(e){super(),this._lastTilesetChange=ze(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=true,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=false,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(e,t4){this.tileManager.update(e,t4),this._renderableTilesKeys=[];let i={},r=false;for(let a of ss(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:false,terrain:t4}))i[a.key]=true,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float32Array(16),$i(a.terrainRttPosMatrix32f,0,k,k,0,0,1),this._tiles[a.key]=new N1(a,this.tileSize),this._lastTilesetChange=ze(),r=true);for(let a in this._tiles)i[a]||(this._tiles[a].releaseRTT(this.tileManager.map.painter),delete this._tiles[a],r=true);return r}releaseRTT(e){for(let t4 in this._tiles){let i=this._tiles[t4];(i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&i.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let e in this._tiles)this._tiles[e].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t4){return t4?this._getTerrainCoordsForTileRanges(e,t4):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t4={};for(let i of this._renderableTilesKeys){let r=this._tiles[i].tileID,a=e.clone(),s=jr();if(r.canonical.equals(e.canonical))$i(s,0,k,k,0,0,1);else if(r.canonical.isChildOf(e.canonical)){let n=r.canonical.z-e.canonical.z,o=r.canonical.x-(r.canonical.x>>n<<n),l=r.canonical.y-(r.canonical.y>>n<<n),u=k>>n;$i(s,0,u,u,0,0,1),ot(s,s,[-o*u,-l*u,0])}else if(e.canonical.isChildOf(r.canonical)){let n=e.canonical.z-r.canonical.z,o=e.canonical.x-(e.canonical.x>>n<<n),l=e.canonical.y-(e.canonical.y>>n<<n),u=k>>n;$i(s,0,k,k,0,0,1),ot(s,s,[o*u,l*u,0]),Dt(s,s,[1/2**n,1/2**n,0])}else continue;a.terrainRttPosMatrix32f=new Float32Array(s),t4[i]=a}return t4}_getTerrainCoordsForTileRanges(e,t4){let i={};for(let r of this._renderableTilesKeys){let a=this._tiles[r].tileID;if(!this._isWithinTileRanges(a,t4))continue;let s=e.clone(),n=jr();if(a.canonical.z===e.canonical.z){let o=e.canonical.x-a.canonical.x+e.wrap*(1<<e.canonical.z),l=e.canonical.y-a.canonical.y;$i(n,0,k,k,0,0,1),ot(n,n,[o*k,l*k,0])}else if(a.canonical.z>e.canonical.z){let o=a.canonical.z-e.canonical.z,l=a.canonical.x-(a.canonical.x>>o<<o)+e.wrap*(1<<a.canonical.z),u=a.canonical.y-(a.canonical.y>>o<<o),h=e.canonical.x-(a.canonical.x>>o),c=e.canonical.y-(a.canonical.y>>o),d=k>>o;$i(n,0,d,d,0,0,1),ot(n,n,[-l*d+h*k,-u*d+c*k,0])}else{let o=e.canonical.z-a.canonical.z,l=e.canonical.x-(e.canonical.x>>o<<o)+e.wrap*(1<<e.canonical.z),u=e.canonical.y-(e.canonical.y>>o<<o),h=(e.canonical.x>>o)-a.canonical.x,c=(e.canonical.y>>o)-a.canonical.y,d=k<<o;$i(n,0,d,d,0,0,1),ot(n,n,[l*k+h*d,u*k+c*d,0])}s.terrainRttPosMatrix32f=new Float32Array(n),i[r]=s}return i}getSourceTile(e,t4){var s,n;let i=this.tileManager._source,r=e.overscaledZ-this.deltaZoom;if(r>i.maxzoom&&(r=i.maxzoom),r<i.minzoom)return;(s=this._sourceTileCache)[n=e.key]||(s[n]=e.scaledTo(r).key);let a=this.findTileInCaches(this._sourceTileCache[e.key]);if(!(a!=null&&a.dem)&&t4)for(;r>=i.minzoom&&!(a!=null&&a.dem);)a=this.findTileInCaches(e.scaledTo(r--).key);return a}findTileInCaches(e){let t4=this.tileManager.getTileByID(e);return t4||(t4=this.tileManager._outOfViewCache.getByKey(e),t4)}anyTilesAfterTime(e=ze()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t4){let i=t4[e.canonical.z];return!!i&&(e.wrap>i.minWrap||e.wrap<i.maxWrap||e.canonical.x>=i.minTileXWrapped&&e.canonical.x<=i.maxTileXWrapped&&e.canonical.y>=i.minTileY&&e.canonical.y<=i.maxTileY)}};const cg=k*(1-1e-12),dg=-.5;var JM=class{constructor(e,t4,i,r="auto"){this._meshCache={},this.painter=e,this.tileManager=new KM(t4),this.options=i,this.exaggeration=typeof i.exaggeration=="number"?i.exaggeration:1,this._terrainSkirtLength=r,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){this._fbo&&(this._fbo=(this._fbo.destroy(),null)),this._fboDepthTexture&&(this._fboDepthTexture=(this._fboDepthTexture.destroy(),null)),this._emptyDemTexture&&(this._emptyDemTexture=(this._emptyDemTexture.destroy(),null)),this._emptyDepthTexture&&(this._emptyDepthTexture=(this._emptyDepthTexture.destroy(),null));for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,t4,i,r=k){let a=e.normalizeCoordinates(t4,i,r);if(!a)return 0;let s=this.getElevationSampler(a.tileID);return s?s(a.x,a.y,r):0}getElevationForLngLatZoom(e,t4){if(!fm(t4,e.wrap()))return 0;let{tileID:i,mercatorX:r,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(e,t4);return this.getElevation(i,r%k,a%k,k)}getElevationForLngLat(e,t4){let i=this.getCoverageIndex();if(i){let s=Ie.fromLngLat(e),n=op(i,this.exaggeration,s.x,s.y);if(n.demLoaded)return n.elevation}let r=ss(t4,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let s of r)s.canonical.z>a&&(a=Math.min(s.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,a)}getElevation(e,t4,i,r=k){return this.getDEMElevation(e,t4,i,r)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return this._coverageIndex===void 0&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let e=[],t4=new Map,i=0,r=0;for(let a of this.tileManager.getRenderableTiles()){if(!a)continue;let{canonical:s,wrap:n}=a.tileID;e.includes(s.z)||e.push(s.z);let o=this.getElevationSampler(a.tileID);t4.set(`${n}/${s.z}/${s.x}/${s.y}`,o);let{minElevation:l,maxElevation:u}=this.getMinMaxElevation(a.tileID);i=Math.min(i,l??0),r=Math.max(r,u??0)}return t4.size===0?null:(e.sort((a,s)=>s-a),{zooms:e,samplerPerTile:t4,minElevation:i-10,maxElevation:r+10})}getElevationSampler(e){let t4=e.key,i=this._elevationSamplerCache.get(t4);if(i)return i;let r=this.tileManager.getSourceTile(e,true),a=r==null?void 0:r.dem;if(!r||!a)return null;let s=this._getDEMTileMatrix(e,r),n=s[0]*a.dim,o=s[5]*a.dim,l=s[12]*a.dim+dg,u=s[13]*a.dim+dg,h=(c,d,p)=>{let f=p===8192?1:k/p;return a.sampleBilinear(c*f*n+l,d*f*o+u)};return this._elevationSamplerCache.set(t4,h),h}_getDEMTileMatrix(e,t4){let i=`${t4.tileID.key}/${e.key}`,r=this._demMatrixCache.get(i);if(r)return r;let a=e.canonical.z-t4.tileID.canonical.z,s=e.canonical.x-(e.canonical.x>>a<<a),n=e.canonical.y-(e.canonical.y>>a<<a),o=sx(new Float64Array(16),[1/(k<<a),1/(k<<a),0]);return ot(o,o,[s*k,n*k,0]),this._demMatrixCache.set(i,o),o}getTerrainData(e){var r,a;if(!this._emptyDemTexture){let s=this.painter.context,n=new je({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new dt(s,n,s.gl.RGBA,{premultiply:false}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new dt(s,new je({width:1,height:1}),s.gl.RGBA,{premultiply:false}),this._emptyDemTexture.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=Ii([])}let t4=this.tileManager.getSourceTile(e,true);if(t4!=null&&t4.dem&&(!t4.demTexture||t4.needsTerrainPrepare)){let s=this.painter.context;t4.demTexture||(t4.demTexture=this.painter.getTileTexture(t4.dem.stride)),t4.demTexture?t4.demTexture.update(t4.dem.getPixels(),{premultiply:false}):t4.demTexture=new dt(s,t4.dem.getPixels(),s.gl.RGBA,{premultiply:false}),t4.demTexture.bind(s.gl.NEAREST,s.gl.CLAMP_TO_EDGE),t4.needsTerrainPrepare=false}let i=t4?this._getDEMTileMatrix(e,t4):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:((r=t4==null?void 0:t4.dem)==null?void 0:r.dim)||1,u_terrain_matrix:i,u_terrain_unpack:((a=t4==null?void 0:t4.dem)==null?void 0:a.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:((t4==null?void 0:t4.demTexture)||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t4}}getFramebuffer(){let e=this.painter,t4=e.width/devicePixelRatio,i=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==t4||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new dt(e.context,{width:t4,height:i,data:null},e.context.gl.RGBA,{premultiply:false}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(t4,i,true,false),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t4,i))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}getTerrainMesh(e){var d;let t4=((d=this.painter.style.projection)==null?void 0:d.transitionState)>0,i=t4&&e.canonical.y===0,r=t4&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${i?"n":""}_${r?"s":""}`;if(this._meshCache[a])return this._meshCache[a];let s=this.painter.context,n=new a2,o=new Qi,l=this.meshSize,u=k/l,h=l*l;for(let p=0;p<=l;p++)for(let f=0;f<=l;f++)n.emplaceBack(f*u,p*u,0);for(let p=0;p<h;p+=l+1)for(let f=0;f<l;f++)o.emplaceBack(f+p,l+f+p+1,l+f+p+2),o.emplaceBack(f+p,l+f+p+2,f+p+1);this._terrainSkirtLength!=="none"&&this._buildSkirts(n,o,l,u,i,r);let c=new Cn(s.createVertexBuffer(n,YM.members),s.createIndexBuffer(o),We.simpleSegment(0,0,n.length,o.length));return this._meshCache[a]=c,c}getSkirtLength(e){return 2*Math.PI*Lt/2**Math.max(e,0)/5}getMinTileElevationForLngLatZoom(e,t4){if(!fm(t4,e.wrap()))return 0;let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t4);return this.getMinMaxElevation(i).minElevation??0}getMinMaxElevation(e){let t4=this.tileManager.getSourceTile(e,true),i={minElevation:null,maxElevation:null};return t4!=null&&t4.dem&&(i.minElevation=t4.dem.min*this.exaggeration,i.maxElevation=t4.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,t4){let i=Ie.fromLngLat(e.wrap()),r=(1<<t4)*k,a=i.x*r,s=i.y*r,n=Math.floor(a/k),o=Math.floor(s/k);return{tileID:new St(t4,0,t4,n,o),mercatorX:a,mercatorY:s}}_buildSkirts(e,t4,i,r,a,s){let n=e.length,o=n+(i+1),l=(i+1)*i,u=a?Us:0,h=+!a,c=s?Ns:k,d=+!s;for(let m=0;m<=i;m++)e.emplaceBack(m*r,u,h);for(let m=0;m<=i;m++)e.emplaceBack(m*r,c,d);for(let m=0;m<i;m++)t4.emplaceBack(l+m,o+m,o+m+1),t4.emplaceBack(l+m,o+m+1,l+m+1),t4.emplaceBack(0+m,n+m+1,n+m),t4.emplaceBack(0+m,0+m+1,n+m+1);let p=e.length,f=p+(i+1)*2;for(let m of[0,1])for(let g=0;g<=i;g++)for(let _ of[0,1])e.emplaceBack(m*k,g*r,_);for(let m=0;m<i*2;m+=2)t4.emplaceBack(p+m,p+m+1,p+m+3),t4.emplaceBack(p+m,p+m+3,p+m+2),t4.emplaceBack(f+m,f+m+3,f+m+1),t4.emplaceBack(f+m,f+m+2,f+m+3)}};const pg={covered:false,demLoaded:false,elevation:0};function op(e,t4,i,r){if(r<0||r>=1)return pg;let a=Math.floor(i),s=i-a;for(let n of e.zooms){let o=1<<n,l=s*o,u=r*o,h=Math.floor(l),c=Math.floor(u),d=`${a}/${n}/${h}/${c}`;if(!e.samplerPerTile.has(d))continue;let p=e.samplerPerTile.get(d);return p?{covered:true,demLoaded:true,elevation:p(Math.min((l-h)*k,cg),Math.min((u-c)*k,cg),k)*t4}:{covered:true,demLoaded:false,elevation:0}}return pg}function iv(e,t4){return e.covered&&t4<=e.elevation+1e-6}function rv(e,t4,i,r,a){for(let s=0;s<40&&r-i>a;s++){let n=(i+r)/2;t4(e,n)?r=n:i=n}return{lo:i,hi:r}}var bl=class av{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t4){this._helper.setMinZoom(t4)}setMaxZoom(t4){this._helper.setMaxZoom(t4)}setMinPitch(t4){this._helper.setMinPitch(t4)}setMaxPitch(t4){this._helper.setMaxPitch(t4)}setRenderWorldCopies(t4){this._helper.setRenderWorldCopies(t4)}setBearing(t4){this._helper.setBearing(t4)}setPitch(t4){this._helper.setPitch(t4)}setRoll(t4){this._helper.setRoll(t4)}setFov(t4){this._helper.setFov(t4)}setZoom(t4){this._helper.setZoom(t4)}setCenter(t4){this._helper.setCenter(t4)}setElevation(t4){this._helper.setElevation(t4)}setMinElevationForCurrentTile(t4){this._helper.setMinElevationForCurrentTile(t4)}setPadding(t4){this._helper.setPadding(t4)}interpolatePadding(t4,i,r){this._helper.interpolatePadding(t4,i,r)}isPaddingEqual(t4){return this._helper.isPaddingEqual(t4)}resize(t4,i,r=true){this._helper.resize(t4,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t4){this._helper.setMaxBounds(t4)}setConstrainOverride(t4){this._helper.setConstrainOverride(t4)}overrideNearFarZ(t4,i){this._helper.overrideNearFarZ(t4,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t4){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t4)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t4){}constructor(t4,i){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(r,a)=>{a=ne(+a,this.minZoom,this.maxZoom);let s={center:new H(r.lng,r.lat),zoom:a},n=this._helper._lngRange;!this._helper._renderWorldCopies&&n===null&&(n=[-179.9999999999,180-1e-10]);let o=this.tileSize*$t(s.zoom),l=0,u=o,h=0,c=o,d=0,p=0,{x:f,y:m}=this.size;if(this._helper._latRange){let w=this._helper._latRange;l=Qa(w[1])*o,u=Qa(w[0])*o,u-l<m&&(d=m/(u-l))}n&&(h=mi(Ja(n[0])*o,0,o),c=mi(Ja(n[1])*o,0,o),c<h&&(c+=o),c-h<f&&(p=f/(c-h)));let{x:g,y:_}=Ni(o,r),y,x,v=Math.max(p||0,d||0);if(v){let w=new C(p?(c+h)/2:g,d?(u+l)/2:_);return s.center=dn(o,w).wrap(),s.zoom+=It(v),s}if(this._helper._latRange){let w=m/2;_-w<l&&(x=l+w),_+w>u&&(x=u-w)}if(n){let w=(h+c)/2,b=g;this._helper._renderWorldCopies&&(b=mi(g,w-o/2,w+o/2));let T=f/2;b-T<h&&(y=h+T),b+T>c&&(y=c-T)}if(y!==void 0||x!==void 0){let w=new C(y??g,x??_);s.center=dn(o,w).wrap()}return s},this.applyConstrain=(r,a)=>this._helper.applyConstrain(r,a),this._helper=i??new np({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(r,a)=>this.defaultConstrain(r,a)},t4),this._coveringTilesDetailsProvider=new XM}clone(){let t4=new av;return t4.apply(this,false),t4}apply(t4,i){this._helper.apply(t4,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t4){let i=[new ml(0,t4)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new C(0,0)),a=this.screenPointToMercatorCoordinate(new C(this._helper._width,0)),s=this.screenPointToMercatorCoordinate(new C(this._helper._width,this._helper._height)),n=this.screenPointToMercatorCoordinate(new C(0,this._helper._height)),o=Math.floor(Math.min(r.x,a.x,s.x,n.x)),l=Math.floor(Math.max(r.x,a.x,s.x,n.x));for(let u=o-1;u<=l+1;u++)u!==0&&i.push(new ml(u,t4))}return i}getCameraFrustum(){return ep.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t4){let i=this.screenPointToLocation(this.centerPoint,t4),r=t4?t4.getElevationForLngLat(i,this):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(t4,i,r=this.elevation){let a=r-this.elevation,s=this.screenPointToMercatorCoordinateAtZ(i,a),n=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),o=Ie.fromLngLat(t4),l=new Ie(o.x-(s.x-n.x),o.y-(s.y-n.y));this.setCenter(l==null?void 0:l.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t4,i){return i?this.coordinatePoint(Ie.fromLngLat(t4),i.getElevationForLngLat(t4,this),this._pixelMatrix3D):this.coordinatePoint(Ie.fromLngLat(t4))}screenPointToLocation(t4,i){var r;return(r=this.screenPointToMercatorCoordinate(t4,i))==null?void 0:r.toLngLat()}screenPointToLocationAtElevation(t4,i){var r;return(r=this.screenPointToMercatorCoordinateAtZ(t4,i-this.elevation))==null?void 0:r.toLngLat()}screenPointToMercatorCoordinate(t4,i){if(i){let r=this.screenTerrainPointToMercatorCoordinate(t4,i);if(r!=null)return r}return this.screenPointToMercatorCoordinateAtZ(t4)}screenTerrainPointToMercatorCoordinate(t4,i){let r=i.getCoverageIndex();if(!r)return null;let{near:a,far:s}=this.getRaySegmentFromPixel(t4),n=this.worldSize,o=s[0]-a[0],l=s[1]-a[1],u=s[2]-a[2],h={index:r,exaggeration:i.exaggeration,near:a,dx:o,dy:l,dz:u,worldSize:n},c=0,d=1;if(u===0){if(a[2]>r.maxElevation||a[2]<r.minElevation)return null}else{let _=(r.maxElevation-a[2])/u,y=(r.minElevation-a[2])/u;if(c=Math.max(c,Math.min(_,y)),d=Math.min(d,Math.max(_,y)),c>d)return null}let p=Math.hypot(o,l),f=ne(Math.ceil(p*(d-c)/4),1,512),m=0,g=!xo(h,0);for(let _=0;_<=f;_++){let y=c+(d-c)*_/f;if(!g)g=!xo(h,y);else if(xo(h,y)){let{lo:x,hi:v}=rv(h,xo,m,y,.001/p),w=jo(h,x),b=jo(h,v),T=a[2]+x*u-w.elevation,P=a[2]+v*u-b.elevation,E=w.covered&&T>P?ne(x+T*(v-x)/(T-P),x,v):v;return new Ie((a[0]+E*o)/n,(a[1]+E*l)/n,jo(h,E).elevation)}m=y}return null}getRaySegmentFromPixel(t4){let i=[t4.x,t4.y,0,1],r=[t4.x,t4.y,1,1];Ct(i,i,this._pixelMatrixInverse),Ct(r,r,this._pixelMatrixInverse);let a=i[3],s=r[3],n=this.elevation;return{near:[i[0]/a,i[1]/a,i[2]/a+n],far:[r[0]/s,r[1]/s,r[2]/s+n]}}screenPointToMercatorCoordinateAtZ(t4,i){let r=i||0,{near:a,far:s}=this.getRaySegmentFromPixel(t4),n=a[2]===s[2]?0:(r+this.elevation-a[2])/(s[2]-a[2]);return new Ie(He.number(a[0],s[0],n)/this.worldSize,He.number(a[1],s[1],n)/this.worldSize,r)}coordinatePoint(t4,i=0,r=this._pixelMatrix){let a=this._coordinateClipPoint(t4,i,r),s=a[3];return s>0?new C(a[0]/s,a[1]/s):this._offScreenPointBehindCamera(a[0],a[1],s)}_coordinateClipPoint(t4,i,r){let a=[t4.x*this.worldSize,t4.y*this.worldSize,i,1];return Ct(a,a,r)}_offScreenPointBehindCamera(t4,i,r){let a=this.width/2,s=this.height/2,n=t4-a*r,o=i-s*r;n===0&&o===0&&(o=1);let l=a+this.width,u=s+this.height,h=Math.min(n===0?1/0:l/Math.abs(n),o===0?1/0:u/Math.abs(o));return new C(a+n*h,s+o*h)}getBounds(){let t4=Math.max(0,this._helper._height/2-Zs(this));return new Yi().extend(this.screenPointToLocation(new C(0,t4))).extend(this.screenPointToLocation(new C(this._helper._width,t4))).extend(this.screenPointToLocation(new C(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new C(0,this._helper._height)))}isPointOnMapSurface(t4,i){return i?this.screenTerrainPointToMercatorCoordinate(t4,i)!=null:t4.y>this.height/2-Zs(this)}calculatePosMatrix(t4,i=false,r=false){let a=t4.key??$a(t4.wrap,t4.canonical.z,t4.canonical.z,t4.canonical.x,t4.canonical.y),s=i?this._alignedPosMatrixCache:this._posMatrixCache;if(s.has(a)){let l=s.get(a);return r?l.f32:l.f64}let n=Gu(t4,this.worldSize);Da(n,i?this._alignedProjMatrix:this._viewProjMatrix,n);let o={f64:n,f32:new Float32Array(n)};return s.set(a,o),r?o.f32:o.f64}calculateFogMatrix(t4){let i=t4.key,r=this._fogMatrixCacheF32;if(r.has(i))return r.get(i);let a=Gu(t4,this.worldSize);return Da(a,this._fogMatrix,a),r.set(i,new Float32Array(a)),r.get(i)}calculateCenterFromCameraLngLatAlt(t4,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t4,i,r,a)}calculateCameraOptionsFromTo(t4,i,r,a){let s=Ie.fromLngLat(t4,i),n=Ie.fromLngLat(r,a),o=n.x-s.x,l=n.y-s.y,u=n.z-s.z,h=Math.hypot(o,l,u);if(h===0)throw Error("Can't calculate camera options with same From and To");let c=Math.hypot(o,l),d=It(this.cameraToCenterDistance/h/this.tileSize),p=Ui(Math.atan2(o,-l)),f=Ui(Math.acos(c/h));return f=u<0?90-f:90+f,{center:n.toLngLat(),elevation:a,zoom:d,pitch:f,bearing:p}}_calculateNearFarZ(t4,i,r){let a=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),s=t4-a*this._helper._pixelPerMeter/Math.cos(i),n=a<0?s:t4,o=Math.PI/2+this.pitchInRadians,l=Ze(this.fov)*(Math.abs(Math.cos(Ze(this.roll)))*this.height+Math.abs(Math.sin(Ze(this.roll)))*this.width)/this.height*(.5+r.y/this.height),u=Math.sin(l)*n/Math.sin(ne(Math.PI-o-l,.01,Math.PI-.01)),h=Zs(this),c=Math.atan(h/this._helper.cameraToCenterDistance),d=Ze(90-Yr),p=c>d?2*c*(.5+r.y/(h*2)):d,f=Math.sin(p)*n/Math.sin(ne(Math.PI-o-p,.01,Math.PI-.01)),m=Math.min(u,f);this._helper._farZ=(Math.cos(Math.PI/2-i)*m+n)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(t4=this._helper.autoCalculateNearFarZ){let i=this.centerOffset,r=Ni(this.worldSize,this.center),a=r.x,s=r.y,n=Ze(Math.min(this.pitch,Yr)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(n));t4&&this._calculateNearFarZ(o,n,i);let l;l=new Float64Array(16),vh(l,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),_M(this._invProjMatrix,l),l[8]=-i.x*2/this._helper._width,l[9]=i.y*2/this._helper._height,this._projectionMatrix=yh(l),Dt(l,l,[1,-1,1]),ot(l,l,[0,0,-this._helper.cameraToCenterDistance]),br(l,l,-this.rollInRadians),Na(l,l,this.pitchInRadians),br(l,l,-this.bearingInRadians),ot(l,l,[-a,-s,0]),this._mercatorMatrix=Dt([],l,[this.worldSize,this.worldSize,this.worldSize]),Dt(l,l,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=Da(new Float64Array(16),this.clipSpaceToPixelsMatrix,l),ot(l,l,[0,0,-this.elevation]),this._viewProjMatrix=l,this._invViewProjMatrix=No([],l);let u=[0,0,-1,1];Ct(u,u,this._invViewProjMatrix),this._cameraPosition=[u[0]/u[3],u[1]/u[3],u[2]/u[3]],this._fogMatrix=new Float64Array(16),vh(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=-i.x*2/this.width,this._fogMatrix[9]=i.y*2/this.height,Dt(this._fogMatrix,this._fogMatrix,[1,-1,1]),ot(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),br(this._fogMatrix,this._fogMatrix,-this.rollInRadians),Na(this._fogMatrix,this._fogMatrix,this.pitchInRadians),br(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),ot(this._fogMatrix,this._fogMatrix,[-a,-s,0]),Dt(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),ot(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=Da(new Float64Array(16),this.clipSpaceToPixelsMatrix,l);let h=this._helper._width%2/2,c=this._helper._height%2/2,d=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),f=a-Math.round(a)+d*h+p*c,m=s-Math.round(s)+d*c+p*h,g=new Float64Array(l);if(ot(g,g,[f>.5?f-1:f,m>.5?m-1:m,0]),this._alignedProjMatrix=g,l=No(new Float64Array(16),this._pixelMatrix),!l)throw Error("failed to invert matrix");this._pixelMatrixInverse=l,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t4=this.screenPointToMercatorCoordinate(new C(0,0)),i=[t4.x*this.worldSize,t4.y*this.worldSize,0,1];return Ct(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this.cameraToCenterDistance/this.pixelsPerMeter+this.elevation}getCameraLngLat(){let t4=Xr(1,this.center.lat)*this.worldSize,i=this._helper.cameraToCenterDistance/t4;return b0(this.center,this.elevation,this.pitch,this.bearing,i).toLngLat()}getProjectionData(t4){let{overscaledTileID:i,aligned:r,applyTerrainMatrix:a}=t4,s=this._helper.getMercatorTileCoordinates(i),n=i?this.calculatePosMatrix(i,r,true):null,o;return o=i!=null&&i.terrainRttPosMatrix32f&&a?i.terrainRttPosMatrix32f:n||e_(),{mainMatrix:o,tileMercatorCoords:s,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:o,clipAntimeridian:false}}isLocationOccluded(t4,i,r){if(!(i!=null&&i.getCoverageIndex()))return false;let a=Ie.fromLngLat(t4);r??(r=i.getElevationForLngLat(t4,this));let s=this._coordinateClipPoint(a,r,this._pixelMatrix3D),n=s[3];if(n<=0||s[2]>n)return true;let o=new C(s[0]/n,s[1]/n),l=this.screenTerrainPointToMercatorCoordinate(o,i);if(l==null)return false;let u=this.getRaySegmentFromPixel(o),h=fg(u,a.x*this.worldSize,a.y*this.worldSize,r);return fg(u,l.x*this.worldSize,l.y*this.worldSize,l.z)<h*.99}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t4,i,r){return 1}transformLightDirection(t4){return xh(t4)}getRayDirectionFromPixel(t4){throw Error("Not implemented.")}projectTileCoordinates(t4,i,r,a){let s=this.calculatePosMatrix(r),n;a==null?(n=[t4,i,0,1],sp(n,n,s)):(n=[t4,i,a,1],Ct(n,n,s));let o=n[3];return{point:new C(n[0]/o,n[1]/o),signedDistanceFromCamera:o,isOccluded:false}}populateCache(t4){for(let i of t4)this.calculatePosMatrix(i)}getProjectionDataForCustomLayer(t4=true){let i=new St(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:t4}),a=Gu(i,this.worldSize);Da(a,this._viewProjMatrix,a);let s=[k,k,this.worldSize/this._helper.pixelsPerMeter],n=jr();return Dt(n,a,s),{...r,tileMercatorCoords:[0,0,1,1],fallbackMatrix:n,mainMatrix:n}}getFastPathSimpleProjectionMatrix(t4){return this.calculatePosMatrix(t4)}};function jo(e,t4){return op(e.index,e.exaggeration,(e.near[0]+t4*e.dx)/e.worldSize,(e.near[1]+t4*e.dy)/e.worldSize)}function xo(e,t4){return iv(jo(e,t4),e.near[2]+t4*e.dz)}function fg({near:e,far:t4},i,r,a){let s=t4[0]-e[0],n=t4[1]-e[1],o=t4[2]-e[2];return((i-e[0])*s+(r-e[1])*n+(a-e[2])*o)/(s*s+n*n+o*o)}function sv(){ge("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function nv(e){if(e.useSlerp)if(e.k<1){let t4=Qp(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),i=Qp(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),r=new Float64Array(4);Ao(r,t4,i,e.k);let a=Ux(r);e.tr.setRoll(a.roll),e.tr.setPitch(a.pitch),e.tr.setBearing(a.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(He.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(He.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(He.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function ov(e,t4,i,r,a){let s=a.padding,n=Ni(a.worldSize,i.getNorthWest()),o=Ni(a.worldSize,i.getNorthEast()),l=Ni(a.worldSize,i.getSouthEast()),u=Ni(a.worldSize,i.getSouthWest()),h=Ze(-r),c=n.rotate(h),d=o.rotate(h),p=l.rotate(h),f=u.rotate(h),m=new C(Math.max(c.x,d.x,f.x,p.x),Math.max(c.y,d.y,f.y,p.y)),g=new C(Math.min(c.x,d.x,f.x,p.x),Math.min(c.y,d.y,f.y,p.y)),_=m.sub(g),y=a.width-(s.left+s.right+t4.left+t4.right),x=a.height-(s.top+s.bottom+t4.top+t4.bottom),v=y/_.x,w=x/_.y;if(w<0||v<0){sv();return}let b=Math.min(It(a.scale*Math.min(v,w)),e.maxZoom),T=C.convert(e.offset),P=(t4.left-t4.right)/2,E=(t4.top-t4.bottom)/2,I=new C(P,E).rotate(Ze(r)),R=T.add(I).mult(a.scale/$t(b));return{center:dn(a.worldSize,n.add(l).div(2).sub(R)),zoom:b,bearing:r}}var wl=class{get useGlobeControls(){return false}handlePanInertia(e,t4){let i=e.mag(),r=Math.abs(Zs(t4));return{easingOffset:e.mult(Math.min(r*.75/i,1)),easingCenter:t4.center}}handleMapControlsRollPitchBearingZoom(e,t4){e.bearingDelta&&t4.setBearing(t4.bearing+e.bearingDelta),e.pitchDelta&&t4.setPitch(t4.pitch+e.pitchDelta),e.rollDelta&&t4.setRoll(t4.roll+e.rollDelta),e.zoomDelta&&t4.setZoom(t4.zoom+e.zoomDelta)}handleMapControlsPan(e,t4,i){e.around.distSqr(t4.centerPoint)<.01||t4.setLocationAtPoint(i,e.around,e.aroundElevation)}cameraForBoxAndBearing(e,t4,i,r,a){return ov(e,t4,i,r,a)}handleJumpToCenterZoom(e,t4){let i=t4.zoom===void 0?e.zoom:+t4.zoom;e.zoom!==i&&e.setZoom(+t4.zoom),t4.center!==void 0&&e.setCenter(H.convert(t4.center))}handleEaseTo(e,t4){let i=e.zoom,r=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:t4.roll===void 0?e.roll:t4.roll,pitch:t4.pitch===void 0?e.pitch:t4.pitch,bearing:t4.bearing===void 0?e.bearing:t4.bearing},n=t4.zoom!==void 0,o=!e.isPaddingEqual(t4.padding),l=false,u=n?+t4.zoom:e.zoom,h=e.centerPoint.add(t4.offsetAsPoint),c=e.screenPointToLocation(h),{center:d,zoom:p}=e.applyConstrain(H.convert(t4.center||c),u??i);xl(e,d);let f=Ni(e.worldSize,c),m=Ni(e.worldSize,d).sub(f),g=$t(p-i);return l=p!==i,{easeFunc:_=>{if(l&&e.setZoom(He.number(i,p,_)),r_(a,s)||nv({startEulerAngles:a,endEulerAngles:s,tr:e,k:_,useSlerp:a.roll!=s.roll}),o&&(e.interpolatePadding(r,t4.padding,_),h=e.centerPoint.add(t4.offsetAsPoint)),t4.around)e.setLocationAtPoint(t4.around,t4.aroundPoint);else{let y=$t(e.zoom-i),x=(p>i?Math.min(2,g):Math.max(.5,g))**(1-_),v=dn(e.worldSize,f.add(m.mult(_*x)).mult(y));e.setLocationAtPoint(e.renderWorldCopies?v.wrap():v,h)}},isZooming:l,elevationCenter:d}}handleFlyTo(e,t4){let i=t4.zoom!==void 0,r=e.zoom,a=e.applyConstrain(H.convert(t4.center||t4.locationAtOffset),i?+t4.zoom:r),s=a.center,n=a.zoom;xl(e,s);let o=e.worldSize,l=Ni(o,t4.locationAtOffset),u=Ni(o,s).sub(l),h=u.mag(),c=$t(n-r),d=t4.minZoom===void 0?e.minZoom:+t4.minZoom,p=Math.max(d,e.minZoom),f=Math.min(p,r,n),m=e.applyConstrain(s,f).zoom;return{easeFunc:(g,_,y,x)=>{e.setZoom(g===1?n:r+It(_));let v=g===1?s:dn(o,l.add(u.mult(y)));e.setLocationAtPoint(e.renderWorldCopies?v.wrap():v,x)},scaleOfZoom:c,targetCenter:s,scaleOfMinZoom:$t(m-r),pixelPathLength:h}}};let QM;const e3=()=>QM||(QM=new wt({type:new j(F.projection.type,"type")})),rh=new Pd({fill:new nr(128,2),line:new nr(512,0),tile:new nr(128,32),stencil:new nr(128,1),circle:3});var lv=class{constructor(){this._tileMeshCache={}}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return true}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return Gi.projectionGlobe}get vertexShaderPreludeCode(){return Gi.projectionMercator.vertexSource}get subdivisionGranularity(){return rh}get useGlobeControls(){return true}destroy(){}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t4,i,r,a){let s=(a==="stencil"?rh.stencil:rh.tile).getGranularityForZoomLevel(t4.z),n=t4.y===0&&r,o=t4.y===(1<<t4.z)-1&&r;return this._getMesh(e,{granularity:s,generateBorders:i,extendToNorthPole:n,extendToSouthPole:o})}_getMesh(e,t4){let i=this._getMeshKey(t4);if(i in this._tileMeshCache)return this._tileMeshCache[i];let r=$1(e,t4);return this._tileMeshCache[i]=r,r}recalculate(e){}hasTransition(){return false}},mg=class extends pt{constructor(e,t4){super(),this._transitionable=new jl(e3(),"projection",t4),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Fe(0)),this._mercatorProjection=new Nc,this._verticalPerspectiveProjection=new lv}get transitionState(){let e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof Mr){if(e.from===e.to)return e.from==="mercator"?0:1;if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(e,t4,i,r,a){return this.currentProjection.getMeshFromTileID(e,t4,i,r,a)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}};function uv(e){let t4=es(e.worldSize,e.center.lat);return 2*Math.PI*t4}function t3(e,t4,i){let r=gt(t4),a=gt(i),s=lt(r,a),n=Math.acos(s),o=uv(e);return n/(2*Math.PI)*o}function i3(e,t4){return[Qr(e*Math.PI*2+Math.PI,Math.PI*2),2*Math.atan(Math.exp(Math.PI-t4*Math.PI*2))-Math.PI*.5]}function r3(e,t4){let i=Math.cos(t4),r=new Float64Array(3);return r[0]=Math.sin(e)*i,r[1]=Math.sin(t4),r[2]=Math.cos(e)*i,r}function yr(e,t4,i,r,a){let s=1/(1<<a),n=e/k*s+i*s,o=t4/k*s+r*s,l=Qr(n*Math.PI*2+Math.PI,Math.PI*2),u=2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-Math.PI*.5,h=Math.cos(u),c=new Float64Array(3);return c[0]=Math.sin(l)*h,c[1]=Math.sin(u),c[2]=Math.cos(l)*h,c}function gt(e){return r3(e.lng*Math.PI/180,e.lat*Math.PI/180)}function es(e,t4){return e/(2*Math.PI)/Math.cos(t4*Math.PI/180)}function hv(e){let t4=Ct(Vr(),[0,0,0,1],e.modelViewProjectionMatrix);return Ct(t4,t4,e.inverseProjectionMatrix),[t4[0]/t4[3],t4[1]/t4[3],t4[2]/t4[3]]}function qs(e){let t4=Math.asin(e[1])/Math.PI*180,i=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(i>1e-6){let r=e[0]/i,a=e[2]/i,s=Math.acos(a),n=(r>0?s:-s)/Math.PI*180;return new H(mi(n,-180,180),t4)}return new H(0,t4)}function a3(e,t4){return Yc(Vr(),-e.lng,-e.lat,t4)}function s3(e){let t4=e[0],i=e[1],r=e[2],a=e[3];return{lng:-Math.atan2(2*(a*t4+i*r),1-2*(t4*t4+i*i))*180/Math.PI,lat:-Math.asin(ne(2*(a*i-r*t4),-1,1))*180/Math.PI,bearing:Math.atan2(2*(a*r+t4*i),1-2*(i*i+r*r))*180/Math.PI}}const ah=Math.PI*.98;function gg(e,t4){let i=e.cameraPosition,r=Ci(i);if(r<=1)return e.screenPointToLocation(t4);let a=De();Bt(a,i);let s=e.getRayDirectionFromPixel(t4),n=-lt(s,a),o=De();Go(o,s,a,n);let l=Ci(o);if(l<1e-9)return e.screenPointToLocation(t4);let u=Math.atan2(l,n),h=Math.asin(1/r)*.9;if(u<h)return e.screenPointToLocation(t4);let c=r*Math.sin(h),d=Math.asin(ne(c,-1,1))-h,p=r*Math.cos(h)/Math.sqrt(Math.max(1-c*c,1e-12))-1,f=ah-d,m=u-h,g=d+p*m*f/(f+p*m),_=De();Ne(_,o,1/l);let y=De();return Ne(y,a,Math.cos(ne(g,0,ah))),Go(y,y,_,Math.sin(ne(g,0,ah))),Bt(y,y),qs(y)}function n3(e,t4,i,r,a=true){let s=gg(e,i),n=t4;if(r)n=gg(e,i.sub(r));else if(!e.isPointOnMapSurface(i))return;let o=gt(s),l=gt(n),u=a3(e.center,e.bearing),h=Ht(De(),l,o),c=Math.sqrt(lt(h,h)),d=Math.acos(ne(lt(l,o),-1,1))/2,p=Math.sin(d),f=c?qp(h[1]/c*p,-h[0]/c*p,h[2]/c*p,Math.cos(d)):qp(0,0,0,1),{lng:m,lat:g,bearing:_}=s3(wx(Vr(),u,f)),y=e.center.lat,x=e.zoom,v=ne(g,-90,90),w=a?o3(e,i,r,m):m;e.setCenter(new H(mi(w,-180,180),v)),a||e.setBearing(_),e.setZoom(x+vt(y,e.center.lat))}function o3(e,t4,i,r){let a=e.center.lng,s=e.center.lat,n=s>=0?90:-90,o=e.locationToScreenPoint(new H(0,n)),l=t4.x-o.x,u=t4.y-o.y,h=l*l+u*u,c=ne(1-(Wi-Math.abs(s))/12,0,1),d=c*c*(3-2*c),p=Qr(r-a+180,360)-180,f=0;if(d>0&&i){let m=(l*i.y-u*i.x)/Math.max(h,400);f=(n>0?1:-1)*m*180/Math.PI}return a+(1-d)*p+d*f}function l3(e){let t4=De();return t4[0]=e[0]*-e[3],t4[1]=e[1]*-e[3],t4[2]=e[2]*-e[3],{center:t4,radius:Math.sqrt(1-e[3]*e[3])}}function u3(e,t4,i){let r=De();cr(r,i,e);let a=De();return Go(a,e,r,t4/Zo(r)),a}function Tl(e){return Math.cos(e*Math.PI/180)}function vt(e,t4){let i=Tl(e),r=Tl(t4);return It(r/i)}function h3(e,t4){return 360/uv({worldSize:e,center:{lat:t4}})}function c3(e,t4){let i=e.rotate(t4.bearingInRadians),r=t4.zoom+vt(t4.center.lat,0),a=ka(1/Tl(t4.center.lat),1/Tl(Math.min(Math.abs(t4.center.lat),60)),Io(r,7,3,0,1)),s=h3(t4.worldSize,t4.center.lat);return new H(t4.center.lng-i.x*s*a,ne(t4.center.lat+i.y*s,-Wi,Wi))}function sh(e){let t4=.5*e,i=Math.sin(t4),r=Math.cos(t4);return Math.log(i+r)-Math.log(r-i)}function _g(e,t4,i,r){let a=e.lat+i*r;if(Math.abs(i)>1){let s=e.lat+i,n=(Math.sign(s)===Math.sign(e.lat)?Math.abs(e.lat):-Math.abs(e.lat))*Math.PI/180,o=Math.abs(e.lat+i)*Math.PI/180,l=sh(n+r*(o-n)),u=sh(n),h=sh(o),c=(l-u)/(h-u),d=e.lng+t4*c;return new H(d,a)}{let s=e.lng+t4*r;return new H(s,a)}}function bo(e,t4,i=1){let r=lt(e,t4),a=i*i,s=De(),n=De();Ne(n,t4,r),cr(s,e,n);let o=a-lt(s,s);if(o<0)return null;let l=lt(e,e)-a,u=-r+(r<0?1:-1)*Math.sqrt(o),h=l/u,c=u;return{tMin:Math.min(h,c),tMax:Math.max(h,c)}}function cv(e,t4){let i=t4*.01569612305760477,r=ne((e-i)/(9*i),0,1);return r*r*(3-2*r)}var d3=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=false,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=false}getTileBoundingVolume(e,t4,i,r){let a=`${e.z}_${e.x}_${e.y}_${r!=null&&r.terrain?"t":""}_${Math.round(i)}`,s=this._cache.get(a);if(s)return s;let n=this._cachePrevious.get(a);if(n)return this._cache.set(a,n),n;let o=this._boundingVolumeFactory(e,t4,i,r);return this._cache.set(a,o),this._hadAnyChanges=true,o}},nh=class Gc{constructor(t4,i,r,a){this.min=r,this.max=a,this.points=t4,this.planes=i}static fromAabb(t4,i){let r=[];for(let a=0;a<8;a++)r.push([(a>>0&1)==1?i[0]:t4[0],(a>>1&1)==1?i[1]:t4[1],(a>>2&1)==1?i[2]:t4[2]]);return new Gc(r,[[-1,0,0,i[0]],[1,0,0,-t4[0]],[0,-1,0,i[1]],[0,1,0,-t4[1]],[0,0,-1,i[2]],[0,0,1,-t4[2]]],t4,i)}static fromCenterSizeAngles(t4,i,r){let a=Yc([],r[0],r[1],r[2]),s=Au([],[i[0],0,0],a),n=Au([],[0,i[1],0],a),o=Au([],[0,0,i[2]],a),l=[...t4],u=[...t4];for(let c=0;c<8;c++)for(let d=0;d<3;d++){let p=t4[d]+s[d]*((c>>0&1)==1?1:-1)+n[d]*((c>>1&1)==1?1:-1)+o[d]*((c>>2&1)==1?1:-1);l[d]=Math.min(l[d],p),u[d]=Math.max(u[d],p)}let h=[];for(let c=0;c<8;c++){let d=[...t4];fi(d,d,Ne([],s,(c>>0&1)==1?1:-1)),fi(d,d,Ne([],n,(c>>1&1)==1?1:-1)),fi(d,d,Ne([],o,(c>>2&1)==1?1:-1)),h.push(d)}return new Gc(h,[[...s,-lt(s,h[0])],[...n,-lt(n,h[0])],[...o,-lt(o,h[0])],[-s[0],-s[1],-s[2],-lt(s,h[7])],[-n[0],-n[1],-n[2],-lt(n,h[7])],[-o[0],-o[1],-o[2],-lt(o,h[7])]],l,u)}intersectsFrustum(t4){let i=true,r=this.points.length,a=this.planes.length,s=t4.planes.length,n=t4.points.length;for(let o=0;o<s;o++){let l=t4.planes[o],u=0;for(let h=0;h<r;h++){let c=this.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0;u<r&&(i=false)}if(i)return 2;for(let o=0;o<a;o++){let l=this.planes[o],u=0;for(let h=0;h<n;h++){let c=t4.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(t4){let i=this.points.length,r=0;for(let a=0;a<i;a++){let s=this.points[a];t4[0]*s[0]+t4[1]*s[1]+t4[2]*s[2]+t4[3]>=0&&r++}return r===i?2:r===0?0:1}};function Uo(e,t4,i){let r=e-t4;return r<0?-r:Math.max(0,r-i)}function oh(e,t4,i,r,a){let s=e-i,n;return n=s<0?Math.min(-s,1+s-a):s>a?Math.min(Math.max(s-a,0),1-s):0,Math.max(n,Uo(t4,r,a))}var p3=class{constructor(){this._boundingVolumeCache=new d3(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t4,i,r){let a=1<<i.z,s=1/a,n=i.x/a,o=i.y/a,l=.5,u=2;return u=Math.min(u,oh(e,t4,n,o,s)),u=Math.min(u,oh(e,t4,n+l,-o-s,s)),u=Math.min(u,oh(e,t4,n+l,2-o-s,s)),u}getWrap(e,t4,i){let r=1<<t4.z,a=1/r,s=t4.x/r,n=Uo(e.x,s,a),o=Uo(e.x,s-1,a),l=Uo(e.x,s+1,a),u=Math.min(n,o,l);return u===l?1:u===o?-1:0}allowVariableZoom(e,t4){return tp(e,t4)>4}allowWorldCopies(){return false}getTileBoundingVolume(e,t4,i,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t4,i,r)}_computeTileBoundingVolume(e,t4,i,r){let a=Math.min(0,i),s=Math.max(0,i);if(r!=null&&r.terrain){let n=new St(e.z,t4,e.z,e.x,e.y),o=r.terrain.getMinMaxElevation(n);a=o.minElevation??a,s=Math.max(o.maxElevation??s,s)}if(a/=Lt,s/=Lt,a+=1,s+=1,e.z<=0)return nh.fromAabb([-s,-s,-s],[s,s,s]);if(e.z===1)return nh.fromAabb([e.x===0?-s:0,e.y===0?0:-s,-s],[e.x===0?0:s,e.y===0?s:0,s]);{let n=[yr(0,0,e.x,e.y,e.z),yr(k,0,e.x,e.y,e.z),yr(k,k,e.x,e.y,e.z),yr(0,k,e.x,e.y,e.z)],o=[];for(let P of n)o.push(Ne([],P,s));if(s!==a)for(let P of n)o.push(Ne([],P,a));e.y===0&&o.push([0,1,0]),e.y===(1<<e.z)-1&&o.push([0,-1,0]);let l=[1,1,1],u=[-1,-1,-1];for(let P of o)for(let E=0;E<3;E++)l[E]=Math.min(l[E],P[E]),u[E]=Math.max(u[E],P[E]);let h=yr(k/2,k/2,e.x,e.y,e.z),c=Ht([],[0,1,0],h);Bt(c,c);let d=Ht([],h,c);Bt(d,d);let p=Ht([],n[2],n[1]);Bt(p,p);let f=Ht([],n[0],n[3]);Bt(f,f),o.push(Ne([],h,s)),e.y>=(1<<e.z)/2&&o.push(Ne([],yr(k/2,0,e.x,e.y,e.z),s)),e.y<(1<<e.z)/2&&o.push(Ne([],yr(k/2,k,e.x,e.y,e.z),s));let m=yg(h,o),g=yg(d,o),_=[-h[0],-h[1],-h[2],m.max],y=[h[0],h[1],h[2],-m.min],x=[-d[0],-d[1],-d[2],g.max],v=[d[0],d[1],d[2],-g.min],w=[...p,0],b=[...f,0],T=[];return e.y===0?T.push(li(b,w,_),li(b,w,y)):T.push(li(x,w,_),li(x,w,y),li(x,b,_),li(x,b,y)),e.y===(1<<e.z)-1?T.push(li(b,w,_),li(b,w,y)):T.push(li(v,w,_),li(v,w,y),li(v,b,_),li(v,b,y)),new nh(T,[_,y,x,v,w,b],l,u)}}};function yg(e,t4){let i=1/0,r=-1/0;for(let a of t4){let s=lt(e,a);i=Math.min(i,s),r=Math.max(r,s)}return{min:i,max:r}}const vg=1e-12;var dv=class pv{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t4){this._helper.setMinZoom(t4)}setMaxZoom(t4){this._helper.setMaxZoom(t4)}setMinPitch(t4){this._helper.setMinPitch(t4)}setMaxPitch(t4){this._helper.setMaxPitch(t4)}setRenderWorldCopies(t4){this._helper.setRenderWorldCopies(t4)}setBearing(t4){this._helper.setBearing(t4)}setPitch(t4){this._helper.setPitch(t4)}setRoll(t4){this._helper.setRoll(t4)}setFov(t4){this._helper.setFov(t4)}setZoom(t4){this._helper.setZoom(t4)}setCenter(t4){this._helper.setCenter(t4)}setElevation(t4){this._helper.setElevation(t4)}setMinElevationForCurrentTile(t4){this._helper.setMinElevationForCurrentTile(t4)}setPadding(t4){this._helper.setPadding(t4)}interpolatePadding(t4,i,r){this._helper.interpolatePadding(t4,i,r)}isPaddingEqual(t4){return this._helper.isPaddingEqual(t4)}resize(t4,i){this._helper.resize(t4,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t4){this._helper.setMaxBounds(t4)}setConstrainOverride(t4){this._helper.setConstrainOverride(t4)}overrideNearFarZ(t4,i){this._helper.overrideNearFarZ(t4,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t4){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t4)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t4){}constructor(t4,i){this._cachedClippingPlane=Vr(),this._projectionMatrix=Xn(),this._globeViewProjMatrix32f=e_(),this._globeViewProjMatrixF64=Xn(),this._globeViewProjMatrixF64Inverted=Xn(),this._globeProjMatrixInverted=Xn(),this._cameraPosition=De(),this.defaultConstrain=(r,a)=>{let s=ne(r.lat,-Wi,Wi),n=ne(+a,this.minZoom+vt(0,s),this.maxZoom);return{center:new H(r.lng,s),zoom:n}},this.applyConstrain=(r,a)=>this._helper.applyConstrain(r,a),this._helper=i??new np({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(r,a)=>this.defaultConstrain(r,a)},t4),this._coveringTilesDetailsProvider=new p3}clone(){let t4=new pv;return t4.apply(this,false),t4}apply(t4,i){this._helper.apply(t4,i)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t4=De();return t4[0]=this._cameraPosition[0],t4[1]=this._cameraPosition[1],t4[2]=this._cameraPosition[2],t4}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t4){let{overscaledTileID:i,applyGlobeMatrix:r}=t4,a=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:a,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!r,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:(i==null?void 0:i.canonical.z)===0}}_computeClippingPlane(t4){let i=this.pitchInRadians,r=this.cameraToCenterDistance/t4,a=Math.sin(i)*r,s=Math.cos(i)*r+1,n=1/Math.sqrt(a*a+s*s)*1,o=-a,l=s,u=Math.sqrt(o*o+l*l);o/=u,l/=u;let h=[0,o,l];Iu(h,h,[0,0,0],-this.bearingInRadians),gs(h,h,[0,0,0],-1*this.center.lat*Math.PI/180),va(h,h,[0,0,0],this.center.lng*Math.PI/180);let c=1/Ci(h);return Ne(h,h,c),[...h,-n*c]}isLocationOccluded(t4,i,r){let a=i==null?void 0:i.getCoverageIndex();r??(r=a?i.getElevationForLngLat(t4,this):0);let s=bg(t4,r);if(!this.isSurfacePointVisible(s))return true;if(!a)return false;let n=this._projectSurfacePointToScreen(s),o=this.cameraPosition,l=this.getRayDirectionFromPixel(n),u=wg(o,l,s);if(u<=0)return true;let h=this.screenTerrainPointToMercatorCoordinate(n,i);return h!=null&&wg(o,l,bg(h.toLngLat(),h.z))<u*.99}transformLightDirection(t4){let i=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,a=Math.cos(r),s=[Math.sin(i)*a,Math.sin(r),Math.cos(i)*a],n=[s[2],0,-s[0]],o=[0,0,0];Ht(o,n,s),Bt(n,n),Bt(o,o);let l=[n[0]*t4[0]+o[0]*t4[1]+s[0]*t4[2],n[1]*t4[0]+o[1]*t4[1]+s[1]*t4[2],n[2]*t4[0]+o[2]*t4[1]+s[2]*t4[2]],u=[0,0,0];return Bt(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t4,i,r){let a=x0(t4,i,r.canonical),s=i3(a.x,a.y);return this.getCircleRadiusCorrection()/Math.cos(s[1])}projectTileCoordinates(t4,i,r,a){let s=r.canonical,n=yr(t4,i,s.x,s.y,s.z),o=1+(a??0)/Lt,l=n[0]*o,u=n[1]*o,h=n[2]*o,c=[l,u,h,1];Ct(c,c,this._globeViewProjMatrixF64);let d;if(o<=1){let p=this._cachedClippingPlane;d=p[0]*n[0]+p[1]*n[1]+p[2]*n[2]+p[3]<0}else d=this._isLineOfSightBlocked(l,u,h);return{point:new C(c[0]/c[3],c[1]/c[3]),signedDistanceFromCamera:c[3],isOccluded:d}}_isLineOfSightBlocked(t4,i,r){let a=this._cameraPosition,s=t4-a[0],n=i-a[1],o=r-a[2],l=s*s+n*n+o*o;if(l===0)return false;let u=ne(-(a[0]*s+a[1]*n+a[2]*o)/l,0,1),h=a[0]+u*s,c=a[1]+u*n,d=a[2]+u*o;return h*h+c*c+d*d<1}_calcMatrices(t4=this._helper.autoCalculateNearFarZ){let i=es(this.worldSize,this.center.lat),r=jr();t4&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+i*2),vh(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let a=this.centerOffset;r[8]=-a.x*2/this._helper._width,r[9]=a.y*2/this._helper._height,this._projectionMatrix=yh(r),this._globeProjMatrixInverted=jr(),No(this._globeProjMatrixInverted,r),ot(r,r,[0,0,-this.cameraToCenterDistance]),br(r,r,this.rollInRadians),Na(r,r,-this.pitchInRadians),br(r,r,this.bearingInRadians),ot(r,r,[0,0,-i]);let s=De();s[0]=i,s[1]=i,s[2]=i,Na(r,r,this.center.lat*Math.PI/180),Jg(r,r,-this.center.lng*Math.PI/180),Dt(r,r,s),this._globeViewProjMatrixF64=r,this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixF64Inverted=jr(),No(this._globeViewProjMatrixF64Inverted,r);let n=De();this._cameraPosition=De(),this._cameraPosition[2]=this.cameraToCenterDistance/i,Iu(this._cameraPosition,this._cameraPosition,n,-this.rollInRadians),gs(this._cameraPosition,this._cameraPosition,n,this.pitchInRadians),Iu(this._cameraPosition,this._cameraPosition,n,-this.bearingInRadians),fi(this._cameraPosition,this._cameraPosition,[0,0,1]),gs(this._cameraPosition,this._cameraPosition,n,-this.center.lat*Math.PI/180),va(this._cameraPosition,this._cameraPosition,n,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(i);let o=yh(this._globeViewProjMatrixF64Inverted);Dt(o,o,[1,1,-1]),this._cachedFrustum=ep.fromInvProjectionMatrix(o,1,0,this._cachedClippingPlane,true)}calculateFogMatrix(t4){ge("calculateFogMatrix is not supported on globe projection.");let i=jr();return Ii(i),i}getVisibleUnwrappedCoordinates(t4){return[new ml(0,t4)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t4){if(t4){ge("terrain is not fully supported on vertical perspective projection.");return}this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return(Ci(this._cameraPosition)-1)*Lt}getCameraLngLat(){let t4=De();return Bt(t4,this._cameraPosition),qs(t4)}populateCache(t4){}getBounds(){let t4=this.width*.5,i=this.height*.5,r=[new C(0,0),new C(t4,0),new C(this.width,0),new C(this.width,i),new C(this.width,this.height),new C(t4,this.height),new C(0,this.height),new C(0,i)],a=[];for(let c of r)a.push(this.unprojectScreenPoint(c));let s=0,n=0,o=0,l=0,u=this.center;for(let c of a){let d=ei(u.lng,c.lng),p=ei(u.lat,c.lat);d<n&&(n=d),d>s&&(s=d),p<l&&(l=p),p>o&&(o=p)}let h=[u.lng+n,u.lat+l,u.lng+s,u.lat+o];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new Yi(h)}calculateCenterFromCameraLngLatAlt(t4,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t4,i,r,a)}calculateCameraOptionsFromTo(t4,i,r,a){let s=H.convert(r),n=gt(H.convert(t4));Ne(n,n,1+i/Lt);let o=gt(s),l=Ne(De(),o,1+a/Lt),u=Xc(De(),n,o),h=Ci(u);if(h<vg||hx(n,l)<vg)throw Error("Can't calculate camera options with same From and To");let c=De();va(u,u,c,-Ze(s.lng)),gs(u,u,c,Ze(s.lat));let d=Ui(Math.acos(ne(u[2]/h,-1,1))),p=Math.hypot(u[0],u[1])<h*1e-9?this.bearing:Ui(Math.atan2(-u[0],-u[1]));return{center:s,elevation:a,zoom:It(this.cameraToCenterDistance/h/es(this.tileSize,s.lat)),pitch:d,bearing:p}}setLocationAtPoint(t4,i,r){let a=gt(this.unprojectScreenPoint(i)),s=gt(t4),n=De();fx(n);let o=De();va(o,a,n,-this.center.lng*Math.PI/180),gs(o,o,n,this.center.lat*Math.PI/180);let l=s[0]*s[0]+s[2]*s[2],u=o[0]*o[0];if(l<u)return;let h=Math.sqrt(l-u),c=-h,d=Yn(s[0],s[2],o[0],h),p=Yn(s[0],s[2],o[0],c),f=De();va(f,s,n,-d);let m=Yn(f[1],f[2],o[1],o[2]),g=De();va(g,s,n,-p);let _=Yn(g[1],g[2],o[1],o[2]),y=Math.PI*.5,x=m>=-y&&m<=y,v=_>=-y&&_<=y,w,b;if(x&&v){let I=this.center.lng*Math.PI/180,R=this.center.lat*Math.PI/180,z=Kn(d,I),S=Kn(m,R),A=Kn(p,I),D=Kn(_,R);z+S<A+D?(w=d,b=m):(w=p,b=_)}else if(x)w=d,b=m;else if(v)w=p,b=_;else return;let T=w/Math.PI*180,P=b/Math.PI*180,E=this.center.lat;this.setCenter(new H(T,ne(P,-90,90))),this.setZoom(this.zoom+vt(E,this.center.lat))}locationToScreenPoint(t4,i){let r=gt(t4);if(i){let a=i.getElevationForLngLatZoom(t4,this._helper._tileZoom);Ne(r,r,1+a/Lt)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(t4){let i=Vr();return Ct(i,[...t4,1],this._globeViewProjMatrixF64),i[0]/=i[3],i[1]/=i[3],new C((i[0]*.5+.5)*this.width,(-i[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(t4,i){if(i){let r=this.screenTerrainPointToMercatorCoordinate(t4,i);if(r)return r}return Ie.fromLngLat(this.unprojectScreenPoint(t4))}screenTerrainPointToMercatorCoordinate(t4,i){let r=i.getCoverageIndex();if(!r)return null;let a=this.cameraPosition,s=this.getRayDirectionFromPixel(t4),n=bo(a,s,1+r.maxElevation/Lt);if(!n)return null;let o=bo(a,s,1+r.minElevation/Lt),l=Math.max(n.tMin,0),u=o?o.tMin:n.tMax;if(u<=l)return null;let h={index:r,exaggeration:i.exaggeration,origin:a,direction:s},c=0;for(let d=0;d<=256;d++){let p=l+(u-l)*d/256;if(xg(h,p)){let{hi:f}=rv(h,xg,c,p,1e-12),{sample:m,mercator:g}=fv(h,f);return new Ie(g.x,g.y,m.elevation)}c=p}return null}screenPointToLocation(t4,i){var r;return(r=this.screenPointToMercatorCoordinate(t4,i))==null?void 0:r.toLngLat()}screenPointToLocationAtElevation(t4,i){return this.screenPointToLocation(t4)}isPointOnMapSurface(t4,i){let r=this._cameraPosition;return!!bo(r,this.getRayDirectionFromPixel(t4))}getRayDirectionFromPixel(t4){let i=Vr();i[0]=t4.x/this.width*2-1,i[1]=(t4.y/this.height*2-1)*-1,i[2]=1,i[3]=1,Ct(i,i,this._globeViewProjMatrixF64Inverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=De();r[0]=i[0]-this._cameraPosition[0],r[1]=i[1]-this._cameraPosition[1],r[2]=i[2]-this._cameraPosition[2];let a=De();return Bt(a,r),a}isSurfacePointVisible(t4){let i=this._cachedClippingPlane;return i[0]*t4[0]+i[1]*t4[1]+i[2]*t4[2]+i[3]>=0}isSurfacePointOnScreen(t4){if(!this.isSurfacePointVisible(t4))return false;let i=Vr();return Ct(i,[...t4,1],this._globeViewProjMatrixF64),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}unprojectScreenPoint(t4){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(t4),a=bo(i,r);if(a){let h=De();fi(h,i,[r[0]*a.tMin,r[1]*a.tMin,r[2]*a.tMin]);let c=De();return Bt(c,h),qs(c)}let s=this._cachedClippingPlane,n=s[0]*r[0]+s[1]*r[1]+s[2]*r[2],o=-wh(s,i)/n,l=De();if(o>0)fi(l,i,[r[0]*o,r[1]*o,r[2]*o]);else{let h=De();fi(h,i,[r[0]*2,r[1]*2,r[2]*2]);let c=wh(this._cachedClippingPlane,h);cr(l,h,[this._cachedClippingPlane[0]*c,this._cachedClippingPlane[1]*c,this._cachedClippingPlane[2]*c])}let u=l3(s);return qs(u3(u.center,u.radius,l))}getProjectionDataForCustomLayer(t4=true){let i=this.getProjectionData({overscaledTileID:new St(0,0,0,0,0),applyGlobeMatrix:t4});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(t4){}};function fv(e,t4){let i=De();Go(i,e.origin,e.direction,t4);let r=Ci(i),a=De();Ne(a,i,1/r);let s=qs(a),n=Ie.fromLngLat(s),o=new Ie(n.x,ne(n.y,0,.999999999)),l=op(e.index,e.exaggeration,o.x,o.y),u=Math.abs(s.lat)>85.051129?0:l.elevation;return{sample:{...l,elevation:u},radius:r,mercator:o}}function xg(e,t4){let{sample:i,radius:r}=fv(e,t4);return iv(i,(r-1)*Lt)}function bg(e,t4){let i=gt(e);return Ne(i,i,1+t4/Lt)}function wg(e,t4,i){let r=Xc(De(),i,e);return lt(r,t4)}var Tg=class mv{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t4){this._helper.setMinZoom(t4)}setMaxZoom(t4){this._helper.setMaxZoom(t4)}setMinPitch(t4){this._helper.setMinPitch(t4)}setMaxPitch(t4){this._helper.setMaxPitch(t4)}setRenderWorldCopies(t4){this._helper.setRenderWorldCopies(t4)}setBearing(t4){this._helper.setBearing(t4)}setPitch(t4){this._helper.setPitch(t4)}setRoll(t4){this._helper.setRoll(t4)}setFov(t4){this._helper.setFov(t4)}setZoom(t4){this._helper.setZoom(t4)}setCenter(t4){this._helper.setCenter(t4)}setElevation(t4){this._helper.setElevation(t4)}setMinElevationForCurrentTile(t4){this._helper.setMinElevationForCurrentTile(t4)}setPadding(t4){this._helper.setPadding(t4)}interpolatePadding(t4,i,r){this._helper.interpolatePadding(t4,i,r)}isPaddingEqual(t4){return this._helper.isPaddingEqual(t4)}resize(t4,i,r=true){this._helper.resize(t4,i,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t4){this._helper.setMaxBounds(t4)}setConstrainOverride(t4){this._helper.setConstrainOverride(t4)}overrideNearFarZ(t4,i){this._helper.overrideNearFarZ(t4,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t4){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t4)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t4){this._globeness=t4,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t4){this._globeness=1,this.defaultConstrain=(i,r)=>this.currentTransform.defaultConstrain(i,r),this.applyConstrain=(i,r)=>this._helper.applyConstrain(i,r),this._helper=new np({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(i,r)=>this.defaultConstrain(i,r)},t4),this._globeness=1,this._mercatorTransform=new bl(void 0,this._helper),this._verticalPerspectiveTransform=new dv(void 0,this._helper)}clone(){let t4=new mv;return t4._globeness=this._globeness,t4.apply(this,false),t4}apply(t4,i){this._helper.apply(t4,i)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t4){let i=this._mercatorTransform.getProjectionData(t4),r=this._verticalPerspectiveTransform.getProjectionData(t4);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:i.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t4.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix,clipAntimeridian:r.clipAntimeridian}}isLocationOccluded(t4,i,r){return this.currentTransform.isLocationOccluded(t4,i,r)}transformLightDirection(t4){return this.currentTransform.transformLightDirection(t4)}getPixelScale(){return ka(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return ka(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t4,i,r){let a=this._mercatorTransform.getPitchedTextCorrection(t4,i,r),s=this._verticalPerspectiveTransform.getPitchedTextCorrection(t4,i,r);return ka(a,s,this._globeness)}projectTileCoordinates(t4,i,r,a){return this.currentTransform.projectTileCoordinates(t4,i,r,a)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform._calcMatrices(),this._mercatorTransform._calcMatrices(this.autoCalculateNearFarZ&&!this.isGlobeRendering))}calculateFogMatrix(t4){return this.currentTransform.calculateFogMatrix(t4)}getVisibleUnwrappedCoordinates(t4){return this.currentTransform.getVisibleUnwrappedCoordinates(t4)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t4){this.currentTransform.recalculateZoomAndCenter(t4)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}populateCache(t4){this._mercatorTransform.populateCache(t4),this._verticalPerspectiveTransform.populateCache(t4)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t4,i,r,a){return this._helper.calculateCenterFromCameraLngLatAlt(t4,i,r,a)}calculateCameraOptionsFromTo(t4,i,r,a){return this.currentTransform.calculateCameraOptionsFromTo(t4,i,r,a)}setLocationAtPoint(t4,i,r){this.currentTransform.setLocationAtPoint(t4,i,r)}locationToScreenPoint(t4,i){return this.currentTransform.locationToScreenPoint(t4,i)}screenPointToMercatorCoordinate(t4,i){return this.currentTransform.screenPointToMercatorCoordinate(t4,i)}screenTerrainPointToMercatorCoordinate(t4,i){return this.currentTransform.screenTerrainPointToMercatorCoordinate(t4,i)}screenPointToLocation(t4,i){return this.currentTransform.screenPointToLocation(t4,i)}screenPointToLocationAtElevation(t4,i){return this.currentTransform.screenPointToLocationAtElevation(t4,i)}isPointOnMapSurface(t4,i){return this.currentTransform.isPointOnMapSurface(t4,i)}getRayDirectionFromPixel(t4){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t4)}getProjectionDataForCustomLayer(t4=true){let i=this._mercatorTransform.getProjectionDataForCustomLayer(t4);if(!this.isGlobeRendering)return i;let r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t4);return r.fallbackMatrix=i.mainMatrix,r.projectionTransition=this._globeness,r}getFastPathSimpleProjectionMatrix(t4){return this.currentTransform.getFastPathSimpleProjectionMatrix(t4)}},gv=class rr{get useGlobeControls(){return true}handlePanInertia(t4,i){let r=c3(t4,i);return Math.abs(r.lng-i.center.lng)>180&&(r.lng=i.center.lng+179.5*Math.sign(r.lng-i.center.lng)),{easingCenter:r,easingOffset:new C(0,0)}}handleMapControlsRollPitchBearingZoom(t4,i){let r=t4.around,a=i.screenPointToLocation(r);t4.bearingDelta&&i.setBearing(i.bearing+t4.bearingDelta),t4.pitchDelta&&i.setPitch(i.pitch+t4.pitchDelta),t4.rollDelta&&i.setRoll(i.roll+t4.rollDelta);let s=i.zoom;t4.zoomDelta&&i.setZoom(i.zoom+t4.zoomDelta);let n=i.zoom-s;if(n===0)return;let o=ei(i.center.lng,a.lng),l=o/(Math.abs(o/180)+1),u=ei(i.center.lat,a.lat),h=i.getRayDirectionFromPixel(r),c=i.cameraPosition,d=lt(c,h)*-1,p=De();fi(p,c,[h[0]*d,h[1]*d,h[2]*d]);let f=Ci(p),m=f-1,g=Math.exp(-Math.max(m-.3,0)*.5),_=Io(f,.95,.999,0,1),y=es(i.worldSize,i.center.lat)/Math.min(i.width,i.height),x=Io(y,.9,.5,1,.25),v=Math.min(g,ka(1,x,_)),w=(1-$t(-n))*v,b=i.center.lat,T=i.zoom,P=new H(i.center.lng+l*w,ne(i.center.lat+u*w,-Wi,Wi));i.setLocationAtPoint(a,r);let E=i.center,I=Io(Math.abs(o),45,85,0,1),R=Math.max(I,_)**.25,z=ei(E.lng,P.lng),S=ei(E.lat,P.lat);i.setCenter(new H(E.lng+z*R,E.lat+S*R).wrap()),i.setZoom(T+vt(b,i.center.lat))}handleMapControlsPan(t4,i,r){t4.panDelta&&n3(i,r,i.isPointOnMapSurface(t4.around)?t4.around:i.centerPoint,t4.panDelta)}cameraForBoxAndBearing(t4,i,r,a,s){let n=ov(t4,i,r,a,s),o=i.left/s.width*2-1,l=(s.width-i.right)/s.width*2-1,u=i.top/s.height*-2+1,h=(s.height-i.bottom)/s.height*-2+1,c=ei(r.getWest(),r.getEast())<0,d=c?r.getEast():r.getWest(),p=c?r.getWest():r.getEast(),f=Math.max(r.getNorth(),r.getSouth()),m=Math.min(r.getNorth(),r.getSouth()),g=d+ei(d,p)*.5,_=f+ei(f,m)*.5,y=s.clone();y.setCenter(n.center),y.setBearing(n.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(n.zoom);let x=y.modelViewProjectionMatrix,v=[gt(r.getNorthWest()),gt(r.getNorthEast()),gt(r.getSouthWest()),gt(r.getSouthEast()),gt(new H(p,_)),gt(new H(d,_)),gt(new H(g,f)),gt(new H(g,m))],w=gt(n.center),b=1/0;for(let T of v)o<0&&(b=rr.getLesserNonNegativeNonNull(b,rr.solveVectorScale(T,w,x,"x",o))),l>0&&(b=rr.getLesserNonNegativeNonNull(b,rr.solveVectorScale(T,w,x,"x",l))),u>0&&(b=rr.getLesserNonNegativeNonNull(b,rr.solveVectorScale(T,w,x,"y",u))),h<0&&(b=rr.getLesserNonNegativeNonNull(b,rr.solveVectorScale(T,w,x,"y",h)));if(!Number.isFinite(b)||b===0){sv();return}return n.zoom=Math.min(y.zoom+It(b),t4.maxZoom),n}handleJumpToCenterZoom(t4,i){let r=t4.center.lat,a=t4.applyConstrain(i.center?H.convert(i.center):t4.center,t4.zoom).center;t4.setCenter(a.wrap());let s=i.zoom===void 0?t4.zoom+vt(r,a.lat):+i.zoom;t4.zoom!==s&&t4.setZoom(s)}handleEaseTo(t4,i){let r=t4.zoom,a=t4.center,s=t4.padding,n={roll:t4.roll,pitch:t4.pitch,bearing:t4.bearing},o={roll:i.roll===void 0?t4.roll:i.roll,pitch:i.pitch===void 0?t4.pitch:i.pitch,bearing:i.bearing===void 0?t4.bearing:i.bearing},l=i.zoom!==void 0,u=!t4.isPaddingEqual(i.padding),h=false,c=i.center?H.convert(i.center):a,d=t4.applyConstrain(c,r).center;xl(t4,d);let p=t4.clone();p.setCenter(d),p.setZoom(l?+i.zoom:r+vt(a.lat,c.lat)),p.setBearing(i.bearing);let f=new C(ne(t4.centerPoint.x+i.offsetAsPoint.x,0,t4.width),ne(t4.centerPoint.y+i.offsetAsPoint.y,0,t4.height));p.setLocationAtPoint(d,f);let m=(i.offset&&i.offsetAsPoint.mag())>0?p.center:d,g=l?+i.zoom:r+vt(a.lat,m.lat),_=r+vt(a.lat,0),y=g+vt(m.lat,0),x=ei(a.lng,m.lng),v=ei(a.lat,m.lat),w=$t(y-_);return h=g!==r,{easeFunc:b=>{if(r_(n,o)||nv({startEulerAngles:n,endEulerAngles:o,tr:t4,k:b,useSlerp:n.roll!=o.roll}),u&&t4.interpolatePadding(s,i.padding,b),i.around)ge("Easing around a point is not supported under globe projection."),t4.setLocationAtPoint(i.around,i.aroundPoint);else{let T=b*(y>_?Math.min(2,w):Math.max(.5,w))**(1-b),P=_g(a,x,v,T);t4.setCenter(P.wrap())}if(h){let T=He.number(_,y,b)+vt(0,t4.center.lat);t4.setZoom(T)}},isZooming:h,elevationCenter:m}}handleFlyTo(t4,i){let r=i.zoom!==void 0,a=t4.center,s=t4.zoom,n=t4.padding,o=!t4.isPaddingEqual(i.padding),l=t4.applyConstrain(H.convert(i.center||i.locationAtOffset),s).center,u=r?+i.zoom:t4.zoom+vt(t4.center.lat,l.lat),h=t4.clone();h.setCenter(l),h.setZoom(u),h.setBearing(i.bearing);let c=new C(ne(t4.centerPoint.x+i.offsetAsPoint.x,0,t4.width),ne(t4.centerPoint.y+i.offsetAsPoint.y,0,t4.height));h.setLocationAtPoint(l,c);let d=h.center;xl(t4,d);let p=t3(t4,a,d),f=s+vt(a.lat,0),m=u+vt(d.lat,0),g=$t(m-f),_=typeof i.minZoom=="number"?+i.minZoom:t4.minZoom,y=Math.max(_,t4.minZoom)+vt(d.lat,0),x=Math.min(y,f,m)+vt(0,d.lat),v=t4.applyConstrain(d,x).zoom+vt(d.lat,0),w=$t(v-f),b=ei(a.lng,d.lng),T=ei(a.lat,d.lat);return{easeFunc:(P,E,I,R)=>{let z=_g(a,b,T,I);o&&t4.interpolatePadding(n,i.padding,P);let S=P===1?d:z;t4.setCenter(S.wrap());let A=f+It(E);t4.setZoom(P===1?u:A+vt(0,S.lat))},scaleOfZoom:g,targetCenter:d,scaleOfMinZoom:w,pixelPathLength:p}}static solveVectorScale(t4,i,r,a,s){let n=s,o=a==="x"?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],l=[r[3],r[7],r[11],r[15]],u=t4[0]*o[0]+t4[1]*o[1]+t4[2]*o[2],h=t4[0]*l[0]+t4[1]*l[1]+t4[2]*l[2],c=i[0]*o[0]+i[1]*o[1]+i[2]*o[2],d=i[0]*l[0]+i[1]*l[1]+i[2]*l[2],p=(c+o[3]-n*d-n*l[3])/(c-u-n*d+n*h);return c+n*h===u+n*d||l[3]*(u-c)+o[3]*(d-h)+u*d===c*h?null:p}static getLesserNonNegativeNonNull(t4,i){return i!==null&&i>=0&&i<t4?i:t4}},Eg=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new wl,this._verticalPerspectiveCameraHelper=new gv}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t4){return this.currentHelper.handlePanInertia(e,t4)}handleMapControlsRollPitchBearingZoom(e,t4){this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t4)}handleMapControlsPan(e,t4,i){this.currentHelper.handleMapControlsPan(e,t4,i)}cameraForBoxAndBearing(e,t4,i,r,a){return this.currentHelper.cameraForBoxAndBearing(e,t4,i,r,a)}handleJumpToCenterZoom(e,t4){this.currentHelper.handleJumpToCenterZoom(e,t4)}handleEaseTo(e,t4){return this.currentHelper.handleEaseTo(e,t4)}handleFlyTo(e,t4){return this.currentHelper.handleFlyTo(e,t4)}};function f3(e,t4,i){let r={constrainOverride:t4};if(Array.isArray(e)){let a=new mg({type:e},i);return{projection:a,transform:new Tg(r),cameraHelper:new Eg(a)}}switch(e){case"mercator":return{projection:new Nc,transform:new bl(r),cameraHelper:new wl};case"globe":{let a=new mg({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:a,transform:new Tg(r),cameraHelper:new Eg(a)}}case"vertical-perspective":return{projection:new lv,transform:new dv(r),cameraHelper:new gv};default:return ge(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new Nc,transform:new bl(r),cameraHelper:new wl}}}const m3=qA();var Sg=class extends pt{constructor(e,t4={}){var r,a;super(),this._rtlPluginLoaded=()=>{for(let s in this.tileManagers){let n=this.tileManagers[s].getSource().type;(n==="vector"||n==="geojson")&&this.tileManagers[s].reload()}},this.map=e,this.dispatcher=new M1(Jd(),e._getMapId()).setEventedParent(this),this.dispatcher.registerMessageHandler("GG",(s,n)=>this.getGlyphs(s,n)),this.dispatcher.registerMessageHandler("GI",(s,n)=>this.getImages(s,n)),this.dispatcher.registerMessageHandler("GDA",(s,n)=>this.getDashes(s,n)),this.imageManager=new XA,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(e._missingStyleImageResolver),this.patternAtlas=new YA(this.imageManager);let i=((r=e._container)==null?void 0:r.lang)||typeof document<"u"&&((a=document.documentElement)==null?void 0:a.lang)||void 0;this.glyphManager=new sI(e._requestManager,t4.localIdeographFontFamily,i),this.lineAtlas=new dI(256,512),this.crossTileSymbolIndex=new J1,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",ed()),pn().on(Bc,this._rtlPluginLoaded),this.on("data",s=>{if(s.dataType!=="source"||s.sourceDataType!=="metadata")return;let n=this.tileManagers[s.sourceId];if(!n)return;let o=n.getSource();if(o!=null&&o.vectorLayerIds)for(let l in this._layers){let u=this._layers[l];u.source===o.id&&this._validateLayer(u)}})}_setInitialValues(){var e;this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new Oh,this._imagesListDirty=false,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=false,this._changed=false,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=false,this._updatedPaintProps={},this._layerOrderChanged=false,this._symbolPlacementTriggered=false,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new(((e=this.crossTileSymbolIndex)==null?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,t4){var r,a;this._checkLoaded();let i=t4===null?((a=(r=this.stylesheet.state)==null?void 0:r[e])==null?void 0:a.default)??null:t4;return this._setGlobalStateValues({[e]:i}),this}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t4={};for(let i in e)t4[i]=e[i].default;this._setGlobalStateValues(t4)}_setGlobalStateValues(e){let t4=[];for(let r in e)Vi(e[r],this._globalState[r])||t4.push(r);if(t4.length===0)return;let i={...this._globalState};for(let r of t4)this._globalState[r]=e[r];this._applyGlobalStateChanges(t4,i)}_applyGlobalStateChanges(e,t4){var s,n;let i=new Set,r={};for(let o of e)r[o]=this._globalState[o];for(let o in this._layers){let l=this._layers[o];l.retainPriorGlobalState(e,t4);let u=l.getLayoutAffectingGlobalStateRefs(),h=l.getPaintAffectingGlobalStateRefs(),c=l.getVisibilityAffectingGlobalStateRefs();for(let d of e){if(u.has(d)&&i.add(l.source),h.has(d))for(let{name:p,value:f}of h.get(d))this._updatePaintProperty(l,p,f,{validate:false});c!=null&&c.has(d)&&(l.recalculateVisibility(),this._updateLayer(l))}}let a={now:ze(),transition:this.getTransition()};(s=this.light)==null||s.applyGlobalStateChange(e,t4,a),(n=this.sky)==null||n.applyGlobalStateChange(e,t4,a),this.dispatcher.broadcast("UGS",r);for(let o in this.tileManagers)i.has(o)&&(this._reloadSource(o),this._changed=true)}async loadURL(e,t4={},i){this.fire(new Di("dataloading")),t4.validate=typeof t4.validate!="boolean"||t4.validate,this._loadStyleRequest=new AbortController;let r=this._loadStyleRequest;try{let a=await this.map._requestManager.transformRequest(e,"Style");Qc(r.signal);let s=await Dl(a,r);this._loadStyleRequest===r&&(this._loadStyleRequest=null),this._load(s.data,t4,i)}catch(a){this._loadStyleRequest===r&&(this._loadStyleRequest=null),a&&!r.signal.aborted&&this.fire(new Y(Ft(a)))}}loadJSON(e,t4={},i){this.fire(new Di("dataloading")),this._frameRequest=new AbortController,Xt.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,t4.validate=t4.validate!==false,this._load(e,t4,i)}).catch(()=>{})}loadEmpty(){this.fire(new Di("dataloading")),this._load(m3,{validate:false})}_load(e,t4,i){var a;let r=t4.transformStyle?t4.transformStyle(i,e):e;if(!(t4.validate&&wf(this,r))){r={...r},this._loaded=true,this.stylesheet=r;for(let s in r.sources)this.addSource(s,r.sources[s],{validate:false});r.sprite?this._loadSprite(r.sprite):this.imageManager.setLoaded(true),this.glyphManager.setURL(r.glyphs),this.glyphManager.setFontFaces(r["font-faces"]),this._createLayers(),this.light=new lI(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(((a=this.stylesheet.projection)==null?void 0:a.type)||"mercator"),this.sky=new cI(this.stylesheet.sky,this._globalState),this.sky.setEventedParent(this),this.map.setTerrain(this.stylesheet.terrain??null,{validate:false}),this.fire(new Di("data")),this.fire(new zm)}}_createLayers(){var t4;let e=km(this.stylesheet.layers);this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast("SL",e),this._order=e.map(i=>i.id),this._layers={},this._serializedLayers=null;for(let i of e){let r=Hu(i,this._globalState);if(r.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=r,Vh(r)&&this.tileManagers[r.source]){let a=((t4=i.paint)==null?void 0:t4["raster-fade-duration"])??r.paint.get("raster-fade-duration");this.tileManagers[r.source].setRasterFadeDuration(a)}}}async _loadSprite(e,t4=false,i=void 0){this.imageManager.setLoaded(false);let r=new AbortController;this._spriteRequest=r;let a;try{let s=await WA(e,this.map._requestManager,this.map.getPixelRatio(),r);if(!s)return;for(let n in s){let{loaded:o,removed:l}=this.imageManager.setSpriteImages(n,s[n]);this._markImagesChanged(l),t4&&this._markImagesChanged(o)}}catch(s){a=s,r.signal.aborted||this.fire(new Y(a))}finally{this._spriteRequest=null,this.imageManager.setLoaded(true),t4&&(this._changed=true),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new Di("data")),i==null||i(a)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=true,this._changed=true,this.fire(new Di("data"))}_validateLayer(e){let t4=this.tileManagers[e.source];if(!t4)return;let i=e.sourceLayer;if(!i)return;let r=t4.getSource();(r.type==="geojson"||r.vectorLayerIds&&!r.vectorLayerIds.includes(i))&&this.fire(new Y(Error(`Source layer "${i}" does not exist on source "${r.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return false;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return false;return this.imageManager.isLoaded()}_serializeByIds(e,t4=false){let i=this._serializedAllLayers();if(!e||e.length===0)return Object.values(t4?Wt(i):i);let r=[];for(let a of e)if(i[a]){let s=t4?Wt(i[a]):i[a];r.push(s)}return r}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t4=Object.keys(this._layers);for(let i of t4){let r=this._layers[i];r.type!=="custom"&&(e[i]=r.serialize())}return e}hasTransitions(){var e,t4,i;if((e=this.light)!=null&&e.hasTransition()||(t4=this.sky)!=null&&t4.hasTransition()||(i=this.projection)!=null&&i.hasTransition())return true;for(let r in this.tileManagers)if(this.tileManagers[r].hasTransition())return true;for(let r in this._layers)if(this._layers[r].hasTransition())return true;return false}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t4=this._changed;if(t4){this._imagesListDirty&&(this._imagesListDirty=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),false));let a=Object.keys(this._updatedLayers),s=Object.keys(this._removedLayers);(a.length||s.length)&&this._updateWorkerLayers(a,s);for(let n in this._updatedSources){let o=this._updatedSources[n];if(o==="reload")this._reloadSource(n);else if(o==="clear")this._clearSource(n);else throw Error(`Invalid action ${o}`)}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let n in this._updatedPaintProps)this._layers[n].updateTransitions(e);this._resetUpdates()}let i={};for(let a in this.tileManagers){let s=this.tileManagers[a];i[a]=s.used,s.used=false}let r=this.imageManager.listImages();for(let a of this._order){let s=this._layers[a];s.recalculate(e,r),!s.isHidden(e.zoom)&&s.source&&(this.tileManagers[s.source].used=true)}for(let a in i){let s=this.tileManagers[a];!!i[a]!=!!s.used&&s.fire(new Ge("data",{sourceDataType:"visibility",sourceId:a}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t4&&this.fire(new Di("data"))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t4 in this.tileManagers)this.tileManagers[t4].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=false}}_updateWorkerLayers(e,t4){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,false),removedIds:t4})}_resetUpdates(){this._changed=false,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=false}setState(e,t4={}){this._checkLoaded();let i=this.serialize();if(e=t4.transformStyle?t4.transformStyle(i,e):e,(t4.validate??true)&&wf(this,e))return false;e=Wt(e),e.layers=km(e.layers);let r=ZA(i,e),a=this._getOperationsToPerform(r);if(a.unimplemented.length>0)throw Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(a.operations.length===0)return false;for(let s of a.operations)s();return this.stylesheet=e,this._serializedLayers=null,this.fire(new zm({style:this})),true}_getOperationsToPerform(e){let t4=[],i=[];for(let r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":{let[a,s]=r.args;t4.push(()=>this.addLayer(a,s));break}case"removeLayer":{let[a]=r.args;t4.push(()=>this.removeLayer(a));break}case"setPaintProperty":{let[a,s,n]=r.args;t4.push(()=>this.setPaintProperty(a,s,n));break}case"setLayoutProperty":{let[a,s,n]=r.args;t4.push(()=>this.setLayoutProperty(a,s,n));break}case"setFilter":{let[a,s]=r.args;t4.push(()=>this.setFilter(a,s));break}case"addSource":{let[a,s]=r.args;t4.push(()=>this.addSource(a,s));break}case"removeSource":{let[a]=r.args;t4.push(()=>this.removeSource(a));break}case"setLayerZoomRange":{let[a,s,n]=r.args;t4.push(()=>this.setLayerZoomRange(a,s,n));break}case"setLight":{let[a]=r.args;t4.push(()=>this.setLight(a));break}case"setGeoJSONSourceData":{let[a,s]=r.args;t4.push(()=>this.setGeoJSONSourceData(a,s));break}case"setGlyphs":{let[a]=r.args;t4.push(()=>this.setGlyphs(a));break}case"setFontFaces":{let[a]=r.args;t4.push(()=>this.setFontFaces(a));break}case"setSprite":{let[a]=r.args;t4.push(()=>this.setSprite(a));break}case"setTerrain":{let[a]=r.args;t4.push(()=>this.map.setTerrain(a));break}case"setSky":{let[a]=r.args;t4.push(()=>this.setSky(a));break}case"setProjection":{let[a]=r.args;t4.push(()=>this.setProjection(a));break}case"setGlobalState":{let[a]=r.args;t4.push(()=>this.setGlobalState(a));break}case"setTransition":t4.push(()=>{});break;default:i.push(r.command)}return{operations:t4,unimplemented:i}}addImage(e,t4){if(this.getImage(e)){this.fire(new Y(Error(`An image named "${e}" already exists.`)));return}this.imageManager.addImage(e,t4),this._afterImageUpdated(e)}updateImage(e,t4){this.imageManager.updateImage(e,t4)}getImage(e){return this.imageManager.getImage(e)}setMissingImageResolver(e){this.imageManager.setMissingImageResolver(e)}removeImage(e){if(!this.getImage(e)){this.fire(new Y(Error(`An image named "${e}" does not exist.`)));return}this.imageManager.removeImage(e),this._afterImageUpdated(e)}_markImagesChanged(e){for(let t4 of e)this._changedImages[t4]=true}_afterImageUpdated(e){this._changedImages[e]=true,this._imagesListDirty=true,this._changed=true,this.fire(new Di("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t4,i={}){var a;if(this._checkLoaded(),this.tileManagers[e]!==void 0)throw Error(`Source "${e}" already exists.`);if(!t4.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(t4).join(", ")}.`);if(Py.has(t4.type)&&this._validate(qt.source,`sources.${e}`,t4,null,i))return;(a=this.map)!=null&&a._collectResourceTiming&&(t4.collectResourceTiming=true);let r=this.tileManagers[e]=new $c(e,t4,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:r.loaded(),source:r.serialize(),sourceId:e})),r.onAdd(this.map),this._changed=true}removeSource(e){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new Y(Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));let t4=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],t4.fire(new Ge("data",{sourceDataType:"metadata",sourceId:e})),t4.setEventedParent(null),t4.onRemove(this.map),this._changed=true}setGeoJSONSourceData(e,t4){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);let i=this.tileManagers[e].getSource();if(i.type!=="geojson")throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t4),this._changed=true}getSource(e){var t4;return(t4=this.tileManagers[e])==null?void 0:t4.getSource()}addLayer(e,t4,i={}){this._checkLoaded();let r=e.id;if(this.getLayer(r)){this.fire(new Y(Error(`Layer "${r}" already exists on this map.`)));return}let a;if(e.type==="custom"){if(vd(this,zD(e)))return;a=Hu(e,this._globalState)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(r,e.source),e=Wt(e),e=W(e,{source:r})),this._validate(qt.layer,`layers.${r}`,e,{arrayIndex:-1},i))return;a=Hu(e,this._globalState),this._validateLayer(a),a.setEventedParent(this,{layer:{id:r}})}let s=t4?this._order.indexOf(t4):this._order.length;if(t4&&s===-1){this.fire(new Y(Error(`Cannot add layer "${r}" before non-existing layer "${t4}".`)));return}if(this._order.splice(s,0,r),this._layerOrderChanged=true,this._layers[r]=a,this._removedLayers[r]&&a.source&&a.type!=="custom"){let n=this._removedLayers[r];delete this._removedLayers[r],n.type===a.type?(this._updatedSources[a.source]="reload",this.tileManagers[a.source].pause()):this._updatedSources[a.source]="clear"}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(e,t4){if(this._checkLoaded(),this._changed=true,!this._layers[e]){this.fire(new Y(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));return}if(e===t4)return;if(t4&&!this._order.includes(t4)){this.fire(new Y(Error(`Cannot move layer "${e}" before non-existing layer "${t4}".`)));return}let i=this._order.indexOf(e);this._order.splice(i,1);let r=t4?this._order.indexOf(t4):this._order.length;this._order.splice(r,0,e),this._layerOrderChanged=true}removeLayer(e){var r;this._checkLoaded();let t4=this._layers[e];if(!t4){this.fire(new Y(Error(`Cannot remove non-existing layer "${e}".`)));return}t4.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=true,this._changed=true,this._removedLayers[e]=t4,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t4.type==="symbol"&&t4.source&&((r=this.tileManagers[t4.source])==null||r.resetMaxContentElevation()),t4.onRemove&&t4.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t4,i){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new Y(Error(`Cannot set the zoom range of non-existing layer "${e}".`)));return}(r.minzoom!==t4||r.maxzoom!==i)&&(t4!=null&&(r.minzoom=t4),i!=null&&(r.maxzoom=i),this._updateLayer(r))}setFilter(e,t4,i={}){this._checkLoaded();let r=this.getLayer(e);if(!r){this.fire(new Y(Error(`Cannot filter non-existing layer "${e}".`)));return}if(!Vi(r.filter,t4)){if(t4==null){r.setFilter(void 0),this._updateLayer(r);return}this._validate(qt.filter,`layers.${r.id}.filter`,t4,null,i)||(r.setFilter(Wt(t4)),this._updateLayer(r))}}getFilter(e){return Wt(this.getLayer(e).filter)}setLayoutProperty(e,t4,i,r={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new Y(Error(`Cannot style non-existing layer "${e}".`)));return}Vi(a.getLayoutProperty(t4),i)||(a.setLayoutProperty(t4,i,r),this._updateLayer(a))}getLayoutProperty(e,t4){let i=this.getLayer(e);if(!i){this.fire(new Y(Error(`Cannot get style of non-existing layer "${e}".`)));return}return i.getLayoutProperty(t4)}setPaintProperty(e,t4,i,r={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new Y(Error(`Cannot style non-existing layer "${e}".`)));return}Vi(a.getPaintProperty(t4),i)||this._updatePaintProperty(a,t4,i,r)}_updatePaintProperty(e,t4,i,r={}){e.setPaintProperty(t4,i,r)&&this._updateLayer(e),Vh(e)&&t4==="raster-fade-duration"&&this.tileManagers[e.source].setRasterFadeDuration(i),this._changed=true,this._updatedPaintProps[e.id]=true,e.type==="symbol"&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(e,t4){return this.getLayer(e).getPaintProperty(t4)}setFeatureState(e,t4){this._checkLoaded();let i=e.source,r=e.sourceLayer,a=this.tileManagers[i];if(a===void 0){this.fire(new Y(Error(`The source '${i}' does not exist in the map's style.`)));return}let s=a.getSource().type;if(s==="geojson"&&r){this.fire(new Y(Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!r){this.fire(new Y(Error("The sourceLayer parameter must be provided for vector source types.")));return}if(e.id===void 0){this.fire(new Y(Error("The feature id parameter must be provided.")));return}let n=["__proto__","constructor","prototype"];if(t4&&Object.keys(t4).some(o=>n.includes(o))){this.fire(new Y(Error(`The feature state should not include one of the following keys: ${n}`)));return}a.setFeatureState(r,e.id,t4)}removeFeatureState(e,t4){this._checkLoaded();let i=e.source,r=this.tileManagers[i];if(r===void 0){this.fire(new Y(Error(`The source '${i}' does not exist in the map's style.`)));return}let a=r.getSource().type,s=a==="vector"?e.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new Y(Error("The sourceLayer parameter must be provided for vector source types.")));return}if(t4&&typeof e.id!="string"&&typeof e.id!="number"){this.fire(new Y(Error("A feature id is required to remove its specific state property.")));return}r.removeFeatureState(s,e.id,t4)}getFeatureState(e){this._checkLoaded();let t4=e.source,i=e.sourceLayer,r=this.tileManagers[t4];if(r===void 0){this.fire(new Y(Error(`The source '${t4}' does not exist in the map's style.`)));return}if(r.getSource().type==="vector"&&!i){this.fire(new Y(Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new Y(Error("The feature id parameter must be provided."))),r.getFeatureState(i,e.id)}getTransition(){var e;return W({duration:300,delay:0},(e=this.stylesheet)==null?void 0:e.transition)}serialize(){if(!this._loaded)return;let e=Jc(this.tileManagers,a=>a.serialize()),t4=this._serializeByIds(this._order,true),i=this.map.getTerrain()||void 0,r=this.stylesheet;return i_({version:r.version,name:r.name,metadata:r.metadata,light:r.light,sky:r.sky,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,"font-faces":r["font-faces"],transition:r.transition,projection:r.projection,state:r.state,sources:e,layers:t4,terrain:i},a=>a!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=true,e.source&&!this._updatedSources[e.source]&&this.tileManagers[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=true}_flattenAndSortRenderedFeatures(e){let t4=s=>this._layers[s].type==="fill-extrusion",i={},r=[];for(let s=this._order.length-1;s>=0;s--){let n=this._order[s];if(t4(n)){i[n]=s;for(let o of e){let l=o[n];if(l)for(let u of l)r.push(u)}}}r.sort((s,n)=>n.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let n=this._order[s];if(t4(n))for(let o=r.length-1;o>=0;o--){let l=r[o].feature;if(i[l.layer.id]<s)break;a.push(l),r.pop()}else for(let o of e){let l=o[n];if(l)for(let u of l)a.push(u.feature)}}return a}queryRenderedFeatures(e,t4,i){t4!=null&&t4.filter&&this._validate(qt.filter,"queryRenderedFeatures.filter",t4.filter,null,t4);let r={};if(t4!=null&&t4.layers){if(!(Array.isArray(t4.layers)||t4.layers instanceof Set))return this.fire(new Y(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let l of t4.layers){let u=this._layers[l];if(!u)return this.fire(new Y(Error(`The layer '${l}' does not exist in the map's style and cannot be queried for features.`))),[];r[u.source]=true}}let a=[];t4.availableImages=this.imageManager.listImages();let s=this._serializedAllLayers(),n=t4.layers instanceof Set?t4.layers:Array.isArray(t4.layers)?new Set(t4.layers):null,o={...t4,layers:n,globalState:this._globalState};for(let l in this.tileManagers)(!t4.layers||r[l])&&a.push(bI(this.tileManagers[l],this._layers,s,e,o,i,this.map.terrain?(u,h,c)=>this.map.terrain.getElevation(u,h,c):void 0));return this.placement&&a.push(wI(this._layers,s,this.tileManagers,e,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,t4){t4!=null&&t4.filter&&this._validate(qt.filter,"querySourceFeatures.filter",t4.filter,null,t4);let i=this.tileManagers[e];return i?TI(i,t4?{...t4,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,t4={}){this._checkLoaded();let i=this.light.getLight(),r=false;for(let s in e)if(!Vi(e[s],i[s])){r=true;break}if(!r)return;let a={now:ze(),transition:W({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t4),this.light.updateTransitions(a)}getProjection(){var e;return(e=this.stylesheet)==null?void 0:e.projection}setProjection(e){this._checkLoaded();let t4=e??{type:"mercator"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t4.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t4.type)}getSky(){var e;return(e=this.stylesheet)==null?void 0:e.sky}setSky(e,t4={}){this._checkLoaded();let i=this.getSky(),r=false;if(!e&&!i)return;if(e&&!i)r=true;else if(!e&&i)r=true;else for(let s in e)if(!Vi(e[s],i[s])){r=true;break}if(!r)return;let a={now:ze(),transition:W({duration:300,delay:0},this.stylesheet.transition)};this.sky.setSky(e,t4)&&(this.stylesheet.sky=e,this.sky.updateTransitions(a))}_setProjectionInternal(e){var i;let t4=f3(e,(i=this.map._camera)==null?void 0:i.transform.constrainOverride,this._globalState);this.projection=t4.projection,this.map.migrateProjection(t4.transform,t4.cameraHelper);for(let r in this.tileManagers)this.tileManagers[r].reload()}_validate(e,t4,i,r,a={}){return a.validate!==false&&wn(this,e,{key:t4,style:this.serialize(),value:i,...r},a)}_remove(e=true){this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null)),pn().off(Bc,this._rtlPluginLoaded);for(let t4 in this._layers)this._layers[t4].setEventedParent(null);for(let t4 in this.tileManagers){let i=this.tileManagers[t4];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(let t4 in this.tileManagers)this.tileManagers[t4].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}triggerSymbolPlacement(){this._symbolPlacementTriggered=true}_placementInputsChanged(e,t4,i){var a;let r=this.pauseablePlacement;return!r||this._symbolPlacementTriggered||this._placedProjectionTransition!==((a=this.projection)==null?void 0:a.transitionState)||r._showCollisionBoxes!==t4||r.placement.collisionGroups.crossSourceCollisions!==i||r.placement.transform.renderWorldCopies!==e.renderWorldCopies||!lx(r.placement.transform.modelViewProjectionMatrix,e.modelViewProjectionMatrix)}_updatePlacement(e,t4,i,r,a=false){var h,c;let s=false,n=false,o={};for(let d of this._order){let p=this._layers[d];if(p.type!=="symbol")continue;if(!o[p.source]){let m=this.tileManagers[p.source];o[p.source]=m.getRenderableIds(true).map(g=>m.getTileByID(g)).sort((g,_)=>_.tileID.overscaledZ-g.tileID.overscaledZ||(g.tileID.isLessThan(_.tileID)?-1:1))}let f=this.crossTileSymbolIndex.addLayer(p,o[p.source],e.center.lng);s||(s=f)}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a||(a=this._layerOrderChanged||i===0);let l=s||this._placementInputsChanged(e,t4,r),u=((h=this.pauseablePlacement)==null?void 0:h.isDone())&&!this.placement.stillRecent(ze(),e.zoom);if((a||!this.pauseablePlacement||u&&(l||this.placement.stale))&&(this._symbolPlacementTriggered=false,this._placedProjectionTransition=(c=this.projection)==null?void 0:c.transitionState,this.pauseablePlacement=new LM(e,this.map.terrain,this._order,a,t4,i,r,this.placement),this._layerOrderChanged=false),this.pauseablePlacement.isDone()?l&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,o),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ze()),n=true),s&&this.pauseablePlacement.placement.setStale()),n||s)for(let d of this._order){let p=this._layers[d];p.type==="symbol"&&this.placement.updateLayerOpacities(p,o[p.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ze())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}async getImages(e,t4){let i=await this.imageManager.getImages(t4.icons);this._updateTilesForChangedImages();let r=this.tileManagers[t4.source];return r&&r.setDependencies(t4.tileID.key,t4.type,t4.icons),i}async getGlyphs(e,t4){let i=await this.glyphManager.getGlyphs(t4.stacks),r=this.tileManagers[t4.source];return r&&r.setDependencies(t4.tileID.key,t4.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t4={}){this._checkLoaded(),!(e&&this._validate(qt.glyphs,"glyphs",e,null,t4))&&(this._changed=true,this._glyphsDidChange=true,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(e){this._checkLoaded(),this._changed=true,this._glyphsDidChange=true,this.stylesheet["font-faces"]=e,this.glyphManager.setFontFaces(e)}async getDashes(e,t4){let i={};for(let[r,a]of Object.entries(t4.dashes))i[r]=this.lineAtlas.getDash(a.dasharray,a.round);return i}addSprite(e,t4,i={},r){this._checkLoaded();let a=[{id:e,url:t4}],s=[...Oo(this.stylesheet.sprite),...a];this._validate(qt.sprite,"sprite",s,null,i)||(this.stylesheet.sprite=s,this._loadSprite(a,true,r))}removeSprite(e){this._checkLoaded();let t4=Oo(this.stylesheet.sprite);if(!t4.find(r=>r.id===e)){this.fire(new Y(Error(`Sprite "${e}" doesn't exists on this map.`)));return}let i=this.imageManager.removeSpriteImages(e);this._markImagesChanged(i),t4.splice(t4.findIndex(r=>r.id===e),1),this.stylesheet.sprite=t4.length>0?t4:void 0,this._imagesListDirty=true,this._changed=true,this.fire(new Di("data"))}getSprite(){return Oo(this.stylesheet.sprite)}setSprite(e,t4={},i){this._checkLoaded(),!(e&&this._validate(qt.sprite,"sprite",e,null,t4))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,true,i):(this._unloadSprite(),i&&i(null)))}destroy(){this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null));for(let e in this.tileManagers){let t4=this.tileManagers[e];t4.setEventedParent(null),t4.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let t4=this._layers[e];t4.setEventedParent(null),t4.onRemove&&t4.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(true),this._listeners={},this._oneTimeListeners={}}};const g3=Ke([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var _3=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t4,i,r,a,s,n,o,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==r.length;for(let h=0;!u&&h<r.length;h++)this.boundPaintVertexBuffers[h]!==r[h]&&(u=true);!this.vao||this.boundProgram!==t4||this.boundLayoutVertexBuffer!==i||u||this.boundIndexBuffer!==a||this.boundVertexOffset!==s||this.boundDynamicVertexBuffer!==n||this.boundDynamicVertexBuffer2!==o||this.boundDynamicVertexBuffer3!==l?this.freshBind(t4,i,r,a,s,n,o,l):e.bindVertexArray.set(this.vao)}freshBind(e,t4,i,r,a,s,n,o){let l=e.numAttributes,u=this.context,h=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t4,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=s,this.boundDynamicVertexBuffer2=n,this.boundDynamicVertexBuffer3=o,t4.enableAttributes(h,e);for(let c of i)c.enableAttributes(h,e);s&&s.enableAttributes(h,e),n&&n.enableAttributes(h,e),o&&o.enableAttributes(h,e),t4.bind(),t4.setVertexAttribPointers(h,e,a);for(let c of i)c.bind(),c.setVertexAttribPointers(h,e,a);s&&(s.bind(),s.setVertexAttribPointers(h,e,a)),r&&r.bind(),n&&(n.bind(),n.setVertexAttribPointers(h,e,a)),o&&(o.bind(),o.setVertexAttribPointers(h,e,a)),u.currentNumAttributes=l}destroy(){this.vao&&(this.vao=(this.context.deleteVertexArray(this.vao),null))}};const y3=(e,t4)=>({u_depth:new X(e,t4.u_depth),u_terrain:new X(e,t4.u_terrain)}),v3=(e,t4)=>({u_texture:new X(e,t4.u_texture),u_ele_delta:new U(e,t4.u_ele_delta),u_fog_matrix:new Mi(e,t4.u_fog_matrix),u_fog_color:new Ar(e,t4.u_fog_color),u_fog_ground_blend:new U(e,t4.u_fog_ground_blend),u_fog_ground_blend_opacity:new U(e,t4.u_fog_ground_blend_opacity),u_horizon_color:new Ar(e,t4.u_horizon_color),u_horizon_fog_blend:new U(e,t4.u_horizon_fog_blend),u_is_globe_mode:new U(e,t4.u_is_globe_mode)}),x3=(e,t4)=>({u_ele_delta:new U(e,t4.u_ele_delta)}),b3=(e,t4,i,r,a)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t4,u_fog_color:i?i.properties.get("fog-color"):oe.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?0:i?i.calculateFogBlendOpacity(r):0,u_horizon_color:i?i.properties.get("horizon-color"):oe.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!a}),w3=e=>({u_ele_delta:e}),tu={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2};function T3(e,t4){for(let[i,r]of Object.entries(tu)){let a=e.getUniformBlockIndex(t4,i);a!==e.INVALID_INDEX&&e.uniformBlockBinding(t4,a,r)}}const E3={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]};function lp(e){let t4={},i=0;for(let{name:r,type:a}of e){let[s,n]=E3[a];i=Math.ceil(i/n)*n,t4[r]=i,i+=s}return{offsets:t4,contentWords:i,sizeWords:Math.ceil(i/4)*4}}var up=class{constructor(e,t4,i){this.context=e,this.binding=t4,this.contentWords=i.contentWords;let r=e.gl;this.buffer=r.createBuffer(),r.bindBuffer(r.UNIFORM_BUFFER,this.buffer),r.bufferData(r.UNIFORM_BUFFER,i.sizeWords*4,r.DYNAMIC_DRAW),r.bindBufferBase(r.UNIFORM_BUFFER,t4,this.buffer),this.uploaded=new Float32Array(i.sizeWords),this.pending=new Float32Array(i.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=false,this.bindingDirty=false}upload(){let e=this.context.gl,t4=!this.hasData;if(!t4){let i=this.pendingWords,r=this.uploadedWords;for(let a=0;a<this.contentWords;a++)if(i[a]!==r[a]){t4=true;break}}this.bind(),t4&&(e.bindBufferBase(e.UNIFORM_BUFFER,this.binding,this.buffer),e.bufferData(e.UNIFORM_BUFFER,this.pending,e.DYNAMIC_DRAW),this.uploaded.set(this.pending),this.hasData=true)}bind(){if(!this.bindingDirty)return;let e=this.context.gl;e.bindBufferBase(e.UNIFORM_BUFFER,this.binding,this.buffer),this.bindingDirty=false}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const _v=lp([{name:"u_projection_matrix",type:"mat4"},{name:"u_projection_fallback_matrix",type:"mat4"},{name:"u_projection_tile_mercator_coords",type:"vec4"},{name:"u_projection_clipping_plane",type:"vec4"},{name:"u_projection_transition",type:"float"},{name:"u_projection_clip_antimeridian",type:"int"}]),wa=_v.offsets;function S3(e){return new up(e,tu.ProjectionUBO,_v)}function D3(e,t4){let i=e.pending;i.set(t4.mainMatrix,wa.u_projection_matrix),i.set(t4.fallbackMatrix,wa.u_projection_fallback_matrix),i.set(t4.tileMercatorCoords,wa.u_projection_tile_mercator_coords),i.set(t4.clippingPlane,wa.u_projection_clipping_plane),i[wa.u_projection_transition]=t4.projectionTransition,e.pendingWords[wa.u_projection_clip_antimeridian]=+!!t4.clipAntimeridian,e.upload()}const yv=lp([{name:"u_terrain_matrix",type:"mat4"},{name:"u_terrain_unpack",type:"vec4"},{name:"u_terrain_dim",type:"float"},{name:"u_terrain_exaggeration",type:"float"}]),wo=yv.offsets;function C3(e){return new up(e,tu.TerrainUBO,yv)}function P3(e,t4){let i=e.pending;i.set(t4.u_terrain_matrix,wo.u_terrain_matrix),i.set(t4.u_terrain_unpack,wo.u_terrain_unpack),i[wo.u_terrain_dim]=t4.u_terrain_dim,i[wo.u_terrain_exaggeration]=t4.u_terrain_exaggeration,e.upload()}function lh(e){let t4=[];for(let i of e){if(i===null)continue;let r=i.split(" ");t4.push(r.pop())}return t4}function A3(e,t4){let i=new Set([e.INT,e.INT_VEC2,e.INT_VEC3,e.INT_VEC4,e.UNSIGNED_INT,e.UNSIGNED_INT_VEC2,e.UNSIGNED_INT_VEC3,e.UNSIGNED_INT_VEC4]),r=new Set,a=e.getProgramParameter(t4,e.ACTIVE_ATTRIBUTES);for(let s=0;s<a;s++){let n=e.getActiveAttrib(t4,s);n&&i.has(n.type)&&r.add(n.name)}return r}var I3=class{constructor(e,t4,i,r,a,s,n,o,l=[]){let u=e.gl;this.program=u.createProgram();let h=lh(t4.staticAttributes),c=i?i.getBinderAttributes():[],d=h.concat(c),p=Gi.prelude.staticUniforms?lh(Gi.prelude.staticUniforms):[],f=t4.staticUniforms?lh(t4.staticUniforms):[],m=i?i.getBinderUniforms():[],g=p.concat(f).concat(m),_=[];for(let E of g)_.includes(E)||_.push(E);let y=i?i.defines():[];y.unshift("#version 300 es"),a&&y.push("#define OVERDRAW_INSPECTOR;"),s&&y.push("#define TERRAIN3D;"),o&&y.push(o),l&&y.push(...l);let x=y.concat(Gi.prelude.fragmentSource,n.fragmentSource,t4.fragmentSource).join(`
820
+ `),v=y.concat(Gi.prelude.vertexSource,n.vertexSource,t4.vertexSource).join(`
821
+ `),w=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=true;return}u.shaderSource(w,x),u.compileShader(w),u.attachShader(this.program,w);let b=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=true;return}u.shaderSource(b,v),u.compileShader(b),u.attachShader(this.program,b),this.attributes={};let T={};if(this.numAttributes=d.length,u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS)){if(u.isContextLost()){this.failedToCreate=true;return}throw u.getShaderParameter(w,u.COMPILE_STATUS)?u.getShaderParameter(b,u.COMPILE_STATUS)?Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${u.getShaderInfoLog(b)}`):Error(`Could not compile fragment shader: ${u.getShaderInfoLog(w)}`)}T3(u,this.program);let P=A3(u,this.program);for(let E of d){if(!E)continue;let I=u.getAttribLocation(this.program,E);I>=0&&(this.attributes[E]={location:I,isInteger:P.has(E)})}u.deleteShader(b),u.deleteShader(w);for(let E of _)if(E&&!T[E]){let I=u.getUniformLocation(this.program,E);I&&(T[E]=I)}this.fixedUniforms=r(e,T),this.terrainUniforms=y3(e,T),this.binderUniforms=i?i.getUniforms(e,T):[]}draw(e,t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m,g,_,y){var w;let x=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.projectionUniformBuffer.bind(),e.terrainUniformBuffer.bind(),e.frameUniformBuffer.bind(),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(a),e.setCullFace(s),o){e.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,o.depthTexture),e.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,o.texture);for(let b in this.terrainUniforms)this.terrainUniforms[b].set(o[b]);P3(e.terrainUniformBuffer,o)}if(l&&D3(e.projectionUniformBuffer,l),n)for(let b in this.fixedUniforms)this.fixedUniforms[b].set(n[b]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let v=0;switch(t4){case x.LINES:v=2;break;case x.TRIANGLES:v=3;break;case x.LINE_STRIP:v=1}for(let b of d.get())b.vaos||(b.vaos={}),(w=b.vaos)[u]||(w[u]=new _3),b.vaos[u].bind(e,this,h,m?m.getPaintVertexBuffers():[],c,b.vertexOffset,g,_,y),x.drawElements(t4,b.primitiveLength*v,x.UNSIGNED_SHORT,b.primitiveOffset*v*2)}};function vv(e,t4,i){let r=1/si(i,1,t4.transform.tileZoom),a=2**i.tileID.overscaledZ,s=i.tileSize*2**t4.transform.tileZoom/a,n=s*(i.tileID.canonical.x+i.tileID.wrap*a),o=s*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[n>>16,o>>16],u_pixel_coord_lower:[n&65535,o&65535]}}function M3(e,t4,i,r){let a=i.patternAtlas.getPattern(e.from.toString()),s=i.patternAtlas.getPattern(e.to.toString()),{width:n,height:o}=i.patternAtlas.getPixelSize(),l=2**r.tileID.overscaledZ,u=r.tileSize*2**i.transform.tileZoom/l,h=u*(r.tileID.canonical.x+r.tileID.wrap*l),c=u*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:s.tl,u_pattern_br_b:s.br,u_texsize:[n,o],u_mix:t4.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:s.displaySize,u_scale_a:t4.fromScale,u_scale_b:t4.toScale,u_tile_units_to_pixels:1/si(r,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,c>>16],u_pixel_coord_lower:[h&65535,c&65535]}}const F3=(e,t4)=>({u_lightpos:new Vt(e,t4.u_lightpos),u_lightpos_globe:new Vt(e,t4.u_lightpos_globe),u_lightintensity:new U(e,t4.u_lightintensity),u_lightcolor:new Vt(e,t4.u_lightcolor),u_vertical_gradient:new U(e,t4.u_vertical_gradient),u_opacity:new U(e,t4.u_opacity),u_fill_translate:new de(e,t4.u_fill_translate)}),z3=(e,t4)=>({u_lightpos:new Vt(e,t4.u_lightpos),u_lightpos_globe:new Vt(e,t4.u_lightpos_globe),u_lightintensity:new U(e,t4.u_lightintensity),u_lightcolor:new Vt(e,t4.u_lightcolor),u_vertical_gradient:new U(e,t4.u_vertical_gradient),u_height_factor:new U(e,t4.u_height_factor),u_opacity:new U(e,t4.u_opacity),u_fill_translate:new de(e,t4.u_fill_translate),u_image:new X(e,t4.u_image),u_texsize:new de(e,t4.u_texsize),u_pixel_coord_upper:new de(e,t4.u_pixel_coord_upper),u_pixel_coord_lower:new de(e,t4.u_pixel_coord_lower),u_scale:new Vt(e,t4.u_scale),u_fade:new U(e,t4.u_fade)}),xv=(e,t4,i,r)=>{let a=e.style.light,s=a.getCartesianPosition(),n=Kg();a.properties.get("anchor")==="viewport"&&ix(n,e.transform.bearingInRadians),px(s,s,n);let o=e.transform.transformLightDirection(s),l=a.properties.get("color");return{u_lightpos:s,u_lightpos_globe:o,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+t4,u_opacity:i,u_fill_translate:r}},R3=(e,t4,i,r,a,s,n)=>W(xv(e,t4,i,r),vv(s,e,n),{u_height_factor:-(2**a.overscaledZ)/n.tileSize/8}),k3=(e,t4)=>({u_fill_translate:new de(e,t4.u_fill_translate)}),L3=(e,t4)=>({u_image:new X(e,t4.u_image),u_texsize:new de(e,t4.u_texsize),u_pixel_coord_upper:new de(e,t4.u_pixel_coord_upper),u_pixel_coord_lower:new de(e,t4.u_pixel_coord_lower),u_scale:new Vt(e,t4.u_scale),u_fade:new U(e,t4.u_fade),u_sdf_pattern:new X(e,t4.u_sdf_pattern),u_fill_translate:new de(e,t4.u_fill_translate)}),B3=(e,t4)=>({u_fill_translate:new de(e,t4.u_fill_translate)}),O3=(e,t4)=>({u_image:new X(e,t4.u_image),u_texsize:new de(e,t4.u_texsize),u_pixel_coord_upper:new de(e,t4.u_pixel_coord_upper),u_pixel_coord_lower:new de(e,t4.u_pixel_coord_lower),u_scale:new Vt(e,t4.u_scale),u_fade:new U(e,t4.u_fade),u_sdf_pattern:new X(e,t4.u_sdf_pattern),u_fill_translate:new de(e,t4.u_fill_translate)}),bv=(e,t4,i,r,a)=>W(vv(t4,e,i),{u_fill_translate:r,u_sdf_pattern:+!!a}),$3=e=>({u_fill_translate:e}),V3=e=>({u_fill_translate:e}),j3=(e,t4,i,r,a)=>bv(e,t4,i,r,a),U3=(e,t4)=>({u_scale_with_map:new X(e,t4.u_scale_with_map),u_pitch_with_map:new X(e,t4.u_pitch_with_map),u_extrude_scale:new de(e,t4.u_extrude_scale),u_globe_extrude_scale:new U(e,t4.u_globe_extrude_scale),u_translate:new de(e,t4.u_translate)}),N3=(e,t4,i,r,a)=>{let s=e.transform,n,o,l=0;if(i.paint.get("circle-pitch-alignment")==="map"){let u=si(t4,1,s.zoom);n=true,o=[u,u],l=u/(k*2**t4.tileID.overscaledZ)*2*Math.PI*a}else n=false,o=s.pixelsToGLUnits;return{u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+n,u_extrude_scale:o,u_globe_extrude_scale:l,u_translate:r}},G3=(e,t4)=>({u_color:new Ar(e,t4.u_color),u_overlay:new X(e,t4.u_overlay),u_overlay_scale:new U(e,t4.u_overlay_scale)}),Dg=(e,t4=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t4}),Z3=(e,t4)=>({u_extrude_scale:new U(e,t4.u_extrude_scale),u_intensity:new U(e,t4.u_intensity),u_globe_extrude_scale:new U(e,t4.u_globe_extrude_scale)}),q3=(e,t4)=>({u_matrix:new Mi(e,t4.u_matrix),u_image:new X(e,t4.u_image),u_color_ramp:new X(e,t4.u_color_ramp),u_opacity:new U(e,t4.u_opacity)}),wv=(e,t4,i,r)=>{let a=si(e,1,t4)/(k*2**e.tileID.overscaledZ)*2*Math.PI*r;return{u_extrude_scale:si(e,1,t4),u_intensity:i,u_globe_extrude_scale:a}},Tv=(e,t4,i,r)=>{let a=Ir();return $i(a,0,e.width,e.height,0,0,1),{u_matrix:a,u_image:i,u_color_ramp:r,u_opacity:t4.paint.get("heatmap-opacity")}},W3=(e,t4)=>({u_image:new X(e,t4.u_image),u_latrange:new de(e,t4.u_latrange),u_exaggeration:new U(e,t4.u_exaggeration),u_altitudes:new zf(e,t4.u_altitudes),u_azimuths:new zf(e,t4.u_azimuths),u_accent:new Ar(e,t4.u_accent),u_method:new X(e,t4.u_method),u_shadows:new Ff(e,t4.u_shadows),u_highlights:new Ff(e,t4.u_highlights)}),H3=(e,t4)=>({u_matrix:new Mi(e,t4.u_matrix),u_image:new X(e,t4.u_image),u_dimension:new de(e,t4.u_dimension),u_zoom:new U(e,t4.u_zoom),u_unpack:new nn(e,t4.u_unpack)}),X3=(e,t4,i)=>{let r=i.paint.get("hillshade-accent-color"),a;switch(i.paint.get("hillshade-method")){case"basic":a=4;break;case"combined":a=1;break;case"igor":a=2;break;case"multidirectional":a=3;break;default:a=0}let s=i.getIlluminationProperties();for(let n=0;n<s.directionRadians.length;n++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(s.directionRadians[n]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:K3(e,t4.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:s.altitudeRadians,u_azimuths:s.directionRadians,u_accent:r,u_method:a,u_highlights:s.highlightColor,u_shadows:s.shadowColor}},Y3=(e,t4)=>{let i=t4.stride,r=Ir();return $i(r,0,k,-k,0,0,1),ot(r,r,[0,-k,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:e.overscaledZ,u_unpack:t4.getUnpackVector()}};function K3(e,t4){let i=2**t4.canonical.z,r=t4.canonical.y;return[new Ie(0,r/i).toLngLat().lat,new Ie(0,(r+1)/i).toLngLat().lat]}const J3=(e,t4)=>({u_image:new X(e,t4.u_image),u_unpack:new nn(e,t4.u_unpack),u_dimension:new de(e,t4.u_dimension),u_elevation_stops:new X(e,t4.u_elevation_stops),u_color_stops:new X(e,t4.u_color_stops),u_color_ramp_size:new X(e,t4.u_color_ramp_size),u_opacity:new U(e,t4.u_opacity)}),Q3=(e,t4,i=0)=>({u_image:0,u_unpack:t4.getUnpackVector(),u_dimension:[t4.stride,t4.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:e.paint.get("color-relief-opacity")}),eF=(e,t4)=>({u_translation:new de(e,t4.u_translation),u_ratio:new U(e,t4.u_ratio)}),tF=(e,t4)=>({u_translation:new de(e,t4.u_translation),u_ratio:new U(e,t4.u_ratio),u_image:new X(e,t4.u_image),u_image_height:new U(e,t4.u_image_height)}),iF=(e,t4)=>({u_translation:new de(e,t4.u_translation),u_texsize:new de(e,t4.u_texsize),u_ratio:new U(e,t4.u_ratio),u_image:new X(e,t4.u_image),u_scale:new Vt(e,t4.u_scale),u_fade:new U(e,t4.u_fade)}),rF=(e,t4)=>({u_translation:new de(e,t4.u_translation),u_ratio:new U(e,t4.u_ratio),u_image:new X(e,t4.u_image),u_mix:new U(e,t4.u_mix),u_tileratio:new U(e,t4.u_tileratio),u_crossfade_from:new U(e,t4.u_crossfade_from),u_crossfade_to:new U(e,t4.u_crossfade_to),u_lineatlas_width:new U(e,t4.u_lineatlas_width),u_lineatlas_height:new U(e,t4.u_lineatlas_height)}),aF=(e,t4)=>({u_translation:new de(e,t4.u_translation),u_ratio:new U(e,t4.u_ratio),u_image:new X(e,t4.u_image),u_image_height:new U(e,t4.u_image_height),u_tileratio:new U(e,t4.u_tileratio),u_crossfade_from:new U(e,t4.u_crossfade_from),u_crossfade_to:new U(e,t4.u_crossfade_to),u_image_dash:new X(e,t4.u_image_dash),u_mix:new U(e,t4.u_mix),u_lineatlas_width:new U(e,t4.u_lineatlas_width),u_lineatlas_height:new U(e,t4.u_lineatlas_height)}),iu=(e,t4,i,r)=>{let a=e.transform;return{u_translation:Ev(e,t4,i),u_ratio:r/si(t4,1,a.zoom)}},sF=(e,t4,i,r,a)=>W(iu(e,t4,i,r),{u_image:0,u_image_height:a}),nF=(e,t4,i,r,a)=>{let s=e.transform,n=hp(t4,s);return{u_translation:Ev(e,t4,i),u_texsize:t4.imageAtlasTexture.size,u_ratio:r/si(t4,1,s.zoom),u_image:0,u_scale:[n,a.fromScale,a.toScale],u_fade:a.t}},oF=(e,t4,i,r,a)=>{let s=e.transform,n=hp(t4,s);return W(iu(e,t4,i,r),{u_tileratio:n,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},lF=(e,t4,i,r,a,s)=>{let n=e.transform,o=hp(t4,n);return W(iu(e,t4,i,r),{u_image:0,u_image_height:s,u_tileratio:o,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function hp(e,t4){return 1/si(e,1,t4.tileZoom)}function Ev(e,t4,i){return Dr(e.transform,t4,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const uF=(e,t4)=>({u_image:new X(e,t4.u_image),u_opacity:new U(e,t4.u_opacity)}),hF=(e,t4)=>({u_image:t4,u_opacity:e}),cF=(e,t4)=>({u_is_size_zoom_constant:new X(e,t4.u_is_size_zoom_constant),u_is_size_feature_constant:new X(e,t4.u_is_size_feature_constant),u_size_t:new U(e,t4.u_size_t),u_size:new U(e,t4.u_size),u_rotate_symbol:new X(e,t4.u_rotate_symbol),u_label_plane_matrix:new Mi(e,t4.u_label_plane_matrix),u_coord_matrix:new Mi(e,t4.u_coord_matrix),u_is_text:new X(e,t4.u_is_text),u_pitch_with_map:new X(e,t4.u_pitch_with_map),u_is_along_line:new X(e,t4.u_is_along_line),u_is_variable_anchor:new X(e,t4.u_is_variable_anchor),u_texsize:new de(e,t4.u_texsize),u_texture:new X(e,t4.u_texture),u_translation:new de(e,t4.u_translation),u_pitched_scale:new U(e,t4.u_pitched_scale),u_is_offset:new X(e,t4.u_is_offset),u_height_anchor_ground:new X(e,t4.u_height_anchor_ground)}),dF=(e,t4)=>({u_is_size_zoom_constant:new X(e,t4.u_is_size_zoom_constant),u_is_size_feature_constant:new X(e,t4.u_is_size_feature_constant),u_size_t:new U(e,t4.u_size_t),u_size:new U(e,t4.u_size),u_rotate_symbol:new X(e,t4.u_rotate_symbol),u_label_plane_matrix:new Mi(e,t4.u_label_plane_matrix),u_coord_matrix:new Mi(e,t4.u_coord_matrix),u_is_text:new X(e,t4.u_is_text),u_pitch_with_map:new X(e,t4.u_pitch_with_map),u_is_along_line:new X(e,t4.u_is_along_line),u_is_variable_anchor:new X(e,t4.u_is_variable_anchor),u_texsize:new de(e,t4.u_texsize),u_texture:new X(e,t4.u_texture),u_gamma_scale:new U(e,t4.u_gamma_scale),u_is_halo:new X(e,t4.u_is_halo),u_is_plain:new X(e,t4.u_is_plain),u_translation:new de(e,t4.u_translation),u_pitched_scale:new U(e,t4.u_pitched_scale),u_is_offset:new X(e,t4.u_is_offset),u_height_anchor_ground:new X(e,t4.u_height_anchor_ground)}),pF=(e,t4)=>({u_is_size_zoom_constant:new X(e,t4.u_is_size_zoom_constant),u_is_size_feature_constant:new X(e,t4.u_is_size_feature_constant),u_size_t:new U(e,t4.u_size_t),u_size:new U(e,t4.u_size),u_rotate_symbol:new X(e,t4.u_rotate_symbol),u_label_plane_matrix:new Mi(e,t4.u_label_plane_matrix),u_coord_matrix:new Mi(e,t4.u_coord_matrix),u_is_text:new X(e,t4.u_is_text),u_pitch_with_map:new X(e,t4.u_pitch_with_map),u_is_along_line:new X(e,t4.u_is_along_line),u_is_variable_anchor:new X(e,t4.u_is_variable_anchor),u_texsize:new de(e,t4.u_texsize),u_texsize_icon:new de(e,t4.u_texsize_icon),u_texture:new X(e,t4.u_texture),u_texture_icon:new X(e,t4.u_texture_icon),u_gamma_scale:new U(e,t4.u_gamma_scale),u_is_halo:new X(e,t4.u_is_halo),u_translation:new de(e,t4.u_translation),u_pitched_scale:new U(e,t4.u_pitched_scale),u_is_offset:new X(e,t4.u_is_offset),u_height_anchor_ground:new X(e,t4.u_height_anchor_ground)}),Sv=(e,t4,i,r,a,s,n,o,l,u,h,c,d,p,f)=>({u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:t4?t4.uSizeT:0,u_size:t4?t4.uSize:0,u_rotate_symbol:+i,u_label_plane_matrix:o,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+r,u_is_along_line:a,u_is_variable_anchor:s,u_texsize:c,u_texture:0,u_translation:u,u_pitched_scale:d,u_is_offset:p,u_height_anchor_ground:+f}),Dv=(e,t4,i,r,a,s,n,o,l,u,h,c,d,p,f,m)=>{let g=n.transform;return W(Sv(e,t4,i,r,a,s,n,o,l,u,h,c,p,f,m),{u_gamma_scale:r?Math.cos(g.pitch*Math.PI/180)*g.cameraToCenterDistance:1,u_is_halo:+!!d,u_is_plain:1})},fF=(e,t4,i,r,a,s,n,o,l,u,h,c,d,p,f)=>W(Dv(e,t4,i,r,a,s,n,o,l,u,true,h,true,d,p,f),{u_texsize_icon:c,u_texture_icon:1}),mF=(e,t4)=>({u_opacity:new U(e,t4.u_opacity),u_color:new Ar(e,t4.u_color)}),gF=(e,t4)=>({u_opacity:new U(e,t4.u_opacity),u_image:new X(e,t4.u_image),u_pattern_tl_a:new de(e,t4.u_pattern_tl_a),u_pattern_br_a:new de(e,t4.u_pattern_br_a),u_pattern_tl_b:new de(e,t4.u_pattern_tl_b),u_pattern_br_b:new de(e,t4.u_pattern_br_b),u_texsize:new de(e,t4.u_texsize),u_mix:new U(e,t4.u_mix),u_pattern_size_a:new de(e,t4.u_pattern_size_a),u_pattern_size_b:new de(e,t4.u_pattern_size_b),u_scale_a:new U(e,t4.u_scale_a),u_scale_b:new U(e,t4.u_scale_b),u_pixel_coord_upper:new de(e,t4.u_pixel_coord_upper),u_pixel_coord_lower:new de(e,t4.u_pixel_coord_lower),u_tile_units_to_pixels:new U(e,t4.u_tile_units_to_pixels)}),_F=(e,t4)=>({u_opacity:e,u_color:t4}),yF=(e,t4,i,r,a)=>W(M3(i,a,t4,r),{u_opacity:e}),vF=(e,t4)=>({u_sun_pos:new Vt(e,t4.u_sun_pos),u_atmosphere_blend:new U(e,t4.u_atmosphere_blend),u_globe_position:new Vt(e,t4.u_globe_position),u_globe_radius:new U(e,t4.u_globe_radius),u_inv_proj_matrix:new Mi(e,t4.u_inv_proj_matrix)}),xF=(e,t4,i,r,a)=>({u_sun_pos:e,u_atmosphere_blend:t4,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:a}),bF=(e,t4)=>({u_sky_color:new Ar(e,t4.u_sky_color),u_horizon_color:new Ar(e,t4.u_horizon_color),u_horizon:new de(e,t4.u_horizon),u_horizon_normal:new de(e,t4.u_horizon_normal),u_sky_horizon_blend:new U(e,t4.u_sky_horizon_blend),u_sky_blend:new U(e,t4.u_sky_blend),u_inv_proj_matrix:new Mi(e,t4.u_inv_proj_matrix),u_globe_position:new Vt(e,t4.u_globe_position),u_globe_radius:new U(e,t4.u_globe_radius),u_atmosphere_blend:new U(e,t4.u_atmosphere_blend)}),wF=(e,t4,i)=>{let r=Math.cos(t4.rollInRadians),a=Math.sin(t4.rollInRadians),s=Zs(t4),n=t4.getProjectionData({overscaledTileID:null,applyGlobeMatrix:true,applyTerrainMatrix:true}).projectionTransition,o=hv(t4),l=es(t4.worldSize,t4.center.lat);return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t4.width/2-s*a)*i,(t4.height/2+s*r)*i],u_horizon_normal:[-a,r],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t4.height/2*i,u_sky_blend:n,u_inv_proj_matrix:t4.inverseProjectionMatrix,u_globe_position:o,u_globe_radius:l,u_atmosphere_blend:e.properties.get("atmosphere-blend")*cv(Ci(o)-l,l)}},To=(e,t4)=>({}),TF={fillExtrusion:F3,fillExtrusionPattern:z3,fill:k3,fillPattern:L3,fillOutline:B3,fillOutlinePattern:O3,circle:U3,collisionBox:To,collisionCircle:To,debug:G3,depth:To,clippingMask:To,heatmap:Z3,heatmapTexture:q3,hillshade:W3,hillshadePrepare:H3,colorRelief:J3,line:eF,lineGradient:tF,linePattern:iF,lineSDF:rF,lineGradientSDF:aF,layerOpacity:uF,raster:BI,symbolIcon:cF,symbolSDF:dF,symbolTextAndIcon:pF,background:mF,backgroundPattern:gF,terrain:v3,terrainDepth:x3,atmosphere:vF,sky:bF};var EF=class{constructor(e,t4,i){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t4.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||t4.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t4=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t4.bufferSubData(t4.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const Cg={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var SF=class{constructor(e,t4,i,r){this.length=t4.length,this.attributes=i,this.itemSize=t4.bytesPerElement,this.dynamicDraw=r,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t4.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||t4.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t4=this.context.gl;this.bind(),t4.bufferSubData(t4.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t4){for(let i of this.attributes){let r=t4.attributes[i.name];r!==void 0&&e.enableVertexAttribArray(r.location)}}setVertexAttribPointers(e,t4,i){for(let r of this.attributes){let a=t4.attributes[r.name];if(a!==void 0){let s=r.offset+this.itemSize*(i||0);a.isInteger?e.vertexAttribIPointer(a.location,r.components,e[Cg[r.type]],this.itemSize,s):e.vertexAttribPointer(a.location,r.components,e[Cg[r.type]],false,this.itemSize,s)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},Re=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=false}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},DF=class extends Re{getDefault(){return oe.transparent}set(e){let t4=this.current;(e.r!==t4.r||e.g!==t4.g||e.b!==t4.b||e.a!==t4.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=false)}},CF=class extends Re{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=false)}},PF=class extends Re{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=false)}},AF=class extends Re{getDefault(){return[true,true,true,true]}set(e){let t4=this.current;(e[0]!==t4[0]||e[1]!==t4[1]||e[2]!==t4[2]||e[3]!==t4[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=false)}},IF=class extends Re{getDefault(){return true}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=false)}},MF=class extends Re{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=false)}},FF=class extends Re{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t4=this.current;(e.func!==t4.func||e.ref!==t4.ref||e.mask!==t4.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=false)}},zF=class extends Re{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t4=this.current;(e[0]!==t4[0]||e[1]!==t4[1]||e[2]!==t4[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=false)}},RF=class extends Re{getDefault(){return false}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;e?t4.enable(t4.STENCIL_TEST):t4.disable(t4.STENCIL_TEST),this.current=e,this.dirty=false}},kF=class extends Re{getDefault(){return[0,1]}set(e){let t4=this.current;(e[0]!==t4[0]||e[1]!==t4[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=false)}},LF=class extends Re{getDefault(){return false}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;e?t4.enable(t4.DEPTH_TEST):t4.disable(t4.DEPTH_TEST),this.current=e,this.dirty=false}},BF=class extends Re{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=false)}},OF=class extends Re{getDefault(){return false}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;e?t4.enable(t4.BLEND):t4.disable(t4.BLEND),this.current=e,this.dirty=false}},$F=class extends Re{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t4=this.current;(e[0]!==t4[0]||e[1]!==t4[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=false)}},VF=class extends Re{getDefault(){return oe.transparent}set(e){let t4=this.current;(e.r!==t4.r||e.g!==t4.g||e.b!==t4.b||e.a!==t4.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=false)}},jF=class extends Re{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=false)}},UF=class extends Re{getDefault(){return false}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;e?t4.enable(t4.CULL_FACE):t4.disable(t4.CULL_FACE),this.current=e,this.dirty=false}},NF=class extends Re{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=false)}},GF=class extends Re{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=false)}},ZF=class extends Re{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=false)}},qF=class extends Re{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=false)}},WF=class extends Re{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t4=this.current;(e[0]!==t4[0]||e[1]!==t4[1]||e[2]!==t4[2]||e[3]!==t4[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=false)}},HF=class extends Re{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;t4.bindFramebuffer(t4.FRAMEBUFFER,e),this.current=e,this.dirty=false}},XF=class extends Re{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;t4.bindRenderbuffer(t4.RENDERBUFFER,e),this.current=e,this.dirty=false}},YF=class extends Re{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;t4.bindTexture(t4.TEXTURE_2D,e),this.current=e,this.dirty=false}},KF=class extends Re{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;t4.bindBuffer(t4.ARRAY_BUFFER,e),this.current=e,this.dirty=false}},JF=class extends Re{getDefault(){return null}set(e){let t4=this.gl;t4.bindBuffer(t4.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=false}},QF=class extends Re{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=false)}},e5=class extends Re{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;t4.pixelStorei(t4.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=false}},t5=class extends Re{getDefault(){return false}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;t4.pixelStorei(t4.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=false}},i5=class extends Re{getDefault(){return false}set(e){if(e===this.current&&!this.dirty)return;let t4=this.gl;t4.pixelStorei(t4.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=false}},cp=class extends Re{constructor(e,t4){super(e),this.context=e,this.parent=t4}getDefault(){return null}},r5=class extends cp{setDirty(){this.dirty=true}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t4=this.gl;t4.framebufferTexture2D(t4.FRAMEBUFFER,t4.COLOR_ATTACHMENT0,t4.TEXTURE_2D,e,0),this.current=e,this.dirty=false}},a5=class extends cp{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t4=this.gl;t4.framebufferRenderbuffer(t4.FRAMEBUFFER,t4.DEPTH_ATTACHMENT,t4.RENDERBUFFER,e),this.current=e,this.dirty=false}},s5=class extends cp{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t4=this.gl;t4.framebufferRenderbuffer(t4.FRAMEBUFFER,t4.DEPTH_STENCIL_ATTACHMENT,t4.RENDERBUFFER,e),this.current=e,this.dirty=false}},n5=class{constructor(e,t4,i,r,a){this.context=e,this.width=t4,this.height=i;let s=e.gl,n=this.framebuffer=s.createFramebuffer();if(this.colorAttachment=new r5(e,n),r)this.depthAttachment=a?new s5(e,n):new a5(e,n);else if(a)throw Error("Stencil cannot be set without depth")}destroy(){let e=this.context.gl,t4=this.colorAttachment.get();if(t4&&e.deleteTexture(t4),this.depthAttachment){let i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}e.deleteFramebuffer(this.framebuffer)}};const Cv=lp([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),Jt=Cv.offsets;function o5(e){return new up(e,tu.FrameUBO,Cv)}function l5(e,t4){let i=e.pending,{transform:r}=t4,a=t4.context.gl;i[Jt.u_units_to_pixels]=1/r.pixelsToGLUnits[0],i[Jt.u_units_to_pixels+1]=1/r.pixelsToGLUnits[1],i[Jt.u_world_size]=a.drawingBufferWidth,i[Jt.u_world_size+1]=a.drawingBufferHeight,i[Jt.u_camera_to_center_distance]=r.cameraToCenterDistance,i[Jt.u_symbol_fade_change]=t4.options.fadeDuration?t4.symbolFadeChange:1,i[Jt.u_aspect_ratio]=r.width/r.height,i[Jt.u_device_pixel_ratio]=t4.pixelRatio,i[Jt.u_viewport_size]=r.width,i[Jt.u_viewport_size+1]=r.height,i[Jt.u_pixel_extrude_scale]=1/r.width,i[Jt.u_pixel_extrude_scale+1]=1/r.height,i[Jt.u_pitch]=r.pitch/360*2*Math.PI,e.upload()}var tt=class{constructor(e,t4,i){this.blendFunction=e,this.blendColor=t4,this.mask=i}};tt.Replace=[1,0],tt.disabled=new tt(tt.Replace,oe.transparent,[false,false,false,false]),tt.unblended=new tt(tt.Replace,oe.transparent,[true,true,true,true]),tt.alphaBlended=new tt([1,771],oe.transparent,[true,true,true,true]);var u5=class{constructor(e){this.gl=e,this.clearColor=new DF(this),this.clearDepth=new CF(this),this.clearStencil=new PF(this),this.colorMask=new AF(this),this.depthMask=new IF(this),this.stencilMask=new MF(this),this.stencilFunc=new FF(this),this.stencilOp=new zF(this),this.stencilTest=new RF(this),this.depthRange=new kF(this),this.depthTest=new LF(this),this.depthFunc=new BF(this),this.blend=new OF(this),this.blendFunc=new $F(this),this.blendColor=new VF(this),this.blendEquation=new jF(this),this.cullFace=new UF(this),this.cullFaceSide=new NF(this),this.frontFace=new GF(this),this.program=new ZF(this),this.activeTexture=new qF(this),this.viewport=new WF(this),this.bindFramebuffer=new HF(this),this.bindRenderbuffer=new XF(this),this.bindTexture=new YF(this),this.bindVertexBuffer=new KF(this),this.bindElementBuffer=new JF(this),this.bindVertexArray=new QF(this),this.pixelStoreUnpack=new e5(this),this.pixelStoreUnpackPremultiplyAlpha=new t5(this),this.pixelStoreUnpackFlipY=new i5(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),e.getExtension("EXT_color_buffer_half_float"),e.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=S3(this),this.terrainUniformBuffer=C3(this),this.frameUniformBuffer=o5(this)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=true,this.clearDepth.dirty=true,this.clearStencil.dirty=true,this.colorMask.dirty=true,this.depthMask.dirty=true,this.stencilMask.dirty=true,this.stencilFunc.dirty=true,this.stencilOp.dirty=true,this.stencilTest.dirty=true,this.depthRange.dirty=true,this.depthTest.dirty=true,this.depthFunc.dirty=true,this.blend.dirty=true,this.blendFunc.dirty=true,this.blendColor.dirty=true,this.blendEquation.dirty=true,this.cullFace.dirty=true,this.cullFaceSide.dirty=true,this.frontFace.dirty=true,this.program.dirty=true,this.activeTexture.dirty=true,this.viewport.dirty=true,this.bindFramebuffer.dirty=true,this.bindRenderbuffer.dirty=true,this.bindTexture.dirty=true,this.bindVertexBuffer.dirty=true,this.bindElementBuffer.dirty=true,this.bindVertexArray.dirty=true,this.pixelStoreUnpack.dirty=true,this.pixelStoreUnpackPremultiplyAlpha.dirty=true,this.pixelStoreUnpackFlipY.dirty=true,this.projectionUniformBuffer.bindingDirty=true,this.terrainUniformBuffer.bindingDirty=true,this.frameUniformBuffer.bindingDirty=true}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,t4){return new EF(this,e,t4)}createVertexBuffer(e,t4,i){return new SF(this,e,t4,i)}createRenderbuffer(e,t4,i){let r=this.gl,a=r.createRenderbuffer();return this.bindRenderbuffer.set(a),r.renderbufferStorage(r.RENDERBUFFER,e,t4,i),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t4,i,r){return new n5(this,e,t4,i,r)}clear({color:e,depth:t4,stencil:i}){let r=this.gl,a=0;e&&(a|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([true,true,true,true])),t4!==void 0&&(a|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t4),this.depthMask.set(true)),i!==void 0&&(a|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(a)}setCullFace(e){e.enable===false?this.cullFace.set(false):(this.cullFace.set(true),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(false):(this.depthTest.set(true),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(false):(this.stencilTest.set(true),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){Vi(e.blendFunction,tt.Replace)?this.blend.set(false):(this.blend.set(true),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},_e=class{constructor(e,t4,i){this.func=e,this.mask=t4,this.range=i}};_e.ReadOnly=false,_e.ReadWrite=true,_e.disabled=new _e(519,_e.ReadOnly,[0,1]);const uh=7680;var Ce=class{constructor(e,t4,i,r,a,s){this.test=e,this.ref=t4,this.mask=i,this.fail=r,this.depthFail=a,this.pass=s}};Ce.disabled=new Ce({func:519,mask:0},0,0,uh,uh,uh);const Pg=1029,hh=2305;var Se=class{constructor(e,t4,i){this.enable=e,this.mode=t4,this.frontFace=i}};Se.disabled=new Se(false,Pg,hh),Se.backCCW=new Se(true,Pg,hh),Se.frontCCW=new Se(true,1028,hh);function h5(e,t4,i){let r=(t4==null?void 0:t4.transitionState)??0;return{currentPass:"offscreen",currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:false,transform:e,terrain:i,projectionTransition:r,isRenderingGlobe:r>0}}function zt(e,t4,i={}){return e.transform.getProjectionData({overscaledTileID:t4,aligned:i.aligned,applyGlobeMatrix:!e.isRenderingToTexture,applyTerrainMatrix:i.applyTerrainMatrix??true})}function jt(e,t4){var i;return e.isRenderingToTexture?null:((i=e.terrain)==null?void 0:i.getTerrainData(t4))??null}let Eo;function Ag(e,t4,i,r,a,s){let n=e.context,o=n.gl,l=e.useProgram("collisionBox"),u=[],h=0,c=0;for(let _ of r){let y=t4.getTile(_).getBucket(i);if(!y)continue;let x=a?y.textCollisionBox:y.iconCollisionBox,v=y.collisionCircleArray;v.length>0&&(u.push({circleArray:v,circleOffset:c,coord:_}),h+=v.length/4,c=h),x&&l.draw(n,o.LINES,_e.disabled,Ce.disabled,e.colorModeForRenderPass(),Se.disabled,null,jt(s,_),zt(s,_),i.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,e.transform.zoom,null,null,x.collisionVertexBuffer)}if(!a||!u.length)return;let d=e.useProgram("collisionCircle"),p=new f2;p.resize(h*4),p._trim();let f=0;for(let _ of u)for(let y=0;y<_.circleArray.length/4;y++){let x=y*4,v=_.circleArray[x+0],w=_.circleArray[x+1],b=_.circleArray[x+2],T=_.circleArray[x+3];p.emplace(f++,v,w,b,T,0),p.emplace(f++,v,w,b,T,1),p.emplace(f++,v,w,b,T,2),p.emplace(f++,v,w,b,T,3)}(!Eo||Eo.length<h*2)&&(Eo=c5(h));let m=n.createIndexBuffer(Eo,true),g=n.createVertexBuffer(p,RE.members,true);for(let _ of u)d.draw(n,o.TRIANGLES,_e.disabled,Ce.disabled,e.colorModeForRenderPass(),Se.disabled,null,jt(s,_.coord),null,i.id,g,m,We.simpleSegment(0,_.circleOffset*2,_.circleArray.length,_.circleArray.length/2),null,e.transform.zoom,null,null,null);g.destroy(),m.destroy()}function c5(e){let t4=e*2,i=new g2;i.resize(t4),i._trim();for(let r=0;r<t4;r++){let a=r*6;i.uint16[a+0]=r*4+0,i.uint16[a+1]=r*4+1,i.uint16[a+2]=r*4+2,i.uint16[a+3]=r*4+2,i.uint16[a+4]=r*4+3,i.uint16[a+5]=r*4+0}return i}const d5=Ii(new Float32Array(16));function p5(e,t4,i,r,a,s){if(s.currentPass!=="translucent")return;let n=Ce.disabled,o=e.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&m5(r,e,i,t4,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),a),i.paint.get("icon-opacity").constantOr(1)!==0&&Ig(e,t4,i,r,false,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment").constantOr("viewport"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),n,o,s),i.paint.get("text-opacity").constantOr(1)!==0&&Ig(e,t4,i,r,true,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),n,o,s),t4.map.showCollisionBoxes&&(Ag(e,t4,i,r,true,s),Ag(e,t4,i,r,false,s))}function f5(e,t4,i,r,a,s){let{horizontalAlign:n,verticalAlign:o}=Hl(e),l=-(n-.5)*t4,u=-(o-.5)*i;return new C((l/a+r[0])*s,(u/a+r[1])*s)}function m5(e,t4,i,r,a,s,n,o,l){var p;let u=t4.transform,h=t4.style.map.terrain,c=a==="map",d=s==="map";for(let f of e){let m=r.getTile(f),g=m.getBucket(i);if(!((p=g==null?void 0:g.text)!=null&&p.segments.get().length))continue;let _=g.textSizeData,y=Xl(_,u.zoom),x=si(m,1,t4.transform.zoom),v=ip(c,t4.transform,x),w=i.layout.get("icon-text-fit")!=="none"&&g.hasIconData();if(y){let b=2**(u.zoom-m.tileID.overscaledZ),T=h?(P,E)=>h.getElevation(f,P,E):void 0;_5(g,c,d,l,u,v,b,y,w,Dr(u,m,n,o),f.toUnwrapped(),T,i.layout.get("symbol-height-anchor")==="ground")}}}function g5(e,t4,i,r,a,s){let n=t4.tileAnchorPoint.add(new C(t4.translation[0],t4.translation[1]));if(t4.pitchWithMap){let o=r.mult(s);i||(o=o.rotate(-a));let l=n.add(o);return ap(l.x,l.y,t4.pitchedLabelPlaneMatrix,ra(t4,l.x,l.y)).point}if(i){let o=aa(t4.tileAnchorPoint.x+1,t4.tileAnchorPoint.y,t4).point.sub(e),l=Math.atan(o.y/o.x)+(o.x<0?Math.PI:0);return e.add(r.rotate(l))}return e.add(r)}function _5(e,t4,i,r,a,s,n,o,l,u,h,c,d){let p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let _=0;_<p.length;_++){let y=p.get(_),x=e.allowVerticalPlacement&&!y.placedOrientation,v=!y.hidden&&y.crossTileID&&!x?r[y.crossTileID]:null;if(!v)Ua(y.numGlyphs,f);else{let w=new C(y.anchorX,y.anchorY),b={getElevation:c,heightOffset:y.heightOffset,heightAnchorGround:d,width:a.width,height:a.height,pitchedLabelPlaneMatrix:s,pitchWithMap:i,transform:a,tileAnchorPoint:w,translation:u,unwrappedTileID:h},T=i?X1(w.x,w.y,b):aa(w.x,w.y,b),P=q1(a.cameraToCenterDistance,T.signedDistanceFromCamera),E=zd(e.textSizeData,o,y)*P/24;i&&(E*=e.tilePixelRatio/n);let{width:I,height:R,anchor:z,textOffset:S,textBoxScale:A}=v,D=f5(z,I,R,S,A,E),M=a.getPitchedTextCorrection(w.x+u[0],w.y+u[1],h),L=g5(T.point,b,t4,D,-a.bearingInRadians,M),O=e.allowVerticalPlacement&&y.placedOrientation===2?Math.PI/2:0;for(let N=0;N<y.numGlyphs;N++)pl(f,L,O);l&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:L,angle:O})}}if(l){m.clear();let _=e.icon.placedSymbolArray;for(let y=0;y<_.length;y++){let x=_.get(y);if(x.hidden)Ua(x.numGlyphs,m);else{let v=g[y];if(!v)Ua(x.numGlyphs,m);else for(let w=0;w<x.numGlyphs;w++)pl(m,v.shiftedAnchor,v.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function y5(e,t4,i){return i.iconsInText&&t4?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function Ig(e,t4,i,r,a,s,n,o,l,u,h,c,d){let p=e.context,f=p.gl,m=e.transform,g=o==="map",_=l==="map",y=o!=="viewport"&&i.layout.get("symbol-placement")!=="point",x=g&&!_&&!y,v=!i.layout.get("symbol-sort-key").isConstant(),w=false,b=e.getDepthModeForSublayer(0,_e.ReadOnly),T=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),P=[],E=m.getCircleRadiusCorrection();for(let z of r){let S=t4.getTile(z),A=S.getBucket(i);if(!A)continue;let D=a?A.text:A.icon;if(!(D!=null&&D.segments.get().length)||!D.hasVisibleVertices)continue;let M=D.programConfigurations.get(i.id),L=a||A.sdfIcons,O=a?A.textSizeData:A.iconSizeData,N=_||m.pitch!==0,J=e.useProgram(y5(L,a,A),M),fe=Xl(O,m.zoom),xe=jt(d,z),le,$e=[0,0],Pe,Ve,ke=null,ft;if(a){if(Pe=S.glyphAtlasTexture,Ve=f.LINEAR,le=S.glyphAtlasTexture.size,A.iconsInText){$e=S.imageAtlasTexture.size,ke=S.imageAtlasTexture;let Z=O.kind==="composite"||O.kind==="camera";ft=N||e.options.rotating||e.options.zooming||Z?f.LINEAR:f.NEAREST}}else{let Z=i.layout.get("icon-size").constantOr(0)!==1||A.iconsNeedLinear;Pe=S.imageAtlasTexture,Ve=L||e.options.rotating||e.options.zooming||Z||N?f.LINEAR:f.NEAREST,le=S.imageAtlasTexture.size}let Rt=si(S,1,e.transform.zoom),Ut=ip(g,e.transform,Rt),Nt=xM(_,g,e.transform,Rt),Tt=Dr(m,S,s,n),st=zt(d,z),Yt=T&&A.hasTextData(),wi=i.layout.get("icon-text-fit")!=="none"&&Yt&&A.hasIconData(),ni=i._unevaluatedLayout.hasValue("icon-offset"),q=i.layout.get("symbol-height-anchor")==="ground";if(y){let Z=Ir();gM(Z,Ut);let we=e.style.map.terrain?(Te,se)=>e.style.map.terrain.getElevation(z,Te,se):void 0;wM(A,e,a,Ut,Z,_,u,i.layout.get("text-rotation-alignment")==="map",z.toUnwrapped(),m.width,m.height,Tt,we)}let ye=a&&T||wi,re=_?Ut:e.transform.clipSpaceToPixelsMatrix,$=y||ye?d5:re,ve=L&&i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0,ee;ee=L?A.iconsInText?fF(O.kind,fe,x,_,y,ye,e,$,Nt,Tt,le,$e,E,ni,q):Dv(O.kind,fe,x,_,y,ye,e,$,Nt,Tt,a,le,ve,E,ni,q):Sv(O.kind,fe,x,_,y,ye,e,$,Nt,Tt,a,le,E,ni,q);let ae={program:J,buffers:D,uniformValues:ee,projectionData:st,atlasTexture:Pe,atlasTextureIcon:ke,atlasInterpolation:Ve,atlasInterpolationIcon:ft,isSDF:L,hasHalo:ve};if(v&&A.canOverlap){w=true;let Z=D.segments.get();for(let we of Z)P.push({segments:new We([we]),sortKey:we.sortKey,state:ae,terrainData:xe})}else P.push({segments:D.segments,sortKey:0,state:ae,terrainData:xe})}w&&P.sort((z,S)=>z.sortKey-S.sortKey);let I=i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,R=i.layout.get("text-letter-spacing").constantOr(0)*24<0||I>1;for(let z of P){let S=z.state;p.activeTexture.set(f.TEXTURE0),S.atlasTexture.bind(S.atlasInterpolation,f.CLAMP_TO_EDGE),S.atlasTextureIcon&&(p.activeTexture.set(f.TEXTURE1),S.atlasTextureIcon&&S.atlasTextureIcon.bind(S.atlasInterpolationIcon,f.CLAMP_TO_EDGE));let A=S.isSDF&&S.hasHalo;if(A){let D=S.uniformValues;D.u_is_halo=1,R&&(D.u_is_plain=0,Mg(S.buffers,z.segments,i,e,S.program,b,h,c,D,S.projectionData,z.terrainData),D.u_is_halo=0,D.u_is_plain=1)}Mg(S.buffers,z.segments,i,e,S.program,b,h,c,S.uniformValues,S.projectionData,z.terrainData),A&&!R&&(S.uniformValues.u_is_halo=0)}}function Mg(e,t4,i,r,a,s,n,o,l,u,h){let c=r.context,d=c.gl;a.draw(c,d.TRIANGLES,s,n,o,Se.backCCW,l,h,u,i.id,e.layoutVertexBuffer,e.indexBuffer,t4,i.paint,r.transform.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function v5(e,t4,i,r,a){if(a.currentPass!=="translucent")return;let s=i.paint.get("circle-opacity"),n=i.paint.get("circle-stroke-width"),o=i.paint.get("circle-stroke-opacity"),l=!i.layout.get("circle-sort-key").isConstant();if(s.constantOr(1)===0&&(n.constantOr(1)===0||o.constantOr(1)===0))return;let u=e.context,h=u.gl,c=e.transform,d=e.getDepthModeForSublayer(0,_e.ReadOnly),p=Ce.disabled,f=e.colorModeForRenderPass(),m=[],g=c.getCircleRadiusCorrection();for(let _ of r){let y=t4.getTile(_),x=y.getBucket(i);if(!x)continue;let v=i.paint.get("circle-translate"),w=i.paint.get("circle-translate-anchor"),b=Dr(c,y,v,w),T=x.programConfigurations.get(i.id),P=e.useProgram("circle",T),E=x.layoutVertexBuffer,I=x.indexBuffer,R=jt(a,_),z={programConfiguration:T,program:P,layoutVertexBuffer:E,indexBuffer:I,uniformValues:N3(e,y,i,b,g),terrainData:R,projectionData:zt(a,_)};if(l){let S=x.segments.get();for(let A of S)m.push({segments:new We([A]),sortKey:A.sortKey,state:z})}else m.push({segments:x.segments,sortKey:0,state:z})}l&&m.sort((_,y)=>_.sortKey-y.sortKey);for(let _ of m){let{programConfiguration:y,program:x,layoutVertexBuffer:v,indexBuffer:w,uniformValues:b,terrainData:T,projectionData:P}=_.state,E=_.segments;x.draw(u,h.TRIANGLES,d,p,f,Se.backCCW,b,T,P,i.id,v,w,E,i.paint,e.transform.zoom,y)}}function x5(e,t4,i,r,a){if(i.paint.get("heatmap-opacity")===0)return;let s=e.context;if(e.style.map.terrain){for(let n of r){let o=t4.getTile(n);t4.hasRenderableParent(n)||(a.currentPass==="offscreen"?T5(e,o,i,n,a):a.currentPass==="translucent"&&E5(e,i,n,a))}s.viewport.set([0,0,e.width,e.height])}else a.currentPass==="offscreen"?b5(e,t4,i,r,a):a.currentPass==="translucent"&&w5(e,i)}function b5(e,t4,i,r,a){let s=e.context,n=s.gl,o=e.transform,l=Ce.disabled,u=new tt([n.ONE,n.ONE],oe.transparent,[true,true,true,true]);S5(s,e,i),s.clear({color:oe.transparent});for(let h of r){if(t4.hasRenderableParent(h))continue;let c=t4.getTile(h),d=c.getBucket(i);if(!d)continue;let p=d.programConfigurations.get(i.id),f=e.useProgram("heatmap",p),m=zt(a,h,{applyTerrainMatrix:false}),g=o.getCircleRadiusCorrection();f.draw(s,n.TRIANGLES,_e.disabled,l,u,Se.backCCW,wv(c,o.zoom,i.paint.get("heatmap-intensity"),g),null,m,i.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,i.paint,o.zoom,p)}s.viewport.set([0,0,e.width,e.height])}function w5(e,t4){let i=e.context,r=i.gl;i.setColorMode(e.colorModeForRenderPass());let a=t4.heatmapFbos.get(sl);a&&(i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),i.activeTexture.set(r.TEXTURE1),Av(i,t4).bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,r.TRIANGLES,_e.disabled,Ce.disabled,e.colorModeForRenderPass(),Se.disabled,Tv(e,t4,0,1),null,null,t4.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t4.paint,e.transform.zoom))}function T5(e,t4,i,r,a){let s=e.context,n=s.gl,o=Ce.disabled,l=new tt([n.ONE,n.ONE],oe.transparent,[true,true,true,true]),u=t4.getBucket(i);if(!u)return;let h=r.key,c=i.heatmapFbos.get(h);c||(c=Pv(s,t4.tileSize,t4.tileSize),i.heatmapFbos.set(h,c)),s.bindFramebuffer.set(c.framebuffer),s.viewport.set([0,0,t4.tileSize,t4.tileSize]),s.clear({color:oe.transparent});let d=u.programConfigurations.get(i.id),p=e.useProgram("heatmap",d,!a.isRenderingGlobe),f=zt(a,t4.tileID),m=jt(a,r);p.draw(s,n.TRIANGLES,_e.disabled,o,l,Se.disabled,wv(t4,e.transform.zoom,i.paint.get("heatmap-intensity"),1),m,f,i.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,i.paint,e.transform.zoom,d)}function E5(e,t4,i,r){let a=e.context,s=a.gl,n=e.transform;a.setColorMode(e.colorModeForRenderPass());let o=Av(a,t4),l=i.key,u=t4.heatmapFbos.get(l);if(!u)return;a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u.colorAttachment.get()),a.activeTexture.set(s.TEXTURE1),o.bind(s.LINEAR,s.CLAMP_TO_EDGE);let h=zt(r,i,{applyTerrainMatrix:r.isRenderingGlobe});e.useProgram("heatmapTexture").draw(a,s.TRIANGLES,_e.disabled,Ce.disabled,e.colorModeForRenderPass(),Se.disabled,Tv(e,t4,0,1),null,h,t4.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t4.paint,n.zoom),u.destroy(),t4.heatmapFbos.delete(l)}function S5(e,t4,i){let r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,t4.width/4,t4.height/4]);let a=i.heatmapFbos.get(sl);a?(r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)):(a=Pv(e,t4.width/4,t4.height/4),i.heatmapFbos.set(sl,a))}function Pv(e,t4,i){let r=e.gl,a=r.createTexture();r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texStorage2D(r.TEXTURE_2D,1,r.RGBA16F,t4,i);let s=e.createFramebuffer(t4,i,false,false);return s.colorAttachment.set(a),s}function Av(e,t4){return t4.colorRampTexture||(t4.colorRampTexture=new dt(e,t4.colorRamp,e.gl.RGBA)),t4.colorRampTexture}function Iv(e,t4,i){let r=e.context,a=r.bindFramebuffer.get(),s=r.viewport.get(),[,,n,o]=s;return D5(e,n,o),r.viewport.set([0,0,n,o]),r.clear({color:oe.transparent,depth:1,stencil:0}),e.currentStencilSource=void 0,e.renderTileClippingMasks(t4,i),{compositeTarget:a,compositeViewport:s}}function D5(e,t4,i){let r=e.context.gl;if(!e.layerOpacityFbo){let s=e.context.createFramebuffer(t4,i,true,true),n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t4,i,0,r.RGBA,r.UNSIGNED_BYTE,null),s.colorAttachment.set(n),s.depthAttachment.set(e.context.createRenderbuffer(r.DEPTH_STENCIL,t4,i)),e.layerOpacityFbo=s,e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}if(e.layerOpacityFbo.width===t4&&e.layerOpacityFbo.height===i){e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}let a=e.layerOpacityFbo;r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t4,i,0,r.RGBA,r.UNSIGNED_BYTE,null),e.context.bindRenderbuffer.set(a.depthAttachment.get()),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t4,i),e.context.bindRenderbuffer.set(null),a.width=t4,a.height=i,e.context.bindFramebuffer.set(a.framebuffer)}function Mv(e,t4,i,r){let a=e.context,s=a.gl;a.bindFramebuffer.set(i.compositeTarget),a.viewport.set(i.compositeViewport),a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,e.layerOpacityFbo.colorAttachment.get()),e.useProgram("layerOpacity").draw(a,s.TRIANGLES,_e.disabled,Ce.disabled,e.colorModeForRenderPass(),Se.disabled,hF(t4,0),null,null,r.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,r.paint,e.transform.zoom),e.currentStencilSource=void 0}function Fv(e,t4,i,r,a,s,n,o){let l=256;if(a.stepInterpolant){let u=t4.getSource().maxzoom,h=n.canonical.z===u?Math.ceil(1<<e.transform.maxZoom-n.canonical.z):1,c=s.maxLineLength/k*1024*h;l=ne(zx(c),256,i.maxTextureSize)}return o.gradient=s0({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:o.gradient||void 0,clips:s.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new dt(i,o.gradient,r.RGBA),o.version=a.gradientVersion,o.texture}function C5(e,t4,i,r,a){e.activeTexture.set(t4.TEXTURE0),i.imageAtlasTexture.bind(t4.LINEAR,t4.CLAMP_TO_EDGE),r.updatePaintBuffers(a)}function P5(e,t4,i,r,a,s){(a||e.lineAtlas.dirty)&&(t4.activeTexture.set(i.TEXTURE0),e.lineAtlas.bind(t4)),r.updatePaintBuffers(s)}function A5(e,t4,i,r,a,s,n){let o=s.gradients[a.id],l=o.texture;a.gradientVersion!==o.version&&(l=Fv(e,t4,i,r,a,s,n,o)),i.activeTexture.set(r.TEXTURE0),l.bind(a.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE)}function I5(e,t4,i,r,a,s,n,o,l){let u=s.gradients[a.id],h=u.texture;a.gradientVersion!==u.version&&(h=Fv(e,t4,i,r,a,s,n,u)),i.activeTexture.set(r.TEXTURE0),h.bind(a.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),i.activeTexture.set(r.TEXTURE1),e.lineAtlas.bind(i),o.updatePaintBuffers(l)}function M5(e,t4,i,r,a){if(a.currentPass!=="translucent")return;let s=i.paint.get("line-opacity"),n=i.paint.get("line-width"),o=i.paint.get("line-layer-opacity");if(s.constantOr(1)!==0&&n.constantOr(1)!==0&&o!==0){if(o<1){let l=Iv(e,i,r);Fg(e,t4,i,r,a),Mv(e,o,l,i);return}Fg(e,t4,i,r,a)}}function Fg(e,t4,i,r,a){let s=e.getDepthModeForSublayer(0,_e.ReadOnly),n=e.colorModeForRenderPass(),o=i.paint.get("line-dasharray"),l=o.constantOr(1),u=i.paint.get("line-pattern"),h=u.constantOr(1),c=i.paint.get("line-gradient"),d=i.getCrossfadeParameters(),p;p=h?"linePattern":l&&c?"lineGradientSDF":l?"lineSDF":c?"lineGradient":"line";let f=e.context,m=f.gl,g=e.transform,_=true;for(let y of r){let x=t4.getTile(y);if(h&&!x.patternsLoaded())continue;let v=x.getBucket(i);if(!v)continue;let w=v.programConfigurations.get(i.id),b=e.context.program.get(),T=e.useProgram(p,w),P=_||T.program!==b,E=jt(a,y),I=u.constantOr(null),R=o==null?void 0:o.constantOr(null);if(I&&x.imageAtlas){let M=x.imageAtlas,L=M.patternPositions[I.to.toString()],O=M.patternPositions[I.from.toString()];L&&O&&w.setConstantPatternPositions(L,O)}else if(R){let M=i.layout.get("line-cap").constantOr(null)==="round",L=e.lineAtlas.getDash(R.to,M),O=e.lineAtlas.getDash(R.from,M);w.setConstantDashPositions(L,O)}let z=zt(a,y),S=g.getPixelScale(),A;h?(A=nF(e,x,i,S,d),C5(f,m,x,w,d)):l&&c?(A=lF(e,x,i,S,d,v.lineClipsArray.length),I5(e,t4,f,m,i,v,y,w,d)):l?(A=oF(e,x,i,S,d),P5(e,f,m,w,P,d)):c?(A=sF(e,x,i,S,v.lineClipsArray.length),A5(e,t4,f,m,i,v,y)):A=iu(e,x,i,S);let D=e.stencilModeForClipping(y);T.draw(f,m.TRIANGLES,s,D,n,Se.disabled,A,E,z,i.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,i.paint,e.transform.zoom,w,v.layoutVertexBuffer2),_=false}}function zv(e,t4,i,r,a){if(!i||!(r!=null&&r.imageAtlas))return;let s=r.imageAtlas.patternPositions,n=s[i.to.toString()],o=s[i.from.toString()];if(!n&&o&&(n=o),!o&&n&&(o=n),!n||!o){let l=a.getPaintProperty(t4);n=s[l],o=s[l]}n&&o&&e.setConstantPatternPositions(n,o)}function F5(e,t4,i,r,a){let s=i.paint.get("fill-color"),n=i.paint.get("fill-opacity"),o=i.paint.get("fill-layer-opacity");if(n.constantOr(1)===0||o===0)return;if(o<1){if(a.currentPass!=="translucent")return;let h=Iv(e,i,r);zg(e,t4,i,r,a),Mv(e,o,h,i);return}let l=i.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&s.constantOr(oe.transparent).a===1&&n.constantOr(0)===1;if(u&&a.currentPass==="opaque"){let h=e.colorModeForRenderPass();dp(e,t4,i,r,e.getDepthModeForSublayer(1,_e.ReadWrite),h,false,a);return}if(u&&a.currentPass==="translucent"){Rv(e,t4,i,r,a);return}a.currentPass==="translucent"&&zg(e,t4,i,r,a)}function zg(e,t4,i,r,a){let s=e.colorModeForRenderPass();dp(e,t4,i,r,e.getDepthModeForSublayer(1,_e.ReadOnly),s,false,a),Rv(e,t4,i,r,a)}function Rv(e,t4,i,r,a){if(!i.paint.get("fill-antialias"))return;let s=e.colorModeForRenderPass();dp(e,t4,i,r,e.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,_e.ReadOnly),s,true,a)}function dp(e,t4,i,r,a,s,n,o){let l=e.context.gl,u="fill-pattern",h=i.paint.get(u),c=h==null?void 0:h.constantOr(1),d=i.getCrossfadeParameters(),p,f,m,g,_,y=e.transform,x=i.paint.get("fill-translate"),v=i.paint.get("fill-translate-anchor");n?(f=c&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=l.LINES):(f=c?"fillPattern":"fill",p=l.TRIANGLES);let w=h.constantOr(null);for(let b of r){let T=t4.getTile(b);if(c&&!T.patternsLoaded())continue;let P=T.getBucket(i);if(!P)continue;let E=P.sdfPatterns[i.id]??false,I=P.programConfigurations.get(i.id),R=e.useProgram(f,I),z=jt(o,b);c&&(e.context.activeTexture.set(l.TEXTURE0),T.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),I.updatePaintBuffers(d)),zv(I,u,w,T,i);let S=zt(o,b),A=Dr(y,T,x,v);n?(g=P.indexBuffer2,_=P.segments2,m=f==="fillOutlinePattern"&&c?j3(e,d,T,A,E):V3(A)):(g=P.indexBuffer,_=P.segments,m=c?bv(e,d,T,A,E):$3(A));let D=e.stencilModeForClipping(b);R.draw(e.context,p,a,D,s,Se.backCCW,m,z,S,i.id,P.layoutVertexBuffer,g,_,i.paint,e.transform.zoom,I)}}function z5(e,t4,i,r,a){let s=i.paint.get("fill-extrusion-opacity");if(s!==0&&a.currentPass==="translucent"){let n=new _e(e.context.gl.LEQUAL,_e.ReadWrite,a.depthRangeFor3D);if(s===1&&!i.paint.get("fill-extrusion-pattern").constantOr(1)){let o=e.colorModeForRenderPass();ch(e,t4,i,r,n,Ce.disabled,o,a)}else ch(e,t4,i,r,n,Ce.disabled,tt.disabled,a),ch(e,t4,i,r,n,e.stencilModeFor3D(),e.colorModeForRenderPass(),a)}}function ch(e,t4,i,r,a,s,n,o){let l=e.context,u=l.gl,h="fill-extrusion-pattern",c=i.paint.get(h),d=c.constantOr(1),p=i.getCrossfadeParameters(),f=i.paint.get("fill-extrusion-opacity"),m=c.constantOr(null),g=e.transform;for(let _ of r){let y=t4.getTile(_),x=y.getBucket(i);if(!x)continue;let v=jt(o,_),w=x.programConfigurations.get(i.id),b=e.useProgram(d?"fillExtrusionPattern":"fillExtrusion",w);d&&(e.context.activeTexture.set(u.TEXTURE0),y.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),w.updatePaintBuffers(p));let T=zt(o,_);zv(w,h,m,y,i);let P=Dr(g,y,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),E=i.paint.get("fill-extrusion-vertical-gradient"),I=d?R3(e,E,f,P,_,p,y):xv(e,E,f,P);b.draw(l,l.gl.TRIANGLES,a,s,n,Se.backCCW,I,v,T,i.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,i.paint,e.transform.zoom,w,e.style.map.terrain&&x.centroidVertexBuffer)}}function R5(e,t4,i,r,a){if(a.currentPass!=="offscreen"&&a.currentPass!=="translucent")return;let s=e.context,n=e.style.projection.useSubdivision,o=e.getDepthModeForSublayer(0,_e.ReadOnly),l=e.colorModeForRenderPass();if(a.currentPass==="offscreen")k5(e,t4,r,i,o,Ce.disabled,l),s.viewport.set([0,0,e.width,e.height]);else if(a.currentPass==="translucent")if(n){let[u,h,c]=e.stencilConfigForOverlapTwoPass(r);dh(e,t4,i,c,u,o,l,false,a),dh(e,t4,i,c,h,o,l,true,a)}else{let[u,h]=e.getStencilConfigForOverlapAndUpdateStencilID(r);dh(e,t4,i,h,u,o,l,false,a)}}function dh(e,t4,i,r,a,s,n,o,l){let u=e.style.projection,h=e.context,c=h.gl,d=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],p=e.useProgram("hillshade",null,false,d),f=!e.options.moving;for(let m of r){let g=t4.getTile(m),_=g.fbo;if(!_)continue;let y=u.getMeshFromTileID(h,m.canonical,o,true,"raster"),x=jt(l,m);h.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,_.colorAttachment.get());let v=zt(l,m,{aligned:f});p.draw(h,c.TRIANGLES,s,a[m.overscaledZ],n,Se.backCCW,X3(e,g,i),x,v,i.id,y.vertexBuffer,y.indexBuffer,y.segments)}}function k5(e,t4,i,r,a,s,n){let o=e.context,l=o.gl,u=r.paint.get("resampling")==="nearest"?l.NEAREST:l.LINEAR;for(let h of i){let c=t4.getTile(h),d=c.dem;if(!(d!=null&&d.data)||!c.needsHillshadePrepare)continue;let p=d.dim+2,f=d.stride,m=d.getPixels();if(o.activeTexture.set(l.TEXTURE1),o.pixelStoreUnpackPremultiplyAlpha.set(false),c.demTexture||(c.demTexture=e.getTileTexture(f)),c.demTexture){let _=c.demTexture;_.update(m,{premultiply:false}),_.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else c.demTexture=new dt(o,m,l.RGBA,{premultiply:false}),c.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);o.activeTexture.set(l.TEXTURE0);let g=c.fbo;if(!g){let _=new dt(o,{width:p,height:p,data:null},l.RGBA);_.bind(u,l.CLAMP_TO_EDGE),g=c.fbo=o.createFramebuffer(p,p,true,false),g.colorAttachment.set(_.texture)}o.bindFramebuffer.set(g.framebuffer),o.viewport.set([0,0,p,p]),e.useProgram("hillshadePrepare").draw(o,l.TRIANGLES,a,s,n,Se.disabled,Y3(c.tileID,d),null,null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),c.needsHillshadePrepare=false}}function L5(e,t4,i,r,a){if(a.currentPass!=="translucent"||!r.length)return;let s=e.style.projection.useSubdivision,n=e.getDepthModeForSublayer(0,_e.ReadOnly),o=e.colorModeForRenderPass();if(s){let[l,u,h]=e.stencilConfigForOverlapTwoPass(r);ph(e,t4,i,h,l,n,o,false,a),ph(e,t4,i,h,u,n,o,true,a)}else{let[l,u]=e.getStencilConfigForOverlapAndUpdateStencilID(r);ph(e,t4,i,u,l,n,o,false,a)}}let Rg=0;function ph(e,t4,i,r,a,s,n,o,l){let u=e.style.projection,h=e.context,c=h.gl,d=e.useProgram("colorRelief"),p=!e.options.moving,f=i.paint.get("resampling")==="nearest"?c.NEAREST:c.LINEAR,m=true,g=0;for(let _ of r){let y=t4.getTile(_),x=y.dem;if(!(x!=null&&x.data))continue;if(m){Rg||(Rg=c.getParameter(c.MAX_TEXTURE_SIZE));let P=Rg,{elevationTexture:E,colorTexture:I}=i.getColorRampTextures(h,P,x.getUnpackVector());h.activeTexture.set(c.TEXTURE1),E.bind(c.NEAREST,c.CLAMP_TO_EDGE),h.activeTexture.set(c.TEXTURE4),I.bind(c.LINEAR,c.CLAMP_TO_EDGE),m=false,g=E.size[0]}let v=x.stride;h.activeTexture.set(c.TEXTURE0),(!y.demTexture||y.needsColorReliefPrepare)&&(h.pixelStoreUnpackPremultiplyAlpha.set(false),y.demTexture||(y.demTexture=e.getTileTexture(v)??new dt(h,{width:v,height:v,data:null},c.RGBA)),y.demTexture.update(x.getPixels(),{premultiply:false}),y.needsColorReliefPrepare=false),y.demTexture.bind(f,c.CLAMP_TO_EDGE);let w=u.getMeshFromTileID(h,_.canonical,o,true,"raster"),b=jt(l,_),T=zt(l,_,{aligned:p});d.draw(h,c.TRIANGLES,s,a[_.overscaledZ],n,Se.backCCW,Q3(i,y.dem,g),b,T,i.id,w.vertexBuffer,w.indexBuffer,w.segments)}}const fh=[new C(0,0),new C(k,0),new C(k,k),new C(0,k)];function B5(e,t4,i,r,a){if(a.currentPass!=="translucent"||i.paint.get("raster-opacity")===0||!r.length)return;let s=t4.getSource(),n=e.style.projection.useSubdivision;if(s instanceof Pn)So(e,t4,i,r,null,false,false,s.tileCoords,s.imageWarp,s.flippedWindingOrder,a,s.getMesh(e.context,n));else if(n){let[o,l,u]=e.stencilConfigForOverlapTwoPass(r);So(e,t4,i,u,o,false,true,fh,ja,false,a),So(e,t4,i,u,l,true,true,fh,ja,false,a)}else{let[o,l]=e.getStencilConfigForOverlapAndUpdateStencilID(r);So(e,t4,i,l,o,false,true,fh,ja,false,a)}}function So(e,t4,i,r,a,s,n,o,l,u=false,h,c=null){let d=r[r.length-1].overscaledZ,p=e.context,f=p.gl,m=e.useProgram("raster"),g=e.style.projection,_=e.colorModeForRenderPass(),y=!e.options.moving,x=i.paint.get("raster-opacity"),v=i.paint.get("resampling")==="nearest"||i.paint.get("raster-resampling")==="nearest"?f.NEAREST:f.LINEAR,w=i.paint.get("raster-fade-duration"),b=!!e.style.map.terrain;for(let T of r){let P=e.getDepthModeForSublayer(T.overscaledZ-d,x===1?_e.ReadWrite:_e.ReadOnly,f.LESS),E=t4.getTile(T);p.activeTexture.set(f.TEXTURE0),E.texture.bind(v,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(f.TEXTURE1);let{parentTile:I,parentScaleBy:R,parentTopLeft:z,fadeValues:S}=O5(E,t4,w,b);E.fadeOpacity=S.tileOpacity,I?(I.fadeOpacity=S.parentTileOpacity,I.texture.bind(v,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)):E.texture.bind(v,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),E.texture.useMipmap&&p.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&f.texParameterf(f.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let A=jt(h,T),D=zt(h,T,{aligned:y}),M=OI(z,R,S.fadeMix,i,o,l),L=c??g.getMeshFromTileID(p,T.canonical,s,n,"raster"),O=a?a[T.overscaledZ]:Ce.disabled;m.draw(p,f.TRIANGLES,P,O,_,u?Se.frontCCW:Se.backCCW,M,A,D,i.id,L.vertexBuffer,L.indexBuffer,L.segments)}}function O5(e,t4,i,r){let a={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(i===0||r)return a;if(e.fadingParentID){let s=t4.getLoadedTile(e.fadingParentID);if(!s)return a;let n=2**(s.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:s,parentScaleBy:n,parentTopLeft:[e.tileID.canonical.x*n%1,e.tileID.canonical.y*n%1],fadeValues:$5(e,s,i)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:V5(e,i)}:a}function $5(e,t4,i){let r=ze(),a=(r-e.timeAdded)/i,s=(r-t4.timeAdded)/i,n=e.fadingDirection===1,o=ne(a,0,1),l=ne(1-s,0,1),u=n?o:l;return{tileOpacity:u,parentTileOpacity:n?l:o,fadeMix:{opacity:1,mix:1-u}}}function V5(e,t4){let i=(ze()-e.timeAdded)/t4,r=ne(i,0,1);return{tileOpacity:r,fadeMix:{opacity:r,mix:0}}}function j5(e,t4,i,r,a){let s=i.paint.get("background-color"),n=i.paint.get("background-opacity");if(n===0)return;let o=e.context,l=o.gl,u=e.style.projection,h=e.transform,c=h.tileSize,d=i.paint.get("background-pattern");if(e.isPatternMissing(d))return;let p=!d&&s.a===1&&n===1&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.currentPass!==p)return;let f=Ce.disabled,m=e.getDepthModeForSublayer(0,p==="opaque"?_e.ReadWrite:_e.ReadOnly),g=e.colorModeForRenderPass(),_=e.useProgram(d?"backgroundPattern":"background"),y=r||ss(h,{tileSize:c,terrain:e.style.map.terrain});d&&(o.activeTexture.set(l.TEXTURE0),e.patternAtlas.bind(e.context));let x=i.getCrossfadeParameters();for(let v of y){let w=zt(a,v),b=d?yF(n,e,d,{tileID:v,tileSize:c},x):_F(n,s),T=jt(a,v),P=u.getMeshFromTileID(o,v.canonical,false,true,"raster");_.draw(o,l.TRIANGLES,m,f,g,Se.backCCW,b,T,w,i.id,P.vertexBuffer,P.indexBuffer,P.segments)}}const U5=new oe(1,0,0,1),N5=new oe(0,1,0,1),G5=new oe(0,0,1,1),Z5=new oe(1,0,1,1),q5=new oe(0,1,1,1);function W5(e){let t4=e.transform.padding;kg(e,e.transform.height-(t4.top||0),3,U5),kg(e,t4.bottom||0,3,N5),Lg(e,t4.left||0,3,G5),Lg(e,e.transform.width-(t4.right||0),3,Z5);let i=e.transform.centerPoint;H5(e,i.x,e.transform.height-i.y,q5)}function H5(e,t4,i,r){El(e,t4-1,i-10,2,20,r),El(e,t4-10,i-1,20,2,r)}function kg(e,t4,i,r){El(e,0,t4+i/2,e.transform.width,i,r)}function Lg(e,t4,i,r){El(e,t4-i/2,0,i,e.transform.height,r)}function El(e,t4,i,r,a,s){let n=e.context,o=n.gl;o.enable(o.SCISSOR_TEST),o.scissor(t4*e.pixelRatio,i*e.pixelRatio,r*e.pixelRatio,a*e.pixelRatio),n.clear({color:s}),o.disable(o.SCISSOR_TEST)}function X5(e,t4,i,r){for(let a of i)Y5(e,t4,a,r)}function Y5(e,t4,i,r){var y;let a=e.context,s=a.gl,n=e.useProgram("debug"),o=_e.disabled,l=Ce.disabled,u=e.colorModeForRenderPass(),h="$debug",c=jt(r,i);a.activeTexture.set(s.TEXTURE0);let d=((y=t4.getTileByID(i.key).latestRawTileData)==null?void 0:y.byteLength)||0,p=Math.floor(d/1024),f=t4.getTile(i).tileSize,m=512/Math.min(f,512)*(i.overscaledZ/e.transform.zoom)*.5,g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=` => ${i.overscaledZ}`),K5(e,`${g} ${p}kB`);let _=zt(r,i);n.draw(a,s.TRIANGLES,o,l,tt.alphaBlended,Se.disabled,Dg(oe.transparent,m),null,_,h,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),n.draw(a,s.LINE_STRIP,o,l,u,Se.disabled,Dg(oe.red),c,_,h,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function K5(e,t4){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,r=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,i.width,i.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t4,5,5),a.strokeText(t4,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}function J5(e,t4){let i=null,r=Object.values(e._layers).flatMap(o=>o.source&&!o.isHidden(t4)?[e.tileManagers[o.source]]:[]),a=r.filter(o=>o.getSource().type==="vector"),s=r.filter(o=>o.getSource().type!=="vector"),n=o=>{(!i||i.getSource().maxzoom<o.getSource().maxzoom)&&(i=o)};for(let o of a)n(o);if(!i)for(let o of s)n(o);return i}function Q5(e,t4,i,r){let{isRenderingGlobe:a}=r,s=e.context,n=i.implementation,o=e.style.projection,l=e.transform,u=l.getProjectionDataForCustomLayer(a),h={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:o.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
822
+ uniform mat4 u_projection_matrix;
823
+ ${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:u,getProjectionData:d=>l.getProjectionData({overscaledTileID:new St(d.tileID.canonical.z,d.tileID.wrap??0,d.tileID.canonical.z,d.tileID.canonical.x,d.tileID.canonical.y),aligned:d.aligned,applyGlobeMatrix:d.applyGlobeMatrix,applyTerrainMatrix:d.applyTerrainMatrix})},c=n.renderingMode?n.renderingMode:"2d";if(r.currentPass==="offscreen"){let d=n.prerender;d&&(e.setCustomLayerDefaults(),s.setColorMode(e.colorModeForRenderPass()),d.call(n,s.gl,h),s.setDirty(),e.setBaseState())}else if(r.currentPass==="translucent"){e.setCustomLayerDefaults(),s.setColorMode(e.colorModeForRenderPass()),s.setStencilMode(Ce.disabled);let d=c==="3d"?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,_e.ReadOnly);s.setDepthMode(d),n.render(s.gl,h),s.setDirty(),e.setBaseState(),s.bindFramebuffer.set(null)}}function ez(e,t4){let i=e.context,r=i.gl,a=e.transform,s=tt.unblended,n=new _e(r.LEQUAL,_e.ReadWrite,[0,1]),o=t4.tileManager.getRenderableTiles(),l=e.useProgram("terrainDepth");i.bindFramebuffer.set(t4.getFramebuffer().framebuffer),i.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),i.clear({color:oe.white,depth:1});for(let u of o){let h=t4.getTerrainMesh(u.tileID),c=t4.getTerrainData(u.tileID),d=a.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:false,applyGlobeMatrix:true}),p=w3(t4.getSkirtLength(a.zoom));l.draw(i,r.TRIANGLES,n,Ce.disabled,s,Se.backCCW,p,c,d,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height])}function tz(e,t4,i,r){let{isRenderingGlobe:a}=r,s=e.context,n=s.gl,o=e.transform,l=e.colorModeForRenderPass(),u=e.getDepthModeFor3D(),h=e.useProgram("terrain");s.bindFramebuffer.set(null),s.viewport.set([0,0,e.width,e.height]);for(let c of i){let d=t4.getTerrainMesh(c.tileID),p=e.renderToTexture.getTexture(c),f=t4.getTerrainData(c.tileID);s.activeTexture.set(n.TEXTURE0),p.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_LINEAR);let m=t4.getSkirtLength(o.zoom),g=o.calculateFogMatrix(c.tileID.toUnwrapped()),_=b3(m,g,e.style.sky,o.pitch,a),y=zt(r,c.tileID,{applyTerrainMatrix:false});h.draw(s,n.TRIANGLES,u,Ce.disabled,l,Se.backCCW,_,f,y,"terrain",d.vertexBuffer,d.indexBuffer,d.segments)}}function kv(e,t4){if(!t4.mesh){let i=new Tr;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);let r=new Qi;r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),t4.mesh=new Cn(e.createVertexBuffer(i,Zr.members),e.createIndexBuffer(r),We.simpleSegment(0,0,i.length,r.length))}return t4.mesh}function iz(e,t4){let i=e.context,r=i.gl,a=wF(t4,e.transform,e.pixelRatio),s=new _e(r.LEQUAL,_e.ReadWrite,[0,1]),n=Ce.disabled,o=e.colorModeForRenderPass(),l=e.useProgram("sky"),u=kv(i,t4);l.draw(i,r.TRIANGLES,s,n,o,Se.disabled,a,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function rz(e,t4){let i=e.getCartesianPosition();cx(i,i);let r=Ii(new Float64Array(16));return e.properties.get("anchor")==="map"&&(br(r,r,t4.rollInRadians),Na(r,r,-t4.pitchInRadians),br(r,r,t4.bearingInRadians),Na(r,r,t4.center.lat*Math.PI/180),Jg(r,r,-t4.center.lng*Math.PI/180)),dx(i,i,r),i}function az(e,t4,i){let r=e.context,a=r.gl,s=e.useProgram("atmosphere"),n=new _e(a.LEQUAL,_e.ReadOnly,[0,1]),o=e.transform,l=rz(i,e.transform),u=o.getProjectionData({overscaledTileID:null,applyGlobeMatrix:true,applyTerrainMatrix:true}),h=es(o.worldSize,o.center.lat),c=hv(o),d=cv(Ci(c)-h,h),p=t4.properties.get("atmosphere-blend")*u.projectionTransition*d;if(p===0)return;let f=xF(l,p,c,h,o.inverseProjectionMatrix),m=kv(r,t4);s.draw(r,a.TRIANGLES,n,Ce.disabled,tt.alphaBlended,Se.disabled,f,null,null,"atmosphere",m.vertexBuffer,m.indexBuffer,m.segments)}const sz={symbol:p5,circle:v5,heatmap:x5,line:M5,fill:F5,fillExtrusion:z5,hillshade:R5,colorRelief:L5,raster:B5,background:j5,sky:iz,atmosphere:az,custom:Q5,debug:X5,debugPadding:W5,terrainDepth:ez};var Jr,nz=(Jr=class{constructor(t4,i){this.drawFunctions=sz,this.context=new u5(t4),this.transform=i,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:true,matrix:Ii(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=$c.maxOverzooming+$c.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new J1}resize(t4,i,r){if(this.width=Math.floor(t4*r),this.height=Math.floor(i*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let a of this.style._order)this.style._layers[a].resize()}setup(){let t4=this.context,i=new Tr;i.emplaceBack(0,0),i.emplaceBack(k,0),i.emplaceBack(0,k),i.emplaceBack(k,k),this.tileExtentBuffer=t4.createVertexBuffer(i,Zr.members),this.tileExtentSegments=We.simpleSegment(0,0,4,2);let r=new Tr;r.emplaceBack(0,0),r.emplaceBack(k,0),r.emplaceBack(0,k),r.emplaceBack(k,k),this.debugBuffer=t4.createVertexBuffer(r,Zr.members),this.debugSegments=We.simpleSegment(0,0,4,5);let a=new s2;a.emplaceBack(0,0,0,0),a.emplaceBack(k,0,k,0),a.emplaceBack(0,k,0,k),a.emplaceBack(k,k,k,k),this.rasterBoundsBuffer=t4.createVertexBuffer(a,g3.members),this.rasterBoundsSegments=We.simpleSegment(0,0,4,2);let s=new Tr;s.emplaceBack(0,0),s.emplaceBack(k,0),s.emplaceBack(0,k),s.emplaceBack(k,k),this.rasterBoundsBufferPosOnly=t4.createVertexBuffer(s,Zr.members),this.rasterBoundsSegmentsPosOnly=We.simpleSegment(0,0,4,5);let n=new Tr;n.emplaceBack(0,0),n.emplaceBack(1,0),n.emplaceBack(0,1),n.emplaceBack(1,1),this.viewportBuffer=t4.createVertexBuffer(n,Zr.members),this.viewportSegments=We.simpleSegment(0,0,4,2);let o=new _2;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t4.createIndexBuffer(o);let l=new Qi;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t4.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new Ce({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new Cn(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t4=this.context,i=t4.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=Ir();$i(r,0,this.width,this.height,0,0,1),Dt(r,r,[i.drawingBufferWidth,i.drawingBufferHeight,0]);let a={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r,clipAntimeridian:false};this.useProgram("clippingMask",null,true).draw(t4,i.TRIANGLES,_e.disabled,this.stencilClearMode,tt.disabled,Se.disabled,null,null,a,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t4,i){if(this.currentStencilSource===t4.source||!t4.isTileClipped()||!(i!=null&&i.length))return;this.currentStencilSource=t4.source,this.nextStencilID+i.length>256&&this.clearStencil();let r=this.context;r.setColorMode(tt.disabled),r.setDepthMode(_e.disabled);let a={};for(let s of i)a[s.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,i,true),this._renderTileMasks(a,i,false),this._tileClippingMaskIDs=a}_renderTileMasks(t4,i,r){let a=this.context,s=a.gl,n=this.style.projection,o=this.renderContext,l=this.useProgram("clippingMask");for(let u of i){let h=t4[u.key],c=jt(o,u),d=n.getMeshFromTileID(this.context,u.canonical,r,true,"stencil"),p=zt(o,u);l.draw(a,s.TRIANGLES,_e.disabled,new Ce({func:s.ALWAYS,mask:0},h,255,s.KEEP,s.KEEP,s.REPLACE),tt.disabled,o.isRenderingToTexture?Se.disabled:Se.backCCW,null,c,p,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}_renderTilesDepthBuffer(){let t4=this.context,i=t4.gl,r=this.style.projection,a=this.transform,s=this.useProgram("depth"),n=this.getDepthModeFor3D(),o=ss(a,{tileSize:a.tileSize});for(let l of o){let u=jt(this.renderContext,l),h=r.getMeshFromTileID(this.context,l.canonical,true,true,"raster"),c=zt(this.renderContext,l);s.draw(t4,i.TRIANGLES,n,Ce.disabled,tt.disabled,Se.backCCW,null,u,c,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t4=this.nextStencilID++,i=this.context.gl;return new Ce({func:i.NOTEQUAL,mask:255},t4,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(t4){let i=this.context.gl;return new Ce({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[t4.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t4){let i=this.context.gl,r=t4.sort((n,o)=>o.overscaledZ-n.overscaledZ),a=r[r.length-1].overscaledZ,s=r[0].overscaledZ-a+1;if(s>1){this.currentStencilSource=void 0,this.nextStencilID+s>256&&this.clearStencil();let n={};for(let o=0;o<s;o++)n[o+a]=new Ce({func:i.GEQUAL,mask:255},o+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=s,[n,r]}return[{[a]:Ce.disabled},r]}stencilConfigForOverlapTwoPass(t4){let i=this.context.gl,r=t4.sort((n,o)=>o.overscaledZ-n.overscaledZ),a=r[r.length-1].overscaledZ,s=r[0].overscaledZ-a+1;if(this.clearStencil(),s>1){let n={},o={};for(let l=0;l<s;l++)n[l+a]=new Ce({func:i.GREATER,mask:255},s+1+l,255,i.KEEP,i.KEEP,i.REPLACE),o[l+a]=new Ce({func:i.GREATER,mask:255},1+l,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=s*2+1,[n,o,r]}return this.nextStencilID=3,[{[a]:new Ce({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[a]:new Ce({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},r]}colorModeForRenderPass(){let t4=this.context.gl;if(this._showOverdrawInspector){let i=.125;return new tt([t4.CONSTANT_COLOR,t4.ONE],new oe(i,i,i,0),[true,true,true,true])}return this.renderContext.currentPass==="opaque"?tt.unblended:tt.alphaBlended}getDepthModeForSublayer(t4,i,r){if(!this.opaquePassEnabledForLayer())return _e.disabled;let a=1-((1+this.renderContext.currentLayer)*this.numSublayers+t4)*this.depthEpsilon;return new _e(r||this.context.gl.LEQUAL,i,[a,a])}getDepthModeFor3D(){return new _e(this.context.gl.LEQUAL,_e.ReadWrite,this.renderContext.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderContext.currentLayer<this.renderContext.opaquePassCutoff}render(t4,i){var h;this.style=t4,this.options=i;let r=this.renderContext=h5(this.transform,t4.projection,t4.map.terrain??null);this.lineAtlas=t4.lineAtlas,this.imageManager=t4.imageManager,this.patternAtlas=t4.patternAtlas,this.glyphManager=t4.glyphManager,this.symbolFadeChange=t4.placement.symbolFadeChange(ze()),l5(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let a=this.style._order,s=this.style.tileManagers,n={},o={},l={};for(let c in s){let d=s[c];d.used&&d.prepare(this.context),n[c]=d.getVisibleCoordinates(false),o[c]=n[c].slice().reverse(),l[c]=d.getVisibleCoordinates(true).reverse()}r.opaquePassCutoff=1/0;for(let c=0;c<a.length;c++){let d=a[c];if(this.style._layers[d].is3D()){r.opaquePassCutoff=c;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),r.opaquePassCutoff=0),r.currentPass="offscreen";for(let c of a){let d=this.style._layers[c];if(!d.hasOffscreenPass()||d.isHidden(this.transform.zoom))continue;let p=o[d.source];(d.type==="custom"||p.length)&&this.renderLayer(this,s[d.source],d,p,r)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?oe.black:oe.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,r.depthRangeFor3D=[0,1-(t4._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(r.currentPass="opaque",r.currentLayer=a.length-1;r.currentLayer>=0;r.currentLayer--){let c=this.style._layers[a[r.currentLayer]];if(c.isHidden(this.transform.zoom))continue;let d=s[c.source],p=n[c.source];this.renderTileClippingMasks(c,p),this.renderLayer(this,d,c,p,r)}r.currentPass="translucent";let u=false;for(r.currentLayer=0;r.currentLayer<a.length;r.currentLayer++){let c=this.style._layers[a[r.currentLayer]];if(c.isHidden(this.transform.zoom))continue;let d=s[c.source];if((h=this.renderToTexture)!=null&&h.renderLayer(c,r))continue;!this.opaquePassEnabledForLayer()&&!u&&(u=true,r.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let p=(c.type==="symbol"?l:o)[c.source];this.renderTileClippingMasks(c,n[c.source]),this.renderLayer(this,d,c,p,r)}if(r.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let c=J5(this.style,this.transform.zoom);c&&this.drawFunctions.debug(this,c,c.getVisibleCoordinates(),r)}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.renderToTexture&&!this.options.moving&&this.clearRTTPool(),this.context.setDefault()}markTerrainDepthDirty(){this.terrainFacilitator.depthDirty=true}maybeDrawDepth(){var a,s;if(!((a=this.style)!=null&&a.projection)||!((s=this.style.map)!=null&&s.terrain))return;let t4=this.terrainFacilitator.matrix,i=this.transform.modelViewProjectionMatrix,r=this.terrainFacilitator.depthDirty;r||(r=!ux(t4,i)),r||(r=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),r&&(ax(t4,i),this.terrainFacilitator.renderTime=ze(),this.terrainFacilitator.depthDirty=false,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(t4,i,r,a,s){if(r.isHidden(this.transform.zoom)||r.type!=="background"&&r.type!=="custom"&&!(a||[]).length)return;this.id=r.id;let n=this.drawFunctions;Y0(r)?n.symbol(t4,i,r,a,this.style.placement.variableOffsets,s):Z2(r)?n.circle(t4,i,r,a,s):Y2(r)?n.heatmap(t4,i,r,a,s):AE(r)?n.line(t4,i,r,a,s):UT(r)?n.fill(t4,i,r,a,s):dE(r)?n.fillExtrusion(t4,i,r,a,s):tT(r)?n.hillshade(t4,i,r,a,s):oT(r)?n.colorRelief(t4,i,r,a,s):Vh(r)?n.raster(t4,i,r,a,s):MD(r)?n.background(t4,i,r,a,s):RD(r)&&n.custom(t4,i,r,s)}saveTileTexture(t4){let i=this._tileTextures[t4.size[0]];i?i.length<Jr.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?i.push(t4):t4.destroy():this._tileTextures[t4.size[0]]=[t4]}getTileTexture(t4){let i=this._tileTextures[t4];return i&&i.length>0?i.pop():null}acquireRTT(t4){let i=this.context.gl,r=this._rttObjectRecyclePool.pop();if(r)return r.size!==t4&&(r.texture.update({width:t4,height:t4,data:null},{premultiply:false,useMipmap:true}),r.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),r.size=t4),r;let a=new dt(this.context,{width:t4,height:t4,data:null},i.RGBA,{premultiply:false,useMipmap:true});return a.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:a,size:t4}}bindRTT(t4){let i=this.context.gl,r=t4.size;if(!this._rttSharedFbo){let a=this.context.createFramebuffer(r,r,true,true),s=this.context.createRenderbuffer(i.DEPTH_STENCIL,r,r);a.depthAttachment.set(s),this._rttSharedFbo={fbo:a,depthRenderbuffer:s,size:r}}this._rttSharedFbo.size!==r&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,r,r),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=r,this._rttSharedFbo.fbo.height=r,this._rttSharedFbo.size=r),this._rttSharedFbo.fbo.colorAttachment.set(t4.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t4){this._rttObjectRecyclePool.push(t4)}clearRTTPool(){for(let t4 of this._rttObjectRecyclePool)t4.texture.destroy();this._rttObjectRecyclePool.length=0}destroyRTTResources(){if(this.clearRTTPool(),!this._rttSharedFbo)return;this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t4=this.context.gl;t4.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t4.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}isPatternMissing(t4){if(!t4)return false;if(!t4.from||!t4.to)return true;let i=this.patternAtlas.getPattern(t4.from.toString()),r=this.patternAtlas.getPattern(t4.to.toString());return!i||!r}useProgram(t4,i,r=false,a=[]){var m;this.cache||(this.cache={});let s=!!this.style.map.terrain,n=this.style.projection,o=r?Gi.projectionMercator:n.shaderPreludeCode,l=r?Q1:n.shaderDefine,u=`/${r?ev:n.shaderVariantName}`,h=i?i.cacheKey:"",c=this._showOverdrawInspector?"/overdraw":"",d=s?"/terrain":"",p=a?`/${a.join("/")}`:"",f=t4+h+u+c+d+p;return(m=this.cache)[f]||(m[f]=new I3(this.context,Gi[t4],i,TF[t4],this._showOverdrawInspector,s,o,l,a)),this.cache[f]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let t4=this.context.gl;this.context.cullFace.set(false),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t4.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t4=this.context.gl;this.debugOverlayTexture=new dt(this.context,this.debugOverlayCanvas,t4.RGBA)}}destroy(){var t4,i,r;if(this._tileTextures){for(let a in this._tileTextures){let s=this._tileTextures[a];if(s)for(let n of s)n.destroy()}this._tileTextures={}}if(this.destroyRTTResources(),(t4=this.layerOpacityFbo)==null||t4.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((i=this.tileExtentMesh.vertexBuffer)==null||i.destroy()),this.tileExtentMesh&&((r=this.tileExtentMesh.indexBuffer)==null||r.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let a in this.cache){let s=this.cache[a];s!=null&&s.program&&this.context.gl.deleteProgram(s.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t4,drawingBufferHeight:i}=this.context.gl;return this.width!==t4||this.height!==i}},Jr.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50,Jr),oz=class extends Error{constructor(e,t4){super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=e,this.statusMessage=(t4==null?void 0:t4.statusMessage)??null}};function pp(e,t4){let i=false,r=null,a,s=()=>{r=null,i&&(i=(e(...a),r=setTimeout(s,t4),false))};return(...n)=>(i=true,a=n,r||s(),r)}var lz=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let t4=this._getHashParams();return this._hashName?(t4.get(this._hashName)||"").split("/"):([...t4.keys()][0]??"").split("/")},this._onHashChange=()=>{let t4=this._getCurrentHash();if(!this._isValidHash(t4))return false;let i=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t4[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t4[2],+t4[1]],zoom:+t4[0],bearing:i,pitch:+(t4[4]||0)}),true},this._updateHashUnthrottled=()=>{let t4=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t4)},this._removeHash=()=>{let t4=this._getHashParams();if(this._hashName)t4.delete(this._hashName);else{let s=Array.from(t4.keys());s.length>0&&t4.delete(s[0])}let i=decodeURIComponent(t4.toString()).replace(/=&/g,"&").replace(/=$/g,""),r=i?`#${i}`:"",a=window.location.href.replace(/(#.+)?$/,r);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=pp(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,false),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,false),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t4=this._map.getCenter(),i=Math.round(this._map.getZoom()*100)/100,r=10**Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(t4.lng*r)/r,s=Math.round(t4.lat*r)/r,n=this._map.getBearing(),o=this._map.getPitch(),l="";if(l+=e?`/${a}/${s}/${i}`:`${i}/${s}/${a}`,(n||o)&&(l+=`/${Math.round(n*10)/10}`),o&&(l+=`/${Math.round(o)}`),this._hashName){let u=this._getHashParams();return u.set(this._hashName,l),`#${decodeURIComponent(u.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${l}`}_isValidHash(e){if(e.length<3||e.some(a=>isNaN(+a)))return false;try{new H(+e[2],+e[1])}catch{return false}let t4=+e[0],i=+(e[3]||0),r=+(e[4]||0);return t4>=this._map.getMinZoom()&&t4<=this._map.getMaxZoom()&&i>=-180&&i<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}};const An={linearity:.3,easing:Kc(0,0,.3,1)},uz=W({deceleration:2500,maxSpeed:1400},An),hz=W({deceleration:20,maxSpeed:1400},An),cz=W({deceleration:1e3,maxSpeed:360},An),dz=W({deceleration:1e3,maxSpeed:90},An),pz=W({deceleration:1e3,maxSpeed:360},An);var fz=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ze(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t4=ze();for(;e.length>0&&t4-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t4=ze()-60,i=Math.max(0,e.length-2);for(;i>0&&e[i-1].time>=t4;)i--;return e.slice(i)}_onMoveEnd(e){this._drainInertiaBuffer();let t4=this._getVelocityEntries();if(t4.length<2){this.clear();return}let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new C(0,0),pinchAround:void 0,around:void 0};for(let{settings:s}of t4)s.around&&(i.around=s.around),s.pinchAround&&(i.pinchAround=s.pinchAround);for(let{settings:s}of t4.slice(1))i.zoom+=s.zoomDelta||0,i.bearing+=s.bearingDelta||0,i.pitch+=s.pitchDelta||0,i.roll+=s.rollDelta||0,s.panDelta&&i.pan._add(s.panDelta);if(!i.pan.mag()&&!i.zoom&&!i.bearing&&!i.pitch&&!i.roll){this.clear();return}let r=ze()-t4[0].time,a={};if(i.pan.mag()){let s=Ps(i.pan.mag(),r,W({},uz,e||{})),n=i.pan.mult(s.amount/i.pan.mag()),o=this._map._camera.cameraHelper.handlePanInertia(n,this._map._camera.transform);a.center=o.easingCenter,a.offset=o.easingOffset,Cs(a,s)}if(i.zoom){let s=Ps(i.zoom,r,hz);a.zoom=ii(this._map.getZoom()+s.amount,this._map.getZoomSnap(),s.amount),Cs(a,s)}if(i.bearing){let s=Ps(i.bearing,r,cz);a.bearing=this._map.getBearing()+ne(s.amount,-179,179),Cs(a,s)}if(i.pitch){let s=Ps(i.pitch,r,dz);a.pitch=this._map.getPitch()+s.amount,Cs(a,s)}if(i.roll){let s=Ps(i.roll,r,pz);a.roll=this._map.getRoll()+ne(s.amount,-179,179),Cs(a,s)}if(a.zoom||a.bearing){let s=i.pinchAround===void 0?i.around:i.pinchAround;a.around=s?this._map.unproject(s):this._map.getCenter()}return this.clear(),W(a,{noMoveStart:true})}};function Cs(e,t4){(!e.duration||e.duration<t4.duration)&&(e.duration=t4.duration,e.easing=t4.easing)}function Ps(e,t4,i){let{maxSpeed:r,linearity:a,deceleration:s}=i,n=ne(e*a/(t4/1e3),-r,r),o=Math.abs(n)/(s*a);return{easing:i.easing,duration:o*1e3,amount:o/2*n}}var mz=class{constructor(e,t4){this._map=e,this._clickTolerance=t4.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new LA(this._map,e))}mousedown(e,t4){return this._mousedownPos=t4,this._firePreventable(new ri(e.type,this._map,e))}mouseup(e){this._map.fire(new ri(e.type,this._map,e))}click(e,t4){this._mousedownPos&&this._mousedownPos.dist(t4)>=this._clickTolerance||this._map.fire(new ri(e.type,this._map,e))}dblclick(e){return this._firePreventable(new ri(e.type,this._map,e))}mouseover(e){this._map.fire(new ri(e.type,this._map,e))}mouseout(e){this._map.fire(new ri(e.type,this._map,e))}touchstart(e){return this._firePreventable(new fo(e.type,this._map,e))}touchmove(e){this._map.fire(new fo(e.type,this._map,e))}touchend(e){this._map.fire(new fo(e.type,this._map,e))}touchcancel(e){this._map.fire(new fo(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return true}isActive(){return false}enable(){}disable(){}},gz=class{constructor(e,t4){this._map=e,this._clickTolerance=t4.clickTolerance}reset(){this._delayContextMenu=false,this._ignoreContextMenu=true,delete this._contextMenuEvent,this._clearLongPress(),this._touchActive=false}mousemove(e){this._map.fire(new ri(e.type,this._map,e))}mousedown(){this._delayContextMenu=true,this._ignoreContextMenu=false}mouseup(){this._delayContextMenu=false,this._contextMenuEvent&&(this._map.fire(new ri("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}touchstart(e,t4,i){if(this._clearLongPress(),this._touchActive=i.length>0,i.length!==1)return;this._longPressStart=t4[0];let r=i[0];this._longPressTimer=setTimeout(()=>{this._longPressTimer=void 0;let a=new MouseEvent("contextmenu",{clientX:r.clientX,clientY:r.clientY,button:2,bubbles:true,cancelable:true});this._map.fire(new ri("contextmenu",this._map,a))},500)}touchmove(e,t4,i){this._longPressTimer&&(i.length!==1||!this._longPressStart||t4[0].dist(this._longPressStart)>this._clickTolerance)&&this._clearLongPress()}touchend(){this._touchActive=false,this._clearLongPress()}touchcancel(){this._touchActive=false,this._clearLongPress()}_clearLongPress(){this._longPressTimer&&(this._longPressTimer=(clearTimeout(this._longPressTimer),void 0)),this._longPressStart=void 0}contextmenu(e){if(this._touchActive){e.preventDefault();return}this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new ri(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return true}isActive(){return false}enable(){}disable(){}},_z=class{constructor(e,t4,i){this._map=e,this._tr=i,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t4.clickTolerance||1,t4.boxZoom&&typeof t4.boxZoom=="object"&&(this._boxZoomEnd=t4.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=true)}disable(){this.isEnabled()&&(this._enabled=false)}mousedown(e,t4){this.isEnabled()&&e.shiftKey&&e.button===0&&(ie.disableDrag(),this._startPos=this._lastPos=t4,this._active=true)}mousemoveWindow(e,t4){if(!this._active)return;let i=t4;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=ie.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let a=Math.min(r.x,i.x),s=Math.max(r.x,i.x),n=Math.min(r.y,i.y),o=Math.max(r.y,i.y);this._box.style.transform=`translate(${a}px,${n}px)`,this._box.style.width=`${s-a}px`,this._box.style.height=`${o-n}px`}mouseupWindow(e,t4){if(!this._active||e.button!==0)return;let i=this._startPos,r=t4;if(this.reset(),ie.suppressClick(),i.x===r.x&&i.y===r.y)this._fireEvent("boxzoomcancel",e);else{if(this._map.fire(new Rm("boxzoomend",{originalEvent:e})),this._boxZoomEnd){this._boxZoomEnd(this._map,i,r,e);return}return{cameraAnimation:a=>a.fitScreenCoordinates(i,r,this._tr.bearing,{linear:true})}}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=false,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box=(this._box.remove(),null)),ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t4){return this._map.fire(new Rm(e,{originalEvent:t4}))}};function Zc(e,t4){if(e.length!==t4.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t4.length}`);let i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t4[r];return i}function yz(e){let t4=new C(0,0);for(let i of e)t4._add(i);return t4.div(e.length)}var vz=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=false}touchstart(e,t4,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=true),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=yz(t4),this.touches=Zc(i,t4)))}touchmove(e,t4,i){if(this.aborted||!this.centroid)return;let r=Zc(i,t4);for(let a in this.touches){let s=this.touches[a],n=r[a];(!n||n.dist(s)>30)&&(this.aborted=true)}}touchend(e,t4,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=true),i.length===0){let r=!this.aborted&&this.centroid;if(this.reset(),r)return r}}},qc=class{constructor(e){this.singleTap=new vz(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t4,i){this.singleTap.touchstart(e,t4,i)}touchmove(e,t4,i){this.singleTap.touchmove(e,t4,i)}touchend(e,t4,i){let r=this.singleTap.touchend(e,t4,i);if(r){let a=e.timeStamp-this.lastTime<500,s=!this.lastTap||this.lastTap.dist(r)<30;if((!a||!s)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}},xz=class{constructor(e,t4){this._tr=t4,this._zoomIn=new qc({numTouches:1,numTaps:2}),this._zoomOut=new qc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=false,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t4,i){this._zoomIn.touchstart(e,t4,i),this._zoomOut.touchstart(e,t4,i)}touchmove(e,t4,i){this._zoomIn.touchmove(e,t4,i),this._zoomOut.touchmove(e,t4,i)}touchend(e,t4,i){let r=this._zoomIn.touchend(e,t4,i),a=this._zoomOut.touchend(e,t4,i),s=this._tr;if(r)return this._active=true,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:n=>n.easeTo({duration:300,zoom:ii(s.zoom+1,n.getZoomSnap()),around:s.unproject(r)},{originalEvent:e})};if(a)return this._active=true,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:n=>n.easeTo({duration:300,zoom:ii(s.zoom-1,n.getZoomSnap()),around:s.unproject(a)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=true}disable(){this._enabled=false,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},In=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=false,this._moved=false,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t4=this._moveFunction(...e);if(t4.bearingDelta||t4.pitchDelta||t4.rollDelta||t4.around||t4.panDelta)return this._active=true,t4}dragStart(e,t4){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t4)?t4[0]:t4,this._activateOnStart&&this._lastPoint&&(this._active=true))}dragMove(e,t4){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let r=Array.isArray(t4)?t4[0]:t4;if(!(!this._moved&&r.dist(i)<this._clickTolerance))return this._moved=true,this._lastPoint=r,this._move(i,r)}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ie.suppressClick(),this.reset(e))}enable(){this._enabled=true}disable(){this._enabled=false,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};const bz={0:1,2:2};function wz(e,t4){let i=bz[t4];return e.buttons===void 0||(e.buttons&i)!==i}var Mn=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!wz(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}},Tz=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}},Ez=class{constructor(e=new Mn({checkCorrectEvent:()=>true}),t4=new Tz){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t4}_executeRelevantHandler(e,t4,i){if(e instanceof MouseEvent)return t4(e);if(typeof TouchEvent<"u"&&e instanceof TouchEvent)return i(e)}startMove(e){this._executeRelevantHandler(e,t4=>{this.mouseMoveStateManager.startMove(t4)},t4=>{this.oneFingerTouchMoveStateManager.startMove(t4)})}endMove(e){this._executeRelevantHandler(e,t4=>{this.mouseMoveStateManager.endMove(t4)},t4=>{this.oneFingerTouchMoveStateManager.endMove(t4)})}isValidStartEvent(e){return!!this._executeRelevantHandler(e,t4=>this.mouseMoveStateManager.isValidStartEvent(t4),t4=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t4))}isValidMoveEvent(e){return!!this._executeRelevantHandler(e,t4=>this.mouseMoveStateManager.isValidMoveEvent(t4),t4=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t4))}isValidEndEvent(e){return!!this._executeRelevantHandler(e,t4=>this.mouseMoveStateManager.isValidEndEvent(t4),t4=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t4))}};const ru=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=t4=>{t4.preventDefault()}};function Sz({enable:e,clickTolerance:t4}){return new In({clickTolerance:t4,move:(i,r)=>({around:r,panDelta:r.sub(i)}),activateOnStart:true,moveStateManager:new Mn({checkCorrectEvent:i=>i.button===0&&!i.ctrlKey}),enable:e,assignEvents:ru})}function Dz({enable:e,clickTolerance:t4,aroundCenter:i=true,minPixelCenterThreshold:r=100,rotateSpeed:a=.8},s){return new In({clickTolerance:t4,move:(n,o)=>{let l=s();if(i&&Math.abs(l.y-n.y)>r)return{bearingDelta:a_(new C(n.x,o.y),o,l)};let u=(o.x-n.x)*a;return i&&o.y<l.y&&(u=-u),{bearingDelta:u}},moveStateManager:new Mn({checkCorrectEvent:n=>n.button===0&&n.ctrlKey||n.button===2&&!n.ctrlKey}),enable:e,assignEvents:ru})}function Cz({enable:e,clickTolerance:t4,pitchSpeed:i=-.5}){return new In({clickTolerance:t4,move:(r,a)=>({pitchDelta:(a.y-r.y)*i}),moveStateManager:new Mn({checkCorrectEvent:r=>r.button===0&&r.ctrlKey||r.button===2}),enable:e,assignEvents:ru})}function Pz({enable:e,clickTolerance:t4,rollDegreesPerPixelMoved:i=.3},r){return new In({clickTolerance:t4,move:(a,s)=>{let n=r(),o=(s.x-a.x)*i;return s.y<n.y&&(o=-o),{rollDelta:o}},moveStateManager:new Mn({checkCorrectEvent:a=>a.button===2&&a.ctrlKey}),enable:e,assignEvents:ru})}var Az=class{constructor(e,t4){this._clickTolerance=e.clickTolerance||1,this._map=t4,this.reset()}reset(){this._active=false,this._touches={},this._sum=new C(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t4,i){return this._calculateTransform(e,t4,i)}touchmove(e,t4,i){if(this._active){if(this._shouldBePrevented(i.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,t4,i)}}touchend(e,t4,i){this._calculateTransform(e,t4,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t4,i){i.length>0&&(this._active=true);let r=Zc(i,t4),a=new C(0,0),s=new C(0,0),n=0;for(let l in r){let u=r[l],h=this._touches[l];h&&(a._add(u),s._add(u.sub(h)),n++,r[l]=u)}if(this._touches=r,this._shouldBePrevented(n)||!s.mag())return;let o=s.div(n);if(this._sum._add(o),!(this._sum.mag()<this._clickTolerance))return{around:a.div(n),panDelta:o}}enable(){this._enabled=true}disable(){this._enabled=false,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},fp=class{constructor(){this.reset()}reset(){this._active=false,delete this._firstTwoTouches}touchstart(e,t4,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t4[0],t4[1]]))}touchmove(e,t4,i){if(!this._firstTwoTouches)return;e.preventDefault();let[r,a]=this._firstTwoTouches,s=Do(i,t4,r),n=Do(i,t4,a);if(!s||!n)return;let o=this._aroundCenter?null:s.add(n).div(2);return this._move([s,n],o,e)}touchend(e,t4,i){if(!this._firstTwoTouches)return;let[r,a]=this._firstTwoTouches,s=Do(i,t4,r),n=Do(i,t4,a);s&&n||(this._active&&ie.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=true,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=false,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function Do(e,t4,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t4[r]}const Bg=.1;function Og(e,t4){return Math.log(e/t4)/Math.LN2}var Iz=class extends fp{constructor(){super(),this._zoomRate=1,this._zoomThreshold=Bg}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??Bg}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t4){let i=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(Og(this._distance,this._startDistance))<this._zoomThreshold))return this._active=true,{zoomDelta:Og(this._distance,i)*this._zoomRate,pinchAround:t4}}};function $g(e,t4){return e.angleWith(t4)*180/Math.PI}var Mz=class extends fp{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t4,i){let r=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=true,{bearingDelta:$g(this._vector,r),pinchAround:t4}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t4=25/(Math.PI*this._minDiameter)*360,i=$g(e,this._startVector);return Math.abs(i)<t4}};function mh(e){return Math.abs(e.y)>Math.abs(e.x)}var Fz=class extends fp{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t4,i){super.touchstart(e,t4,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,mh(e[0].sub(e[1]))&&(this._valid=false)}_move(e,t4,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(r,a,i.timeStamp),this._valid)return this._lastPoints=e,this._active=true,{pitchDelta:(r.y+a.y)/2*-.5}}gestureBeginsVertically(e,t4,i){if(this._valid!==void 0)return this._valid;let r=e.mag()>=2,a=t4.mag()>=2;if(!r&&!a)return;if(!r||!a)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<100&&void 0;let s=e.y>0==t4.y>0;return mh(e)&&mh(t4)&&s}};const zz={panStep:100,bearingStep:15,pitchStep:10};var Rz=class{constructor(e,t4){this._tr=t4;let i=zz;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=false}reset(){this._active=false}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t4=0,i=0,r=0,a=0,s=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t4=1;break;case 189:case 109:case 173:t4=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),s=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:n=>{let o=this._tr;n.easeTo({duration:300,easeId:"keyboardHandler",easing:kz,zoom:t4?ii(o.zoom+t4*(e.shiftKey?2:1),n.getZoomSnap()):o.zoom,bearing:o.bearing+i*this._bearingStep,pitch:o.pitch+r*this._pitchStep,offset:[-a*this._panStep,-s*this._panStep],center:o.center},{originalEvent:e})}}}enable(){this._enabled=true}disable(){this._enabled=false,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=true}enableRotation(){this._rotationDisabled=false}};function kz(e){return e*(2-e)}const Vg=4.000244140625;var Lz=class{constructor(e,t4,i){this._onTimeout=r=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)},this._map=e,this._tr=i,this._triggerRenderFrame=t4,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=true,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=false)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):false}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let t4=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,i=ze(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,t4!==0&&t4%Vg==0?this._type="wheel":t4!==0&&Math.abs(t4)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=t4,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t4)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t4+=this._lastValue)),e.shiftKey&&t4&&(t4/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t4,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=false,this._active=true,this.isZooming()||(this._zooming=true),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t4=ie.mousePos(this._map.getCanvas(),e),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(H.convert(i.center)):t4,this._needsRerender||(this._needsRerender=true,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=false,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let n=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=n),typeof this._targetZoom=="number"&&(this._targetZoom+=n)}if(this._delta!==0){let n=this._type==="wheel"&&Math.abs(this._delta)>Vg?this._wheelZoomRate:this._defaultZoomRate,o=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&o!==0&&(o=1/o);let l=typeof this._targetZoom=="number"?$t(this._targetZoom):e.scale,u=e.applyConstrain(e.getCameraLngLat(),It(l*o)).zoom,h=this._map.getZoomSnap();if(this._type==="wheel"&&h>0){let c=ii(e.zoom,h);this._targetZoom=ii(u,h,u-c)}else this._targetZoom=u;this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t4=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,i=this._startZoom,r=this._easing,a=false,s;if(this._type==="wheel"&&i&&r){let n=ze()-this._lastWheelEventTime,o=Math.min((n+5)/200,1),l=r(o);s=He.number(i,t4,l),o<1?this._needsRerender=true:a=true}else s=t4,a=true;return this._active=true,a&&(this._active=false,this._finishTimeout=setTimeout(()=>{this._zooming=false,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=s,{noInertia:true,needsRenderFrame:!a,zoomDelta:s-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t4=Th;if(this._prevEase){let i=this._prevEase,r=(ze()-i.start)/i.duration,a=i.easing(r+.01)-i.easing(r),s=.27/Math.sqrt(a*a+1e-4)*.01,n=Math.sqrt(.0729-s*s);t4=Kc(s,n,.25,1)}return this._prevEase={start:ze(),duration:e,easing:t4},t4}reset(){this._active=false,this._zooming=false,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},Bz=class{constructor(e,t4){this._clickZoom=e,this._tapZoom=t4}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},Oz=class{constructor(e,t4){this._tr=t4,this.reset()}reset(){this._active=false}dblclick(e,t4){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:ii(this._tr.zoom+(e.shiftKey?-1:1),i.getZoomSnap()),around:this._tr.unproject(t4)},{originalEvent:e})}}}enable(){this._enabled=true}disable(){this._enabled=false,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},$z=class{constructor(){this._tap=new qc({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=false,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t4,i){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t4,i);else{let r=t4[0],a=e.timeStamp-this._tapTime<500,s=this._tapPoint.dist(r)<30;!a||!s?this.reset():i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier)}}touchmove(e,t4,i){if(!this._tapTime)this._tap.touchmove(e,t4,i);else if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let r=t4[0],a=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=true,{zoomDelta:a/128*this._zoomRate}}}touchend(e,t4,i){if(this._tapTime)this._swipePoint&&i.length===0&&this.reset();else{let r=this._tap.touchend(e,t4,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=true}disable(){this._enabled=false,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Vz=class{constructor(e,t4,i){this._el=e,this._mousePan=t4,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},jz=class{constructor(e,t4,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t4,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},Uz=class{constructor(e,t4,i,r){this._el=e,this._touchZoom=t4,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=false,this._enabled=true}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=true,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=false,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},Nz=class{constructor(e,t4){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t4,this._enabled=false}isActive(){return false}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=ie.create("div","maplibregl-cooperative-gesture-screen",e);let t4=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t4=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t4,this._container.appendChild(r);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=i,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=true}disable(){this._enabled=false,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t4){this._enabled&&(this._map.fire(new bt("cooperativegestureprevented",{gestureType:e,originalEvent:t4})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},Gz=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(C.convert(e),this._camera.terrain)}};const Co=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;var Zz=class extends bi{};function gh(e){var t4;return((t4=e.panDelta)==null?void 0:t4.mag())||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var qz=class{get _ownerDocument(){var e;return((e=this._el)==null?void 0:e.ownerDocument)||document}get _ownerWindow(){var e,t4;return((t4=(e=this._el)==null?void 0:e.ownerDocument)==null?void 0:t4.defaultView)||window}constructor(e,t4,i){this._terrainGesture={inFlight:false,anchorElevation:null},this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,s)=>{if(a.type==="blur"){this.stop(true);return}this._updatingCamera=true;let n=a.type==="renderFrame"?void 0:a,o={needsRenderFrame:false},l={},u={};for(let{handlerName:d,handler:p,allowed:f}of this._handlers){if(!p.isEnabled())continue;let m;if(this._blockedByActive(u,f,d))p.reset();else if(p[s||a.type]){if(Gx(a,s||a.type)){let g=ie.mousePos(this._map.getCanvas(),a);m=p[s||a.type](a,g)}else if(Nx(a,s||a.type)){let g=a.touches,_=this._getMapTouches(g),y=ie.touchPos(this._map.getCanvas(),_);m=p[s||a.type](a,y,_)}else Zx(s||a.type)||(m=p[s||a.type](a));this.mergeHandlerResult(o,l,m,d,n),m!=null&&m.needsRenderFrame&&this._triggerRenderFrame()}(m||p.isActive())&&(u[d]=p)}let h={};for(let d in this._previousActiveHandlers)u[d]||(h[d]=n);this._previousActiveHandlers=u,(Object.keys(h).length||gh(o))&&(this._changes.push([o,l,h]),this._triggerRenderFrame()),(Object.keys(u).length||gh(o))&&this._camera.stop(true),this._updatingCamera=false;let{cameraAnimation:c}=o;c&&(this._inertia.clear(),this._fireEvents({},{},true),this._changes=[],c(this._map))},this._map=e,this._camera=t4,this._transformProvider=new Gz(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new fz(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);let r=this._el;this._listeners=[[r,"touchstart",{passive:true}],[r,"touchmove",{passive:false}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:true}],[this._ownerDocument,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:false}],[r,"keyup",void 0],[r,"wheel",{passive:false}],[r,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[a,s,n]of this._listeners)a.addEventListener(s,a===this._ownerDocument?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(let[e,t4,i]of this._listeners)e.removeEventListener(t4,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let t4=this._map,i=t4.getCanvasContainer();this._add("mapEvent",new mz(t4,e));let r=t4.boxZoom=new _z(t4,e,this._transformProvider);this._add("boxZoom",r),e.interactive&&e.boxZoom&&r.enable();let a=t4.cooperativeGestures=new Nz(t4,e.cooperativeGestures);this._add("cooperativeGestures",a),e.cooperativeGestures&&a.enable();let s=new xz(t4,this._transformProvider),n=new Oz(t4,this._transformProvider);t4.doubleClickZoom=new Bz(n,s),this._add("tapZoom",s),this._add("clickZoom",n),e.interactive&&e.doubleClickZoom&&t4.doubleClickZoom.enable();let o=new $z;this._add("tapDragZoom",o);let l=t4.touchPitch=new Fz(t4);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t4.touchPitch.enable(e.touchPitch);let u=()=>this._camera.transform.centerPoint,h=Dz(e,u),c=Cz(e),d=Pz(e,u);t4.dragRotate=new jz(e,h,c,d),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",c,["mouseRotate","mouseRoll"]),this._add("mouseRoll",d,["mousePitch"]),e.interactive&&e.dragRotate&&t4.dragRotate.enable();let p=Sz(e),f=new Az(e,t4);t4.dragPan=new Vz(i,p,f),this._add("mousePan",p),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t4.dragPan.enable(e.dragPan);let m=new Mz,g=new Iz;t4.touchZoomRotate=new Uz(i,g,m,o),this._add("touchRotate",m,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t4.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new gz(t4,e),["touchPan"]);let _=t4.scrollZoom=new Lz(t4,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",_,["mousePan"]),e.interactive&&e.scrollZoom&&t4.scrollZoom.enable(e.scrollZoom);let y=t4.keyboard=new Rz(t4,this._transformProvider);this._add("keyboard",y),e.interactive&&e.keyboard&&t4.keyboard.enable()}_add(e,t4,i){this._handlers.push({handlerName:e,handler:t4,allowed:i}),this._handlersById[e]=t4}stop(e){if(!this._updatingCamera){for(let{handler:t4}of this._handlers)t4.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return true;return false}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Co(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t4,i){for(let r in e)if(r!==i&&!(t4!=null&&t4.includes(r)))return true;return false}_getMapTouches(e){let t4=[];for(let i of e){let r=i.target;this._el.contains(r)&&t4.push(i)}return t4}mergeHandlerResult(e,t4,i,r,a){if(!i)return;W(e,i);let s={handlerName:r,originalEvent:i.originalEvent||a};i.zoomDelta!==void 0&&(t4.zoom=s),i.panDelta!==void 0&&(t4.drag=s),i.rollDelta!==void 0&&(t4.roll=s),i.pitchDelta!==void 0&&(t4.pitch=s),i.bearingDelta!==void 0&&(t4.rotate=s)}_applyChanges(){let e={},t4={},i={};for(let[r,a,s]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new C(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),r.rollDelta&&(e.rollDelta=(e.rollDelta||0)+r.rollDelta),r.around!==void 0&&(e.around=r.around),r.pinchAround!==void 0&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),W(t4,a),W(i,s);this._updateMapTransform(e,t4,i),this._changes=[]}_updateMapTransform(e,t4,i){let r=this._map.terrain;if(!gh(e)){this._fireEvents(t4,i,true);return}let a=this._camera.getTransformForUpdate();this._camera.stop(true);let{panDelta:s,zoomDelta:n,bearingDelta:o,pitchDelta:l,rollDelta:u}=e,{around:h,aroundOnSurface:c}=this._resolveAround(e,r,a),d=r?this._terrainGestureElevation(r,h,c,a,t4):void 0,p={panDelta:s,zoomDelta:n,rollDelta:u,pitchDelta:l,bearingDelta:o,around:h,aroundElevation:d};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(h)&&(h=a.centerPoint);let f=this._computePreZoomAroundLoc(a,h,s,d);this._handleMapControls({terrain:r,tr:a,deltasForHelper:p,preZoomAroundLoc:f,combinedEventsInProgress:t4,panDelta:s}),this._camera.applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t4,i,true)}_resolveAround(e,t4,i){let r=e.pinchAround===void 0?e.around:e.pinchAround;return r||(r=this._camera.transform.centerPoint),t4&&!i.isPointOnMapSurface(r)?{around:i.centerPoint,aroundOnSurface:false}:{around:r,aroundOnSurface:true}}_terrainGestureElevation(e,t4,i,r,a){if(!i)return;if(this._terrainGesture.anchorElevation===null&&(a.drag||a.zoom)){let n=r.screenTerrainPointToMercatorCoordinate(t4,e);this._terrainGesture.anchorElevation=n?n.z:void 0}let s=this._terrainGesture.anchorElevation;if(s!=null&&!(t4.distSqr(r.centerPoint)<.01)&&!(s-r.elevation>=.9*(r.getCameraAltitude()-r.elevation)))return s}_computePreZoomAroundLoc(e,t4,i,r){if(t4.distSqr(e.centerPoint)<.01)return e.center;let a=i?t4.sub(i):t4;return r===void 0?e.screenPointToLocation(a):e.screenPointToLocationAtElevation(a,r)}_handleMapControls({terrain:e,tr:t4,deltasForHelper:i,preZoomAroundLoc:r,combinedEventsInProgress:a,panDelta:s}){let n=this._camera.cameraHelper;if(n.handleMapControlsRollPitchBearingZoom(i,t4),!e){n.handleMapControlsPan(i,t4,r);return}if(!this._terrainGesture.inFlight){this._terrainGesture.inFlight=true,this._camera.elevationFreeze=true,n.handleMapControlsPan(i,t4,r);return}if(!n.useGlobeControls&&i.aroundElevation===void 0&&a.drag&&s){t4.setCenter(t4.screenPointToLocation(t4.centerPoint.sub(s)));return}n.handleMapControlsPan(i,t4,r)}_fireEvents(e,t4,i){let r=Co(this._eventsInProgress),a=Co(e),s={};for(let h in e){let{originalEvent:c}=e[h];this._eventsInProgress[h]||(s[`${h}start`]=c),this._eventsInProgress[h]=e[h]}!r&&a&&this._fireEvent("movestart",a.originalEvent);for(let h in s)this._fireEvent(h,s[h]);a&&this._fireEvent("move",a.originalEvent);for(let h in e){let{originalEvent:c}=e[h];this._fireEvent(h,c)}let n={},o;for(let h in this._eventsInProgress){let{handlerName:c,originalEvent:d}=this._eventsInProgress[h];this._handlersById[c].isActive()||(delete this._eventsInProgress[h],o=t4[c]||d,n[`${h}end`]=o)}for(let h in n)this._fireEvent(h,n[h]);let l=Co(this._eventsInProgress),u=(r||a)&&!l;if(u&&this._terrainGesture.inFlight){this._camera.elevationFreeze=false,this._terrainGesture={inFlight:false,anchorElevation:null};let h=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&h.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(h)}if(i&&u){this._updatingCamera=true;let h=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),c=d=>d!==0&&-this._bearingSnap<d&&d<this._bearingSnap;h&&(h.essential||!Xt.prefersReducedMotion)?(c(h.bearing||this._map.getBearing())&&(h.bearing=0),h.freezeElevation=true,this._map.easeTo(h,{originalEvent:o})):(this._fireEvent("moveend",o),c(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=false}}_fireEvent(e,t4){this._camera.fire(new Q(e,t4?{originalEvent:t4}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Zz("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},Wz=class extends pt{constructor(e){super(),this._renderFrameCallback=()=>{let t4=Math.min((ze()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t4)),t4<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new bl,this.cameraHelper=new wl,e.minZoom!==void 0&&this.transform.setMinZoom(e.minZoom),e.maxZoom!==void 0&&this.transform.setMaxZoom(e.maxZoom),e.minPitch!==void 0&&this.transform.setMinPitch(e.minPitch),e.maxPitch!==void 0&&this.transform.setMaxPitch(e.maxPitch),e.renderWorldCopies!==void 0&&this.transform.setRenderWorldCopies(e.renderWorldCopies),e.transformConstrain!==null&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=false,this._zooming=false,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=e.centerClampedToGround??true,this.transformCameraUpdate=e.transformCameraUpdate??null,this._stopHandlers=e.stopHandlers??(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}setTerrain(e){this.terrain=e,this.applyTerrainChange()}migrateProjection(e,t4){if(e.apply(this.transform,true),this.transform=e,this.cameraHelper=t4,this._requestedCameraState){let i=e.clone();i.apply(this._requestedCameraState,true),this._requestedCameraState=i}}getCenter(){return new H(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t4){return this.jumpTo({center:e},t4)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t4){return this.jumpTo({elevation:e},t4),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t4,i){return e=C.convert(e).mult(-1),this.panTo(this.transform.center,W({offset:e},t4),i)}panTo(e,t4,i){return this.easeTo(W({center:e},t4),i)}getZoom(){return this.transform.zoom}setZoom(e,t4){return this.jumpTo({zoom:e},t4),this}zoomTo(e,t4,i){return this.easeTo(W({zoom:e},t4),i)}zoomIn(e,t4){return this.zoomTo(ii(this.getZoom()+1,this._zoomSnap),e,t4),this}zoomOut(e,t4){return this.zoomTo(ii(this.getZoom()-1,this._zoomSnap),e,t4),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t4){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new Q("movestart",t4)).fire(new Q("move",t4)).fire(new Q("moveend",t4))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t4){return this.jumpTo({bearing:e},t4),this}getPadding(){return this.transform.padding}setPadding(e,t4){return this.jumpTo({padding:e},t4),this}rotateTo(e,t4,i){return this.easeTo(W({bearing:e},t4),i)}resetNorth(e,t4){return this.rotateTo(0,W({duration:1e3},e),t4),this}resetNorthPitch(e,t4){return this.easeTo(W({bearing:0,pitch:0,roll:0,duration:1e3},e),t4),this}snapToNorth(e,t4){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t4):this}getPitch(){return this.transform.pitch}setPitch(e,t4){return this.jumpTo({pitch:e},t4),this}getRoll(){return this.transform.roll}setRoll(e,t4){return this.jumpTo({roll:e},t4),this}cameraForBounds(e,t4){e=Yi.convert(e).adjustAntiMeridian();let i=(t4==null?void 0:t4.bearing)||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t4)}_cameraForBoxAndBearing(e,t4,i,r){let a={top:0,bottom:0,right:0,left:0};if(r=W({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},r),typeof r.padding=="number"){let u=r.padding;r.padding={top:u,bottom:u,right:u,left:u}}let s=W(a,r.padding);r.padding=s;let n=this.transform,o=new Yi(e,t4),l=this.cameraHelper.cameraForBoxAndBearing(r,s,o,i,n);return l&&this._zoomSnap&&(l.zoom=ii(l.zoom,this._zoomSnap,-1)),l}fitBounds(e,t4,i){return this._fitInternal(this.cameraForBounds(e,t4),t4,i)}fitScreenCoordinates(e,t4,i,r,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(C.convert(e)),this.transform.screenPointToLocation(C.convert(t4)),i,r),r,a)}_fitInternal(e,t4,i){return e?(t4=W(e,t4),delete t4.padding,t4.linear?this.easeTo(t4,i):this.flyTo(t4,i)):this}jumpTo(e,t4){this.stop(),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=ii(e.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),r=false,a=false,s=false,n=i.zoom;this.terrain&&i.setElevation(this.terrain.getElevationForLngLat(e.center?H.convert(e.center):i.center,i)),this.cameraHelper.handleJumpToCenterZoom(i,e);let o=i.zoom!==n;return e.elevation!==void 0&&i.elevation!==+e.elevation&&i.setElevation(+e.elevation),e.bearing!==void 0&&i.bearing!==+e.bearing&&(r=true,i.setBearing(+e.bearing)),e.pitch!==void 0&&i.pitch!==+e.pitch&&(a=true,i.setPitch(+e.pitch)),e.roll!==void 0&&i.roll!==+e.roll&&(s=true,i.setRoll(+e.roll)),e.padding!=null&&!i.isPaddingEqual(e.padding)&&i.setPadding(e.padding),this.applyUpdatedTransform(i),this.fire(new Q("movestart",t4)).fire(new Q("move",t4)),o&&this.fire(new Q("zoomstart",t4)).fire(new Q("zoom",t4)).fire(new Q("zoomend",t4)),r&&this.fire(new Q("rotatestart",t4)).fire(new Q("rotate",t4)).fire(new Q("rotateend",t4)),a&&this.fire(new Q("pitchstart",t4)).fire(new Q("pitch",t4)).fire(new Q("pitchend",t4)),s&&this.fire(new Q("rollstart",t4)).fire(new Q("roll",t4)).fire(new Q("rollend",t4)),this.fire(new Q("moveend",t4))}calculateAnchoredCameraOptions(e){var s;let t4=this.transform.clone(),i=H.convert(e.anchorLocation),r=C.convert(e.anchorScreenPoint),a={panDelta:r.sub(this.transform.locationToScreenPoint(i,this.terrain)),zoomDelta:e.zoom===void 0?0:e.zoom-t4.zoom,bearingDelta:0,pitchDelta:0,rollDelta:0,around:r,aroundElevation:(s=this.terrain)==null?void 0:s.getElevationForLngLat(i,t4)};return this.cameraHelper.handleMapControlsRollPitchBearingZoom(a,t4),this.cameraHelper.handleMapControlsPan(a,t4,i),{center:t4.center,zoom:t4.zoom}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t4,i,r,a){let s=this.transform.calculateCenterFromCameraLngLatAlt(e,t4,i,r);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:i,pitch:r,roll:a}}easeTo(e,t4){this._stop(false,e.easeId),e=W({offset:[0,0],duration:500,easing:Th},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=ii(e.zoom,this._zoomSnap)),(e.animate===false||!e.essential&&Xt.prefersReducedMotion)&&(e.duration=0);let i=this.getTransformForUpdate(),r=this.getBearing(),a=i.pitch,s=i.roll,n=e.bearing===void 0?r:this._normalizeBearing(e.bearing,r),o=e.pitch===void 0?a:+e.pitch,l=e.roll===void 0?s:this._normalizeBearing(e.roll,s),u=e.padding===void 0?i.padding:e.padding,h=C.convert(e.offset),c,d;e.around&&(c=H.convert(e.around),d=i.locationToScreenPoint(c));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(i,{bearing:n,pitch:o,roll:l,padding:u,around:c,aroundPoint:d,offsetAsPoint:h,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||(this._rotating=r!==n),this._pitching||(this._pitching=o!==a),this._rolling||(this._rolling=l!==s),this._padding=!i.isPaddingEqual(u),this._zooming||(this._zooming=f.isZooming),this._easeId=e.easeId,this._prepareEase(t4,e.noMoveStart,p),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease(m=>{f.easeFunc(m),this.terrain&&!e.freezeElevation&&this._updateElevation(m),this.applyUpdatedTransform(i),this._fireMoveEvents(t4)},m=>{this.terrain&&e.freezeElevation?this._finalizeElevation():this.elevationFreeze=false,this._afterEase(t4,m)},e),this}_prepareEase(e,t4,i={}){this._moving=true,!t4&&!i.moving&&this.fire(new Q("movestart",e)),this._zooming&&!i.zooming&&this.fire(new Q("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new Q("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new Q("pitchstart",e)),this._rolling&&!i.rolling&&this.fire(new Q("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,this.transform),this.elevationFreeze=true}_updateElevation(e){(this._elevationStart===void 0||this._elevationCenter===void 0)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t4=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(e<1&&t4!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,r=(t4-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-r),this._elevationTarget=t4}this.transform.setElevation(He.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=false,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}applyTerrainChange(){if(this.elevationFreeze)return;let e=this.transform;e.setMinElevationForCurrentTile(this.terrain?this.terrain.getMinTileElevationForLngLatZoom(e.center,e.tileZoom):0),this.getCenterClampedToGround()&&e.setElevation(this.terrain?this.terrain.getElevationForLngLat(e.center,e):0)}getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t4=e.getCameraLngLat(),i=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t4,e.zoom):0;if(i<r){let a=e.calculateCameraOptionsFromTo(t4,r,e.center,e.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}applyUpdatedTransform(e){let t4=[];if(t4.push(r=>this._elevateCameraIfInsideTerrain(r)),this.transformCameraUpdate&&t4.push(r=>this.transformCameraUpdate(r)),!t4.length)return;let i=e.clone();for(let r of t4){let a=i.clone(),{center:s,zoom:n,roll:o,pitch:l,bearing:u,elevation:h}=r(a);s&&a.setCenter(s),h!==void 0&&a.setElevation(h),n!==void 0&&a.setZoom(n),o!==void 0&&a.setRoll(o),l!==void 0&&a.setPitch(l),u!==void 0&&a.setBearing(u),i.apply(a,false)}this.transform.apply(i,false)}_fireMoveEvents(e){this.fire(new Q("move",e)),this._zooming&&this.fire(new Q("zoom",e)),this._rotating&&this.fire(new Q("rotate",e)),this._pitching&&this.fire(new Q("pitch",e)),this._rolling&&this.fire(new Q("roll",e))}_afterEase(e,t4){if(this._easeId&&t4&&this._easeId===t4)return;delete this._easeId;let i=this._zooming,r=this._rotating,a=this._pitching,s=this._rolling;this._moving=false,this._zooming=false,this._rotating=false,this._pitching=false,this._rolling=false,this._padding=false,i&&this.fire(new Q("zoomend",e)),r&&this.fire(new Q("rotateend",e)),a&&this.fire(new Q("pitchend",e)),s&&this.fire(new Q("rollend",e)),this.fire(new Q("moveend",e))}flyTo(e,t4){if(!e.essential&&Xt.prefersReducedMotion){let S=fn(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(S,t4)}this.stop(),e=W({offset:[0,0],speed:1.2,curve:1.42,easing:Th},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=ii(e.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),r=i.bearing,a=i.pitch,s=i.roll,n=i.padding,o=e.bearing===void 0?r:this._normalizeBearing(e.bearing,r),l=e.pitch===void 0?a:+e.pitch,u=e.roll===void 0?s:this._normalizeBearing(e.roll,s),h=e.padding===void 0?i.padding:e.padding,c=C.convert(e.offset),d=i.centerPoint.add(c),p=i.screenPointToLocation(d),f=this.cameraHelper.handleFlyTo(i,{bearing:o,pitch:l,roll:u,padding:h,locationAtOffset:p,offsetAsPoint:c,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),m=e.curve,g=Math.max(i.width,i.height),_=g/f.scaleOfZoom,y=f.pixelPathLength,x=g/f.scaleOfMinZoom;m=Math.min(m,Math.sqrt(x/y*2));let v=m*m;function w(S){let A=(_*_-g*g+(S?-1:1)*v*v*y*y)/(2*(S?_:g)*v*y);return Math.log(Math.sqrt(A*A+1)-A)}function b(S){return(Math.exp(S)-Math.exp(-S))/2}function T(S){return(Math.exp(S)+Math.exp(-S))/2}function P(S){return b(S)/T(S)}let E=w(false),I=function(S){return T(E)/T(E+m*S)},R=function(S){return g*((T(E)*P(E+m*S)-b(E))/v)/y},z=(w(true)-E)/m;if(Math.abs(y)<2e-6||!isFinite(z)){if(Math.abs(g-_)<1e-6)return this.easeTo(e,t4);let S=_<g?-1:1;z=Math.abs(Math.log(_/g))/m,R=()=>0,I=A=>Math.exp(S*m*A)}if(e.duration!==void 0)e.duration=+e.duration;else{let S=e.screenSpeed===void 0?+e.speed:+e.screenSpeed/m;e.duration=1e3*z/S}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=true,this._rotating=r!==o,this._pitching=l!==a,this._rolling=u!==s,this._padding=!i.isPaddingEqual(h),this._prepareEase(t4,false),this.terrain&&this._prepareElevation(f.targetCenter),this._ease(S=>{let A=S*z,D=1/I(A),M=R(A);this._rotating&&i.setBearing(He.number(r,o,S)),this._pitching&&i.setPitch(He.number(a,l,S)),this._rolling&&i.setRoll(He.number(s,u,S)),this._padding&&(i.interpolatePadding(n,h,S),d=i.centerPoint.add(c)),f.easeFunc(S,D,M,d),this.terrain&&!e.freezeElevation&&this._updateElevation(S),this.applyUpdatedTransform(i),this._fireMoveEvents(t4)},()=>{this.terrain&&e.freezeElevation?this._finalizeElevation():this.elevationFreeze=false,this._afterEase(t4)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,t4){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,t4)}return e||this._stopHandlers(),this}_ease(e,t4,i){i.animate===false||i.duration===0?(e(1),t4()):(this._easeStart=ze(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=t4,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t4){e=mi(e,-180,180);let i=Math.abs(e-t4);return Math.abs(e-360-t4)<i&&(e-=360),Math.abs(e+360-t4)<i&&(e+=360),e}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};const Lv={compact:true,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var Hz=class{constructor(e=Lv){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t4=>{t4&&(t4.type==="terrain"||t4.dataType==="style"||t4.dataType==="source"&&(t4.sourceDataType==="metadata"||t4.sourceDataType==="visibility"))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===false?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ie.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ie.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t4){let i=this._map._getUIString(`AttributionControl.${t4}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(r=>typeof r=="string"?r:"")):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let r=this._map.style.stylesheet;this.styleOwner=r.owner,this.styleId=r.id}let t4=this._map.style.tileManagers;for(let r in t4){let a=t4[r];if(a.used||a.usedForTerrain){let s=a.getSource();s.attribution&&!e.includes(s.attribution)&&e.push(s.attribution)}}e=e.filter(r=>String(r).trim()),e.sort((r,a)=>r.length-a.length),e=e.filter((r,a)=>{for(let s=a+1;s<e.length;s++)if(e[s].includes(r))return false;return true});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.replaceChildren(ie.sanitize(i)),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},Xz=class{constructor(e={}){this._updateCompact=()=>{let t4=this._container.children;if(t4.length){let i=t4[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==false&&i.classList.add("maplibregl-compact"):i.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){var i;this._map=e,this._compact=(i=this.options)==null?void 0:i.compact,this._container=ie.create("div","maplibregl-ctrl");let t4=ie.create("a","maplibregl-ctrl-logo");return t4.target="_blank",t4.rel="noopener nofollow",t4.href="https://maplibre.org/",t4.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t4.setAttribute("rel","noopener nofollow"),this._container.appendChild(t4),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},Yz=class{constructor(){this._queue=[],this._id=0,this._cleared=false,this._currentlyRunning=false}add(e){let t4=++this._id;return this._queue.push({callback:e,id:t4,cancelled:false}),t4}remove(e){let t4=this._currentlyRunning,i=t4?this._queue.concat(t4):this._queue;for(let r of i)if(r.id===e){r.cancelled=true;return}}run(e=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let t4=this._currentlyRunning=this._queue;this._queue=[];let i=false,r;for(let a of t4)if(!a.cancelled){try{a.callback(e)}catch(s){i||(i=true,r=s)}if(this._cleared)break}if(this._cleared=false,this._currentlyRunning=false,i)throw r}clear(){this._currentlyRunning&&(this._cleared=true),this._queue=[]}};const jg=["none","zoom","sourceTiles","visibleLayers","revision"];var Kz=class{constructor(e,t4,i,r){this._tileKeys=e.map(a=>a.key).sort().join(),this._revision=t4,this._zoom=i,this._visibleLayerIds=r}difference(e){return this._revision===(e==null?void 0:e._revision)?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}};const Ta={background:true,fill:true,line:true,raster:true,hillshade:true,"color-relief":true};var Jz=class{constructor(e,t4){this.needsFollowUpFrame=false,this.painter=e,this.terrain=t4,this.rttSize=t4.tileManager.tileSize*t4.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,t4){let i=t4!==this._lastPrepareZoom;this._lastPrepareZoom=t4,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(o=>!e._layers[o].isHidden(t4));let r=this._renderableLayerIds.join(),a=new Set;for(let o of this._renderableLayerIds){let l=e._layers[o],u=l.source;u&&Ta[l.type]&&a.add(u)}this._coordsAscending={},this._rttFingerprints={};for(let o of a){let l=e.tileManagers[o];if(!l)continue;this._coordsAscending[o]={};let u=this._coordsAscending[o],h=l.getSource(),c=h instanceof Pn?h.terrainTileRanges:null;for(let f of l.getVisibleCoordinates()){let m=this.terrain.tileManager.getTerrainCoords(f,c);for(let g in m)u[g]||(u[g]=[]),u[g].push(m[g])}this._rttFingerprints[o]={};let d=this._rttFingerprints[o],p=l.getState().revision;for(let f in u)d[f]=new Kz(u[f],p,t4,r)}this.needsFollowUpFrame=false;let s=i||this.painter.options.moving,n=false;for(let o of this._renderableTiles){let l=this._textureDifference(o);l!=="none"&&(l==="zoom"&&s||l==="visibleLayers"&&i?this.needsFollowUpFrame=true:l==="zoom"||l==="sourceTiles"?(n?this.needsFollowUpFrame=true:o.releaseRTT(this.painter),n=true):o.releaseRTT(this.painter))}}_textureDifference(e){let t4="none";for(let i in this._rttFingerprints){let r=this._rttFingerprints[i][e.tileID.key];if(!r)continue;let a=r.difference(e.rttFingerprint[i]);jg.indexOf(a)>jg.indexOf(t4)&&(t4=a)}return t4}renderLayer(e,t4){if(e.isHidden(this.painter.transform.zoom))return false;let i=e.type,r=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Ta[i]&&((!this._prevType||!Ta[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!a))return true;if(Ta[this._prevType]||Ta[i]&&a){this._prevType=i;let s=this._stacks.length-1,n=this._stacks[s]||[];t4.isRenderingToTexture=true;for(let o of this._renderableTiles){if(this._rttTiles.push(o),o.getRTT(s))continue;let l=o.acquireRTT(r,s,this.rttSize);r.bindRTT(l),r.context.clear({color:oe.transparent,stencil:0}),r.currentStencilSource=void 0;for(let u of n){let h=r.style._layers[u],c=h.source?this._coordsAscending[h.source][o.tileID.key]:[o.tileID];r.context.viewport.set([0,0,this.rttSize,this.rttSize]),r.renderTileClippingMasks(h,c),r.renderLayer(r,r.style.tileManagers[h.source],h,c,t4),h.source&&(o.rttFingerprint[h.source]=this._rttFingerprints[h.source][o.tileID.key])}l.texture.generateMipmap()}return t4.isRenderingToTexture=false,tz(this.painter,this.terrain,this._rttTiles,t4),this._rttTiles=[],Ta[i]}return false}};const Qz={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},eR=D1,Ug={hash:false,interactive:true,bearingSnap:7,zoomSnap:0,attributionControl:Lv,maplibreLogo:false,refreshExpiredTiles:true,canvasContextAttributes:{antialias:false,preserveDrawingBuffer:false,powerPreference:"high-performance",failIfMajorPerformanceCaveat:false,desynchronized:false,contextType:void 0},scrollZoom:true,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:true,dragRotate:true,dragPan:true,keyboard:true,doubleClickZoom:true,touchZoomRotate:true,touchPitch:true,cooperativeGestures:false,trackResize:true,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:true,maxTileCacheSize:null,maxTileCacheZoomLevels:xi.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:true,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:true,rollEnabled:false,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:true,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:true,centerClampedToGround:true,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var B4=class extends pt{get _ownerWindow(){var e,t4;return((t4=(e=this._container)==null?void 0:e.ownerDocument)==null?void 0:t4.defaultView)||window}constructor(e){var a,s,n;super(),this._idleTriggered=false,this._crossFadingFactor=1,this._renderTaskQueue=new Yz,this._controls=[],this._mapId=t_(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=o=>{if(o.preventDefault(),this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style){this.fire(new eh("webglcontextlost",{originalEvent:o}));return}for(let l of Object.values(this.style._layers))if(l.type==="custom"&&console.warn(`Custom layer with id '${l.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),l._listeners)for(let[u]of Object.entries(l._listeners))console.warn(`Custom layer with id '${l.id}' had event listeners for event '${u}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new eh("webglcontextlost",{originalEvent:o}))},this._contextRestored=o=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:false}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let l in this._lostContextStyle.images){let u=this._lostContextStyle.images[l];u.isWebGLImage&&this.style.imageManager.updateImage(l,u,false)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(l){this.fire(new Y(l));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new eh("webglcontextrestored",{originalEvent:o}))},this._onMapScroll=o=>{if(o.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,false},this._onWindowOnline=()=>{this._update()};let t4={...Ug,...e,canvasContextAttributes:{...Ug.canvasContextAttributes,...e.canvasContextAttributes}};if(t4.minZoom!=null&&t4.maxZoom!=null&&t4.minZoom>t4.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(t4.minPitch!=null&&t4.maxPitch!=null&&t4.minPitch>t4.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(t4.minPitch!=null&&t4.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(t4.maxPitch!=null&&t4.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new Wz({minZoom:t4.minZoom,maxZoom:t4.maxZoom,minPitch:t4.minPitch,maxPitch:t4.maxPitch,bearingSnap:t4.bearingSnap,zoomSnap:t4.zoomSnap,renderWorldCopies:t4.renderWorldCopies,centerClampedToGround:t4.centerClampedToGround,terrain:this.terrain,transformConstrain:t4.transformConstrain,requestRenderFrame:o=>this._requestRenderFrame(o),cancelRenderFrame:o=>this._cancelRenderFrame(o),transformCameraUpdate:t4.transformCameraUpdate,stopHandlers:()=>{var o;return(o=this._handlers)==null?void 0:o.stop(false)}}),this._camera.setEventedParent(this),this._interactive=t4.interactive,this._maxTileCacheSize=t4.maxTileCacheSize,this._maxTileCacheZoomLevels=t4.maxTileCacheZoomLevels,this._canvasContextAttributes={...t4.canvasContextAttributes},this._trackResize=t4.trackResize===true,this._terrainSkirtLength=t4.terrainSkirtLength,this._refreshExpiredTiles=t4.refreshExpiredTiles===true,this._fadeDuration=t4.fadeDuration,this._crossSourceCollisions=t4.crossSourceCollisions===true,this._collectResourceTiming=t4.collectResourceTiming===true,this._locale={...Qz,...t4.locale},this._clickTolerance=t4.clickTolerance,this._overridePixelRatio=t4.pixelRatio,this._maxCanvasSize=t4.maxCanvasSize,this._zoomLevelsToOverscale=t4.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=t4.cancelPendingTileRequestsWhileZooming===true,this.setAnisotropicFilterPitch(t4.anisotropicFilterPitch),t4.reduceMotion!==void 0&&(Xt.prefersReducedMotion=t4.reduceMotion),this._requestManager=new kA(t4.transformRequest),this._container=this._resolveContainer(t4.container),t4.maxBounds&&this.setMaxBounds(t4.maxBounds),this._setupContainer();try{this._setupPainter()}catch(o){throw this._cleanupContainer(),o}this._imageQueueHandle=qi.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(false)),this.on("moveend",()=>this._update(false)),this.on("zoom",()=>this._update(true)),this.on("terrain",()=>{this.painter.markTerrainDepthDirty(),this._update(true)}),this.once("idle",()=>this._idleTriggered=true),this._handlers=new qz(this,this._camera,t4),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,false),this._setupResizeObserver());let i=typeof t4.hash=="string"&&t4.hash||void 0;this._hash=t4.hash?new lz(i).addTo(this):void 0,(a=this._hash)!=null&&a._onHashChange()||(this.jumpTo({center:t4.center,elevation:t4.elevation,zoom:t4.zoom,bearing:t4.bearing,pitch:t4.pitch,roll:t4.roll}),t4.bounds&&(this.resize(),this.fitBounds(t4.bounds,W({},t4.fitBoundsOptions,{duration:0}))));let r=typeof t4.style=="string"||((n=(s=t4.style)==null?void 0:s.projection)==null?void 0:n.type)!=="globe";this.resize(null,r),this._localIdeographFontFamily=t4.localIdeographFontFamily,this._validateStyle=t4.validateStyle,t4.style&&this.setStyle(t4.style,{localIdeographFontFamily:t4.localIdeographFontFamily}),t4.attributionControl&&this.addControl(new Hz(typeof t4.attributionControl=="boolean"?void 0:t4.attributionControl)),t4.maplibreLogo&&this.addControl(new Xz,t4.logoPosition),this.on("style.load",()=>{if(r||this._resizeTransform(),this._camera.transform.unmodified){let o=fn(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(o)}}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(o.dataType==="style"?new Di("styledata",o):new Ge("sourcedata",o))}),this.on("dataloading",o=>{this.fire(o.dataType==="style"?new Di("styledataloading",o):new Ge("sourcedataloading",o))}),this.on("dataabort",o=>{this.fire(new Ge("sourcedataabort",o))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t4){return this.style.setGlobalStateProperty(e,t4),this._update(true)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t4){if(t4===void 0&&(t4=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!(e!=null&&e.onAdd))return this.fire(new Y(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=e.onAdd(this);this._controls.push(e);let r=this._controlPositions[t4];return t4.includes("bottom")?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(e){if(!(e!=null&&e.onRemove))return this.fire(new Y(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t4=this._controls.indexOf(e);return t4>-1&&this._controls.splice(t4,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return ss(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new H(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,t4){return this._camera.setCenter(e,t4),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,t4){return this._camera.setCenterElevation(e,t4),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,t4,i){return this._camera.panBy(e,t4,i),this}panTo(e,t4,i){return this._camera.panTo(e,t4,i),this}getZoom(){return this._camera.transform.zoom}setZoom(e,t4){return this._camera.setZoom(e,t4),this}zoomTo(e,t4,i){return this._camera.zoomTo(e,t4,i),this}zoomIn(e,t4){return this._camera.zoomIn(e,t4),this}zoomOut(e,t4){return this._camera.zoomOut(e,t4),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,t4){return this._camera.setVerticalFieldOfView(e,t4),this}getBearing(){return this._camera.transform.bearing}setBearing(e,t4){return this._camera.setBearing(e,t4),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,t4){return this._camera.setPadding(e,t4),this}rotateTo(e,t4,i){return this._camera.rotateTo(e,t4,i),this}resetNorth(e,t4){return this._camera.resetNorth(e,t4),this}resetNorthPitch(e,t4){return this._camera.resetNorthPitch(e,t4),this}snapToNorth(e,t4){return this._camera.snapToNorth(e,t4),this}getPitch(){return this._camera.transform.pitch}setPitch(e,t4){return this._camera.setPitch(e,t4),this}getRoll(){return this._camera.transform.roll}setRoll(e,t4){return this._camera.setRoll(e,t4),this}cameraForBounds(e,t4){return this._camera.cameraForBounds(e,t4)}fitBounds(e,t4,i){return this._camera.fitBounds(e,t4,i),this}fitScreenCoordinates(e,t4,i,r,a){return this._camera.fitScreenCoordinates(e,t4,i,r,a),this}jumpTo(e,t4){return this._camera.jumpTo(e,t4),this}calculateAnchoredCameraOptions(e){return this._camera.calculateAnchoredCameraOptions(e)}calculateCameraOptionsFromCameraLngLatAltRotation(e,t4,i,r,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t4,i,r,a)}easeTo(e,t4){return this._camera.easeTo(e,t4),this}flyTo(e,t4){return this._camera.flyTo(e,t4),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(H.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t4,i,r){return r==null&&this.terrain&&(r=this.terrain.getElevationForLngLat(i,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,t4,i,r??0)}resize(e,t4=true){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t4);let i=!this._camera._moving;return i&&(this.stop(),this.fire(new Q("movestart",e)).fire(new Q("move",e))),this.fire(new bt("resize",e)),i&&this.fire(new Q("moveend",e)),this}_resizeInternal(e=true){let[t4,i]=this._containerDimensions(),r=this._getClampedPixelRatio(t4,i);if(this._resizeCanvas(t4,i,r),this.painter.resize(t4,i,r),this.painter.overLimit()){let a=this.painter.context.gl;this._maxCanvasSize=[a.drawingBufferWidth,a.drawingBufferHeight];let s=this._getClampedPixelRatio(t4,i);this._resizeCanvas(t4,i,s),this.painter.resize(t4,i,s)}this._resizeTransform(e)}_resizeTransform(e=true){var r;let[t4,i]=this._containerDimensions();this._camera.transform.resize(t4,i,e),(r=this._camera._requestedCameraState)==null||r.resize(t4,i,e)}_getClampedPixelRatio(e,t4){let{0:i,1:r}=this._maxCanvasSize,a=this.getPixelRatio(),s=e*a,n=t4*a,o=s>i?i/s:1,l=n>r?r/n:1,u=Math.min(o,l);return u<1&&ge("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),u*a}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.transform.setMaxBounds(Yi.convert(e)),this._update()}setMinZoom(e){if(e??(e=-2),e>=-2&&e<=this._camera.transform.maxZoom){let t4=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMinZoom(e),this._camera.applyUpdatedTransform(i),this._update(),t4!==this._camera.transform.zoom&&this.fire(new Q("zoomstart")).fire(new Q("zoom")).fire(new Q("zoomend")).fire(new Q("movestart")).fire(new Q("move")).fire(new Q("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(e=false){let t4=this._camera.transform;return e?t4.applyConstrain(t4.center,t4.minZoom).zoom:t4.minZoom}setMaxZoom(e){if(e??(e=22),e>=this._camera.transform.minZoom){let t4=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMaxZoom(e),this._camera.applyUpdatedTransform(i),this._update(),t4!==this._camera.transform.zoom&&this.fire(new Q("zoomstart")).fire(new Q("zoom")).fire(new Q("zoomend")).fire(new Q("movestart")).fire(new Q("move")).fire(new Q("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??(e=0),e<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this._camera.transform.maxPitch){let t4=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMinPitch(e),this._camera.applyUpdatedTransform(i),this._update(),t4!==this._camera.transform.pitch&&this.fire(new Q("pitchstart")).fire(new Q("pitch")).fire(new Q("pitchend")).fire(new Q("movestart")).fire(new Q("move")).fire(new Q("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??(e=60),e>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this._camera.transform.minPitch){let t4=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMaxPitch(e),this._camera.applyUpdatedTransform(i),this._update(),t4!==this._camera.transform.pitch&&this.fire(new Q("pitchstart")).fire(new Q("pitch")).fire(new Q("pitchend")).fire(new Q("movestart")).fire(new Q("move")).fire(new Q("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??(e=20),e>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this._camera.transform.setConstrainOverride(e),this._update()}project(e){return this._camera.transform.locationToScreenPoint(H.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(C.convert(e),this.terrain)}isMoving(){var e;return this._camera.isMoving()||((e=this._handlers)==null?void 0:e.isMoving())||false}isZooming(){var e;return this._camera.isZooming()||((e=this._handlers)==null?void 0:e.isZooming())||false}isRotating(){var e;return this._camera.isRotating()||((e=this._handlers)==null?void 0:e.isRotating())||false}_createDelegatedListener(e,t4,i){if(e==="mouseenter"||e==="mouseover"){let r=false;return{layers:t4,listener:i,delegates:{mousemove:a=>{let s=t4.filter(o=>this.getLayer(o)),n=s.length===0?[]:this.queryRenderedFeatures(a.point,{layers:s});n.length?r||(r=true,i.call(this,new ri(e,this,a.originalEvent,{features:n}))):r=false},mouseout:()=>{r=false}}}}if(e==="mouseleave"||e==="mouseout"){let r=false;return{layers:t4,listener:i,delegates:{mousemove:a=>{let s=t4.filter(n=>this.getLayer(n));(s.length===0?[]:this.queryRenderedFeatures(a.point,{layers:s})).length?r=true:r&&(r=false,i.call(this,new ri(e,this,a.originalEvent)))},mouseout:a=>{r&&(r=false,i.call(this,new ri(e,this,a.originalEvent)))}}}}{let r=a=>{let s=t4.filter(o=>this.getLayer(o)),n=s.length===0?[]:this.queryRenderedFeatures(a.point,{layers:s});n.length&&(a.features=n,i.call(this,a),delete a.features)};return{layers:t4,listener:i,delegates:{[e]:r}}}}_saveDelegatedListener(e,t4){var i;this._delegatedListeners||(this._delegatedListeners={}),(i=this._delegatedListeners)[e]||(i[e]=[]),this._delegatedListeners[e].push(t4)}_removeDelegatedListener(e,t4,i){var a;if(!((a=this._delegatedListeners)!=null&&a[e]))return;let r=this._delegatedListeners[e];for(let s=0;s<r.length;s++){let n=r[s];if(n.listener===i&&n.layers.length===t4.length&&n.layers.every(o=>t4.includes(o))){for(let o in n.delegates)this.off(o,n.delegates[o]);r.splice(s,1);return}}}on(e,t4,i){if(i===void 0)return super.on(e,t4);let r=typeof t4=="string"?[t4]:t4,a=this._createDelegatedListener(e,r,i);this._saveDelegatedListener(e,a);for(let s in a.delegates)this.on(s,a.delegates[s]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t4,i){if(i===void 0)return super.once(e,t4);let r=typeof t4=="string"?[t4]:t4,a=this._createDelegatedListener(e,r,i);for(let s in a.delegates){let n=a.delegates[s];a.delegates[s]=(...o)=>{this._removeDelegatedListener(e,r,i),n(...o)}}this._saveDelegatedListener(e,a);for(let s in a.delegates)this.once(s,a.delegates[s]);return this}off(e,t4,i){if(i===void 0)return super.off(e,t4);let r=typeof t4=="string"?[t4]:t4;return this._removeDelegatedListener(e,r,i),this}queryRenderedFeatures(e,t4){if(!this.style)return[];let i,r=e instanceof C||Array.isArray(e),a=r?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(t4||(t4=(r?{}:e)||{}),a instanceof C||typeof a[0]=="number")i=[C.convert(a)];else{let s=C.convert(a[0]),n=C.convert(a[1]);i=[s,new C(n.x,s.y),n,new C(s.x,n.y),s]}return this.style.queryRenderedFeatures(i,t4,this._camera.transform)}querySourceFeatures(e,t4){return this.style.querySourceFeatures(e,t4)}setStyle(e,t4){return t4=W({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t4),this._styleUrl=typeof e=="string"?e:null,t4.diff!==false&&t4.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t4),this):(this._localIdeographFontFamily=t4.localIdeographFontFamily,this._updateStyle(e,t4))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t4=this._locale[e];if(t4==null)throw Error(`Missing UI string '${e}'`);return t4}_updateStyle(e,t4){var r,a,s;if((r=this._diffStyleRequest)==null||r.abort(),this._diffStyleRequest=null,t4.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,t4));return}let i=this.style&&t4.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new Sg(this,t4||{});else return this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),(s=(a=this.style)==null?void 0:a.projection)==null||s.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,t4,i):this.style.loadJSON(e,t4,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new Sg(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(e,t4){var i;if((i=this._diffStyleRequest)==null||i.abort(),typeof e=="string"){let r=e;this._diffStyleRequest=new AbortController;let a=this._diffStyleRequest;try{let s=await this._requestManager.transformRequest(r,"Style");if(a.signal.aborted){this._diffStyleRequest=null;return}let n=await Dl(s,a);this._diffStyleRequest=null,this._updateDiff(n.data,t4)}catch(s){this._diffStyleRequest=null,Cr(s)||this.fire(new Y(Ft(s)))}}else typeof e=="object"&&(this._diffStyleRequest=null,this._updateDiff(e,t4))}_updateDiff(e,t4){try{this.style.setState(e,t4)&&this._update(true)}catch(i){ge(`Unable to perform style diff: ${Ft(i).message}. Rebuilding the style from scratch.`),this._updateStyle(e,t4)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(!this.style){ge("There is no style added to the map.");return}return this.style.loaded()}addSource(e,t4){return this._lazyInitEmptyStyle(),this.style.addSource(e,t4),this._update(true)}isSourceLoaded(e){var i;let t4=(i=this.style)==null?void 0:i.tileManagers[e];if(t4===void 0){this.fire(new Y(Error(`There is no tile manager with ID '${e}'`)));return}return t4.loaded()}setTerrain(e,t4={}){if(this.style._checkLoaded(),e&&wn(this,qt.terrain,{value:e},t4))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this.painter.destroyRTTResources(),this._camera.setTerrain(null);else{let i=this.style.tileManagers[e.source];if(!i)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&i.reload();for(let r in this.style._layers){let a=this.style._layers[r];a.type==="hillshade"&&a.source===e.source&&ge("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),a.type==="color-relief"&&a.source===e.source&&ge("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new JM(this.painter,i,e,this._terrainSkirtLength),this.painter.renderToTexture=new Jz(this.painter,this.terrain),this._camera.setTerrain(this.terrain),this._terrainDataCallback=r=>this._handleTerrainDataEvent(r,e.source),this.style.on("data",this._terrainDataCallback)}return this.style.triggerSymbolPlacement(),this.fire(new BA({terrain:e})),this}_handleTerrainDataEvent(e,t4){var r;if(e.dataType==="style"){this.terrain.tileManager.releaseAllRTT();return}let i=e.sourceId===t4;if(i&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),i&&e.tile&&(this.painter.markTerrainDepthDirty(),this._camera.applyTerrainChange()),e.tile){if(((r=e.source)==null?void 0:r.type)==="image"){this.terrain.tileManager.releaseAllRTT();return}this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){var e;return((e=this.terrain)==null?void 0:e.options)??null}areTilesLoaded(){var t4;let e=(t4=this.style)==null?void 0:t4.tileManagers;for(let i of Object.values(e))if(!i.areTilesLoaded())return false;return true}removeSource(e){return this.style.removeSource(e),this._update(true)}getSource(e){var t4;return(t4=this.style)==null?void 0:t4.getSource(e)}setSourceTileLodParams(e,t4,i){if(i){let r=this.getSource(i);if(!r)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);r.calculateTileZoom=Oc(Math.max(1,e),Math.max(1,t4))}else for(let r in this.style.tileManagers)this.style.tileManagers[r].getSource().calculateTileZoom=Oc(Math.max(1,e),Math.max(1,t4));return this._update(true),this}refreshTiles(e,t4){let i=this.style.tileManagers[e];if(!i)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);t4===void 0?i.reload(true):i.refreshTiles(t4.map(r=>new Yl(r.z,r.x,r.y)))}addImage(e,t4,i={}){var a;this._lazyInitEmptyStyle();let r=this._createStyleImage(t4,i);return r?(this.style.addImage(e,r),(a=r.userImage)!=null&&a.onAdd&&r.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){var t4;return this._missingStyleImageResolver=e,(t4=this.style)==null||t4.setMissingImageResolver(e),this}_createStyleImage(e,t4={}){let{pixelRatio:i=1,sdf:r=false,stretchX:a,stretchY:s,content:n,textFitWidth:o,textFitHeight:l}=t4;if(e instanceof HTMLImageElement||qr(e)){let{width:u,height:h,data:c}=Xt.getImageData(e);return{data:new je({width:u,height:h},c),pixelRatio:i,stretchX:a,stretchY:s,content:n,textFitWidth:o,textFitHeight:l,sdf:r,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new Y(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))),null;{let{width:u,height:h,data:c}=e,d=e,p=cl(d.data);return{data:p?new je({width:u,height:h}):new je({width:u,height:h},new Uint8Array(c)),pixelRatio:i,stretchX:a,stretchY:s,content:n,textFitWidth:o,textFitHeight:l,sdf:r,version:0,isWebGLImage:p,userImage:d}}}updateImage(e,t4){let i=this.style.getImage(e);if(!i)return this.fire(new Y(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:r,height:a,data:s}=t4 instanceof HTMLImageElement||qr(t4)?Xt.getImageData(t4):t4;if(r===void 0||a===void 0)return this.fire(new Y(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(r!==i.data.width||a!==i.data.height)return this.fire(new Y(Error("The width and height of the updated image must be that same as the previous version of the image")));if(i.isWebGLImage=cl(s),i.isWebGLImage)i.userImage=t4;else{let n=!(t4 instanceof HTMLImageElement||qr(t4));i.data.replace(s,n)}return this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new Y(Error("Missing required image id"))),false)}removeImage(e){this.style.removeImage(e)}async loadImage(e){let t4=await qi.getImage(await this._requestManager.transformRequest(e,"Image"),new AbortController);if(!t4.data)throw Error(`Could not load image ${e}: the response is empty`);return t4}listImages(){var e;return((e=this.style)==null?void 0:e.listImages())??[]}addLayer(e,t4){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t4),this._update(true)}moveLayer(e,t4){return this.style.moveLayer(e,t4),this._update(true)}removeLayer(e){return this.style.removeLayer(e),this._update(true)}getLayer(e){var t4;return(t4=this.style)==null?void 0:t4.getLayer(e)}getLayersOrder(){var e;return((e=this.style)==null?void 0:e.getLayersOrder())??[]}setLayerZoomRange(e,t4,i){return this.style.setLayerZoomRange(e,t4,i),this._update(true)}setFilter(e,t4,i={}){var r;return(r=this.style)==null||r.setFilter(e,t4,i),this._update(true)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t4,i,r={}){var a;return(a=this.style)==null||a.setPaintProperty(e,t4,i,r),this._update(true)}getPaintProperty(e,t4){return this.style.getPaintProperty(e,t4)}setLayoutProperty(e,t4,i,r={}){return this.style.setLayoutProperty(e,t4,i,r),this._update(true)}getLayoutProperty(e,t4){return this.style.getLayoutProperty(e,t4)}setGlyphs(e,t4={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t4),this._update(true)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(true)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,t4,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t4,i,r=>{r||this._update(true)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(true)}getSprite(){return this.style.getSprite()}setSprite(e,t4={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t4,i=>{i||this._update(true)}),this}setLight(e,t4={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t4),this._update(true)}getLight(){return this.style.getLight()}setSky(e,t4={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t4),this._update(true)}getSky(){return this.style.getSky()}setFeatureState(e,t4){return this.style.setFeatureState(e,t4),this._update()}removeFeatureState(e,t4){return this.style.removeFeatureState(e,t4),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t4=0;return this._container&&(e=this._container.clientWidth||400,t4=this._container.clientHeight||300),[e,t4]}_shouldHandleInitialResize(){var i;if(!((i=this._container)!=null&&i.clientWidth)||!this._container.clientHeight)return false;let[e,t4]=this._containerDimensions();return e!==this._camera.transform.width||t4!==this._camera.transform.height}_setupResizeObserver(){let e=false,t4=pp(r=>{this._trackResize&&!this._removed&&(this.resize(r),this.redraw())},50),i=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new i(r=>{!e&&(e=true,!this._shouldHandleInitialResize())||t4(r)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if(typeof e=="string"){let t4=document.getElementById(e);if(!t4)throw Error(`Container '${e}' not found.`);return t4}if(e instanceof HTMLElement||e&&typeof e=="object"&&e.nodeType===1)return e;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._containerDimensions(),t4=this._getClampedPixelRatio(e[0],e[1]),i=this._container;i.classList.add("maplibregl-map");let r=this._canvasContainer=ie.create("div","maplibregl-canvas-container",i);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=ie.create("canvas","maplibregl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,false),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,false),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._resizeCanvas(e[0],e[1],t4);let a=this._controlContainer=ie.create("div","maplibregl-control-container",i),s=this._controlPositions={};for(let n of["top-left","top-right","bottom-left","bottom-right"])s[n]=ie.create("div",`maplibregl-ctrl-${n} `,a);this._container.addEventListener("scroll",this._onMapScroll,false)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,false),this._canvas.removeEventListener("webglcontextlost",this._contextLost,false),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,false),this._container.classList.remove("maplibregl-map")}_resizeCanvas(e,t4,i){this._canvas.width=Math.floor(i*e),this._canvas.height=Math.floor(i*t4),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t4}px`}_setupPainter(){let e={...this._canvasContextAttributes,alpha:true,depth:true,stencil:true,premultipliedAlpha:true},t4=null;this._canvas.addEventListener("webglcontextcreationerror",r=>{t4=r},{once:true});let i=this._canvas.getContext("webgl2",e);if(!i)throw new oz(e,t4);this.painter=new nz(i,this._camera.transform)}migrateProjection(e,t4){this._camera.migrateProjection(e,t4),this.painter.transform=e,this.fire(new OA({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){var t4;return(t4=this.style)!=null&&t4._loaded?(this._styleDirty||(this._styleDirty=e),this._sourcesDirty=true,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var n,o,l,u,h;let t4=this._idleTriggered?this._fadeDuration:0,i=((n=this.style.projection)==null?void 0:n.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=false;if(this.style&&this._styleDirty){this._styleDirty=false;let c=this._camera.transform.zoom,d=ze();this.style.zoomHistory.update(c,d);let p=new Fe(c,{now:d,fadeDuration:t4,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),f=p.crossFadingFactor();(f!==1||f!==this._crossFadingFactor)&&(r=true,this._crossFadingFactor=f),this.style.update(p)}let a=((o=this.style.projection)==null?void 0:o.transitionState)>0!==i;this._camera.transform.setTransitionState((l=this.style.projection)==null?void 0:l.transitionState),this.style&&(this._sourcesDirty||a)&&(this._sourcesDirty=false,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=(u=this.style)==null?void 0:u._updatePlacement(this._camera.transform,this.showCollisionBoxes,t4,this._crossSourceCollisions,a),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t4,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new bt("render")),this.loaded()&&!this._loaded&&(this._loaded=true,this.fire(new bt("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=true),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty||((h=this.painter.renderToTexture)==null?void 0:h.needsFollowUpFrame);return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new bt("idle")),this._loaded&&!this._fullyLoaded&&!s&&(this._fullyLoaded=true),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._render(0)),this}remove(){var t4,i;this._hash&&this._hash.remove();for(let r of this._controls)r.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._renderTaskQueue.clear(),(t4=this._diffStyleRequest)==null||t4.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,false),qi.removeThrottleControl(this._imageQueueHandle),(i=this._resizeObserver)==null||i.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._cleanupContainer(),this._removed=true,this.fire(new bt("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Xt.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(t4){if(!Cr(t4))throw t4}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return eR}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(true)}};const tR={showCompass:true,showZoom:true,visualizePitch:false,visualizeRoll:true};var O4=class{constructor(e){this._updateZoomButtons=()=>{let t4=this._map.getZoom(),i=t4===this._map.getMaxZoom(),r=t4===this._map.getMinZoom(true);this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},this._rotateCompassArrow=()=>{let t4=this._map.getPitch(),i=this._map.getRoll(),r=this._map.getBearing(),a=1/Math.cos(Ze(t4))**.5;if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${a}) rotateZ(${-i}deg) rotateX(${t4}deg) rotateZ(${-r}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${a}) rotateX(${t4}deg) rotateZ(${-r}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-r-i}deg)`;return}this._compassIcon.style.transform=`rotate(${-r}deg)`},this._setButtonTitle=(t4,i)=>{let r=this._map._getUIString(`NavigationControl.${i}`);t4.title=r,t4.setAttribute("aria-label",r)},this.options=W({},tR,e),this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t4=>t4.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t4=>this._map.zoomIn({},{originalEvent:t4})),ie.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t4=>this._map.zoomOut({},{originalEvent:t4})),ie.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t4=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t4}):this._map.resetNorth({},{originalEvent:t4})}),this._compassIcon=ie.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("move",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new iR(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("move",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t4){let i=ie.create("button",e,this._container);return i.type="button",i.addEventListener("click",t4),i}},iR=class{constructor(e,t4,i=false){this.mousedown=a=>{this.startMove(a,ie.mousePos(this.element,a)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=a=>{this.move(a,ie.mousePos(this.element,a))},this.mouseup=a=>{this._rotatePitchHandler.dragEnd(a),this.offTemp()},this.touchstart=a=>{a.targetTouches.length===1?(this._startPos=this._lastPos=ie.touchPos(this.element,a.targetTouches)[0],this.startMove(a,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:false}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=a=>{a.targetTouches.length===1?(this._lastPos=ie.touchPos(this.element,a.targetTouches)[0],this.move(a,this._lastPos)):this.reset()},this.touchend=a=>{a.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=t4;let r=new Ez;this._rotatePitchHandler=new In({clickTolerance:3,move:(a,s)=>{let n=t4.getBoundingClientRect(),o=new C((n.bottom-n.top)/2,(n.right-n.left)/2);return{bearingDelta:a_(new C(a.x,s.y),s,o),pitchDelta:i?(s.y-a.y)*-.5:void 0}},moveStateManager:r,enable:true,assignEvents:()=>{}}),this.map=e,t4.addEventListener("mousedown",this.mousedown),t4.addEventListener("touchstart",this.touchstart,{passive:false}),t4.addEventListener("touchcancel",this.reset)}startMove(e,t4){this._rotatePitchHandler.dragStart(e,t4),ie.disableDrag()}move(e,t4){let i=this.map,{bearingDelta:r,pitchDelta:a}=this._rotatePitchHandler.dragMove(e,t4)||{};r&&i.setBearing(i.getBearing()+r),a&&i.setPitch(i.getPitch()+a)}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){ie.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}};let Br;async function rR(e=false){if(Br!==void 0&&!e)return Br;if(window.navigator.permissions===void 0)return Br=!!window.navigator.geolocation,Br;try{Br=(await window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Br=!!window.navigator.geolocation}return Br}function Bv(e,t4,i,r=false){if(r||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return e==null?void 0:e.wrap();let a=new H(e.lng,e.lat);if(e=new H(e.lng,e.lat),t4){let s=new H(e.lng-360,e.lat),n=new H(e.lng+360,e.lat),o=i.locationToScreenPoint(e).distSqr(t4);i.locationToScreenPoint(s).distSqr(t4)<o?e=s:i.locationToScreenPoint(n).distSqr(t4)<o&&(e=n)}for(;Math.abs(e.lng-i.center.lng)>180;){let s=i.locationToScreenPoint(e);if(s.x>=0&&s.y>=0&&s.x<=i.width&&s.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e.lng!==a.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(e))?e:a}const mp={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Ov(e,t4,i){let r=e.classList;for(let a in mp)r.remove(`maplibregl-${i}-anchor-${a}`);r.add(`maplibregl-${i}-anchor-${t4}`)}const Ng={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},$v="#3FB1CE";function ci(e,t4,i=[]){let r=ie.createNS("http://www.w3.org/2000/svg",e);for(let a in t4)r.setAttributeNS(null,a,t4[a]);for(let a of i)r.appendChild(a);return r}let _h;function aR(){return _h||(_h=ci("svg",{display:"block",height:"41px",width:"27px",viewBox:"0 0 27 41"},[ci("g",{"fill-rule":"nonzero"},[ci("g",{transform:"translate(3.0, 29.0)",fill:"#000000"},[["10.5","5.25002273"],["10.5","5.25002273"],["9.5","4.77275007"],["8.5","4.29549936"],["7.5","3.81822308"],["6.5","3.34094679"],["5.5","2.86367051"],["4.5","2.38636864"]].map(([e,t4])=>ci("ellipse",{opacity:"0.04",cx:"10.5",cy:"5.80029008",rx:e,ry:t4}))),ci("g",{fill:$v},[ci("path",{d:"M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"})]),ci("g",{opacity:"0.25",fill:"#000000"},[ci("path",{d:"M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"})]),ci("g",{transform:"translate(6.0, 7.0)",fill:"#FFFFFF"}),ci("g",{transform:"translate(8.0, 8.0)"},[ci("circle",{fill:"#000000",opacity:"0.25",cx:"5.5",cy:"5.5",r:"5.4999962"}),ci("circle",{fill:"#FFFFFF",cx:"5.5",cy:"5.5",r:"5.4999962"})])])]),_h)}function sR(e){return e.firstElementChild.children[1]}var Ea=class extends bi{},nR=class extends bi{},Gg=class extends pt{constructor(e){if(super(),this._onClick=t4=>{this.fire(new nR("click",{originalEvent:t4}))},this._onKeyPress=t4=>{(t4.code==="Space"||t4.code==="Enter")&&this.togglePopup()},this._onKeyDown=t4=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||t4.composedPath()[0]!==this._element||t4.altKey||t4.ctrlKey||t4.metaKey)return;let i=Ng[t4.key];if(!i)return;t4.preventDefault(),t4.stopPropagation();let r=t4.shiftKey?10:1,a=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new C(a.x+i[0]*r,a.y+i[1]*r))),this._keyboardDragActive||(this._keyboardDragActive=true,this.fire(new Ea("dragstart"))),this.fire(new Ea("drag"))},this._onKeyUp=t4=>{Ng[t4.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=t4=>{let i=t4.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()},this._updateCoveredUnthrottled=()=>{var r,a;let t4=(r=this._map)==null?void 0:r.terrain;if(!t4||!this._isInViewport())return;let i=this._isCovered(t4);i&&((a=this._popup)!=null&&a.isOpen())&&this._popup.remove(),this._element.style.opacity=i?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",i)},this._updateCovered=pp(this._updateCoveredUnthrottled,100),this._update=t4=>{if(!this._map)return;this._lngLat=Bv(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?i=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?r="rotateX(0deg)":this._pitchAlignment==="map"&&(r=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&(t4==null?void 0:t4.type)!=="move"&&(this._pos=this._pos.round()),this._element.style.transform=`${mp[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${i}`,this._updateOpacity()},this._onMove=t4=>{if(!this._isDragging){let i=this._clickTolerance||this._map._clickTolerance;this._isDragging=t4.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=t4.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new Ea("dragstart"))),this.fire(new Ea("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=false,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new Ea("dragend")),this._state="inactive"},this._addDragHandler=t4=>{this._element.contains(t4.originalEvent.target)&&(t4.preventDefault(),this._positionDelta=t4.point.sub(this._pos).add(this._offset),this._pointerdownPos=t4.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=(e==null?void 0:e.anchor)||"center",this._color=(e==null?void 0:e.color)||$v,this._scale=(e==null?void 0:e.scale)||1,this._draggable=(e==null?void 0:e.draggable)||false,this._clickTolerance=(e==null?void 0:e.clickTolerance)||0,this._subpixelPositioning=(e==null?void 0:e.subpixelPositioning)||false,this._isDragging=false,this._roleManaged=false,this._tabIndexManaged=false,this._keyboardDragActive=false,this._state="inactive",this._rotation=(e==null?void 0:e.rotation)||0,this._rotationAlignment=(e==null?void 0:e.rotationAlignment)||"auto",this._pitchAlignment=e!=null&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e==null?void 0:e.element)this._element=e.element,this._offset=C.convert((e==null?void 0:e.offset)||[0,0]);else{this._defaultMarker=true,this._element=ie.create("div");let t4=aR().cloneNode(true);t4.setAttributeNS(null,"height",`${41*this._scale}px`),t4.setAttributeNS(null,"width",`${27*this._scale}px`),sR(t4).setAttributeNS(null,"fill",this._color),this._element.appendChild(t4),this._offset=C.convert((e==null?void 0:e.offset)||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t4=>{t4.preventDefault()}),this._element.addEventListener("mousedown",t4=>{t4.preventDefault()}),Ov(this._element,this._anchor,"marker"),e==null?void 0:e.className)for(let t4 of e.className.split(" "))this._element.classList.add(t4);this._popup=null}addTo(e){return this.remove(),this._map=e,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._updateAccessibilityRole(),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),e.on("idle",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("idle",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=false,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=H.convert(e),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),e){if(!("offset"in e.options)){let t4=13.5/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[t4,(24.6+t4)*-1],"bottom-right":[-t4,(24.6+t4)*-1],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=false,this.fire(new Ea("dragend")))}getPopup(){return this._popup}togglePopup(){let e=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(e)e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map));else return this;return this}_updateOpacity(){var i;if(!this._isInViewport())return;let e=(i=this._map)==null?void 0:i.terrain,t4=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!e||t4){let r=t4?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==r&&(this._element.style.opacity=r,this._element.classList.toggle("maplibregl-marker-covered",t4));return}this._updateCovered()}_isInViewport(){let{width:e,height:t4}=this._map._camera.transform;return!!this._pos&&this._pos.x>=0&&this._pos.y>=0&&this._pos.x<=e&&this._pos.y<=t4}_isCovered(e){let t4=this._map._camera.transform,i=e.getElevationForLngLat(this._lngLat,t4),r=Math.max(0,-this._offset.y)/t4.pixelsPerMeter,a=Math.sin(this._map.getPitch()*Math.PI/180)*r;return t4.isLocationOccluded(this._lngLat,e,i+a)}getOffset(){return this._offset}setOffset(e){return this._offset=C.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=true):this._tabIndexManaged&&(this._tabIndexManaged=(this._element.getAttribute("tabindex")==="0"&&this._element.removeAttribute("tabindex"),false))}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let e=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",e),this._roleManaged=true}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t4){return(this._opacity===void 0||e===void 0&&t4===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=String(e)),t4!==void 0&&(this._opacityWhenCovered=String(t4)),this._map&&this._updateOpacity(),this}};const oR={positionOptions:{enableHighAccuracy:false,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:false,showAccuracyCircle:true,showUserLocation:true};let Po=0,As=false;var Sa=class extends bi{},Zg=class extends bi{},lR=class extends bi{},$4=class extends pt{constructor(e){super(),this._onSuccess=t4=>{if(this._map){if(this._isOutOfMapMaxBounds(t4)){this._setErrorState(),this.fire(new Zg("outofmaxbounds",t4)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=t4,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t4),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(t4),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new Zg("geolocate",t4)),this._finish()}},this._updateCamera=t4=>{let i=new H(t4.coords.longitude,t4.coords.latitude),r=t4.coords.accuracy,a=this._map.getBearing(),s=W({bearing:a},this.options.fitBoundsOptions),n=Yi.fromLngLat(i,r);this._map.fitBounds(n,s,{geolocateSource:true})},this._updateMarker=t4=>{if(t4){let i=new H(t4.coords.longitude,t4.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t4.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t4=>{if(this._map){if(t4.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=true;let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t4.code===3&&As)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new lR("error",t4)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t4=>{if(!this._map)return;let i=(t4==null?void 0:t4[0])instanceof ResizeObserverEntry;!t4.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!i&&!this._map.isZooming()&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new Sa("trackuserlocationend")),this.fire(new Sa("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t4=>{t4.preventDefault()}),this._geolocateButton=ie.create("button","maplibregl-ctrl-geolocate",this._container),ie.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=true)},this._finishSetupUI=t4=>{if(this._map){if(t4===false){ge("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=true,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=false,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=ie.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Gg({element:this._dotElement}),this._circleElement=ie.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Gg({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=true,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=W({},oR,e)}onAdd(e){return this._map=e,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),rR().then(t4=>this._finishSetupUI(t4)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,Po=0,As=false}_isOutOfMapMaxBounds(e){let t4=this._map.getMaxBounds(),i=e.coords;return t4&&(i.longitude<t4.getWest()||i.longitude>t4.getEast()||i.latitude<t4.getSouth()||i.latitude>t4.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":break;case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let e=this._userLocationDotMarker.getLngLat();if(!this.options.showUserLocation||!this.options.showAccuracyCircle||!this._accuracy||!e)return;let t4=this._map.project(e),i=this._map.unproject([t4.x+100,t4.y]),r=e.distanceTo(i)/100,a=2*this._accuracy/r;this._circleElement.style.width=`${a.toFixed(2)}px`,this._circleElement.style.height=`${a.toFixed(2)}px`}trigger(){if(!this._setup)return ge("Geolocate control triggered before added to a map"),false;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new Sa("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Po--,As=false,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new Sa("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new Sa("trackuserlocationstart")),this.fire(new Sa("userlocationfocus"));break;default:throw Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Po++;let e;Po>1?(e={maximumAge:6e5,timeout:0},As=true):(e=this.options.positionOptions,As=false),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return true}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};const uR={maxWidth:100,unit:"metric"};var V4=class{constructor(e){this._onMove=()=>{qg(this._map,this._container,this.options)},this.setUnit=t4=>{this.options.unit=t4,qg(this._map,this._container,this.options)},this.options={...uR,...e}}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}};function qg(e,t4,i){let r=(i==null?void 0:i.maxWidth)||100,{width:a,height:s}=e._camera.transform,n=s/2,o=a/2,l=e.unproject([o-r/2,n]),u=e.unproject([o+r/2,n]),h=Math.round(e.project(u).x-e.project(l).x),c=Math.min(r,h,a),d=l.distanceTo(u);if((i==null?void 0:i.unit)==="imperial"){let p=3.2808*d;p>5280?Is(t4,c,p/5280,e._getUIString("ScaleControl.Miles")):Is(t4,c,p,e._getUIString("ScaleControl.Feet"))}else(i==null?void 0:i.unit)==="nautical"?Is(t4,c,d/1852,e._getUIString("ScaleControl.NauticalMiles")):d>=1e3?Is(t4,c,d/1e3,e._getUIString("ScaleControl.Kilometers")):Is(t4,c,d,e._getUIString("ScaleControl.Meters"))}function Is(e,t4,i,r){let a=cR(i),s=a/i;e.style.width=`${t4*s}px`;let n=`${a}\xA0${r}`;e.textContent!==n&&(e.textContent=n)}function hR(e){let t4=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t4)/t4}function cR(e){let t4=10**(`${Math.floor(e)}`.length-1),i=e/t4;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:i>=1?1:hR(i),t4*i}var Wg=class extends bi{},j4=class extends pt{constructor(e={}){super(),this._onFullscreenChange=()=>{var i;let t4=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;(i=t4==null?void 0:t4.shadowRoot)!=null&&i.fullscreenElement;)t4=t4.shadowRoot.fullscreenElement;t4===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=false,this._pseudo=e.pseudo??false,e!=null&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:ge("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=ie.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ie.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new Wg("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new Wg("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},U4=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=e}onAdd(e){return this._map=e,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ie.create("button","maplibregl-ctrl-terrain",this._container),ie.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},N4=class{constructor(){this._toggleProjection=()=>{var t4;let e=(t4=this._map.getProjection())==null?void 0:t4.type;e==="mercator"||!e?this._map.setProjection({type:"globe"}):this._map.setProjection({type:"mercator"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((e=this._map.getProjection())==null?void 0:e.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=ie.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ie.create("button","maplibregl-ctrl-globe",this._container),ie.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}};const dR={closeButton:true,closeOnClick:true,focusAfterOpen:true,className:"",maxWidth:"240px",subpixelPositioning:false,locationOccludedOpacity:void 0,padding:void 0},pR=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");var Hg=class extends bi{},G4=class extends pt{constructor(e){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity="")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("idle",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new Hg("close"))),this),this._update=t4=>{let i=this._lngLat||this._trackPointer;if(!this._map||!i||!this._content)return;if(!this._container){if(this._container=ie.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ie.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let l of this.options.className.split(" "))this._container.classList.add(l);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Bv(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer);let r;if(t4&&"point"in t4&&t4.point&&(r=t4.point),this._trackPointer&&!r)return;let a=this._flatPos=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&r?r:this._map._camera.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor,n=Vv(this.options.offset);if(!s){let l=this._container.offsetWidth,u=this._container.offsetHeight,h=fR(this.options.padding),c;c=a.y+n.bottom.y<u+h.top?["top"]:a.y>this._map._camera.transform.height-u-h.bottom?["bottom"]:[],a.x<l/2+h.left?c.push("left"):a.x>this._map._camera.transform.width-l/2-h.right&&c.push("right"),s=c.length===0?"bottom":c.join("-")}let o=a.add(n[s]);this.options.subpixelPositioning||(o=o.round()),this._container.style.transform=`${mp[s]} translate(${o.x}px,${o.y}px)`,Ov(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=W(Object.create(dR),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._map.on("idle",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new Hg("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=H.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=false,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=true,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t4=document.createDocumentFragment(),i=document.createElement("body"),r;for(i.innerHTML=e;r=i.firstChild,r;)t4.appendChild(r);return this.setDOMContent(t4)}getMaxWidth(){var e;return(e=this._container)==null?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ie.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=ie.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(pR);e&&e.focus()}};function Vv(e){if(!e)return Vv(new C(0,0));if(typeof e=="number"){let t4=Math.round(Math.abs(e)/Math.SQRT2);return{center:new C(0,0),top:new C(0,e),"top-left":new C(t4,t4),"top-right":new C(-t4,t4),bottom:new C(0,-e),"bottom-left":new C(t4,-t4),"bottom-right":new C(-t4,-t4),left:new C(e,0),right:new C(-e,0)}}if(e instanceof C||Array.isArray(e)){let t4=C.convert(e);return{center:t4,top:t4,"top-left":t4,"top-right":t4,bottom:t4,"bottom-left":t4,"bottom-right":t4,left:t4,right:t4}}return{center:C.convert(e.center||[0,0]),top:C.convert(e.top||[0,0]),"top-left":C.convert(e["top-left"]||[0,0]),"top-right":C.convert(e["top-right"]||[0,0]),bottom:C.convert(e.bottom||[0,0]),"bottom-left":C.convert(e["bottom-left"]||[0,0]),"bottom-right":C.convert(e["bottom-right"]||[0,0]),left:C.convert(e.left||[0,0]),right:C.convert(e.right||[0,0])}}function fR(e){return e?{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}:{top:0,right:0,bottom:0,left:0}}const mR=D1;function Z4(e,t4){return pn().setRTLTextPlugin(e,t4)}function q4(){return pn().getRTLTextPluginStatus()}function W4(){return mR}function H4(){return eu.workerCount}function X4(e){eu.workerCount=e}function Y4(){return xi.MAX_PARALLEL_IMAGE_REQUESTS}function K4(e){xi.MAX_PARALLEL_IMAGE_REQUESTS=e}function J4(){return xi.WORKER_URL}function Q4(e){xi.WORKER_URL=e}async function e6(e){await F1().broadcast("IS",e)}export{Wo as AJAXError,Hz as AttributionControl,_z as BoxZoomHandler,HI as CanvasSource,Nz as CooperativeGesturesHandler,Bz as DoubleClickZoomHandler,Vz as DragPanHandler,jz as DragRotateHandler,k as EXTENT,ug as EdgeInsets,Y as ErrorEvent,bi as Event,pt as Evented,j4 as FullscreenControl,Wg as FullscreenEvent,oz as GPUInitializationError,LI as GeoJSONSource,$4 as GeolocateControl,lR as GeolocateErrorEvent,Sa as GeolocateEvent,Zg as GeolocatePositionEvent,N4 as GlobeControl,lz as Hash,Pn as ImageSource,Rz as KeyboardHandler,H as LngLat,Yi as LngLatBounds,Xz as LogoControl,B4 as Map,Rm as MapBoxZoomEvent,eh as MapContextEvent,bt as MapLibreEvent,B4 as MapLibreMap,ri as MapMouseEvent,Q as MapMovementEvent,OA as MapProjectionEvent,Ge as MapSourceDataEvent,Di as MapStyleDataEvent,$A as MapStyleImageMissingEvent,zm as MapStyleLoadEvent,BA as MapTerrainEvent,fo as MapTouchEvent,LA as MapWheelEvent,Gg as Marker,nR as MarkerClickEvent,Ea as MarkerDragEvent,Ie as MercatorCoordinate,O4 as NavigationControl,C as Point,G4 as Popup,Hg as PopupEvent,PI as RasterDEMTileSource,B1 as RasterTileSource,V4 as ScaleControl,Lz as ScrollZoomHandler,Sg as Style,U4 as TerrainControl,Fz as TwoFingersTouchPitchHandler,Mz as TwoFingersTouchRotateHandler,Iz as TwoFingersTouchZoomHandler,Uz as TwoFingersTouchZoomRotateHandler,CI as VectorTileSource,WI as VideoSource,gR as addProtocol,L4 as addSourceType,k4 as clearPrewarmedResources,xi as config,UI as createTileMesh,F1 as getGlobalDispatcher,Y4 as getMaxParallelImageRequests,q4 as getRTLTextPluginStatus,W4 as getVersion,H4 as getWorkerCount,J4 as getWorkerUrl,e6 as importScriptInWorkers,z4 as isTimeFrozen,ze as now,R4 as prewarm,_R as removeProtocol,F4 as restoreNow,K4 as setMaxParallelImageRequests,M4 as setNow,Z4 as setRTLTextPlugin,X4 as setWorkerCount,Q4 as setWorkerUrl};