@local-logic/sdks-app 1.0.0-beta.49 → 1.0.0-beta.50

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 (214) hide show
  1. package/dist/assets/{index.d3f78cf1.css → chevron_right.2aa1109f.css} +0 -0
  2. package/dist/assets/chevron_right.4d3152f8.js +587 -0
  3. package/dist/assets/index.5b4e1a6e.js +183 -0
  4. package/dist/assets/index.9276bc44.js +1 -0
  5. package/dist/assets/index.993161da.js +1 -0
  6. package/dist/assets/index.cc7e4871.js +94 -0
  7. package/dist/assets/index.e82abb8d.js +1 -0
  8. package/dist/assets/index.fb8ba143.js +1029 -0
  9. package/dist/assets/index.fe0fe532.js +1 -0
  10. package/dist/index.html +1 -1
  11. package/dist/types/App.d.ts.map +1 -1
  12. package/dist/types/App.js +3 -1
  13. package/dist/types/App.js.map +1 -1
  14. package/dist/types/RouteTemplates/index.d.ts.map +1 -1
  15. package/dist/types/RouteTemplates/index.js +9 -1
  16. package/dist/types/RouteTemplates/index.js.map +1 -1
  17. package/dist/types/{sdks/LocalContent/Map → components}/Pin/index.d.ts +0 -0
  18. package/dist/types/components/Pin/index.d.ts.map +1 -0
  19. package/dist/types/{sdks/LocalContent/Map → components}/Pin/index.js +0 -0
  20. package/dist/types/components/Pin/index.js.map +1 -0
  21. package/dist/types/constants/routes.d.ts +2 -1
  22. package/dist/types/constants/routes.d.ts.map +1 -1
  23. package/dist/types/constants/routes.js +1 -0
  24. package/dist/types/constants/routes.js.map +1 -1
  25. package/dist/types/context/languageProvider/data-explorer/index.d.ts +6 -0
  26. package/dist/types/context/languageProvider/data-explorer/index.d.ts.map +1 -0
  27. package/dist/types/context/languageProvider/data-explorer/index.js +6 -0
  28. package/dist/types/context/languageProvider/data-explorer/index.js.map +1 -0
  29. package/dist/types/context/languageProvider/data-explorer/locales/en/index.d.ts +5 -0
  30. package/dist/types/context/languageProvider/data-explorer/locales/en/index.d.ts.map +1 -0
  31. package/dist/types/context/languageProvider/data-explorer/locales/en/index.js +23 -0
  32. package/dist/types/context/languageProvider/data-explorer/locales/en/index.js.map +1 -0
  33. package/dist/types/context/languageProvider/data-explorer/locales/fr/index.d.ts +5 -0
  34. package/dist/types/context/languageProvider/data-explorer/locales/fr/index.d.ts.map +1 -0
  35. package/dist/types/context/languageProvider/data-explorer/locales/fr/index.js +23 -0
  36. package/dist/types/context/languageProvider/data-explorer/locales/fr/index.js.map +1 -0
  37. package/dist/types/context/languageProvider/data-explorer/types.d.ts +5 -0
  38. package/dist/types/context/languageProvider/data-explorer/types.d.ts.map +1 -0
  39. package/dist/types/context/languageProvider/data-explorer/types.js +2 -0
  40. package/dist/types/context/languageProvider/data-explorer/types.js.map +1 -0
  41. package/dist/types/context/languageProvider/index.d.ts +15 -0
  42. package/dist/types/context/languageProvider/index.d.ts.map +1 -0
  43. package/dist/types/context/languageProvider/index.js +48 -0
  44. package/dist/types/context/languageProvider/index.js.map +1 -0
  45. package/dist/types/context/languageProvider/local-content/index.d.ts +6 -0
  46. package/dist/types/context/languageProvider/local-content/index.d.ts.map +1 -0
  47. package/dist/types/context/languageProvider/local-content/index.js +6 -0
  48. package/dist/types/context/languageProvider/local-content/index.js.map +1 -0
  49. package/dist/types/context/languageProvider/local-content/locales/en/index.d.ts +5 -0
  50. package/dist/types/context/languageProvider/local-content/locales/en/index.d.ts.map +1 -0
  51. package/dist/types/context/languageProvider/local-content/locales/en/index.js +4 -0
  52. package/dist/types/context/languageProvider/local-content/locales/en/index.js.map +1 -0
  53. package/dist/types/context/languageProvider/local-content/locales/fr/index.d.ts +5 -0
  54. package/dist/types/context/languageProvider/local-content/locales/fr/index.d.ts.map +1 -0
  55. package/dist/types/context/languageProvider/local-content/locales/fr/index.js +4 -0
  56. package/dist/types/context/languageProvider/local-content/locales/fr/index.js.map +1 -0
  57. package/dist/types/context/languageProvider/local-content/types.d.ts +2 -0
  58. package/dist/types/context/languageProvider/local-content/types.d.ts.map +1 -0
  59. package/dist/types/context/languageProvider/local-content/types.js +2 -0
  60. package/dist/types/context/languageProvider/local-content/types.js.map +1 -0
  61. package/dist/types/context/languageProvider/sdkLocales.d.ts +9 -0
  62. package/dist/types/context/languageProvider/sdkLocales.d.ts.map +1 -0
  63. package/dist/types/context/languageProvider/sdkLocales.js +7 -0
  64. package/dist/types/context/languageProvider/sdkLocales.js.map +1 -0
  65. package/dist/types/context/languageProvider/types.d.ts +5 -0
  66. package/dist/types/context/languageProvider/types.d.ts.map +1 -0
  67. package/dist/types/context/languageProvider/types.js +2 -0
  68. package/dist/types/context/languageProvider/types.js.map +1 -0
  69. package/dist/types/context/stateManager/defaultState.d.ts.map +1 -1
  70. package/dist/types/context/stateManager/defaultState.js +5 -0
  71. package/dist/types/context/stateManager/defaultState.js.map +1 -1
  72. package/dist/types/context/stateManager/index.d.ts +3 -3
  73. package/dist/types/context/stateManager/index.d.ts.map +1 -1
  74. package/dist/types/features/demographics/index.d.ts +3 -0
  75. package/dist/types/features/demographics/index.d.ts.map +1 -0
  76. package/dist/types/features/demographics/index.js +3 -0
  77. package/dist/types/features/demographics/index.js.map +1 -0
  78. package/dist/types/features/demographics/keyFactory.d.ts +10 -0
  79. package/dist/types/features/demographics/keyFactory.d.ts.map +1 -0
  80. package/dist/types/features/demographics/keyFactory.js +5 -0
  81. package/dist/types/features/demographics/keyFactory.js.map +1 -0
  82. package/dist/types/features/demographics/types.d.ts +4 -0
  83. package/dist/types/features/demographics/types.d.ts.map +1 -0
  84. package/dist/types/features/demographics/types.js +2 -0
  85. package/dist/types/features/demographics/types.js.map +1 -0
  86. package/dist/types/features/profiles/index.d.ts +3 -0
  87. package/dist/types/features/profiles/index.d.ts.map +1 -0
  88. package/dist/types/features/profiles/index.js +3 -0
  89. package/dist/types/features/profiles/index.js.map +1 -0
  90. package/dist/types/features/profiles/keyFactory.d.ts +10 -0
  91. package/dist/types/features/profiles/keyFactory.d.ts.map +1 -0
  92. package/dist/types/features/profiles/keyFactory.js +5 -0
  93. package/dist/types/features/profiles/keyFactory.js.map +1 -0
  94. package/dist/types/features/profiles/types.d.ts +4 -0
  95. package/dist/types/features/profiles/types.d.ts.map +1 -0
  96. package/dist/types/features/profiles/types.js +2 -0
  97. package/dist/types/features/profiles/types.js.map +1 -0
  98. package/dist/types/sdks/DataExplorer/components/Demographics/index.d.ts +4 -0
  99. package/dist/types/sdks/DataExplorer/components/Demographics/index.d.ts.map +1 -0
  100. package/dist/types/sdks/DataExplorer/components/Demographics/index.js +15 -0
  101. package/dist/types/sdks/DataExplorer/components/Demographics/index.js.map +1 -0
  102. package/dist/types/sdks/DataExplorer/components/Demographics/styles.d.ts +2 -0
  103. package/dist/types/sdks/DataExplorer/components/Demographics/styles.d.ts.map +1 -0
  104. package/dist/types/sdks/DataExplorer/components/Demographics/styles.js +6 -0
  105. package/dist/types/sdks/DataExplorer/components/Demographics/styles.js.map +1 -0
  106. package/dist/types/sdks/DataExplorer/components/Export/index.d.ts +4 -0
  107. package/dist/types/sdks/DataExplorer/components/Export/index.d.ts.map +1 -0
  108. package/dist/types/sdks/DataExplorer/components/Export/index.js +239 -0
  109. package/dist/types/sdks/DataExplorer/components/Export/index.js.map +1 -0
  110. package/dist/types/sdks/DataExplorer/components/Export/styles.d.ts +3 -0
  111. package/dist/types/sdks/DataExplorer/components/Export/styles.d.ts.map +1 -0
  112. package/dist/types/sdks/DataExplorer/components/Export/styles.js +18 -0
  113. package/dist/types/sdks/DataExplorer/components/Export/styles.js.map +1 -0
  114. package/dist/types/sdks/DataExplorer/components/Map/index.d.ts +4 -0
  115. package/dist/types/sdks/DataExplorer/components/Map/index.d.ts.map +1 -0
  116. package/dist/types/sdks/DataExplorer/components/Map/index.js +49 -0
  117. package/dist/types/sdks/DataExplorer/components/Map/index.js.map +1 -0
  118. package/dist/types/sdks/DataExplorer/components/Map/styles.d.ts +2 -0
  119. package/dist/types/sdks/DataExplorer/components/Map/styles.d.ts.map +1 -0
  120. package/dist/types/sdks/DataExplorer/components/Map/styles.js +8 -0
  121. package/dist/types/sdks/DataExplorer/components/Map/styles.js.map +1 -0
  122. package/dist/types/sdks/DataExplorer/components/POIs/index.d.ts +4 -0
  123. package/dist/types/sdks/DataExplorer/components/POIs/index.d.ts.map +1 -0
  124. package/dist/types/sdks/DataExplorer/components/POIs/index.js +42 -0
  125. package/dist/types/sdks/DataExplorer/components/POIs/index.js.map +1 -0
  126. package/dist/types/sdks/DataExplorer/components/POIs/styles.d.ts +2 -0
  127. package/dist/types/sdks/DataExplorer/components/POIs/styles.d.ts.map +1 -0
  128. package/dist/types/sdks/DataExplorer/components/POIs/styles.js +6 -0
  129. package/dist/types/sdks/DataExplorer/components/POIs/styles.js.map +1 -0
  130. package/dist/types/sdks/DataExplorer/components/Schools/index.d.ts +4 -0
  131. package/dist/types/sdks/DataExplorer/components/Schools/index.d.ts.map +1 -0
  132. package/dist/types/sdks/DataExplorer/components/Schools/index.js +21 -0
  133. package/dist/types/sdks/DataExplorer/components/Schools/index.js.map +1 -0
  134. package/dist/types/sdks/DataExplorer/components/Schools/styles.d.ts +2 -0
  135. package/dist/types/sdks/DataExplorer/components/Schools/styles.d.ts.map +1 -0
  136. package/dist/types/sdks/DataExplorer/components/Schools/styles.js +6 -0
  137. package/dist/types/sdks/DataExplorer/components/Schools/styles.js.map +1 -0
  138. package/dist/types/sdks/DataExplorer/components/Scores/index.d.ts +4 -0
  139. package/dist/types/sdks/DataExplorer/components/Scores/index.d.ts.map +1 -0
  140. package/dist/types/sdks/DataExplorer/components/Scores/index.js +29 -0
  141. package/dist/types/sdks/DataExplorer/components/Scores/index.js.map +1 -0
  142. package/dist/types/sdks/DataExplorer/components/Scores/styles.d.ts +2 -0
  143. package/dist/types/sdks/DataExplorer/components/Scores/styles.d.ts.map +1 -0
  144. package/dist/types/sdks/DataExplorer/components/Scores/styles.js +6 -0
  145. package/dist/types/sdks/DataExplorer/components/Scores/styles.js.map +1 -0
  146. package/dist/types/sdks/DataExplorer/components/Section/index.d.ts +12 -0
  147. package/dist/types/sdks/DataExplorer/components/Section/index.d.ts.map +1 -0
  148. package/dist/types/sdks/DataExplorer/components/Section/index.js +34 -0
  149. package/dist/types/sdks/DataExplorer/components/Section/index.js.map +1 -0
  150. package/dist/types/sdks/DataExplorer/components/Section/styles.d.ts +11 -0
  151. package/dist/types/sdks/DataExplorer/components/Section/styles.d.ts.map +1 -0
  152. package/dist/types/sdks/DataExplorer/components/Section/styles.js +69 -0
  153. package/dist/types/sdks/DataExplorer/components/Section/styles.js.map +1 -0
  154. package/dist/types/sdks/DataExplorer/context.d.ts +41 -0
  155. package/dist/types/sdks/DataExplorer/context.d.ts.map +1 -0
  156. package/dist/types/sdks/DataExplorer/context.js +45 -0
  157. package/dist/types/sdks/DataExplorer/context.js.map +1 -0
  158. package/dist/types/sdks/DataExplorer/defaultState.d.ts +7 -0
  159. package/dist/types/sdks/DataExplorer/defaultState.d.ts.map +1 -0
  160. package/dist/types/sdks/DataExplorer/defaultState.js +3 -0
  161. package/dist/types/sdks/DataExplorer/defaultState.js.map +1 -0
  162. package/dist/types/sdks/DataExplorer/features/useDemographics.d.ts +7 -0
  163. package/dist/types/sdks/DataExplorer/features/useDemographics.d.ts.map +1 -0
  164. package/dist/types/sdks/DataExplorer/features/useDemographics.js +24 -0
  165. package/dist/types/sdks/DataExplorer/features/useDemographics.js.map +1 -0
  166. package/dist/types/sdks/DataExplorer/features/usePois.d.ts +10 -0
  167. package/dist/types/sdks/DataExplorer/features/usePois.d.ts.map +1 -0
  168. package/dist/types/sdks/DataExplorer/features/usePois.js +29 -0
  169. package/dist/types/sdks/DataExplorer/features/usePois.js.map +1 -0
  170. package/dist/types/sdks/DataExplorer/features/useProfiles.d.ts +6 -0
  171. package/dist/types/sdks/DataExplorer/features/useProfiles.d.ts.map +1 -0
  172. package/dist/types/sdks/DataExplorer/features/useProfiles.js +23 -0
  173. package/dist/types/sdks/DataExplorer/features/useProfiles.js.map +1 -0
  174. package/dist/types/sdks/DataExplorer/features/useSchools.d.ts +8 -0
  175. package/dist/types/sdks/DataExplorer/features/useSchools.d.ts.map +1 -0
  176. package/dist/types/sdks/DataExplorer/features/useSchools.js +25 -0
  177. package/dist/types/sdks/DataExplorer/features/useSchools.js.map +1 -0
  178. package/dist/types/sdks/DataExplorer/features/useScores.d.ts +8 -0
  179. package/dist/types/sdks/DataExplorer/features/useScores.d.ts.map +1 -0
  180. package/dist/types/sdks/DataExplorer/features/useScores.js +26 -0
  181. package/dist/types/sdks/DataExplorer/features/useScores.js.map +1 -0
  182. package/dist/types/sdks/DataExplorer/index.d.ts +5 -0
  183. package/dist/types/sdks/DataExplorer/index.d.ts.map +1 -0
  184. package/dist/types/sdks/DataExplorer/index.js +66 -0
  185. package/dist/types/sdks/DataExplorer/index.js.map +1 -0
  186. package/dist/types/sdks/DataExplorer/styles.d.ts +5 -0
  187. package/dist/types/sdks/DataExplorer/styles.d.ts.map +1 -0
  188. package/dist/types/sdks/DataExplorer/styles.js +14 -0
  189. package/dist/types/sdks/DataExplorer/styles.js.map +1 -0
  190. package/dist/types/sdks/DataExplorer/types.d.ts +11 -0
  191. package/dist/types/sdks/DataExplorer/types.d.ts.map +1 -0
  192. package/dist/types/sdks/DataExplorer/types.js +2 -0
  193. package/dist/types/sdks/DataExplorer/types.js.map +1 -0
  194. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/index.d.ts +1 -2
  195. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/index.d.ts.map +1 -1
  196. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/index.js +5 -9
  197. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/ScoreCategory/index.js.map +1 -1
  198. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/index.d.ts.map +1 -1
  199. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/index.js +1 -1
  200. package/dist/types/sdks/LocalContent/Map/DesktopScores/ScoreCategoryAccordion/index.js.map +1 -1
  201. package/dist/types/sdks/LocalContent/Map/index.d.ts.map +1 -1
  202. package/dist/types/sdks/LocalContent/Map/index.js +2 -10
  203. package/dist/types/sdks/LocalContent/Map/index.js.map +1 -1
  204. package/dist/types/services/downloadFile/index.d.ts +6 -0
  205. package/dist/types/services/downloadFile/index.d.ts.map +1 -0
  206. package/dist/types/services/downloadFile/index.js +17 -0
  207. package/dist/types/services/downloadFile/index.js.map +1 -0
  208. package/dist/types/types/sdks.d.ts +2 -0
  209. package/dist/types/types/sdks.d.ts.map +1 -1
  210. package/package.json +8 -5
  211. package/dist/assets/index.177feb04.js +0 -895
  212. package/dist/assets/index.e216285c.js +0 -769
  213. package/dist/types/sdks/LocalContent/Map/Pin/index.d.ts.map +0 -1
  214. package/dist/types/sdks/LocalContent/Map/Pin/index.js.map +0 -1
@@ -0,0 +1,587 @@
1
+ import{v as wp,w as Qu,y as Tp,z as eh,A as th,B as Ep,C as Sp,D as Ip,G as ih,H as Cp,I as Ks,r as _e,J as Ap,K as Mp,L as zp,M as wc,R as lt,j as rh,N as Pp,P as Ei,$ as kp}from"./index.fb8ba143.js";var Dp=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};class Lp extends wp{constructor(L,B){super(),this.client=L,this.options=B,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(B)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.length===1&&(this.currentQuery.addObserver(this),nh(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.listeners.length||this.destroy()}shouldFetchOnReconnect(){return xc(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return xc(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=[],this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(L,B){const j=this.options,Z=this.currentQuery;if(this.options=this.client.defaultQueryOptions(L),Qu(j,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),typeof this.options.enabled!="undefined"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=j.queryKey),this.updateQuery();const X=this.hasListeners();X&&oh(this.currentQuery,Z,this.options,j)&&this.executeFetch(),this.updateResult(B),X&&(this.currentQuery!==Z||this.options.enabled!==j.enabled||this.options.staleTime!==j.staleTime)&&this.updateStaleTimeout();const ge=this.computeRefetchInterval();X&&(this.currentQuery!==Z||this.options.enabled!==j.enabled||ge!==this.currentRefetchInterval)&&this.updateRefetchInterval(ge)}getOptimisticResult(L){const B=this.client.getQueryCache().build(this.client,L);return this.createResult(B,L)}getCurrentResult(){return this.currentResult}trackResult(L){const B={};return Object.keys(L).forEach(j=>{Object.defineProperty(B,j,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(j),L[j])})}),B}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:L,...B}={}){return this.fetch({...B,meta:{refetchPage:L}})}fetchOptimistic(L){const B=this.client.defaultQueryOptions(L),j=this.client.getQueryCache().build(this.client,B);return j.isFetchingOptimistic=!0,j.fetch().then(()=>this.createResult(j,B))}fetch(L){var B;return this.executeFetch({...L,cancelRefetch:(B=L.cancelRefetch)!=null?B:!0}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(L){this.updateQuery();let B=this.currentQuery.fetch(this.options,L);return L!=null&&L.throwOnError||(B=B.catch(Tp)),B}updateStaleTimeout(){if(this.clearStaleTimeout(),eh||this.currentResult.isStale||!th(this.options.staleTime))return;const B=Ep(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},B)}computeRefetchInterval(){var L;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(L=this.options.refetchInterval)!=null?L:!1}updateRefetchInterval(L){this.clearRefetchInterval(),this.currentRefetchInterval=L,!(eh||this.options.enabled===!1||!th(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||Sp.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(L,B){const j=this.currentQuery,Z=this.options,X=this.currentResult,ge=this.currentResultState,l=this.currentResultOptions,ye=L!==j,pe=ye?L.state:this.currentQueryInitialState,Me=ye?this.currentResult:this.previousQueryResult,{state:we}=L;let{dataUpdatedAt:se,error:gt,errorUpdatedAt:st,fetchStatus:He,status:_t}=we,Mt=!1,ct=!1,bt;if(B._optimisticResults){const Dt=this.hasListeners(),Fi=!Dt&&nh(L,B),_i=Dt&&oh(L,j,B,Z);(Fi||_i)&&(He=Ip(L.options.networkMode)?"fetching":"paused",se||(_t="loading")),B._optimisticResults==="isRestoring"&&(He="idle")}if(B.keepPreviousData&&!we.dataUpdateCount&&Me!=null&&Me.isSuccess&&_t!=="error")bt=Me.data,se=Me.dataUpdatedAt,_t=Me.status,Mt=!0;else if(B.select&&typeof we.data!="undefined")if(X&&we.data===(ge==null?void 0:ge.data)&&B.select===this.selectFn)bt=this.selectResult;else try{this.selectFn=B.select,bt=B.select(we.data),bt=ih(X==null?void 0:X.data,bt,B),this.selectResult=bt,this.selectError=null}catch(Dt){this.selectError=Dt}else bt=we.data;if(typeof B.placeholderData!="undefined"&&typeof bt=="undefined"&&_t==="loading"){let Dt;if(X!=null&&X.isPlaceholderData&&B.placeholderData===(l==null?void 0:l.placeholderData))Dt=X.data;else if(Dt=typeof B.placeholderData=="function"?B.placeholderData():B.placeholderData,B.select&&typeof Dt!="undefined")try{Dt=B.select(Dt),Dt=ih(X==null?void 0:X.data,Dt,B),this.selectError=null}catch(Fi){this.selectError=Fi}typeof Dt!="undefined"&&(_t="success",bt=Dt,ct=!0)}this.selectError&&(gt=this.selectError,bt=this.selectResult,st=Date.now(),_t="error");const Si=He==="fetching";return{status:_t,fetchStatus:He,isLoading:_t==="loading",isSuccess:_t==="success",isError:_t==="error",data:bt,dataUpdatedAt:se,error:gt,errorUpdatedAt:st,failureCount:we.fetchFailureCount,errorUpdateCount:we.errorUpdateCount,isFetched:we.dataUpdateCount>0||we.errorUpdateCount>0,isFetchedAfterMount:we.dataUpdateCount>pe.dataUpdateCount||we.errorUpdateCount>pe.errorUpdateCount,isFetching:Si,isRefetching:Si&&_t!=="loading",isLoadingError:_t==="error"&&we.dataUpdatedAt===0,isPaused:He==="paused",isPlaceholderData:ct,isPreviousData:Mt,isRefetchError:_t==="error"&&we.dataUpdatedAt!==0,isStale:Tc(L,B),refetch:this.refetch,remove:this.remove}}updateResult(L){const B=this.currentResult,j=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,Qu(j,B))return;this.currentResult=j;const Z={cache:!0},X=()=>{if(!B)return!0;const{notifyOnChangeProps:ge}=this.options;if(ge==="all"||!ge&&!this.trackedProps.size)return!0;const l=new Set(ge!=null?ge:this.trackedProps);return this.options.useErrorBoundary&&l.add("error"),Object.keys(this.currentResult).some(ye=>{const pe=ye;return this.currentResult[pe]!==B[pe]&&l.has(pe)})};(L==null?void 0:L.listeners)!==!1&&X()&&(Z.listeners=!0),this.notify({...Z,...L})}updateQuery(){const L=this.client.getQueryCache().build(this.client,this.options);if(L===this.currentQuery)return;const B=this.currentQuery;this.currentQuery=L,this.currentQueryInitialState=L.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(B==null||B.removeObserver(this),L.addObserver(this))}onQueryUpdate(L){const B={};L.type==="success"?B.onSuccess=!L.manual:L.type==="error"&&!Cp(L.error)&&(B.onError=!0),this.updateResult(B),this.hasListeners()&&this.updateTimers()}notify(L){Ks.batch(()=>{if(L.onSuccess){var B,j,Z,X;(B=(j=this.options).onSuccess)==null||B.call(j,this.currentResult.data),(Z=(X=this.options).onSettled)==null||Z.call(X,this.currentResult.data,null)}else if(L.onError){var ge,l,ye,pe;(ge=(l=this.options).onError)==null||ge.call(l,this.currentResult.error),(ye=(pe=this.options).onSettled)==null||ye.call(pe,void 0,this.currentResult.error)}L.listeners&&this.listeners.forEach(Me=>{Me(this.currentResult)}),L.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function Rp(A,L){return L.enabled!==!1&&!A.state.dataUpdatedAt&&!(A.state.status==="error"&&L.retryOnMount===!1)}function nh(A,L){return Rp(A,L)||A.state.dataUpdatedAt>0&&xc(A,L,L.refetchOnMount)}function xc(A,L,B){if(L.enabled!==!1){const j=typeof B=="function"?B(A):B;return j==="always"||j!==!1&&Tc(A,L)}return!1}function oh(A,L,B,j){return B.enabled!==!1&&(A!==L||j.enabled===!1)&&(!B.suspense||A.state.status!=="error")&&Tc(A,B)}function Tc(A,L){return A.isStaleByTime(L.staleTime)}const ph=_e.exports.createContext(!1),Bp=()=>_e.exports.useContext(ph);ph.Provider;var fh={exports:{}},mh={};/**
2
+ * @license React
3
+ * use-sync-external-store-shim.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Jo=_e.exports;function Fp(A,L){return A===L&&(A!==0||1/A===1/L)||A!==A&&L!==L}var Op=typeof Object.is=="function"?Object.is:Fp,Up=Jo.useState,$p=Jo.useEffect,Vp=Jo.useLayoutEffect,Np=Jo.useDebugValue;function Gp(A,L){var B=L(),j=Up({inst:{value:B,getSnapshot:L}}),Z=j[0].inst,X=j[1];return Vp(function(){Z.value=B,Z.getSnapshot=L,_c(Z)&&X({inst:Z})},[A,B,L]),$p(function(){return _c(Z)&&X({inst:Z}),A(function(){_c(Z)&&X({inst:Z})})},[A]),Np(B),B}function _c(A){var L=A.getSnapshot;A=A.value;try{var B=L();return!Op(A,B)}catch{return!0}}function qp(A,L){return L()}var Zp=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?qp:Gp;mh.useSyncExternalStore=Jo.useSyncExternalStore!==void 0?Jo.useSyncExternalStore:Zp;fh.exports=mh;function jp(){let A=!1;return{clearReset:()=>{A=!1},reset:()=>{A=!0},isReset:()=>A}}const Xp=_e.exports.createContext(jp()),Wp=()=>_e.exports.useContext(Xp);function Hp(A,L){return typeof A=="function"?A(...L):!!A}function Kp(A,L){const B=Ap({context:A.context}),j=Bp(),Z=Wp(),X=B.defaultQueryOptions(A);X._optimisticResults=j?"isRestoring":"optimistic",X.onError&&(X.onError=Ks.batchCalls(X.onError)),X.onSuccess&&(X.onSuccess=Ks.batchCalls(X.onSuccess)),X.onSettled&&(X.onSettled=Ks.batchCalls(X.onSettled)),X.suspense&&typeof X.staleTime!="number"&&(X.staleTime=1e3),(X.suspense||X.useErrorBoundary)&&(Z.isReset()||(X.retryOnMount=!1));const[ge]=_e.exports.useState(()=>new L(B,X)),l=ge.getOptimisticResult(X);if(fh.exports.useSyncExternalStore(_e.exports.useCallback(ye=>j?()=>{}:ge.subscribe(Ks.batchCalls(ye)),[ge,j]),()=>ge.getCurrentResult(),()=>ge.getCurrentResult()),_e.exports.useEffect(()=>{Z.clearReset()},[Z]),_e.exports.useEffect(()=>{ge.setOptions(X,{listeners:!1})},[X,ge]),X.suspense&&l.isLoading&&l.isFetching&&!j)throw ge.fetchOptimistic(X).then(({data:ye})=>{X.onSuccess==null||X.onSuccess(ye),X.onSettled==null||X.onSettled(ye,null)}).catch(ye=>{Z.clearReset(),X.onError==null||X.onError(ye),X.onSettled==null||X.onSettled(void 0,ye)});if(l.isError&&!Z.isReset()&&!l.isFetching&&Hp(X.useErrorBoundary,[l.error,ge.getCurrentQuery()]))throw l.error;return X.notifyOnChangeProps?l:ge.trackResult(l)}function um(A,L,B){const j=Mp(A,L,B);return Kp(j,Lp)}const Jp=_e.exports.createContext(null);function Yp(A){const L=A.clone();return L.pixelsToGLUnits=A.pixelsToGLUnits,L}function sh(A){return{longitude:A.center.lng,latitude:A.center.lat,zoom:A.zoom,pitch:A.pitch,bearing:A.bearing,padding:A.padding}}function ah(A,L){const B=L.viewState||L;let j=!1;if("longitude"in B&&"latitude"in B){const Z=A.center;A.center=new Z.constructor(B.longitude,B.latitude),j=j||Z!==A.center}if("zoom"in B){const Z=A.zoom;A.zoom=B.zoom,j=j||Z!==A.zoom}if("bearing"in B){const Z=A.bearing;A.bearing=B.bearing,j=j||Z!==A.bearing}if("pitch"in B){const Z=A.pitch;A.pitch=B.pitch,j=j||Z!==A.pitch}return B.padding&&!A.isPaddingEqual(B.padding)&&(j=!0,A.padding=B.padding),j}const Qp=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function lh(A){if(!A)return null;if(typeof A=="string"||("toJS"in A&&(A=A.toJS()),!A.layers))return A;const L={};for(const j of A.layers)L[j.id]=j;const B=A.layers.map(j=>{const Z=L[j.ref];let X=null;if("interactive"in j&&(X={...j},delete X.interactive),Z){X=X||{...j},delete X.ref;for(const ge of Qp)ge in Z&&(X[ge]=Z[ge])}return X||j});return{...A,layers:B}}function ef(A,L){const B=Array.isArray(A)?A[0]:A?A.x:0,j=Array.isArray(A)?A[1]:A?A.y:0,Z=Array.isArray(L)?L[0]:L?L.x:0,X=Array.isArray(L)?L[1]:L?L.y:0;return B===Z&&j===X}function On(A,L){if(A===L)return!0;if(!A||!L)return!1;if(Array.isArray(A)){if(!Array.isArray(L)||A.length!==L.length)return!1;for(let B=0;B<A.length;B++)if(!On(A[B],L[B]))return!1;return!0}else if(Array.isArray(L))return!1;if(typeof A=="object"&&typeof L=="object"){const B=Object.keys(A),j=Object.keys(L);if(B.length!==j.length)return!1;for(const Z of B)if(!L.hasOwnProperty(Z)||!On(A[Z],L[Z]))return!1;return!0}return!1}const ch={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},yc={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},uh={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},tf=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],rf=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class Yo{constructor(L,B,j){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=Z=>{const X=this.props[uh[Z.type]];X&&X(Z)},this._onPointerEvent=Z=>{(Z.type==="mousemove"||Z.type==="mouseout")&&this._updateHover(Z);const X=this.props[ch[Z.type]];if(X){if(this.props.interactiveLayerIds&&Z.type!=="mouseover"&&Z.type!=="mouseout"){const ge=this._hoveredFeatures||this._map.queryRenderedFeatures(Z.point,{layers:this.props.interactiveLayerIds});Z.features=ge}X(Z),delete Z.features}},this._onCameraEvent=Z=>{if(!this._internalUpdate){const X=this.props[yc[Z.type]];X&&X(Z)}Z.type in this._deferredEvents&&(this._deferredEvents[Z.type]=!1)},this._MapClass=L,this.props=B,this._initialize(j)}get map(){return this._map}get transform(){return this._renderTransform}setProps(L){const B=this.props;this.props=L;const j=this._updateSettings(L,B);j&&this._createShadowTransform(this._map);const Z=this._updateSize(L),X=this._updateViewState(L,!0);this._updateStyle(L,B),this._updateStyleComponents(L,B),this._updateHandlers(L,B),(j||Z||X&&!this._map.isMoving())&&this.redraw()}static reuse(L,B){const j=Yo.savedMaps.pop();if(!j)return null;const Z=j.map,X=Z.getContainer();for(B.className=X.className;X.childNodes.length>0;)B.appendChild(X.childNodes[0]);Z._container=B,j.setProps({...L,styleDiffing:!1}),Z.resize();const{initialViewState:ge}=L;return ge&&(ge.bounds?Z.fitBounds(ge.bounds,{...ge.fitBoundsOptions,duration:0}):j._updateViewState(ge,!1)),Z.isStyleLoaded()?Z.fire("load"):Z.once("styledata",()=>Z.fire("load")),j}_initialize(L){const{props:B}=this,j={...B,...B.initialViewState,accessToken:B.mapboxAccessToken||nf()||null,container:L,style:lh(B.mapStyle)},Z=j.initialViewState||j.viewState||j;if(Object.assign(j,{center:[Z.longitude||0,Z.latitude||0],zoom:Z.zoom||0,pitch:Z.pitch||0,bearing:Z.bearing||0}),B.gl){const pe=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=pe,B.gl)}const X=new this._MapClass(j);Z.padding&&X.setPadding(Z.padding),B.cursor&&(X.getCanvas().style.cursor=B.cursor),this._createShadowTransform(X);const ge=X._render;X._render=pe=>{this._inRender=!0,ge.call(X,pe),this._inRender=!1};const l=X._renderTaskQueue.run;X._renderTaskQueue.run=pe=>{l.call(X._renderTaskQueue,pe),this._onBeforeRepaint()},X.on("render",()=>this._onAfterRepaint());const ye=X.fire;X.fire=this._fireEvent.bind(this,ye),X.on("resize",()=>{this._renderTransform.resize(X.transform.width,X.transform.height)}),X.on("styledata",()=>this._updateStyleComponents(this.props,{})),X.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const pe in ch)X.on(pe,this._onPointerEvent);for(const pe in yc)X.on(pe,this._onCameraEvent);for(const pe in uh)X.on(pe,this._onEvent);this._map=X}recycle(){Yo.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const L=this._map;!this._inRender&&L.style&&(L._frame&&(L._frame.cancel(),L._frame=null),L._render())}_createShadowTransform(L){const B=Yp(L.transform);L.painter.transform=B,this._renderTransform=B}_updateSize(L){const{viewState:B}=L;if(B){const j=this._map;if(B.width!==j.transform.width||B.height!==j.transform.height)return j.resize(),!0}return!1}_updateViewState(L,B){if(this._internalUpdate)return!1;const j=this._map,Z=this._renderTransform,{zoom:X,pitch:ge,bearing:l}=Z,ye=j.isMoving();ye&&(Z.cameraElevationReference="sea");const pe=ah(Z,{...sh(j.transform),...L});if(ye&&(Z.cameraElevationReference="ground"),pe&&B){const Me=this._deferredEvents;Me.move=!0,Me.zoom||(Me.zoom=X!==Z.zoom),Me.rotate||(Me.rotate=l!==Z.bearing),Me.pitch||(Me.pitch=ge!==Z.pitch)}return ye||ah(j.transform,L),pe}_updateSettings(L,B){const j=this._map;let Z=!1;for(const X of tf)X in L&&!On(L[X],B[X])&&(Z=!0,j[`set${X[0].toUpperCase()}${X.slice(1)}`](L[X]));return Z}_updateStyle(L,B){if(L.cursor!==B.cursor&&(this._map.getCanvas().style.cursor=L.cursor),L.mapStyle!==B.mapStyle){const j={diff:L.styleDiffing};return"localIdeographFontFamily"in L&&(j.localIdeographFontFamily=L.localIdeographFontFamily),this._map.setStyle(lh(L.mapStyle),j),!0}return!1}_updateStyleComponents(L,B){const j=this._map;let Z=!1;return j.style.loaded()&&("light"in L&&!On(L.light,B.light)&&(Z=!0,j.setLight(L.light)),"fog"in L&&!On(L.fog,B.fog)&&(Z=!0,j.setFog(L.fog)),"terrain"in L&&!On(L.terrain,B.terrain)&&(!L.terrain||j.getSource(L.terrain.source))&&(Z=!0,j.setTerrain(L.terrain))),Z}_updateHandlers(L,B){const j=this._map;let Z=!1;for(const X of rf){const ge=L[X];On(ge,B[X])||(Z=!0,ge?j[X].enable(ge):j[X].disable())}return Z}_updateHover(L){var B;const{props:j}=this;if(j.interactiveLayerIds&&(j.onMouseMove||j.onMouseEnter||j.onMouseLeave)){const X=L.type,ge=((B=this._hoveredFeatures)===null||B===void 0?void 0:B.length)>0;let l;if(X==="mousemove")try{l=this._map.queryRenderedFeatures(L.point,{layers:j.interactiveLayerIds})}catch{l=[]}else l=[];const ye=l.length>0;!ye&&ge&&(L.type="mouseleave",this._onPointerEvent(L)),this._hoveredFeatures=l,ye&&!ge&&(L.type="mouseenter",this._onPointerEvent(L)),L.type=X}else this._hoveredFeatures=null}_fireEvent(L,B,j){const Z=this._map,X=Z.transform,ge=typeof B=="string"?B:B.type;return ge==="move"&&this._updateViewState(this.props,!1),ge in yc&&(typeof B=="object"&&(B.viewState=sh(X)),this._map.isMoving())?(Z.transform=this._renderTransform,L.call(Z,B,j),Z.transform=X,Z):(L.call(Z,B,j),Z)}_onBeforeRepaint(){const L=this._map;this._internalUpdate=!0;for(const j in this._deferredEvents)this._deferredEvents[j]&&L.fire(j);this._internalUpdate=!1;const B=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=B}}}Yo.savedMaps=[];function nf(){let A=null;if(typeof location!="undefined"){const L=/access_token=([^&\/]*)/.exec(location.search);A=L&&L[1]}try{A=A||{}.MapboxAccessToken}catch{}try{A=A||{}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return A}const of=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function sf(A,L){if(!A)return null;const B=A.map,j={getMap:()=>B,getCenter:()=>A.transform.center,getZoom:()=>A.transform.zoom,getBearing:()=>A.transform.bearing,getPitch:()=>A.transform.pitch,getPadding:()=>A.transform.padding,getBounds:()=>A.transform.getBounds(),project:Z=>A.transform.locationPoint(L.LngLat.convert(Z)),unproject:Z=>A.transform.pointLocation(L.Point.convert(Z)),queryTerrainElevation:(Z,X)=>{const ge=B.transform;B.transform=A.transform;const l=B.queryTerrainElevation(Z,X);return B.transform=ge,l}};for(const Z of af(B))!(Z in j)&&!of.includes(Z)&&(j[Z]=B[Z].bind(B));return j}function af(A){const L=new Set;let B=A;for(;B;){for(const j of Object.getOwnPropertyNames(B))j[0]!=="_"&&typeof A[j]=="function"&&j!=="fire"&&j!=="setEventedParent"&&L.add(j);B=Object.getPrototypeOf(B)}return Array.from(L)}const lf=typeof document!="undefined"?_e.exports.useLayoutEffect:_e.exports.useEffect,cf=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function uf(A,L){for(const B of cf)B in L&&(A[B]=L[B]);L.RTLTextPlugin&&A.getRTLTextPluginStatus&&A.getRTLTextPluginStatus()==="unavailable"&&A.setRTLTextPlugin(L.RTLTextPlugin,B=>{B&&console.error(B)},!1)}const hl=_e.exports.createContext(null),hf={minZoom:0,maxZoom:22,minPitch:0,maxPitch:60,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,mapStyle:{version:8,sources:{},layers:[]},styleDiffing:!0,projection:"mercator",renderWorldCopies:!0,onError:A=>console.error(A.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},gh=_e.exports.forwardRef((A,L)=>{const B=_e.exports.useContext(Jp),[j,Z]=_e.exports.useState(null),X=_e.exports.useRef(),{current:ge}=_e.exports.useRef({mapLib:null,map:null});_e.exports.useEffect(()=>{const ye=A.mapLib;let pe=!0,Me;return Promise.resolve(ye||zp(()=>import("./index.c629d6a1.js").then(function(we){return we.i}),[])).then(we=>{if(!!pe){if(we.Map||(we=we.default),!we||!we.Map)throw new Error("Invalid mapLib");if(we.supported(A))uf(we,A),A.reuseMaps&&(Me=Yo.reuse(A,X.current)),Me||(Me=new Yo(we.Map,A,X.current)),ge.map=sf(Me,we),ge.mapLib=we,Z(Me),B==null||B.onMapMount(ge.map,A.id);else throw new Error("Map is not supported by this browser")}}).catch(we=>{A.onError({type:"error",target:null,originalEvent:null,error:we})}),()=>{pe=!1,Me&&(B==null||B.onMapUnmount(A.id),A.reuseMaps?Me.recycle():Me.destroy())}},[]),lf(()=>{j&&j.setProps(A)}),_e.exports.useImperativeHandle(L,()=>ge.map,[j]);const l=_e.exports.useMemo(()=>({position:"relative",width:"100%",height:"100%",...A.style}),[A.style]);return _e.exports.createElement("div",{id:A.id,ref:X,style:l},j&&_e.exports.createElement(hl.Provider,{value:ge},A.children))});gh.displayName="Map";gh.defaultProps=hf;const df=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function xo(A,L){if(!A||!L)return;const B=A.style;for(const j in L){const Z=L[j];Number.isFinite(Z)&&!df.test(j)?B[j]=`${Z}px`:B[j]=Z}}const pf={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};function _h(A){const{map:L,mapLib:B}=_e.exports.useContext(hl),j=_e.exports.useRef({props:A});j.current.props=A;const Z=_e.exports.useMemo(()=>{let X=!1;_e.exports.Children.forEach(A.children,ye=>{ye&&(X=!0)});const ge={...A,element:X?document.createElement("div"):null},l=new B.Marker(ge).setLngLat([A.longitude,A.latitude]);return l.getElement().addEventListener("click",ye=>{var pe,Me;(Me=(pe=j.current.props).onClick)===null||Me===void 0||Me.call(pe,{type:"click",target:l,originalEvent:ye})}),l.on("dragstart",ye=>{var pe,Me;const we=ye;we.lngLat=Z.getLngLat(),(Me=(pe=j.current.props).onDragStart)===null||Me===void 0||Me.call(pe,we)}),l.on("drag",ye=>{var pe,Me;const we=ye;we.lngLat=Z.getLngLat(),(Me=(pe=j.current.props).onDrag)===null||Me===void 0||Me.call(pe,we)}),l.on("dragend",ye=>{var pe,Me;const we=ye;we.lngLat=Z.getLngLat(),(Me=(pe=j.current.props).onDragEnd)===null||Me===void 0||Me.call(pe,we)}),l},[]);return _e.exports.useEffect(()=>(Z.addTo(L.getMap()),()=>{Z.remove()}),[]),_e.exports.useEffect(()=>{xo(Z.getElement(),A.style)},[A.style]),(Z.getLngLat().lng!==A.longitude||Z.getLngLat().lat!==A.latitude)&&Z.setLngLat([A.longitude,A.latitude]),A.offset&&!ef(Z.getOffset(),A.offset)&&Z.setOffset(A.offset),Z.isDraggable()!==A.draggable&&Z.setDraggable(A.draggable),Z.getRotation()!==A.rotation&&Z.setRotation(A.rotation),Z.getRotationAlignment()!==A.rotationAlignment&&Z.setRotationAlignment(A.rotationAlignment),Z.getPitchAlignment()!==A.pitchAlignment&&Z.setPitchAlignment(A.pitchAlignment),Z.getPopup()!==A.popup&&Z.setPopup(A.popup),wc.exports.createPortal(A.children,Z.getElement())}_h.defaultProps=pf;var ff=_e.exports.memo(_h);function hh(A){return new Set(A?A.trim().split(/\s+/):[])}function mf(A){const{map:L,mapLib:B}=_e.exports.useContext(hl),j=_e.exports.useMemo(()=>document.createElement("div"),[]),Z=_e.exports.useRef({props:A});Z.current.props=A;const X=_e.exports.useMemo(()=>{const ge={...A},l=new B.Popup(ge).setLngLat([A.longitude,A.latitude]);return l.once("open",ye=>{var pe,Me;(Me=(pe=Z.current.props).onOpen)===null||Me===void 0||Me.call(pe,ye)}),l},[]);if(_e.exports.useEffect(()=>{const ge=l=>{var ye,pe;(pe=(ye=Z.current.props).onClose)===null||pe===void 0||pe.call(ye,l)};return X.on("close",ge),X.setDOMContent(j).addTo(L.getMap()),()=>{X.off("close",ge),X.isOpen()&&X.remove()}},[]),_e.exports.useEffect(()=>{xo(X.getElement(),A.style)},[A.style]),X.isOpen()&&((X.getLngLat().lng!==A.longitude||X.getLngLat().lat!==A.latitude)&&X.setLngLat([A.longitude,A.latitude]),A.offset&&!On(X.options.offset,A.offset)&&X.setOffset(A.offset),(X.options.anchor!==A.anchor||X.options.maxWidth!==A.maxWidth)&&(X.options.anchor=A.anchor,X.setMaxWidth(A.maxWidth)),X.options.className!==A.className)){const ge=hh(X.options.className),l=hh(A.className);for(const ye of ge)l.has(ye)||X.removeClassName(ye);for(const ye of l)ge.has(ye)||X.addClassName(ye);X.options.className=A.className}return wc.exports.createPortal(A.children,j)}_e.exports.memo(mf);function Ys(A,L,B,j){const Z=_e.exports.useContext(hl),X=_e.exports.useMemo(()=>A(Z),[]);return _e.exports.useEffect(()=>{const ge=j||B||L,l=typeof L=="function"&&typeof B=="function"?L:null,ye=typeof B=="function"?B:typeof L=="function"?L:null,{map:pe}=Z;return pe.hasControl(X)||(pe.addControl(X,ge==null?void 0:ge.position),l&&l(Z)),()=>{ye&&ye(Z),pe.hasControl(X)&&pe.removeControl(X)}},[]),X}function gf(A){const L=Ys(({mapLib:B})=>new B.AttributionControl(A),{position:A.position});return _e.exports.useEffect(()=>{xo(L._container,A.style)},[A.style]),null}_e.exports.memo(gf);function _f(A){const L=Ys(({mapLib:B})=>new B.FullscreenControl({container:A.containerId&&document.getElementById(A.containerId)}),{position:A.position});return _e.exports.useEffect(()=>{xo(L._controlContainer,A.style)},[A.style]),null}_e.exports.memo(_f);const yh=_e.exports.forwardRef((A,L)=>{const B=_e.exports.useRef({props:A}),j=Ys(({mapLib:Z})=>{const X=new Z.GeolocateControl(A),ge=X._setupUI;return X._setupUI=l=>{X._container.hasChildNodes()||ge(l)},X.on("geolocate",l=>{var ye,pe;(pe=(ye=B.current.props).onGeolocate)===null||pe===void 0||pe.call(ye,l)}),X.on("error",l=>{var ye,pe;(pe=(ye=B.current.props).onError)===null||pe===void 0||pe.call(ye,l)}),X.on("outofmaxbounds",l=>{var ye,pe;(pe=(ye=B.current.props).onOutOfMaxBounds)===null||pe===void 0||pe.call(ye,l)}),X.on("trackuserlocationstart",l=>{var ye,pe;(pe=(ye=B.current.props).onTrackUserLocationStart)===null||pe===void 0||pe.call(ye,l)}),X.on("trackuserlocationend",l=>{var ye,pe;(pe=(ye=B.current.props).onTrackUserLocationEnd)===null||pe===void 0||pe.call(ye,l)}),X},{position:A.position});return B.current.props=A,_e.exports.useImperativeHandle(L,()=>({trigger:()=>j.trigger()}),[]),_e.exports.useEffect(()=>{xo(j._container,A.style)},[A.style]),null});yh.displayName="GeolocateControl";_e.exports.memo(yh);function yf(A){const L=Ys(({mapLib:B})=>new B.NavigationControl(A),{position:A.position});return _e.exports.useEffect(()=>{xo(L._container,A.style)},[A.style]),null}var hm=_e.exports.memo(yf);const xf={unit:"metric",maxWidth:100};function xh(A){const L=Ys(({mapLib:B})=>new B.ScaleControl(A),{position:A.position});return(L.options.unit!==A.unit||L.options.maxWidth!==A.maxWidth)&&(L.options.maxWidth=A.maxWidth,L.setUnit(A.unit)),_e.exports.useEffect(()=>{xo(L._container,A.style)},[A.style]),null}xh.defaultProps=xf;_e.exports.memo(xh);var vh={exports:{}};(function(A,L){(function(B,j){A.exports=j()})(Dp,function(){var B,j,Z;function X(l,ye){if(!B)B=ye;else if(!j)j=ye;else{var pe="var sharedChunk = {}; ("+B+")(sharedChunk); ("+j+")(sharedChunk);",Me={};B(Me),Z=ye(Me),typeof window!="undefined"&&(Z.workerUrl=window.URL.createObjectURL(new Blob([pe],{type:"text/javascript"})))}}X(["exports"],function(l){var ye=pe;function pe(i,e,r,o){this.cx=3*i,this.bx=3*(r-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(o-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=r,this.p2y=o}function Me(i,e,r,o){const c=new ye(i,e,r,o);return function(h){return c.solve(h)}}pe.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var r=i,o=0;o<8;o++){var c=this.sampleCurveX(r)-i;if(Math.abs(c)<e)return r;var h=this.sampleCurveDerivativeX(r);if(Math.abs(h)<1e-6)break;r-=c/h}var p=0,m=1;for(r=i,o=0;o<20&&(c=this.sampleCurveX(r),!(Math.abs(c-i)<e));o++)i>c?p=r:m=r,r=.5*(m-p)+p;return r},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const we=Me(.25,.1,.25,1);function se(i,e,r){return Math.min(r,Math.max(e,i))}function gt(i,e,r){const o=r-e,c=((i-e)%o+o)%o+e;return c===e?r:c}function st(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}let He=1;function _t(i,e){i.forEach(r=>{e[r]&&(e[r]=e[r].bind(e))})}function Mt(i,e,r){const o={};for(const c in i)o[c]=e.call(r||this,i[c],c,i);return o}function ct(i,e,r){const o={};for(const c in i)e.call(r||this,i[c],c,i)&&(o[c]=i[c]);return o}function bt(i){return Array.isArray(i)?i.map(bt):typeof i=="object"&&i?Mt(i,bt):i}const Si={};function Vt(i){Si[i]||(typeof console!="undefined"&&console.warn(i),Si[i]=!0)}function Dt(i,e,r){return(r.y-i.y)*(e.x-i.x)>(e.y-i.y)*(r.x-i.x)}function Fi(i){let e=0;for(let r,o,c=0,h=i.length,p=h-1;c<h;p=c++)r=i[c],o=i[p],e+=(o.x-r.x)*(r.y+o.y);return e}function _i(){return typeof WorkerGlobalScope!="undefined"&&typeof self!="undefined"&&self instanceof WorkerGlobalScope}function vo(i){const e={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,o,c,h)=>{const p=c||h;return e[o]=!p||p.toLowerCase(),""}),e["max-age"]){const r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}let ar,Nr,lr=null;function cn(i){if(lr==null){const e=i.navigator?i.navigator.userAgent:null;lr=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return lr}function Tr(i){return typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap}const Er={now:typeof performance!="undefined"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const r=window.document.createElement("canvas"),o=r.getContext("2d");if(!o)throw new Error("failed to create canvas 2d context");return r.width=i.width,r.height=i.height,o.drawImage(i,0,0,i.width,i.height),o.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(ar||(ar=document.createElement("a")),ar.href=i,ar.href),hardwareConcurrency:typeof navigator!="undefined"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Nr==null&&(Nr=matchMedia("(prefers-reduced-motion: reduce)")),Nr.matches)}};var We=cr;function cr(i,e){this.x=i,this.y=e}cr.prototype={clone:function(){return new cr(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,r=i.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),r=Math.sin(i),o=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=o,this},_rotateAround:function(i,e){var r=Math.cos(i),o=Math.sin(i),c=e.y+o*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-o*(this.y-e.y),this.y=c,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},cr.convert=function(i){return i instanceof cr?i:Array.isArray(i)?new cr(i[0],i[1]):i};const ur={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},Gi="mapbox-tiles";let qi,Gr,un=500,hn=50;function dn(){typeof caches=="undefined"||qi||(qi=caches.open(Gi))}let Yi=1/0;const Sr={supported:!1,testSupport:function(i){!yi&&Cr&&(pn?Un(i):Ir=i)}};let Ir,Cr,yi=!1,pn=!1;function Un(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,Cr),i.isContextLost())return;Sr.supported=!0}catch{}i.deleteTexture(e),yi=!0}typeof document!="undefined"&&(Cr=document.createElement("img"),Cr.onload=function(){Ir&&Un(Ir),Ir=null,pn=!0},Cr.onerror=function(){yi=!0,Ir=null},Cr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const hr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(hr);class Ii extends Error{constructor(e,r,o,c){super(`AJAXError: ${r} (${e}): ${o}`),this.status=e,this.statusText=r,this.url=o,this.body=c}}const $n=_i()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function Ar(i,e){const r=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:$n(),signal:r.signal});let c=!1,h=!1;return i.type==="json"&&o.headers.set("Accept","application/json"),((p,m,g)=>{if(h)return;const x=Date.now();fetch(o).then(w=>w.ok?((E,C,z)=>{(i.type==="arrayBuffer"?E.arrayBuffer():i.type==="json"?E.json():E.text()).then(P=>{h||(C&&z&&function(N,V,ee){if(dn(),!qi)return;const oe={status:V.status,statusText:V.statusText,headers:new Headers};V.headers.forEach((re,me)=>oe.headers.set(me,re));const Q=vo(V.headers.get("Cache-Control")||"");Q["no-store"]||(Q["max-age"]&&oe.headers.set("Expires",new Date(ee+1e3*Q["max-age"]).toUTCString()),new Date(oe.headers.get("Expires")).getTime()-ee<42e4||function(re,me){if(Gr===void 0)try{new Response(new ReadableStream),Gr=!0}catch{Gr=!1}Gr?me(re.body):re.blob().then(me)}(V,re=>{const me=new Response(re,oe);dn(),qi&&qi.then(fe=>fe.put(function(Be){const Ue=Be.indexOf("?");return Ue<0?Be:Be.slice(0,Ue)}(N.url),me)).catch(fe=>Vt(fe.message))}))}(o,C,z),c=!0,e(null,P,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(P=>{h||e(new Error(P.message))})})(w,null,x):w.blob().then(E=>e(new Ii(w.status,w.statusText,i.url,E)))).catch(w=>{w.code!==20&&e(new Error(w.message))})})(),{cancel:()=>{h=!0,c||r.abort()}}}const fn=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(_i()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!_i()){const o=i.url.substring(0,i.url.indexOf("://"));return(ur.REGISTERED_PROTOCOLS[o]||Ar)(i,e)}}if(!(/^file:/.test(r=i.url)||/^file:/.test($n())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Ar(i,e);if(_i()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var r;return function(o,c){const h=new XMLHttpRequest;h.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const p in o.headers)h.setRequestHeader(p,o.headers[p]);return o.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=o.credentials==="include",h.onerror=()=>{c(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let p=h.response;if(o.type==="json")try{p=JSON.parse(h.response)}catch(m){return c(m)}c(null,p,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else{const p=new Blob([h.response],{type:h.getResponseHeader("Content-Type")});c(new Ii(h.status,h.statusText,o.url,p))}},h.send(o.body),{cancel:()=>h.abort()}}(i,e)},mn=function(i,e){return fn(st(i,{type:"arrayBuffer"}),e)};function Vn(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const ht="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Qi,Mr;Qi=[],Mr=0;const zr=function(i,e){if(Sr.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),Mr>=ur.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Qi.push(h),h}Mr++;let r=!1;const o=()=>{if(!r)for(r=!0,Mr--;Qi.length&&Mr<ur.MAX_PARALLEL_IMAGE_REQUESTS;){const h=Qi.shift(),{requestParameters:p,callback:m,cancelled:g}=h;g||(h.cancel=zr(p,m).cancel)}},c=mn(i,(h,p,m,g)=>{o(),h?e(h):p&&function(x,w){typeof createImageBitmap=="function"?function(E,C){const z=new Blob([new Uint8Array(E)],{type:"image/png"});createImageBitmap(z).then(P=>{C(null,P)}).catch(P=>{C(new Error(`Could not load image because of ${P.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(x,w):function(E,C){const z=new Image;z.onload=()=>{C(null,z),URL.revokeObjectURL(z.src),z.onload=null,window.requestAnimationFrame(()=>{z.src=ht})},z.onerror=()=>C(new 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."));const P=new Blob([new Uint8Array(E)],{type:"image/png"});z.src=E.byteLength?URL.createObjectURL(P):ht}(x,w)}(p,(x,w)=>{x!=null?e(x):w!=null&&e(null,w,{cacheControl:m,expires:g})})});return{cancel:()=>{c.cancel(),o()}}};function Nn(i,e,r){r[i]&&r[i].indexOf(e)!==-1||(r[i]=r[i]||[],r[i].push(e))}function dr(i,e,r){if(r&&r[i]){const o=r[i].indexOf(e);o!==-1&&r[i].splice(o,1)}}class pr{constructor(e,r={}){st(this,r),this.type=e}}class gn extends pr{constructor(e,r={}){super("error",st({error:e},r))}}class fr{on(e,r){return this._listeners=this._listeners||{},Nn(e,r,this._listeners),this}off(e,r){return dr(e,r,this._listeners),dr(e,r,this._oneTimeListeners),this}once(e,r){return this._oneTimeListeners=this._oneTimeListeners||{},Nn(e,r,this._oneTimeListeners),this}fire(e,r){typeof e=="string"&&(e=new pr(e,r||{}));const o=e.type;if(this.listens(o)){e.target=this;const c=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const m of c)m.call(this,e);const h=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const m of h)dr(o,m,this._oneTimeListeners),m.call(this,e);const p=this._eventedParent;p&&(st(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(e))}else e instanceof gn&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,r){return this._eventedParent=e,this._eventedParentData=r,this}}var de={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,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:!0,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:!1},"*":{type:"*"}},source_raster:{type:{required:!0,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:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},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_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,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:!1,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:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,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:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,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:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,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:!0,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:!1,parameters:["zoom"]},"property-type":"data-constant"},"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:!1,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:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,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:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},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:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,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:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,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"}}};class Ce{constructor(e,r,o,c){this.message=(e?`${e}: `:"")+o,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function qr(i){const e=i.value;return e?[new Ce(i.key,e,"constants have been deprecated as of v8")]:[]}function Zi(i,...e){for(const r of e)for(const o in r)i[o]=r[o];return i}function dt(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Oi(i){if(Array.isArray(i))return i.map(Oi);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const r in i)e[r]=Oi(i[r]);return e}return dt(i)}class Ci extends Error{constructor(e,r){super(r),this.message=r,this.key=e}}class Ai{constructor(e,r=[]){this.parent=e,this.bindings={};for(const[o,c]of r)this.bindings[o]=c}concat(e){return new Ai(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Pr={kind:"null"},Ee={kind:"number"},et={kind:"string"},Ye={kind:"boolean"},oi={kind:"color"},kr={kind:"object"},Je={kind:"value"},mr={kind:"collator"},Yt={kind:"formatted"},_n={kind:"padding"},Zt={kind:"resolvedImage"};function pi(i,e){return{kind:"array",itemType:i,N:e}}function Et(i){if(i.kind==="array"){const e=Et(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const yn=[Pr,Ee,et,Ye,oi,Yt,kr,pi(Je),_n,Zt];function er(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!er(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const r of yn)if(!er(r,e))return null}}return`Expected ${Et(i)} but found ${Et(e)} instead.`}function Zr(i,e){return e.some(r=>r.kind===i.kind)}function jr(i,e){return e.some(r=>r==="null"?i===null:r==="array"?Array.isArray(i):r==="object"?i&&!Array.isArray(i)&&typeof i=="object":r===typeof i)}var xn,Xr={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function R(i){return(i=Math.round(i))<0?0:i>255?255:i}function b(i){return R(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function S(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function k(i,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?i+(e-i)*r*6:2*r<1?e:3*r<2?i+(e-i)*(2/3-r)*6:i}try{xn={}.parseCSSColor=function(i){var e,r=i.replace(/ /g,"").toLowerCase();if(r in Xr)return Xr[r].slice();if(r[0]==="#")return r.length===4?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:r.length===7&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var o=r.indexOf("("),c=r.indexOf(")");if(o!==-1&&c+1===r.length){var h=r.substr(0,o),p=r.substr(o+1,c-(o+1)).split(","),m=1;switch(h){case"rgba":if(p.length!==4)return null;m=S(p.pop());case"rgb":return p.length!==3?null:[b(p[0]),b(p[1]),b(p[2]),m];case"hsla":if(p.length!==4)return null;m=S(p.pop());case"hsl":if(p.length!==3)return null;var g=(parseFloat(p[0])%360+360)%360/360,x=S(p[1]),w=S(p[2]),E=w<=.5?w*(x+1):w+x-w*x,C=2*w-E;return[R(255*k(C,E,g+1/3)),R(255*k(C,E,g)),R(255*k(C,E,g-1/3)),m];default:return null}}return null}}catch{}class D{constructor(e,r,o,c=1){this.r=e,this.g=r,this.b=o,this.a=c}static parse(e){if(!e)return;if(e instanceof D)return e;if(typeof e!="string")return;const r=xn(e);return r?new D(r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]):void 0}toString(){const[e,r,o,c]=this.toArray();return`rgba(${Math.round(e)},${Math.round(r)},${Math.round(o)},${c})`}toArray(){const{r:e,g:r,b:o,a:c}=this;return c===0?[0,0,0,0]:[255*e/c,255*r/c,255*o/c,c]}}D.black=new D(0,0,0,1),D.white=new D(1,1,1,1),D.transparent=new D(0,0,0,0),D.red=new D(1,0,0,1);class G{constructor(e,r,o){this.sensitivity=e?r?"variant":"case":r?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,r){return this.collator.compare(e,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class K{constructor(e,r,o,c,h){this.text=e,this.image=r,this.scale=o,this.fontStack=c,this.textColor=h}}class W{constructor(e){this.sections=e}static fromString(e){return new W([new K(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof W?e:W.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class q{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof q)return e;if(typeof e=="number")return new q([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new q(e)}}toString(){return JSON.stringify(this.values)}}class J{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new J({name:e,available:!1}):null}}function le(i,e,r,o){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[i,e,r,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[i,e,r,o]:[i,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function xe(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof D||i instanceof G||i instanceof W||i instanceof q||i instanceof J)return!0;if(Array.isArray(i)){for(const e of i)if(!xe(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!xe(i[e]))return!1;return!0}return!1}function ae(i){if(i===null)return Pr;if(typeof i=="string")return et;if(typeof i=="boolean")return Ye;if(typeof i=="number")return Ee;if(i instanceof D)return oi;if(i instanceof G)return mr;if(i instanceof W)return Yt;if(i instanceof q)return _n;if(i instanceof J)return Zt;if(Array.isArray(i)){const e=i.length;let r;for(const o of i){const c=ae(o);if(r){if(r===c)continue;r=Je;break}r=c}return pi(r||Je,e)}return kr}function Oe(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof D||i instanceof W||i instanceof q||i instanceof J?i.toString():JSON.stringify(i)}class $e{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!xe(e[1]))return r.error("invalid value");const o=e[1];let c=ae(o);const h=r.expectedType;return c.kind!=="array"||c.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(c=h),new $e(c,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class De{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Ze={string:et,number:Ee,boolean:Ye,object:kr};class Xe{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let o,c=1;const h=e[0];if(h==="array"){let m,g;if(e.length>2){const x=e[1];if(typeof x!="string"||!(x in Ze)||x==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ze[x],c++}else m=Je;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error('The length argument to "array" must be a positive integer literal',2);g=e[2],c++}o=pi(m,g)}else{if(!Ze[h])throw new Error(`Types doesn't contain name = ${h}`);o=Ze[h]}const p=[];for(;c<e.length;c++){const m=r.parse(e[c],c,Je);if(!m)return null;p.push(m)}return new Xe(o,p)}evaluate(e){for(let r=0;r<this.args.length;r++){const o=this.args[r].evaluate(e);if(!er(this.type,ae(o)))return o;if(r===this.args.length-1)throw new De(`Expected value to be of type ${Et(this.type)}, but found ${Et(ae(o))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const pt={"to-boolean":Ye,"to-color":oi,"to-number":Ee,"to-string":et};class Ke{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[0];if(!pt[o])throw new Error(`Can't parse ${o} as it is not part of the known types`);if((o==="to-boolean"||o==="to-string")&&e.length!==2)return r.error("Expected one argument.");const c=pt[o],h=[];for(let p=1;p<e.length;p++){const m=r.parse(e[p],p,Je);if(!m)return null;h.push(m)}return new Ke(c,h)}evaluate(e){if(this.type.kind==="boolean")return Boolean(this.args[0].evaluate(e));if(this.type.kind==="color"){let r,o;for(const c of this.args){if(r=c.evaluate(e),o=null,r instanceof D)return r;if(typeof r=="string"){const h=e.parseColor(r);if(h)return h}else if(Array.isArray(r)&&(o=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:le(r[0],r[1],r[2],r[3]),!o))return new D(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new De(o||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="padding"){let r;for(const o of this.args){r=o.evaluate(e);const c=q.parse(r);if(c)return c}throw new De(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}if(this.type.kind==="number"){let r=null;for(const o of this.args){if(r=o.evaluate(e),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new De(`Could not convert ${JSON.stringify(r)} to number.`)}return this.type.kind==="formatted"?W.fromString(Oe(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?J.fromString(Oe(this.args[0].evaluate(e))):Oe(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const tt=["Unknown","Point","LineString","Polygon"];class ft{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?tt[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(e){let r=this._parseColorCache[e];return r||(r=this._parseColorCache[e]=D.parse(e)),r}}class It{constructor(e,r,o,c){this.name=e,this.type=r,this._evaluate=o,this.args=c}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){const o=e[0],c=It.definitions[o];if(!c)return r.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([x])=>!Array.isArray(x)||x.length===e.length-1);let g=null;for(const[x,w]of m){g=new wn(r.registry,r.path,null,r.scope);const E=[];let C=!1;for(let z=1;z<e.length;z++){const P=e[z],N=Array.isArray(x)?x[z-1]:x.type,V=g.parse(P,1+E.length,N);if(!V){C=!0;break}E.push(V)}if(!C)if(Array.isArray(x)&&x.length!==E.length)g.error(`Expected ${x.length} arguments, but found ${E.length} instead.`);else{for(let z=0;z<E.length;z++){const P=Array.isArray(x)?x[z]:x.type,N=E[z];g.concat(z+1).checkSubtype(P,N.type)}if(g.errors.length===0)return new It(o,h,w,E)}}if(m.length===1)r.errors.push(...g.errors);else{const x=(m.length?m:p).map(([E])=>{return C=E,Array.isArray(C)?`(${C.map(Et).join(", ")})`:`(${Et(C.type)}...)`;var C}).join(" | "),w=[];for(let E=1;E<e.length;E++){const C=r.parse(e[E],1+w.length);if(!C)return null;w.push(Et(C.type))}r.error(`Expected arguments of type ${x}, but found (${w.join(", ")}) instead.`)}return null}static register(e,r){It.definitions=r;for(const o in r)e[o]=It}}class Qt{constructor(e,r,o){this.type=mr,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return r.error("Collator options argument must be an object.");const c=r.parse(o["case-sensitive"]!==void 0&&o["case-sensitive"],1,Ye);if(!c)return null;const h=r.parse(o["diacritic-sensitive"]!==void 0&&o["diacritic-sensitive"],1,Ye);if(!h)return null;let p=null;return o.locale&&(p=r.parse(o.locale,1,et),!p)?null:new Qt(c,h,p)}evaluate(e){return new G(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}const Lt=8192;function li(i,e){i[0]=Math.min(i[0],e[0]),i[1]=Math.min(i[1],e[1]),i[2]=Math.max(i[2],e[0]),i[3]=Math.max(i[3],e[1])}function vn(i,e){return!(i[0]<=e[0]||i[2]>=e[2]||i[1]<=e[1]||i[3]>=e[3])}function Gn(i,e){const r=(180+i[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,c=Math.pow(2,e.z);return[Math.round(r*c*Lt),Math.round(o*c*Lt)]}function Ct(i,e,r){const o=i[0]-e[0],c=i[1]-e[1],h=i[0]-r[0],p=i[1]-r[1];return o*p-h*c==0&&o*h<=0&&c*p<=0}function Qo(i,e){let r=!1;for(let p=0,m=e.length;p<m;p++){const g=e[p];for(let x=0,w=g.length;x<w-1;x++){if(Ct(i,g[x],g[x+1]))return!1;(c=g[x])[1]>(o=i)[1]!=(h=g[x+1])[1]>o[1]&&o[0]<(h[0]-c[0])*(o[1]-c[1])/(h[1]-c[1])+c[0]&&(r=!r)}}var o,c,h;return r}function es(i,e){for(let r=0;r<e.length;r++)if(Qo(i,e[r]))return!0;return!1}function ta(i,e,r,o){const c=o[0]-r[0],h=o[1]-r[1],p=(i[0]-r[0])*h-c*(i[1]-r[1]),m=(e[0]-r[0])*h-c*(e[1]-r[1]);return p>0&&m<0||p<0&&m>0}function ia(i,e,r){for(const x of r)for(let w=0;w<x.length-1;++w)if((m=[(p=x[w+1])[0]-(h=x[w])[0],p[1]-h[1]])[0]*(g=[(c=e)[0]-(o=i)[0],c[1]-o[1]])[1]-m[1]*g[0]!=0&&ta(o,c,h,p)&&ta(h,p,o,c))return!0;var o,c,h,p,m,g;return!1}function ts(i,e){for(let r=0;r<i.length;++r)if(!Qo(i[r],e))return!1;for(let r=0;r<i.length-1;++r)if(ia(i[r],i[r+1],e))return!1;return!0}function pl(i,e){for(let r=0;r<e.length;r++)if(ts(i,e[r]))return!0;return!1}function bo(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=[];for(let p=0;p<i[c].length;p++){const m=Gn(i[c][p],r);li(e,m),h.push(m)}o.push(h)}return o}function is(i,e,r){const o=[];for(let c=0;c<i.length;c++){const h=bo(i[c],e,r);o.push(h)}return o}function ra(i,e,r,o){if(i[0]<r[0]||i[0]>r[2]){const c=.5*o;let h=i[0]-r[0]>c?-o:r[0]-i[0]>c?o:0;h===0&&(h=i[0]-r[2]>c?-o:r[2]-i[0]>c?o:0),i[0]+=h}li(e,i)}function na(i,e,r,o){const c=Math.pow(2,o.z)*Lt,h=[o.x*Lt,o.y*Lt],p=[];for(const m of i)for(const g of m){const x=[g.x+h[0],g.y+h[1]];ra(x,e,r,c),p.push(x)}return p}function oa(i,e,r,o){const c=Math.pow(2,o.z)*Lt,h=[o.x*Lt,o.y*Lt],p=[];for(const g of i){const x=[];for(const w of g){const E=[w.x+h[0],w.y+h[1]];li(e,E),x.push(E)}p.push(x)}if(e[2]-e[0]<=c/2){(m=e)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const g of p)for(const x of g)ra(x,e,r,c)}var m;return p}class Wr{constructor(e,r){this.type=Ye,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(xe(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let c=0;c<o.features.length;++c){const h=o.features[c].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new Wr(o,o.features[c].geometry)}else if(o.type==="Feature"){const c=o.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new Wr(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new Wr(o,o)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(o.type==="Polygon"){const m=bo(o.coordinates,h,p),g=na(r.geometry(),c,h,p);if(!vn(c,h))return!1;for(const x of g)if(!Qo(x,m))return!1}if(o.type==="MultiPolygon"){const m=is(o.coordinates,h,p),g=na(r.geometry(),c,h,p);if(!vn(c,h))return!1;for(const x of g)if(!es(x,m))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(r,o){const c=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(o.type==="Polygon"){const m=bo(o.coordinates,h,p),g=oa(r.geometry(),c,h,p);if(!vn(c,h))return!1;for(const x of g)if(!ts(x,m))return!1}if(o.type==="MultiPolygon"){const m=is(o.coordinates,h,p),g=oa(r.geometry(),c,h,p);if(!vn(c,h))return!1;for(const x of g)if(!pl(x,m))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}function qn(i){if(i instanceof It&&(i.name==="get"&&i.args.length===1||i.name==="feature-state"||i.name==="has"&&i.args.length===1||i.name==="properties"||i.name==="geometry-type"||i.name==="id"||/^filter-/.test(i.name))||i instanceof Wr)return!1;let e=!0;return i.eachChild(r=>{e&&!qn(r)&&(e=!1)}),e}function bn(i){if(i instanceof It&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(r=>{e&&!bn(r)&&(e=!1)}),e}function wo(i,e){if(i instanceof It&&e.indexOf(i.name)>=0)return!1;let r=!0;return i.eachChild(o=>{r&&!wo(o,e)&&(r=!1)}),r}class To{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const o=e[1];return r.scope.has(o)?new To(o,r.scope.get(o)):r.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class wn{constructor(e,r=[],o,c=new Ai,h=[]){this.registry=e,this.path=r,this.key=r.map(p=>`[${p}]`).join(""),this.scope=c,this.errors=h,this.expectedType=o}parse(e,r,o,c,h={}){return r?this.concat(r,o,c)._parse(e,h):this._parse(e,h)}_parse(e,r){function o(c,h,p){return p==="assert"?new Xe(h,[c]):p==="coerce"?new Ke(h,[c]):c}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=e[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const h=this.registry[c];if(h){let p=h.parse(e,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,g=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||g.kind!=="value")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||g.kind!=="value"&&g.kind!=="string")if(m.kind!=="padding"||g.kind!=="value"&&g.kind!=="number"&&g.kind!=="array"){if(this.checkSubtype(m,g))return null}else p=o(p,m,r.typeAnnotation||"coerce");else p=o(p,m,r.typeAnnotation||"coerce");else p=o(p,m,r.typeAnnotation||"assert")}if(!(p instanceof $e)&&p.type.kind!=="resolvedImage"&&rs(p)){const m=new ft;try{p=new $e(p.type,p.evaluate(m))}catch(g){return this.error(g.message),null}}return p}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,r,o){const c=typeof e=="number"?this.path.concat(e):this.path,h=o?this.scope.concat(o):this.scope;return new wn(this.registry,c,r||null,h,this.errors)}error(e,...r){const o=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Ci(o,e))}checkSubtype(e,r){const o=er(e,r);return o&&this.error(o),o}}function rs(i){if(i instanceof To)return rs(i.boundExpression);if(i instanceof It&&i.name==="error"||i instanceof Qt||i instanceof Wr)return!1;const e=i instanceof Ke||i instanceof Xe;let r=!0;return i.eachChild(o=>{r=e?r&&rs(o):r&&o instanceof $e}),!!r&&qn(i)&&wo(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Eo(i,e){const r=i.length-1;let o,c,h=0,p=r,m=0;for(;h<=p;)if(m=Math.floor((h+p)/2),o=i[m],c=i[m+1],o<=e){if(m===r||e<c)return m;h=m+1}else{if(!(o>e))throw new De("Input is not a number.");p=m-1}return 0}class Zn{constructor(e,r,o){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(const[c,h]of o)this.labels.push(c),this.outputs.push(h)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");const o=r.parse(e[1],1,Ee);if(!o)return null;const c=[];let h=null;r.expectedType&&r.expectedType.kind!=="value"&&(h=r.expectedType);for(let p=1;p<e.length;p+=2){const m=p===1?-1/0:e[p],g=e[p+1],x=p,w=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',x);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',x);const E=r.parse(g,w,h);if(!E)return null;h=h||E.type,c.push([m,E])}return new Zn(h,o,c)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;return c>=r[h-1]?o[h-1].evaluate(e):o[Eo(r,c)].evaluate(e)}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Rt(i,e,r){return i*(1-r)+e*r}var jn=Object.freeze({__proto__:null,number:Rt,color:function(i,e,r){return new D(Rt(i.r,e.r,r),Rt(i.g,e.g,r),Rt(i.b,e.b,r),Rt(i.a,e.a,r))},array:function(i,e,r){return i.map((o,c)=>Rt(o,e[c],r))},padding:function(i,e,r){const o=i.values,c=e.values;return new q([Rt(o[0],c[0],r),Rt(o[1],c[1],r),Rt(o[2],c[2],r),Rt(o[3],c[3],r)])}});const sa=.95047,aa=1.08883,ns=4/29,So=6/29,la=3*So*So,fl=Math.PI/180,ml=180/Math.PI;function os(i){return i>.008856451679035631?Math.pow(i,1/3):i/la+ns}function ss(i){return i>So?i*i*i:la*(i-ns)}function as(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function ls(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function yt(i){const e=ls(i.r),r=ls(i.g),o=ls(i.b),c=os((.4124564*e+.3575761*r+.1804375*o)/sa),h=os((.2126729*e+.7151522*r+.072175*o)/1);return{l:116*h-16,a:500*(c-h),b:200*(h-os((.0193339*e+.119192*r+.9503041*o)/aa)),alpha:i.a}}function ca(i){let e=(i.l+16)/116,r=isNaN(i.a)?e:e+i.a/500,o=isNaN(i.b)?e:e-i.b/200;return e=1*ss(e),r=sa*ss(r),o=aa*ss(o),new D(as(3.2404542*r-1.5371385*e-.4985314*o),as(-.969266*r+1.8760108*e+.041556*o),as(.0556434*r-.2040259*e+1.0572252*o),i.alpha)}function gl(i,e,r){const o=e-i;return i+r*(o>180||o<-180?o-360*Math.round(o/360):o)}const Xn={forward:yt,reverse:ca,interpolate:function(i,e,r){return{l:Rt(i.l,e.l,r),a:Rt(i.a,e.a,r),b:Rt(i.b,e.b,r),alpha:Rt(i.alpha,e.alpha,r)}}},Wn={forward:function(i){const{l:e,a:r,b:o}=yt(i),c=Math.atan2(o,r)*ml;return{h:c<0?c+360:c,c:Math.sqrt(r*r+o*o),l:e,alpha:i.a}},reverse:function(i){const e=i.h*fl,r=i.c;return ca({l:i.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:i.alpha})},interpolate:function(i,e,r){return{h:gl(i.h,e.h,r),c:Rt(i.c,e.c,r),l:Rt(i.l,e.l,r),alpha:Rt(i.alpha,e.alpha,r)}}};var ua=Object.freeze({__proto__:null,lab:Xn,hcl:Wn});class Mi{constructor(e,r,o,c,h){this.type=e,this.operator=r,this.interpolation=o,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of h)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(e,r,o,c){let h=0;if(e.name==="exponential")h=cs(r,e.base,o,c);else if(e.name==="linear")h=cs(r,1,o,c);else if(e.name==="cubic-bezier"){const p=e.controlPoints;h=new ye(p[0],p[1],p[2],p[3]).solve(cs(r,1,o,c))}return h}static parse(e,r){let[o,c,h,...p]=e;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const x=c[1];if(typeof x!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:x}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const x=c.slice(1);if(x.length!==4||x.some(w=>typeof w!="number"||w<0||w>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:x}}}if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(h=r.parse(h,2,Ee),!h)return null;const m=[];let g=null;o==="interpolate-hcl"||o==="interpolate-lab"?g=oi:r.expectedType&&r.expectedType.kind!=="value"&&(g=r.expectedType);for(let x=0;x<p.length;x+=2){const w=p[x],E=p[x+1],C=x+3,z=x+4;if(typeof w!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',C);if(m.length&&m[m.length-1][0]>=w)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',C);const P=r.parse(E,z,g);if(!P)return null;g=g||P.type,m.push([w,P])}return g.kind==="number"||g.kind==="color"||g.kind==="padding"||g.kind==="array"&&g.itemType.kind==="number"&&typeof g.N=="number"?new Mi(g,o,c,h,m):r.error(`Type ${Et(g)} is not interpolatable.`)}evaluate(e){const r=this.labels,o=this.outputs;if(r.length===1)return o[0].evaluate(e);const c=this.input.evaluate(e);if(c<=r[0])return o[0].evaluate(e);const h=r.length;if(c>=r[h-1])return o[h-1].evaluate(e);const p=Eo(r,c),m=Mi.interpolationFactor(this.interpolation,c,r[p],r[p+1]),g=o[p].evaluate(e),x=o[p+1].evaluate(e);return this.operator==="interpolate"?jn[this.type.kind.toLowerCase()](g,x,m):this.operator==="interpolate-hcl"?Wn.reverse(Wn.interpolate(Wn.forward(g),Wn.forward(x),m)):Xn.reverse(Xn.interpolate(Xn.forward(g),Xn.forward(x),m))}eachChild(e){e(this.input);for(const r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function cs(i,e,r,o){const c=o-r,h=i-r;return c===0?0:e===1?h/c:(Math.pow(e,h)-1)/(Math.pow(e,c)-1)}class Io{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected at least one argument.");let o=null;const c=r.expectedType;c&&c.kind!=="value"&&(o=c);const h=[];for(const m of e.slice(1)){const g=r.parse(m,1+h.length,o,void 0,{typeAnnotation:"omit"});if(!g)return null;o=o||g.type,h.push(g)}if(!o)throw new Error("No output type");const p=c&&h.some(m=>er(c,m.type));return new Io(p?Je:o,h)}evaluate(e){let r,o=null,c=0;for(const h of this.args)if(c++,o=h.evaluate(e),o&&o instanceof J&&!o.available&&(r||(r=o.name),o=null,c===this.args.length&&(o=r)),o!==null)break;return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class Co{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let h=1;h<e.length-1;h+=2){const p=e[h];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,h);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",h);const m=r.parse(e[h+1],h+1);if(!m)return null;o.push([p,m])}const c=r.parse(e[e.length-1],e.length-1,r.expectedType,o);return c?new Co(o,c):null}outputDefined(){return this.result.outputDefined()}}class us{constructor(e,r,o){this.type=e,this.index=r,this.input=o}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Ee),c=r.parse(e[2],2,pi(r.expectedType||Je));return o&&c?new us(c.type.itemType,o,c):null}evaluate(e){const r=this.index.evaluate(e),o=this.input.evaluate(e);if(r<0)throw new De(`Array index out of bounds: ${r} < 0.`);if(r>=o.length)throw new De(`Array index out of bounds: ${r} > ${o.length-1}.`);if(r!==Math.floor(r))throw new De(`Array index must be an integer, but found ${r} instead.`);return o[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class hs{constructor(e,r){this.type=Ye,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Je);return o&&c?Zr(o.type,[Ye,et,Ee,Pr,Je])?new hs(o,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Et(o.type)} instead`):null}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!o)return!1;if(!jr(r,["boolean","string","number","null"]))throw new De(`Expected first argument to be of type boolean, string, number or null, but found ${Et(ae(r))} instead.`);if(!jr(o,["string","array"]))throw new De(`Expected second argument to be of type array or string, but found ${Et(ae(o))} instead.`);return o.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class Ao{constructor(e,r,o){this.type=Ee,this.needle=e,this.haystack=r,this.fromIndex=o}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Je);if(!o||!c)return null;if(!Zr(o.type,[Ye,et,Ee,Pr,Je]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Et(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ee);return h?new Ao(o,c,h):null}return new Ao(o,c)}evaluate(e){const r=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!jr(r,["boolean","string","number","null"]))throw new De(`Expected first argument to be of type boolean, string, number or null, but found ${Et(ae(r))} instead.`);if(!jr(o,["string","array"]))throw new De(`Expected second argument to be of type array or string, but found ${Et(ae(o))} instead.`);if(this.fromIndex){const c=this.fromIndex.evaluate(e);return o.indexOf(r,c)}return o.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class ds{constructor(e,r,o,c,h,p){this.inputType=e,this.type=r,this.input=o,this.cases=c,this.outputs=h,this.otherwise=p}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let o,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const h={},p=[];for(let x=2;x<e.length-1;x+=2){let w=e[x];const E=e[x+1];Array.isArray(w)||(w=[w]);const C=r.concat(x);if(w.length===0)return C.error("Expected at least one branch label.");for(const P of w){if(typeof P!="number"&&typeof P!="string")return C.error("Branch labels must be numbers or strings.");if(typeof P=="number"&&Math.abs(P)>Number.MAX_SAFE_INTEGER)return C.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof P=="number"&&Math.floor(P)!==P)return C.error("Numeric branch labels must be integer values.");if(o){if(C.checkSubtype(o,ae(P)))return null}else o=ae(P);if(h[String(P)]!==void 0)return C.error("Branch labels must be unique.");h[String(P)]=p.length}const z=r.parse(E,x,c);if(!z)return null;c=c||z.type,p.push(z)}const m=r.parse(e[1],1,Je);if(!m)return null;const g=r.parse(e[e.length-1],e.length-1,c);return g?m.type.kind!=="value"&&r.concat(1).checkSubtype(o,m.type)?null:new ds(o,c,m,h,p,g):null}evaluate(e){const r=this.input.evaluate(e);return(ae(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class ps{constructor(e,r,o){this.type=e,this.branches=r,this.otherwise=o}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let o;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);const c=[];for(let p=1;p<e.length-1;p+=2){const m=r.parse(e[p],p,Ye);if(!m)return null;const g=r.parse(e[p+1],p+1,o);if(!g)return null;c.push([m,g]),o=o||g.type}const h=r.parse(e[e.length-1],e.length-1,o);if(!h)return null;if(!o)throw new Error("Can't infer output type");return new ps(o,c,h)}evaluate(e){for(const[r,o]of this.branches)if(r.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[r,o]of this.branches)e(r),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Mo{constructor(e,r,o,c){this.type=e,this.input=r,this.beginIndex=o,this.endIndex=c}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=r.parse(e[1],1,Je),c=r.parse(e[2],2,Ee);if(!o||!c)return null;if(!Zr(o.type,[pi(Je),et,Je]))return r.error(`Expected first argument to be of type array or string, but found ${Et(o.type)} instead`);if(e.length===4){const h=r.parse(e[3],3,Ee);return h?new Mo(o.type,o,c,h):null}return new Mo(o.type,o,c)}evaluate(e){const r=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!jr(r,["string","array"]))throw new De(`Expected first argument to be of type array or string, but found ${Et(ae(r))} instead.`);if(this.endIndex){const c=this.endIndex.evaluate(e);return r.slice(o,c)}return r.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function ha(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function da(i,e,r,o){return o.compare(e,r)===0}function Tn(i,e,r){const o=i!=="=="&&i!=="!=";return class bh{constructor(h,p,m){this.type=Ye,this.lhs=h,this.rhs=p,this.collator=m,this.hasUntypedArgument=h.type.kind==="value"||p.type.kind==="value"}static parse(h,p){if(h.length!==3&&h.length!==4)return p.error("Expected two or three arguments.");const m=h[0];let g=p.parse(h[1],1,Je);if(!g)return null;if(!ha(m,g.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${Et(g.type)}'.`);let x=p.parse(h[2],2,Je);if(!x)return null;if(!ha(m,x.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${Et(x.type)}'.`);if(g.type.kind!==x.type.kind&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error(`Cannot compare types '${Et(g.type)}' and '${Et(x.type)}'.`);o&&(g.type.kind==="value"&&x.type.kind!=="value"?g=new Xe(x.type,[g]):g.type.kind!=="value"&&x.type.kind==="value"&&(x=new Xe(g.type,[x])));let w=null;if(h.length===4){if(g.type.kind!=="string"&&x.type.kind!=="string"&&g.type.kind!=="value"&&x.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(w=p.parse(h[3],3,mr),!w)return null}return new bh(g,x,w)}evaluate(h){const p=this.lhs.evaluate(h),m=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const g=ae(p),x=ae(m);if(g.kind!==x.kind||g.kind!=="string"&&g.kind!=="number")throw new De(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${g.kind}, ${x.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const g=ae(p),x=ae(m);if(g.kind!=="string"||x.kind!=="string")return e(h,p,m)}return this.collator?r(h,p,m,this.collator.evaluate(h)):e(h,p,m)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}}}const _l=Tn("==",function(i,e,r){return e===r},da),yl=Tn("!=",function(i,e,r){return e!==r},function(i,e,r,o){return!da(0,e,r,o)}),xl=Tn("<",function(i,e,r){return e<r},function(i,e,r,o){return o.compare(e,r)<0}),vl=Tn(">",function(i,e,r){return e>r},function(i,e,r,o){return o.compare(e,r)>0}),bl=Tn("<=",function(i,e,r){return e<=r},function(i,e,r,o){return o.compare(e,r)<=0}),wl=Tn(">=",function(i,e,r){return e>=r},function(i,e,r,o){return o.compare(e,r)>=0});class fs{constructor(e,r,o,c,h){this.type=et,this.number=e,this.locale=r,this.currency=o,this.minFractionDigits=c,this.maxFractionDigits=h}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");const o=r.parse(e[1],1,Ee);if(!o)return null;const c=e[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let h=null;if(c.locale&&(h=r.parse(c.locale,1,et),!h))return null;let p=null;if(c.currency&&(p=r.parse(c.currency,1,et),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Ee),!m))return null;let g=null;return c["max-fraction-digits"]&&(g=r.parse(c["max-fraction-digits"],1,Ee),!g)?null:new fs(o,h,p,m,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class zo{constructor(e){this.type=Yt,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return r.error("First argument must be an image or text section.");const c=[];let h=!1;for(let p=1;p<=e.length-1;++p){const m=e[p];if(h&&typeof m=="object"&&!Array.isArray(m)){h=!1;let g=null;if(m["font-scale"]&&(g=r.parse(m["font-scale"],1,Ee),!g))return null;let x=null;if(m["text-font"]&&(x=r.parse(m["text-font"],1,pi(et)),!x))return null;let w=null;if(m["text-color"]&&(w=r.parse(m["text-color"],1,oi),!w))return null;const E=c[c.length-1];E.scale=g,E.font=x,E.textColor=w}else{const g=r.parse(e[p],1,Je);if(!g)return null;const x=g.type.kind;if(x!=="string"&&x!=="value"&&x!=="null"&&x!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,c.push({content:g,scale:null,font:null,textColor:null})}}return new zo(c)}evaluate(e){return new W(this.sections.map(r=>{const o=r.content.evaluate(e);return ae(o)===Zt?new K("",o,null,null,null):new K(Oe(o),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null)}))}eachChild(e){for(const r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}}class ms{constructor(e){this.type=Zt,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");const o=r.parse(e[1],1,et);return o?new ms(o):r.error("No image name provided.")}evaluate(e){const r=this.input.evaluate(e),o=J.fromString(r);return o&&e.availableImages&&(o.available=e.availableImages.indexOf(r)>-1),o}eachChild(e){e(this.input)}outputDefined(){return!1}}class gs{constructor(e){this.type=Ee,this.input=e}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=r.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Et(o.type)} instead.`):new gs(o):null}evaluate(e){const r=this.input.evaluate(e);if(typeof r=="string"||Array.isArray(r))return r.length;throw new De(`Expected value to be of type string or array, but found ${Et(ae(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const En={"==":_l,"!=":yl,">":vl,"<":xl,">=":wl,"<=":bl,array:Xe,at:us,boolean:Xe,case:ps,coalesce:Io,collator:Qt,format:zo,image:ms,in:hs,"index-of":Ao,interpolate:Mi,"interpolate-hcl":Mi,"interpolate-lab":Mi,length:gs,let:Co,literal:$e,match:ds,number:Xe,"number-format":fs,object:Xe,slice:Mo,step:Zn,string:Xe,"to-boolean":Ke,"to-color":Ke,"to-number":Ke,"to-string":Ke,var:To,within:Wr};function pa(i,[e,r,o,c]){e=e.evaluate(i),r=r.evaluate(i),o=o.evaluate(i);const h=c?c.evaluate(i):1,p=le(e,r,o,h);if(p)throw new De(p);return new D(e/255*h,r/255*h,o/255*h,h)}function fa(i,e){return i in e}function Po(i,e){const r=e[i];return r===void 0?null:r}function Hr(i){return{type:i}}function ma(i){return{result:"success",value:i}}function Sn(i){return{result:"error",value:i}}function Pt(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function ga(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function at(i){return!!i.expression&&i.expression.interpolated}function xt(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function zt(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function Bt(i){return i}function Hn(i,e){const r=e.type==="color",o=i.stops&&typeof i.stops[0][0]=="object",c=o||!(o||i.property!==void 0),h=i.type||(at(e)?"exponential":"interval");if(r||e.type==="padding"){const x=r?D.parse:q.parse;(i=Zi({},i)).stops&&(i.stops=i.stops.map(w=>[w[0],x(w[1])])),i.default=x(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!ua[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let p,m,g;if(h==="exponential")p=_a;else if(h==="interval")p=El;else if(h==="categorical"){p=Tl,m=Object.create(null);for(const x of i.stops)m[x[0]]=x[1];g=typeof i.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);p=Sl}if(o){const x={},w=[];for(let z=0;z<i.stops.length;z++){const P=i.stops[z],N=P[0].zoom;x[N]===void 0&&(x[N]={zoom:N,type:i.type,property:i.property,default:i.default,stops:[]},w.push(N)),x[N].stops.push([P[0].value,P[1]])}const E=[];for(const z of w)E.push([x[z].zoom,Hn(x[z],e)]);const C={name:"linear"};return{kind:"composite",interpolationType:C,interpolationFactor:Mi.interpolationFactor.bind(void 0,C),zoomStops:E.map(z=>z[0]),evaluate:({zoom:z},P)=>_a({stops:E,base:i.base},e,z).evaluate(z,P)}}if(c){const x=h==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:x,interpolationFactor:Mi.interpolationFactor.bind(void 0,x),zoomStops:i.stops.map(w=>w[0]),evaluate:({zoom:w})=>p(i,e,w,m,g)}}return{kind:"source",evaluate(x,w){const E=w&&w.properties?w.properties[i.property]:void 0;return E===void 0?In(i.default,e.default):p(i,e,E,m,g)}}}function In(i,e,r){return i!==void 0?i:e!==void 0?e:r!==void 0?r:void 0}function Tl(i,e,r,o,c){return In(typeof r===c?o[r]:void 0,i.default,e.default)}function El(i,e,r){if(xt(r)!=="number")return In(i.default,e.default);const o=i.stops.length;if(o===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[o-1][0])return i.stops[o-1][1];const c=Eo(i.stops.map(h=>h[0]),r);return i.stops[c][1]}function _a(i,e,r){const o=i.base!==void 0?i.base:1;if(xt(r)!=="number")return In(i.default,e.default);const c=i.stops.length;if(c===1||r<=i.stops[0][0])return i.stops[0][1];if(r>=i.stops[c-1][0])return i.stops[c-1][1];const h=Eo(i.stops.map(w=>w[0]),r),p=function(w,E,C,z){const P=z-C,N=w-C;return P===0?0:E===1?N/P:(Math.pow(E,N)-1)/(Math.pow(E,P)-1)}(r,o,i.stops[h][0],i.stops[h+1][0]),m=i.stops[h][1],g=i.stops[h+1][1];let x=jn[e.type]||Bt;if(i.colorSpace&&i.colorSpace!=="rgb"){const w=ua[i.colorSpace];x=(E,C)=>w.reverse(w.interpolate(w.forward(E),w.forward(C),p))}return typeof m.evaluate=="function"?{evaluate(...w){const E=m.evaluate.apply(void 0,w),C=g.evaluate.apply(void 0,w);if(E!==void 0&&C!==void 0)return x(E,C,p)}}:x(m,g,p)}function Sl(i,e,r){switch(e.type){case"color":r=D.parse(r);break;case"formatted":r=W.fromString(r.toString());break;case"resolvedImage":r=J.fromString(r.toString());break;case"padding":r=q.parse(r);break;default:xt(r)===e.type||e.type==="enum"&&e.values[r]||(r=void 0)}return In(r,i.default,e.default)}It.register(En,{error:[{kind:"error"},[et],(i,[e])=>{throw new De(e.evaluate(i))}],typeof:[et,[Je],(i,[e])=>Et(ae(e.evaluate(i)))],"to-rgba":[pi(Ee,4),[oi],(i,[e])=>e.evaluate(i).toArray()],rgb:[oi,[Ee,Ee,Ee],pa],rgba:[oi,[Ee,Ee,Ee,Ee],pa],has:{type:Ye,overloads:[[[et],(i,[e])=>fa(e.evaluate(i),i.properties())],[[et,kr],(i,[e,r])=>fa(e.evaluate(i),r.evaluate(i))]]},get:{type:Je,overloads:[[[et],(i,[e])=>Po(e.evaluate(i),i.properties())],[[et,kr],(i,[e,r])=>Po(e.evaluate(i),r.evaluate(i))]]},"feature-state":[Je,[et],(i,[e])=>Po(e.evaluate(i),i.featureState||{})],properties:[kr,[],i=>i.properties()],"geometry-type":[et,[],i=>i.geometryType()],id:[Je,[],i=>i.id()],zoom:[Ee,[],i=>i.globals.zoom],"heatmap-density":[Ee,[],i=>i.globals.heatmapDensity||0],"line-progress":[Ee,[],i=>i.globals.lineProgress||0],accumulated:[Je,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Ee,Hr(Ee),(i,e)=>{let r=0;for(const o of e)r+=o.evaluate(i);return r}],"*":[Ee,Hr(Ee),(i,e)=>{let r=1;for(const o of e)r*=o.evaluate(i);return r}],"-":{type:Ee,overloads:[[[Ee,Ee],(i,[e,r])=>e.evaluate(i)-r.evaluate(i)],[[Ee],(i,[e])=>-e.evaluate(i)]]},"/":[Ee,[Ee,Ee],(i,[e,r])=>e.evaluate(i)/r.evaluate(i)],"%":[Ee,[Ee,Ee],(i,[e,r])=>e.evaluate(i)%r.evaluate(i)],ln2:[Ee,[],()=>Math.LN2],pi:[Ee,[],()=>Math.PI],e:[Ee,[],()=>Math.E],"^":[Ee,[Ee,Ee],(i,[e,r])=>Math.pow(e.evaluate(i),r.evaluate(i))],sqrt:[Ee,[Ee],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))],log2:[Ee,[Ee],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Ee,[Ee],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Ee,[Ee],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Ee,[Ee],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Ee,[Ee],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Ee,[Ee],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Ee,[Ee],(i,[e])=>Math.atan(e.evaluate(i))],min:[Ee,Hr(Ee),(i,e)=>Math.min(...e.map(r=>r.evaluate(i)))],max:[Ee,Hr(Ee),(i,e)=>Math.max(...e.map(r=>r.evaluate(i)))],abs:[Ee,[Ee],(i,[e])=>Math.abs(e.evaluate(i))],round:[Ee,[Ee],(i,[e])=>{const r=e.evaluate(i);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ee,[Ee],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Ee,[Ee],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[Ye,[et,Je],(i,[e,r])=>i.properties()[e.value]===r.value],"filter-id-==":[Ye,[Je],(i,[e])=>i.id()===e.value],"filter-type-==":[Ye,[et],(i,[e])=>i.geometryType()===e.value],"filter-<":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<c}],"filter-id-<":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<o}],"filter->":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>c}],"filter-id->":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>o}],"filter-<=":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o<=c}],"filter-id-<=":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r<=o}],"filter->=":[Ye,[et,Je],(i,[e,r])=>{const o=i.properties()[e.value],c=r.value;return typeof o==typeof c&&o>=c}],"filter-id->=":[Ye,[Je],(i,[e])=>{const r=i.id(),o=e.value;return typeof r==typeof o&&r>=o}],"filter-has":[Ye,[Je],(i,[e])=>e.value in i.properties()],"filter-has-id":[Ye,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[Ye,[pi(et)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[Ye,[pi(Je)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[Ye,[et,pi(Je)],(i,[e,r])=>r.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[Ye,[et,pi(Je)],(i,[e,r])=>function(o,c,h,p){for(;h<=p;){const m=h+p>>1;if(c[m]===o)return!0;c[m]>o?p=m-1:h=m+1}return!1}(i.properties()[e.value],r.value,0,r.value.length-1)],all:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)&&r.evaluate(i)],[Hr(Ye),(i,e)=>{for(const r of e)if(!r.evaluate(i))return!1;return!0}]]},any:{type:Ye,overloads:[[[Ye,Ye],(i,[e,r])=>e.evaluate(i)||r.evaluate(i)],[Hr(Ye),(i,e)=>{for(const r of e)if(r.evaluate(i))return!0;return!1}]]},"!":[Ye,[Ye],(i,[e])=>!e.evaluate(i)],"is-supported-script":[Ye,[et],(i,[e])=>{const r=i.globals&&i.globals.isSupportedScript;return!r||r(e.evaluate(i))}],upcase:[et,[et],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[et,[et],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[et,Hr(Je),(i,e)=>e.map(r=>Oe(r.evaluate(i))).join("")],"resolved-locale":[et,[mr],(i,[e])=>e.evaluate(i).resolvedLocale()]});class ko{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new ft,this._defaultValue=r?function(o){return o.type==="color"&&zt(o.default)?new D(0,0,0,0):o.type==="color"?D.parse(o.default)||null:o.type==="padding"?q.parse(o.default)||null:o.default===void 0?null:o.default}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._evaluator.globals=e,this._evaluator.feature=r,this._evaluator.featureState=o,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(e,r,o,c,h,p){this._evaluator.globals=e,this._evaluator.feature=r||null,this._evaluator.featureState=o||null,this._evaluator.canonical=c,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new De(`Expected value to be one of ${Object.keys(this._enumValues).map(g=>JSON.stringify(g)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console!="undefined"&&console.warn(m.message)),this._defaultValue}}}function Kn(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in En}function Jn(i,e){const r=new wn(En,[],e?function(c){const h={color:oi,string:et,number:Ee,enum:et,boolean:Ye,formatted:Yt,padding:_n,resolvedImage:Zt};return c.type==="array"?pi(h[c.value]||Je,c.length):h[c.type]}(e):void 0),o=r.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?ma(new ko(o,e)):Sn(r.errors)}class Yn{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!bn(r.expression)}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,p)}evaluate(e,r,o,c,h,p){return this._styleExpression.evaluate(e,r,o,c,h,p)}}class _s{constructor(e,r,o,c){this.kind=e,this.zoomStops=o,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!bn(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(e,r,o,c,h,p){return this._styleExpression.evaluateWithoutErrorHandling(e,r,o,c,h,p)}evaluate(e,r,o,c,h,p){return this._styleExpression.evaluate(e,r,o,c,h,p)}interpolationFactor(e,r,o){return this.interpolationType?Mi.interpolationFactor(this.interpolationType,e,r,o):0}}function ya(i,e){const r=Jn(i,e);if(r.result==="error")return r;const o=r.value.expression,c=qn(o);if(!c&&!Pt(e))return Sn([new Ci("","data expressions not supported")]);const h=wo(o,["zoom"]);if(!h&&!ga(e))return Sn([new Ci("","zoom expressions not supported")]);const p=Lo(o);return p||h?p instanceof Ci?Sn([p]):p instanceof Mi&&!at(e)?Sn([new Ci("",'"interpolate" expressions cannot be used with this property')]):ma(p?new _s(c?"camera":"composite",r.value,p.labels,p instanceof Mi?p.interpolation:void 0):new Yn(c?"constant":"source",r.value)):Sn([new Ci("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Do{constructor(e,r){this._parameters=e,this._specification=r,Zi(this,Hn(this._parameters,this._specification))}static deserialize(e){return new Do(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Lo(i){let e=null;if(i instanceof Co)e=Lo(i.result);else if(i instanceof Io){for(const r of i.args)if(e=Lo(r),e)break}else(i instanceof Zn||i instanceof Mi)&&i.input instanceof It&&i.input.name==="zoom"&&(e=i);return e instanceof Ci||i.eachChild(r=>{const o=Lo(r);o instanceof Ci?e=o:!e&&o?e=new Ci("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&o&&e!==o&&(e=new Ci("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function ji(i){const e=i.key,r=i.value,o=i.valueSpec||{},c=i.objectElementValidators||{},h=i.style,p=i.styleSpec;let m=[];const g=xt(r);if(g!=="object")return[new Ce(e,r,`object expected, ${g} found`)];for(const x in r){const w=x.split(".")[0],E=o[w]||o["*"];let C;if(c[w])C=c[w];else if(o[w])C=Pi;else if(c["*"])C=c["*"];else{if(!o["*"]){m.push(new Ce(e,r[x],`unknown property "${x}"`));continue}C=Pi}m=m.concat(C({key:(e&&`${e}.`)+x,value:r[x],valueSpec:E,style:h,styleSpec:p,object:r,objectKey:x},r))}for(const x in o)c[x]||o[x].required&&o[x].default===void 0&&r[x]===void 0&&m.push(new Ce(e,r,`missing required property "${x}"`));return m}function xa(i){const e=i.value,r=i.valueSpec,o=i.style,c=i.styleSpec,h=i.key,p=i.arrayElementValidator||Pi;if(xt(e)!=="array")return[new Ce(h,e,`array expected, ${xt(e)} found`)];if(r.length&&e.length!==r.length)return[new Ce(h,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new Ce(h,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),xt(r.value)==="object"&&(m=r.value);let g=[];for(let x=0;x<e.length;x++)g=g.concat(p({array:e,arrayIndex:x,value:e[x],valueSpec:m,style:o,styleSpec:c,key:`${h}[${x}]`}));return g}function ys(i){const e=i.key,r=i.value,o=i.valueSpec;let c=xt(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new Ce(e,r,`number expected, ${c} found`)]:"minimum"in o&&r<o.minimum?[new Ce(e,r,`${r} is less than the minimum value ${o.minimum}`)]:"maximum"in o&&r>o.maximum?[new Ce(e,r,`${r} is greater than the maximum value ${o.maximum}`)]:[]}function va(i){const e=i.valueSpec,r=dt(i.value.type);let o,c,h,p={};const m=r!=="categorical"&&i.value.property===void 0,g=!m,x=xt(i.value.stops)==="array"&&xt(i.value.stops[0])==="array"&&xt(i.value.stops[0][0])==="object",w=ji({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(z){if(r==="identity")return[new Ce(z.key,z.value,'identity function may not have a "stops" property')];let P=[];const N=z.value;return P=P.concat(xa({key:z.key,value:N,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:E})),xt(N)==="array"&&N.length===0&&P.push(new Ce(z.key,N,"array must have at least one stop")),P},default:function(z){return Pi({key:z.key,value:z.value,valueSpec:e,style:z.style,styleSpec:z.styleSpec})}}});return r==="identity"&&m&&w.push(new Ce(i.key,i.value,'missing required property "property"')),r==="identity"||i.value.stops||w.push(new Ce(i.key,i.value,'missing required property "stops"')),r==="exponential"&&i.valueSpec.expression&&!at(i.valueSpec)&&w.push(new Ce(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(g&&!Pt(i.valueSpec)?w.push(new Ce(i.key,i.value,"property functions not supported")):m&&!ga(i.valueSpec)&&w.push(new Ce(i.key,i.value,"zoom functions not supported"))),r!=="categorical"&&!x||i.value.property!==void 0||w.push(new Ce(i.key,i.value,'"property" property is required')),w;function E(z){let P=[];const N=z.value,V=z.key;if(xt(N)!=="array")return[new Ce(V,N,`array expected, ${xt(N)} found`)];if(N.length!==2)return[new Ce(V,N,`array length 2 expected, length ${N.length} found`)];if(x){if(xt(N[0])!=="object")return[new Ce(V,N,`object expected, ${xt(N[0])} found`)];if(N[0].zoom===void 0)return[new Ce(V,N,"object stop key must have zoom")];if(N[0].value===void 0)return[new Ce(V,N,"object stop key must have value")];if(h&&h>dt(N[0].zoom))return[new Ce(V,N[0].zoom,"stop zoom values must appear in ascending order")];dt(N[0].zoom)!==h&&(h=dt(N[0].zoom),c=void 0,p={}),P=P.concat(ji({key:`${V}[0]`,value:N[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:ys,value:C}}))}else P=P.concat(C({key:`${V}[0]`,value:N[0],valueSpec:{},style:z.style,styleSpec:z.styleSpec},N));return Kn(Oi(N[1]))?P.concat([new Ce(`${V}[1]`,N[1],"expressions are not allowed in function stops.")]):P.concat(Pi({key:`${V}[1]`,value:N[1],valueSpec:e,style:z.style,styleSpec:z.styleSpec}))}function C(z,P){const N=xt(z.value),V=dt(z.value),ee=z.value!==null?z.value:P;if(o){if(N!==o)return[new Ce(z.key,ee,`${N} stop domain type must match previous stop domain type ${o}`)]}else o=N;if(N!=="number"&&N!=="string"&&N!=="boolean")return[new Ce(z.key,ee,"stop domain value must be a number, string, or boolean")];if(N!=="number"&&r!=="categorical"){let oe=`number expected, ${N} found`;return Pt(e)&&r===void 0&&(oe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ce(z.key,ee,oe)]}return r!=="categorical"||N!=="number"||isFinite(V)&&Math.floor(V)===V?r!=="categorical"&&N==="number"&&c!==void 0&&V<c?[new Ce(z.key,ee,"stop domain values must appear in ascending order")]:(c=V,r==="categorical"&&V in p?[new Ce(z.key,ee,"stop domain values must be unique")]:(p[V]=!0,[])):[new Ce(z.key,ee,`integer expected, found ${V}`)]}}function Kr(i){const e=(i.expressionContext==="property"?ya:Jn)(Oi(i.value),i.valueSpec);if(e.result==="error")return e.value.map(o=>new Ce(`${i.key}${o.key}`,i.value,o.message));const r=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!r.outputDefined())return[new Ce(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!bn(r))return[new Ce(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!bn(r))return[new Ce(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!wo(r,["zoom","feature-state"]))return[new Ce(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!qn(r))return[new Ce(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Qn(i){const e=i.key,r=i.value,o=i.valueSpec,c=[];return Array.isArray(o.values)?o.values.indexOf(dt(r))===-1&&c.push(new Ce(e,r,`expected one of [${o.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(o.values).indexOf(dt(r))===-1&&c.push(new Ce(e,r,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function Cn(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Cn(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const Il={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ro(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Cn(i)||(i=eo(i));const e=Jn(i,Il);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,o,c)=>e.value.evaluate(r,o,{},c),needGeometry:wa(i)}}function ba(i,e){return i<e?-1:i>e?1:0}function wa(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e<i.length;e++)if(wa(i[e]))return!0;return!1}function eo(i){if(!i)return!0;const e=i[0];return i.length<=1?e!=="any":e==="=="?xs(i[1],i[2],"=="):e==="!="?An(xs(i[1],i[2],"==")):e==="<"||e===">"||e==="<="||e===">="?xs(i[1],i[2],e):e==="any"?(r=i.slice(1),["any"].concat(r.map(eo))):e==="all"?["all"].concat(i.slice(1).map(eo)):e==="none"?["all"].concat(i.slice(1).map(eo).map(An)):e==="in"?Bo(i[1],i.slice(2)):e==="!in"?An(Bo(i[1],i.slice(2))):e==="has"?to(i[1]):e==="!has"?An(to(i[1])):e!=="within"||i;var r}function xs(i,e,r){switch(i){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,i,e]}}function Bo(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",i,["literal",e.sort(ba)]]:["filter-in-small",i,["literal",e]]}}function to(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function An(i){return["!",i]}function io(i){return Cn(Oi(i.value))?Kr(Zi({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ta(i)}function Ta(i){const e=i.value,r=i.key;if(xt(e)!=="array")return[new Ce(r,e,`array expected, ${xt(e)} found`)];const o=i.styleSpec;let c,h=[];if(e.length<1)return[new Ce(r,e,"filter array must have at least 1 element")];switch(h=h.concat(Qn({key:`${r}[0]`,value:e[0],valueSpec:o.filter_operator,style:i.style,styleSpec:i.styleSpec})),dt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&dt(e[1])==="$type"&&h.push(new Ce(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&h.push(new Ce(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(c=xt(e[1]),c!=="string"&&h.push(new Ce(`${r}[1]`,e[1],`string expected, ${c} found`)));for(let p=2;p<e.length;p++)c=xt(e[p]),dt(e[1])==="$type"?h=h.concat(Qn({key:`${r}[${p}]`,value:e[p],valueSpec:o.geometry_type,style:i.style,styleSpec:i.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&h.push(new Ce(`${r}[${p}]`,e[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<e.length;p++)h=h.concat(Ta({key:`${r}[${p}]`,value:e[p],style:i.style,styleSpec:i.styleSpec}));break;case"has":case"!has":c=xt(e[1]),e.length!==2?h.push(new Ce(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="string"&&h.push(new Ce(`${r}[1]`,e[1],`string expected, ${c} found`));break;case"within":c=xt(e[1]),e.length!==2?h.push(new Ce(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):c!=="object"&&h.push(new Ce(`${r}[1]`,e[1],`object expected, ${c} found`))}return h}function ro(i,e){const r=i.key,o=i.style,c=i.styleSpec,h=i.value,p=i.objectKey,m=c[`${e}_${i.layerType}`];if(!m)return[];const g=p.match(/^(.*)-transition$/);if(e==="paint"&&g&&m[g[1]]&&m[g[1]].transition)return Pi({key:r,value:h,valueSpec:c.transition,style:o,styleSpec:c});const x=i.valueSpec||m[p];if(!x)return[new Ce(r,h,`unknown property "${p}"`)];let w;if(xt(h)==="string"&&Pt(x)&&!x.tokens&&(w=/^{([^}]+)}$/.exec(h)))return[new Ce(r,h,`"${p}" does not support interpolation syntax
10
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(w[1])} }\`.`)];const E=[];return i.layerType==="symbol"&&(p==="text-field"&&o&&!o.glyphs&&E.push(new Ce(r,h,'use of "text-field" requires a style "glyphs" property')),p==="text-font"&&zt(Oi(h))&&dt(h.type)==="identity"&&E.push(new Ce(r,h,'"text-font" does not support identity functions'))),E.concat(Pi({key:i.key,value:h,valueSpec:x,style:o,styleSpec:c,expressionContext:"property",propertyType:e,propertyKey:p}))}function Ea(i){return ro(i,"paint")}function Sa(i){return ro(i,"layout")}function Ia(i){let e=[];const r=i.value,o=i.key,c=i.style,h=i.styleSpec;r.type||r.ref||e.push(new Ce(o,r,'either "type" or "ref" is required'));let p=dt(r.type);const m=dt(r.ref);if(r.id){const g=dt(r.id);for(let x=0;x<i.arrayIndex;x++){const w=c.layers[x];dt(w.id)===g&&e.push(new Ce(o,r.id,`duplicate layer id "${r.id}", previously used at line ${w.id.__line__}`))}}if("ref"in r){let g;["type","source","source-layer","filter","layout"].forEach(x=>{x in r&&e.push(new Ce(o,r[x],`"${x}" is prohibited for ref layers`))}),c.layers.forEach(x=>{dt(x.id)===m&&(g=x)}),g?g.ref?e.push(new Ce(o,r.ref,"ref cannot reference another ref layer")):p=dt(g.type):e.push(new Ce(o,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const g=c.sources&&c.sources[r.source],x=g&&dt(g.type);g?x==="vector"&&p==="raster"?e.push(new Ce(o,r.source,`layer "${r.id}" requires a raster source`)):x==="raster"&&p!=="raster"?e.push(new Ce(o,r.source,`layer "${r.id}" requires a vector source`)):x!=="vector"||r["source-layer"]?x==="raster-dem"&&p!=="hillshade"?e.push(new Ce(o,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||x==="geojson"&&g.lineMetrics||e.push(new Ce(o,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new Ce(o,r,`layer "${r.id}" must specify a "source-layer"`)):e.push(new Ce(o,r.source,`source "${r.source}" not found`))}else e.push(new Ce(o,r,'missing required property "source"'));return e=e.concat(ji({key:o,value:r,valueSpec:h.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Pi({key:`${o}.type`,value:r.type,valueSpec:h.layer.type,style:i.style,styleSpec:i.styleSpec,object:r,objectKey:"type"}),filter:io,layout:g=>ji({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Sa(Zi({layerType:p},x))}}),paint:g=>ji({layer:r,key:g.key,value:g.value,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{"*":x=>Ea(Zi({layerType:p},x))}})}})),e}function Mn(i){const e=i.value,r=i.key,o=xt(e);return o!=="string"?[new Ce(r,e,`string expected, ${o} found`)]:[]}const Ca={promoteId:function({key:i,value:e}){if(xt(e)==="string")return Mn({key:i,value:e});{const r=[];for(const o in e)r.push(...Mn({key:`${i}.${o}`,value:e[o]}));return r}}};function no(i){const e=i.value,r=i.key,o=i.styleSpec,c=i.style;if(!e.type)return[new Ce(r,e,'"type" is required')];const h=dt(e.type);let p;switch(h){case"vector":case"raster":case"raster-dem":return p=ji({key:r,value:e,valueSpec:o[`source_${h.replace("-","_")}`],style:i.style,styleSpec:o,objectElementValidators:Ca}),p;case"geojson":if(p=ji({key:r,value:e,valueSpec:o.source_geojson,style:c,styleSpec:o,objectElementValidators:Ca}),e.cluster)for(const m in e.clusterProperties){const[g,x]=e.clusterProperties[m],w=typeof g=="string"?[g,["accumulated"],["get",m]]:g;p.push(...Kr({key:`${r}.${m}.map`,value:x,expressionContext:"cluster-map"})),p.push(...Kr({key:`${r}.${m}.reduce`,value:w,expressionContext:"cluster-reduce"}))}return p;case"video":return ji({key:r,value:e,valueSpec:o.source_video,style:c,styleSpec:o});case"image":return ji({key:r,value:e,valueSpec:o.source_image,style:c,styleSpec:o});case"canvas":return[new Ce(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Qn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:c,styleSpec:o})}}function oo(i){const e=i.value,r=i.styleSpec,o=r.light,c=i.style;let h=[];const p=xt(e);if(e===void 0)return h;if(p!=="object")return h=h.concat([new Ce("light",e,`object expected, ${p} found`)]),h;for(const m in e){const g=m.match(/^(.*)-transition$/);h=h.concat(g&&o[g[1]]&&o[g[1]].transition?Pi({key:m,value:e[m],valueSpec:r.transition,style:c,styleSpec:r}):o[m]?Pi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Ce(m,e[m],`unknown property "${m}"`)])}return h}function zi(i){const e=i.value,r=i.styleSpec,o=r.terrain,c=i.style;let h=[];const p=xt(e);if(e===void 0)return h;if(p!=="object")return h=h.concat([new Ce("terrain",e,`object expected, ${p} found`)]),h;for(const m in e)h=h.concat(o[m]?Pi({key:m,value:e[m],valueSpec:o[m],style:c,styleSpec:r}):[new Ce(m,e[m],`unknown property "${m}"`)]);return h}const so={"*":()=>[],array:xa,boolean:function(i){const e=i.value,r=i.key,o=xt(e);return o!=="boolean"?[new Ce(r,e,`boolean expected, ${o} found`)]:[]},number:ys,color:function(i){const e=i.key,r=i.value,o=xt(r);return o!=="string"?[new Ce(e,r,`color expected, ${o} found`)]:xn(r)===null?[new Ce(e,r,`color expected, "${r}" found`)]:[]},constants:qr,enum:Qn,filter:io,function:va,layer:Ia,object:ji,source:no,light:oo,terrain:zi,string:Mn,formatted:function(i){return Mn(i).length===0?[]:Kr(i)},resolvedImage:function(i){return Mn(i).length===0?[]:Kr(i)},padding:function(i){const e=i.key,r=i.value;if(xt(r)==="array"){if(r.length<1||r.length>4)return[new Ce(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];const o={type:"number"};let c=[];for(let h=0;h<r.length;h++)c=c.concat(Pi({key:`${e}[${h}]`,value:r[h],valueSpec:o}));return c}return ys({key:e,value:r,valueSpec:{}})}};function Pi(i){const e=i.value,r=i.valueSpec,o=i.styleSpec;return r.expression&&zt(dt(e))?va(i):r.expression&&Kn(Oi(e))?Kr(i):r.type&&so[r.type]?so[r.type](i):ji(Zi({},i,{valueSpec:r.type?o[r.type]:r}))}function Cl(i){const e=i.value,r=i.key,o=Mn(i);return o.length||(e.indexOf("{fontstack}")===-1&&o.push(new Ce(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&o.push(new Ce(r,e,'"glyphs" url must include a "{range}" token'))),o}function Dr(i,e=de){let r=[];return r=r.concat(Pi({key:"",value:i,valueSpec:e.$root,styleSpec:e,style:i,objectElementValidators:{glyphs:Cl,"*":()=>[]}})),i.constants&&(r=r.concat(qr({key:"constants",value:i.constants,style:i,styleSpec:e}))),Aa(r)}function Aa(i){return[].concat(i).sort((e,r)=>e.line-r.line)}function gr(i){return function(...e){return Aa(i.apply(this,e))}}Dr.source=gr(no),Dr.light=gr(oo),Dr.terrain=gr(zi),Dr.layer=gr(Ia),Dr.filter=gr(io),Dr.paintProperty=gr(Ea),Dr.layoutProperty=gr(Sa);const ao=Dr,vs=ao.light,Al=ao.paintProperty,Ml=ao.layoutProperty;function Fo(i,e){let r=!1;if(e&&e.length)for(const o of e)i.fire(new gn(new Error(o.message))),r=!0;return r}class lo{constructor(e,r,o){const c=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const p=new Int32Array(this.arrayBuffer);e=p[0],this.d=(r=p[1])+2*(o=p[2]);for(let g=0;g<this.d*this.d;g++){const x=p[3+g],w=p[3+g+1];c.push(x===w?null:p.subarray(x,w))}const m=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*o;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=o,this.scale=r/e,this.uid=0;const h=o/r*e;this.min=-h,this.max=e+h}insert(e,r,o,c,h){this._forEachCell(r,o,c,h,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(o),this.bboxes.push(c),this.bboxes.push(h)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,o,c,h,p){this.cells[h].push(p)}query(e,r,o,c,h){const p=this.min,m=this.max;if(e<=p&&r<=p&&m<=o&&m<=c&&!h)return Array.prototype.slice.call(this.keys);{const g=[];return this._forEachCell(e,r,o,c,this._queryCell,g,{},h),g}}_queryCell(e,r,o,c,h,p,m,g){const x=this.cells[h];if(x!==null){const w=this.keys,E=this.bboxes;for(let C=0;C<x.length;C++){const z=x[C];if(m[z]===void 0){const P=4*z;(g?g(E[P+0],E[P+1],E[P+2],E[P+3]):e<=E[P+2]&&r<=E[P+3]&&o>=E[P+0]&&c>=E[P+1])?(m[z]=!0,p.push(w[z])):m[z]=!1}}}}_forEachCell(e,r,o,c,h,p,m,g){const x=this._convertToCellCoord(e),w=this._convertToCellCoord(r),E=this._convertToCellCoord(o),C=this._convertToCellCoord(c);for(let z=x;z<=E;z++)for(let P=w;P<=C;P++){const N=this.d*P+z;if((!g||g(this._convertFromCellCoord(z),this._convertFromCellCoord(P),this._convertFromCellCoord(z+1),this._convertFromCellCoord(P+1)))&&h.call(this,e,r,o,c,N,p,m,g))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,r=3+this.cells.length+1+1;let o=0;for(let p=0;p<this.cells.length;p++)o+=this.cells[p].length;const c=new Int32Array(r+o+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let h=r;for(let p=0;p<e.length;p++){const m=e[p];c[3+p]=h,c.set(m,h),h+=m.length}return c[3+e.length]=h,c.set(this.keys,h),h+=this.keys.length,c[3+e.length+1]=h,c.set(this.bboxes,h),h+=this.bboxes.length,c.buffer}static serialize(e,r){const o=e.toArrayBuffer();return r&&r.push(o),{buffer:o}}static deserialize(e){return new lo(e.buffer)}}const _r={};function Fe(i,e,r={}){if(_r[i])throw new Error(`${i} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:i,writeable:!1}),_r[i]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}Fe("Object",Object),Fe("TransferableGridIndex",lo),Fe("Color",D),Fe("Error",Error),Fe("AJAXError",Ii),Fe("ResolvedImage",J),Fe("StylePropertyFunction",Do),Fe("StyleExpression",ko,{omit:["_evaluator"]}),Fe("ZoomDependentExpression",_s),Fe("ZoomConstantExpression",Yn),Fe("CompoundExpression",It,{omit:["_evaluate"]});for(const i in En)En[i]._classRegistryKey||Fe(`Expression_${i}`,En[i]);function Ma(i){return i&&typeof ArrayBuffer!="undefined"&&(i instanceof ArrayBuffer||i.constructor&&i.constructor.name==="ArrayBuffer")}function Jr(i,e){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob)return i;if(Ma(i)||Tr(i))return e&&e.push(i),i;if(ArrayBuffer.isView(i)){const r=i;return e&&e.push(r.buffer),r}if(i instanceof ImageData)return e&&e.push(i.data.buffer),i;if(Array.isArray(i)){const r=[];for(const o of i)r.push(Jr(o,e));return r}if(typeof i=="object"){const r=i.constructor,o=r._classRegistryKey;if(!o)throw new Error("can't serialize object of unregistered class");if(!_r[o])throw new Error(`${o} is not registered.`);const c=r.serialize?r.serialize(i,e):{};if(r.serialize){if(e&&c===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const h in i){if(!i.hasOwnProperty(h)||_r[o].omit.indexOf(h)>=0)continue;const p=i[h];c[h]=_r[o].shallow.indexOf(h)>=0?p:Jr(p,e)}i instanceof Error&&(c.message=i.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(c.$name=o),c}throw new Error("can't serialize object of type "+typeof i)}function Lr(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Ma(i)||Tr(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(Lr);if(typeof i=="object"){const e=i.$name||"Object";if(!_r[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:r}=_r[e];if(!r)throw new Error(`can't deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(i);const o=Object.create(r.prototype);for(const c of Object.keys(i)){if(c==="$name")continue;const h=i[c];o[c]=_r[e].shallow.indexOf(c)>=0?h:Lr(h)}return o}throw new Error("can't deserialize object of type "+typeof i)}class bs{constructor(){this.first=!0}update(e,r){const o=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=o,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=o,!0):(this.lastFloorZoom>o?(this.lastIntegerZoom=o+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<o&&(this.lastIntegerZoom=o,this.lastIntegerZoomTime=r),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=o,!0))}}const ze={"Latin-1 Supplement":i=>i>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function Oo(i){for(const e of i)if(Ts(e.charCodeAt(0)))return!0;return!1}function zl(i){for(const e of i)if(!ws(e.charCodeAt(0)))return!1;return!0}function ws(i){return!(ze.Arabic(i)||ze["Arabic Supplement"](i)||ze["Arabic Extended-A"](i)||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i))}function Ts(i){return!(i!==746&&i!==747&&(i<4352||!(ze["Bopomofo Extended"](i)||ze.Bopomofo(i)||ze["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||ze["CJK Compatibility Ideographs"](i)||ze["CJK Compatibility"](i)||ze["CJK Radicals Supplement"](i)||ze["CJK Strokes"](i)||!(!ze["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||ze["CJK Unified Ideographs Extension A"](i)||ze["CJK Unified Ideographs"](i)||ze["Enclosed CJK Letters and Months"](i)||ze["Hangul Compatibility Jamo"](i)||ze["Hangul Jamo Extended-A"](i)||ze["Hangul Jamo Extended-B"](i)||ze["Hangul Jamo"](i)||ze["Hangul Syllables"](i)||ze.Hiragana(i)||ze["Ideographic Description Characters"](i)||ze.Kanbun(i)||ze["Kangxi Radicals"](i)||ze["Katakana Phonetic Extensions"](i)||ze.Katakana(i)&&i!==12540||!(!ze["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!ze["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||ze["Unified Canadian Aboriginal Syllabics"](i)||ze["Unified Canadian Aboriginal Syllabics Extended"](i)||ze["Vertical Forms"](i)||ze["Yijing Hexagram Symbols"](i)||ze["Yi Syllables"](i)||ze["Yi Radicals"](i))))}function za(i){return!(Ts(i)||function(e){return!!(ze["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||ze["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||ze["Letterlike Symbols"](e)||ze["Number Forms"](e)||ze["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||ze["Control Pictures"](e)&&e!==9251||ze["Optical Character Recognition"](e)||ze["Enclosed Alphanumerics"](e)||ze["Geometric Shapes"](e)||ze["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||ze["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||ze["CJK Symbols and Punctuation"](e)||ze.Katakana(e)||ze["Private Use Area"](e)||ze["CJK Compatibility Forms"](e)||ze["Small Form Variants"](e)||ze["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Pa(i){return i>=1424&&i<=2303||ze["Arabic Presentation Forms-A"](i)||ze["Arabic Presentation Forms-B"](i)}function Pl(i,e){return!(!e&&Pa(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||ze.Khmer(i))}function ka(i){for(const e of i)if(Pa(e.charCodeAt(0)))return!0;return!1}const Es="deferred",Ss="loading",Is="loaded";let Cs=null,xi="unavailable",Rr=null;const Da=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(xi="error"),Cs&&Cs(i)};function zn(){As.fire(new pr("pluginStateChange",{pluginStatus:xi,pluginURL:Rr}))}const As=new fr,co=function(){return xi},La=function(){if(xi!==Es||!Rr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");xi=Ss,zn(),Rr&&mn({url:Rr},i=>{i?Da(i):(xi=Is,zn())})},Ui={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>xi===Is||Ui.applyArabicShaping!=null,isLoading:()=>xi===Ss,setState(i){if(!_i())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");xi=i.pluginStatus,Rr=i.pluginURL},isParsed(){if(!_i())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Ui.applyArabicShaping!=null&&Ui.processBidirectionalText!=null&&Ui.processStyledBidirectionalText!=null},getPluginURL(){if(!_i())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Rr}};class Ft{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new bs,this.transition={})}isSupportedScript(e){return function(r,o){for(const c of r)if(!Pl(c.charCodeAt(0),o))return!1;return!0}(e,Ui.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,r=e-Math.floor(e),o=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*o}:{fromScale:.5,toScale:1,t:1-(1-o)*r}}}class uo{constructor(e,r){this.property=e,this.value=r,this.expression=function(o,c){if(zt(o))return new Do(o,c);if(Kn(o)){const h=ya(o,c);if(h.result==="error")throw new Error(h.value.map(p=>`${p.key}: ${p.message}`).join(", "));return h.value}{let h=o;return c.type==="color"&&typeof o=="string"?h=D.parse(o):c.type!=="padding"||typeof o!="number"&&!Array.isArray(o)||(h=q.parse(o)),{kind:"constant",evaluate:()=>h}}}(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,o){return this.property.possiblyEvaluate(this,e,r,o)}}class Uo{constructor(e){this.property=e,this.value=new uo(e,void 0)}transitioned(e,r){return new Ba(this.property,this.value,r,st({},e.transition,this.transition),e.now)}untransitioned(){return new Ba(this.property,this.value,null,{},0)}}class Ra{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return bt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Uo(this._values[e].property)),this._values[e].value=new uo(this._values[e].property,r===null?void 0:bt(r))}getTransition(e){return bt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Uo(this._values[e].property)),this._values[e].transition=bt(r)||void 0}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o);const c=this.getTransition(r);c!==void 0&&(e[`${r}-transition`]=c)}return e}transitioned(e,r){const o=new Fa(this._properties);for(const c of Object.keys(this._values))o._values[c]=this._values[c].transitioned(e,r._values[c]);return o}untransitioned(){const e=new Fa(this._properties);for(const r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}}class Ba{constructor(e,r,o,c,h){this.property=e,this.value=r,this.begin=h+c.delay||0,this.end=this.begin+c.duration||0,e.specification.transition&&(c.delay||c.duration)&&(this.prior=o)}possiblyEvaluate(e,r,o){const c=e.now||0,h=this.value.possiblyEvaluate(e,r,o),p=this.prior;if(p){if(c>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(c<this.begin)return p.possiblyEvaluate(e,r,o);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(e,r,o),h,function(g){if(g<=0)return 0;if(g>=1)return 1;const x=g*g,w=x*g;return 4*(g<.5?w:3*(g-x)+w-.75)}(m))}}return h}}class Fa{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,o){const c=new ho(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class kl{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return bt(this._values[e].value)}setValue(e,r){this._values[e]=new uo(this._values[e].property,r===null?void 0:bt(r))}serialize(){const e={};for(const r of Object.keys(this._values)){const o=this.getValue(r);o!==void 0&&(e[r]=o)}return e}possiblyEvaluate(e,r,o){const c=new ho(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,r,o);return c}}class tr{constructor(e,r,o){this.property=e,this.value=r,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,r,o,c){return this.property.evaluate(this.value,this.parameters,e,r,o,c)}}class ho{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ve{constructor(e){this.specification=e}possiblyEvaluate(e,r){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(r)}interpolate(e,r,o){const c=jn[this.specification.type];return c?c(e,r,o):e}}class je{constructor(e,r){this.specification=e,this.overrides=r}possiblyEvaluate(e,r,o,c){return new tr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(r,null,{},o,c)}:e.expression,r)}interpolate(e,r,o){if(e.value.kind!=="constant"||r.value.kind!=="constant")return e;if(e.value.value===void 0||r.value.value===void 0)return new tr(this,{kind:"constant",value:void 0},e.parameters);const c=jn[this.specification.type];return c?new tr(this,{kind:"constant",value:c(e.value.value,r.value.value,o)},e.parameters):e}evaluate(e,r,o,c,h,p){return e.kind==="constant"?e.value:e.evaluate(r,o,c,h,p)}}class Pn extends je{possiblyEvaluate(e,r,o,c){if(e.value===void 0)return new tr(this,{kind:"constant",value:void 0},r);if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c),p=e.property.specification.type==="resolvedImage"&&typeof h!="string"?h.name:h,m=this._calculate(p,p,p,r);return new tr(this,{kind:"constant",value:m},r)}if(e.expression.kind==="camera"){const h=this._calculate(e.expression.evaluate({zoom:r.zoom-1}),e.expression.evaluate({zoom:r.zoom}),e.expression.evaluate({zoom:r.zoom+1}),r);return new tr(this,{kind:"constant",value:h},r)}return new tr(this,e.expression,r)}evaluate(e,r,o,c,h,p){if(e.kind==="source"){const m=e.evaluate(r,o,c,h,p);return this._calculate(m,m,m,r)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(r.zoom)-1},o,c),e.evaluate({zoom:Math.floor(r.zoom)},o,c),e.evaluate({zoom:Math.floor(r.zoom)+1},o,c),r):e.value}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Ms{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){if(e.value!==void 0){if(e.expression.kind==="constant"){const h=e.expression.evaluate(r,null,{},o,c);return this._calculate(h,h,h,r)}return this._calculate(e.expression.evaluate(new Ft(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Ft(Math.floor(r.zoom),r)),e.expression.evaluate(new Ft(Math.floor(r.zoom+1),r)),r)}}_calculate(e,r,o,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:e,to:r}:{from:o,to:r}}interpolate(e){return e}}class Br{constructor(e){this.specification=e}possiblyEvaluate(e,r,o,c){return!!e.expression.evaluate(r,null,{},o,c)}interpolate(){return!1}}class si{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in e){const o=e[r];o.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new uo(o,void 0),h=this.defaultTransitionablePropertyValues[r]=new Uo(o);this.defaultTransitioningPropertyValues[r]=h.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}Fe("DataDrivenProperty",je),Fe("DataConstantProperty",Ve),Fe("CrossFadedDataDrivenProperty",Pn),Fe("CrossFadedProperty",Ms),Fe("ColorRampProperty",Br);const Fr="-transition";class ir extends fr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new kl(r.layout)),r.paint)){this._transitionablePaint=new Ra(r.paint);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ho(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,o={}){r!=null&&this._validate(Ml,`layers.${this.id}.layout.${e}`,e,r,o)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,r):this.visibility=r)}getPaintProperty(e){return e.endsWith(Fr)?this._transitionablePaint.getTransition(e.slice(0,-Fr.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,o={}){if(r!=null&&this._validate(Al,`layers.${this.id}.paint.${e}`,e,r,o))return!1;if(e.endsWith(Fr))return this._transitionablePaint.setTransition(e.slice(0,-Fr.length),r||void 0),!1;{const c=this._transitionablePaint._values[e],h=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);const g=this._transitionablePaint._values[e].value;return g.isDataDriven()||p||h||this._handleOverridablePaintPropertyUpdate(e,m,g)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,o){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){const e={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:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),ct(e,(r,o)=>!(r===void 0||o==="layout"&&!Object.keys(r).length||o==="paint"&&!Object.keys(r).length))}_validate(e,r,o,c,h={}){return(!h||h.validate!==!1)&&Fo(this,e.call(ao,{key:r,layerType:this.type,objectKey:o,value:c,styleSpec:de,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const r=this.paint.get(e);if(r instanceof tr&&Pt(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const Oa={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Or{constructor(e,r){this._structArray=e,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Nt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,r){return e._trim(),r&&(e.isTransferred=!0,r.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const r=Object.create(this.prototype);return r.arrayBuffer=e.arrayBuffer,r.length=e.length,r.capacity=e.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function jt(i,e=1){let r=0,o=0;return{members:i.map(c=>{const h=Oa[c.type].BYTES_PER_ELEMENT,p=r=zs(r,Math.max(e,h)),m=c.components||1;return o=Math.max(o,h),r+=h*m,{name:c.name,type:c.type,components:m,offset:p}}),size:zs(r,Math.max(o,e)),alignment:e}}function zs(i,e){return Math.ceil(i/e)*e}class Yr extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.int16[c+0]=r,this.int16[c+1]=o,e}}Yr.prototype.bytesPerElement=4,Fe("StructArrayLayout2i4",Yr);class a extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=4*e;return this.int16[p+0]=r,this.int16[p+1]=o,this.int16[p+2]=c,this.int16[p+3]=h,e}}a.prototype.bytesPerElement=8,Fe("StructArrayLayout4i8",a);class t extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=p,this.int16[g+5]=m,e}}t.prototype.bytesPerElement=12,Fe("StructArrayLayout2i4i12",t);class n extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=4*e,x=8*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.uint8[x+4]=c,this.uint8[x+5]=h,this.uint8[x+6]=p,this.uint8[x+7]=m,e}}n.prototype.bytesPerElement=8,Fe("StructArrayLayout2i4ub8",n);class s extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.float32[c+0]=r,this.float32[c+1]=o,e}}s.prototype.bytesPerElement=8,Fe("StructArrayLayout2f8",s);class u extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x,w){const E=this.length;return this.resize(E+1),this.emplace(E,e,r,o,c,h,p,m,g,x,w)}emplace(e,r,o,c,h,p,m,g,x,w,E){const C=10*e;return this.uint16[C+0]=r,this.uint16[C+1]=o,this.uint16[C+2]=c,this.uint16[C+3]=h,this.uint16[C+4]=p,this.uint16[C+5]=m,this.uint16[C+6]=g,this.uint16[C+7]=x,this.uint16[C+8]=w,this.uint16[C+9]=E,e}}u.prototype.bytesPerElement=20,Fe("StructArrayLayout10ui20",u);class d extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p,m,g,x,w,E,C){const z=this.length;return this.resize(z+1),this.emplace(z,e,r,o,c,h,p,m,g,x,w,E,C)}emplace(e,r,o,c,h,p,m,g,x,w,E,C,z){const P=12*e;return this.int16[P+0]=r,this.int16[P+1]=o,this.int16[P+2]=c,this.int16[P+3]=h,this.uint16[P+4]=p,this.uint16[P+5]=m,this.uint16[P+6]=g,this.uint16[P+7]=x,this.int16[P+8]=w,this.int16[P+9]=E,this.int16[P+10]=C,this.int16[P+11]=z,e}}d.prototype.bytesPerElement=24,Fe("StructArrayLayout4i4ui4i24",d);class f extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.float32[h+0]=r,this.float32[h+1]=o,this.float32[h+2]=c,e}}f.prototype.bytesPerElement=12,Fe("StructArrayLayout3f12",f);class _ extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint32[1*e+0]=r,e}}_.prototype.bytesPerElement=4,Fe("StructArrayLayout1ul4",_);class y extends Nt{_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(e,r,o,c,h,p,m,g,x){const w=this.length;return this.resize(w+1),this.emplace(w,e,r,o,c,h,p,m,g,x)}emplace(e,r,o,c,h,p,m,g,x,w){const E=10*e,C=5*e;return this.int16[E+0]=r,this.int16[E+1]=o,this.int16[E+2]=c,this.int16[E+3]=h,this.int16[E+4]=p,this.int16[E+5]=m,this.uint32[C+3]=g,this.uint16[E+8]=x,this.uint16[E+9]=w,e}}y.prototype.bytesPerElement=20,Fe("StructArrayLayout6i1ul2ui20",y);class v extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h,p){const m=this.length;return this.resize(m+1),this.emplace(m,e,r,o,c,h,p)}emplace(e,r,o,c,h,p,m){const g=6*e;return this.int16[g+0]=r,this.int16[g+1]=o,this.int16[g+2]=c,this.int16[g+3]=h,this.int16[g+4]=p,this.int16[g+5]=m,e}}v.prototype.bytesPerElement=12,Fe("StructArrayLayout2i2i2i12",v);class T extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,r,o,c,h)}emplace(e,r,o,c,h,p){const m=4*e,g=8*e;return this.float32[m+0]=r,this.float32[m+1]=o,this.float32[m+2]=c,this.int16[g+6]=h,this.int16[g+7]=p,e}}T.prototype.bytesPerElement=16,Fe("StructArrayLayout2f1f2i16",T);class I extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=12*e,m=3*e;return this.uint8[p+0]=r,this.uint8[p+1]=o,this.float32[m+1]=c,this.float32[m+2]=h,e}}I.prototype.bytesPerElement=12,Fe("StructArrayLayout2ub2f12",I);class M extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.uint16[h+0]=r,this.uint16[h+1]=o,this.uint16[h+2]=c,e}}M.prototype.bytesPerElement=6,Fe("StructArrayLayout3ui6",M);class U extends Nt{_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(e,r,o,c,h,p,m,g,x,w,E,C,z,P,N,V,ee){const oe=this.length;return this.resize(oe+1),this.emplace(oe,e,r,o,c,h,p,m,g,x,w,E,C,z,P,N,V,ee)}emplace(e,r,o,c,h,p,m,g,x,w,E,C,z,P,N,V,ee,oe){const Q=24*e,re=12*e,me=48*e;return this.int16[Q+0]=r,this.int16[Q+1]=o,this.uint16[Q+2]=c,this.uint16[Q+3]=h,this.uint32[re+2]=p,this.uint32[re+3]=m,this.uint32[re+4]=g,this.uint16[Q+10]=x,this.uint16[Q+11]=w,this.uint16[Q+12]=E,this.float32[re+7]=C,this.float32[re+8]=z,this.uint8[me+36]=P,this.uint8[me+37]=N,this.uint8[me+38]=V,this.uint32[re+10]=ee,this.int16[Q+22]=oe,e}}U.prototype.bytesPerElement=48,Fe("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",U);class F extends Nt{_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(e,r,o,c,h,p,m,g,x,w,E,C,z,P,N,V,ee,oe,Q,re,me,fe,Be,Ue,Pe,Ie,Te,ke){const Ae=this.length;return this.resize(Ae+1),this.emplace(Ae,e,r,o,c,h,p,m,g,x,w,E,C,z,P,N,V,ee,oe,Q,re,me,fe,Be,Ue,Pe,Ie,Te,ke)}emplace(e,r,o,c,h,p,m,g,x,w,E,C,z,P,N,V,ee,oe,Q,re,me,fe,Be,Ue,Pe,Ie,Te,ke,Ae){const be=34*e,qe=17*e;return this.int16[be+0]=r,this.int16[be+1]=o,this.int16[be+2]=c,this.int16[be+3]=h,this.int16[be+4]=p,this.int16[be+5]=m,this.int16[be+6]=g,this.int16[be+7]=x,this.uint16[be+8]=w,this.uint16[be+9]=E,this.uint16[be+10]=C,this.uint16[be+11]=z,this.uint16[be+12]=P,this.uint16[be+13]=N,this.uint16[be+14]=V,this.uint16[be+15]=ee,this.uint16[be+16]=oe,this.uint16[be+17]=Q,this.uint16[be+18]=re,this.uint16[be+19]=me,this.uint16[be+20]=fe,this.uint16[be+21]=Be,this.uint16[be+22]=Ue,this.uint32[qe+12]=Pe,this.float32[qe+13]=Ie,this.float32[qe+14]=Te,this.float32[qe+15]=ke,this.float32[qe+16]=Ae,e}}F.prototype.bytesPerElement=68,Fe("StructArrayLayout8i15ui1ul4f68",F);class O extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.float32[1*e+0]=r,e}}O.prototype.bytesPerElement=4,Fe("StructArrayLayout1f4",O);class H extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=3*e;return this.int16[h+0]=r,this.int16[h+1]=o,this.int16[h+2]=c,e}}H.prototype.bytesPerElement=6,Fe("StructArrayLayout3i6",H);class Y extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,o){const c=this.length;return this.resize(c+1),this.emplace(c,e,r,o)}emplace(e,r,o,c){const h=4*e;return this.uint32[2*e+0]=r,this.uint16[h+2]=o,this.uint16[h+3]=c,e}}Y.prototype.bytesPerElement=8,Fe("StructArrayLayout1ul2ui8",Y);class te extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){const o=this.length;return this.resize(o+1),this.emplace(o,e,r)}emplace(e,r,o){const c=2*e;return this.uint16[c+0]=r,this.uint16[c+1]=o,e}}te.prototype.bytesPerElement=4,Fe("StructArrayLayout2ui4",te);class $ extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){return this.uint16[1*e+0]=r,e}}$.prototype.bytesPerElement=2,Fe("StructArrayLayout1ui2",$);class ne extends Nt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,o,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,r,o,c)}emplace(e,r,o,c,h){const p=4*e;return this.float32[p+0]=r,this.float32[p+1]=o,this.float32[p+2]=c,this.float32[p+3]=h,e}}ne.prototype.bytesPerElement=16,Fe("StructArrayLayout4f16",ne);class ie extends Or{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 We(this.anchorPointX,this.anchorPointY)}}ie.prototype.size=20;class ue extends y{get(e){return new ie(this,e)}}Fe("CollisionBoxArray",ue);class he extends Or{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(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}he.prototype.size=48;class ve extends U{get(e){return new he(this,e)}}Fe("PlacedSymbolArray",ve);class ce extends Or{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(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}ce.prototype.size=68;class Le extends F{get(e){return new ce(this,e)}}Fe("SymbolInstanceArray",Le);class Se extends O{getoffsetX(e){return this.float32[1*e+0]}}Fe("GlyphOffsetArray",Se);class Re extends H{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Fe("SymbolLineVertexArray",Re);class Qe extends Or{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]}}Qe.prototype.size=8;class it extends Y{get(e){return new Qe(this,e)}}Fe("FeatureIndexArray",it);class Ge extends Yr{}class wt extends Yr{}class Tt extends Yr{}class ut extends t{}class mt extends n{}class St extends s{}class ei extends u{}class rr extends d{}class Xi extends f{}class nr extends _{}class Ur extends v{}class $i extends I{}class vi extends M{}class yr extends te{}const $o=jt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ht}=$o;class nt{constructor(e=[]){this.segments=e}prepareSegment(e,r,o,c){let h=this.segments[this.segments.length-1];return e>nt.MAX_VERTEX_ARRAY_LENGTH&&Vt(`Max vertices per segment is ${nt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>nt.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==c)&&(h={vertexOffset:r.length,primitiveOffset:o.length,vertexLength:0,primitiveLength:0},c!==void 0&&(h.sortKey=c),this.segments.push(h)),h}get(){return this.segments}destroy(){for(const e of this.segments)for(const r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,o,c){return new nt([{vertexOffset:e,primitiveOffset:r,vertexLength:o,primitiveLength:c,vaos:{},sortKey:0}])}}function vt(i,e){return 256*(i=se(Math.floor(i),0,255))+se(Math.floor(e),0,255)}nt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Fe("SegmentVector",nt);const ti=jt([{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"}]);var ii={exports:{}},Ot={exports:{}};Ot.exports=function(i,e){var r,o,c,h,p,m,g,x;for(o=i.length-(r=3&i.length),c=e,p=3432918353,m=461845907,x=0;x<o;)g=255&i.charCodeAt(x)|(255&i.charCodeAt(++x))<<8|(255&i.charCodeAt(++x))<<16|(255&i.charCodeAt(++x))<<24,++x,c=27492+(65535&(h=5*(65535&(c=(c^=g=(65535&(g=(g=(65535&g)*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295)<<13|c>>>19))+((5*(c>>>16)&65535)<<16)&4294967295))+((58964+(h>>>16)&65535)<<16);switch(g=0,r){case 3:g^=(255&i.charCodeAt(x+2))<<16;case 2:g^=(255&i.charCodeAt(x+1))<<8;case 1:c^=g=(65535&(g=(g=(65535&(g^=255&i.charCodeAt(x)))*p+(((g>>>16)*p&65535)<<16)&4294967295)<<15|g>>>17))*m+(((g>>>16)*m&65535)<<16)&4294967295}return c^=i.length,c=2246822507*(65535&(c^=c>>>16))+((2246822507*(c>>>16)&65535)<<16)&4294967295,c=3266489909*(65535&(c^=c>>>13))+((3266489909*(c>>>16)&65535)<<16)&4294967295,(c^=c>>>16)>>>0};var Vi={exports:{}};Vi.exports=function(i,e){for(var r,o=i.length,c=e^o,h=0;o>=4;)r=1540483477*(65535&(r=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24))+((1540483477*(r>>>16)&65535)<<16),c=1540483477*(65535&c)+((1540483477*(c>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),o-=4,++h;switch(o){case 3:c^=(255&i.charCodeAt(h+2))<<16;case 2:c^=(255&i.charCodeAt(h+1))<<8;case 1:c=1540483477*(65535&(c^=255&i.charCodeAt(h)))+((1540483477*(c>>>16)&65535)<<16)}return c=1540483477*(65535&(c^=c>>>13))+((1540483477*(c>>>16)&65535)<<16),(c^=c>>>15)>>>0};var Qr=Ot.exports,Ps=Vi.exports;ii.exports=Qr,ii.exports.murmur3=Qr,ii.exports.murmur2=Ps;class kn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,o,c){this.ids.push(Ua(e)),this.positions.push(r,o,c)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Ua(e);let o=0,c=this.ids.length-1;for(;o<c;){const p=o+c>>1;this.ids[p]>=r?c=p:o=p+1}const h=[];for(;this.ids[o]===r;)h.push({index:this.positions[3*o],start:this.positions[3*o+1],end:this.positions[3*o+2]}),o++;return h}static serialize(e,r){const o=new Float64Array(e.ids),c=new Uint32Array(e.positions);return ks(o,c,0,o.length-1),r&&r.push(o.buffer,c.buffer),{ids:o,positions:c}}static deserialize(e){const r=new kn;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}}function Ua(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:ii.exports(String(i))}function ks(i,e,r,o){for(;r<o;){const c=i[r+o>>1];let h=r-1,p=o+1;for(;;){do h++;while(i[h]<c);do p--;while(i[p]>c);if(h>=p)break;$r(i,h,p),$r(e,3*h,3*p),$r(e,3*h+1,3*p+1),$r(e,3*h+2,3*p+2)}p-r<o-p?(ks(i,e,r,p),r=p+1):(ks(i,e,p+1,o),o=p)}}function $r(i,e,r){const o=i[e];i[e]=i[r],i[r]=o}Fe("FeaturePositionMap",kn);class en{constructor(e,r){this.gl=e.gl,this.location=r}}class tn extends en{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Vo extends en{constructor(e,r){super(e,r),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Pc extends en{constructor(e,r){super(e,r),this.current=D.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}const Lh=new Float32Array(16);function Dl(i){return[vt(255*i.r,255*i.g),vt(255*i.b,255*i.a)]}class Ds{constructor(e,r,o){this.value=e,this.uniformNames=r.map(c=>`u_${c}`),this.type=o}setUniform(e,r,o){e.set(o.constantOr(this.value))}getBinding(e,r,o){return this.type==="color"?new Pc(e,r):new tn(e,r)}}class No{constructor(e,r){this.uniformNames=r.map(o=>`u_${o}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,o,c){const h=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;h&&e.set(h)}getBinding(e,r,o){return o.substr(0,9)==="u_pattern"?new Vo(e,r):new tn(e,r)}}class rn{constructor(e,r,o,c){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=r.map(h=>({name:`a_${h}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,r,o,c,h){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Ft(0),r,{},c,[],h);this.paintVertexArray.resize(e),this._setPaintValue(p,e,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:0},o,c);this._setPaintValue(e,r,h)}_setPaintValue(e,r,o){if(this.type==="color"){const c=Dl(o);for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,c[0],c[1])}else{for(let c=e;c<r;c++)this.paintVertexArray.emplace(c,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class xr{constructor(e,r,o,c,h,p){this.expression=e,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=o,this.useIntegerZoom=c,this.zoom=h,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(e,r,o,c,h){const p=this.expression.evaluate(new Ft(this.zoom),r,{},c,[],h),m=this.expression.evaluate(new Ft(this.zoom+1),r,{},c,[],h),g=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(g,e,p,m)}updatePaintArray(e,r,o,c){const h=this.expression.evaluate({zoom:this.zoom},o,c),p=this.expression.evaluate({zoom:this.zoom+1},o,c);this._setPaintValue(e,r,h,p)}_setPaintValue(e,r,o,c){if(this.type==="color"){const h=Dl(o),p=Dl(c);for(let m=e;m<r;m++)this.paintVertexArray.emplace(m,h[0],h[1],p[0],p[1])}else{for(let h=e;h<r;h++)this.paintVertexArray.emplace(h,o,c);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(c))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){const o=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=se(this.expression.interpolationFactor(o,this.zoom,this.zoom+1),0,1);e.set(c)}getBinding(e,r,o){return new tn(e,r)}}class Dn{constructor(e,r,o,c,h,p){this.expression=e,this.type=r,this.useIntegerZoom=o,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new h,this.zoomOutPaintVertexArray=new h}populatePaintArray(e,r,o){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(c,e,r.patterns&&r.patterns[this.layerId],o)}updatePaintArray(e,r,o,c,h){this._setPaintValues(e,r,o.patterns&&o.patterns[this.layerId],h)}_setPaintValues(e,r,o,c){if(!c||!o)return;const{min:h,mid:p,max:m}=o,g=c[h],x=c[p],w=c[m];if(g&&x&&w)for(let E=e;E<r;E++)this.zoomInPaintVertexArray.emplace(E,x.tl[0],x.tl[1],x.br[0],x.br[1],g.tl[0],g.tl[1],g.br[0],g.br[1],x.pixelRatio,g.pixelRatio),this.zoomOutPaintVertexArray.emplace(E,x.tl[0],x.tl[1],x.br[0],x.br[1],w.tl[0],w.tl[1],w.br[0],w.br[1],x.pixelRatio,w.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,ti.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,ti.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class kc{constructor(e,r,o){this.binders={},this._buffers=[];const c=[];for(const h in e.paint._values){if(!o(h))continue;const p=e.paint.get(h);if(!(p instanceof tr&&Pt(p.property.specification)))continue;const m=Rh(h,e.type),g=p.value,x=p.property.specification.type,w=p.property.useIntegerZoom,E=p.property.specification["property-type"],C=E==="cross-faded"||E==="cross-faded-data-driven";if(g.kind==="constant")this.binders[h]=C?new No(g.value,m):new Ds(g.value,m,x),c.push(`/u_${h}`);else if(g.kind==="source"||C){const z=Dc(h,x,"source");this.binders[h]=C?new Dn(g,x,w,r,z,e.id):new rn(g,m,x,z),c.push(`/a_${h}`)}else{const z=Dc(h,x,"composite");this.binders[h]=new xr(g,m,x,w,r,z),c.push(`/z_${h}`)}}this.cacheKey=c.sort().join("")}getMaxValue(e){const r=this.binders[e];return r instanceof rn||r instanceof xr?r.maxValue:0}populatePaintArrays(e,r,o,c,h){for(const p in this.binders){const m=this.binders[p];(m instanceof rn||m instanceof xr||m instanceof Dn)&&m.populatePaintArray(e,r,o,c,h)}}setConstantPatternPositions(e,r){for(const o in this.binders){const c=this.binders[o];c instanceof No&&c.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,o,c,h){let p=!1;for(const m in e){const g=r.getPositions(m);for(const x of g){const w=o.feature(x.index);for(const E in this.binders){const C=this.binders[E];if((C instanceof rn||C instanceof xr||C instanceof Dn)&&C.expression.isStateDependent===!0){const z=c.paint.get(E);C.expression=z.value,C.updatePaintArray(x.start,x.end,w,e[m],h),p=!0}}}}return p}defines(){const e=[];for(const r in this.binders){const o=this.binders[r];(o instanceof Ds||o instanceof No)&&e.push(...o.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return e}getBinderAttributes(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof rn||o instanceof xr)for(let c=0;c<o.paintVertexAttributes.length;c++)e.push(o.paintVertexAttributes[c].name);else if(o instanceof Dn)for(let c=0;c<ti.members.length;c++)e.push(ti.members[c].name)}return e}getBinderUniforms(){const e=[];for(const r in this.binders){const o=this.binders[r];if(o instanceof Ds||o instanceof No||o instanceof xr)for(const c of o.uniformNames)e.push(c)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,r){const o=[];for(const c in this.binders){const h=this.binders[c];if(h instanceof Ds||h instanceof No||h instanceof xr){for(const p of h.uniformNames)if(r[p]){const m=h.getBinding(e,r[p],p);o.push({name:p,property:c,binding:m})}}}return o}setUniforms(e,r,o,c){for(const{name:h,property:p,binding:m}of r)this.binders[p].setUniform(m,c,o.get(p),h)}updatePaintBuffers(e){this._buffers=[];for(const r in this.binders){const o=this.binders[r];if(e&&o instanceof Dn){const c=e.fromScale===2?o.zoomInPaintVertexBuffer:o.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(o instanceof rn||o instanceof xr)&&o.paintVertexBuffer&&this._buffers.push(o.paintVertexBuffer)}}upload(e){for(const r in this.binders){const o=this.binders[r];(o instanceof rn||o instanceof xr||o instanceof Dn)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const r=this.binders[e];(r instanceof rn||r instanceof xr||r instanceof Dn)&&r.destroy()}}}class po{constructor(e,r,o=()=>!0){this.programConfigurations={};for(const c of e)this.programConfigurations[c.id]=new kc(c,r,o);this.needsUpload=!1,this._featureMap=new kn,this._bufferOffset=0}populatePaintArrays(e,r,o,c,h,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(e,r,c,h,p);r.id!==void 0&&this._featureMap.add(r.id,o,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,r,o,c){for(const h of o)this.needsUpload=this.programConfigurations[h.id].updatePaintArrays(e,this._featureMap,r,h,c)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Rh(i,e){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-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"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function Dc(i,e,r){const o={color:{source:s,composite:ne},number:{source:O,composite:s}},c=function(h){return{"line-pattern":{source:ei,composite:ei},"fill-pattern":{source:ei,composite:ei},"fill-extrusion-pattern":{source:ei,composite:ei}}[h]}(i);return c&&c[r]||o[e][r]}Fe("ConstantBinder",Ds),Fe("CrossFadedConstantBinder",No),Fe("SourceExpressionBinder",rn),Fe("CrossFadedCompositeBinder",Dn),Fe("CompositeExpressionBinder",xr),Fe("ProgramConfiguration",kc,{omit:["_buffers"]}),Fe("ProgramConfigurationSet",po);var Kt=8192;const Ll=Math.pow(2,14)-1,Lc=-Ll-1;function fo(i){const e=Kt/i.extent,r=i.loadGeometry();for(let o=0;o<r.length;o++){const c=r[o];for(let h=0;h<c.length;h++){const p=c[h],m=Math.round(p.x*e),g=Math.round(p.y*e);p.x=se(m,Lc,Ll),p.y=se(g,Lc,Ll),(m<p.x||m>p.x+1||g<p.y||g>p.y+1)&&Vt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function mo(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?fo(i):[]}}function $a(i,e,r,o,c){i.emplaceBack(2*e+(o+1)/2,2*r+(c+1)/2)}class Rl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new wt,this.indexArray=new vi,this.segments=new nt,this.programConfigurations=new po(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){const c=this.layers[0],h=[];let p=null,m=!1;c.type==="circle"&&(p=c.layout.get("circle-sort-key"),m=!p.isConstant());for(const{feature:g,id:x,index:w,sourceLayerIndex:E}of e){const C=this.layers[0]._featureFilter.needGeometry,z=mo(g,C);if(!this.layers[0]._featureFilter.filter(new Ft(this.zoom),z,o))continue;const P=m?p.evaluate(z,{},o):void 0,N={id:x,properties:g.properties,type:g.type,sourceLayerIndex:E,index:w,geometry:C?z.geometry:fo(g),patterns:{},sortKey:P};h.push(N)}m&&h.sort((g,x)=>g.sortKey-x.sortKey);for(const g of h){const{geometry:x,index:w,sourceLayerIndex:E}=g,C=e[w].feature;this.addFeature(g,x,w,o),r.featureIndex.insert(C,x,w,E,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ht),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,r,o,c){for(const h of r)for(const p of h){const m=p.x,g=p.y;if(m<0||m>=Kt||g<0||g>=Kt)continue;const x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),w=x.vertexLength;$a(this.layoutVertexArray,m,g,-1,-1),$a(this.layoutVertexArray,m,g,1,-1),$a(this.layoutVertexArray,m,g,1,1),$a(this.layoutVertexArray,m,g,-1,1),this.indexArray.emplaceBack(w,w+1,w+2),this.indexArray.emplaceBack(w,w+3,w+2),x.vertexLength+=4,x.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},c)}}function Rc(i,e){for(let r=0;r<i.length;r++)if(Go(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Go(i,e[r]))return!0;return!!Bl(i,e)}function Bh(i,e,r){return!!Go(i,e)||!!Fl(e,i,r)}function Bc(i,e){if(i.length===1)return Oc(e,i[0]);for(let r=0;r<e.length;r++){const o=e[r];for(let c=0;c<o.length;c++)if(Go(i,o[c]))return!0}for(let r=0;r<i.length;r++)if(Oc(e,i[r]))return!0;for(let r=0;r<e.length;r++)if(Bl(i,e[r]))return!0;return!1}function Fh(i,e,r){if(i.length>1){if(Bl(i,e))return!0;for(let o=0;o<e.length;o++)if(Fl(e[o],i,r))return!0}for(let o=0;o<i.length;o++)if(Fl(i[o],e,r))return!0;return!1}function Bl(i,e){if(i.length===0||e.length===0)return!1;for(let r=0;r<i.length-1;r++){const o=i[r],c=i[r+1];for(let h=0;h<e.length-1;h++)if(Oh(o,c,e[h],e[h+1]))return!0}return!1}function Oh(i,e,r,o){return Dt(i,r,o)!==Dt(e,r,o)&&Dt(i,e,r)!==Dt(i,e,o)}function Fl(i,e,r){const o=r*r;if(e.length===1)return i.distSqr(e[0])<o;for(let c=1;c<e.length;c++)if(Fc(i,e[c-1],e[c])<o)return!0;return!1}function Fc(i,e,r){const o=e.distSqr(r);if(o===0)return i.distSqr(e);const c=((i.x-e.x)*(r.x-e.x)+(i.y-e.y)*(r.y-e.y))/o;return i.distSqr(c<0?e:c>1?r:r.sub(e)._mult(c)._add(e))}function Oc(i,e){let r,o,c,h=!1;for(let p=0;p<i.length;p++){r=i[p];for(let m=0,g=r.length-1;m<r.length;g=m++)o=r[m],c=r[g],o.y>e.y!=c.y>e.y&&e.x<(c.x-o.x)*(e.y-o.y)/(c.y-o.y)+o.x&&(h=!h)}return h}function Go(i,e){let r=!1;for(let o=0,c=i.length-1;o<i.length;c=o++){const h=i[o],p=i[c];h.y>e.y!=p.y>e.y&&e.x<(p.x-h.x)*(e.y-h.y)/(p.y-h.y)+h.x&&(r=!r)}return r}function Uh(i,e,r){const o=r[0],c=r[2];if(i.x<o.x&&e.x<o.x||i.x>c.x&&e.x>c.x||i.y<o.y&&e.y<o.y||i.y>c.y&&e.y>c.y)return!1;const h=Dt(i,e,r[0]);return h!==Dt(i,e,r[1])||h!==Dt(i,e,r[2])||h!==Dt(i,e,r[3])}function Ls(i,e,r){const o=e.paint.get(i).value;return o.kind==="constant"?o.value:r.programConfigurations.get(e.id).getMaxValue(i)}function Va(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Na(i,e,r,o,c){if(!e[0]&&!e[1])return i;const h=We.convert(e)._mult(c);r==="viewport"&&h._rotate(-o);const p=[];for(let m=0;m<i.length;m++)p.push(i[m].sub(h));return p}Fe("CircleBucket",Rl,{omit:["layers"]});const $h=new si({"circle-sort-key":new je(de.layout_circle["circle-sort-key"])});var Vh={paint:new si({"circle-radius":new je(de.paint_circle["circle-radius"]),"circle-color":new je(de.paint_circle["circle-color"]),"circle-blur":new je(de.paint_circle["circle-blur"]),"circle-opacity":new je(de.paint_circle["circle-opacity"]),"circle-translate":new Ve(de.paint_circle["circle-translate"]),"circle-translate-anchor":new Ve(de.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ve(de.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ve(de.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new je(de.paint_circle["circle-stroke-width"]),"circle-stroke-color":new je(de.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new je(de.paint_circle["circle-stroke-opacity"])}),layout:$h},bi=1e-6,wi=typeof Float32Array!="undefined"?Float32Array:Array;function Uc(){var i=new wi(9);return wi!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function Ol(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function $c(i,e,r){var o=e[0],c=e[1],h=e[2],p=e[3],m=e[4],g=e[5],x=e[6],w=e[7],E=e[8],C=e[9],z=e[10],P=e[11],N=e[12],V=e[13],ee=e[14],oe=e[15],Q=r[0],re=r[1],me=r[2],fe=r[3];return i[0]=Q*o+re*m+me*E+fe*N,i[1]=Q*c+re*g+me*C+fe*V,i[2]=Q*h+re*x+me*z+fe*ee,i[3]=Q*p+re*w+me*P+fe*oe,i[4]=(Q=r[4])*o+(re=r[5])*m+(me=r[6])*E+(fe=r[7])*N,i[5]=Q*c+re*g+me*C+fe*V,i[6]=Q*h+re*x+me*z+fe*ee,i[7]=Q*p+re*w+me*P+fe*oe,i[8]=(Q=r[8])*o+(re=r[9])*m+(me=r[10])*E+(fe=r[11])*N,i[9]=Q*c+re*g+me*C+fe*V,i[10]=Q*h+re*x+me*z+fe*ee,i[11]=Q*p+re*w+me*P+fe*oe,i[12]=(Q=r[12])*o+(re=r[13])*m+(me=r[14])*E+(fe=r[15])*N,i[13]=Q*c+re*g+me*C+fe*V,i[14]=Q*h+re*x+me*z+fe*ee,i[15]=Q*p+re*w+me*P+fe*oe,i}Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});var Rs,Nh=$c;function Vc(){var i=new wi(3);return wi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function Nc(i,e,r){var o=new wi(3);return o[0]=i,o[1]=e,o[2]=r,o}function Ga(i,e,r){var o=e[0],c=e[1],h=e[2],p=e[3];return i[0]=r[0]*o+r[4]*c+r[8]*h+r[12]*p,i[1]=r[1]*o+r[5]*c+r[9]*h+r[13]*p,i[2]=r[2]*o+r[6]*c+r[10]*h+r[14]*p,i[3]=r[3]*o+r[7]*c+r[11]*h+r[15]*p,i}function Gc(){var i=new wi(4);return wi!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function qc(i,e){const r=Ga([],[i.x,i.y,0,1],e);return new We(r[0]/r[3],r[1]/r[3])}Vc(),Rs=new wi(4),wi!=Float32Array&&(Rs[0]=0,Rs[1]=0,Rs[2]=0,Rs[3]=0),Vc(),Nc(1,0,0),Nc(0,1,0),Gc(),Gc(),Uc(),function(){var i;i=new wi(2),wi!=Float32Array&&(i[0]=0,i[1]=0)}();class Zc extends Rl{}Fe("HeatmapBucket",Zc,{omit:["layers"]});var Gh={paint:new si({"heatmap-radius":new je(de.paint_heatmap["heatmap-radius"]),"heatmap-weight":new je(de.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ve(de.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Br(de.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ve(de.paint_heatmap["heatmap-opacity"])})};function Ul(i,{width:e,height:r},o,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==e*r*o)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${e*r*o}`)}else c=new Uint8Array(e*r*o);return i.width=e,i.height=r,i.data=c,i}function jc(i,{width:e,height:r},o){if(e===i.width&&r===i.height)return;const c=Ul({},{width:e,height:r},o);$l(i,c,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,e),height:Math.min(i.height,r)},o),i.width=e,i.height=r,i.data=c.data}function $l(i,e,r,o,c,h){if(c.width===0||c.height===0)return e;if(c.width>i.width||c.height>i.height||r.x>i.width-c.width||r.y>i.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>e.width||c.height>e.height||o.x>e.width-c.width||o.y>e.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=i.data,m=e.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<c.height;g++){const x=((r.y+g)*i.width+r.x)*h,w=((o.y+g)*e.width+o.x)*h;for(let E=0;E<c.width*h;E++)m[w+E]=p[x+E]}return e}class Bs{constructor(e,r){Ul(this,e,1,r)}resize(e){jc(this,e,1)}clone(){return new Bs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){$l(e,r,o,c,h,1)}}class Wi{constructor(e,r){Ul(this,e,4,r)}resize(e){jc(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Wi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,o,c,h){$l(e,r,o,c,h,4)}}function Xc(i){const e={},r=i.resolution||256,o=i.clips?i.clips.length:1,c=i.image||new Wi({width:r,height:o});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const h=(p,m,g)=>{e[i.evaluationKey]=g;const x=i.expression.evaluate(e);c.data[p+m+0]=Math.floor(255*x.r/x.a),c.data[p+m+1]=Math.floor(255*x.g/x.a),c.data[p+m+2]=Math.floor(255*x.b/x.a),c.data[p+m+3]=Math.floor(255*x.a)};if(i.clips)for(let p=0,m=0;p<o;++p,m+=4*r)for(let g=0,x=0;g<r;g++,x+=4){const w=g/(r-1),{start:E,end:C}=i.clips[p];h(m,x,E*(1-w)+C*w)}else for(let p=0,m=0;p<r;p++,m+=4)h(0,m,p/(r-1));return c}Fe("AlphaImage",Bs),Fe("RGBAImage",Wi);var qh={paint:new si({"hillshade-illumination-direction":new Ve(de.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ve(de.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ve(de.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ve(de.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ve(de.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ve(de.paint_hillshade["hillshade-accent-color"])})};const Zh=jt([{name:"a_pos",components:2,type:"Int16"}],4),{members:jh}=Zh;var qa={exports:{}};function Za(i,e,r){r=r||2;var o,c,h,p,m,g,x,w=e&&e.length,E=w?e[0]*r:i.length,C=Wc(i,0,E,r,!0),z=[];if(!C||C.next===C.prev)return z;if(w&&(C=function(N,V,ee,oe){var Q,re,me,fe=[];for(Q=0,re=V.length;Q<re;Q++)(me=Wc(N,V[Q]*oe,Q<re-1?V[Q+1]*oe:N.length,oe,!1))===me.next&&(me.steiner=!0),fe.push(ed(me));for(fe.sort(Jh),Q=0;Q<fe.length;Q++)ee=Yh(fe[Q],ee);return ee}(i,e,C,r)),i.length>80*r){o=h=i[0],c=p=i[1];for(var P=r;P<E;P+=r)(m=i[P])<o&&(o=m),(g=i[P+1])<c&&(c=g),m>h&&(h=m),g>p&&(p=g);x=(x=Math.max(h-o,p-c))!==0?32767/x:0}return Fs(C,z,r,o,c,x,0),z}function Wc(i,e,r,o,c){var h,p;if(c===Gl(i,e,r,o)>0)for(h=e;h<r;h+=o)p=Jc(h,i[h],i[h+1],p);else for(h=r-o;h>=e;h-=o)p=Jc(h,i[h],i[h+1],p);return p&&ja(p,p.next)&&(Us(p),p=p.next),p}function go(i,e){if(!i)return i;e||(e=i);var r,o=i;do if(r=!1,o.steiner||!ja(o,o.next)&&qt(o.prev,o,o.next)!==0)o=o.next;else{if(Us(o),(o=e=o.prev)===o.next)break;r=!0}while(r||o!==e);return e}function Fs(i,e,r,o,c,h,p){if(i){!p&&h&&function(w,E,C,z){var P=w;do P.z===0&&(P.z=Vl(P.x,P.y,E,C,z)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==w);P.prevZ.nextZ=null,P.prevZ=null,function(N){var V,ee,oe,Q,re,me,fe,Be,Ue=1;do{for(ee=N,N=null,re=null,me=0;ee;){for(me++,oe=ee,fe=0,V=0;V<Ue&&(fe++,oe=oe.nextZ);V++);for(Be=Ue;fe>0||Be>0&&oe;)fe!==0&&(Be===0||!oe||ee.z<=oe.z)?(Q=ee,ee=ee.nextZ,fe--):(Q=oe,oe=oe.nextZ,Be--),re?re.nextZ=Q:N=Q,Q.prevZ=re,re=Q;ee=oe}re.nextZ=null,Ue*=2}while(me>1)}(P)}(i,o,c,h);for(var m,g,x=i;i.prev!==i.next;)if(m=i.prev,g=i.next,h?Wh(i,o,c,h):Xh(i))e.push(m.i/r|0),e.push(i.i/r|0),e.push(g.i/r|0),Us(i),i=g.next,x=g.next;else if((i=g)===x){p?p===1?Fs(i=Hh(go(i),e,r),e,r,o,c,h,2):p===2&&Kh(i,e,r,o,c,h):Fs(go(i),e,r,o,c,h,1);break}}}function Xh(i){var e=i.prev,r=i,o=i.next;if(qt(e,r,o)>=0)return!1;for(var c=e.x,h=r.x,p=o.x,m=e.y,g=r.y,x=o.y,w=c<h?c<p?c:p:h<p?h:p,E=m<g?m<x?m:x:g<x?g:x,C=c>h?c>p?c:p:h>p?h:p,z=m>g?m>x?m:x:g>x?g:x,P=o.next;P!==e;){if(P.x>=w&&P.x<=C&&P.y>=E&&P.y<=z&&qo(c,m,h,g,p,x,P.x,P.y)&&qt(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function Wh(i,e,r,o){var c=i.prev,h=i,p=i.next;if(qt(c,h,p)>=0)return!1;for(var m=c.x,g=h.x,x=p.x,w=c.y,E=h.y,C=p.y,z=m<g?m<x?m:x:g<x?g:x,P=w<E?w<C?w:C:E<C?E:C,N=m>g?m>x?m:x:g>x?g:x,V=w>E?w>C?w:C:E>C?E:C,ee=Vl(z,P,e,r,o),oe=Vl(N,V,e,r,o),Q=i.prevZ,re=i.nextZ;Q&&Q.z>=ee&&re&&re.z<=oe;){if(Q.x>=z&&Q.x<=N&&Q.y>=P&&Q.y<=V&&Q!==c&&Q!==p&&qo(m,w,g,E,x,C,Q.x,Q.y)&&qt(Q.prev,Q,Q.next)>=0||(Q=Q.prevZ,re.x>=z&&re.x<=N&&re.y>=P&&re.y<=V&&re!==c&&re!==p&&qo(m,w,g,E,x,C,re.x,re.y)&&qt(re.prev,re,re.next)>=0))return!1;re=re.nextZ}for(;Q&&Q.z>=ee;){if(Q.x>=z&&Q.x<=N&&Q.y>=P&&Q.y<=V&&Q!==c&&Q!==p&&qo(m,w,g,E,x,C,Q.x,Q.y)&&qt(Q.prev,Q,Q.next)>=0)return!1;Q=Q.prevZ}for(;re&&re.z<=oe;){if(re.x>=z&&re.x<=N&&re.y>=P&&re.y<=V&&re!==c&&re!==p&&qo(m,w,g,E,x,C,re.x,re.y)&&qt(re.prev,re,re.next)>=0)return!1;re=re.nextZ}return!0}function Hh(i,e,r){var o=i;do{var c=o.prev,h=o.next.next;!ja(c,h)&&Hc(c,o,o.next,h)&&Os(c,h)&&Os(h,c)&&(e.push(c.i/r|0),e.push(o.i/r|0),e.push(h.i/r|0),Us(o),Us(o.next),o=i=h),o=o.next}while(o!==i);return go(o)}function Kh(i,e,r,o,c,h){var p=i;do{for(var m=p.next.next;m!==p.prev;){if(p.i!==m.i&&td(p,m)){var g=Kc(p,m);return p=go(p,p.next),g=go(g,g.next),Fs(p,e,r,o,c,h,0),void Fs(g,e,r,o,c,h,0)}m=m.next}p=p.next}while(p!==i)}function Jh(i,e){return i.x-e.x}function Yh(i,e){var r=function(c,h){var p,m=h,g=c.x,x=c.y,w=-1/0;do{if(x<=m.y&&x>=m.next.y&&m.next.y!==m.y){var E=m.x+(x-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(E<=g&&E>w&&(w=E,p=m.x<m.next.x?m:m.next,E===g))return p}m=m.next}while(m!==h);if(!p)return null;var C,z=p,P=p.x,N=p.y,V=1/0;m=p;do g>=m.x&&m.x>=P&&g!==m.x&&qo(x<N?g:w,x,P,N,x<N?w:g,x,m.x,m.y)&&(C=Math.abs(x-m.y)/(g-m.x),Os(m,c)&&(C<V||C===V&&(m.x>p.x||m.x===p.x&&Qh(p,m)))&&(p=m,V=C)),m=m.next;while(m!==z);return p}(i,e);if(!r)return e;var o=Kc(r,i);return go(o,o.next),go(r,r.next)}function Qh(i,e){return qt(i.prev,i,e.prev)<0&&qt(e.next,i,i.next)<0}function Vl(i,e,r,o,c){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-r)*c|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*c|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ed(i){var e=i,r=i;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==i);return r}function qo(i,e,r,o,c,h,p,m){return(c-p)*(e-m)>=(i-p)*(h-m)&&(i-p)*(o-m)>=(r-p)*(e-m)&&(r-p)*(h-m)>=(c-p)*(o-m)}function td(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(r,o){var c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==o.i&&c.next.i!==o.i&&Hc(c,c.next,r,o))return!0;c=c.next}while(c!==r);return!1}(i,e)&&(Os(i,e)&&Os(e,i)&&function(r,o){var c=r,h=!1,p=(r.x+o.x)/2,m=(r.y+o.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&p<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(h=!h),c=c.next;while(c!==r);return h}(i,e)&&(qt(i.prev,i,e.prev)||qt(i,e.prev,e))||ja(i,e)&&qt(i.prev,i,i.next)>0&&qt(e.prev,e,e.next)>0)}function qt(i,e,r){return(e.y-i.y)*(r.x-e.x)-(e.x-i.x)*(r.y-e.y)}function ja(i,e){return i.x===e.x&&i.y===e.y}function Hc(i,e,r,o){var c=Wa(qt(i,e,r)),h=Wa(qt(i,e,o)),p=Wa(qt(r,o,i)),m=Wa(qt(r,o,e));return c!==h&&p!==m||!(c!==0||!Xa(i,r,e))||!(h!==0||!Xa(i,o,e))||!(p!==0||!Xa(r,i,o))||!(m!==0||!Xa(r,e,o))}function Xa(i,e,r){return e.x<=Math.max(i.x,r.x)&&e.x>=Math.min(i.x,r.x)&&e.y<=Math.max(i.y,r.y)&&e.y>=Math.min(i.y,r.y)}function Wa(i){return i>0?1:i<0?-1:0}function Os(i,e){return qt(i.prev,i,i.next)<0?qt(i,e,i.next)>=0&&qt(i,i.prev,e)>=0:qt(i,e,i.prev)<0||qt(i,i.next,e)<0}function Kc(i,e){var r=new Nl(i.i,i.x,i.y),o=new Nl(e.i,e.x,e.y),c=i.next,h=e.prev;return i.next=e,e.prev=i,r.next=c,c.prev=r,o.next=r,r.prev=o,h.next=o,o.prev=h,o}function Jc(i,e,r,o){var c=new Nl(i,e,r);return o?(c.next=o.next,c.prev=o,o.next.prev=c,o.next=c):(c.prev=c,c.next=c),c}function Us(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Nl(i,e,r){this.i=i,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Gl(i,e,r,o){for(var c=0,h=e,p=r-o;h<r;h+=o)c+=(i[p]-i[h])*(i[h+1]+i[p+1]),p=h;return c}function id(i,e,r,o,c){Yc(i,e,r||0,o||i.length-1,c||rd)}function Yc(i,e,r,o,c){for(;o>r;){if(o-r>600){var h=o-r+1,p=e-r+1,m=Math.log(h),g=.5*Math.exp(2*m/3),x=.5*Math.sqrt(m*g*(h-g)/h)*(p-h/2<0?-1:1);Yc(i,e,Math.max(r,Math.floor(e-p*g/h+x)),Math.min(o,Math.floor(e+(h-p)*g/h+x)),c)}var w=i[e],E=r,C=o;for($s(i,r,e),c(i[o],w)>0&&$s(i,r,o);E<C;){for($s(i,E,C),E++,C--;c(i[E],w)<0;)E++;for(;c(i[C],w)>0;)C--}c(i[r],w)===0?$s(i,r,C):$s(i,++C,o),C<=e&&(r=C+1),e<=C&&(o=C-1)}}function $s(i,e,r){var o=i[e];i[e]=i[r],i[r]=o}function rd(i,e){return i<e?-1:i>e?1:0}function ql(i,e){const r=i.length;if(r<=1)return[i];const o=[];let c,h;for(let p=0;p<r;p++){const m=Fi(i[p]);m!==0&&(i[p].area=Math.abs(m),h===void 0&&(h=m<0),h===m<0?(c&&o.push(c),c=[i[p]]):c.push(i[p]))}if(c&&o.push(c),e>1)for(let p=0;p<o.length;p++)o[p].length<=e||(id(o[p],e,1,o[p].length-1,nd),o[p]=o[p].slice(0,e));return o}function nd(i,e){return e.area-i.area}function Zl(i,e,r){const o=r.patternDependencies;let c=!1;for(const h of e){const p=h.paint.get(`${i}-pattern`);p.isConstant()||(c=!0);const m=p.constantOr(null);m&&(c=!0,o[m.to]=!0,o[m.from]=!0)}return c}function jl(i,e,r,o,c){const h=c.patternDependencies;for(const p of e){const m=p.paint.get(`${i}-pattern`).value;if(m.kind!=="constant"){let g=m.evaluate({zoom:o-1},r,{},c.availableImages),x=m.evaluate({zoom:o},r,{},c.availableImages),w=m.evaluate({zoom:o+1},r,{},c.availableImages);g=g&&g.name?g.name:g,x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,h[g]=!0,h[x]=!0,h[w]=!0,r.patterns[p.id]={min:g,mid:x,max:w}}}return r}qa.exports=Za,qa.exports.default=Za,Za.deviation=function(i,e,r,o){var c=e&&e.length,h=Math.abs(Gl(i,0,c?e[0]*r:i.length,r));if(c)for(var p=0,m=e.length;p<m;p++)h-=Math.abs(Gl(i,e[p]*r,p<m-1?e[p+1]*r:i.length,r));var g=0;for(p=0;p<o.length;p+=3){var x=o[p]*r,w=o[p+1]*r,E=o[p+2]*r;g+=Math.abs((i[x]-i[E])*(i[w+1]-i[x+1])-(i[x]-i[w])*(i[E+1]-i[x+1]))}return h===0&&g===0?0:Math.abs((g-h)/h)},Za.flatten=function(i){for(var e=i[0][0].length,r={vertices:[],holes:[],dimensions:e},o=0,c=0;c<i.length;c++){for(var h=0;h<i[c].length;h++)for(var p=0;p<e;p++)r.vertices.push(i[c][h][p]);c>0&&r.holes.push(o+=i[c-1].length)}return r};class Xl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Tt,this.indexArray=new vi,this.indexArray2=new yr,this.programConfigurations=new po(e.layers,e.zoom),this.segments=new nt,this.segments2=new nt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=Zl("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),h=!c.isConstant(),p=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,C=mo(m,E);if(!this.layers[0]._featureFilter.filter(new Ft(this.zoom),C,o))continue;const z=h?c.evaluate(C,{},o,r.availableImages):void 0,P={id:g,properties:m.properties,type:m.type,sourceLayerIndex:w,index:x,geometry:E?C.geometry:fo(m),patterns:{},sortKey:z};p.push(P)}h&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:x,sourceLayerIndex:w}=m;if(this.hasPattern){const E=jl("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,jh),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,r,o,c,h){for(const p of ql(r,500)){let m=0;for(const z of p)m+=z.length;const g=this.segments.prepareSegment(m,this.layoutVertexArray,this.indexArray),x=g.vertexLength,w=[],E=[];for(const z of p){if(z.length===0)continue;z!==p[0]&&E.push(w.length/2);const P=this.segments2.prepareSegment(z.length,this.layoutVertexArray,this.indexArray2),N=P.vertexLength;this.layoutVertexArray.emplaceBack(z[0].x,z[0].y),this.indexArray2.emplaceBack(N+z.length-1,N),w.push(z[0].x),w.push(z[0].y);for(let V=1;V<z.length;V++)this.layoutVertexArray.emplaceBack(z[V].x,z[V].y),this.indexArray2.emplaceBack(N+V-1,N+V),w.push(z[V].x),w.push(z[V].y);P.vertexLength+=z.length,P.primitiveLength+=z.length}const C=qa.exports(w,E);for(let z=0;z<C.length;z+=3)this.indexArray.emplaceBack(x+C[z],x+C[z+1],x+C[z+2]);g.vertexLength+=m,g.primitiveLength+=C.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}Fe("FillBucket",Xl,{omit:["layers","patternFeatures"]});const od=new si({"fill-sort-key":new je(de.layout_fill["fill-sort-key"])});var sd={paint:new si({"fill-antialias":new Ve(de.paint_fill["fill-antialias"]),"fill-opacity":new je(de.paint_fill["fill-opacity"]),"fill-color":new je(de.paint_fill["fill-color"]),"fill-outline-color":new je(de.paint_fill["fill-outline-color"]),"fill-translate":new Ve(de.paint_fill["fill-translate"]),"fill-translate-anchor":new Ve(de.paint_fill["fill-translate-anchor"]),"fill-pattern":new Pn(de.paint_fill["fill-pattern"])}),layout:od};const ad=jt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ld=jt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:cd}=ad;var Ln={},ud=We,Qc=Zo;function Zo(i,e,r,o,c){this.properties={},this.extent=r,this.type=0,this._pbf=i,this._geometry=-1,this._keys=o,this._values=c,i.readFields(hd,this,e)}function hd(i,e,r){i==1?e.id=r.readVarint():i==2?function(o,c){for(var h=o.readVarint()+o.pos;o.pos<h;){var p=c._keys[o.readVarint()],m=c._values[o.readVarint()];c.properties[p]=m}}(r,e):i==3?e.type=r.readVarint():i==4&&(e._geometry=r.pos)}function dd(i){for(var e,r,o=0,c=0,h=i.length,p=h-1;c<h;p=c++)o+=((r=i[p]).x-(e=i[c]).x)*(e.y+r.y);return o}Zo.types=["Unknown","Point","LineString","Polygon"],Zo.prototype.loadGeometry=function(){var i=this._pbf;i.pos=this._geometry;for(var e,r=i.readVarint()+i.pos,o=1,c=0,h=0,p=0,m=[];i.pos<r;){if(c<=0){var g=i.readVarint();o=7&g,c=g>>3}if(c--,o===1||o===2)h+=i.readSVarint(),p+=i.readSVarint(),o===1&&(e&&m.push(e),e=[]),e.push(new ud(h,p));else{if(o!==7)throw new Error("unknown command "+o);e&&e.push(e[0].clone())}}return e&&m.push(e),m},Zo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,r=1,o=0,c=0,h=0,p=1/0,m=-1/0,g=1/0,x=-1/0;i.pos<e;){if(o<=0){var w=i.readVarint();r=7&w,o=w>>3}if(o--,r===1||r===2)(c+=i.readSVarint())<p&&(p=c),c>m&&(m=c),(h+=i.readSVarint())<g&&(g=h),h>x&&(x=h);else if(r!==7)throw new Error("unknown command "+r)}return[p,g,m,x]},Zo.prototype.toGeoJSON=function(i,e,r){var o,c,h=this.extent*Math.pow(2,r),p=this.extent*i,m=this.extent*e,g=this.loadGeometry(),x=Zo.types[this.type];function w(z){for(var P=0;P<z.length;P++){var N=z[P];z[P]=[360*(N.x+p)/h-180,360/Math.PI*Math.atan(Math.exp((180-360*(N.y+m)/h)*Math.PI/180))-90]}}switch(this.type){case 1:var E=[];for(o=0;o<g.length;o++)E[o]=g[o][0];w(g=E);break;case 2:for(o=0;o<g.length;o++)w(g[o]);break;case 3:for(g=function(z){var P=z.length;if(P<=1)return[z];for(var N,V,ee=[],oe=0;oe<P;oe++){var Q=dd(z[oe]);Q!==0&&(V===void 0&&(V=Q<0),V===Q<0?(N&&ee.push(N),N=[z[oe]]):N.push(z[oe]))}return N&&ee.push(N),ee}(g),o=0;o<g.length;o++)for(c=0;c<g[o].length;c++)w(g[o][c])}g.length===1?g=g[0]:x="Multi"+x;var C={type:"Feature",geometry:{type:x,coordinates:g},properties:this.properties};return"id"in this&&(C.id=this.id),C};var pd=Qc,eu=tu;function tu(i,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(fd,this,e),this.length=this._features.length}function fd(i,e,r){i===15?e.version=r.readVarint():i===1?e.name=r.readString():i===5?e.extent=r.readVarint():i===2?e._features.push(r.pos):i===3?e._keys.push(r.readString()):i===4&&e._values.push(function(o){for(var c=null,h=o.readVarint()+o.pos;o.pos<h;){var p=o.readVarint()>>3;c=p===1?o.readString():p===2?o.readFloat():p===3?o.readDouble():p===4?o.readVarint64():p===5?o.readVarint():p===6?o.readSVarint():p===7?o.readBoolean():null}return c}(r))}tu.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new pd(this._pbf,e,this.extent,this._keys,this._values)};var md=eu;function gd(i,e,r){if(i===3){var o=new md(r,r.readVarint()+r.pos);o.length&&(e[o.name]=o)}}Ln.VectorTile=function(i,e){this.layers=i.readFields(gd,{},e)},Ln.VectorTileFeature=Qc,Ln.VectorTileLayer=eu;const _d=Ln.VectorTileFeature.types,Wl=Math.pow(2,13);function Vs(i,e,r,o,c,h,p,m){i.emplaceBack(e,r,2*Math.floor(o*Wl)+p,c*Wl*2,h*Wl*2,Math.round(m))}class Hl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new ut,this.centroidVertexArray=new Ge,this.indexArray=new vi,this.programConfigurations=new po(e.layers,e.zoom),this.segments=new nt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.features=[],this.hasPattern=Zl("fill-extrusion",this.layers,r);for(const{feature:c,id:h,index:p,sourceLayerIndex:m}of e){const g=this.layers[0]._featureFilter.needGeometry,x=mo(c,g);if(!this.layers[0]._featureFilter.filter(new Ft(this.zoom),x,o))continue;const w={id:h,sourceLayerIndex:m,index:p,geometry:g?x.geometry:fo(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(jl("fill-extrusion",this.layers,w,this.zoom,r)):this.addFeature(w,w.geometry,p,o,{}),r.featureIndex.insert(c,w.geometry,p,m,this.index,!0)}}addFeatures(e,r,o){for(const c of this.features){const{geometry:h}=c;this.addFeature(c,h,c.index,r,o)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,cd),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ld.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,r,o,c,h){const p={x:0,y:0,vertexCount:0};for(const m of ql(r,500)){let g=0;for(const P of m)g+=P.length;let x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const P of m){if(P.length===0||xd(P))continue;let N=0;for(let V=0;V<P.length;V++){const ee=P[V];if(V>=1){const oe=P[V-1];if(!yd(ee,oe)){x.vertexLength+4>nt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Q=ee.sub(oe)._perp()._unit(),re=oe.dist(ee);N+re>32768&&(N=0),Vs(this.layoutVertexArray,ee.x,ee.y,Q.x,Q.y,0,0,N),Vs(this.layoutVertexArray,ee.x,ee.y,Q.x,Q.y,0,1,N),p.x+=2*ee.x,p.y+=2*ee.y,p.vertexCount+=2,N+=re,Vs(this.layoutVertexArray,oe.x,oe.y,Q.x,Q.y,0,0,N),Vs(this.layoutVertexArray,oe.x,oe.y,Q.x,Q.y,0,1,N),p.x+=2*oe.x,p.y+=2*oe.y,p.vertexCount+=2;const me=x.vertexLength;this.indexArray.emplaceBack(me,me+2,me+1),this.indexArray.emplaceBack(me+1,me+2,me+3),x.vertexLength+=4,x.primitiveLength+=2}}}}if(x.vertexLength+g>nt.MAX_VERTEX_ARRAY_LENGTH&&(x=this.segments.prepareSegment(g,this.layoutVertexArray,this.indexArray)),_d[e.type]!=="Polygon")continue;const w=[],E=[],C=x.vertexLength;for(const P of m)if(P.length!==0){P!==m[0]&&E.push(w.length/2);for(let N=0;N<P.length;N++){const V=P[N];Vs(this.layoutVertexArray,V.x,V.y,0,0,1,1,0),p.x+=V.x,p.y+=V.y,p.vertexCount+=1,w.push(V.x),w.push(V.y)}}const z=qa.exports(w,E);for(let P=0;P<z.length;P+=3)this.indexArray.emplaceBack(C+z[P],C+z[P+2],C+z[P+1]);x.primitiveLength+=z.length/3,x.vertexLength+=g}for(let m=0;m<p.vertexCount;m++)this.centroidVertexArray.emplaceBack(Math.floor(p.x/p.vertexCount),Math.floor(p.y/p.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}}function yd(i,e){return i.x===e.x&&(i.x<0||i.x>Kt)||i.y===e.y&&(i.y<0||i.y>Kt)}function xd(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Kt)||i.every(e=>e.y<0)||i.every(e=>e.y>Kt)}Fe("FillExtrusionBucket",Hl,{omit:["layers","features"]});var vd={paint:new si({"fill-extrusion-opacity":new Ve(de["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new je(de["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ve(de["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ve(de["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Pn(de["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new je(de["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new je(de["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ve(de["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Ns(i,e){return i.x*e.x+i.y*e.y}function iu(i,e){if(i.length===1){let r=0;const o=e[r++];let c;for(;!c||o.equals(c);)if(c=e[r++],!c)return 1/0;for(;r<e.length;r++){const h=e[r],p=i[0],m=c.sub(o),g=h.sub(o),x=p.sub(o),w=Ns(m,m),E=Ns(m,g),C=Ns(g,g),z=Ns(x,m),P=Ns(x,g),N=w*C-E*E,V=(C*z-E*P)/N,ee=(w*P-E*z)/N,oe=o.z*(1-V-ee)+c.z*V+h.z*ee;if(isFinite(oe))return oe}return 1/0}{let r=1/0;for(const o of e)r=Math.min(r,o.z);return r}}const bd=jt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:wd}=bd,Td=jt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Ed}=Td,Sd=Ln.VectorTileFeature.types,Id=Math.cos(Math.PI/180*37.5),ru=Math.pow(2,14)/.5;class Kl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(r=>r.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new mt,this.layoutVertexArray2=new St,this.indexArray=new vi,this.programConfigurations=new po(e.layers,e.zoom),this.segments=new nt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,o){this.hasPattern=Zl("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),h=!c.isConstant(),p=[];for(const{feature:m,id:g,index:x,sourceLayerIndex:w}of e){const E=this.layers[0]._featureFilter.needGeometry,C=mo(m,E);if(!this.layers[0]._featureFilter.filter(new Ft(this.zoom),C,o))continue;const z=h?c.evaluate(C,{},o):void 0,P={id:g,properties:m.properties,type:m.type,sourceLayerIndex:w,index:x,geometry:E?C.geometry:fo(m),patterns:{},sortKey:z};p.push(P)}h&&p.sort((m,g)=>m.sortKey-g.sortKey);for(const m of p){const{geometry:g,index:x,sourceLayerIndex:w}=m;if(this.hasPattern){const E=jl("line",this.layers,m,this.zoom,r);this.patternFeatures.push(E)}else this.addFeature(m,g,x,o,{});r.featureIndex.insert(e[x].feature,g,x,w,this.index)}}update(e,r,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,r,this.stateDependentLayers,o)}addFeatures(e,r,o){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,o)}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,Ed)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,wd),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,r,o,c,h){const p=this.layers[0].layout,m=p.get("line-join").evaluate(e,{}),g=p.get("line-cap"),x=p.get("line-miter-limit"),w=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of r)this.addLine(E,e,m,g,x,w);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,c)}addLine(e,r,o,c,h,p){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ee=0;ee<e.length-1;ee++)this.totalDistance+=e[ee].dist(e[ee+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=Sd[r.type]==="Polygon";let g=e.length;for(;g>=2&&e[g-1].equals(e[g-2]);)g--;let x=0;for(;x<g-1&&e[x].equals(e[x+1]);)x++;if(g<(m?3:2))return;o==="bevel"&&(h=1.05);const w=this.overscaling<=16?122880/(512*this.overscaling):0,E=this.segments.prepareSegment(10*g,this.layoutVertexArray,this.indexArray);let C,z,P,N,V;this.e1=this.e2=-1,m&&(C=e[g-2],V=e[x].sub(C)._unit()._perp());for(let ee=x;ee<g;ee++){if(P=ee===g-1?m?e[x+1]:void 0:e[ee+1],P&&e[ee].equals(P))continue;V&&(N=V),C&&(z=C),C=e[ee],V=P?P.sub(C)._unit()._perp():N,N=N||V;let oe=N.add(V);oe.x===0&&oe.y===0||oe._unit();const Q=N.x*V.x+N.y*V.y,re=oe.x*V.x+oe.y*V.y,me=re!==0?1/re:1/0,fe=2*Math.sqrt(2-2*re),Be=re<Id&&z&&P,Ue=N.x*V.y-N.y*V.x>0;if(Be&&ee>x){const Te=C.dist(z);if(Te>2*w){const ke=C.sub(C.sub(z)._mult(w/Te)._round());this.updateDistance(z,ke),this.addCurrentVertex(ke,N,0,0,E),z=ke}}const Pe=z&&P;let Ie=Pe?o:m?"butt":c;if(Pe&&Ie==="round"&&(me<p?Ie="miter":me<=2&&(Ie="fakeround")),Ie==="miter"&&me>h&&(Ie="bevel"),Ie==="bevel"&&(me>2&&(Ie="flipbevel"),me<h&&(Ie="miter")),z&&this.updateDistance(z,C),Ie==="miter")oe._mult(me),this.addCurrentVertex(C,oe,0,0,E);else if(Ie==="flipbevel"){if(me>100)oe=V.mult(-1);else{const Te=me*N.add(V).mag()/N.sub(V).mag();oe._perp()._mult(Te*(Ue?-1:1))}this.addCurrentVertex(C,oe,0,0,E),this.addCurrentVertex(C,oe.mult(-1),0,0,E)}else if(Ie==="bevel"||Ie==="fakeround"){const Te=-Math.sqrt(me*me-1),ke=Ue?Te:0,Ae=Ue?0:Te;if(z&&this.addCurrentVertex(C,N,ke,Ae,E),Ie==="fakeround"){const be=Math.round(180*fe/Math.PI/20);for(let qe=1;qe<be;qe++){let Ne=qe/be;if(Ne!==.5){const kt=Ne-.5;Ne+=Ne*kt*(Ne-1)*((1.0904+Q*(Q*(3.55645-1.43519*Q)-3.2452))*kt*kt+(.848013+Q*(.215638*Q-1.06021)))}const rt=V.sub(N)._mult(Ne)._add(N)._unit()._mult(Ue?-1:1);this.addHalfVertex(C,rt.x,rt.y,!1,Ue,0,E)}}P&&this.addCurrentVertex(C,V,-ke,-Ae,E)}else if(Ie==="butt")this.addCurrentVertex(C,oe,0,0,E);else if(Ie==="square"){const Te=z?1:-1;this.addCurrentVertex(C,oe,Te,Te,E)}else Ie==="round"&&(z&&(this.addCurrentVertex(C,N,0,0,E),this.addCurrentVertex(C,N,1,1,E,!0)),P&&(this.addCurrentVertex(C,V,-1,-1,E,!0),this.addCurrentVertex(C,V,0,0,E)));if(Be&&ee<g-1){const Te=C.dist(P);if(Te>2*w){const ke=C.add(P.sub(C)._mult(w/Te)._round());this.updateDistance(C,ke),this.addCurrentVertex(ke,V,0,0,E),C=ke}}}}addCurrentVertex(e,r,o,c,h,p=!1){const m=r.y*c-r.x,g=-r.y-r.x*c;this.addHalfVertex(e,r.x+r.y*o,r.y-r.x*o,p,!1,o,h),this.addHalfVertex(e,m,g,p,!0,-c,h),this.distance>ru/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,r,o,c,h,p))}addHalfVertex({x:e,y:r},o,c,h,p,m,g){const x=.5*(this.lineClips?this.scaledDistance*(ru-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(r<<1)+(p?1:0),Math.round(63*o)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&x)<<2,x>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const w=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,w),g.primitiveLength++),p?this.e2=w:this.e1=w}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,r){this.distance+=e.dist(r),this.updateScaledDistance()}}Fe("LineBucket",Kl,{omit:["layers","patternFeatures"]});const Cd=new si({"line-cap":new Ve(de.layout_line["line-cap"]),"line-join":new je(de.layout_line["line-join"]),"line-miter-limit":new Ve(de.layout_line["line-miter-limit"]),"line-round-limit":new Ve(de.layout_line["line-round-limit"]),"line-sort-key":new je(de.layout_line["line-sort-key"])});var nu={paint:new si({"line-opacity":new je(de.paint_line["line-opacity"]),"line-color":new je(de.paint_line["line-color"]),"line-translate":new Ve(de.paint_line["line-translate"]),"line-translate-anchor":new Ve(de.paint_line["line-translate-anchor"]),"line-width":new je(de.paint_line["line-width"]),"line-gap-width":new je(de.paint_line["line-gap-width"]),"line-offset":new je(de.paint_line["line-offset"]),"line-blur":new je(de.paint_line["line-blur"]),"line-dasharray":new Ms(de.paint_line["line-dasharray"]),"line-pattern":new Pn(de.paint_line["line-pattern"]),"line-gradient":new Br(de.paint_line["line-gradient"])}),layout:Cd};const ou=new class extends je{possiblyEvaluate(i,e){return e=new Ft(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,r,o){return e=st({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,r,o)}}(nu.paint.properties["line-width"].specification);function su(i,e){return e>0?e+2*i:i}ou.useIntegerZoom=!0;const Ad=jt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Md=jt([{name:"a_projected_pos",components:3,type:"Float32"}],4);jt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const zd=jt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);jt([{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 au=jt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Pd=jt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function kd(i,e,r){return i.sections.forEach(o=>{o.text=function(c,h,p){const m=h.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),Ui.applyArabicShaping&&(c=Ui.applyArabicShaping(c)),c}(o.text,e,r)}),i}jt([{name:"triangle",components:3,type:"Uint16"}]),jt([{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"}]),jt([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),jt([{type:"Float32",name:"offsetX"}]),jt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Gs={"!":"\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","\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"};var ai=24,Jl=At,lu=function(i,e,r,o,c){var h,p,m=8*c-o-1,g=(1<<m)-1,x=g>>1,w=-7,E=r?c-1:0,C=r?-1:1,z=i[e+E];for(E+=C,h=z&(1<<-w)-1,z>>=-w,w+=m;w>0;h=256*h+i[e+E],E+=C,w-=8);for(p=h&(1<<-w)-1,h>>=-w,w+=o;w>0;p=256*p+i[e+E],E+=C,w-=8);if(h===0)h=1-x;else{if(h===g)return p?NaN:1/0*(z?-1:1);p+=Math.pow(2,o),h-=x}return(z?-1:1)*p*Math.pow(2,h-o)},cu=function(i,e,r,o,c,h){var p,m,g,x=8*h-c-1,w=(1<<x)-1,E=w>>1,C=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,z=o?0:h-1,P=o?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(m=isNaN(e)?1:0,p=w):(p=Math.floor(Math.log(e)/Math.LN2),e*(g=Math.pow(2,-p))<1&&(p--,g*=2),(e+=p+E>=1?C/g:C*Math.pow(2,1-E))*g>=2&&(p++,g/=2),p+E>=w?(m=0,p=w):p+E>=1?(m=(e*g-1)*Math.pow(2,c),p+=E):(m=e*Math.pow(2,E-1)*Math.pow(2,c),p=0));c>=8;i[r+z]=255&m,z+=P,m/=256,c-=8);for(p=p<<c|m,x+=c;x>0;i[r+z]=255&p,z+=P,p/=256,x-=8);i[r+z-P]|=128*N};function At(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}At.Varint=0,At.Fixed64=1,At.Bytes=2,At.Fixed32=5;var Rn,Yl=4294967296,uu=1/Yl,hu=typeof TextDecoder=="undefined"?null:new TextDecoder("utf8");function nn(i){return i.type===At.Bytes?i.readVarint()+i.pos:i.pos+1}function jo(i,e,r){return r?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function du(i,e,r){var o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(o);for(var c=r.pos-1;c>=i;c--)r.buf[c+o]=r.buf[c]}function Dd(i,e){for(var r=0;r<i.length;r++)e.writeVarint(i[r])}function Ld(i,e){for(var r=0;r<i.length;r++)e.writeSVarint(i[r])}function Rd(i,e){for(var r=0;r<i.length;r++)e.writeFloat(i[r])}function Bd(i,e){for(var r=0;r<i.length;r++)e.writeDouble(i[r])}function Fd(i,e){for(var r=0;r<i.length;r++)e.writeBoolean(i[r])}function Od(i,e){for(var r=0;r<i.length;r++)e.writeFixed32(i[r])}function Ud(i,e){for(var r=0;r<i.length;r++)e.writeSFixed32(i[r])}function $d(i,e){for(var r=0;r<i.length;r++)e.writeFixed64(i[r])}function Vd(i,e){for(var r=0;r<i.length;r++)e.writeSFixed64(i[r])}function Ha(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+16777216*i[e+3]}function Xo(i,e,r){i[r]=e,i[r+1]=e>>>8,i[r+2]=e>>>16,i[r+3]=e>>>24}function pu(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function Nd(i,e,r){i===1&&r.readMessage(Gd,e)}function Gd(i,e,r){if(i===3){const{id:o,bitmap:c,width:h,height:p,left:m,top:g,advance:x}=r.readMessage(qd,{});e.push({id:o,bitmap:new Bs({width:h+6,height:p+6},c),metrics:{width:h,height:p,left:m,top:g,advance:x}})}}function qd(i,e,r){i===1?e.id=r.readVarint():i===2?e.bitmap=r.readBytes():i===3?e.width=r.readVarint():i===4?e.height=r.readVarint():i===5?e.left=r.readSVarint():i===6?e.top=r.readSVarint():i===7&&(e.advance=r.readVarint())}function fu(i){let e=0,r=0;for(const p of i)e+=p.w*p.h,r=Math.max(r,p.w);i.sort((p,m)=>m.h-p.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let c=0,h=0;for(const p of i)for(let m=o.length-1;m>=0;m--){const g=o[m];if(!(p.w>g.w||p.h>g.h)){if(p.x=g.x,p.y=g.y,h=Math.max(h,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===g.w&&p.h===g.h){const x=o.pop();m<o.length&&(o[m]=x)}else p.h===g.h?(g.x+=p.w,g.w-=p.w):p.w===g.w?(g.y+=p.h,g.h-=p.h):(o.push({x:g.x+p.w,y:g.y,w:g.w-p.w,h:p.h}),g.y+=p.h,g.h-=p.h);break}}return{w:c,h,fill:e/(c*h)||0}}At.prototype={destroy:function(){this.buf=null},readFields:function(i,e,r){for(r=r||this.length;this.pos<r;){var o=this.readVarint(),c=o>>3,h=this.pos;this.type=7&o,i(c,e,this),this.pos===h&&this.skip(o)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=Ha(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=pu(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=Ha(this.buf,this.pos)+Ha(this.buf,this.pos+4)*Yl;return this.pos+=8,i},readSFixed64:function(){var i=Ha(this.buf,this.pos)+pu(this.buf,this.pos+4)*Yl;return this.pos+=8,i},readFloat:function(){var i=lu(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=lu(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,r,o=this.buf;return e=127&(r=o[this.pos++]),r<128?e:(e|=(127&(r=o[this.pos++]))<<7,r<128?e:(e|=(127&(r=o[this.pos++]))<<14,r<128?e:(e|=(127&(r=o[this.pos++]))<<21,r<128?e:function(c,h,p){var m,g,x=p.buf;if(m=(112&(g=x[p.pos++]))>>4,g<128||(m|=(127&(g=x[p.pos++]))<<3,g<128)||(m|=(127&(g=x[p.pos++]))<<10,g<128)||(m|=(127&(g=x[p.pos++]))<<17,g<128)||(m|=(127&(g=x[p.pos++]))<<24,g<128)||(m|=(1&(g=x[p.pos++]))<<31,g<128))return jo(c,m,h);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=o[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&hu?function(r,o,c){return hu.decode(r.subarray(o,c))}(this.buf,e,i):function(r,o,c){for(var h="",p=o;p<c;){var m,g,x,w=r[p],E=null,C=w>239?4:w>223?3:w>191?2:1;if(p+C>c)break;C===1?w<128&&(E=w):C===2?(192&(m=r[p+1]))==128&&(E=(31&w)<<6|63&m)<=127&&(E=null):C===3?(g=r[p+2],(192&(m=r[p+1]))==128&&(192&g)==128&&((E=(15&w)<<12|(63&m)<<6|63&g)<=2047||E>=55296&&E<=57343)&&(E=null)):C===4&&(g=r[p+2],x=r[p+3],(192&(m=r[p+1]))==128&&(192&g)==128&&(192&x)==128&&((E=(15&w)<<18|(63&m)<<12|(63&g)<<6|63&x)<=65535||E>=1114112)&&(E=null)),E===null?(E=65533,C=1):E>65535&&(E-=65536,h+=String.fromCharCode(E>>>10&1023|55296),E=56320|1023&E),h+=String.fromCharCode(E),p+=C}return h}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==At.Bytes)return i.push(this.readVarint(e));var r=nn(this);for(i=i||[];this.pos<r;)i.push(this.readVarint(e));return i},readPackedSVarint:function(i){if(this.type!==At.Bytes)return i.push(this.readSVarint());var e=nn(this);for(i=i||[];this.pos<e;)i.push(this.readSVarint());return i},readPackedBoolean:function(i){if(this.type!==At.Bytes)return i.push(this.readBoolean());var e=nn(this);for(i=i||[];this.pos<e;)i.push(this.readBoolean());return i},readPackedFloat:function(i){if(this.type!==At.Bytes)return i.push(this.readFloat());var e=nn(this);for(i=i||[];this.pos<e;)i.push(this.readFloat());return i},readPackedDouble:function(i){if(this.type!==At.Bytes)return i.push(this.readDouble());var e=nn(this);for(i=i||[];this.pos<e;)i.push(this.readDouble());return i},readPackedFixed32:function(i){if(this.type!==At.Bytes)return i.push(this.readFixed32());var e=nn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed32());return i},readPackedSFixed32:function(i){if(this.type!==At.Bytes)return i.push(this.readSFixed32());var e=nn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed32());return i},readPackedFixed64:function(i){if(this.type!==At.Bytes)return i.push(this.readFixed64());var e=nn(this);for(i=i||[];this.pos<e;)i.push(this.readFixed64());return i},readPackedSFixed64:function(i){if(this.type!==At.Bytes)return i.push(this.readSFixed64());var e=nn(this);for(i=i||[];this.pos<e;)i.push(this.readSFixed64());return i},skip:function(i){var e=7&i;if(e===At.Varint)for(;this.buf[this.pos++]>127;);else if(e===At.Bytes)this.pos=this.readVarint()+this.pos;else if(e===At.Fixed32)this.pos+=4;else{if(e!==At.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e<this.pos+i;)e*=2;if(e!==this.length){var r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(i){this.realloc(4),Xo(this.buf,i,this.pos),this.pos+=4},writeSFixed32:function(i){this.realloc(4),Xo(this.buf,i,this.pos),this.pos+=4},writeFixed64:function(i){this.realloc(8),Xo(this.buf,-1&i,this.pos),Xo(this.buf,Math.floor(i*uu),this.pos+4),this.pos+=8},writeSFixed64:function(i){this.realloc(8),Xo(this.buf,-1&i,this.pos),Xo(this.buf,Math.floor(i*uu),this.pos+4),this.pos+=8},writeVarint:function(i){(i=+i||0)>268435455||i<0?function(e,r){var o,c;if(e>=0?(o=e%4294967296|0,c=e/4294967296|0):(c=~(-e/4294967296),4294967295^(o=~(-e%4294967296))?o=o+1|0:(o=0,c=c+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");r.realloc(10),function(h,p,m){m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,h>>>=7,m.buf[m.pos++]=127&h|128,m.buf[m.pos]=127&(h>>>=7)}(o,0,r),function(h,p){var m=(7&h)<<4;p.buf[p.pos++]|=m|((h>>>=3)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h|((h>>>=7)?128:0),h&&(p.buf[p.pos++]=127&h)))))}(c,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(Boolean(i))},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(o,c,h){for(var p,m,g=0;g<c.length;g++){if((p=c.charCodeAt(g))>55295&&p<57344){if(!m){p>56319||g+1===c.length?(o[h++]=239,o[h++]=191,o[h++]=189):m=p;continue}if(p<56320){o[h++]=239,o[h++]=191,o[h++]=189,m=p;continue}p=m-55296<<10|p-56320|65536,m=null}else m&&(o[h++]=239,o[h++]=191,o[h++]=189,m=null);p<128?o[h++]=p:(p<2048?o[h++]=p>>6|192:(p<65536?o[h++]=p>>12|224:(o[h++]=p>>18|240,o[h++]=p>>12&63|128),o[h++]=p>>6&63|128),o[h++]=63&p|128)}return h}(this.buf,i,this.pos);var r=this.pos-e;r>=128&&du(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(i){this.realloc(4),cu(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),cu(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=i[r]},writeRawMessage:function(i,e){this.pos++;var r=this.pos;i(e,this);var o=this.pos-r;o>=128&&du(r,o,this),this.pos=r-1,this.writeVarint(o),this.pos+=o},writeMessage:function(i,e,r){this.writeTag(i,At.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,Dd,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,Ld,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,Fd,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,Rd,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,Bd,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,Od,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,Ud,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,$d,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,Vd,e)},writeBytesField:function(i,e){this.writeTag(i,At.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,At.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,At.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,At.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,At.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,At.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,At.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,At.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,At.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,At.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,Boolean(e))}};class Ql{constructor(e,{pixelRatio:r,version:o,stretchX:c,stretchY:h,content:p}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=c,this.stretchY=h,this.content=p,this.version=o}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]}}class mu{constructor(e,r){const o={},c={};this.haveRenderCallbacks=[];const h=[];this.addImages(e,o,h),this.addImages(r,c,h);const{w:p,h:m}=fu(h),g=new Wi({width:p||1,height:m||1});for(const x in e){const w=e[x],E=o[x].paddedRect;Wi.copy(w.data,g,{x:0,y:0},{x:E.x+1,y:E.y+1},w.data)}for(const x in r){const w=r[x],E=c[x].paddedRect,C=E.x+1,z=E.y+1,P=w.data.width,N=w.data.height;Wi.copy(w.data,g,{x:0,y:0},{x:C,y:z},w.data),Wi.copy(w.data,g,{x:0,y:N-1},{x:C,y:z-1},{width:P,height:1}),Wi.copy(w.data,g,{x:0,y:0},{x:C,y:z+N},{width:P,height:1}),Wi.copy(w.data,g,{x:P-1,y:0},{x:C-1,y:z},{width:1,height:N}),Wi.copy(w.data,g,{x:0,y:0},{x:C+P,y:z},{width:1,height:N})}this.image=g,this.iconPositions=o,this.patternPositions=c}addImages(e,r,o){for(const c in e){const h=e[c],p={x:0,y:0,w:h.data.width+2,h:h.data.height+2};o.push(p),r[c]=new Ql(p,h),h.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(e,r){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const o in e.updatedImages)this.patchUpdatedImage(this.iconPositions[o],e.getImage(o),r),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o),r)}patchUpdatedImage(e,r,o){if(!e||!r||e.version===r.version)return;e.version=r.version;const[c,h]=e.tl;o.update(r.data,void 0,{x:c,y:h})}}Fe("ImagePosition",Ql),Fe("ImageAtlas",mu),l.WritingMode=void 0,(Rn=l.WritingMode||(l.WritingMode={}))[Rn.none=0]="none",Rn[Rn.horizontal=1]="horizontal",Rn[Rn.vertical=2]="vertical",Rn[Rn.horizontalOnly=3]="horizontalOnly";const Ka=-17;class qs{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){const o=new qs;return o.scale=e||1,o.fontStack=r,o}static forImage(e){const r=new qs;return r.imageName=e,r}}class Wo{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,r){const o=new Wo;for(let c=0;c<e.sections.length;c++){const h=e.sections[c];h.image?o.addImageSection(h):o.addTextSection(h,r)}return o}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}getCharCode(e){return this.text.charCodeAt(e)}verticalizePunctuation(){this.text=function(e){let r="";for(let o=0;o<e.length;o++){const c=e.charCodeAt(o+1)||null,h=e.charCodeAt(o-1)||null;r+=c&&za(c)&&!Gs[e[o+1]]||h&&za(h)&&!Gs[e[o-1]]||!Gs[e[o]]?e[o]:Gs[e[o]]}return r}(this.text)}trim(){let e=0;for(let o=0;o<this.text.length&&Ya[this.text.charCodeAt(o)];o++)e++;let r=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&Ya[this.text.charCodeAt(o)];o--)r--;this.text=this.text.substring(e,r),this.sectionIndex=this.sectionIndex.slice(e,r)}substring(e,r){const o=new Wo;return o.text=this.text.substring(e,r),o.sectionIndex=this.sectionIndex.slice(e,r),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}addTextSection(e,r){this.text+=e.text,this.sections.push(qs.forText(e.scale,e.fontStack||r));const o=this.sections.length-1;for(let c=0;c<e.text.length;++c)this.sectionIndex.push(o)}addImageSection(e){const r=e.image?e.image.name:"";if(r.length===0)return void Vt("Can't add FormattedSection with an empty image.");const o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCharCode(o),this.sections.push(qs.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Vt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Ja(i,e,r,o,c,h,p,m,g,x,w,E,C,z,P,N){const V=Wo.fromFeature(i,c);let ee;E===l.WritingMode.vertical&&V.verticalizePunctuation();const{processBidirectionalText:oe,processStyledBidirectionalText:Q}=Ui;if(oe&&V.sections.length===1){ee=[];const fe=oe(V.toString(),ec(V,x,h,e,o,z,P));for(const Be of fe){const Ue=new Wo;Ue.text=Be,Ue.sections=V.sections;for(let Pe=0;Pe<Be.length;Pe++)Ue.sectionIndex.push(0);ee.push(Ue)}}else if(Q){ee=[];const fe=Q(V.text,V.sectionIndex,ec(V,x,h,e,o,z,P));for(const Be of fe){const Ue=new Wo;Ue.text=Be[0],Ue.sectionIndex=Be[1],Ue.sections=V.sections,ee.push(Ue)}}else ee=function(fe,Be){const Ue=[],Pe=fe.text;let Ie=0;for(const Te of Be)Ue.push(fe.substring(Ie,Te)),Ie=Te;return Ie<Pe.length&&Ue.push(fe.substring(Ie,Pe.length)),Ue}(V,ec(V,x,h,e,o,z,P));const re=[],me={positionedLines:re,text:V.toString(),top:w[1],bottom:w[1],left:w[0],right:w[0],writingMode:E,iconsInText:!1,verticalizable:!1};return function(fe,Be,Ue,Pe,Ie,Te,ke,Ae,be,qe,Ne,rt){let kt=0,Ut=Ka,Jt=0,Ki=0;const ci=Ae==="right"?1:Ae==="left"?0:.5;let Xt=0;for(const Wt of Ie){Wt.trim();const hi=Wt.getMaxScale(),mi=(hi-1)*ai,Ti={positionedGlyphs:[],lineOffset:0};fe.positionedLines[Xt]=Ti;const Di=Ti.positionedGlyphs;let Li=0;if(!Wt.length()){Ut+=Te,++Xt;continue}for(let ni=0;ni<Wt.length();ni++){const ot=Wt.getSection(ni),Ni=Wt.getSectionIndex(ni),di=Wt.getCharCode(ni);let gi=0,or=null,vr=null,br=null,sn=ai;const sr=!(be===l.WritingMode.horizontal||!Ne&&!Ts(di)||Ne&&(Ya[di]||(ri=di,ze.Arabic(ri)||ze["Arabic Supplement"](ri)||ze["Arabic Extended-A"](ri)||ze["Arabic Presentation Forms-A"](ri)||ze["Arabic Presentation Forms-B"](ri))));if(ot.imageName){const Ji=Pe[ot.imageName];if(!Ji)continue;br=ot.imageName,fe.iconsInText=fe.iconsInText||!0,vr=Ji.paddedRect;const Ri=Ji.displaySize;ot.scale=ot.scale*ai/rt,or={width:Ri[0],height:Ri[1],left:1,top:-3,advance:sr?Ri[1]:Ri[0]},gi=mi+(ai-Ri[1]*ot.scale),sn=or.advance;const an=sr?Ri[0]*ot.scale-ai*hi:Ri[1]*ot.scale-ai*hi;an>0&&an>Li&&(Li=an)}else{const Ji=Ue[ot.fontStack],Ri=Ji&&Ji[di];if(Ri&&Ri.rect)vr=Ri.rect,or=Ri.metrics;else{const an=Be[ot.fontStack],Xs=an&&an[di];if(!Xs)continue;or=Xs.metrics}gi=(hi-ot.scale)*ai}sr?(fe.verticalizable=!0,Di.push({glyph:di,imageName:br,x:kt,y:Ut+gi,vertical:sr,scale:ot.scale,fontStack:ot.fontStack,sectionIndex:Ni,metrics:or,rect:vr}),kt+=sn*ot.scale+qe):(Di.push({glyph:di,imageName:br,x:kt,y:Ut+gi,vertical:sr,scale:ot.scale,fontStack:ot.fontStack,sectionIndex:Ni,metrics:or,rect:vr}),kt+=or.advance*ot.scale+qe)}Di.length!==0&&(Jt=Math.max(kt-qe,Jt),Xd(Di,0,Di.length-1,ci,Li)),kt=0;const $t=Te*hi+Li;Ti.lineOffset=Math.max(Li,mi),Ut+=$t,Ki=Math.max($t,Ki),++Xt}var ri;const ui=Ut-Ka,{horizontalAlign:fi,verticalAlign:ki}=tc(ke);(function(Wt,hi,mi,Ti,Di,Li,$t,ni,ot){const Ni=(hi-mi)*Di;let di=0;di=Li!==$t?-ni*Ti-Ka:(-Ti*ot+.5)*$t;for(const gi of Wt)for(const or of gi.positionedGlyphs)or.x+=Ni,or.y+=di})(fe.positionedLines,ci,fi,ki,Jt,Ki,Te,ui,Ie.length),fe.top+=-ki*ui,fe.bottom=fe.top+ui,fe.left+=-fi*Jt,fe.right=fe.left+Jt}(me,e,r,o,ee,p,m,g,E,x,C,N),!function(fe){for(const Be of fe)if(Be.positionedGlyphs.length!==0)return!1;return!0}(re)&&me}const Ya={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Zd={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function gu(i,e,r,o,c,h){if(e.imageName){const p=o[e.imageName];return p?p.displaySize[0]*e.scale*ai/h+c:0}{const p=r[e.fontStack],m=p&&p[i];return m?m.metrics.advance*e.scale+c:0}}function _u(i,e,r,o){const c=Math.pow(i-e,2);return o?i<e?c/2:2*c:c+Math.abs(r)*r}function jd(i,e,r){let o=0;return i===10&&(o-=1e4),r&&(o+=150),i!==40&&i!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function yu(i,e,r,o,c,h){let p=null,m=_u(e,r,c,h);for(const g of o){const x=_u(e-g.x,r,c,h)+g.badness;x<=m&&(p=g,m=x)}return{index:i,x:e,priorBreak:p,badness:m}}function xu(i){return i?xu(i.priorBreak).concat(i.index):[]}function ec(i,e,r,o,c,h,p){if(h!=="point")return[];if(!i)return[];const m=[],g=function(C,z,P,N,V,ee){let oe=0;for(let Q=0;Q<C.length();Q++){const re=C.getSection(Q);oe+=gu(C.getCharCode(Q),re,N,V,z,ee)}return oe/Math.max(1,Math.ceil(oe/P))}(i,e,r,o,c,p),x=i.text.indexOf("\u200B")>=0;let w=0;for(let C=0;C<i.length();C++){const z=i.getSection(C),P=i.getCharCode(C);if(Ya[P]||(w+=gu(P,z,o,c,e,p)),C<i.length()-1){const N=!((E=P)<11904||!(ze["Bopomofo Extended"](E)||ze.Bopomofo(E)||ze["CJK Compatibility Forms"](E)||ze["CJK Compatibility Ideographs"](E)||ze["CJK Compatibility"](E)||ze["CJK Radicals Supplement"](E)||ze["CJK Strokes"](E)||ze["CJK Symbols and Punctuation"](E)||ze["CJK Unified Ideographs Extension A"](E)||ze["CJK Unified Ideographs"](E)||ze["Enclosed CJK Letters and Months"](E)||ze["Halfwidth and Fullwidth Forms"](E)||ze.Hiragana(E)||ze["Ideographic Description Characters"](E)||ze["Kangxi Radicals"](E)||ze["Katakana Phonetic Extensions"](E)||ze.Katakana(E)||ze["Vertical Forms"](E)||ze["Yi Radicals"](E)||ze["Yi Syllables"](E)));(Zd[P]||N||z.imageName)&&m.push(yu(C+1,w,g,m,jd(P,i.getCharCode(C+1),N&&x),!1))}}var E;return xu(yu(i.length(),w,g,m,0,!0))}function tc(i){let e=.5,r=.5;switch(i){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Xd(i,e,r,o,c){if(!o&&!c)return;const h=i[r],p=(i[r].x+h.metrics.advance*h.scale)*o;for(let m=e;m<=r;m++)i[m].x-=p,i[m].y+=c}function Wd(i,e,r){const{horizontalAlign:o,verticalAlign:c}=tc(r),h=e[0]-i.displaySize[0]*o,p=e[1]-i.displaySize[1]*c;return{image:i,top:p,bottom:p+i.displaySize[1],left:h,right:h+i.displaySize[0]}}function vu(i,e,r,o,c,h){const p=i.image;let m;if(p.content){const V=p.content,ee=p.pixelRatio||1;m=[V[0]/ee,V[1]/ee,p.displaySize[0]-V[2]/ee,p.displaySize[1]-V[3]/ee]}const g=e.left*h,x=e.right*h;let w,E,C,z;r==="width"||r==="both"?(z=c[0]+g-o[3],E=c[0]+x+o[1]):(z=c[0]+(g+x-p.displaySize[0])/2,E=z+p.displaySize[0]);const P=e.top*h,N=e.bottom*h;return r==="height"||r==="both"?(w=c[1]+P-o[0],C=c[1]+N+o[2]):(w=c[1]+(P+N-p.displaySize[1])/2,C=w+p.displaySize[1]),{image:p,top:w,right:E,bottom:C,left:z,collisionPadding:m}}const on=128;function bu(i,e){const{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Ft(i+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:o,interpolationType:c}=r;let h=0;for(;h<o.length&&o[h]<=i;)h++;h=Math.max(0,h-1);let p=h;for(;p<o.length&&o[p]<i+1;)p++;p=Math.min(o.length-1,p);const m=o[h],g=o[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:g,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:g,minSize:r.evaluate(new Ft(m)),maxSize:r.evaluate(new Ft(g)),interpolationType:c}}}class Bn extends We{constructor(e,r,o,c){super(e,r),this.angle=o,c!==void 0&&(this.segment=c)}clone(){return new Bn(this.x,this.y,this.angle,this.segment)}}function wu(i,e,r,o,c){if(e.segment===void 0)return!0;let h=e,p=e.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=i[p].dist(h),h=i[p]}m+=i[p].dist(i[p+1]),p++;const g=[];let x=0;for(;m<r/2;){const w=i[p],E=i[p+1];if(!E)return!1;let C=i[p-1].angleTo(w)-w.angleTo(E);for(C=Math.abs((C+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:m,angleDelta:C}),x+=C;m-g[0].distance>o;)x-=g.shift().angleDelta;if(x>c)return!1;p++,m+=w.dist(E)}return!0}function Tu(i){let e=0;for(let r=0;r<i.length-1;r++)e+=i[r].dist(i[r+1]);return e}function Eu(i,e,r){return i?.6*e*r:0}function Su(i,e){return Math.max(i?i.right-i.left:0,e?e.right-e.left:0)}function Hd(i,e,r,o,c,h){const p=Eu(r,c,h),m=Su(r,o)*h;let g=0;const x=Tu(i)/2;for(let w=0;w<i.length-1;w++){const E=i[w],C=i[w+1],z=E.dist(C);if(g+z>x){const P=(x-g)/z,N=Rt(E.x,C.x,P),V=Rt(E.y,C.y,P),ee=new Bn(N,V,C.angleTo(E),w);return ee._round(),!p||wu(i,ee,m,p,e)?ee:void 0}g+=z}}function Kd(i,e,r,o,c,h,p,m,g){const x=Eu(o,h,p),w=Su(o,c),E=w*p,C=i[0].x===0||i[0].x===g||i[0].y===0||i[0].y===g;return e-E<e/4&&(e=E+e/4),Iu(i,C?e/2*m%e:(w/2+2*h)*p*m%e,e,x,r,E,C,!1,g)}function Iu(i,e,r,o,c,h,p,m,g){const x=h/2,w=Tu(i);let E=0,C=e-r,z=[];for(let P=0;P<i.length-1;P++){const N=i[P],V=i[P+1],ee=N.dist(V),oe=V.angleTo(N);for(;C+r<E+ee;){C+=r;const Q=(C-E)/ee,re=Rt(N.x,V.x,Q),me=Rt(N.y,V.y,Q);if(re>=0&&re<g&&me>=0&&me<g&&C-x>=0&&C+x<=w){const fe=new Bn(re,me,oe,P);fe._round(),o&&!wu(i,fe,h,o,c)||z.push(fe)}}E+=ee}return m||z.length||p||(z=Iu(i,E/2,r,o,c,h,p,!0,g)),z}function Cu(i,e,r,o,c){const h=[];for(let p=0;p<i.length;p++){const m=i[p];let g;for(let x=0;x<m.length-1;x++){let w=m[x],E=m[x+1];w.x<e&&E.x<e||(w.x<e?w=new We(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x<e&&(E=new We(e,w.y+(e-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y<r&&E.y<r||(w.y<r?w=new We(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round():E.y<r&&(E=new We(w.x+(r-w.y)/(E.y-w.y)*(E.x-w.x),r)._round()),w.x>=o&&E.x>=o||(w.x>=o?w=new We(o,w.y+(o-w.x)/(E.x-w.x)*(E.y-w.y))._round():E.x>=o&&(E=new We(o,w.y+(o-w.x)/(E.x-w.x)*(E.y-w.y))._round()),w.y>=c&&E.y>=c||(w.y>=c?w=new We(w.x+(c-w.y)/(E.y-w.y)*(E.x-w.x),c)._round():E.y>=c&&(E=new We(w.x+(c-w.y)/(E.y-w.y)*(E.x-w.x),c)._round()),g&&w.equals(g[g.length-1])||(g=[w],h.push(g)),g.push(E)))))}}return h}function Au(i,e,r,o){const c=[],h=i.image,p=h.pixelRatio,m=h.paddedRect.w-2,g=h.paddedRect.h-2,x=i.right-i.left,w=i.bottom-i.top,E=h.stretchX||[[0,m]],C=h.stretchY||[[0,g]],z=(Te,ke)=>Te+ke[1]-ke[0],P=E.reduce(z,0),N=C.reduce(z,0),V=m-P,ee=g-N;let oe=0,Q=P,re=0,me=N,fe=0,Be=V,Ue=0,Pe=ee;if(h.content&&o){const Te=h.content;oe=Qa(E,0,Te[0]),re=Qa(C,0,Te[1]),Q=Qa(E,Te[0],Te[2]),me=Qa(C,Te[1],Te[3]),fe=Te[0]-oe,Ue=Te[1]-re,Be=Te[2]-Te[0]-Q,Pe=Te[3]-Te[1]-me}const Ie=(Te,ke,Ae,be)=>{const qe=el(Te.stretch-oe,Q,x,i.left),Ne=tl(Te.fixed-fe,Be,Te.stretch,P),rt=el(ke.stretch-re,me,w,i.top),kt=tl(ke.fixed-Ue,Pe,ke.stretch,N),Ut=el(Ae.stretch-oe,Q,x,i.left),Jt=tl(Ae.fixed-fe,Be,Ae.stretch,P),Ki=el(be.stretch-re,me,w,i.top),ci=tl(be.fixed-Ue,Pe,be.stretch,N),Xt=new We(qe,rt),ri=new We(Ut,rt),ui=new We(Ut,Ki),fi=new We(qe,Ki),ki=new We(Ne/p,kt/p),Wt=new We(Jt/p,ci/p),hi=e*Math.PI/180;if(hi){const Di=Math.sin(hi),Li=Math.cos(hi),$t=[Li,-Di,Di,Li];Xt._matMult($t),ri._matMult($t),fi._matMult($t),ui._matMult($t)}const mi=Te.stretch+Te.fixed,Ti=ke.stretch+ke.fixed;return{tl:Xt,tr:ri,bl:fi,br:ui,tex:{x:h.paddedRect.x+1+mi,y:h.paddedRect.y+1+Ti,w:Ae.stretch+Ae.fixed-mi,h:be.stretch+be.fixed-Ti},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ki,pixelOffsetBR:Wt,minFontScaleX:Be/p/x,minFontScaleY:Pe/p/w,isSDF:r}};if(o&&(h.stretchX||h.stretchY)){const Te=Mu(E,V,P),ke=Mu(C,ee,N);for(let Ae=0;Ae<Te.length-1;Ae++){const be=Te[Ae],qe=Te[Ae+1];for(let Ne=0;Ne<ke.length-1;Ne++)c.push(Ie(be,ke[Ne],qe,ke[Ne+1]))}}else c.push(Ie({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:g+1}));return c}function Qa(i,e,r){let o=0;for(const c of i)o+=Math.max(e,Math.min(r,c[1]))-Math.max(e,Math.min(r,c[0]));return o}function Mu(i,e,r){const o=[{fixed:-1,stretch:0}];for(const[c,h]of i){const p=o[o.length-1];o.push({fixed:c-p.stretch,stretch:p.stretch}),o.push({fixed:c-p.stretch,stretch:p.stretch+(h-c)})}return o.push({fixed:e+1,stretch:r}),o}function el(i,e,r,o){return i/e*r+o}function tl(i,e,r,o){return i-e*r/o}Fe("Anchor",Bn);class il{constructor(e,r,o,c,h,p,m,g,x,w){if(this.boxStartIndex=e.length,x){let E=p.top,C=p.bottom;const z=p.collisionPadding;z&&(E-=z[1],C+=z[3]);let P=C-E;P>0&&(P=Math.max(10,P),this.circleDiameter=P)}else{let E=p.top*m-g[0],C=p.bottom*m+g[2],z=p.left*m-g[3],P=p.right*m+g[1];const N=p.collisionPadding;if(N&&(z-=N[0]*m,E-=N[1]*m,P+=N[2]*m,C+=N[3]*m),w){const V=new We(z,E),ee=new We(P,E),oe=new We(z,C),Q=new We(P,C),re=w*Math.PI/180;V._rotate(re),ee._rotate(re),oe._rotate(re),Q._rotate(re),z=Math.min(V.x,ee.x,oe.x,Q.x),P=Math.max(V.x,ee.x,oe.x,Q.x),E=Math.min(V.y,ee.y,oe.y,Q.y),C=Math.max(V.y,ee.y,oe.y,Q.y)}e.emplaceBack(r.x,r.y,z,E,P,C,o,c,h)}this.boxEndIndex=e.length}}class Jd{constructor(e=[],r=Yd){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:r,compare:o}=this,c=r[e];for(;e>0;){const h=e-1>>1,p=r[h];if(o(c,p)>=0)break;r[e]=p,e=h}r[e]=c}_down(e){const{data:r,compare:o}=this,c=this.length>>1,h=r[e];for(;e<c;){let p=1+(e<<1),m=r[p];const g=p+1;if(g<this.length&&o(r[g],m)<0&&(p=g,m=r[g]),o(m,h)>=0)break;r[e]=m,e=p}r[e]=h}}function Yd(i,e){return i<e?-1:i>e?1:0}function Qd(i,e=1,r=!1){let o=1/0,c=1/0,h=-1/0,p=-1/0;const m=i[0];for(let z=0;z<m.length;z++){const P=m[z];(!z||P.x<o)&&(o=P.x),(!z||P.y<c)&&(c=P.y),(!z||P.x>h)&&(h=P.x),(!z||P.y>p)&&(p=P.y)}const g=Math.min(h-o,p-c);let x=g/2;const w=new Jd([],ep);if(g===0)return new We(o,c);for(let z=o;z<h;z+=g)for(let P=c;P<p;P+=g)w.push(new Ho(z+x,P+x,x,i));let E=function(z){let P=0,N=0,V=0;const ee=z[0];for(let oe=0,Q=ee.length,re=Q-1;oe<Q;re=oe++){const me=ee[oe],fe=ee[re],Be=me.x*fe.y-fe.x*me.y;N+=(me.x+fe.x)*Be,V+=(me.y+fe.y)*Be,P+=3*Be}return new Ho(N/P,V/P,0,z)}(i),C=w.length;for(;w.length;){const z=w.pop();(z.d>E.d||!E.d)&&(E=z,r&&console.log("found best %d after %d probes",Math.round(1e4*z.d)/1e4,C)),z.max-E.d<=e||(x=z.h/2,w.push(new Ho(z.p.x-x,z.p.y-x,x,i)),w.push(new Ho(z.p.x+x,z.p.y-x,x,i)),w.push(new Ho(z.p.x-x,z.p.y+x,x,i)),w.push(new Ho(z.p.x+x,z.p.y+x,x,i)),C+=4)}return r&&(console.log(`num probes: ${C}`),console.log(`best distance: ${E.d}`)),E.p}function ep(i,e){return e.max-i.max}function Ho(i,e,r,o){this.p=new We(i,e),this.h=r,this.d=function(c,h){let p=!1,m=1/0;for(let g=0;g<h.length;g++){const x=h[g];for(let w=0,E=x.length,C=E-1;w<E;C=w++){const z=x[w],P=x[C];z.y>c.y!=P.y>c.y&&c.x<(P.x-z.x)*(c.y-z.y)/(P.y-z.y)+z.x&&(p=!p),m=Math.min(m,Fc(c,z,P))}}return(p?1:-1)*Math.sqrt(m)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}const ic=Number.POSITIVE_INFINITY;function zu(i,e){return e[1]!==ic?function(r,o,c){let h=0,p=0;switch(o=Math.abs(o),c=Math.abs(c),r){case"top-right":case"top-left":case"top":p=c-7;break;case"bottom-right":case"bottom-left":case"bottom":p=7-c}switch(r){case"top-right":case"bottom-right":case"right":h=-o;break;case"top-left":case"bottom-left":case"left":h=o}return[h,p]}(i,e[0],e[1]):function(r,o){let c=0,h=0;o<0&&(o=0);const p=o/Math.sqrt(2);switch(r){case"top-right":case"top-left":h=p-7;break;case"bottom-right":case"bottom-left":h=7-p;break;case"bottom":h=7-o;break;case"top":h=o-7}switch(r){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=o;break;case"right":c=-o}return[c,h]}(i,e[0])}function rc(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function tp(i,e,r,o,c,h,p,m,g,x,w){let E=h.textMaxSize.evaluate(e,{});E===void 0&&(E=p);const C=i.layers[0].layout,z=C.get("icon-offset").evaluate(e,{},w),P=ku(r.horizontal),N=p/24,V=i.tilePixelRatio*N,ee=i.tilePixelRatio*E/24,oe=i.tilePixelRatio*m,Q=i.tilePixelRatio*C.get("symbol-spacing"),re=C.get("text-padding")*i.tilePixelRatio,me=function(be,qe,Ne,rt=1){const kt=be.get("icon-padding").evaluate(qe,{},Ne),Ut=kt&&kt.values;return[Ut[0]*rt,Ut[1]*rt,Ut[2]*rt,Ut[3]*rt]}(C,e,w,i.tilePixelRatio),fe=C.get("text-max-angle")/180*Math.PI,Be=C.get("text-rotation-alignment")!=="viewport"&&C.get("symbol-placement")!=="point",Ue=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",Pe=C.get("symbol-placement"),Ie=Q/2,Te=C.get("icon-text-fit");let ke;o&&Te!=="none"&&(i.allowVerticalPlacement&&r.vertical&&(ke=vu(o,r.vertical,Te,C.get("icon-text-fit-padding"),z,N)),P&&(o=vu(o,P,Te,C.get("icon-text-fit-padding"),z,N)));const Ae=(be,qe)=>{qe.x<0||qe.x>=Kt||qe.y<0||qe.y>=Kt||function(Ne,rt,kt,Ut,Jt,Ki,ci,Xt,ri,ui,fi,ki,Wt,hi,mi,Ti,Di,Li,$t,ni,ot,Ni,di,gi,or){const vr=Ne.addToLineVertexArray(rt,kt);let br,sn,sr,Ji,Ri=0,an=0,Xs=0,Wu=0,pc=-1,fc=-1;const ln={};let Hu=ii.exports(""),mc=0,gc=0;if(Xt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[mc,gc]=Xt.layout.get("text-offset").evaluate(ot,{},gi).map(Bi=>Bi*ai):(mc=Xt.layout.get("text-radial-offset").evaluate(ot,{},gi)*ai,gc=ic),Ne.allowVerticalPlacement&&Ut.vertical){const Bi=Xt.layout.get("text-rotate").evaluate(ot,{},gi)+90;sr=new il(ri,rt,ui,fi,ki,Ut.vertical,Wt,hi,mi,Bi),ci&&(Ji=new il(ri,rt,ui,fi,ki,ci,Di,Li,mi,Bi))}if(Jt){const Bi=Xt.layout.get("icon-rotate").evaluate(ot,{}),Vr=Xt.layout.get("icon-text-fit")!=="none",Ws=Au(Jt,Bi,di,Vr),Hs=ci?Au(ci,Bi,di,Vr):void 0;sn=new il(ri,rt,ui,fi,ki,Jt,Di,Li,!1,Bi),Ri=4*Ws.length;const Yu=Ne.iconSizeData;let yo=null;Yu.kind==="source"?(yo=[on*Xt.layout.get("icon-size").evaluate(ot,{})],yo[0]>Fn&&Vt(`${Ne.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Yu.kind==="composite"&&(yo=[on*Ni.compositeIconSizes[0].evaluate(ot,{},gi),on*Ni.compositeIconSizes[1].evaluate(ot,{},gi)],(yo[0]>Fn||yo[1]>Fn)&&Vt(`${Ne.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Ne.addSymbols(Ne.icon,Ws,yo,ni,$t,ot,l.WritingMode.none,rt,vr.lineStartIndex,vr.lineLength,-1,gi),pc=Ne.icon.placedSymbolArray.length-1,Hs&&(an=4*Hs.length,Ne.addSymbols(Ne.icon,Hs,yo,ni,$t,ot,l.WritingMode.vertical,rt,vr.lineStartIndex,vr.lineLength,-1,gi),fc=Ne.icon.placedSymbolArray.length-1)}const Ku=Object.keys(Ut.horizontal);for(const Bi of Ku){const Vr=Ut.horizontal[Bi];if(!br){Hu=ii.exports(Vr.text);const Hs=Xt.layout.get("text-rotate").evaluate(ot,{},gi);br=new il(ri,rt,ui,fi,ki,Vr,Wt,hi,mi,Hs)}const Ws=Vr.positionedLines.length===1;if(Xs+=Pu(Ne,rt,Vr,Ki,Xt,mi,ot,Ti,vr,Ut.vertical?l.WritingMode.horizontal:l.WritingMode.horizontalOnly,Ws?Ku:[Bi],ln,pc,Ni,gi),Ws)break}Ut.vertical&&(Wu+=Pu(Ne,rt,Ut.vertical,Ki,Xt,mi,ot,Ti,vr,l.WritingMode.vertical,["vertical"],ln,fc,Ni,gi));const fp=br?br.boxStartIndex:Ne.collisionBoxArray.length,mp=br?br.boxEndIndex:Ne.collisionBoxArray.length,gp=sr?sr.boxStartIndex:Ne.collisionBoxArray.length,_p=sr?sr.boxEndIndex:Ne.collisionBoxArray.length,yp=sn?sn.boxStartIndex:Ne.collisionBoxArray.length,xp=sn?sn.boxEndIndex:Ne.collisionBoxArray.length,vp=Ji?Ji.boxStartIndex:Ne.collisionBoxArray.length,bp=Ji?Ji.boxEndIndex:Ne.collisionBoxArray.length;let wr=-1;const al=(Bi,Vr)=>Bi&&Bi.circleDiameter?Math.max(Bi.circleDiameter,Vr):Vr;wr=al(br,wr),wr=al(sr,wr),wr=al(sn,wr),wr=al(Ji,wr);const Ju=wr>-1?1:0;Ju&&(wr*=or/ai),Ne.glyphOffsetArray.length>=Ko.MAX_GLYPHS&&Vt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ot.sortKey!==void 0&&Ne.addToSortKeyRanges(Ne.symbolInstances.length,ot.sortKey),Ne.symbolInstances.emplaceBack(rt.x,rt.y,ln.right>=0?ln.right:-1,ln.center>=0?ln.center:-1,ln.left>=0?ln.left:-1,ln.vertical||-1,pc,fc,Hu,fp,mp,gp,_p,yp,xp,vp,bp,ui,Xs,Wu,Ri,an,Ju,0,Wt,mc,gc,wr)}(i,qe,be,r,o,c,ke,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,V,[re,re,re,re],Be,g,oe,me,Ue,z,e,h,x,w,p)};if(Pe==="line")for(const be of Cu(e.geometry,0,0,Kt,Kt)){const qe=Kd(be,Q,fe,r.vertical||P,o,24,ee,i.overscaling,Kt);for(const Ne of qe){const rt=P;rt&&ip(i,rt.text,Ie,Ne)||Ae(be,Ne)}}else if(Pe==="line-center"){for(const be of e.geometry)if(be.length>1){const qe=Hd(be,fe,r.vertical||P,o,24,ee);qe&&Ae(be,qe)}}else if(e.type==="Polygon")for(const be of ql(e.geometry,0)){const qe=Qd(be,16);Ae(be[0],new Bn(qe.x,qe.y,0))}else if(e.type==="LineString")for(const be of e.geometry)Ae(be,new Bn(be[0].x,be[0].y,0));else if(e.type==="Point")for(const be of e.geometry)for(const qe of be)Ae([qe],new Bn(qe.x,qe.y,0))}const Fn=32640;function Pu(i,e,r,o,c,h,p,m,g,x,w,E,C,z,P){const N=function(oe,Q,re,me,fe,Be,Ue,Pe){const Ie=me.layout.get("text-rotate").evaluate(Be,{})*Math.PI/180,Te=[];for(const ke of Q.positionedLines)for(const Ae of ke.positionedGlyphs){if(!Ae.rect)continue;const be=Ae.rect||{};let qe=4,Ne=!0,rt=1,kt=0;const Ut=(fe||Pe)&&Ae.vertical,Jt=Ae.metrics.advance*Ae.scale/2;if(Pe&&Q.verticalizable){const $t=(Ae.scale-1)*ai,ni=(ai-Ae.metrics.width*Ae.scale)/2;kt=ke.lineOffset/2-(Ae.imageName?-ni:$t)}if(Ae.imageName){const $t=Ue[Ae.imageName];Ne=$t.sdf,rt=$t.pixelRatio,qe=1/rt}const Ki=fe?[Ae.x+Jt,Ae.y]:[0,0];let ci=fe?[0,0]:[Ae.x+Jt+re[0],Ae.y+re[1]-kt],Xt=[0,0];Ut&&(Xt=ci,ci=[0,0]);const ri=(Ae.metrics.left-qe)*Ae.scale-Jt+ci[0],ui=(-Ae.metrics.top-qe)*Ae.scale+ci[1],fi=ri+be.w*Ae.scale/rt,ki=ui+be.h*Ae.scale/rt,Wt=new We(ri,ui),hi=new We(fi,ui),mi=new We(ri,ki),Ti=new We(fi,ki);if(Ut){const $t=new We(-Jt,Jt-Ka),ni=-Math.PI/2,ot=12-Jt,Ni=new We(22-ot,-(Ae.imageName?ot:0)),di=new We(...Xt);Wt._rotateAround(ni,$t)._add(Ni)._add(di),hi._rotateAround(ni,$t)._add(Ni)._add(di),mi._rotateAround(ni,$t)._add(Ni)._add(di),Ti._rotateAround(ni,$t)._add(Ni)._add(di)}if(Ie){const $t=Math.sin(Ie),ni=Math.cos(Ie),ot=[ni,-$t,$t,ni];Wt._matMult(ot),hi._matMult(ot),mi._matMult(ot),Ti._matMult(ot)}const Di=new We(0,0),Li=new We(0,0);Te.push({tl:Wt,tr:hi,bl:mi,br:Ti,tex:be,writingMode:Q.writingMode,glyphOffset:Ki,sectionIndex:Ae.sectionIndex,isSDF:Ne,pixelOffsetTL:Di,pixelOffsetBR:Li,minFontScaleX:0,minFontScaleY:0})}return Te}(0,r,m,c,h,p,o,i.allowVerticalPlacement),V=i.textSizeData;let ee=null;V.kind==="source"?(ee=[on*c.layout.get("text-size").evaluate(p,{})],ee[0]>Fn&&Vt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):V.kind==="composite"&&(ee=[on*z.compositeTextSizes[0].evaluate(p,{},P),on*z.compositeTextSizes[1].evaluate(p,{},P)],(ee[0]>Fn||ee[1]>Fn)&&Vt(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,N,ee,m,h,p,x,e,g.lineStartIndex,g.lineLength,C,P);for(const oe of w)E[oe]=i.text.placedSymbolArray.length-1;return 4*N.length}function ku(i){for(const e in i)return i[e];return null}function ip(i,e,r,o){const c=i.compareText;if(e in c){const h=c[e];for(let p=h.length-1;p>=0;p--)if(o.dist(h[p])<r)return!0}else c[e]=[];return c[e].push(o),!1}const rp=Ln.VectorTileFeature.types,np=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function rl(i,e,r,o,c,h,p,m,g,x,w,E,C){const z=m?Math.min(Fn,Math.round(m[0])):0,P=m?Math.min(Fn,Math.round(m[1])):0;i.emplaceBack(e,r,Math.round(32*o),Math.round(32*c),h,p,(z<<1)+(g?1:0),P,16*x,16*w,256*E,256*C)}function nc(i,e,r){i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r),i.emplaceBack(e.x,e.y,r)}function op(i){for(const e of i.sections)if(ka(e.text))return!0;return!1}class oc{constructor(e){this.layoutVertexArray=new rr,this.indexArray=new vi,this.programConfigurations=e,this.segments=new nt,this.dynamicLayoutVertexArray=new Xi,this.opacityVertexArray=new nr,this.placedSymbolArray=new ve}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,o,c){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ad.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Md.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,np,!0),this.opacityVertexBuffer.itemSize=1),(o||c)&&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())}}Fe("SymbolBuffers",oc);class sc{constructor(e,r,o){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new o,this.segments=new nt,this.collisionVertexArray=new $i}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,zd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Fe("CollisionBuffers",sc);class Ko{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(p=>p.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Ol([]),this.placementViewportMatrix=Ol([]);const r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=bu(this.zoom,r["text-size"]),this.iconSizeData=bu(this.zoom,r["icon-size"]);const o=this.layers[0].layout,c=o.get("symbol-sort-key"),h=o.get("symbol-z-order");this.canOverlap=lc(o,"text-overlap","text-allow-overlap")!=="never"||lc(o,"icon-overlap","icon-allow-overlap")!=="never"||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,o.get("symbol-placement")==="point"&&(this.writingModes=o.get("text-writing-mode").map(p=>l.WritingMode[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=e.sourceID}createArrays(){this.text=new oc(new po(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new oc(new po(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Se,this.lineVertexArray=new Re,this.symbolInstances=new Le}calculateGlyphDependencies(e,r,o,c,h){for(let p=0;p<e.length;p++)if(r[e.charCodeAt(p)]=!0,(o||c)&&h){const m=Gs[e.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(e,r,o){const c=this.layers[0],h=c.layout,p=h.get("text-font"),m=h.get("text-field"),g=h.get("icon-image"),x=(m.value.kind!=="constant"||m.value.value instanceof W&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),w=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,E=h.get("symbol-sort-key");if(this.features=[],!x&&!w)return;const C=r.iconDependencies,z=r.glyphDependencies,P=r.availableImages,N=new Ft(this.zoom);for(const{feature:V,id:ee,index:oe,sourceLayerIndex:Q}of e){const re=c._featureFilter.needGeometry,me=mo(V,re);if(!c._featureFilter.filter(N,me,o))continue;let fe,Be;if(re||(me.geometry=fo(V)),x){const Pe=c.getValueAndResolveTokens("text-field",me,o,P),Ie=W.factory(Pe);op(Ie)&&(this.hasRTLText=!0),(!this.hasRTLText||co()==="unavailable"||this.hasRTLText&&Ui.isParsed())&&(fe=kd(Ie,c,me))}if(w){const Pe=c.getValueAndResolveTokens("icon-image",me,o,P);Be=Pe instanceof J?Pe:J.fromString(Pe)}if(!fe&&!Be)continue;const Ue=this.sortFeaturesByKey?E.evaluate(me,{},o):void 0;if(this.features.push({id:ee,text:fe,icon:Be,index:oe,sourceLayerIndex:Q,geometry:me.geometry,properties:V.properties,type:rp[V.type],sortKey:Ue}),Be&&(C[Be.name]=!0),fe){const Pe=p.evaluate(me,{},o).join(","),Ie=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(l.WritingMode.vertical)>=0;for(const Te of fe.sections)if(Te.image)C[Te.image.name]=!0;else{const ke=Oo(fe.toString()),Ae=Te.fontStack||Pe,be=z[Ae]=z[Ae]||{};this.calculateGlyphDependencies(Te.text,be,Ie,this.allowVerticalPlacement,ke)}}}h.get("symbol-placement")==="line"&&(this.features=function(V){const ee={},oe={},Q=[];let re=0;function me(Pe){Q.push(V[Pe]),re++}function fe(Pe,Ie,Te){const ke=oe[Pe];return delete oe[Pe],oe[Ie]=ke,Q[ke].geometry[0].pop(),Q[ke].geometry[0]=Q[ke].geometry[0].concat(Te[0]),ke}function Be(Pe,Ie,Te){const ke=ee[Ie];return delete ee[Ie],ee[Pe]=ke,Q[ke].geometry[0].shift(),Q[ke].geometry[0]=Te[0].concat(Q[ke].geometry[0]),ke}function Ue(Pe,Ie,Te){const ke=Te?Ie[0][Ie[0].length-1]:Ie[0][0];return`${Pe}:${ke.x}:${ke.y}`}for(let Pe=0;Pe<V.length;Pe++){const Ie=V[Pe],Te=Ie.geometry,ke=Ie.text?Ie.text.toString():null;if(!ke){me(Pe);continue}const Ae=Ue(ke,Te),be=Ue(ke,Te,!0);if(Ae in oe&&be in ee&&oe[Ae]!==ee[be]){const qe=Be(Ae,be,Te),Ne=fe(Ae,be,Q[qe].geometry);delete ee[Ae],delete oe[be],oe[Ue(ke,Q[Ne].geometry,!0)]=Ne,Q[qe].geometry=null}else Ae in oe?fe(Ae,be,Te):be in ee?Be(Ae,be,Te):(me(Pe),ee[Ae]=re-1,oe[be]=re-1)}return Q.filter(Pe=>Pe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((V,ee)=>V.sortKey-ee.sortKey)}update(e,r,o){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,r,this.layers,o),this.icon.programConfigurations.updatePaintArrays(e,r,this.layers,o))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}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=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,r){const o=this.lineVertexArray.length;if(e.segment!==void 0){let c=e.dist(r[e.segment+1]),h=e.dist(r[e.segment]);const p={};for(let m=e.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=e.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:h},m>0&&(h+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const g=p[m];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,r,o,c,h,p,m,g,x,w,E,C){const z=e.indexArray,P=e.layoutVertexArray,N=e.segments.prepareSegment(4*r.length,P,z,this.canOverlap?p.sortKey:void 0),V=this.glyphOffsetArray.length,ee=N.vertexLength,oe=this.allowVerticalPlacement&&m===l.WritingMode.vertical?Math.PI/2:0,Q=p.text&&p.text.sections;for(let re=0;re<r.length;re++){const{tl:me,tr:fe,bl:Be,br:Ue,tex:Pe,pixelOffsetTL:Ie,pixelOffsetBR:Te,minFontScaleX:ke,minFontScaleY:Ae,glyphOffset:be,isSDF:qe,sectionIndex:Ne}=r[re],rt=N.vertexLength,kt=be[1];rl(P,g.x,g.y,me.x,kt+me.y,Pe.x,Pe.y,o,qe,Ie.x,Ie.y,ke,Ae),rl(P,g.x,g.y,fe.x,kt+fe.y,Pe.x+Pe.w,Pe.y,o,qe,Te.x,Ie.y,ke,Ae),rl(P,g.x,g.y,Be.x,kt+Be.y,Pe.x,Pe.y+Pe.h,o,qe,Ie.x,Te.y,ke,Ae),rl(P,g.x,g.y,Ue.x,kt+Ue.y,Pe.x+Pe.w,Pe.y+Pe.h,o,qe,Te.x,Te.y,ke,Ae),nc(e.dynamicLayoutVertexArray,g,oe),z.emplaceBack(rt,rt+1,rt+2),z.emplaceBack(rt+1,rt+2,rt+3),N.vertexLength+=4,N.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(be[0]),re!==r.length-1&&Ne===r[re+1].sectionIndex||e.programConfigurations.populatePaintArrays(P.length,p,p.index,{},C,Q&&Q[Ne])}e.placedSymbolArray.emplaceBack(g.x,g.y,V,this.glyphOffsetArray.length-V,ee,x,w,g.segment,o?o[0]:0,o?o[1]:0,c[0],c[1],m,0,!1,0,E)}_addCollisionDebugVertex(e,r,o,c,h,p){return r.emplaceBack(0,0),e.emplaceBack(o.x,o.y,c,h,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(e,r,o,c,h,p,m){const g=h.segments.prepareSegment(4,h.layoutVertexArray,h.indexArray),x=g.vertexLength,w=h.layoutVertexArray,E=h.collisionVertexArray,C=m.anchorX,z=m.anchorY;this._addCollisionDebugVertex(w,E,p,C,z,new We(e,r)),this._addCollisionDebugVertex(w,E,p,C,z,new We(o,r)),this._addCollisionDebugVertex(w,E,p,C,z,new We(o,c)),this._addCollisionDebugVertex(w,E,p,C,z,new We(e,c)),g.vertexLength+=4;const P=h.indexArray;P.emplaceBack(x,x+1),P.emplaceBack(x+1,x+2),P.emplaceBack(x+2,x+3),P.emplaceBack(x+3,x),g.primitiveLength+=4}addDebugCollisionBoxes(e,r,o,c){for(let h=e;h<r;h++){const p=this.collisionBoxArray.get(h);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,o)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new sc(Ur,au.members,yr),this.iconCollisionBox=new sc(Ur,au.members,yr);for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(e,r,o,c,h,p,m,g,x){const w={};for(let E=r;E<o;E++){const C=e.get(E);w.textBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.textFeatureIndex=C.featureIndex;break}for(let E=c;E<h;E++){const C=e.get(E);w.verticalTextBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.verticalTextFeatureIndex=C.featureIndex;break}for(let E=p;E<m;E++){const C=e.get(E);w.iconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.iconFeatureIndex=C.featureIndex;break}for(let E=g;E<x;E++){const C=e.get(E);w.verticalIconBox={x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,anchorPointX:C.anchorPointX,anchorPointY:C.anchorPointY},w.verticalIconFeatureIndex=C.featureIndex;break}return w}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const o=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.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,r){const o=e.placedSymbolArray.get(r),c=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;h<c;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const r=Math.sin(e),o=Math.cos(e),c=[],h=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const g=this.symbolInstances.get(m);c.push(0|Math.round(r*g.anchorX+o*g.anchorY)),h.push(g.featureIndex)}return p.sort((m,g)=>c[m]-c[g]||h[g]-h[m]),p}addToSortKeyRanges(e,r){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===r?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:r,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(const r of this.symbolInstanceIndexes){const o=this.symbolInstances.get(r);this.featureSortOrder.push(o.featureIndex),[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((c,h,p)=>{c>=0&&p.indexOf(c)===h&&this.addIndicesForPlacedSymbol(this.text,c)}),o.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,o.verticalPlacedTextSymbolIndex),o.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.placedIconSymbolIndex),o.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,o.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Fe("SymbolBucket",Ko,{omit:["layers","collisionBoxArray","features","compareText"]}),Ko.MAX_GLYPHS=65535,Ko.addDynamicAttributes=nc;const sp=new si({"symbol-placement":new Ve(de.layout_symbol["symbol-placement"]),"symbol-spacing":new Ve(de.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ve(de.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new je(de.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ve(de.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ve(de.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ve(de.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ve(de.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ve(de.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ve(de.layout_symbol["icon-rotation-alignment"]),"icon-size":new je(de.layout_symbol["icon-size"]),"icon-text-fit":new Ve(de.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ve(de.layout_symbol["icon-text-fit-padding"]),"icon-image":new je(de.layout_symbol["icon-image"]),"icon-rotate":new je(de.layout_symbol["icon-rotate"]),"icon-padding":new je(de.layout_symbol["icon-padding"]),"icon-keep-upright":new Ve(de.layout_symbol["icon-keep-upright"]),"icon-offset":new je(de.layout_symbol["icon-offset"]),"icon-anchor":new je(de.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ve(de.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ve(de.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ve(de.layout_symbol["text-rotation-alignment"]),"text-field":new je(de.layout_symbol["text-field"]),"text-font":new je(de.layout_symbol["text-font"]),"text-size":new je(de.layout_symbol["text-size"]),"text-max-width":new je(de.layout_symbol["text-max-width"]),"text-line-height":new Ve(de.layout_symbol["text-line-height"]),"text-letter-spacing":new je(de.layout_symbol["text-letter-spacing"]),"text-justify":new je(de.layout_symbol["text-justify"]),"text-radial-offset":new je(de.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ve(de.layout_symbol["text-variable-anchor"]),"text-anchor":new je(de.layout_symbol["text-anchor"]),"text-max-angle":new Ve(de.layout_symbol["text-max-angle"]),"text-writing-mode":new Ve(de.layout_symbol["text-writing-mode"]),"text-rotate":new je(de.layout_symbol["text-rotate"]),"text-padding":new Ve(de.layout_symbol["text-padding"]),"text-keep-upright":new Ve(de.layout_symbol["text-keep-upright"]),"text-transform":new je(de.layout_symbol["text-transform"]),"text-offset":new je(de.layout_symbol["text-offset"]),"text-allow-overlap":new Ve(de.layout_symbol["text-allow-overlap"]),"text-overlap":new Ve(de.layout_symbol["text-overlap"]),"text-ignore-placement":new Ve(de.layout_symbol["text-ignore-placement"]),"text-optional":new Ve(de.layout_symbol["text-optional"])});var ac={paint:new si({"icon-opacity":new je(de.paint_symbol["icon-opacity"]),"icon-color":new je(de.paint_symbol["icon-color"]),"icon-halo-color":new je(de.paint_symbol["icon-halo-color"]),"icon-halo-width":new je(de.paint_symbol["icon-halo-width"]),"icon-halo-blur":new je(de.paint_symbol["icon-halo-blur"]),"icon-translate":new Ve(de.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ve(de.paint_symbol["icon-translate-anchor"]),"text-opacity":new je(de.paint_symbol["text-opacity"]),"text-color":new je(de.paint_symbol["text-color"],{runtimeType:oi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new je(de.paint_symbol["text-halo-color"]),"text-halo-width":new je(de.paint_symbol["text-halo-width"]),"text-halo-blur":new je(de.paint_symbol["text-halo-blur"]),"text-translate":new Ve(de.paint_symbol["text-translate"]),"text-translate-anchor":new Ve(de.paint_symbol["text-translate-anchor"])}),layout:sp};class Du{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Pr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(e.formattedSection))return r.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Fe("FormatSectionOverride",Du,{omit:["defaultValue"]});class nl extends ir{constructor(e){super(e,ac)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),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")),this.layout.get("symbol-placement")==="point"){const o=this.layout.get("text-writing-mode");if(o){const c=[];for(const h of o)c.indexOf(h)<0&&c.push(h);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,o,c){const h=this.layout.get(e).evaluate(r,{},o,c),p=this._unevaluatedLayout._values[e];return p.isDataDriven()||Kn(p.value)||!h?h:function(m,g){return g.replace(/{([^{}]+)}/g,(x,w)=>w in m?String(m[w]):"")}(r.properties,h)}createBucket(e){return new Ko(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of ac.paint.overridableProperties){if(!nl.hasPaintOverride(this.layout,e))continue;const r=this.paint.get(e),o=new Du(r),c=new ko(o,r.property.specification);let h=null;h=r.value.kind==="constant"||r.value.kind==="source"?new Yn("source",c):new _s("composite",c,r.value.zoomStops),this.paint._values[e]=new tr(r.property,h,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,o){return!(!this.layout||r.isDataDriven()||o.isDataDriven())&&nl.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){const o=e.get("text-field"),c=ac.paint.properties[r];let h=!1;const p=m=>{for(const g of m)if(c.overrides&&c.overrides.hasOverride(g))return void(h=!0)};if(o.value.kind==="constant"&&o.value.value instanceof W)p(o.value.value.sections);else if(o.value.kind==="source"){const m=x=>{h||(x instanceof $e&&ae(x.value)===Yt?p(x.value.sections):x instanceof zo?p(x.sections):x.eachChild(m))},g=o.value;g._styleExpression&&m(g._styleExpression.expression)}return h}}function lc(i,e,r){let o="never";const c=i.get(e);return c?o=c:i.get(r)&&(o="always"),o}var ap={paint:new si({"background-color":new Ve(de.paint_background["background-color"]),"background-pattern":new Ms(de.paint_background["background-pattern"]),"background-opacity":new Ve(de.paint_background["background-opacity"])})},lp={paint:new si({"raster-opacity":new Ve(de.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ve(de.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ve(de.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ve(de.paint_raster["raster-brightness-max"]),"raster-saturation":new Ve(de.paint_raster["raster-saturation"]),"raster-contrast":new Ve(de.paint_raster["raster-contrast"]),"raster-resampling":new Ve(de.paint_raster["raster-resampling"]),"raster-fade-duration":new Ve(de.paint_raster["raster-fade-duration"])})};class cp extends ir{constructor(e){super(e,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const up={circle:class extends ir{constructor(i){super(i,Vh)}createBucket(i){return new Rl(i)}queryRadius(i){const e=i;return Ls("circle-radius",this,e)+Ls("circle-stroke-width",this,e)+Va(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p,m){const g=Na(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,p),x=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),w=this.paint.get("circle-pitch-alignment")==="map",E=w?g:function(z,P){return z.map(N=>qc(N,P))}(g,m),C=w?x*p:x;for(const z of o)for(const P of z){const N=w?P:qc(P,m);let V=C;const ee=Ga([],[P.x,P.y,0,1],m);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?V*=ee[3]/h.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(V*=h.cameraToCenterDistance/ee[3]),Bh(E,N,V))return!0}return!1}},heatmap:class extends ir{constructor(i){super(i,Gh),this._updateColorRamp()}createBucket(i){return new Zc(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Xc({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends ir{constructor(i){super(i,qh)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends ir{constructor(i){super(i,sd)}recalculate(i,e){super.recalculate(i,e);const 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(i){return new Xl(i)}queryRadius(){return Va(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p){return Bc(Na(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,p),o)}isTileClipped(){return!0}},"fill-extrusion":class extends ir{constructor(i){super(i,vd)}createBucket(i){return new Hl(i)}queryRadius(){return Va(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,r,o,c,h,p,m){const g=Na(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,p),x=this.paint.get("fill-extrusion-height").evaluate(e,r),w=this.paint.get("fill-extrusion-base").evaluate(e,r),E=function(z,P,N,V){const ee=[];for(const oe of z){const Q=[oe.x,oe.y,0,1];Ga(Q,Q,P),ee.push(new We(Q[0]/Q[3],Q[1]/Q[3]))}return ee}(g,m),C=function(z,P,N,V){const ee=[],oe=[],Q=V[8]*P,re=V[9]*P,me=V[10]*P,fe=V[11]*P,Be=V[8]*N,Ue=V[9]*N,Pe=V[10]*N,Ie=V[11]*N;for(const Te of z){const ke=[],Ae=[];for(const be of Te){const qe=be.x,Ne=be.y,rt=V[0]*qe+V[4]*Ne+V[12],kt=V[1]*qe+V[5]*Ne+V[13],Ut=V[2]*qe+V[6]*Ne+V[14],Jt=V[3]*qe+V[7]*Ne+V[15],Ki=Ut+me,ci=Jt+fe,Xt=rt+Be,ri=kt+Ue,ui=Ut+Pe,fi=Jt+Ie,ki=new We((rt+Q)/ci,(kt+re)/ci);ki.z=Ki/ci,ke.push(ki);const Wt=new We(Xt/fi,ri/fi);Wt.z=ui/fi,Ae.push(Wt)}ee.push(ke),oe.push(Ae)}return[ee,oe]}(o,w,x,m);return function(z,P,N){let V=1/0;Bc(N,P)&&(V=iu(N,P[0]));for(let ee=0;ee<P.length;ee++){const oe=P[ee],Q=z[ee];for(let re=0;re<oe.length-1;re++){const me=oe[re],fe=[me,oe[re+1],Q[re+1],Q[re],me];Rc(N,fe)&&(V=Math.min(V,iu(N,fe)))}}return V!==1/0&&V}(C[0],C[1],E)}},line:class extends ir{constructor(i){super(i,nu),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(i){i==="line-gradient"&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Zn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(i,e){super.recalculate(i,e),this.paint._values["line-floorwidth"]=ou.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new Kl(i)}queryRadius(i){const e=i,r=su(Ls("line-width",this,e),Ls("line-gap-width",this,e)),o=Ls("line-offset",this,e);return r/2+Math.abs(o)+Va(this.paint.get("line-translate"))}queryIntersectsFeature(i,e,r,o,c,h,p){const m=Na(i,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,p),g=p/2*su(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),x=this.paint.get("line-offset").evaluate(e,r);return x&&(o=function(w,E){const C=[];for(let z=0;z<w.length;z++){const P=w[z],N=[];for(let V=0;V<P.length;V++){const ee=P[V-1],oe=P[V],Q=P[V+1],re=V===0?new We(0,0):oe.sub(ee)._unit()._perp(),me=V===P.length-1?new We(0,0):Q.sub(oe)._unit()._perp(),fe=re._add(me)._unit(),Be=fe.x*me.x+fe.y*me.y;Be!==0&&fe._mult(1/Be),N.push(fe._mult(E)._add(oe))}C.push(N)}return C}(o,x*p)),function(w,E,C){for(let z=0;z<E.length;z++){const P=E[z];if(w.length>=3){for(let N=0;N<P.length;N++)if(Go(w,P[N]))return!0}if(Fh(w,P,C))return!0}return!1}(m,o,g)}isTileClipped(){return!0}},symbol:nl,background:class extends ir{constructor(i){super(i,ap)}},raster:class extends ir{constructor(i){super(i,lp)}}};class hp{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel!="undefined"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const Lu=63710088e-1;class Gt{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Gt(gt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const r=Math.PI/180,o=this.lat*r,c=e.lat*r,h=Math.sin(o)*Math.sin(c)+Math.cos(o)*Math.cos(c)*Math.cos((e.lng-this.lng)*r);return Lu*Math.acos(Math.min(h,1))}toBounds(e=0){const r=360*e/40075017,o=r/Math.cos(Math.PI/180*this.lat);return new _o(new Gt(this.lng-o,this.lat-r),new Gt(this.lng+o,this.lat+r))}static convert(e){if(e instanceof Gt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Gt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Gt(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new 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>]")}}class _o{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Gt?new Gt(e.lng,e.lat):Gt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Gt?new Gt(e.lng,e.lat):Gt.convert(e),this}extend(e){const r=this._sw,o=this._ne;let c,h;if(e instanceof Gt)c=e,h=e;else{if(!(e instanceof _o))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(_o.convert(e)):this.extend(Gt.convert(e)):this;if(c=e._sw,h=e._ne,!c||!h)return this}return r||o?(r.lng=Math.min(c.lng,r.lng),r.lat=Math.min(c.lat,r.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new Gt(c.lng,c.lat),this._ne=new Gt(h.lng,h.lat)),this}getCenter(){return new Gt((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 Gt(this.getWest(),this.getNorth())}getSouthEast(){return new Gt(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(e){const{lng:r,lat:o}=Gt.convert(e);let c=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(c=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&c}static convert(e){return e instanceof _o?e:e&&new _o(e)}}const Ru=2*Math.PI*Lu;function Bu(i){return Ru*Math.cos(i*Math.PI/180)}function Fu(i){return(180+i)/360}function Ou(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function Uu(i,e){return i/Bu(e)}function cc(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class ol{constructor(e,r,o=0){this.x=+e,this.y=+r,this.z=+o}static fromLngLat(e,r=0){const o=Gt.convert(e);return new ol(Fu(o.lng),Ou(o.lat),Uu(r,o.lat))}toLngLat(){return new Gt(360*this.x-180,cc(this.y))}toAltitude(){return this.z*Bu(cc(this.y))}meterInMercatorCoordinateUnits(){return 1/Ru*(e=cc(this.y),1/Math.cos(e*Math.PI/180));var e}}function $u(i,e,r){var o=2*Math.PI*6378137/256/Math.pow(2,r);return[i*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}class uc{constructor(e,r,o){if(e<0||e>25||o<0||o>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error(`x=${r}, y=${o}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=o,this.key=Zs(0,e,e,r,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,r,o){const c=(p=this.y,m=this.z,g=$u(256*(h=this.x),256*(p=Math.pow(2,m)-p-1),m),x=$u(256*(h+1),256*(p+1),m),g[0]+","+g[1]+","+x[0]+","+x[1]);var h,p,m,g,x;const w=function(E,C,z){let P,N="";for(let V=E;V>0;V--)P=1<<V-1,N+=(C&P?1:0)+(z&P?2:0);return N}(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(o==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,w).replace(/{bbox-epsg-3857}/g,c)}isChildOf(e){const r=this.z-e.z;return r>0&&e.x===this.x>>r&&e.y===this.y>>r}getTilePoint(e){const r=Math.pow(2,this.z);return new We((e.x*r-this.x)*Kt,(e.y*r-this.y)*Kt)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Vu{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Zs(e,r.z,r.z,r.x,r.y)}}class Hi{constructor(e,r,o,c,h){if(e<o)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${o}`);this.overscaledZ=e,this.wrap=r,this.canonical=new uc(o,+c,+h),this.key=Zs(r,e,o,c,h)}clone(){return new Hi(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const r=this.canonical.z-e;return e>this.canonical.z?new Hi(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Hi(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const o=this.canonical.z-e;return e>this.canonical.z?Zs(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Zs(this.wrap*+r,e,e,this.canonical.x>>o,this.canonical.y>>o)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const r=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Hi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,o=2*this.canonical.x,c=2*this.canonical.y;return[new Hi(r,this.wrap,r,o,c),new Hi(r,this.wrap,r,o+1,c),new Hi(r,this.wrap,r,o,c+1),new Hi(r,this.wrap,r,o+1,c+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Hi(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Hi(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Vu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new ol(e.x-this.wrap,e.y))}}function Zs(i,e,r,o,c){(i*=2)<0&&(i=-1*i-1);const h=1<<r;return(h*h*i+h*c+o).toString(36)+r.toString(36)+e.toString(36)}Fe("CanonicalTileID",uc),Fe("OverscaledTileID",Hi,{omit:["posMatrix"]});class Nu{constructor(e,r,o){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void Vt(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;const c=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=o||"mapbox";for(let h=0;h<c;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(c,h)]=this.data[this._idx(c-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,c)]=this.data[this._idx(h,c-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(c,-1)]=this.data[this._idx(c-1,0)],this.data[this._idx(-1,c)]=this.data[this._idx(0,c-1)],this.data[this._idx(c,c)]=this.data[this._idx(c-1,c-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let h=0;h<c;h++)for(let p=0;p<c;p++){const m=this.get(h,p);m>this.max&&(this.max=m),m<this.min&&(this.min=m)}}get(e,r){const o=new Uint8Array(this.data.buffer),c=4*this._idx(e,r);return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(o[c],o[c+1],o[c+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}_unpackMapbox(e,r,o){return(256*e*256+256*r+o)/10-1e4}_unpackTerrarium(e,r,o){return 256*e+r+o/256-32768}getPixels(){return new Wi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,r,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,h=r*this.dim+this.dim,p=o*this.dim,m=o*this.dim+this.dim;switch(r){case-1:c=h-1;break;case 1:h=c+1}switch(o){case-1:p=m-1;break;case 1:m=p+1}const g=-r*this.dim,x=-o*this.dim;for(let w=p;w<m;w++)for(let E=c;E<h;E++)this.data[this._idx(E,w)]=e.data[this._idx(E+g,w+x)]}}Fe("DEMData",Nu);class Gu{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){const o=e[r];this._stringToNumber[o]=r,this._numberToString[r]=o}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class qu{constructor(e,r,o,c,h){this.type="Feature",this._vectorTileFeature=e,e._z=r,e._x=o,e._y=c,this.properties=e.properties,this.id=h}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(e[r]=this[r]);return e}}class Zu{constructor(e,r){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new lo(Kt,16,0),this.grid3D=new lo(Kt,16,0),this.featureIndexArray=new it,this.promoteId=r}insert(e,r,o,c,h,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,c,h);const g=p?this.grid3D:this.grid;for(let x=0;x<r.length;x++){const w=r[x],E=[1/0,1/0,-1/0,-1/0];for(let C=0;C<w.length;C++){const z=w[C];E[0]=Math.min(E[0],z.x),E[1]=Math.min(E[1],z.y),E[2]=Math.max(E[2],z.x),E[3]=Math.max(E[3],z.y)}E[0]<Kt&&E[1]<Kt&&E[2]>=0&&E[3]>=0&&g.insert(m,E[0],E[1],E[2],E[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ln.VectorTile(new Jl(this.rawTileData)).layers,this.sourceLayerCoder=new Gu(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,r,o,c){this.loadVTLayers();const h=e.params||{},p=Kt/e.tileSize/e.scale,m=Ro(h.filter),g=e.queryGeometry,x=e.queryPadding*p,w=Xu(g),E=this.grid.query(w.minX-x,w.minY-x,w.maxX+x,w.maxY+x),C=Xu(e.cameraQueryGeometry),z=this.grid3D.query(C.minX-x,C.minY-x,C.maxX+x,C.maxY+x,(V,ee,oe,Q)=>function(re,me,fe,Be,Ue){for(const Ie of re)if(me<=Ie.x&&fe<=Ie.y&&Be>=Ie.x&&Ue>=Ie.y)return!0;const Pe=[new We(me,fe),new We(me,Ue),new We(Be,Ue),new We(Be,fe)];if(re.length>2){for(const Ie of Pe)if(Go(re,Ie))return!0}for(let Ie=0;Ie<re.length-1;Ie++)if(Uh(re[Ie],re[Ie+1],Pe))return!0;return!1}(e.cameraQueryGeometry,V-x,ee-x,oe+x,Q+x));for(const V of z)E.push(V);E.sort(dp);const P={};let N;for(let V=0;V<E.length;V++){const ee=E[V];if(ee===N)continue;N=ee;const oe=this.featureIndexArray.get(ee);let Q=null;this.loadMatchingFeature(P,oe.bucketIndex,oe.sourceLayerIndex,oe.featureIndex,m,h.layers,h.availableImages,r,o,c,(re,me,fe)=>(Q||(Q=fo(re)),me.queryIntersectsFeature(g,re,fe,Q,this.z,e.transform,p,e.pixelPosMatrix)))}return P}loadMatchingFeature(e,r,o,c,h,p,m,g,x,w,E){const C=this.bucketLayerIDs[r];if(p&&!function(V,ee){for(let oe=0;oe<V.length;oe++)if(ee.indexOf(V[oe])>=0)return!0;return!1}(p,C))return;const z=this.sourceLayerCoder.decode(o),P=this.vtLayers[z].feature(c);if(h.needGeometry){const V=mo(P,!0);if(!h.filter(new Ft(this.tileID.overscaledZ),V,this.tileID.canonical))return}else if(!h.filter(new Ft(this.tileID.overscaledZ),P))return;const N=this.getId(P,z);for(let V=0;V<C.length;V++){const ee=C[V];if(p&&p.indexOf(ee)<0)continue;const oe=g[ee];if(!oe)continue;let Q={};N&&w&&(Q=w.getState(oe.sourceLayer||"_geojsonTileLayer",N));const re=st({},x[ee]);re.paint=ju(re.paint,oe.paint,P,Q,m),re.layout=ju(re.layout,oe.layout,P,Q,m);const me=!E||E(P,oe,Q);if(!me)continue;const fe=new qu(P,this.z,this.x,this.y,N);fe.layer=re;let Be=e[ee];Be===void 0&&(Be=e[ee]=[]),Be.push({featureIndex:c,feature:fe,intersectionZ:me})}}lookupSymbolFeatures(e,r,o,c,h,p,m,g){const x={};this.loadVTLayers();const w=Ro(h);for(const E of e)this.loadMatchingFeature(x,o,c,E,w,p,m,g,r);return x}hasLayer(e){for(const r of this.bucketLayerIDs)for(const o of r)if(e===o)return!0;return!1}getId(e,r){let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],typeof o=="boolean"&&(o=Number(o))),o}}function ju(i,e,r,o,c){return Mt(i,(h,p)=>{const m=e instanceof ho?e.get(p):null;return m&&m.evaluate?m.evaluate(r,o,c):m})}function Xu(i){let e=1/0,r=1/0,o=-1/0,c=-1/0;for(const h of i)e=Math.min(e,h.x),r=Math.min(r,h.y),o=Math.max(o,h.x),c=Math.max(c,h.y);return{minX:e,minY:r,maxX:o,maxY:c}}function dp(i,e){return e-i}var hc;Fe("FeatureIndex",Zu,{omit:["rawTileData","sourceLayerCoder"]}),l.PerformanceMarkers=void 0,(hc=l.PerformanceMarkers||(l.PerformanceMarkers={})).create="create",hc.load="load",hc.fullLoad="fullLoad";let sl=null,js=[];const dc=1e3/30,pp={mark(i){performance.mark(i)},frame(i){const e=i;sl!=null&&js.push(e-sl),sl=e},clearMetrics(){sl=null,js=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in l.PerformanceMarkers)performance.clearMarks(l.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",l.PerformanceMarkers.create,l.PerformanceMarkers.load),performance.measure("fullLoadTime",l.PerformanceMarkers.create,l.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,r=js.length,o=1/(js.reduce((h,p)=>h+p,0)/r/1e3),c=js.filter(h=>h>dc).reduce((h,p)=>h+(p-dc)/dc,0);return{loadTime:i,fullLoadTime:e,fps:o,percentDroppedFrames:c/(r+c)*100}}};l.AJAXError=Ii,l.ARRAY_TYPE=wi,l.Actor=class{constructor(i,e,r){this.target=i,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},_t(["receive","process"],this),this.invoker=new hp(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=_i()?i:window}send(i,e,r,o,c=!1){const h=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[h]=r);const p=cn(this.globalScope)?void 0:[];return this.target.postMessage({id:h,type:i,hasCallback:!!r,targetMapId:o,mustQueue:c,sourceMapId:this.mapId,data:Jr(e,p)},p),{cancel:()=>{r&&delete this.callbacks[h],this.target.postMessage({id:h,type:"<cancel>",targetMapId:o,sourceMapId:this.mapId})}}}receive(i){const e=i.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];const o=this.cancelCallbacks[r];delete this.cancelCallbacks[r],o&&o()}else _i()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type==="<response>"){const r=this.callbacks[i];delete this.callbacks[i],r&&(e.error?r(Lr(e.error)):r(null,Lr(e.data)))}else{let r=!1;const o=cn(this.globalScope)?void 0:[],c=e.hasCallback?(m,g)=>{r=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:m?Jr(m):null,data:Jr(g,o)},o)}:m=>{r=!0};let h=null;const p=Lr(e.data);if(this.parent[e.type])h=this.parent[e.type](e.sourceMapId,p,c);else if(this.parent.getWorkerSource){const m=e.type.split(".");h=this.parent.getWorkerSource(e.sourceMapId,m[0],p.source)[m[1]](p,c)}else c(new Error(`Could not find function ${e.type}`));!r&&h&&h.cancel&&(this.cancelCallbacks[i]=h.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},l.AlphaImage=Bs,l.CanonicalTileID=uc,l.CollisionBoxArray=ue,l.CollisionCircleLayoutArray=class extends T{},l.Color=D,l.DEMData=Nu,l.DataConstantProperty=Ve,l.DictionaryCoder=Gu,l.EXTENT=Kt,l.ErrorEvent=gn,l.EvaluationParameters=Ft,l.Event=pr,l.Evented=fr,l.FeatureIndex=Zu,l.FillBucket=Xl,l.FillExtrusionBucket=Hl,l.GeoJSONFeature=qu,l.ImageAtlas=mu,l.ImagePosition=Ql,l.LineBucket=Kl,l.LineStripIndexArray=class extends ${},l.LngLat=Gt,l.LngLatBounds=_o,l.MercatorCoordinate=ol,l.ONE_EM=ai,l.OverscaledTileID=Hi,l.PerformanceUtils=pp,l.PosArray=Ge,l.Properties=si,l.QuadTriangleArray=class extends M{},l.RGBAImage=Wi,l.RasterBoundsArray=class extends a{},l.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},l.ResourceType=hr,l.SegmentVector=nt,l.SymbolBucket=Ko,l.Transitionable=Ra,l.TriangleIndexArray=vi,l.Uniform1f=tn,l.Uniform1i=class extends en{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},l.Uniform2f=class extends en{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},l.Uniform3f=class extends en{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},l.Uniform4f=Vo,l.UniformColor=Pc,l.UniformMatrix4f=class extends en{constructor(i,e){super(i,e),this.current=Lh}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},l.UnwrappedTileID=Vu,l.ValidationError=Ce,l.ZoomHistory=bs,l.add=function(i,e,r){return i[0]=e[0]+r[0],i[1]=e[1]+r[1],i[2]=e[2]+r[2],i},l.addDynamicAttributes=nc,l.asyncAll=function(i,e,r){if(!i.length)return r(null,[]);let o=i.length;const c=new Array(i.length);let h=null;i.forEach((p,m)=>{e(p,(g,x)=>{g&&(h=g),c[m]=x,--o==0&&r(h,c)})})},l.bezier=Me,l.bindAll=_t,l.cacheEntryPossiblyAdded=function(i){Yi++,Yi>hn&&(i.getActor().send("enforceCacheSizeLimit",un),Yi=0)},l.clamp=se,l.clearTileCache=function(i){const e=caches.delete(Gi);i&&e.catch(i).then(()=>i())},l.clipLine=Cu,l.clone=function(i){var e=new wi(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},l.clone$1=bt,l.clone$2=function(i){var e=new wi(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},l.collisionCircleLayout=Pd,l.config=ur,l.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.create=function(){var i=new wi(16);return wi!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},l.create$1=Uc,l.createExpression=Jn,l.createFilter=Ro,l.createLayout=jt,l.createStyleLayer=function(i){return i.type==="custom"?new cp(i):new up[i.type](i)},l.cross=function(i,e,r){var o=e[0],c=e[1],h=e[2],p=r[0],m=r[1],g=r[2];return i[0]=c*g-h*m,i[1]=h*p-o*g,i[2]=o*m-c*p,i},l.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},l.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},l.ease=we,l.emitValidationErrors=Fo,l.enforceCacheSizeLimit=function(i){dn(),qi&&qi.then(e=>{e.keys().then(r=>{for(let o=0;o<r.length-i;o++)e.delete(r[o])})})},l.equals=function(i,e){var r=i[0],o=i[1],c=i[2],h=i[3],p=i[4],m=i[5],g=i[6],x=i[7],w=i[8],E=i[9],C=i[10],z=i[11],P=i[12],N=i[13],V=i[14],ee=i[15],oe=e[0],Q=e[1],re=e[2],me=e[3],fe=e[4],Be=e[5],Ue=e[6],Pe=e[7],Ie=e[8],Te=e[9],ke=e[10],Ae=e[11],be=e[12],qe=e[13],Ne=e[14],rt=e[15];return Math.abs(r-oe)<=bi*Math.max(1,Math.abs(r),Math.abs(oe))&&Math.abs(o-Q)<=bi*Math.max(1,Math.abs(o),Math.abs(Q))&&Math.abs(c-re)<=bi*Math.max(1,Math.abs(c),Math.abs(re))&&Math.abs(h-me)<=bi*Math.max(1,Math.abs(h),Math.abs(me))&&Math.abs(p-fe)<=bi*Math.max(1,Math.abs(p),Math.abs(fe))&&Math.abs(m-Be)<=bi*Math.max(1,Math.abs(m),Math.abs(Be))&&Math.abs(g-Ue)<=bi*Math.max(1,Math.abs(g),Math.abs(Ue))&&Math.abs(x-Pe)<=bi*Math.max(1,Math.abs(x),Math.abs(Pe))&&Math.abs(w-Ie)<=bi*Math.max(1,Math.abs(w),Math.abs(Ie))&&Math.abs(E-Te)<=bi*Math.max(1,Math.abs(E),Math.abs(Te))&&Math.abs(C-ke)<=bi*Math.max(1,Math.abs(C),Math.abs(ke))&&Math.abs(z-Ae)<=bi*Math.max(1,Math.abs(z),Math.abs(Ae))&&Math.abs(P-be)<=bi*Math.max(1,Math.abs(P),Math.abs(be))&&Math.abs(N-qe)<=bi*Math.max(1,Math.abs(N),Math.abs(qe))&&Math.abs(V-Ne)<=bi*Math.max(1,Math.abs(V),Math.abs(Ne))&&Math.abs(ee-rt)<=bi*Math.max(1,Math.abs(ee),Math.abs(rt))},l.evaluateSizeForFeature=function(i,{uSize:e,uSizeT:r},{lowerSize:o,upperSize:c}){return i.kind==="source"?o/on:i.kind==="composite"?Rt(o/on,c/on,r):e},l.evaluateSizeForZoom=function(i,e){let r=0,o=0;if(i.kind==="constant")o=i.layoutSize;else if(i.kind!=="source"){const{interpolationType:c,minZoom:h,maxZoom:p}=i,m=c?se(Mi.interpolationFactor(c,e,h,p),0,1):0;i.kind==="camera"?o=Rt(i.minSize,i.maxSize,m):r=m}return{uSizeT:r,uSize:o}},l.evaluateVariableOffset=zu,l.evented=As,l.exported=Er,l.exported$1=Sr,l.extend=st,l.filterObject=ct,l.fromRotation=function(i,e){var r=Math.sin(e),o=Math.cos(e);return i[0]=o,i[1]=r,i[2]=0,i[3]=-r,i[4]=o,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},l.fromScaling=function(i,e){return i[0]=e[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=e[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=e[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},l.getAnchorAlignment=tc,l.getAnchorJustification=rc,l.getArrayBuffer=mn,l.getImage=zr,l.getJSON=function(i,e){return fn(st(i,{type:"json"}),e)},l.getOverlapMode=lc,l.getRTLTextPluginStatus=co,l.getReferrer=$n,l.getVideo=function(i,e){const r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let o=0;o<i.length;o++){const c=window.document.createElement("source");Vn(i[o])||(r.crossOrigin="Anonymous"),c.src=i[o],r.appendChild(c)}return{cancel:()=>{}}},l.identity=Ol,l.invert=function(i,e){var r=e[0],o=e[1],c=e[2],h=e[3],p=e[4],m=e[5],g=e[6],x=e[7],w=e[8],E=e[9],C=e[10],z=e[11],P=e[12],N=e[13],V=e[14],ee=e[15],oe=r*m-o*p,Q=r*g-c*p,re=r*x-h*p,me=o*g-c*m,fe=o*x-h*m,Be=c*x-h*g,Ue=w*N-E*P,Pe=w*V-C*P,Ie=w*ee-z*P,Te=E*V-C*N,ke=E*ee-z*N,Ae=C*ee-z*V,be=oe*Ae-Q*ke+re*Te+me*Ie-fe*Pe+Be*Ue;return be?(i[0]=(m*Ae-g*ke+x*Te)*(be=1/be),i[1]=(c*ke-o*Ae-h*Te)*be,i[2]=(N*Be-V*fe+ee*me)*be,i[3]=(C*fe-E*Be-z*me)*be,i[4]=(g*Ie-p*Ae-x*Pe)*be,i[5]=(r*Ae-c*Ie+h*Pe)*be,i[6]=(V*re-P*Be-ee*Q)*be,i[7]=(w*Be-C*re+z*Q)*be,i[8]=(p*ke-m*Ie+x*Ue)*be,i[9]=(o*Ie-r*ke-h*Ue)*be,i[10]=(P*fe-N*re+ee*oe)*be,i[11]=(E*re-w*fe-z*oe)*be,i[12]=(m*Pe-p*Te-g*Ue)*be,i[13]=(r*Te-o*Pe+c*Ue)*be,i[14]=(N*Q-P*me-V*oe)*be,i[15]=(w*me-E*Q+C*oe)*be,i):null},l.isImageBitmap=Tr,l.isSafari=cn,l.isWorker=_i,l.keysDifference=function(i,e){const r=[];for(const o in i)o in e||r.push(o);return r},l.lazyLoadRTLTextPlugin=function(){Ui.isLoading()||Ui.isLoaded()||co()!=="deferred"||La()},l.makeRequest=fn,l.mapObject=Mt,l.mercatorXfromLng=Fu,l.mercatorYfromLat=Ou,l.mercatorZfromAltitude=Uu,l.mul=Nh,l.mul$1=function(i,e,r){return i[0]=e[0]*r[0],i[1]=e[1]*r[1],i[2]=e[2]*r[2],i[3]=e[3]*r[3],i},l.multiply=$c,l.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},l.normalize=function(i,e){var r=e[0],o=e[1],c=e[2],h=r*r+o*o+c*c;return h>0&&(h=1/Math.sqrt(h)),i[0]=e[0]*h,i[1]=e[1]*h,i[2]=e[2]*h,i},l.number=Rt,l.ortho=function(i,e,r,o,c,h,p){var m=1/(e-r),g=1/(o-c),x=1/(h-p);return i[0]=-2*m,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*g,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*x,i[11]=0,i[12]=(e+r)*m,i[13]=(c+o)*g,i[14]=(p+h)*x,i[15]=1,i},l.parseCacheControl=vo,l.parseGlyphPbf=function(i){return new Jl(i).readFields(Nd,[])},l.pbf=Jl,l.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Kt/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,r=i.bucket.layers[0]._unevaluatedLayout._values,o={layoutIconSize:r["icon-size"].possiblyEvaluate(new Ft(i.bucket.zoom+1),i.canonical),layoutTextSize:r["text-size"].possiblyEvaluate(new Ft(i.bucket.zoom+1),i.canonical),textMaxSize:r["text-size"].possiblyEvaluate(new Ft(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.textSizeData;o.compositeTextSizes=[r["text-size"].possiblyEvaluate(new Ft(g),i.canonical),r["text-size"].possiblyEvaluate(new Ft(x),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:g,maxZoom:x}=i.bucket.iconSizeData;o.compositeIconSizes=[r["icon-size"].possiblyEvaluate(new Ft(g),i.canonical),r["icon-size"].possiblyEvaluate(new Ft(x),i.canonical)]}const c=e.get("text-line-height")*ai,h=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",p=e.get("text-keep-upright"),m=e.get("text-size");for(const g of i.bucket.features){const x=e.get("text-font").evaluate(g,{},i.canonical).join(","),w=m.evaluate(g,{},i.canonical),E=o.layoutTextSize.evaluate(g,{},i.canonical),C=o.layoutIconSize.evaluate(g,{},i.canonical),z={horizontal:{},vertical:void 0},P=g.text;let N,V=[0,0];if(P){const Q=P.toString(),re=e.get("text-letter-spacing").evaluate(g,{},i.canonical)*ai,me=zl(Q)?re:0,fe=e.get("text-anchor").evaluate(g,{},i.canonical),Be=e.get("text-variable-anchor");if(!Be){const ke=e.get("text-radial-offset").evaluate(g,{},i.canonical);V=ke?zu(fe,[ke*ai,ic]):e.get("text-offset").evaluate(g,{},i.canonical).map(Ae=>Ae*ai)}let Ue=h?"center":e.get("text-justify").evaluate(g,{},i.canonical);const Pe=e.get("symbol-placement"),Ie=Pe==="point"?e.get("text-max-width").evaluate(g,{},i.canonical)*ai:0,Te=()=>{i.bucket.allowVerticalPlacement&&Oo(Q)&&(z.vertical=Ja(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ie,c,fe,"left",me,V,l.WritingMode.vertical,!0,Pe,E,w))};if(!h&&Be){const ke=Ue==="auto"?Be.map(be=>rc(be)):[Ue];let Ae=!1;for(let be=0;be<ke.length;be++){const qe=ke[be];if(!z.horizontal[qe])if(Ae)z.horizontal[qe]=z.horizontal[0];else{const Ne=Ja(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ie,c,"center",qe,me,V,l.WritingMode.horizontal,!1,Pe,E,w);Ne&&(z.horizontal[qe]=Ne,Ae=Ne.positionedLines.length===1)}}Te()}else{Ue==="auto"&&(Ue=rc(fe));const ke=Ja(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ie,c,fe,Ue,me,V,l.WritingMode.horizontal,!1,Pe,E,w);ke&&(z.horizontal[Ue]=ke),Te(),Oo(Q)&&h&&p&&(z.vertical=Ja(P,i.glyphMap,i.glyphPositions,i.imagePositions,x,Ie,c,fe,Ue,me,V,l.WritingMode.vertical,!1,Pe,E,w))}}let ee=!1;if(g.icon&&g.icon.name){const Q=i.imageMap[g.icon.name];Q&&(N=Wd(i.imagePositions[g.icon.name],e.get("icon-offset").evaluate(g,{},i.canonical),e.get("icon-anchor").evaluate(g,{},i.canonical)),ee=!!Q.sdf,i.bucket.sdfIcons===void 0?i.bucket.sdfIcons=ee:i.bucket.sdfIcons!==ee&&Vt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Q.pixelRatio!==i.bucket.pixelRatio||e.get("icon-rotate").constantOr(1)!==0)&&(i.bucket.iconsNeedLinear=!0))}const oe=ku(z.horizontal)||z.vertical;i.bucket.iconsInText=!!oe&&oe.iconsInText,(oe||N)&&tp(i.bucket,g,z,N,i.imageMap,o,E,C,V,ee,i.canonical)}i.showCollisionBoxes&&i.bucket.generateCollisionDebugBuffers()},l.perspective=function(i,e,r,o,c){var h,p=1/Math.tan(e/2);return i[0]=p/r,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=p,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,c!=null&&c!==1/0?(i[10]=(c+o)*(h=1/(o-c)),i[14]=2*c*o*h):(i[10]=-1,i[14]=-2*o),i},l.pick=function(i,e){const r={};for(let o=0;o<e.length;o++){const c=e[o];c in i&&(r[c]=i[c])}return r},l.plugin=Ui,l.pointGeometry=We,l.polygonIntersectsPolygon=Rc,l.potpack=fu,l.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],l.register=Fe,l.registerForPluginStateChange=function(i){return i({pluginStatus:xi,pluginURL:Rr}),As.on("pluginStateChange",i),i},l.renderColorRamp=Xc,l.rotateX=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[4],p=e[5],m=e[6],g=e[7],x=e[8],w=e[9],E=e[10],C=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=h*c+x*o,i[5]=p*c+w*o,i[6]=m*c+E*o,i[7]=g*c+C*o,i[8]=x*c-h*o,i[9]=w*c-p*o,i[10]=E*c-m*o,i[11]=C*c-g*o,i},l.rotateZ=function(i,e,r){var o=Math.sin(r),c=Math.cos(r),h=e[0],p=e[1],m=e[2],g=e[3],x=e[4],w=e[5],E=e[6],C=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=h*c+x*o,i[1]=p*c+w*o,i[2]=m*c+E*o,i[3]=g*c+C*o,i[4]=x*c-h*o,i[5]=w*c-p*o,i[6]=E*c-m*o,i[7]=C*c-g*o,i},l.scale=function(i,e,r){var o=r[0],c=r[1],h=r[2];return i[0]=e[0]*o,i[1]=e[1]*o,i[2]=e[2]*o,i[3]=e[3]*o,i[4]=e[4]*c,i[5]=e[5]*c,i[6]=e[6]*c,i[7]=e[7]*c,i[8]=e[8]*h,i[9]=e[9]*h,i[10]=e[10]*h,i[11]=e[11]*h,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},l.scale$1=function(i,e,r){return i[0]=e[0]*r,i[1]=e[1]*r,i[2]=e[2]*r,i},l.setCacheLimits=function(i,e){un=i,hn=e},l.setRTLTextPlugin=function(i,e,r=!1){if(xi===Es||xi===Ss||xi===Is)throw new Error("setRTLTextPlugin cannot be called multiple times.");Rr=Er.resolveURL(i),xi=Es,Cs=e,zn(),r||La()},l.spec=de,l.sphericalToCartesian=function([i,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:i*Math.cos(e)*Math.sin(r),y:i*Math.sin(e)*Math.sin(r),z:i*Math.cos(r)}},l.sqrLen=function(i){var e=i[0],r=i[1];return e*e+r*r},l.sub=function(i,e,r){return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],i},l.toEvaluationFeature=mo,l.transformMat3=function(i,e,r){var o=e[0],c=e[1],h=e[2];return i[0]=o*r[0]+c*r[3]+h*r[6],i[1]=o*r[1]+c*r[4]+h*r[7],i[2]=o*r[2]+c*r[5]+h*r[8],i},l.transformMat4=Ga,l.transformMat4$1=function(i,e,r){var o=e[0],c=e[1];return i[0]=r[0]*o+r[4]*c+r[12],i[1]=r[1]*o+r[5]*c+r[13],i},l.translate=function(i,e,r){var o,c,h,p,m,g,x,w,E,C,z,P,N=r[0],V=r[1],ee=r[2];return e===i?(i[12]=e[0]*N+e[4]*V+e[8]*ee+e[12],i[13]=e[1]*N+e[5]*V+e[9]*ee+e[13],i[14]=e[2]*N+e[6]*V+e[10]*ee+e[14],i[15]=e[3]*N+e[7]*V+e[11]*ee+e[15]):(c=e[1],h=e[2],p=e[3],m=e[4],g=e[5],x=e[6],w=e[7],E=e[8],C=e[9],z=e[10],P=e[11],i[0]=o=e[0],i[1]=c,i[2]=h,i[3]=p,i[4]=m,i[5]=g,i[6]=x,i[7]=w,i[8]=E,i[9]=C,i[10]=z,i[11]=P,i[12]=o*N+m*V+E*ee+e[12],i[13]=c*N+g*V+C*ee+e[13],i[14]=h*N+x*V+z*ee+e[14],i[15]=p*N+w*V+P*ee+e[15]),i},l.triggerPluginCompletionEvent=Da,l.unicodeBlockLookup=ze,l.uniqueId=function(){return He++},l.validateCustomStyleLayer=function(i){const e=[],r=i.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),i.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),i.renderingMode&&i.renderingMode!=="2d"&&i.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e},l.validateLight=vs,l.validateStyle=ao,l.vectorTile=Ln,l.warnOnce=Vt,l.wrap=gt}),X(["./shared"],function(l){function ye(R){const b=typeof R;if(b==="number"||b==="boolean"||b==="string"||R==null)return JSON.stringify(R);if(Array.isArray(R)){let D="[";for(const G of R)D+=`${ye(G)},`;return`${D}]`}const S=Object.keys(R).sort();let k="{";for(let D=0;D<S.length;D++)k+=`${JSON.stringify(S[D])}:${ye(R[S[D]])},`;return`${k}}`}function pe(R){let b="";for(const S of l.refProperties)b+=`/${ye(R[S])}`;return b}class Me{constructor(b){this.keyCache={},b&&this.replace(b)}replace(b){this._layerConfigs={},this._layers={},this.update(b,[])}update(b,S){for(const D of b){this._layerConfigs[D.id]=D;const G=this._layers[D.id]=l.createStyleLayer(D);G._featureFilter=l.createFilter(G.filter),this.keyCache[D.id]&&delete this.keyCache[D.id]}for(const D of S)delete this.keyCache[D],delete this._layerConfigs[D],delete this._layers[D];this.familiesBySource={};const k=function(D,G){const K={};for(let q=0;q<D.length;q++){const J=G&&G[D[q].id]||pe(D[q]);G&&(G[D[q].id]=J);let le=K[J];le||(le=K[J]=[]),le.push(D[q])}const W=[];for(const q in K)W.push(K[q]);return W}(Object.values(this._layerConfigs),this.keyCache);for(const D of k){const G=D.map(xe=>this._layers[xe.id]),K=G[0];if(K.visibility==="none")continue;const W=K.source||"";let q=this.familiesBySource[W];q||(q=this.familiesBySource[W]={});const J=K.sourceLayer||"_geojsonTileLayer";let le=q[J];le||(le=q[J]=[]),le.push(G)}}}class we{constructor(b){const S={},k=[];for(const W in b){const q=b[W],J=S[W]={};for(const le in q){const xe=q[+le];if(!xe||xe.bitmap.width===0||xe.bitmap.height===0)continue;const ae={x:0,y:0,w:xe.bitmap.width+2,h:xe.bitmap.height+2};k.push(ae),J[le]={rect:ae,metrics:xe.metrics}}}const{w:D,h:G}=l.potpack(k),K=new l.AlphaImage({width:D||1,height:G||1});for(const W in b){const q=b[W];for(const J in q){const le=q[+J];if(!le||le.bitmap.width===0||le.bitmap.height===0)continue;const xe=S[W][J].rect;l.AlphaImage.copy(le.bitmap,K,{x:0,y:0},{x:xe.x+1,y:xe.y+1},le.bitmap)}}this.image=K,this.positions=S}}l.register("GlyphAtlas",we);class se{constructor(b){this.tileID=new l.OverscaledTileID(b.tileID.overscaledZ,b.tileID.wrap,b.tileID.canonical.z,b.tileID.canonical.x,b.tileID.canonical.y),this.uid=b.uid,this.zoom=b.zoom,this.pixelRatio=b.pixelRatio,this.tileSize=b.tileSize,this.source=b.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=b.showCollisionBoxes,this.collectResourceTiming=!!b.collectResourceTiming,this.returnDependencies=!!b.returnDependencies,this.promoteId=b.promoteId}parse(b,S,k,D,G){this.status="parsing",this.data=b,this.collisionBoxArray=new l.CollisionBoxArray;const K=new l.DictionaryCoder(Object.keys(b.layers).sort()),W=new l.FeatureIndex(this.tileID,this.promoteId);W.bucketLayerIDs=[];const q={},J={featureIndex:W,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:k},le=S.familiesBySource[this.source];for(const Ke in le){const tt=b.layers[Ke];if(!tt)continue;tt.version===1&&l.warnOnce(`Vector tile source "${this.source}" layer "${Ke}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const ft=K.encode(Ke),It=[];for(let Qt=0;Qt<tt.length;Qt++){const Lt=tt.feature(Qt),li=W.getId(Lt,Ke);It.push({feature:Lt,id:li,index:Qt,sourceLayerIndex:ft})}for(const Qt of le[Ke]){const Lt=Qt[0];Lt.source!==this.source&&l.warnOnce(`layer.source = ${Lt.source} does not equal this.source = ${this.source}`),Lt.minzoom&&this.zoom<Math.floor(Lt.minzoom)||Lt.maxzoom&&this.zoom>=Lt.maxzoom||Lt.visibility!=="none"&&(gt(Qt,this.zoom,k),(q[Lt.id]=Lt.createBucket({index:W.bucketLayerIDs.length,layers:Qt,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:ft,sourceID:this.source})).populate(It,J,this.tileID.canonical),W.bucketLayerIDs.push(Qt.map(li=>li.id)))}}let xe,ae,Oe,$e;const De=l.mapObject(J.glyphDependencies,Ke=>Object.keys(Ke).map(Number));Object.keys(De).length?D.send("getGlyphs",{uid:this.uid,stacks:De},(Ke,tt)=>{xe||(xe=Ke,ae=tt,pt.call(this))}):ae={};const Ze=Object.keys(J.iconDependencies);Ze.length?D.send("getImages",{icons:Ze,source:this.source,tileID:this.tileID,type:"icons"},(Ke,tt)=>{xe||(xe=Ke,Oe=tt,pt.call(this))}):Oe={};const Xe=Object.keys(J.patternDependencies);function pt(){if(xe)return G(xe);if(ae&&Oe&&$e){const Ke=new we(ae),tt=new l.ImageAtlas(Oe,$e);for(const ft in q){const It=q[ft];It instanceof l.SymbolBucket?(gt(It.layers,this.zoom,k),l.performSymbolLayout({bucket:It,glyphMap:ae,glyphPositions:Ke.positions,imageMap:Oe,imagePositions:tt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):It.hasPattern&&(It instanceof l.LineBucket||It instanceof l.FillBucket||It instanceof l.FillExtrusionBucket)&&(gt(It.layers,this.zoom,k),It.addFeatures(J,this.tileID.canonical,tt.patternPositions))}this.status="done",G(null,{buckets:Object.values(q).filter(ft=>!ft.isEmpty()),featureIndex:W,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Ke.image,imageAtlas:tt,glyphMap:this.returnDependencies?ae:null,iconMap:this.returnDependencies?Oe:null,glyphPositions:this.returnDependencies?Ke.positions:null})}}Xe.length?D.send("getImages",{icons:Xe,source:this.source,tileID:this.tileID,type:"patterns"},(Ke,tt)=>{xe||(xe=Ke,$e=tt,pt.call(this))}):$e={},pt.call(this)}}function gt(R,b,S){const k=new l.EvaluationParameters(b);for(const D of R)D.recalculate(k,S)}function st(R,b){const S=l.getArrayBuffer(R.request,(k,D,G,K)=>{k?b(k):D&&b(null,{vectorTile:new l.vectorTile.VectorTile(new l.pbf(D)),rawData:D,cacheControl:G,expires:K})});return()=>{S.cancel(),b()}}class He{constructor(b,S,k,D){this.actor=b,this.layerIndex=S,this.availableImages=k,this.loadVectorData=D||st,this.loading={},this.loaded={}}loadTile(b,S){const k=b.uid;this.loading||(this.loading={});const D=!!(b&&b.request&&b.request.collectResourceTiming)&&new l.RequestPerformance(b.request),G=this.loading[k]=new se(b);G.abort=this.loadVectorData(b,(K,W)=>{if(delete this.loading[k],K||!W)return G.status="done",this.loaded[k]=G,S(K);const q=W.rawData,J={};W.expires&&(J.expires=W.expires),W.cacheControl&&(J.cacheControl=W.cacheControl);const le={};if(D){const xe=D.finish();xe&&(le.resourceTiming=JSON.parse(JSON.stringify(xe)))}G.vectorTile=W.vectorTile,G.parse(W.vectorTile,this.layerIndex,this.availableImages,this.actor,(xe,ae)=>{if(xe||!ae)return S(xe);S(null,l.extend({rawTileData:q.slice(0)},ae,J,le))}),this.loaded=this.loaded||{},this.loaded[k]=G})}reloadTile(b,S){const k=this.loaded,D=b.uid,G=this;if(k&&k[D]){const K=k[D];K.showCollisionBoxes=b.showCollisionBoxes;const W=(q,J)=>{const le=K.reloadCallback;le&&(delete K.reloadCallback,K.parse(K.vectorTile,G.layerIndex,this.availableImages,G.actor,le)),S(q,J)};K.status==="parsing"?K.reloadCallback=W:K.status==="done"&&(K.vectorTile?K.parse(K.vectorTile,this.layerIndex,this.availableImages,this.actor,W):W())}}abortTile(b,S){const k=this.loading,D=b.uid;k&&k[D]&&k[D].abort&&(k[D].abort(),delete k[D]),S()}removeTile(b,S){const k=this.loaded,D=b.uid;k&&k[D]&&delete k[D],S()}}class _t{constructor(){this.loaded={}}loadTile(b,S){const{uid:k,encoding:D,rawImageData:G}=b,K=l.isImageBitmap(G)?this.getImageData(G):G,W=new l.DEMData(k,K,D);this.loaded=this.loaded||{},this.loaded[k]=W,S(null,W)}getImageData(b){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(b.width,b.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=b.width,this.offscreenCanvas.height=b.height,this.offscreenCanvasContext.drawImage(b,0,0,b.width,b.height);const S=this.offscreenCanvasContext.getImageData(-1,-1,b.width+2,b.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new l.RGBAImage({width:S.width,height:S.height},S.data)}removeTile(b){const S=this.loaded,k=b.uid;S&&S[k]&&delete S[k]}}var Mt=function R(b,S){var k,D=b&&b.type;if(D==="FeatureCollection")for(k=0;k<b.features.length;k++)R(b.features[k],S);else if(D==="GeometryCollection")for(k=0;k<b.geometries.length;k++)R(b.geometries[k],S);else if(D==="Feature")R(b.geometry,S);else if(D==="Polygon")ct(b.coordinates,S);else if(D==="MultiPolygon")for(k=0;k<b.coordinates.length;k++)ct(b.coordinates[k],S);return b};function ct(R,b){if(R.length!==0){bt(R[0],b);for(var S=1;S<R.length;S++)bt(R[S],!b)}}function bt(R,b){for(var S=0,k=0,D=0,G=R.length,K=G-1;D<G;K=D++){var W=(R[D][0]-R[K][0])*(R[K][1]+R[D][1]),q=S+W;k+=Math.abs(S)>=Math.abs(W)?S-q+W:W-q+S,S=q}S+k>=0!=!!b&&R.reverse()}const Si=l.vectorTile.VectorTileFeature.prototype.toGeoJSON;class Vt{constructor(b){this._feature=b,this.extent=l.EXTENT,this.type=b.type,this.properties=b.tags,"id"in b&&!isNaN(b.id)&&(this.id=parseInt(b.id,10))}loadGeometry(){if(this._feature.type===1){const b=[];for(const S of this._feature.geometry)b.push([new l.pointGeometry(S[0],S[1])]);return b}{const b=[];for(const S of this._feature.geometry){const k=[];for(const D of S)k.push(new l.pointGeometry(D[0],D[1]));b.push(k)}return b}}toGeoJSON(b,S,k){return Si.call(this,b,S,k)}}class Dt{constructor(b){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=l.EXTENT,this.length=b.length,this._features=b}feature(b){return new Vt(this._features[b])}}var Fi={exports:{}},_i=l.pointGeometry,vo=l.vectorTile.VectorTileFeature,ar=Nr;function Nr(R,b){this.options=b||{},this.features=R,this.length=R.length}function lr(R,b){this.id=typeof R.id=="number"?R.id:void 0,this.type=R.type,this.rawGeometry=R.type===1?[R.geometry]:R.geometry,this.properties=R.tags,this.extent=b||4096}Nr.prototype.feature=function(R){return new lr(this.features[R],this.options.extent)},lr.prototype.loadGeometry=function(){var R=this.rawGeometry;this.geometry=[];for(var b=0;b<R.length;b++){for(var S=R[b],k=[],D=0;D<S.length;D++)k.push(new _i(S[D][0],S[D][1]));this.geometry.push(k)}return this.geometry},lr.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var R=this.geometry,b=1/0,S=-1/0,k=1/0,D=-1/0,G=0;G<R.length;G++)for(var K=R[G],W=0;W<K.length;W++){var q=K[W];b=Math.min(b,q.x),S=Math.max(S,q.x),k=Math.min(k,q.y),D=Math.max(D,q.y)}return[b,k,S,D]},lr.prototype.toGeoJSON=vo.prototype.toGeoJSON;var cn=l.pbf,Tr=ar;function Er(R){var b=new cn;return function(S,k){for(var D in S.layers)k.writeMessage(3,We,S.layers[D])}(R,b),b.finish()}function We(R,b){var S;b.writeVarintField(15,R.version||1),b.writeStringField(1,R.name||""),b.writeVarintField(5,R.extent||4096);var k={keys:[],values:[],keycache:{},valuecache:{}};for(S=0;S<R.length;S++)k.feature=R.feature(S),b.writeMessage(2,cr,k);var D=k.keys;for(S=0;S<D.length;S++)b.writeStringField(3,D[S]);var G=k.values;for(S=0;S<G.length;S++)b.writeMessage(4,un,G[S])}function cr(R,b){var S=R.feature;S.id!==void 0&&b.writeVarintField(1,S.id),b.writeMessage(2,ur,R),b.writeVarintField(3,S.type),b.writeMessage(4,Gr,S)}function ur(R,b){var S=R.feature,k=R.keys,D=R.values,G=R.keycache,K=R.valuecache;for(var W in S.properties){var q=S.properties[W],J=G[W];if(q!==null){J===void 0&&(k.push(W),G[W]=J=k.length-1),b.writeVarint(J);var le=typeof q;le!=="string"&&le!=="boolean"&&le!=="number"&&(q=JSON.stringify(q));var xe=le+":"+q,ae=K[xe];ae===void 0&&(D.push(q),K[xe]=ae=D.length-1),b.writeVarint(ae)}}}function Gi(R,b){return(b<<3)+(7&R)}function qi(R){return R<<1^R>>31}function Gr(R,b){for(var S=R.loadGeometry(),k=R.type,D=0,G=0,K=S.length,W=0;W<K;W++){var q=S[W],J=1;k===1&&(J=q.length),b.writeVarint(Gi(1,J));for(var le=k===3?q.length-1:q.length,xe=0;xe<le;xe++){xe===1&&k!==1&&b.writeVarint(Gi(2,le-1));var ae=q[xe].x-D,Oe=q[xe].y-G;b.writeVarint(qi(ae)),b.writeVarint(qi(Oe)),D+=ae,G+=Oe}k===3&&b.writeVarint(Gi(7,1))}}function un(R,b){var S=typeof R;S==="string"?b.writeStringField(1,R):S==="boolean"?b.writeBooleanField(7,R):S==="number"&&(R%1!=0?b.writeDoubleField(3,R):R<0?b.writeSVarintField(6,R):b.writeVarintField(5,R))}function hn(R,b,S,k,D,G){if(D-k<=S)return;const K=k+D>>1;dn(R,b,K,k,D,G%2),hn(R,b,S,k,K-1,G+1),hn(R,b,S,K+1,D,G+1)}function dn(R,b,S,k,D,G){for(;D>k;){if(D-k>600){const J=D-k+1,le=S-k+1,xe=Math.log(J),ae=.5*Math.exp(2*xe/3),Oe=.5*Math.sqrt(xe*ae*(J-ae)/J)*(le-J/2<0?-1:1);dn(R,b,S,Math.max(k,Math.floor(S-le*ae/J+Oe)),Math.min(D,Math.floor(S+(J-le)*ae/J+Oe)),G)}const K=b[2*S+G];let W=k,q=D;for(Yi(R,b,k,S),b[2*D+G]>K&&Yi(R,b,k,D);W<q;){for(Yi(R,b,W,q),W++,q--;b[2*W+G]<K;)W++;for(;b[2*q+G]>K;)q--}b[2*k+G]===K?Yi(R,b,k,q):(q++,Yi(R,b,q,D)),q<=S&&(k=q+1),S<=q&&(D=q-1)}}function Yi(R,b,S,k){Sr(R,S,k),Sr(b,2*S,2*k),Sr(b,2*S+1,2*k+1)}function Sr(R,b,S){const k=R[b];R[b]=R[S],R[S]=k}function Ir(R,b,S,k){const D=R-S,G=b-k;return D*D+G*G}Fi.exports=Er,Fi.exports.fromVectorTileJs=Er,Fi.exports.fromGeojsonVt=function(R,b){b=b||{};var S={};for(var k in R)S[k]=new Tr(R[k].features,b),S[k].name=k,S[k].version=b.version,S[k].extent=b.extent;return Er({layers:S})},Fi.exports.GeoJSONWrapper=Tr;const Cr=R=>R[0],yi=R=>R[1];class pn{constructor(b,S=Cr,k=yi,D=64,G=Float64Array){this.nodeSize=D,this.points=b;const K=b.length<65536?Uint16Array:Uint32Array,W=this.ids=new K(b.length),q=this.coords=new G(2*b.length);for(let J=0;J<b.length;J++)W[J]=J,q[2*J]=S(b[J]),q[2*J+1]=k(b[J]);hn(W,q,D,0,W.length-1,0)}range(b,S,k,D){return function(G,K,W,q,J,le,xe){const ae=[0,G.length-1,0],Oe=[];let $e,De;for(;ae.length;){const Ze=ae.pop(),Xe=ae.pop(),pt=ae.pop();if(Xe-pt<=xe){for(let ft=pt;ft<=Xe;ft++)$e=K[2*ft],De=K[2*ft+1],$e>=W&&$e<=J&&De>=q&&De<=le&&Oe.push(G[ft]);continue}const Ke=Math.floor((pt+Xe)/2);$e=K[2*Ke],De=K[2*Ke+1],$e>=W&&$e<=J&&De>=q&&De<=le&&Oe.push(G[Ke]);const tt=(Ze+1)%2;(Ze===0?W<=$e:q<=De)&&(ae.push(pt),ae.push(Ke-1),ae.push(tt)),(Ze===0?J>=$e:le>=De)&&(ae.push(Ke+1),ae.push(Xe),ae.push(tt))}return Oe}(this.ids,this.coords,b,S,k,D,this.nodeSize)}within(b,S,k){return function(D,G,K,W,q,J){const le=[0,D.length-1,0],xe=[],ae=q*q;for(;le.length;){const Oe=le.pop(),$e=le.pop(),De=le.pop();if($e-De<=J){for(let tt=De;tt<=$e;tt++)Ir(G[2*tt],G[2*tt+1],K,W)<=ae&&xe.push(D[tt]);continue}const Ze=Math.floor((De+$e)/2),Xe=G[2*Ze],pt=G[2*Ze+1];Ir(Xe,pt,K,W)<=ae&&xe.push(D[Ze]);const Ke=(Oe+1)%2;(Oe===0?K-q<=Xe:W-q<=pt)&&(le.push(De),le.push(Ze-1),le.push(Ke)),(Oe===0?K+q>=Xe:W+q>=pt)&&(le.push(Ze+1),le.push($e),le.push(Ke))}return xe}(this.ids,this.coords,b,S,k,this.nodeSize)}}const Un={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:R=>R},hr=Math.fround||(Ii=new Float32Array(1),R=>(Ii[0]=+R,Ii[0]));var Ii;class $n{constructor(b){this.options=zr(Object.create(Un),b),this.trees=new Array(this.options.maxZoom+1)}load(b){const{log:S,minZoom:k,maxZoom:D,nodeSize:G}=this.options;S&&console.time("total time");const K=`prepare ${b.length} points`;S&&console.time(K),this.points=b;let W=[];for(let q=0;q<b.length;q++)b[q].geometry&&W.push(fn(b[q],q));this.trees[D+1]=new pn(W,Nn,dr,G,Float32Array),S&&console.timeEnd(K);for(let q=D;q>=k;q--){const J=+Date.now();W=this._cluster(W,q),this.trees[q]=new pn(W,Nn,dr,G,Float32Array),S&&console.log("z%d: %d clusters in %dms",q,W.length,+Date.now()-J)}return S&&console.timeEnd("total time"),this}getClusters(b,S){let k=((b[0]+180)%360+360)%360-180;const D=Math.max(-90,Math.min(90,b[1]));let G=b[2]===180?180:((b[2]+180)%360+360)%360-180;const K=Math.max(-90,Math.min(90,b[3]));if(b[2]-b[0]>=360)k=-180,G=180;else if(k>G){const le=this.getClusters([k,D,180,K],S),xe=this.getClusters([-180,D,G,K],S);return le.concat(xe)}const W=this.trees[this._limitZoom(S)],q=W.range(ht(k),Qi(K),ht(G),Qi(D)),J=[];for(const le of q){const xe=W.points[le];J.push(xe.numPoints?mn(xe):this.points[xe.index])}return J}getChildren(b){const S=this._getOriginId(b),k=this._getOriginZoom(b),D="No cluster with the specified id.",G=this.trees[k];if(!G)throw new Error(D);const K=G.points[S];if(!K)throw new Error(D);const W=this.options.radius/(this.options.extent*Math.pow(2,k-1)),q=G.within(K.x,K.y,W),J=[];for(const le of q){const xe=G.points[le];xe.parentId===b&&J.push(xe.numPoints?mn(xe):this.points[xe.index])}if(J.length===0)throw new Error(D);return J}getLeaves(b,S,k){const D=[];return this._appendLeaves(D,b,S=S||10,k=k||0,0),D}getTile(b,S,k){const D=this.trees[this._limitZoom(b)],G=Math.pow(2,b),{extent:K,radius:W}=this.options,q=W/K,J=(k-q)/G,le=(k+1+q)/G,xe={features:[]};return this._addTileFeatures(D.range((S-q)/G,J,(S+1+q)/G,le),D.points,S,k,G,xe),S===0&&this._addTileFeatures(D.range(1-q/G,J,1,le),D.points,G,k,G,xe),S===G-1&&this._addTileFeatures(D.range(0,J,q/G,le),D.points,-1,k,G,xe),xe.features.length?xe:null}getClusterExpansionZoom(b){let S=this._getOriginZoom(b)-1;for(;S<=this.options.maxZoom;){const k=this.getChildren(b);if(S++,k.length!==1)break;b=k[0].properties.cluster_id}return S}_appendLeaves(b,S,k,D,G){const K=this.getChildren(S);for(const W of K){const q=W.properties;if(q&&q.cluster?G+q.point_count<=D?G+=q.point_count:G=this._appendLeaves(b,q.cluster_id,k,D,G):G<D?G++:b.push(W),b.length===k)break}return G}_addTileFeatures(b,S,k,D,G,K){for(const W of b){const q=S[W],J=q.numPoints;let le,xe,ae;if(J)le=Vn(q),xe=q.x,ae=q.y;else{const De=this.points[q.index];le=De.properties,xe=ht(De.geometry.coordinates[0]),ae=Qi(De.geometry.coordinates[1])}const Oe={type:1,geometry:[[Math.round(this.options.extent*(xe*G-k)),Math.round(this.options.extent*(ae*G-D))]],tags:le};let $e;J?$e=q.id:this.options.generateId?$e=q.index:this.points[q.index].id&&($e=this.points[q.index].id),$e!==void 0&&(Oe.id=$e),K.features.push(Oe)}}_limitZoom(b){return Math.max(this.options.minZoom,Math.min(Math.floor(+b),this.options.maxZoom+1))}_cluster(b,S){const k=[],{radius:D,extent:G,reduce:K,minPoints:W}=this.options,q=D/(G*Math.pow(2,S));for(let J=0;J<b.length;J++){const le=b[J];if(le.zoom<=S)continue;le.zoom=S;const xe=this.trees[S+1],ae=xe.within(le.x,le.y,q),Oe=le.numPoints||1;let $e=Oe;for(const De of ae){const Ze=xe.points[De];Ze.zoom>S&&($e+=Ze.numPoints||1)}if($e>Oe&&$e>=W){let De=le.x*Oe,Ze=le.y*Oe,Xe=K&&Oe>1?this._map(le,!0):null;const pt=(J<<5)+(S+1)+this.points.length;for(const Ke of ae){const tt=xe.points[Ke];if(tt.zoom<=S)continue;tt.zoom=S;const ft=tt.numPoints||1;De+=tt.x*ft,Ze+=tt.y*ft,tt.parentId=pt,K&&(Xe||(Xe=this._map(le,!0)),K(Xe,this._map(tt)))}le.parentId=pt,k.push(Ar(De/$e,Ze/$e,pt,$e,Xe))}else if(k.push(le),$e>1)for(const De of ae){const Ze=xe.points[De];Ze.zoom<=S||(Ze.zoom=S,k.push(Ze))}}return k}_getOriginId(b){return b-this.points.length>>5}_getOriginZoom(b){return(b-this.points.length)%32}_map(b,S){if(b.numPoints)return S?zr({},b.properties):b.properties;const k=this.points[b.index].properties,D=this.options.map(k);return S&&D===k?zr({},D):D}}function Ar(R,b,S,k,D){return{x:hr(R),y:hr(b),zoom:1/0,id:S,parentId:-1,numPoints:k,properties:D}}function fn(R,b){const[S,k]=R.geometry.coordinates;return{x:hr(ht(S)),y:hr(Qi(k)),zoom:1/0,index:b,parentId:-1}}function mn(R){return{type:"Feature",id:R.id,properties:Vn(R),geometry:{type:"Point",coordinates:[(b=R.x,360*(b-.5)),Mr(R.y)]}};var b}function Vn(R){const b=R.numPoints,S=b>=1e4?`${Math.round(b/1e3)}k`:b>=1e3?Math.round(b/100)/10+"k":b;return zr(zr({},R.properties),{cluster:!0,cluster_id:R.id,point_count:b,point_count_abbreviated:S})}function ht(R){return R/360+.5}function Qi(R){const b=Math.sin(R*Math.PI/180),S=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return S<0?0:S>1?1:S}function Mr(R){const b=(180-360*R)*Math.PI/180;return 360*Math.atan(Math.exp(b))/Math.PI-90}function zr(R,b){for(const S in b)R[S]=b[S];return R}function Nn(R){return R.x}function dr(R){return R.y}function pr(R,b,S,k){for(var D,G=k,K=S-b>>1,W=S-b,q=R[b],J=R[b+1],le=R[S],xe=R[S+1],ae=b+3;ae<S;ae+=3){var Oe=gn(R[ae],R[ae+1],q,J,le,xe);if(Oe>G)D=ae,G=Oe;else if(Oe===G){var $e=Math.abs(ae-K);$e<W&&(D=ae,W=$e)}}G>k&&(D-b>3&&pr(R,b,D,k),R[D+2]=G,S-D>3&&pr(R,D,S,k))}function gn(R,b,S,k,D,G){var K=D-S,W=G-k;if(K!==0||W!==0){var q=((R-S)*K+(b-k)*W)/(K*K+W*W);q>1?(S=D,k=G):q>0&&(S+=K*q,k+=W*q)}return(K=R-S)*K+(W=b-k)*W}function fr(R,b,S,k){var D={id:R===void 0?null:R,type:b,geometry:S,tags:k,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(G){var K=G.geometry,W=G.type;if(W==="Point"||W==="MultiPoint"||W==="LineString")de(G,K);else if(W==="Polygon"||W==="MultiLineString")for(var q=0;q<K.length;q++)de(G,K[q]);else if(W==="MultiPolygon")for(q=0;q<K.length;q++)for(var J=0;J<K[q].length;J++)de(G,K[q][J])}(D),D}function de(R,b){for(var S=0;S<b.length;S+=3)R.minX=Math.min(R.minX,b[S]),R.minY=Math.min(R.minY,b[S+1]),R.maxX=Math.max(R.maxX,b[S]),R.maxY=Math.max(R.maxY,b[S+1])}function Ce(R,b,S,k){if(b.geometry){var D=b.geometry.coordinates,G=b.geometry.type,K=Math.pow(S.tolerance/((1<<S.maxZoom)*S.extent),2),W=[],q=b.id;if(S.promoteId?q=b.properties[S.promoteId]:S.generateId&&(q=k||0),G==="Point")qr(D,W);else if(G==="MultiPoint")for(var J=0;J<D.length;J++)qr(D[J],W);else if(G==="LineString")Zi(D,W,K,!1);else if(G==="MultiLineString"){if(S.lineMetrics){for(J=0;J<D.length;J++)Zi(D[J],W=[],K,!1),R.push(fr(q,"LineString",W,b.properties));return}dt(D,W,K,!1)}else if(G==="Polygon")dt(D,W,K,!0);else{if(G!=="MultiPolygon"){if(G==="GeometryCollection"){for(J=0;J<b.geometry.geometries.length;J++)Ce(R,{id:q,geometry:b.geometry.geometries[J],properties:b.properties},S,k);return}throw new Error("Input data is not a valid GeoJSON object.")}for(J=0;J<D.length;J++){var le=[];dt(D[J],le,K,!0),W.push(le)}}R.push(fr(q,G,W,b.properties))}}function qr(R,b){b.push(Oi(R[0])),b.push(Ci(R[1])),b.push(0)}function Zi(R,b,S,k){for(var D,G,K=0,W=0;W<R.length;W++){var q=Oi(R[W][0]),J=Ci(R[W][1]);b.push(q),b.push(J),b.push(0),W>0&&(K+=k?(D*J-q*G)/2:Math.sqrt(Math.pow(q-D,2)+Math.pow(J-G,2))),D=q,G=J}var le=b.length-3;b[2]=1,pr(b,0,le,S),b[le+2]=1,b.size=Math.abs(K),b.start=0,b.end=b.size}function dt(R,b,S,k){for(var D=0;D<R.length;D++){var G=[];Zi(R[D],G,S,k),b.push(G)}}function Oi(R){return R/360+.5}function Ci(R){var b=Math.sin(R*Math.PI/180),S=.5-.25*Math.log((1+b)/(1-b))/Math.PI;return S<0?0:S>1?1:S}function Ai(R,b,S,k,D,G,K,W){if(k/=b,G>=(S/=b)&&K<k)return R;if(K<S||G>=k)return null;for(var q=[],J=0;J<R.length;J++){var le=R[J],xe=le.geometry,ae=le.type,Oe=D===0?le.minX:le.minY,$e=D===0?le.maxX:le.maxY;if(Oe>=S&&$e<k)q.push(le);else if(!($e<S||Oe>=k)){var De=[];if(ae==="Point"||ae==="MultiPoint")Pr(xe,De,S,k,D);else if(ae==="LineString")Ee(xe,De,S,k,D,!1,W.lineMetrics);else if(ae==="MultiLineString")Ye(xe,De,S,k,D,!1);else if(ae==="Polygon")Ye(xe,De,S,k,D,!0);else if(ae==="MultiPolygon")for(var Ze=0;Ze<xe.length;Ze++){var Xe=[];Ye(xe[Ze],Xe,S,k,D,!0),Xe.length&&De.push(Xe)}if(De.length){if(W.lineMetrics&&ae==="LineString"){for(Ze=0;Ze<De.length;Ze++)q.push(fr(le.id,ae,De[Ze],le.tags));continue}ae!=="LineString"&&ae!=="MultiLineString"||(De.length===1?(ae="LineString",De=De[0]):ae="MultiLineString"),ae!=="Point"&&ae!=="MultiPoint"||(ae=De.length===3?"Point":"MultiPoint"),q.push(fr(le.id,ae,De,le.tags))}}}return q.length?q:null}function Pr(R,b,S,k,D){for(var G=0;G<R.length;G+=3){var K=R[G+D];K>=S&&K<=k&&(b.push(R[G]),b.push(R[G+1]),b.push(R[G+2]))}}function Ee(R,b,S,k,D,G,K){for(var W,q,J=et(R),le=D===0?kr:Je,xe=R.start,ae=0;ae<R.length-3;ae+=3){var Oe=R[ae],$e=R[ae+1],De=R[ae+2],Ze=R[ae+3],Xe=R[ae+4],pt=D===0?Oe:$e,Ke=D===0?Ze:Xe,tt=!1;K&&(W=Math.sqrt(Math.pow(Oe-Ze,2)+Math.pow($e-Xe,2))),pt<S?Ke>S&&(q=le(J,Oe,$e,Ze,Xe,S),K&&(J.start=xe+W*q)):pt>k?Ke<k&&(q=le(J,Oe,$e,Ze,Xe,k),K&&(J.start=xe+W*q)):oi(J,Oe,$e,De),Ke<S&&pt>=S&&(q=le(J,Oe,$e,Ze,Xe,S),tt=!0),Ke>k&&pt<=k&&(q=le(J,Oe,$e,Ze,Xe,k),tt=!0),!G&&tt&&(K&&(J.end=xe+W*q),b.push(J),J=et(R)),K&&(xe+=W)}var ft=R.length-3;Oe=R[ft],$e=R[ft+1],De=R[ft+2],(pt=D===0?Oe:$e)>=S&&pt<=k&&oi(J,Oe,$e,De),ft=J.length-3,G&&ft>=3&&(J[ft]!==J[0]||J[ft+1]!==J[1])&&oi(J,J[0],J[1],J[2]),J.length&&b.push(J)}function et(R){var b=[];return b.size=R.size,b.start=R.start,b.end=R.end,b}function Ye(R,b,S,k,D,G){for(var K=0;K<R.length;K++)Ee(R[K],b,S,k,D,G,!1)}function oi(R,b,S,k){R.push(b),R.push(S),R.push(k)}function kr(R,b,S,k,D,G){var K=(G-b)/(k-b);return R.push(G),R.push(S+(D-S)*K),R.push(1),K}function Je(R,b,S,k,D,G){var K=(G-S)/(D-S);return R.push(b+(k-b)*K),R.push(G),R.push(1),K}function mr(R,b){for(var S=[],k=0;k<R.length;k++){var D,G=R[k],K=G.type;if(K==="Point"||K==="MultiPoint"||K==="LineString")D=Yt(G.geometry,b);else if(K==="MultiLineString"||K==="Polygon"){D=[];for(var W=0;W<G.geometry.length;W++)D.push(Yt(G.geometry[W],b))}else if(K==="MultiPolygon")for(D=[],W=0;W<G.geometry.length;W++){for(var q=[],J=0;J<G.geometry[W].length;J++)q.push(Yt(G.geometry[W][J],b));D.push(q)}S.push(fr(G.id,K,D,G.tags))}return S}function Yt(R,b){var S=[];S.size=R.size,R.start!==void 0&&(S.start=R.start,S.end=R.end);for(var k=0;k<R.length;k+=3)S.push(R[k]+b,R[k+1],R[k+2]);return S}function _n(R,b){if(R.transformed)return R;var S,k,D,G=1<<R.z,K=R.x,W=R.y;for(S=0;S<R.features.length;S++){var q=R.features[S],J=q.geometry,le=q.type;if(q.geometry=[],le===1)for(k=0;k<J.length;k+=2)q.geometry.push(Zt(J[k],J[k+1],b,G,K,W));else for(k=0;k<J.length;k++){var xe=[];for(D=0;D<J[k].length;D+=2)xe.push(Zt(J[k][D],J[k][D+1],b,G,K,W));q.geometry.push(xe)}}return R.transformed=!0,R}function Zt(R,b,S,k,D,G){return[Math.round(S*(R*k-D)),Math.round(S*(b*k-G))]}function pi(R,b,S,k,D){for(var G=b===D.maxZoom?0:D.tolerance/((1<<b)*D.extent),K={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:S,y:k,z:b,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},W=0;W<R.length;W++){K.numFeatures++,Et(K,R[W],G,D);var q=R[W].minX,J=R[W].minY,le=R[W].maxX,xe=R[W].maxY;q<K.minX&&(K.minX=q),J<K.minY&&(K.minY=J),le>K.maxX&&(K.maxX=le),xe>K.maxY&&(K.maxY=xe)}return K}function Et(R,b,S,k){var D=b.geometry,G=b.type,K=[];if(G==="Point"||G==="MultiPoint")for(var W=0;W<D.length;W+=3)K.push(D[W]),K.push(D[W+1]),R.numPoints++,R.numSimplified++;else if(G==="LineString")yn(K,D,R,S,!1,!1);else if(G==="MultiLineString"||G==="Polygon")for(W=0;W<D.length;W++)yn(K,D[W],R,S,G==="Polygon",W===0);else if(G==="MultiPolygon")for(var q=0;q<D.length;q++){var J=D[q];for(W=0;W<J.length;W++)yn(K,J[W],R,S,!0,W===0)}if(K.length){var le=b.tags||null;if(G==="LineString"&&k.lineMetrics){for(var xe in le={},b.tags)le[xe]=b.tags[xe];le.mapbox_clip_start=D.start/D.size,le.mapbox_clip_end=D.end/D.size}var ae={geometry:K,type:G==="Polygon"||G==="MultiPolygon"?3:G==="LineString"||G==="MultiLineString"?2:1,tags:le};b.id!==null&&(ae.id=b.id),R.features.push(ae)}}function yn(R,b,S,k,D,G){var K=k*k;if(k>0&&b.size<(D?K:k))S.numPoints+=b.length/3;else{for(var W=[],q=0;q<b.length;q+=3)(k===0||b[q+2]>K)&&(S.numSimplified++,W.push(b[q]),W.push(b[q+1])),S.numPoints++;D&&function(J,le){for(var xe=0,ae=0,Oe=J.length,$e=Oe-2;ae<Oe;$e=ae,ae+=2)xe+=(J[ae]-J[$e])*(J[ae+1]+J[$e+1]);if(xe>0===le)for(ae=0,Oe=J.length;ae<Oe/2;ae+=2){var De=J[ae],Ze=J[ae+1];J[ae]=J[Oe-2-ae],J[ae+1]=J[Oe-1-ae],J[Oe-2-ae]=De,J[Oe-1-ae]=Ze}}(W,G),R.push(W)}}function er(R,b){var S=(b=this.options=function(D,G){for(var K in G)D[K]=G[K];return D}(Object.create(this.options),b)).debug;if(S&&console.time("preprocess data"),b.maxZoom<0||b.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(b.promoteId&&b.generateId)throw new Error("promoteId and generateId cannot be used together.");var k=function(D,G){var K=[];if(D.type==="FeatureCollection")for(var W=0;W<D.features.length;W++)Ce(K,D.features[W],G,W);else Ce(K,D.type==="Feature"?D:{geometry:D},G);return K}(R,b);this.tiles={},this.tileCoords=[],S&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",b.indexMaxZoom,b.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),k=function(D,G){var K=G.buffer/G.extent,W=D,q=Ai(D,1,-1-K,K,0,-1,2,G),J=Ai(D,1,1-K,2+K,0,-1,2,G);return(q||J)&&(W=Ai(D,1,-K,1+K,0,-1,2,G)||[],q&&(W=mr(q,1).concat(W)),J&&(W=W.concat(mr(J,-1)))),W}(k,b),k.length&&this.splitTile(k,0,0,0),S&&(k.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Zr(R,b,S){return 32*((1<<R)*S+b)+R}function jr(R,b){const S=R.tileID.canonical;if(!this._geoJSONIndex)return b(null,null);const k=this._geoJSONIndex.getTile(S.z,S.x,S.y);if(!k)return b(null,null);const D=new Dt(k.features);let G=Fi.exports(D);G.byteOffset===0&&G.byteLength===G.buffer.byteLength||(G=new Uint8Array(G)),b(null,{vectorTile:D,rawData:G.buffer})}er.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},er.prototype.splitTile=function(R,b,S,k,D,G,K){for(var W=[R,b,S,k],q=this.options,J=q.debug;W.length;){k=W.pop(),S=W.pop(),b=W.pop(),R=W.pop();var le=1<<b,xe=Zr(b,S,k),ae=this.tiles[xe];if(!ae&&(J>1&&console.time("creation"),ae=this.tiles[xe]=pi(R,b,S,k,q),this.tileCoords.push({z:b,x:S,y:k}),J)){J>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",b,S,k,ae.numFeatures,ae.numPoints,ae.numSimplified),console.timeEnd("creation"));var Oe="z"+b;this.stats[Oe]=(this.stats[Oe]||0)+1,this.total++}if(ae.source=R,D){if(b===q.maxZoom||b===D)continue;var $e=1<<D-b;if(S!==Math.floor(G/$e)||k!==Math.floor(K/$e))continue}else if(b===q.indexMaxZoom||ae.numPoints<=q.indexMaxPoints)continue;if(ae.source=null,R.length!==0){J>1&&console.time("clipping");var De,Ze,Xe,pt,Ke,tt,ft=.5*q.buffer/q.extent,It=.5-ft,Qt=.5+ft,Lt=1+ft;De=Ze=Xe=pt=null,Ke=Ai(R,le,S-ft,S+Qt,0,ae.minX,ae.maxX,q),tt=Ai(R,le,S+It,S+Lt,0,ae.minX,ae.maxX,q),R=null,Ke&&(De=Ai(Ke,le,k-ft,k+Qt,1,ae.minY,ae.maxY,q),Ze=Ai(Ke,le,k+It,k+Lt,1,ae.minY,ae.maxY,q),Ke=null),tt&&(Xe=Ai(tt,le,k-ft,k+Qt,1,ae.minY,ae.maxY,q),pt=Ai(tt,le,k+It,k+Lt,1,ae.minY,ae.maxY,q),tt=null),J>1&&console.timeEnd("clipping"),W.push(De||[],b+1,2*S,2*k),W.push(Ze||[],b+1,2*S,2*k+1),W.push(Xe||[],b+1,2*S+1,2*k),W.push(pt||[],b+1,2*S+1,2*k+1)}}},er.prototype.getTile=function(R,b,S){var k=this.options,D=k.extent,G=k.debug;if(R<0||R>24)return null;var K=1<<R,W=Zr(R,b=(b%K+K)%K,S);if(this.tiles[W])return _n(this.tiles[W],D);G>1&&console.log("drilling down to z%d-%d-%d",R,b,S);for(var q,J=R,le=b,xe=S;!q&&J>0;)J--,le=Math.floor(le/2),xe=Math.floor(xe/2),q=this.tiles[Zr(J,le,xe)];return q&&q.source?(G>1&&console.log("found parent tile z%d-%d-%d",J,le,xe),G>1&&console.time("drilling down"),this.splitTile(q.source,J,le,xe,R,b,S),G>1&&console.timeEnd("drilling down"),this.tiles[W]?_n(this.tiles[W],D):null):null};class xn extends He{constructor(b,S,k,D){super(b,S,k,jr),D&&(this.loadGeoJSON=D)}loadData(b,S){var k;(k=this._pendingRequest)===null||k===void 0||k.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const D=!!(b&&b.request&&b.request.collectResourceTiming)&&new l.RequestPerformance(b.request);this._pendingCallback=S,this._pendingRequest=this.loadGeoJSON(b,(G,K)=>{if(delete this._pendingCallback,delete this._pendingRequest,G||!K)return S(G);if(typeof K!="object")return S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));{Mt(K,!0);try{if(b.filter){const q=l.createExpression(b.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(q.result==="error")throw new Error(q.value.map(le=>`${le.key}: ${le.message}`).join(", "));const J=K.features.filter(le=>q.value.evaluate({zoom:0},le));K={type:"FeatureCollection",features:J}}this._geoJSONIndex=b.cluster?new $n(function({superclusterOptions:q,clusterProperties:J}){if(!J||!q)return q;const le={},xe={},ae={accumulated:null,zoom:0},Oe={properties:null},$e=Object.keys(J);for(const De of $e){const[Ze,Xe]=J[De],pt=l.createExpression(Xe),Ke=l.createExpression(typeof Ze=="string"?[Ze,["accumulated"],["get",De]]:Ze);le[De]=pt.value,xe[De]=Ke.value}return q.map=De=>{Oe.properties=De;const Ze={};for(const Xe of $e)Ze[Xe]=le[Xe].evaluate(ae,Oe);return Ze},q.reduce=(De,Ze)=>{Oe.properties=Ze;for(const Xe of $e)ae.accumulated=De[Xe],De[Xe]=xe[Xe].evaluate(ae,Oe)},q}(b)).load(K.features):function(q,J){return new er(q,J)}(K,b.geojsonVtOptions)}catch(q){return S(q)}this.loaded={};const W={};if(D){const q=D.finish();q&&(W.resourceTiming={},W.resourceTiming[b.source]=JSON.parse(JSON.stringify(q)))}S(null,W)}})}reloadTile(b,S){const k=this.loaded;return k&&k[b.uid]?super.reloadTile(b,S):this.loadTile(b,S)}loadGeoJSON(b,S){if(b.request)return l.getJSON(b.request,S);if(typeof b.data=="string")try{S(null,JSON.parse(b.data))}catch{S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`))}else S(new Error(`Input data given to '${b.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(b,S){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),S()}getClusterExpansionZoom(b,S){try{S(null,this._geoJSONIndex.getClusterExpansionZoom(b.clusterId))}catch(k){S(k)}}getClusterChildren(b,S){try{S(null,this._geoJSONIndex.getChildren(b.clusterId))}catch(k){S(k)}}getClusterLeaves(b,S){try{S(null,this._geoJSONIndex.getLeaves(b.clusterId,b.limit,b.offset))}catch(k){S(k)}}}class Xr{constructor(b){this.self=b,this.actor=new l.Actor(b,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:He,geojson:xn},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(S,k)=>{if(this.workerSourceTypes[S])throw new Error(`Worker source with name "${S}" already registered.`);this.workerSourceTypes[S]=k},this.self.registerRTLTextPlugin=S=>{if(l.plugin.isParsed())throw new Error("RTL text plugin already registered.");l.plugin.applyArabicShaping=S.applyArabicShaping,l.plugin.processBidirectionalText=S.processBidirectionalText,l.plugin.processStyledBidirectionalText=S.processStyledBidirectionalText}}setReferrer(b,S){this.referrer=S}setImages(b,S,k){this.availableImages[b]=S;for(const D in this.workerSources[b]){const G=this.workerSources[b][D];for(const K in G)G[K].availableImages=S}k()}setLayers(b,S,k){this.getLayerIndex(b).replace(S),k()}updateLayers(b,S,k){this.getLayerIndex(b).update(S.layers,S.removedIds),k()}loadTile(b,S,k){this.getWorkerSource(b,S.type,S.source).loadTile(S,k)}loadDEMTile(b,S,k){this.getDEMWorkerSource(b,S.source).loadTile(S,k)}reloadTile(b,S,k){this.getWorkerSource(b,S.type,S.source).reloadTile(S,k)}abortTile(b,S,k){this.getWorkerSource(b,S.type,S.source).abortTile(S,k)}removeTile(b,S,k){this.getWorkerSource(b,S.type,S.source).removeTile(S,k)}removeDEMTile(b,S){this.getDEMWorkerSource(b,S.source).removeTile(S)}removeSource(b,S,k){if(!this.workerSources[b]||!this.workerSources[b][S.type]||!this.workerSources[b][S.type][S.source])return;const D=this.workerSources[b][S.type][S.source];delete this.workerSources[b][S.type][S.source],D.removeSource!==void 0?D.removeSource(S,k):k()}loadWorkerSource(b,S,k){try{this.self.importScripts(S.url),k()}catch(D){k(D.toString())}}syncRTLPluginState(b,S,k){try{l.plugin.setState(S);const D=l.plugin.getPluginURL();if(l.plugin.isLoaded()&&!l.plugin.isParsed()&&D!=null){this.self.importScripts(D);const G=l.plugin.isParsed();k(G?void 0:new Error(`RTL Text Plugin failed to import scripts from ${D}`),G)}}catch(D){k(D.toString())}}getAvailableImages(b){let S=this.availableImages[b];return S||(S=[]),S}getLayerIndex(b){let S=this.layerIndexes[b];return S||(S=this.layerIndexes[b]=new Me),S}getWorkerSource(b,S,k){if(this.workerSources[b]||(this.workerSources[b]={}),this.workerSources[b][S]||(this.workerSources[b][S]={}),!this.workerSources[b][S][k]){const D={send:(G,K,W)=>{this.actor.send(G,K,W,b)}};this.workerSources[b][S][k]=new this.workerSourceTypes[S](D,this.getLayerIndex(b),this.getAvailableImages(b))}return this.workerSources[b][S][k]}getDEMWorkerSource(b,S){return this.demWorkerSources[b]||(this.demWorkerSources[b]={}),this.demWorkerSources[b][S]||(this.demWorkerSources[b][S]=new _t),this.demWorkerSources[b][S]}enforceCacheSizeLimit(b,S){l.enforceCacheSizeLimit(S)}}return l.isWorker()&&(self.worker=new Xr(self)),Xr}),X(["./shared"],function(l){var ye=pe;function pe(a){return!function(t){return typeof window=="undefined"||typeof document=="undefined"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var s,u,d=new Blob([""],{type:"text/javascript"}),f=URL.createObjectURL(d);try{u=new Worker(f),s=!0}catch{s=!1}return u&&u.terminate(),URL.revokeObjectURL(f),s}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var s=document.createElement("canvas");s.width=s.height=1;var u=s.getContext("2d");if(!u)return!1;var d=u.getImageData(0,0,1,1);return d&&d.width===s.width}()?(Me[n=t&&t.failIfMajorPerformanceCaveat]===void 0&&(Me[n]=function(s){var u,d=function(f){var _=document.createElement("canvas"),y=Object.create(pe.webGLContextAttributes);return y.failIfMajorPerformanceCaveat=f,_.getContext("webgl",y)||_.getContext("experimental-webgl",y)}(s);if(!d)return!1;try{u=d.createShader(d.VERTEX_SHADER)}catch{return!1}return!(!u||d.isContextLost())&&(d.shaderSource(u,"void main() {}"),d.compileShader(u),d.getShaderParameter(u,d.COMPILE_STATUS)===!0)}(n)),Me[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var n}(a)}var Me={};function we(a,t){if(Array.isArray(a)){if(!Array.isArray(t)||a.length!==t.length)return!1;for(let n=0;n<a.length;n++)if(!we(a[n],t[n]))return!1;return!0}if(typeof a=="object"&&a!==null&&t!==null){if(typeof t!="object"||Object.keys(a).length!==Object.keys(t).length)return!1;for(const n in a)if(!we(a[n],t[n]))return!1;return!0}return a===t}pe.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};class se{static testProp(t){if(!se.docStyle)return t[0];for(let n=0;n<t.length;n++)if(t[n]in se.docStyle)return t[n];return t[0]}static create(t,n,s){const u=window.document.createElement(t);return n!==void 0&&(u.className=n),s&&s.appendChild(u),u}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){se.docStyle&&se.selectProp&&(se.userSelect=se.docStyle[se.selectProp],se.docStyle[se.selectProp]="none")}static enableDrag(){se.docStyle&&se.selectProp&&(se.docStyle[se.selectProp]=se.userSelect)}static setTransform(t,n){t.style[se.transformProp]=n}static addEventListener(t,n,s,u={}){t.addEventListener(n,s,"passive"in u?u:u.capture)}static removeEventListener(t,n,s,u={}){t.removeEventListener(n,s,"passive"in u?u:u.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",se.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",se.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",se.suppressClickInternal,!0)},0)}static mousePos(t,n){const s=t.getBoundingClientRect();return new l.pointGeometry(n.clientX-s.left-t.clientLeft,n.clientY-s.top-t.clientTop)}static touchPos(t,n){const s=t.getBoundingClientRect(),u=[];for(let d=0;d<n.length;d++)u.push(new l.pointGeometry(n[d].clientX-s.left-t.clientLeft,n[d].clientY-s.top-t.clientTop));return u}static mouseButton(t){return t.button}static remove(t){t.parentNode&&t.parentNode.removeChild(t)}}se.docStyle=typeof window!="undefined"&&window.document&&window.document.documentElement.style,se.selectProp=se.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),se.transformProp=se.testProp(["transform","WebkitTransform"]);class gt{constructor(t){this._transformRequestFn=t}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeSpriteURL(t,n,s){const u=function(d){const f=d.match(st);if(!f)throw new Error(`Unable to parse URL "${d}"`);return{protocol:f[1],authority:f[2],path:f[3]||"/",params:f[4]?f[4].split("&"):[]}}(t);return u.path+=`${n}${s}`,function(d){const f=d.params.length?`?${d.params.join("&")}`:"";return`${d.protocol}://${d.authority}${d.path}${f}`}(u)}setTransformRequest(t){this._transformRequestFn=t}}const st=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;class He{constructor(t,n,s,u){this.context=t,this.format=s,this.texture=t.gl.createTexture(),this.update(n,u)}update(t,n,s){const{width:u,height:d}=t,f=!(this.size&&this.size[0]===u&&this.size[1]===d||s),{context:_}=this,{gl:y}=_;if(this.useMipmap=Boolean(n&&n.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!n||n.premultiply!==!1)),f)this.size=[u,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.isImageBitmap(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,u,d,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:v,y:T}=s||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||l.isImageBitmap(t)?y.texSubImage2D(y.TEXTURE_2D,0,v,T,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,v,T,u,d,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D)}bind(t,n,s){const{context:u}=this,{gl:d}=u;d.bindTexture(d.TEXTURE_2D,this.texture),s!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,s||t),this.filter=t),n!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,n),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,n),this.wrap=n)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}function _t(a){const{userImage:t}=a;return!!(t&&t.render&&t.render())&&(a.data.replace(new Uint8Array(t.data.buffer)),!0)}class Mt extends l.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.RGBAImage({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,callback:s}of this.requestors)this._notify(n,s);this.requestors=[]}}getImage(t){return this.images[t]}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let s=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "stretchX" value`))),s=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "stretchY" value`))),s=!1),this._validateContent(n.content,n)||(this.fire(new l.ErrorEvent(new Error(`Image "${t}" has invalid "content" value`))),s=!1),s}_validateStretch(t,n){if(!t)return!0;let s=0;for(const u of t){if(u[0]<s||u[1]<u[0]||n<u[1])return!1;s=u[1]}return!0}_validateContent(t,n){return!(t&&(t.length!==4||t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3]||t[2]<t[0]||t[3]<t[1]))}updateImage(t,n){const s=this.images[t];if(s.data.width!==n.data.width||s.data.height!==n.data.height)throw new Error(`size mismatch between old image (${s.data.width}x${s.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=s.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t,n){let s=!0;if(!this.isLoaded())for(const u of t)this.images[u]||(s=!1);this.isLoaded()||s?this._notify(t,n):this.requestors.push({ids:t,callback:n})}_notify(t,n){const s={};for(const u of t){this.images[u]||this.fire(new l.Event("styleimagemissing",{id:u}));const d=this.images[u];d?s[u]={data:d.data.clone(),pixelRatio:d.pixelRatio,sdf:d.sdf,version:d.version,stretchX:d.stretchX,stretchY:d.stretchY,content:d.content,hasRenderCallback:Boolean(d.userImage&&d.userImage.render)}:l.warnOnce(`Image "${u}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}n(null,s)}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],s=this.getImage(t);if(!s)return null;if(n&&n.position.version===s.version)return n.position;if(n)n.position.version=s.version;else{const u={w:s.data.width+2,h:s.data.height+2,x:0,y:0},d=new l.ImagePosition(u,s);this.patterns[t]={bin:u,position:d}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new He(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const d in this.patterns)t.push(this.patterns[d].bin);const{w:n,h:s}=l.potpack(t),u=this.atlasImage;u.resize({width:n||1,height:s||1});for(const d in this.patterns){const{bin:f}=this.patterns[d],_=f.x+1,y=f.y+1,v=this.images[d].data,T=v.width,I=v.height;l.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y},{width:T,height:I}),l.RGBAImage.copy(v,u,{x:0,y:I-1},{x:_,y:y-1},{width:T,height:1}),l.RGBAImage.copy(v,u,{x:0,y:0},{x:_,y:y+I},{width:T,height:1}),l.RGBAImage.copy(v,u,{x:T-1,y:0},{x:_-1,y},{width:1,height:I}),l.RGBAImage.copy(v,u,{x:0,y:0},{x:_+T,y},{width:1,height:I})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const s=this.images[n];s||l.warnOnce(`Image with ID: "${n}" was not found`),_t(s)&&this.updateImage(n,s)}}}const ct=1e20;function bt(a,t,n,s,u,d,f,_,y){for(let v=t;v<t+s;v++)Si(a,n*d+v,d,u,f,_,y);for(let v=n;v<n+u;v++)Si(a,v*d+t,1,s,f,_,y)}function Si(a,t,n,s,u,d,f){d[0]=0,f[0]=-ct,f[1]=ct,u[0]=a[t];for(let _=1,y=0,v=0;_<s;_++){u[_]=a[t+_*n];const T=_*_;do{const I=d[y];v=(u[_]-u[I]+T-I*I)/(_-I)/2}while(v<=f[y]&&--y>-1);y++,d[y]=_,f[y]=v,f[y+1]=ct}for(let _=0,y=0;_<s;_++){for(;f[y+1]<_;)y++;const v=d[y],T=_-v;a[t+_*n]=u[v]+T*T}}class Vt{constructor(t,n){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={}}setURL(t){this.url=t}getGlyphs(t,n){const s=[];for(const u in t)for(const d of t[u])s.push({stack:u,id:d});l.asyncAll(s,({stack:u,id:d},f)=>{let _=this.entries[u];_||(_=this.entries[u]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[d];if(y!==void 0)return void f(null,{stack:u,id:d,glyph:y});if(y=this._tinySDF(_,u,d),y)return _.glyphs[d]=y,void f(null,{stack:u,id:d,glyph:y});const v=Math.floor(d/256);if(256*v>65535)return void f(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void f(null,{stack:u,id:d,glyph:y});let T=_.requests[v];T||(T=_.requests[v]=[],Vt.loadGlyphRange(u,v,this.url,this.requestManager,(I,M)=>{if(M){for(const U in M)this._doesCharSupportLocalGlyph(+U)||(_.glyphs[+U]=M[+U]);_.ranges[v]=!0}for(const U of T)U(I,M);delete _.requests[v]})),T.push((I,M)=>{I?f(I):M&&f(null,{stack:u,id:d,glyph:M[d]||null})})},(u,d)=>{if(u)n(u);else if(d){const f={};for(const{stack:_,id:y,glyph:v}of d)(f[_]||(f[_]={}))[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics};n(null,f)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(l.unicodeBlockLookup["CJK Unified Ideographs"](t)||l.unicodeBlockLookup["Hangul Syllables"](t)||l.unicodeBlockLookup.Hiragana(t)||l.unicodeBlockLookup.Katakana(t))}_tinySDF(t,n,s){const u=this.localIdeographFontFamily;if(!u||!this._doesCharSupportLocalGlyph(s))return;let d=t.tinySDF;if(!d){let _="400";/bold/i.test(n)?_="900":/medium/i.test(n)?_="500":/light/i.test(n)&&(_="200"),d=t.tinySDF=new Vt.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:u,fontWeight:_})}const f=d.draw(String.fromCharCode(s));return{id:s,bitmap:new l.AlphaImage({width:f.width||30,height:f.height||30},f.data),metrics:{width:f.glyphWidth||24,height:f.glyphHeight||24,left:f.glyphLeft||0,top:f.glyphTop-27||-8,advance:f.glyphAdvance||24}}}}Vt.loadGlyphRange=function(a,t,n,s,u){const d=256*t,f=d+255,_=s.transformRequest(n.replace("{fontstack}",a).replace("{range}",`${d}-${f}`),l.ResourceType.Glyphs);l.getArrayBuffer(_,(y,v)=>{if(y)u(y);else if(v){const T={};for(const I of l.parseGlyphPbf(v))T[I.id]=I;u(null,T)}})},Vt.TinySDF=class{constructor({fontSize:a=24,buffer:t=3,radius:n=8,cutoff:s=.25,fontFamily:u="sans-serif",fontWeight:d="normal",fontStyle:f="normal"}={}){this.buffer=t,this.cutoff=s,this.radius=n;const _=this.size=a+4*t,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${f} ${d} ${a}px ${u}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(a){const t=document.createElement("canvas");return t.width=t.height=a,t}draw(a){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:s,actualBoundingBoxLeft:u,actualBoundingBoxRight:d}=this.ctx.measureText(a),f=Math.ceil(n),_=Math.min(this.size-this.buffer,Math.ceil(d-u)),y=Math.min(this.size-this.buffer,f+Math.ceil(s)),v=_+2*this.buffer,T=y+2*this.buffer,I=Math.max(v*T,0),M=new Uint8ClampedArray(I),U={data:M,width:v,height:T,glyphWidth:_,glyphHeight:y,glyphTop:f,glyphLeft:0,glyphAdvance:t};if(_===0||y===0)return U;const{ctx:F,buffer:O,gridInner:H,gridOuter:Y}=this;F.clearRect(O,O,_,y),F.fillText(a,O,O+f);const te=F.getImageData(O,O,_,y);Y.fill(ct,0,I),H.fill(0,0,I);for(let $=0;$<y;$++)for(let ne=0;ne<_;ne++){const ie=te.data[4*($*_+ne)+3]/255;if(ie===0)continue;const ue=($+O)*v+ne+O;if(ie===1)Y[ue]=0,H[ue]=ct;else{const he=.5-ie;Y[ue]=he>0?he*he:0,H[ue]=he<0?he*he:0}}bt(Y,0,0,v,T,v,this.f,this.v,this.z),bt(H,O,O,_,y,v,this.f,this.v,this.z);for(let $=0;$<I;$++){const ne=Math.sqrt(Y[$])-Math.sqrt(H[$]);M[$]=Math.round(255-255*(ne/this.radius+this.cutoff))}return U}};const Dt=new l.Properties({anchor:new l.DataConstantProperty(l.spec.light.anchor),position:new class{constructor(){this.specification=l.spec.light.position}possiblyEvaluate(a,t){return l.sphericalToCartesian(a.expression.evaluate(t))}interpolate(a,t,n){return{x:l.number(a.x,t.x,n),y:l.number(a.y,t.y,n),z:l.number(a.z,t.z,n)}}},color:new l.DataConstantProperty(l.spec.light.color),intensity:new l.DataConstantProperty(l.spec.light.intensity)}),Fi="-transition";class _i extends l.Evented{constructor(t){super(),this._transitionable=new l.Transitionable(Dt),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(l.validateLight,t,n))for(const s in t){const u=t[s];s.endsWith(Fi)?this._transitionable.setTransition(s.slice(0,-Fi.length),u):this._transitionable.setValue(s,u)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,s){return(!s||s.validate!==!1)&&l.emitValidationErrors(this,t.call(l.validateStyle,l.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:l.spec})))}}class vo{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const s=t.join(",")+String(n);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(t,n)),this.dashEntry[s]}getDashRanges(t,n,s){const u=[];let d=t.length%2==1?-t[t.length-1]*s:0,f=t[0]*s,_=!0;u.push({left:d,right:f,isDash:_,zeroLength:t[0]===0});let y=t[0];for(let v=1;v<t.length;v++){_=!_;const T=t[v];d=y*s,y+=T,f=y*s,u.push({left:d,right:f,isDash:_,zeroLength:T===0})}return u}addRoundDash(t,n,s){const u=n/2;for(let d=-s;d<=s;d++){const f=this.width*(this.nextRow+s+d);let _=0,y=t[_];for(let v=0;v<this.width;v++){v/y.right>1&&(y=t[++_]);const T=Math.abs(v-y.left),I=Math.abs(v-y.right),M=Math.min(T,I);let U;const F=d/s*(u+1);if(y.isDash){const O=u-Math.abs(F);U=Math.sqrt(M*M+O*O)}else U=u-Math.sqrt(M*M+F*F);this.data[f+v]=Math.max(0,Math.min(255,U+128))}}}addRegularDash(t){for(let _=t.length-1;_>=0;--_){const y=t[_],v=t[_+1];y.zeroLength?t.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,t.splice(_,1))}const n=t[0],s=t[t.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const u=this.width*this.nextRow;let d=0,f=t[d];for(let _=0;_<this.width;_++){_/f.right>1&&(f=t[++d]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),T=Math.min(y,v);this.data[u+_]=Math.max(0,Math.min(255,(f.isDash?T:-T)+128))}}addDash(t,n){const s=n?7:0,u=2*s+1;if(this.nextRow+u>this.height)return l.warnOnce("LineAtlas out of space"),null;let d=0;for(let _=0;_<t.length;_++)d+=t[_];if(d!==0){const _=this.width/d,y=this.getDashRanges(t,this.width,_);n?this.addRoundDash(y,_,s):this.addRegularDash(y)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:d};return this.nextRow+=u,this.dirty=!0,f}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}class ar{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=l.uniqueId();const s=this.workerPool.acquire(this.id);for(let u=0;u<s.length;u++){const d=new ar.Actor(s[u],n,this.id);d.name=`Worker ${u}`,this.actors.push(d)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n,s){l.asyncAll(this.actors,(u,d)=>{u.send(t,n,d)},s=s||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function Nr(a,t,n){const s=function(u,d){if(u)return n(u);if(d){const f=l.pick(l.extend(d,a),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);d.vector_layers&&(f.vectorLayers=d.vector_layers,f.vectorLayerIds=f.vectorLayers.map(_=>_.id)),n(null,f)}};return a.url?l.getJSON(t.transformRequest(a.url,l.ResourceType.Source),s):l.exported.frame(()=>s(null,a))}ar.Actor=l.Actor;class lr{constructor(t,n,s){this.bounds=l.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=s||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),s=Math.floor(l.mercatorXfromLng(this.bounds.getWest())*n),u=Math.floor(l.mercatorYfromLat(this.bounds.getNorth())*n),d=Math.ceil(l.mercatorXfromLng(this.bounds.getEast())*n),f=Math.ceil(l.mercatorYfromLat(this.bounds.getSouth())*n);return t.x>=s&&t.x<d&&t.y>=u&&t.y<f}}class cn extends l.Evented{constructor(t,n,s,u){if(super(),this.id=t,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.extend(this,l.pick(n,["url","scheme","tileSize","promoteId"])),this._options=l.extend({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(u)}load(){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Nr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new l.ErrorEvent(t)):n&&(l.extend(this,n),n.bounds&&(this.tileBounds=new lr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return l.extend({},this._options)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),u={request:this.map._requestManager.transformRequest(s,l.ResourceType.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function d(f,_){return delete t.request,t.aborted?n(null):f&&f.status!==404?n(f):(_&&_.resourceTiming&&(t.resourceTiming=_.resourceTiming),this.map._refreshExpiredTiles&&_&&t.setExpiryData(_),t.loadVectorData(_,this.map.painter),l.cacheEntryPossiblyAdded(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}u.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",u,d.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",u,d.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Tr extends l.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.setEventedParent(u),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.extend({type:"raster"},n),l.extend(this,l.pick(n,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=Nr(this._options,this.map._requestManager,(t,n)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new l.ErrorEvent(t)):n&&(l.extend(this,n),n.bounds&&(this.tileBounds=new lr(n.bounds,this.minzoom,this.maxzoom)),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return l.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=l.getImage(this.map._requestManager.transformRequest(s,l.ResourceType.Tile),(u,d,f)=>{if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(u)t.state="errored",n(u);else if(d){this.map._refreshExpiredTiles&&t.setExpiryData(f);const _=this.map.painter.context,y=_.gl;t.texture=this.map.painter.getTileTexture(d.width),t.texture?t.texture.update(d,{useMipmap:!0}):(t.texture=new He(_,d,y.RGBA,{useMipmap:!0}),t.texture.bind(y.LINEAR,y.CLAMP_TO_EDGE,y.LINEAR_MIPMAP_NEAREST),_.extTextureFilterAnisotropic&&y.texParameterf(y.TEXTURE_2D,_.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,_.extTextureFilterAnisotropicMax)),t.state="loaded",l.cacheEntryPossiblyAdded(this.dispatcher),n(null)}})}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n()}unloadTile(t,n){t.texture&&this.map.painter.saveTileTexture(t.texture),n()}hasTransition(){return!1}}let Er;class We extends Tr{constructor(t,n,s,u){super(t,n,s,u),this.type="raster-dem",this.maxzoom=22,this._options=l.extend({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,n){const s=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function u(d,f){d&&(t.state="errored",n(d)),f&&(t.dem=f,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",n(null))}t.request=l.getImage(this.map._requestManager.transformRequest(s,l.ResourceType.Tile),function(d,f){if(delete t.request,t.aborted)t.state="unloaded",n(null);else if(d)t.state="errored",n(d);else if(f){this.map._refreshExpiredTiles&&t.setExpiryData(f),delete f.cacheControl,delete f.expires;const _=l.isImageBitmap(f)&&(Er==null&&(Er=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Er)?f:l.exported.getImageData(f,1),y={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:_,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",y,u.bind(this)))}}.bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const n=t.canonical,s=Math.pow(2,n.z),u=(n.x-1+s)%s,d=n.x===0?t.wrap-1:t.wrap,f=(n.x+1+s)%s,_=n.x+1===s?t.wrap+1:t.wrap,y={};return y[new l.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y).key]={backfilled:!1},n.y>0&&(y[new l.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y-1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y-1).key]={backfilled:!1}),n.y+1<s&&(y[new l.OverscaledTileID(t.overscaledZ,d,n.z,u,n.y+1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},y[new l.OverscaledTileID(t.overscaledZ,_,n.z,f,n.y+1).key]={backfilled:!1}),y}unloadTile(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&t.actor.send("removeDEMTile",{uid:t.uid,source:this.id})}}class cr extends l.Evented{constructor(t,n,s,u){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(u),this._data=n.data,this._options=l.extend({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId;const d=l.EXTENT/this.tileSize;this.workerOptions=l.extend({source:this.id,cluster:n.cluster||!1,geojsonVtOptions:{buffer:(n.buffer!==void 0?n.buffer:128)*d,tolerance:(n.tolerance!==void 0?n.tolerance:.375)*d,extent:l.EXTENT,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1},superclusterOptions:{maxZoom:n.clusterMaxZoom!==void 0?n.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,n.clusterMinPoints||2),extent:l.EXTENT,radius:(n.clusterRadius||50)*d,log:!1,generateId:n.generateId||!1},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}load(){this._updateWorkerData("metadata")}onAdd(t){this.map=t,this.load()}setData(t){return this._data=t,this._updateWorkerData("content"),this}getClusterExpansionZoom(t,n){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},n),this}getClusterChildren(t,n){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},n),this}getClusterLeaves(t,n,s,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:n,offset:s},u),this}_updateWorkerData(t){const n=l.extend({},this.workerOptions),s=this._data;typeof s=="string"?(n.request=this.map._requestManager.transformRequest(l.exported.resolveURL(s),l.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(s),this._pendingLoads++,this.fire(new l.Event("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,n,(u,d)=>{if(this._pendingLoads--,this._removed||d&&d.abandoned)return void this.fire(new l.Event("dataabort",{dataType:"source",sourceDataType:t}));let f=null;if(d&&d.resourceTiming&&d.resourceTiming[this.id]&&(f=d.resourceTiming[this.id].slice(0)),u)return void this.fire(new l.ErrorEvent(u));const _={dataType:"source",sourceDataType:t};this._collectResourceTiming&&f&&f.length>0&&l.extend(_,{resourceTiming:f}),this.fire(new l.Event("data",_))})}loaded(){return this._pendingLoads===0}loadTile(t,n){const s=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const u={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(s,u,(d,f)=>(delete t.request,t.unloadVectorData(),t.aborted?n(null):d?n(d):(t.loadVectorData(f,this.map.painter,s==="reloadTile"),n(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return l.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var ur=l.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Gi extends l.Evented{constructor(t,n,s,u){super(),this.id=t,this.dispatcher=s,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(u),this.options=n}load(t,n){this._loaded=!1,this.fire(new l.Event("dataloading",{dataType:"source"})),this.url=this.options.url,l.getImage(this.map._requestManager.transformRequest(this.url,l.ResourceType.Image),(s,u)=>{this._loaded=!0,s?this.fire(new l.ErrorEvent(s)):u&&(this.image=u,t&&(this.coordinates=t),n&&n(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const n=t.map(l.MercatorCoordinate.fromLngLat);this.tileID=function(u){let d=1/0,f=1/0,_=-1/0,y=-1/0;for(const M of u)d=Math.min(d,M.x),f=Math.min(f,M.y),_=Math.max(_,M.x),y=Math.max(y,M.y);const v=Math.max(_-d,y-f),T=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),I=Math.pow(2,T);return new l.CanonicalTileID(T,Math.floor((d+_)/2*I),Math.floor((f+y)/2*I))}(n),this.minzoom=this.maxzoom=this.tileID.z;const s=n.map(u=>this.tileID.getTilePoint(u)._round());return this._boundsArray=new l.RasterBoundsArray,this._boundsArray.emplaceBack(s[0].x,s[0].y,0,0),this._boundsArray.emplaceBack(s[1].x,s[1].y,l.EXTENT,0),this._boundsArray.emplaceBack(s[3].x,s[3].y,0,l.EXTENT),this._boundsArray.emplaceBack(s[2].x,s[2].y,l.EXTENT,l.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,ur.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new He(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class qi extends Gi{constructor(t,n,s,u){super(t,n,s,u),this.roundZoom=!0,this.type="video",this.options=n}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push(this.map._requestManager.transformRequest(n,l.ResourceType.Source).url);l.getVideo(this.urls,(n,s)=>{this._loaded=!0,n?this.fire(new l.ErrorEvent(n)):s&&(this.video=s,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,n=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,ur.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new He(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));for(const s in this.tiles){const u=this.tiles[s];u.state!=="loaded"&&(u.state="loaded",u.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Gr extends Gi{constructor(t,n,s,u){super(t,n,s,u),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(f=>typeof f!="number"))||this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new l.ErrorEvent(new l.ValidationError(`sources.${t}`,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 l.ErrorEvent(new l.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){this._loaded=!0,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 l.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,s=n.gl;this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,ur.members)),this.boundsSegments||(this.boundsSegments=l.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new He(n,this.canvas,s.RGBA,{premultiply:!0});for(const u in this.tiles){const d=this.tiles[u];d.state!=="loaded"&&(d.state="loaded",d.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const un={vector:cn,raster:Tr,"raster-dem":We,geojson:cr,video:qi,image:Gi,canvas:Gr};function hn(a,t){const n=l.create();return l.translate(n,n,[1,1,0]),l.scale(n,n,[.5*a.width,.5*a.height,1]),l.multiply(n,n,a.calculatePosMatrix(t.toUnwrapped()))}function dn(a,t,n,s,u,d){const f=function(I,M,U){if(I)for(const F of I){const O=M[F];if(O&&O.source===U&&O.type==="fill-extrusion")return!0}else for(const F in M){const O=M[F];if(O.source===U&&O.type==="fill-extrusion")return!0}return!1}(u&&u.layers,t,a.id),_=d.maxPitchScaleFactor(),y=a.tilesIn(s,_,f);y.sort(Yi);const v=[];for(const I of y)v.push({wrappedTileID:I.tileID.wrapped().key,queryResults:I.tile.queryRenderedFeatures(t,n,a._state,I.queryGeometry,I.cameraQueryGeometry,I.scale,u,d,_,hn(a.transform,I.tileID))});const T=function(I){const M={},U={};for(const F of I){const O=F.queryResults,H=F.wrappedTileID,Y=U[H]=U[H]||{};for(const te in O){const $=O[te],ne=Y[te]=Y[te]||{},ie=M[te]=M[te]||[];for(const ue of $)ne[ue.featureIndex]||(ne[ue.featureIndex]=!0,ie.push(ue))}}return M}(v);for(const I in T)T[I].forEach(M=>{const U=M.feature,F=a.getFeatureState(U.layer["source-layer"],U.id);U.source=U.layer.source,U.layer["source-layer"]&&(U.sourceLayer=U.layer["source-layer"]),U.state=F});return T}function Yi(a,t){const n=a.tileID,s=t.tileID;return n.overscaledZ-s.overscaledZ||n.canonical.y-s.canonical.y||n.wrap-s.wrap||n.canonical.x-s.canonical.x}class Sr{constructor(t,n){this.tileID=t,this.uid=l.uniqueId(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const n=t+this.timeAdded;n<l.exported.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.textures.forEach(n=>t.saveTileTexture(n)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,n,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(u,d){const f={};if(!d)return f;for(const _ of u){const y=_.layerIds.map(v=>d.getLayer(v)).filter(Boolean);if(y.length!==0){_.layers=y,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(v=>y.filter(T=>T.id===v)[0]));for(const v of y)f[v.id]=_}}return f}(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const d=this.buckets[u];if(d instanceof l.SymbolBucket){if(this.hasSymbolBuckets=!0,!s)break;d.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const d=this.buckets[u];if(d instanceof l.SymbolBucket&&d.hasRTLText){this.hasRTLText=!0,l.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const u in this.buckets){const d=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(d))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new l.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const s in this.buckets){const u=this.buckets[s];u.uploadPending()&&u.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new He(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new He(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,s,u,d,f,_,y,v,T){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:d,scale:f,tileSize:this.tileSize,pixelPosMatrix:T,transform:y,params:_,queryPadding:this.queryPadding*v},t,n,s):{}}querySourceFeatures(t,n){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const u=s.loadVTLayers(),d=n?n.sourceLayer:"",f=u._geojsonTileLayer||u[d];if(!f)return;const _=l.createFilter(n&&n.filter),{z:y,x:v,y:T}=this.tileID.canonical,I={z:y,x:v,y:T};for(let M=0;M<f.length;M++){const U=f.feature(M);if(_.needGeometry){const H=l.toEvaluationFeature(U,!0);if(!_.filter(new l.EvaluationParameters(this.tileID.overscaledZ),H,this.tileID.canonical))continue}else if(!_.filter(new l.EvaluationParameters(this.tileID.overscaledZ),U))continue;const F=s.getId(U,d),O=new l.GeoJSONFeature(U,y,v,T,F);O.tile=I,t.push(O)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const s=l.parseCacheControl(t.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const s=Date.now();let u=!1;if(this.expirationTime>s)u=!1;else if(n)if(this.expirationTime<n)u=!0;else{const d=this.expirationTime-n;d?this.expirationTime=s+Math.max(d,3e4):u=!0}else u=!0;u?(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(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const u in this.buckets){if(!n.style.hasLayer(u))continue;const d=this.buckets[u],f=d.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],y=t[f];if(!_||!y||Object.keys(y).length===0)continue;d.update(y,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const v=n&&n.style&&n.style.getLayer(u);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(d)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<l.exported.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=l.exported.now()+t}setDependencies(t,n){const s={};for(const u of n)s[u]=!0;this.dependencies[t]=s}hasDependency(t,n){for(const s of t){const u=this.dependencies[s];if(u){for(const d of n)if(u[d])return!0}}return!1}}class Ir{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,s){const u=t.wrapped().key;this.data[u]===void 0&&(this.data[u]=[]);const d={value:n,timeout:void 0};if(s!==void 0&&(d.timeout=setTimeout(()=>{this.remove(t,d)},s)),this.data[u].push(d),this.order.push(u),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const s=t.wrapped().key,u=n===void 0?0:this.data[s].indexOf(n),d=this.data[s][u];return this.data[s].splice(u,1),d.timeout&&clearTimeout(d.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(d.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const s in this.data)for(const u of this.data[s])t(u.value)||n.push(u);for(const s of n)this.remove(s.value.tileID,s)}}class Cr{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,s){const u=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][u]=this.stateChanges[t][u]||{},l.extend(this.stateChanges[t][u],s),this.deletedStates[t]===null){this.deletedStates[t]={};for(const d in this.state[t])d!==u&&(this.deletedStates[t][d]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][u]===null){this.deletedStates[t][u]={};for(const d in this.state[t][u])s[d]||(this.deletedStates[t][u][d]=null)}else for(const d in s)this.deletedStates[t]&&this.deletedStates[t][u]&&this.deletedStates[t][u][d]===null&&delete this.deletedStates[t][u][d]}removeFeatureState(t,n,s){if(this.deletedStates[t]===null)return;const u=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},s&&n!==void 0)this.deletedStates[t][u]!==null&&(this.deletedStates[t][u]=this.deletedStates[t][u]||{},this.deletedStates[t][u][s]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][u])for(s in this.deletedStates[t][u]={},this.stateChanges[t][u])this.deletedStates[t][u][s]=null;else this.deletedStates[t][u]=null;else this.deletedStates[t]=null}getState(t,n){const s=String(n),u=l.extend({},(this.state[t]||{})[s],(this.stateChanges[t]||{})[s]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const d=this.deletedStates[t][n];if(d===null)return{};for(const f in d)delete u[f]}return u}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const s={};for(const u in this.stateChanges){this.state[u]=this.state[u]||{};const d={};for(const f in this.stateChanges[u])this.state[u][f]||(this.state[u][f]={}),l.extend(this.state[u][f],this.stateChanges[u][f]),d[f]=this.state[u][f];s[u]=d}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const d={};if(this.deletedStates[u]===null)for(const f in this.state[u])d[f]={},this.state[u][f]={};else for(const f in this.deletedStates[u]){if(this.deletedStates[u][f]===null)this.state[u][f]={};else for(const _ of Object.keys(this.deletedStates[u][f]))delete this.state[u][f][_];d[f]=this.state[u][f]}s[u]=s[u]||{},l.extend(s[u],d)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const u in t)t[u].setFeatureState(s,n)}}class yi extends l.Evented{constructor(t,n,s){super(),this.id=t,this.dispatcher=s,this.on("data",u=>{u.dataType==="source"&&u.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&u.dataType==="source"&&u.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(u,d,f,_){const y=new un[d.type](u,d,f,_);if(y.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${y.id}`);return l.bindAll(["load","abort","unload","serialize","prepare"],y),y}(t,n,s,this),this._tiles={},this._cache=new Ir(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Cr}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const n=this._tiles[t];if(n.state!=="loaded"&&n.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n){return this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new l.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const s=this._tiles[n];s.upload(t),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(pn).map(t=>t.key)}getRenderableIds(t){const n=[];for(const s in this._tiles)this._isIdRenderable(s,t)&&n.push(this._tiles[s]);return t?n.sort((s,u)=>{const d=s.tileID,f=u.tileID,_=new l.pointGeometry(d.canonical.x,d.canonical.y)._rotate(this.transform.angle),y=new l.pointGeometry(f.canonical.x,f.canonical.y)._rotate(this.transform.angle);return d.overscaledZ-f.overscaledZ||y.y-_.y||y.x-_.x}).map(s=>s.tileID.key):n.map(s=>s.tileID).sort(pn).map(s=>s.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,n){const s=this._tiles[t];s&&(s.state!=="loading"&&(s.state=n),this._loadTile(s,this._tileLoaded.bind(this,s,t,n)))}_tileLoaded(t,n,s,u){if(u)return t.state="errored",void(u.status!==404?this._source.fire(new l.ErrorEvent(u,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=l.exported.now(),s==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new l.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const n=this.getRenderableIds();for(let u=0;u<n.length;u++){const d=n[u];if(t.neighboringTiles&&t.neighboringTiles[d]){const f=this.getTileByID(d);s(t,f),s(f,t)}}function s(u,d){u.needsHillshadePrepare=!0,u.needsTerrainPrepare=!0;let f=d.tileID.canonical.x-u.tileID.canonical.x;const _=d.tileID.canonical.y-u.tileID.canonical.y,y=Math.pow(2,u.tileID.canonical.z),v=d.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+y)===1?f+=y:Math.abs(f-y)===1&&(f-=y)),d.dem&&u.dem&&(u.dem.backfillBorder(d.dem,f,_),u.neighboringTiles&&u.neighboringTiles[v]&&(u.neighboringTiles[v].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,s,u){for(const d in this._tiles){let f=this._tiles[d];if(u[d]||!f.hasData()||f.tileID.overscaledZ<=n||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>n+1;){const v=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[v.key],f&&f.hasData()&&(_=v)}let y=_;for(;y.overscaledZ>n;)if(y=y.scaledTo(y.overscaledZ-1),t[y.key]){u[_.key]=_;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const s=this._loadedParentTiles[t.key];return s&&s.tileID.overscaledZ>=n?s:null}for(let s=t.overscaledZ-1;s>=n;s--){const u=t.scaledTo(s),d=this._getLoadedTile(u);if(d)return d}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,s=Math.ceil(t.height/this._source.tileSize)+1,u=Math.floor(n*s*5),d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._cache.setMaxSize(d)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const s={};for(const u in this._tiles){const d=this._tiles[u];d.tileID=d.tileID.unwrapTo(d.tileID.wrap+n),s[d.tileID.key]=d}this._tiles=s;for(const u in this._timers)clearTimeout(this._timers[u]),delete this._timers[u];for(const u in this._tiles)this._setTileReloadTimer(u,this._tiles[u])}}update(t,n){if(this.transform=t,this.terrain=n,!this._sourceLoaded||this._paused)return;let s;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(v=>new l.OverscaledTileID(v.canonical.z,v.wrap,v.canonical.z,v.canonical.x,v.canonical.y)):(s=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n}),this._source.hasTile&&(s=s.filter(v=>this._source.hasTile(v)))):s=[];const u=t.coveringZoomLevel(this._source),d=Math.max(u-yi.maxOverzooming,this._source.minzoom),f=Math.max(u+yi.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const v={};for(const T of s)if(T.canonical.z>this._source.minzoom){const I=T.scaledTo(T.canonical.z-1);v[I.key]=I;const M=T.scaledTo(Math.max(this._source.minzoom,Math.min(T.canonical.z,5)));v[M.key]=M}s=s.concat(Object.values(v))}const _=this._updateRetainedTiles(s,u);if(Un(this._source.type)){const v={},T={},I=Object.keys(_);for(const M of I){const U=_[M],F=this._tiles[M];if(!F||F.fadeEndTime&&F.fadeEndTime<=l.exported.now())continue;const O=this.findLoadedParent(U,d);O&&(this._addTile(O.tileID),v[O.tileID.key]=O.tileID),T[M]=U}this._retainLoadedChildren(T,u,f,_);for(const M in v)_[M]||(this._coveredTiles[M]=!0,_[M]=v[M]);if(n){const M={},U={};for(const F of s)this._tiles[F.key].hasData()?M[F.key]=F:U[F.key]=F;for(const F in U){const O=U[F].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(M[O[0].key]=_[O[0].key]=O[0],M[O[1].key]=_[O[1].key]=O[1],M[O[2].key]=_[O[2].key]=O[2],M[O[3].key]=_[O[3].key]=O[3],delete U[F])}for(const F in U){const O=this.findLoadedParent(U[F],this._source.minzoom);if(O){M[O.tileID.key]=_[O.tileID.key]=O.tileID;for(const H in M)M[H].isChildOf(O.tileID)&&delete M[H]}}for(const F in this._tiles)M[F]||(this._coveredTiles[F]=!0)}}for(const v in _)this._tiles[v].clearFadeHold();const y=l.keysDifference(this._tiles,_);for(const v of y){const T=this._tiles[v];T.hasSymbolBuckets&&!T.holdingForFade()?T.setHoldDuration(this.map._fadeDuration):T.hasSymbolBuckets&&!T.symbolFadeFinished()||this._removeTile(v)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){const s={},u={},d=Math.max(n-yi.maxOverzooming,this._source.minzoom),f=Math.max(n+yi.maxUnderzooming,this._source.minzoom),_={};for(const y of t){const v=this._addTile(y);s[y.key]=y,v.hasData()||n<this._source.maxzoom&&(_[y.key]=y)}this._retainLoadedChildren(_,n,f,s);for(const y of t){let v=this._tiles[y.key];if(v.hasData())continue;if(n+1>this._source.maxzoom){const I=y.children(this._source.maxzoom)[0],M=this.getTile(I);if(M&&M.hasData()){s[I.key]=I;continue}}else{const I=y.children(this._source.maxzoom);if(s[I[0].key]&&s[I[1].key]&&s[I[2].key]&&s[I[3].key])continue}let T=v.wasRequested();for(let I=y.overscaledZ-1;I>=d;--I){const M=y.scaledTo(I);if(u[M.key]||(u[M.key]=!0,v=this.getTile(M),!v&&T&&(v=this._addTile(M)),v&&(s[M.key]=M,T=v.wasRequested(),v.hasData())))break}}return s}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let s,u=this._tiles[t].tileID;for(;u.overscaledZ>0;){if(u.key in this._loadedParentTiles){s=this._loadedParentTiles[u.key];break}n.push(u.key);const d=u.scaledTo(u.overscaledZ-1);if(s=this._getLoadedTile(d),s)break;u=d}for(const d of n)this._loadedParentTiles[d]=s}}_addTile(t){let n=this._tiles[t.key];if(n)return n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const s=n;return n||(n=new Sr(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))),n.uses++,this._tiles[t.key]=n,s||this._source.fire(new l.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const s=n.getExpiryTimeout();s&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},s))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,n,s){const u=[],d=this.transform;if(!d)return u;const f=s?d.getCameraQueryGeometry(t):t,_=t.map(F=>d.pointCoordinate(F,this.terrain)),y=f.map(F=>d.pointCoordinate(F,this.terrain)),v=this.getIds();let T=1/0,I=1/0,M=-1/0,U=-1/0;for(const F of y)T=Math.min(T,F.x),I=Math.min(I,F.y),M=Math.max(M,F.x),U=Math.max(U,F.y);for(let F=0;F<v.length;F++){const O=this._tiles[v[F]];if(O.holdingForFade())continue;const H=O.tileID,Y=Math.pow(2,d.zoom-O.tileID.overscaledZ),te=n*O.queryPadding*l.EXTENT/O.tileSize/Y,$=[H.getTilePoint(new l.MercatorCoordinate(T,I)),H.getTilePoint(new l.MercatorCoordinate(M,U))];if($[0].x-te<l.EXTENT&&$[0].y-te<l.EXTENT&&$[1].x+te>=0&&$[1].y+te>=0){const ne=_.map(ue=>H.getTilePoint(ue)),ie=y.map(ue=>H.getTilePoint(ue));u.push({tile:O,tileID:H,queryGeometry:ne,cameraQueryGeometry:ie,scale:Y})}}return u}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map(s=>this._tiles[s].tileID);for(const s of n)s.posMatrix=this.transform.calculatePosMatrix(s.toUnwrapped());return n}hasTransition(){if(this._source.hasTransition())return!0;if(Un(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=l.exported.now())return!0}return!1}setFeatureState(t,n,s){this._state.updateState(t=t||"_geojsonTileLayer",n,s)}removeFeatureState(t,n,s){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,s)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,s){const u=this._tiles[t];u&&u.setDependencies(n,s)}reloadTilesForDependencies(t,n){for(const s in this._tiles)this._tiles[s].hasDependency(t,n)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(t,n))}}function pn(a,t){const n=Math.abs(2*a.wrap)-+(a.wrap<0),s=Math.abs(2*t.wrap)-+(t.wrap<0);return a.overscaledZ-t.overscaledZ||s-n||t.canonical.y-a.canonical.y||t.canonical.x-a.canonical.x}function Un(a){return a==="raster"||a==="image"||a==="video"}yi.maxOverzooming=10,yi.maxUnderzooming=3;const hr="mapboxgl_preloaded_worker_pool";class Ii{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Ii.workerCount;)this.workers.push(new Worker(Yr.workerUrl));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[hr]}numActive(){return Object.keys(this.active).length}}const $n=Math.floor(l.exported.hardwareConcurrency/2);let Ar;function fn(){return Ar||(Ar=new Ii),Ar}function mn(a,t){const n={};for(const s in a)s!=="ref"&&(n[s]=a[s]);return l.refProperties.forEach(s=>{s in t&&(n[s]=t[s])}),n}function Vn(a){a=a.slice();const t=Object.create(null);for(let n=0;n<a.length;n++)t[a[n].id]=a[n];for(let n=0;n<a.length;n++)"ref"in a[n]&&(a[n]=mn(a[n],t[a[n].ref]));return a}Ii.workerCount=Math.max(Math.min($n,6),1);const ht={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Qi(a,t,n){n.push({command:ht.addSource,args:[a,t[a]]})}function Mr(a,t,n){t.push({command:ht.removeSource,args:[a]}),n[a]=!0}function zr(a,t,n,s){Mr(a,n,s),Qi(a,t,n)}function Nn(a,t,n){let s;for(s in a[n])if(Object.prototype.hasOwnProperty.call(a[n],s)&&s!=="data"&&!we(a[n][s],t[n][s]))return!1;for(s in t[n])if(Object.prototype.hasOwnProperty.call(t[n],s)&&s!=="data"&&!we(a[n][s],t[n][s]))return!1;return!0}function dr(a,t,n,s,u,d){let f;for(f in t=t||{},a=a||{})Object.prototype.hasOwnProperty.call(a,f)&&(we(a[f],t[f])||n.push({command:d,args:[s,f,t[f],u]}));for(f in t)Object.prototype.hasOwnProperty.call(t,f)&&!Object.prototype.hasOwnProperty.call(a,f)&&(we(a[f],t[f])||n.push({command:d,args:[s,f,t[f],u]}))}function pr(a){return a.id}function gn(a,t){return a[t.id]=t,a}class fr{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=l.clamp(t,0,1);let n=1,s=this._distances[n];const u=t*this.paddedLength+this.padding;for(;s<u&&n<this._distances.length;)s=this._distances[++n];const d=n-1,f=this._distances[d],_=s-f,y=_>0?(u-f)/_:0;return this.points[d].mult(1-y).add(this.points[n].mult(y))}}function de(a,t){let n=!0;return a==="always"||a!=="never"&&t!=="never"||(n=!1),n}class Ce{constructor(t,n,s){const u=this.boxCells=[],d=this.circleCells=[];this.xCellCount=Math.ceil(t/s),this.yCellCount=Math.ceil(n/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)u.push([]),d.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,s,u,d){this._forEachCell(n,s,u,d,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(u),this.bboxes.push(d)}insertCircle(t,n,s,u){this._forEachCell(n-u,s-u,n+u,s+u,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(s),this.circles.push(u)}_insertBoxCell(t,n,s,u,d,f){this.boxCells[d].push(f)}_insertCircleCell(t,n,s,u,d,f){this.circleCells[d].push(f)}_query(t,n,s,u,d,f,_){if(s<0||t>this.width||u<0||n>this.height)return[];const y=[];if(t<=0&&n<=0&&this.width<=s&&this.height<=u){if(d)return[{key:null,x1:t,y1:n,x2:s,y2:u}];for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const T=this.circles[3*v],I=this.circles[3*v+1],M=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:T-M,y1:I-M,x2:T+M,y2:I+M})}}else this._forEachCell(t,n,s,u,this._queryCell,y,{hitTest:d,overlapMode:f,seenUids:{box:{},circle:{}}},_);return y}query(t,n,s,u){return this._query(t,n,s,u,!1,null)}hitTest(t,n,s,u,d,f){return this._query(t,n,s,u,!0,d,f).length>0}hitTestCircle(t,n,s,u,d){const f=t-s,_=t+s,y=n-s,v=n+s;if(_<0||f>this.width||v<0||y>this.height)return!1;const T=[];return this._forEachCell(f,y,_,v,this._queryCellCircle,T,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:s},seenUids:{box:{},circle:{}}},d),T.length>0}_queryCell(t,n,s,u,d,f,_,y){const{seenUids:v,hitTest:T,overlapMode:I}=_,M=this.boxCells[d];if(M!==null){const F=this.bboxes;for(const O of M)if(!v.box[O]){v.box[O]=!0;const H=4*O,Y=this.boxKeys[O];if(t<=F[H+2]&&n<=F[H+3]&&s>=F[H+0]&&u>=F[H+1]&&(!y||y(Y))&&(!T||!de(I,Y.overlapMode))&&(f.push({key:Y,x1:F[H],y1:F[H+1],x2:F[H+2],y2:F[H+3]}),T))return!0}}const U=this.circleCells[d];if(U!==null){const F=this.circles;for(const O of U)if(!v.circle[O]){v.circle[O]=!0;const H=3*O,Y=this.circleKeys[O];if(this._circleAndRectCollide(F[H],F[H+1],F[H+2],t,n,s,u)&&(!y||y(Y))&&(!T||!de(I,Y.overlapMode))){const te=F[H],$=F[H+1],ne=F[H+2];if(f.push({key:Y,x1:te-ne,y1:$-ne,x2:te+ne,y2:$+ne}),T)return!0}}}return!1}_queryCellCircle(t,n,s,u,d,f,_,y){const{circle:v,seenUids:T,overlapMode:I}=_,M=this.boxCells[d];if(M!==null){const F=this.bboxes;for(const O of M)if(!T.box[O]){T.box[O]=!0;const H=4*O,Y=this.boxKeys[O];if(this._circleAndRectCollide(v.x,v.y,v.radius,F[H+0],F[H+1],F[H+2],F[H+3])&&(!y||y(Y))&&!de(I,Y.overlapMode))return f.push(!0),!0}}const U=this.circleCells[d];if(U!==null){const F=this.circles;for(const O of U)if(!T.circle[O]){T.circle[O]=!0;const H=3*O,Y=this.circleKeys[O];if(this._circlesCollide(F[H],F[H+1],F[H+2],v.x,v.y,v.radius)&&(!y||y(Y))&&!de(I,Y.overlapMode))return f.push(!0),!0}}}_forEachCell(t,n,s,u,d,f,_,y){const v=this._convertToXCellCoord(t),T=this._convertToYCellCoord(n),I=this._convertToXCellCoord(s),M=this._convertToYCellCoord(u);for(let U=v;U<=I;U++)for(let F=T;F<=M;F++)if(d.call(this,t,n,s,u,this.xCellCount*F+U,f,_,y))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,s,u,d,f){const _=u-t,y=d-n,v=s+f;return v*v>_*_+y*y}_circleAndRectCollide(t,n,s,u,d,f,_){const y=(f-u)/2,v=Math.abs(t-(u+y));if(v>y+s)return!1;const T=(_-d)/2,I=Math.abs(n-(d+T));if(I>T+s)return!1;if(v<=y||I<=T)return!0;const M=v-y,U=I-T;return M*M+U*U<=s*s}}function qr(a,t,n,s,u){const d=l.create();return t?(l.scale(d,d,[1/u,1/u,1]),n||l.rotateZ(d,d,s.angle)):l.multiply(d,s.labelPlaneMatrix,a),d}function Zi(a,t,n,s,u){if(t){const d=l.clone(a);return l.scale(d,d,[u,u,1]),n||l.rotateZ(d,d,-s.angle),d}return s.glCoordMatrix}function dt(a,t,n){let s;n?(s=[a.x,a.y,n(a.x,a.y),1],l.transformMat4(s,s,t)):(s=[a.x,a.y,0,1],mr(s,s,t));const u=s[3];return{point:new l.pointGeometry(s[0]/u,s[1]/u),signedDistanceFromCamera:u}}function Oi(a,t){return .5+a/t*.5}function Ci(a,t){const n=a[0]/a[3],s=a[1]/a[3];return n>=-t[0]&&n<=t[0]&&s>=-t[1]&&s<=t[1]}function Ai(a,t,n,s,u,d,f,_,y,v){const T=s?a.textSizeData:a.iconSizeData,I=l.evaluateSizeForZoom(T,n.transform.zoom),M=[256/n.width*2+1,256/n.height*2+1],U=s?a.text.dynamicLayoutVertexArray:a.icon.dynamicLayoutVertexArray;U.clear();const F=a.lineVertexArray,O=s?a.text.placedSymbolArray:a.icon.placedSymbolArray,H=n.transform.width/n.transform.height;let Y=!1;for(let te=0;te<O.length;te++){const $=O.get(te);if($.hidden||$.writingMode===l.WritingMode.vertical&&!Y){Je($.numGlyphs,U);continue}let ne;if(Y=!1,v?(ne=[$.anchorX,$.anchorY,v($.anchorX,$.anchorY),1],l.transformMat4(ne,ne,t)):(ne=[$.anchorX,$.anchorY,0,1],mr(ne,ne,t)),!Ci(ne,M)){Je($.numGlyphs,U);continue}const ie=Oi(n.transform.cameraToCenterDistance,ne[3]),ue=l.evaluateSizeForFeature(T,I,$),he=f?ue/ie:ue*ie,ve=new l.pointGeometry($.anchorX,$.anchorY),ce=dt(ve,u,v).point,Le={},Se=et($,he,!1,_,t,u,d,a.glyphOffsetArray,F,U,ce,ve,Le,H,y,v);Y=Se.useVertical,(Se.notEnoughRoom||Y||Se.needsFlipping&&et($,he,!0,_,t,u,d,a.glyphOffsetArray,F,U,ce,ve,Le,H,y,v).notEnoughRoom)&&Je($.numGlyphs,U)}s?a.text.dynamicLayoutVertexBuffer.updateData(U):a.icon.dynamicLayoutVertexBuffer.updateData(U)}function Pr(a,t,n,s,u,d,f,_,y,v,T,I,M){const U=_.glyphStartIndex+_.numGlyphs,F=_.lineStartIndex,O=_.lineStartIndex+_.lineLength,H=t.getoffsetX(_.glyphStartIndex),Y=t.getoffsetX(U-1),te=oi(a*H,n,s,u,d,f,_.segment,F,O,y,v,T,I,M);if(!te)return null;const $=oi(a*Y,n,s,u,d,f,_.segment,F,O,y,v,T,I,M);return $?{first:te,last:$}:null}function Ee(a,t,n,s){return a===l.WritingMode.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*s?{useVertical:!0}:(a===l.WritingMode.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function et(a,t,n,s,u,d,f,_,y,v,T,I,M,U,F,O){const H=t/24,Y=a.lineOffsetX*H,te=a.lineOffsetY*H;let $;if(a.numGlyphs>1){const ne=a.glyphStartIndex+a.numGlyphs,ie=a.lineStartIndex,ue=a.lineStartIndex+a.lineLength,he=Pr(H,_,Y,te,n,T,I,a,y,d,M,F,O);if(!he)return{notEnoughRoom:!0};const ve=dt(he.first.point,f,O).point,ce=dt(he.last.point,f,O).point;if(s&&!n){const Le=Ee(a.writingMode,ve,ce,U);if(Le)return Le}$=[he.first];for(let Le=a.glyphStartIndex+1;Le<ne-1;Le++)$.push(oi(H*_.getoffsetX(Le),Y,te,n,T,I,a.segment,ie,ue,y,d,M,F,O));$.push(he.last)}else{if(s&&!n){const ie=dt(I,u,O).point,ue=a.lineStartIndex+a.segment+1,he=new l.pointGeometry(y.getx(ue),y.gety(ue)),ve=dt(he,u,O),ce=ve.signedDistanceFromCamera>0?ve.point:Ye(I,he,ie,1,u,O),Le=Ee(a.writingMode,ie,ce,U);if(Le)return Le}const ne=oi(H*_.getoffsetX(a.glyphStartIndex),Y,te,n,T,I,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,y,d,M,F,O);if(!ne)return{notEnoughRoom:!0};$=[ne]}for(const ne of $)l.addDynamicAttributes(v,ne.point,ne.angle);return{}}function Ye(a,t,n,s,u,d){const f=dt(a.add(a.sub(t)._unit()),u,d).point,_=n.sub(f);return n.add(_._mult(s/_.mag()))}function oi(a,t,n,s,u,d,f,_,y,v,T,I,M,U){const F=s?a-t:a+t;let O=F>0?1:-1,H=0;s&&(O*=-1,H=Math.PI),O<0&&(H+=Math.PI);let Y=O>0?_+f:_+f+1,te=u,$=u,ne=0,ie=0;const ue=Math.abs(F),he=[];for(;ne+ie<=ue;){if(Y+=O,Y<_||Y>=y)return null;if($=te,he.push(te),te=I[Y],te===void 0){const Re=new l.pointGeometry(v.getx(Y),v.gety(Y)),Qe=dt(Re,T,U);if(Qe.signedDistanceFromCamera>0)te=I[Y]=Qe.point;else{const it=Y-O;te=Ye(ne===0?d:new l.pointGeometry(v.getx(it),v.gety(it)),Re,$,ue-ne+1,T,U)}}ne+=ie,ie=$.dist(te)}const ve=(ue-ne)/ie,ce=te.sub($),Le=ce.mult(ve)._add($);Le._add(ce._unit()._perp()._mult(n*O));const Se=H+Math.atan2(te.y-$.y,te.x-$.x);return he.push(Le),{point:Le,angle:M?Se:0,path:he}}const kr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Je(a,t){for(let n=0;n<a;n++){const s=t.length;t.resize(s+4),t.float32.set(kr,3*s)}}function mr(a,t,n){const s=t[0],u=t[1];return a[0]=n[0]*s+n[4]*u+n[12],a[1]=n[1]*s+n[5]*u+n[13],a[3]=n[3]*s+n[7]*u+n[15],a}const Yt=100;class _n{constructor(t,n=new Ce(t.width+200,t.height+200,25),s=new Ce(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=s,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Yt,this.screenBottomBoundary=t.height+Yt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,s,u,d,f){const _=this.projectAndGetPerspectiveRatio(u,t.anchorPointX,t.anchorPointY,f),y=s*_.perspectiveRatio,v=t.x1*y+_.point.x,T=t.y1*y+_.point.y,I=t.x2*y+_.point.x,M=t.y2*y+_.point.y;return!this.isInsideGrid(v,T,I,M)||n!=="always"&&this.grid.hitTest(v,T,I,M,n,d)||_.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[v,T,I,M],offscreen:this.isOffscreen(v,T,I,M)}}placeCollisionCircles(t,n,s,u,d,f,_,y,v,T,I,M,U,F){const O=[],H=new l.pointGeometry(n.anchorX,n.anchorY),Y=dt(H,f,F),te=Oi(this.transform.cameraToCenterDistance,Y.signedDistanceFromCamera),$=(T?d/te:d*te)/l.ONE_EM,ne=dt(H,_,F).point,ie=Pr($,u,n.lineOffsetX*$,n.lineOffsetY*$,!1,ne,H,n,s,_,{},!1,F);let ue=!1,he=!1,ve=!0;if(ie){const ce=.5*M*te+U,Le=new l.pointGeometry(-100,-100),Se=new l.pointGeometry(this.screenRightBoundary,this.screenBottomBoundary),Re=new fr,Qe=ie.first,it=ie.last;let Ge=[];for(let ut=Qe.path.length-1;ut>=1;ut--)Ge.push(Qe.path[ut]);for(let ut=1;ut<it.path.length;ut++)Ge.push(it.path[ut]);const wt=2.5*ce;if(y){const ut=Ge.map(mt=>dt(mt,y,F));Ge=ut.some(mt=>mt.signedDistanceFromCamera<=0)?[]:ut.map(mt=>mt.point)}let Tt=[];if(Ge.length>0){const ut=Ge[0].clone(),mt=Ge[0].clone();for(let St=1;St<Ge.length;St++)ut.x=Math.min(ut.x,Ge[St].x),ut.y=Math.min(ut.y,Ge[St].y),mt.x=Math.max(mt.x,Ge[St].x),mt.y=Math.max(mt.y,Ge[St].y);Tt=ut.x>=Le.x&&mt.x<=Se.x&&ut.y>=Le.y&&mt.y<=Se.y?[Ge]:mt.x<Le.x||ut.x>Se.x||mt.y<Le.y||ut.y>Se.y?[]:l.clipLine([Ge],Le.x,Le.y,Se.x,Se.y)}for(const ut of Tt){Re.reset(ut,.25*ce);let mt=0;mt=Re.length<=.5*ce?1:Math.ceil(Re.paddedLength/wt)+1;for(let St=0;St<mt;St++){const ei=St/Math.max(mt-1,1),rr=Re.lerp(ei),Xi=rr.x+Yt,nr=rr.y+Yt;O.push(Xi,nr,ce,0);const Ur=Xi-ce,$i=nr-ce,vi=Xi+ce,yr=nr+ce;if(ve=ve&&this.isOffscreen(Ur,$i,vi,yr),he=he||this.isInsideGrid(Ur,$i,vi,yr),t!=="always"&&this.grid.hitTestCircle(Xi,nr,ce,t,I)&&(ue=!0,!v))return{circles:[],offscreen:!1,collisionDetected:ue}}}}return{circles:!v&&ue||!he||te<this.perspectiveRatioCutoff?[]:O,offscreen:ve,collisionDetected:ue}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let s=1/0,u=1/0,d=-1/0,f=-1/0;for(const T of t){const I=new l.pointGeometry(T.x+Yt,T.y+Yt);s=Math.min(s,I.x),u=Math.min(u,I.y),d=Math.max(d,I.x),f=Math.max(f,I.y),n.push(I)}const _=this.grid.query(s,u,d,f).concat(this.ignoredGrid.query(s,u,d,f)),y={},v={};for(const T of _){const I=T.key;if(y[I.bucketInstanceId]===void 0&&(y[I.bucketInstanceId]={}),y[I.bucketInstanceId][I.featureIndex])continue;const M=[new l.pointGeometry(T.x1,T.y1),new l.pointGeometry(T.x2,T.y1),new l.pointGeometry(T.x2,T.y2),new l.pointGeometry(T.x1,T.y2)];l.polygonIntersectsPolygon(n,M)&&(y[I.bucketInstanceId][I.featureIndex]=!0,v[I.bucketInstanceId]===void 0&&(v[I.bucketInstanceId]=[]),v[I.bucketInstanceId].push(I.featureIndex))}return v}insertCollisionBox(t,n,s,u,d,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:d,collisionGroupID:f,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,s,u,d,f){const _=s?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:d,collisionGroupID:f,overlapMode:n};for(let v=0;v<t.length;v+=4)_.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,n,s,u){let d;return u?(d=[n,s,u(n,s),1],l.transformMat4(d,d,t)):(d=[n,s,0,1],mr(d,d,t)),{point:new l.pointGeometry((d[0]/d[3]+1)/2*this.transform.width+Yt,(-d[1]/d[3]+1)/2*this.transform.height+Yt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/d[3]*.5}}isOffscreen(t,n,s,u){return s<Yt||t>=this.screenRightBoundary||u<Yt||n>this.screenBottomBoundary}isInsideGrid(t,n,s,u){return s>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=l.identity([]);return l.translate(t,t,[-100,-100,0]),t}}function Zt(a,t,n){return t*(l.EXTENT/(a.tileSize*Math.pow(2,n-a.tileID.overscaledZ)))}class pi{constructor(t,n,s,u){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):u&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Et{constructor(t,n,s,u,d){this.text=new pi(t?t.text:null,n,s,d),this.icon=new pi(t?t.icon:null,n,u,d)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class yn{constructor(t,n,s){this.text=t,this.icon=n,this.skipFade=s}}class er{constructor(){this.invProjMatrix=l.create(),this.viewportMatrix=l.create(),this.circles=[]}}class Zr{constructor(t,n,s,u,d){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=s,this.bucketIndex=u,this.tileID=d}}class jr{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:s=>s.collisionGroupID===n}}return this.collisionGroups[t]}}function xn(a,t,n,s,u){const{horizontalAlign:d,verticalAlign:f}=l.getAnchorAlignment(a),_=-(d-.5)*t,y=-(f-.5)*n,v=l.evaluateVariableOffset(a,s);return new l.pointGeometry(_+v[0]*u,y+v[1]*u)}function Xr(a,t,n,s,u,d){const{x1:f,x2:_,y1:y,y2:v,anchorPointX:T,anchorPointY:I}=a,M=new l.pointGeometry(t,n);return s&&M._rotate(u?d:-d),{x1:f+M.x,y1:y+M.y,x2:_+M.x,y2:v+M.y,anchorPointX:T,anchorPointY:I}}class R{constructor(t,n,s,u,d){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new _n(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new jr(u),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,s,u){const d=s.getBucket(n),f=s.latestFeatureIndex;if(!d||!f||n.id!==d.layerIds[0])return;const _=s.collisionBoxArray,y=d.layers[0].layout,v=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),T=s.tileSize/l.EXTENT,I=this.transform.calculatePosMatrix(s.tileID.toUnwrapped()),M=y.get("text-pitch-alignment")==="map",U=y.get("text-rotation-alignment")==="map",F=Zt(s,1,this.transform.zoom),O=qr(I,M,U,this.transform,F);let H=null;if(M){const te=Zi(I,M,U,this.transform,F);H=l.multiply([],this.transform.labelPlaneMatrix,te)}this.retainedQueryData[d.bucketInstanceId]=new Zr(d.bucketInstanceId,f,d.sourceLayerIndex,d.index,s.tileID);const Y={bucket:d,layout:y,posMatrix:I,textLabelPlaneMatrix:O,labelToScreenMatrix:H,scale:v,textPixelRatio:T,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:l.evaluateSizeForZoom(d.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(d.sourceID)};if(u)for(const te of d.sortKeyRanges){const{sortKey:$,symbolInstanceStart:ne,symbolInstanceEnd:ie}=te;t.push({sortKey:$,symbolInstanceStart:ne,symbolInstanceEnd:ie,parameters:Y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:d.symbolInstances.length,parameters:Y})}attemptAnchorPlacement(t,n,s,u,d,f,_,y,v,T,I,M,U,F,O,H){const Y=[M.textOffset0,M.textOffset1],te=xn(t,s,u,Y,d),$=this.collisionIndex.placeCollisionBox(Xr(n,te.x,te.y,f,_,this.transform.angle),I,y,v,T.predicate,H);if((!O||this.collisionIndex.placeCollisionBox(Xr(O,te.x,te.y,f,_,this.transform.angle),I,y,v,T.predicate,H).box.length!==0)&&$.box.length>0){let ne;if(this.prevPlacement&&this.prevPlacement.variableOffsets[M.crossTileID]&&this.prevPlacement.placements[M.crossTileID]&&this.prevPlacement.placements[M.crossTileID].text&&(ne=this.prevPlacement.variableOffsets[M.crossTileID].anchor),M.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[M.crossTileID]={textOffset:Y,width:s,height:u,anchor:t,textBoxScale:d,prevAnchor:ne},this.markUsedJustification(U,t,M,F),U.allowVerticalPlacement&&(this.markUsedOrientation(U,F,M),this.placedOrientations[M.crossTileID]=F),{shift:te,placedGlyphBoxes:$}}}placeLayerBucketPart(t,n,s){const{bucket:u,layout:d,posMatrix:f,textLabelPlaneMatrix:_,labelToScreenMatrix:y,textPixelRatio:v,holdingForFade:T,collisionBoxArray:I,partiallyEvaluatedTextSize:M,collisionGroup:U}=t.parameters,F=d.get("text-optional"),O=d.get("icon-optional"),H=l.getOverlapMode(d,"text-overlap","text-allow-overlap"),Y=H==="always",te=l.getOverlapMode(d,"icon-overlap","icon-allow-overlap"),$=te==="always",ne=d.get("text-rotation-alignment")==="map",ie=d.get("text-pitch-alignment")==="map",ue=d.get("icon-text-fit")!=="none",he=d.get("symbol-z-order")==="viewport-y",ve=Y&&($||!u.hasIconData()||O),ce=$&&(Y||!u.hasTextData()||F);!u.collisionArrays&&I&&u.deserializeCollisionBoxes(I);const Le=(Se,Re)=>{if(n[Se.crossTileID])return;if(T)return void(this.placements[Se.crossTileID]=new yn(!1,!1,!1));let Qe=!1,it=!1,Ge=!0,wt=null,Tt={box:null,offscreen:null},ut={box:null,offscreen:null},mt=null,St=null,ei=null,rr=0,Xi=0,nr=0;Re.textFeatureIndex?rr=Re.textFeatureIndex:Se.useRuntimeCollisionCircles&&(rr=Se.featureIndex),Re.verticalTextFeatureIndex&&(Xi=Re.verticalTextFeatureIndex);const Ur=this.retainedQueryData[u.bucketInstanceId].tileID,$i=this.terrain?(Ht,nt)=>this.terrain.getElevation(Ur,Ht,nt):null;for(const Ht of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const nt=Re[Ht];nt&&(nt.elevation=$i?$i(nt.anchorPointX,nt.anchorPointY):0)}const vi=Re.textBox;if(vi){const Ht=vt=>{let ti=l.WritingMode.horizontal;if(u.allowVerticalPlacement&&!vt&&this.prevPlacement){const ii=this.prevPlacement.placedOrientations[Se.crossTileID];ii&&(this.placedOrientations[Se.crossTileID]=ii,ti=ii,this.markUsedOrientation(u,ti,Se))}return ti},nt=(vt,ti)=>{if(u.allowVerticalPlacement&&Se.numVerticalGlyphVertices>0&&Re.verticalTextBox){for(const ii of u.writingModes)if(ii===l.WritingMode.vertical?(Tt=ti(),ut=Tt):Tt=vt(),Tt&&Tt.box&&Tt.box.length)break}else Tt=vt()};if(d.get("text-variable-anchor")){let vt=d.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Se.crossTileID]){const Ot=this.prevPlacement.variableOffsets[Se.crossTileID];vt.indexOf(Ot.anchor)>0&&(vt=vt.filter(Vi=>Vi!==Ot.anchor),vt.unshift(Ot.anchor))}const ti=(Ot,Vi,Qr)=>{const Ps=Ot.x2-Ot.x1,kn=Ot.y2-Ot.y1,Ua=Se.textBoxScale,ks=ue&&te==="never"?Vi:null;let $r={box:[],offscreen:!1};const en=H!=="never"?2*vt.length:vt.length;for(let tn=0;tn<en;++tn){const Vo=this.attemptAnchorPlacement(vt[tn%vt.length],Ot,Ps,kn,Ua,ne,ie,v,f,U,tn>=vt.length?H:"never",Se,u,Qr,ks,$i);if(Vo&&($r=Vo.placedGlyphBoxes,$r&&$r.box&&$r.box.length)){Qe=!0,wt=Vo.shift;break}}return $r};nt(()=>ti(vi,Re.iconBox,l.WritingMode.horizontal),()=>{const Ot=Re.verticalTextBox;return u.allowVerticalPlacement&&!(Tt&&Tt.box&&Tt.box.length)&&Se.numVerticalGlyphVertices>0&&Ot?ti(Ot,Re.verticalIconBox,l.WritingMode.vertical):{box:null,offscreen:null}}),Tt&&(Qe=Tt.box,Ge=Tt.offscreen);const ii=Ht(Tt&&Tt.box);if(!Qe&&this.prevPlacement){const Ot=this.prevPlacement.variableOffsets[Se.crossTileID];Ot&&(this.variableOffsets[Se.crossTileID]=Ot,this.markUsedJustification(u,Ot.anchor,Se,ii))}}else{const vt=(ti,ii)=>{const Ot=this.collisionIndex.placeCollisionBox(ti,H,v,f,U.predicate,$i);return Ot&&Ot.box&&Ot.box.length&&(this.markUsedOrientation(u,ii,Se),this.placedOrientations[Se.crossTileID]=ii),Ot};nt(()=>vt(vi,l.WritingMode.horizontal),()=>{const ti=Re.verticalTextBox;return u.allowVerticalPlacement&&Se.numVerticalGlyphVertices>0&&ti?vt(ti,l.WritingMode.vertical):{box:null,offscreen:null}}),Ht(Tt&&Tt.box&&Tt.box.length)}}if(mt=Tt,Qe=mt&&mt.box&&mt.box.length>0,Ge=mt&&mt.offscreen,Se.useRuntimeCollisionCircles){const Ht=u.text.placedSymbolArray.get(Se.centerJustifiedTextSymbolIndex),nt=l.evaluateSizeForFeature(u.textSizeData,M,Ht),vt=d.get("text-padding");St=this.collisionIndex.placeCollisionCircles(H,Ht,u.lineVertexArray,u.glyphOffsetArray,nt,f,_,y,s,ie,U.predicate,Se.collisionCircleDiameter,vt,$i),St.circles.length&&St.collisionDetected&&!s&&l.warnOnce("Collisions detected, but collision boxes are not shown"),Qe=Y||St.circles.length>0&&!St.collisionDetected,Ge=Ge&&St.offscreen}if(Re.iconFeatureIndex&&(nr=Re.iconFeatureIndex),Re.iconBox){const Ht=nt=>{const vt=ue&&wt?Xr(nt,wt.x,wt.y,ne,ie,this.transform.angle):nt;return this.collisionIndex.placeCollisionBox(vt,te,v,f,U.predicate,$i)};ut&&ut.box&&ut.box.length&&Re.verticalIconBox?(ei=Ht(Re.verticalIconBox),it=ei.box.length>0):(ei=Ht(Re.iconBox),it=ei.box.length>0),Ge=Ge&&ei.offscreen}const yr=F||Se.numHorizontalGlyphVertices===0&&Se.numVerticalGlyphVertices===0,$o=O||Se.numIconVertices===0;if(yr||$o?$o?yr||(it=it&&Qe):Qe=it&&Qe:it=Qe=it&&Qe,Qe&&mt&&mt.box&&this.collisionIndex.insertCollisionBox(mt.box,H,d.get("text-ignore-placement"),u.bucketInstanceId,ut&&ut.box&&Xi?Xi:rr,U.ID),it&&ei&&this.collisionIndex.insertCollisionBox(ei.box,te,d.get("icon-ignore-placement"),u.bucketInstanceId,nr,U.ID),St&&(Qe&&this.collisionIndex.insertCollisionCircles(St.circles,H,d.get("text-ignore-placement"),u.bucketInstanceId,rr,U.ID),s)){const Ht=u.bucketInstanceId;let nt=this.collisionCircleArrays[Ht];nt===void 0&&(nt=this.collisionCircleArrays[Ht]=new er);for(let vt=0;vt<St.circles.length;vt+=4)nt.circles.push(St.circles[vt+0]),nt.circles.push(St.circles[vt+1]),nt.circles.push(St.circles[vt+2]),nt.circles.push(St.collisionDetected?1:0)}if(Se.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(u.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Se.crossTileID]=new yn(Qe||ve,it||ce,Ge||u.justReloaded),n[Se.crossTileID]=!0};if(he){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Se=u.getSortedSymbolIndexes(this.transform.angle);for(let Re=Se.length-1;Re>=0;--Re){const Qe=Se[Re];Le(u.symbolInstances.get(Qe),u.collisionArrays[Qe])}}else for(let Se=t.symbolInstanceStart;Se<t.symbolInstanceEnd;Se++)Le(u.symbolInstances.get(Se),u.collisionArrays[Se]);if(s&&u.bucketInstanceId in this.collisionCircleArrays){const Se=this.collisionCircleArrays[u.bucketInstanceId];l.invert(Se.invProjMatrix,f),Se.viewportMatrix=this.collisionIndex.getViewportMatrix()}u.justReloaded=!1}markUsedJustification(t,n,s,u){let d;d=u===l.WritingMode.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[l.getAnchorJustification(n)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=d>=0&&_!==d?0:s.crossTileID)}markUsedOrientation(t,n,s){const u=n===l.WritingMode.horizontal||n===l.WritingMode.horizontalOnly?n:0,d=n===l.WritingMode.vertical?n:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)t.text.placedSymbolArray.get(_).placedOrientation=u;s.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=d)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let s=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const u=n?n.symbolFadeChange(t):1,d=n?n.opacities:{},f=n?n.variableOffsets:{},_=n?n.placedOrientations:{};for(const y in this.placements){const v=this.placements[y],T=d[y];T?(this.opacities[y]=new Et(T,u,v.text,v.icon),s=s||v.text!==T.text.placed||v.icon!==T.icon.placed):(this.opacities[y]=new Et(null,u,v.text,v.icon,v.skipFade),s=s||v.text||v.icon)}for(const y in d){const v=d[y];if(!this.opacities[y]){const T=new Et(v,u,!1,!1);T.isHidden()||(this.opacities[y]=T,s=s||v.text.placed||v.icon.placed)}}for(const y in f)this.variableOffsets[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.variableOffsets[y]=f[y]);for(const y in _)this.placedOrientations[y]||!this.opacities[y]||this.opacities[y].isHidden()||(this.placedOrientations[y]=_[y]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const s={};for(const u of n){const d=u.getBucket(t);d&&u.latestFeatureIndex&&t.id===d.layerIds[0]&&this.updateBucketOpacities(d,s,u.collisionBoxArray)}}updateBucketOpacities(t,n,s){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const u=t.layers[0].layout,d=new Et(null,0,!1,!1,!0),f=u.get("text-allow-overlap"),_=u.get("icon-allow-overlap"),y=u.get("text-variable-anchor"),v=u.get("text-rotation-alignment")==="map",T=u.get("text-pitch-alignment")==="map",I=u.get("icon-text-fit")!=="none",M=new Et(null,0,f&&(_||!t.hasIconData()||u.get("icon-optional")),_&&(f||!t.hasTextData()||u.get("text-optional")),!0);!t.collisionArrays&&s&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(s);const U=(F,O,H)=>{for(let Y=0;Y<O/4;Y++)F.opacityVertexArray.emplaceBack(H)};for(let F=0;F<t.symbolInstances.length;F++){const O=t.symbolInstances.get(F),{numHorizontalGlyphVertices:H,numVerticalGlyphVertices:Y,crossTileID:te}=O;let $=this.opacities[te];n[te]?$=d:$||($=M,this.opacities[te]=$),n[te]=!0;const ne=O.numIconVertices>0,ie=this.placedOrientations[O.crossTileID],ue=ie===l.WritingMode.vertical,he=ie===l.WritingMode.horizontal||ie===l.WritingMode.horizontalOnly;if(H>0||Y>0){const ve=J($.text);U(t.text,H,ue?le:ve),U(t.text,Y,he?le:ve);const ce=$.text.isHidden();[O.rightJustifiedTextSymbolIndex,O.centerJustifiedTextSymbolIndex,O.leftJustifiedTextSymbolIndex].forEach(Re=>{Re>=0&&(t.text.placedSymbolArray.get(Re).hidden=ce||ue?1:0)}),O.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(O.verticalPlacedTextSymbolIndex).hidden=ce||he?1:0);const Le=this.variableOffsets[O.crossTileID];Le&&this.markUsedJustification(t,Le.anchor,O,ie);const Se=this.placedOrientations[O.crossTileID];Se&&(this.markUsedJustification(t,"left",O,Se),this.markUsedOrientation(t,Se,O))}if(ne){const ve=J($.icon),ce=!(I&&O.verticalPlacedIconSymbolIndex&&ue);O.placedIconSymbolIndex>=0&&(U(t.icon,O.numIconVertices,ce?ve:le),t.icon.placedSymbolArray.get(O.placedIconSymbolIndex).hidden=$.icon.isHidden()),O.verticalPlacedIconSymbolIndex>=0&&(U(t.icon,O.numVerticalIconVertices,ce?le:ve),t.icon.placedSymbolArray.get(O.verticalPlacedIconSymbolIndex).hidden=$.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ve=t.collisionArrays[F];if(ve){let ce=new l.pointGeometry(0,0);if(ve.textBox||ve.verticalTextBox){let Se=!0;if(y){const Re=this.variableOffsets[te];Re?(ce=xn(Re.anchor,Re.width,Re.height,Re.textOffset,Re.textBoxScale),v&&ce._rotate(T?this.transform.angle:-this.transform.angle)):Se=!1}ve.textBox&&b(t.textCollisionBox.collisionVertexArray,$.text.placed,!Se||ue,ce.x,ce.y),ve.verticalTextBox&&b(t.textCollisionBox.collisionVertexArray,$.text.placed,!Se||he,ce.x,ce.y)}const Le=Boolean(!he&&ve.verticalIconBox);ve.iconBox&&b(t.iconCollisionBox.collisionVertexArray,$.icon.placed,Le,I?ce.x:0,I?ce.y:0),ve.verticalIconBox&&b(t.iconCollisionBox.collisionVertexArray,$.icon.placed,!Le,I?ce.x:0,I?ce.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const F=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=F.invProjMatrix,t.placementViewportMatrix=F.viewportMatrix,t.collisionCircleArray=F.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const s=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*s>t}setStale(){this.stale=!0}}function b(a,t,n,s,u){a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0),a.emplaceBack(t?1:0,n?1:0,s||0,u||0)}const S=Math.pow(2,25),k=Math.pow(2,24),D=Math.pow(2,17),G=Math.pow(2,16),K=Math.pow(2,9),W=Math.pow(2,8),q=Math.pow(2,1);function J(a){if(a.opacity===0&&!a.placed)return 0;if(a.opacity===1&&a.placed)return 4294967295;const t=a.placed?1:0,n=Math.floor(127*a.opacity);return n*S+t*k+n*D+t*G+n*K+t*W+n*q+t}const le=0;class xe{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,s,u,d){const f=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(f,u,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,d())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,y)=>_.sortKey-y.sortKey));this._currentPartIndex<f.length;)if(n.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,d())return!0;return!1}}class ae{constructor(t,n,s,u,d,f,_,y){this.placement=new R(t,n,f,_,y),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,s){const u=l.exported.now(),d=()=>{const f=l.exported.now()-u;return!this._forceFullPlacement&&f>2};for(;this._currentPlacementIndex>=0;){const f=n[t[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new xe(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,d))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Oe=512/l.EXTENT/2;class $e{constructor(t,n,s){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=s;for(let u=0;u<n.length;u++){const d=n.get(u),f=d.key;this.indexedSymbolInstances[f]||(this.indexedSymbolInstances[f]=[]),this.indexedSymbolInstances[f].push({crossTileID:d.crossTileID,coord:this.getScaledCoordinates(d,t)})}}getScaledCoordinates(t,n){const s=Oe/Math.pow(2,n.canonical.z-this.tileID.canonical.z);return{x:Math.floor((n.canonical.x*l.EXTENT+t.anchorX)*s),y:Math.floor((n.canonical.y*l.EXTENT+t.anchorY)*s)}}findMatches(t,n,s){const u=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let d=0;d<t.length;d++){const f=t.get(d);if(f.crossTileID)continue;const _=this.indexedSymbolInstances[f.key];if(!_)continue;const y=this.getScaledCoordinates(f,n);for(const v of _)if(Math.abs(v.coord.x-y.x)<=u&&Math.abs(v.coord.y-y.y)<=u&&!s[v.crossTileID]){s[v.crossTileID]=!0,f.crossTileID=v.crossTileID;break}}}}class De{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Ze{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const s in this.indexes){const u=this.indexes[s],d={};for(const f in u){const _=u[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+n),d[_.tileID.key]=_}this.indexes[s]=d}this.lng=t}addBucket(t,n,s){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let d=0;d<n.symbolInstances.length;d++)n.symbolInstances.get(d).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const u=this.usedCrossTileIDs[t.overscaledZ];for(const d in this.indexes){const f=this.indexes[d];if(Number(d)>t.overscaledZ)for(const _ in f){const y=f[_];y.tileID.isChildOf(t)&&y.findMatches(n.symbolInstances,t,u)}else{const _=f[t.scaledTo(Number(d)).key];_&&_.findMatches(n.symbolInstances,t,u)}}for(let d=0;d<n.symbolInstances.length;d++){const f=n.symbolInstances.get(d);f.crossTileID||(f.crossTileID=s.generate(),u[f.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new $e(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const s in n.indexedSymbolInstances)for(const u of n.indexedSymbolInstances[s])delete this.usedCrossTileIDs[t][u.crossTileID]}removeStaleBuckets(t){let n=!1;for(const s in this.indexes){const u=this.indexes[s];for(const d in u)t[u[d].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,u[d]),delete u[d],n=!0)}return n}}class Xe{constructor(){this.layerIndexes={},this.crossTileIDs=new De,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,s){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new Ze);let d=!1;const f={};u.handleWrapJump(s);for(const _ of n){const y=_.getBucket(t);y&&t.id===y.layerIds[0]&&(y.bucketInstanceId||(y.bucketInstanceId=++this.maxBucketInstanceId),u.addBucket(_.tileID,y,this.crossTileIDs)&&(d=!0),f[y.bucketInstanceId]=!0)}return u.removeStaleBuckets(f)&&(d=!0),d}pruneUnusedLayers(t){const n={};t.forEach(s=>{n[s]=!0});for(const s in this.layerIndexes)n[s]||delete this.layerIndexes[s]}}var pt=l.createLayout([{name:"a_pos",type:"Int16",components:2}]);class Ke extends l.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const n=this._tiles[t];n.textures.forEach(s=>s.destroy()),n.textures=[]}}update(t,n){this.sourceCache.update(t,n),this._renderableTilesKeys=[];for(const s of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n}))this._renderableTilesKeys.push(s.key),this._tiles[s.key]||(s.posMatrix=new Float64Array(16),l.ortho(s.posMatrix,0,l.EXTENT,0,l.EXTENT,0,1),this._tiles[s.key]=new Sr(s,this.tileSize))}removeOutdated(t){const n={};this.renderHistory=this.renderHistory.filter((s,u)=>this.renderHistory.indexOf(s)===u).slice(0,this.renderHistorySize);for(const s of this._renderableTilesKeys)n[s]=!0;for(const s of this.renderHistory)n[s]=!0;for(const s in this._tiles)n[s]||(this._tiles[s].clearTextures(t),delete this._tiles[s])}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const n={};for(const s of this._renderableTilesKeys){const u=this._tiles[s].tileID;if(u.canonical.equals(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16),l.ortho(d.posMatrix,0,l.EXTENT,0,l.EXTENT,0,1),n[s]=d}else if(u.canonical.isChildOf(t.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const f=u.canonical.z-t.canonical.z,_=u.canonical.x-(u.canonical.x>>f<<f),y=u.canonical.y-(u.canonical.y>>f<<f),v=l.EXTENT>>f;l.ortho(d.posMatrix,0,v,0,v,0,1),l.translate(d.posMatrix,d.posMatrix,[-_*v,-y*v,0]),n[s]=d}else if(t.canonical.isChildOf(u.canonical)){const d=t.clone();d.posMatrix=new Float64Array(16);const f=t.canonical.z-u.canonical.z,_=t.canonical.x-(t.canonical.x>>f<<f),y=t.canonical.y-(t.canonical.y>>f<<f),v=l.EXTENT>>f;l.ortho(d.posMatrix,0,l.EXTENT,0,l.EXTENT,0,1),l.translate(d.posMatrix,d.posMatrix,[_*v,y*v,0]),l.scale(d.posMatrix,d.posMatrix,[1/2**f,1/2**f,0]),n[s]=d}}return n}getSourceTile(t,n){const s=this.sourceCache._source;let u=t.overscaledZ-this.deltaZoom;if(u>s.maxzoom&&(u=s.maxzoom),u<s.minzoom)return null;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(u).key);let d=this.sourceCache.getTileByID(this._sourceTileCache[t.key]);if((!d||!d.dem)&&n)for(;u>=s.minzoom&&(!d||!d.dem);)d=this.sourceCache.getTileByID(t.scaledTo(u--).key);return d}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(n=>n.timeLoaded>=t)}}class tt{constructor(t,n,s){this.style=t,this.sourceCache=new Ke(n),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.elevationOffset=typeof s.elevationOffset=="number"?s.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,n,s,u=l.EXTENT){if(!(n>=0&&n<u&&s>=0&&s<u))return this.elevationOffset;let d=0;const f=this.getTerrainData(t);if(f.tile&&f.tile.dem){const _=l.transformMat4$1([],[n/u*l.EXTENT,s/u*l.EXTENT],f.u_terrain_matrix),y=[_[0]*f.tile.dem.dim,_[1]*f.tile.dem.dim],v=[Math.floor(y[0]),Math.floor(y[1])],T=f.tile.dem.get(v[0],v[1]),I=f.tile.dem.get(v[0],v[1]+1),M=f.tile.dem.get(v[0]+1,v[1]),U=f.tile.dem.get(v[0]+1,v[1]+1);d=l.number(l.number(T,I,y[0]-v[0]),l.number(M,U,y[0]-v[0]),y[1]-v[1])}return d}rememberForRerender(t,n){for(const s in this.sourceCache._tiles){const u=this.sourceCache._tiles[s];(u.tileID.equals(n)||u.tileID.isChildOf(n))&&(t===this.sourceCache.sourceCache.id&&(u.timeLoaded=Date.now()),this._rerender[t]=this._rerender[t]||{},this._rerender[t][u.tileID.key]=!0)}}needsRerender(t,n){return this._rerender[t]&&this._rerender[t][n.key]}clearRerenderCache(){this._rerender={}}getElevation(t,n,s,u=l.EXTENT){return(this.getDEMElevation(t,n,s,u)+this.elevationOffset)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const u=this.style.map.painter.context,d=new l.RGBAImage({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new He(u,d,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new He(u,new l.RGBAImage({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=l.identity([])}const n=this.sourceCache.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const u=this.style.map.painter.context;n.demTexture=this.style.map.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new He(u,n.dem.getPixels(),u.gl.RGBA,{premultiply:!1}),n.demTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const s=n&&n+n.tileID.key+t.key;if(s&&!this._demMatrixCache[s]){const u=this.sourceCache.sourceCache._source.maxzoom;let d=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=u?d=t.canonical.z-u:l.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=t.canonical.x-(t.canonical.x>>d<<d),_=t.canonical.y-(t.canonical.y>>d<<d),y=l.fromScaling(new Float64Array(16),[1/(l.EXTENT<<d),1/(l.EXTENT<<d),0]);l.translate(y,y,[f*l.EXTENT,_*l.EXTENT,0]),this._demMatrixCache[t.key]={matrix:y,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_offset:this.elevationOffset,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getRTTFramebuffer(){const t=this.style.map.painter;if(!this._rttFramebuffer){const n=this.sourceCache.tileSize*this.qualityFactor;this._rttFramebuffer=t.context.createFramebuffer(n,n,!0),this._rttFramebuffer.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,n,n))}return this._rttFramebuffer}getFramebuffer(t){const n=this.style.map.painter,s=n.width/devicePixelRatio,u=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===u||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new He(n.context,{width:s,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new He(n.context,{width:s,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(s,u,!0),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,s,u))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.style.map.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let d=0,f=0;d<this._coordsTextureSize;d++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)n[f+0]=255&_,n[f+1]=255&d,n[f+2]=_>>8<<4|d>>8,n[f+3]=0;const s=new l.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new He(t,s,t.gl.RGBA,{premultiply:!1});return u.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=u,u}pointCoordinate(t){const n=new Uint8Array(4),s=this.style.map.painter,u=s.context,d=u.gl;u.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),d.readPixels(t.x,s.height/devicePixelRatio-t.y-1,1,1,d.RGBA,d.UNSIGNED_BYTE,n),u.bindFramebuffer.set(null);const f=n[0]+(n[2]>>4<<8),_=n[1]+((15&n[2])<<8),y=this.coordsIndex[255-n[3]],v=y&&this.sourceCache.getTileByID(y);if(!v)return null;const T=this._coordsTextureSize,I=(1<<v.tileID.canonical.z)*T;return new l.MercatorCoordinate((v.tileID.canonical.x*T+f)/I,(v.tileID.canonical.y*T+_)/I,this.getElevation(v.tileID,f,_,T))}getTerrainMesh(){if(this._mesh)return this._mesh;const t=this.style.map.painter.context,n=new l.PosArray,s=new l.TriangleIndexArray,u=this.meshSize,d=l.EXTENT/u,f=u*u;for(let _=0;_<=u;_++)for(let y=0;y<=u;y++)n.emplaceBack(y*d,_*d);for(let _=0;_<f;_+=u+1)for(let y=0;y<u;y++)s.emplaceBack(y+_,u+y+_+1,u+y+_+2),s.emplaceBack(y+_,u+y+_+2,y+_+1);return this._mesh={indexBuffer:t.createIndexBuffer(s),vertexBuffer:t.createVertexBuffer(n,pt.members),segments:l.SegmentVector.simpleSegment(0,0,n.length,s.length)},this._mesh}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,s={minElevation:null,maxElevation:null};return n&&n.dem&&(s.minElevation=(n.dem.min+this.elevationOffset)*this.exaggeration,s.maxElevation=(n.dem.max+this.elevationOffset)*this.exaggeration),s}}const ft=(a,t)=>l.emitValidationErrors(a,t&&t.filter(n=>n.identifier!=="source.canvas")),It=l.pick(ht,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Qt=l.pick(ht,["setCenter","setZoom","setBearing","setPitch"]),Lt=function(){const a={},t=l.spec.$version;for(const n in l.spec.$root){const s=l.spec.$root[n];if(s.required){let u=null;u=n==="version"?t:s.type==="array"?[]:{},u!=null&&(a[n]=u)}}return a}();class li extends l.Evented{constructor(t,n={}){super(),this.map=t,this.dispatcher=new ar(fn(),this),this.imageManager=new Mt,this.imageManager.setEventedParent(this),this.glyphManager=new Vt(t._requestManager,n.localIdeographFontFamily),this.lineAtlas=new vo(256,512),this.crossTileSymbolIndex=new Xe,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",l.getReferrer());const s=this;this._rtlTextPluginCallback=li.registerForPluginStateChange(u=>{s.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:u.pluginStatus,pluginURL:u.pluginURL},(d,f)=>{if(l.triggerPluginCompletionEvent(d),f&&f.every(_=>_))for(const _ in s.sourceCaches)s.sourceCaches[_].reload()})}),this.on("data",u=>{if(u.dataType!=="source"||u.sourceDataType!=="metadata")return;const d=this.sourceCaches[u.sourceId];if(!d)return;const f=d.getSource();if(f&&f.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];y.source===f.id&&this._validateLayer(y)}})}loadURL(t,n={}){this.fire(new l.Event("dataloading",{dataType:"style"}));const s=typeof n.validate!="boolean"||n.validate,u=this.map._requestManager.transformRequest(t,l.ResourceType.Style);this._request=l.getJSON(u,(d,f)=>{this._request=null,d?this.fire(new l.ErrorEvent(d)):f&&this._load(f,s)})}loadJSON(t,n={}){this.fire(new l.Event("dataloading",{dataType:"style"})),this._request=l.exported.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new l.Event("dataloading",{dataType:"style"})),this._load(Lt,!1)}_load(t,n){if(n&&ft(this,l.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const u in t.sources)this.addSource(u,t.sources[u],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const s=Vn(this.stylesheet.layers);this._order=s.map(u=>u.id),this._layers={},this._serializedLayers={};for(let u of s)u=l.createStyleLayer(u),u.setEventedParent(this,{layer:{id:u.id}}),this._layers[u.id]=u,this._serializedLayers[u.id]=u.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new _i(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new l.Event("data",{dataType:"style"})),this.fire(new l.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(n,s,u,d){let f,_,y;const v=u>1?"@2x":"";let T=l.getJSON(s.transformRequest(s.normalizeSpriteURL(n,v,".json"),l.ResourceType.SpriteJSON),(U,F)=>{T=null,y||(y=U,f=F,M())}),I=l.getImage(s.transformRequest(s.normalizeSpriteURL(n,v,".png"),l.ResourceType.SpriteImage),(U,F)=>{I=null,y||(y=U,_=F,M())});function M(){if(y)d(y);else if(f&&_){const U=l.exported.getImageData(_),F={};for(const O in f){const{width:H,height:Y,x:te,y:$,sdf:ne,pixelRatio:ie,stretchX:ue,stretchY:he,content:ve}=f[O],ce=new l.RGBAImage({width:H,height:Y});l.RGBAImage.copy(U,ce,{x:te,y:$},{x:0,y:0},{width:H,height:Y}),F[O]={data:ce,pixelRatio:ie,sdf:ne,stretchX:ue,stretchY:he,content:ve}}d(null,F)}}return{cancel(){T&&(T.cancel(),T=null),I&&(I.cancel(),I=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(n,s)=>{if(this._spriteRequest=null,n)this.fire(new l.ErrorEvent(n));else if(s)for(const u in s)this.imageManager.addImage(u,s[u]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.Event("data",{dataType:"style"}))})}_validateLayer(t){const n=this.sourceCaches[t.source];if(!n)return;const s=t.sourceLayer;if(!s)return;const u=n.getSource();(u.type==="geojson"||u.vectorLayerIds&&u.vectorLayerIds.indexOf(s)===-1)&&this.fire(new l.ErrorEvent(new Error(`Source layer "${s}" does not exist on source "${u.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const n=[];for(const s of t){const u=this._layers[s];u.type!=="custom"&&n.push(u.serialize())}return n}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(this._changed){const u=Object.keys(this._updatedLayers),d=Object.keys(this._removedLayers);(u.length||d.length)&&this._updateWorkerLayers(u,d);for(const f in this._updatedSources){const _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(f)}}this._updateTilesForChangedImages();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const s={};for(const u in this.sourceCaches){const d=this.sourceCaches[u];s[u]=d.used,d.used=!1}for(const u of this._order){const d=this._layers[u];d.recalculate(t,this._availableImages),!d.isHidden(t.zoom)&&d.source&&(this.sourceCaches[d.source].used=!0)}for(const u in s){const d=this.sourceCaches[u];s[u]!==d.used&&d.fire(new l.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.z=t.zoom,n&&this.fire(new l.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const n=this.sourceCaches[t.source];if(!n)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain=new tt(this,n,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=s=>{s.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=s=>{s.tile&&(s.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(s.sourceId,s.tile.tileID)):s.source.type==="geojson"&&this.terrain.rememberForRerender(s.sourceId,s.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new l.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),ft(this,l.validateStyle(t)))return!1;(t=l.clone$1(t)).layers=Vn(t.layers);const n=function(u,d){if(!u)return[{command:ht.setStyle,args:[d]}];let f=[];try{if(!we(u.version,d.version))return[{command:ht.setStyle,args:[d]}];we(u.center,d.center)||f.push({command:ht.setCenter,args:[d.center]}),we(u.zoom,d.zoom)||f.push({command:ht.setZoom,args:[d.zoom]}),we(u.bearing,d.bearing)||f.push({command:ht.setBearing,args:[d.bearing]}),we(u.pitch,d.pitch)||f.push({command:ht.setPitch,args:[d.pitch]}),we(u.sprite,d.sprite)||f.push({command:ht.setSprite,args:[d.sprite]}),we(u.glyphs,d.glyphs)||f.push({command:ht.setGlyphs,args:[d.glyphs]}),we(u.transition,d.transition)||f.push({command:ht.setTransition,args:[d.transition]}),we(u.light,d.light)||f.push({command:ht.setLight,args:[d.light]});const _={},y=[];(function(T,I,M,U){let F;for(F in I=I||{},T=T||{})Object.prototype.hasOwnProperty.call(T,F)&&(Object.prototype.hasOwnProperty.call(I,F)||Mr(F,M,U));for(F in I)Object.prototype.hasOwnProperty.call(I,F)&&(Object.prototype.hasOwnProperty.call(T,F)?we(T[F],I[F])||(T[F].type==="geojson"&&I[F].type==="geojson"&&Nn(T,I,F)?M.push({command:ht.setGeoJSONSourceData,args:[F,I[F].data]}):zr(F,I,M,U)):Qi(F,I,M))})(u.sources,d.sources,y,_);const v=[];u.layers&&u.layers.forEach(T=>{_[T.source]?f.push({command:ht.removeLayer,args:[T.id]}):v.push(T)}),f=f.concat(y),function(T,I,M){I=I||[];const U=(T=T||[]).map(pr),F=I.map(pr),O=T.reduce(gn,{}),H=I.reduce(gn,{}),Y=U.slice(),te=Object.create(null);let $,ne,ie,ue,he,ve,ce;for($=0,ne=0;$<U.length;$++)ie=U[$],Object.prototype.hasOwnProperty.call(H,ie)?ne++:(M.push({command:ht.removeLayer,args:[ie]}),Y.splice(Y.indexOf(ie,ne),1));for($=0,ne=0;$<F.length;$++)ie=F[F.length-1-$],Y[Y.length-1-$]!==ie&&(Object.prototype.hasOwnProperty.call(O,ie)?(M.push({command:ht.removeLayer,args:[ie]}),Y.splice(Y.lastIndexOf(ie,Y.length-ne),1)):ne++,ve=Y[Y.length-$],M.push({command:ht.addLayer,args:[H[ie],ve]}),Y.splice(Y.length-$,0,ie),te[ie]=!0);for($=0;$<F.length;$++)if(ie=F[$],ue=O[ie],he=H[ie],!te[ie]&&!we(ue,he))if(we(ue.source,he.source)&&we(ue["source-layer"],he["source-layer"])&&we(ue.type,he.type)){for(ce in dr(ue.layout,he.layout,M,ie,null,ht.setLayoutProperty),dr(ue.paint,he.paint,M,ie,null,ht.setPaintProperty),we(ue.filter,he.filter)||M.push({command:ht.setFilter,args:[ie,he.filter]}),we(ue.minzoom,he.minzoom)&&we(ue.maxzoom,he.maxzoom)||M.push({command:ht.setLayerZoomRange,args:[ie,he.minzoom,he.maxzoom]}),ue)Object.prototype.hasOwnProperty.call(ue,ce)&&ce!=="layout"&&ce!=="paint"&&ce!=="filter"&&ce!=="metadata"&&ce!=="minzoom"&&ce!=="maxzoom"&&(ce.indexOf("paint.")===0?dr(ue[ce],he[ce],M,ie,ce.slice(6),ht.setPaintProperty):we(ue[ce],he[ce])||M.push({command:ht.setLayerProperty,args:[ie,ce,he[ce]]}));for(ce in he)Object.prototype.hasOwnProperty.call(he,ce)&&!Object.prototype.hasOwnProperty.call(ue,ce)&&ce!=="layout"&&ce!=="paint"&&ce!=="filter"&&ce!=="metadata"&&ce!=="minzoom"&&ce!=="maxzoom"&&(ce.indexOf("paint.")===0?dr(ue[ce],he[ce],M,ie,ce.slice(6),ht.setPaintProperty):we(ue[ce],he[ce])||M.push({command:ht.setLayerProperty,args:[ie,ce,he[ce]]}))}else M.push({command:ht.removeLayer,args:[ie]}),ve=Y[Y.lastIndexOf(ie)+1],M.push({command:ht.addLayer,args:[he,ve]})}(v,d.layers,f)}catch(_){console.warn("Unable to compute style diff:",_),f=[{command:ht.setStyle,args:[d]}]}return f}(this.serialize(),t).filter(u=>!(u.command in Qt));if(n.length===0)return!1;const s=n.filter(u=>!(u.command in It));if(s.length>0)throw new Error(`Unimplemented: ${s.map(u=>u.command).join(", ")}.`);return n.forEach(u=>{u.command!=="setTransition"&&this[u.command].apply(this,u.args)}),this.stylesheet=t,!0}addImage(t,n){if(this.getImage(t))return this.fire(new l.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new l.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new l.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,s={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(l.validateStyle.source,`sources.${t}`,n,null,s))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.sourceCaches[t]=new yi(t,n,this.dispatcher);u.style=this,u.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:u.serialize(),sourceId:t})),u.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===t)return this.fire(new l.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${s}" is using it.`)));const n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire(new l.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const s=this.sourceCaches[t].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(n),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,n,s={}){this._checkLoaded();const u=t.id;if(this.getLayer(u))return void this.fire(new l.ErrorEvent(new Error(`Layer "${u}" already exists on this map.`)));let d;if(t.type==="custom"){if(ft(this,l.validateCustomStyleLayer(t)))return;d=l.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(u,t.source),t=l.clone$1(t),t=l.extend(t,{source:u})),this._validate(l.validateStyle.layer,`layers.${u}`,t,{arrayIndex:-1},s))return;d=l.createStyleLayer(t),this._validateLayer(d),d.setEventedParent(this,{layer:{id:u}}),this._serializedLayers[d.id]=d.serialize()}const f=n?this._order.indexOf(n):this._order.length;if(n&&f===-1)this.fire(new l.ErrorEvent(new Error(`Cannot add layer "${u}" before non-existing layer "${n}".`)));else{if(this._order.splice(f,0,u),this._layerOrderChanged=!0,this._layers[u]=d,this._removedLayers[u]&&d.source&&d.type!=="custom"){const _=this._removedLayers[u];delete this._removedLayers[u],_.type!==d.type?this._updatedSources[d.source]="clear":(this._updatedSources[d.source]="reload",this.sourceCaches[d.source].pause())}this._updateLayer(d),d.onAdd&&d.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new l.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const s=this._order.indexOf(t);this._order.splice(s,1);const u=n?this._order.indexOf(n):this._order.length;n&&u===-1?this.fire(new l.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(u,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new l.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const s=this._order.indexOf(t);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,s){this._checkLoaded();const u=this.getLayer(t);u?u.minzoom===n&&u.maxzoom===s||(n!=null&&(u.minzoom=n),s!=null&&(u.maxzoom=s),this._updateLayer(u)):this.fire(new l.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,s={}){this._checkLoaded();const u=this.getLayer(t);if(u){if(!we(u.filter,n))return n==null?(u.filter=void 0,void this._updateLayer(u)):void(this._validate(l.validateStyle.filter,`layers.${u.id}.filter`,n,null,s)||(u.filter=l.clone$1(n),this._updateLayer(u)))}else this.fire(new l.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return l.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,n,s,u={}){this._checkLoaded();const d=this.getLayer(t);d?we(d.getLayoutProperty(n),s)||(d.setLayoutProperty(n,s,u),this._updateLayer(d)):this.fire(new l.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const s=this.getLayer(t);if(s)return s.getLayoutProperty(n);this.fire(new l.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,s,u={}){this._checkLoaded();const d=this.getLayer(t);d?we(d.getPaintProperty(n),s)||(d.setPaintProperty(n,s,u)&&this._updateLayer(d),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new l.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const s=t.source,u=t.sourceLayer,d=this.sourceCaches[s];if(d===void 0)return void this.fire(new l.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const f=d.getSource().type;f==="geojson"&&u?this.fire(new l.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||u?(t.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided."))),d.setFeatureState(u,t.id,n)):this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const s=t.source,u=this.sourceCaches[s];if(u===void 0)return void this.fire(new l.ErrorEvent(new Error(`The source '${s}' does not exist in the map's style.`)));const d=u.getSource().type,f=d==="vector"?t.sourceLayer:void 0;d!=="vector"||f?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new l.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(f,t.id,n):this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,s=t.sourceLayer,u=this.sourceCaches[n];if(u!==void 0)return u.getSource().type!=="vector"||s?(t.id===void 0&&this.fire(new l.ErrorEvent(new Error("The feature id parameter must be provided."))),u.getFeatureState(s,t.id)):void this.fire(new l.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.ErrorEvent(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return l.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return l.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:l.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=f=>this._layers[f].type==="fill-extrusion",s={},u=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_)){s[_]=f;for(const y of t){const v=y[_];if(v)for(const T of v)u.push(T)}}}u.sort((f,_)=>_.intersectionZ-f.intersectionZ);const d=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(n(_))for(let y=u.length-1;y>=0;y--){const v=u[y].feature;if(s[v.layer.id]<f)break;d.push(v),u.pop()}else for(const y of t){const v=y[_];if(v)for(const T of v)d.push(T.feature)}}return d}queryRenderedFeatures(t,n,s){n&&n.filter&&this._validate(l.validateStyle.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new l.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(const f of n.layers){const _=this._layers[f];if(!_)return this.fire(new l.ErrorEvent(new Error(`The layer '${f}' does not exist in the map's style and cannot be queried for features.`))),[];u[_.source]=!0}}const d=[];n.availableImages=this._availableImages;for(const f in this.sourceCaches)n.layers&&!u[f]||d.push(dn(this.sourceCaches[f],this._layers,this._serializedLayers,t,n,s));return this.placement&&d.push(function(f,_,y,v,T,I,M){const U={},F=I.queryRenderedSymbols(v),O=[];for(const H of Object.keys(F).map(Number))O.push(M[H]);O.sort(Yi);for(const H of O){const Y=H.featureIndex.lookupSymbolFeatures(F[H.bucketInstanceId],_,H.bucketIndex,H.sourceLayerIndex,T.filter,T.layers,T.availableImages,f);for(const te in Y){const $=U[te]=U[te]||[],ne=Y[te];ne.sort((ie,ue)=>{const he=H.featureSortOrder;if(he){const ve=he.indexOf(ie.featureIndex);return he.indexOf(ue.featureIndex)-ve}return ue.featureIndex-ie.featureIndex});for(const ie of ne)$.push(ie)}}for(const H in U)U[H].forEach(Y=>{const te=Y.feature,$=y[f[H].source].getFeatureState(te.layer["source-layer"],te.id);te.source=te.layer.source,te.layer["source-layer"]&&(te.sourceLayer=te.layer["source-layer"]),te.state=$});return U}(this._layers,this._serializedLayers,this.sourceCaches,t,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(d)}querySourceFeatures(t,n){n&&n.filter&&this._validate(l.validateStyle.filter,"querySourceFeatures.filter",n.filter,null,n);const s=this.sourceCaches[t];return s?function(u,d){const f=u.getRenderableIds().map(v=>u.getTileByID(v)),_=[],y={};for(let v=0;v<f.length;v++){const T=f[v],I=T.tileID.canonical.key;y[I]||(y[I]=!0,T.querySourceFeatures(_,d))}return _}(s,n):[]}addSourceType(t,n,s){return li.getSourceType(t)?s(new Error(`A source type called "${t}" already exists.`)):(li.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},s):s(null,null))}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const s=this.light.getLight();let u=!1;for(const f in t)if(!we(t[f],s[f])){u=!0;break}if(!u)return;const d={now:l.exported.now(),transition:l.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(d)}_validate(t,n,s,u,d={}){return(!d||d.validate!==!1)&&ft(this,t.call(l.validateStyle,l.extend({key:n,style:this.serialize(),value:s,styleSpec:l.spec},u)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),l.evented.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._layers)this._layers[t].setEventedParent(null);for(const t in this.sourceCaches){const n=this.sourceCaches[t];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove()}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(const n in this.sourceCaches)this.sourceCaches[n].update(t,this.terrain)}_generateCollisionBoxes(){for(const t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,n,s,u,d=!1){let f=!1,_=!1;const y={};for(const v of this._order){const T=this._layers[v];if(T.type!=="symbol")continue;if(!y[T.source]){const M=this.sourceCaches[T.source];y[T.source]=M.getRenderableIds(!0).map(U=>M.getTileByID(U)).sort((U,F)=>F.tileID.overscaledZ-U.tileID.overscaledZ||(U.tileID.isLessThan(F.tileID)?-1:1))}const I=this.crossTileSymbolIndex.addLayer(T,y[T.source],t.center.lng);f=f||I}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((d=d||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(l.exported.now(),t.zoom))&&(this.pauseablePlacement=new ae(t,this.terrain,this._order,d,n,s,u,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,y),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(l.exported.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const v of this._order){const T=this._layers[v];T.type==="symbol"&&this.placement.updateLayerOpacities(T,y[T.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(l.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,n,s){this.imageManager.getImages(n.icons,s),this._updateTilesForChangedImages();const u=this.sourceCaches[n.source];u&&u.setDependencies(n.tileID.key,n.type,n.icons)}getGlyphs(t,n,s){this.glyphManager.getGlyphs(n.stacks,s)}getResource(t,n,s){return l.makeRequest(n,s)}}li.getSourceType=function(a){return un[a]},li.setSourceType=function(a,t){un[a]=t},li.registerForPluginStateChange=l.registerForPluginStateChange;var vn="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const Gn={prelude:Ct(`#ifdef GL_ES
11
+ precision mediump float;
12
+ #else
13
+ #if !defined(lowp)
14
+ #define lowp
15
+ #endif
16
+ #if !defined(mediump)
17
+ #define mediump
18
+ #endif
19
+ #if !defined(highp)
20
+ #define highp
21
+ #endif
22
+ #endif`,`#ifdef GL_ES
23
+ precision highp float;
24
+ #else
25
+ #if !defined(lowp)
26
+ #define lowp
27
+ #endif
28
+ #if !defined(mediump)
29
+ #define mediump
30
+ #endif
31
+ #if !defined(highp)
32
+ #define highp
33
+ #endif
34
+ #endif
35
+ vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
36
+ );}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;}
37
+ #ifdef TERRAIN3D
38
+ uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_offset;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
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(texture2D(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(vec2 pos) {
53
+ #ifdef TERRAIN3D
54
+ vec4 rgb=(texture2D(u_terrain,pos)*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
+ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return (elevation+u_terrain_offset)*u_terrain_exaggeration;
61
+ #else
62
+ return 0.0;
63
+ #endif
64
+ }`),background:Ct(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
65
+ #ifdef OVERDRAW_INSPECTOR
66
+ gl_FragColor=vec4(1.0);
67
+ #endif
68
+ }`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:Ct(`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;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;
69
+ #ifdef OVERDRAW_INSPECTOR
70
+ gl_FragColor=vec4(1.0);
71
+ #endif
72
+ }`,"uniform mat4 u_matrix;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;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);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);}"),circle:Ct(`varying vec3 v_data;varying float v_visibility;
73
+ #pragma mapbox: define highp vec4 color
74
+ #pragma mapbox: define mediump float radius
75
+ #pragma mapbox: define lowp float blur
76
+ #pragma mapbox: define lowp float opacity
77
+ #pragma mapbox: define highp vec4 stroke_color
78
+ #pragma mapbox: define mediump float stroke_width
79
+ #pragma mapbox: define lowp float stroke_opacity
80
+ void main() {
81
+ #pragma mapbox: initialize highp vec4 color
82
+ #pragma mapbox: initialize mediump float radius
83
+ #pragma mapbox: initialize lowp float blur
84
+ #pragma mapbox: initialize lowp float opacity
85
+ #pragma mapbox: initialize highp vec4 stroke_color
86
+ #pragma mapbox: initialize mediump float stroke_width
87
+ #pragma mapbox: initialize lowp float stroke_opacity
88
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);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));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);
89
+ #ifdef OVERDRAW_INSPECTOR
90
+ gl_FragColor=vec4(1.0);
91
+ #endif
92
+ }`,`uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;
93
+ #pragma mapbox: define highp vec4 color
94
+ #pragma mapbox: define mediump float radius
95
+ #pragma mapbox: define lowp float blur
96
+ #pragma mapbox: define lowp float opacity
97
+ #pragma mapbox: define highp vec4 stroke_color
98
+ #pragma mapbox: define mediump float stroke_width
99
+ #pragma mapbox: define lowp float stroke_opacity
100
+ void main(void) {
101
+ #pragma mapbox: initialize highp vec4 color
102
+ #pragma mapbox: initialize mediump float radius
103
+ #pragma mapbox: initialize lowp float blur
104
+ #pragma mapbox: initialize lowp float opacity
105
+ #pragma mapbox: initialize highp vec4 stroke_color
106
+ #pragma mapbox: initialize mediump float stroke_width
107
+ #pragma mapbox: initialize lowp float stroke_opacity
108
+ vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);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;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:Ct("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Ct(`uniform highp float u_intensity;varying vec2 v_extrude;
109
+ #pragma mapbox: define highp float weight
110
+ #define GAUSS_COEF 0.3989422804014327
111
+ void main() {
112
+ #pragma mapbox: initialize highp float weight
113
+ float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);
114
+ #ifdef OVERDRAW_INSPECTOR
115
+ gl_FragColor=vec4(1.0);
116
+ #endif
117
+ }`,`uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;
118
+ #pragma mapbox: define highp float weight
119
+ #pragma mapbox: define mediump float radius
120
+ const highp float ZERO=1.0/255.0/16.0;
121
+ #define GAUSS_COEF 0.3989422804014327
122
+ void main(void) {
123
+ #pragma mapbox: initialize highp float weight
124
+ #pragma mapbox: initialize mediump float radius
125
+ vec2 unscaled_extrude=vec2(mod(a_pos,2.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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}`),heatmapTexture:Ct(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;
126
+ #ifdef OVERDRAW_INSPECTOR
127
+ gl_FragColor=vec4(0.0);
128
+ #endif
129
+ }`,"uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Ct("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Ct("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;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;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),debug:Ct("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}"),fill:Ct(`#pragma mapbox: define highp vec4 color
130
+ #pragma mapbox: define lowp float opacity
131
+ void main() {
132
+ #pragma mapbox: initialize highp vec4 color
133
+ #pragma mapbox: initialize lowp float opacity
134
+ gl_FragColor=color*opacity;
135
+ #ifdef OVERDRAW_INSPECTOR
136
+ gl_FragColor=vec4(1.0);
137
+ #endif
138
+ }`,`attribute vec2 a_pos;uniform mat4 u_matrix;
139
+ #pragma mapbox: define highp vec4 color
140
+ #pragma mapbox: define lowp float opacity
141
+ void main() {
142
+ #pragma mapbox: initialize highp vec4 color
143
+ #pragma mapbox: initialize lowp float opacity
144
+ gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:Ct(`varying vec2 v_pos;
145
+ #pragma mapbox: define highp vec4 outline_color
146
+ #pragma mapbox: define lowp float opacity
147
+ void main() {
148
+ #pragma mapbox: initialize highp vec4 outline_color
149
+ #pragma mapbox: initialize lowp float opacity
150
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
151
+ #ifdef OVERDRAW_INSPECTOR
152
+ gl_FragColor=vec4(1.0);
153
+ #endif
154
+ }`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
155
+ #pragma mapbox: define highp vec4 outline_color
156
+ #pragma mapbox: define lowp float opacity
157
+ void main() {
158
+ #pragma mapbox: initialize highp vec4 outline_color
159
+ #pragma mapbox: initialize lowp float opacity
160
+ gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:Ct(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
161
+ #pragma mapbox: define lowp float opacity
162
+ #pragma mapbox: define lowp vec4 pattern_from
163
+ #pragma mapbox: define lowp vec4 pattern_to
164
+ void main() {
165
+ #pragma mapbox: initialize lowp float opacity
166
+ #pragma mapbox: initialize mediump vec4 pattern_from
167
+ #pragma mapbox: initialize mediump vec4 pattern_to
168
+ 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=texture2D(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=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;
169
+ #ifdef OVERDRAW_INSPECTOR
170
+ gl_FragColor=vec4(1.0);
171
+ #endif
172
+ }`,`uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;
173
+ #pragma mapbox: define lowp float opacity
174
+ #pragma mapbox: define lowp vec4 pattern_from
175
+ #pragma mapbox: define lowp vec4 pattern_to
176
+ #pragma mapbox: define lowp float pixel_ratio_from
177
+ #pragma mapbox: define lowp float pixel_ratio_to
178
+ void main() {
179
+ #pragma mapbox: initialize lowp float opacity
180
+ #pragma mapbox: initialize mediump vec4 pattern_from
181
+ #pragma mapbox: initialize mediump vec4 pattern_to
182
+ #pragma mapbox: initialize lowp float pixel_ratio_from
183
+ #pragma mapbox: initialize lowp float pixel_ratio_to
184
+ 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=u_matrix*vec4(a_pos,0,1);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;}`),fillPattern:Ct(`#ifdef GL_ES
185
+ precision highp float;
186
+ #endif
187
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
188
+ #pragma mapbox: define lowp float opacity
189
+ #pragma mapbox: define lowp vec4 pattern_from
190
+ #pragma mapbox: define lowp vec4 pattern_to
191
+ void main() {
192
+ #pragma mapbox: initialize lowp float opacity
193
+ #pragma mapbox: initialize mediump vec4 pattern_from
194
+ #pragma mapbox: initialize mediump vec4 pattern_to
195
+ 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;
196
+ #ifdef OVERDRAW_INSPECTOR
197
+ gl_FragColor=vec4(1.0);
198
+ #endif
199
+ }`,`uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;
200
+ #pragma mapbox: define lowp float opacity
201
+ #pragma mapbox: define lowp vec4 pattern_from
202
+ #pragma mapbox: define lowp vec4 pattern_to
203
+ #pragma mapbox: define lowp float pixel_ratio_from
204
+ #pragma mapbox: define lowp float pixel_ratio_to
205
+ void main() {
206
+ #pragma mapbox: initialize lowp float opacity
207
+ #pragma mapbox: initialize mediump vec4 pattern_from
208
+ #pragma mapbox: initialize mediump vec4 pattern_to
209
+ #pragma mapbox: initialize lowp float pixel_ratio_from
210
+ #pragma mapbox: initialize lowp float pixel_ratio_to
211
+ 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=u_matrix*vec4(a_pos,0,1);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:Ct(`varying vec4 v_color;void main() {gl_FragColor=v_color;
212
+ #ifdef OVERDRAW_INSPECTOR
213
+ gl_FragColor=vec4(1.0);
214
+ #endif
215
+ }`,`uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
216
+ #ifdef TERRAIN3D
217
+ attribute vec2 a_centroid;
218
+ #endif
219
+ varying vec4 v_color;
220
+ #pragma mapbox: define highp float base
221
+ #pragma mapbox: define highp float height
222
+ #pragma mapbox: define highp vec4 color
223
+ void main() {
224
+ #pragma mapbox: initialize highp float base
225
+ #pragma mapbox: initialize highp float height
226
+ #pragma mapbox: initialize highp vec4 color
227
+ vec3 normal=a_normal_ed.xyz;
228
+ #ifdef TERRAIN3D
229
+ float baseDelta=10.0;float ele=get_elevation(a_centroid);
230
+ #else
231
+ float baseDelta=0.0;float ele=0.0;
232
+ #endif
233
+ base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);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;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);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+base)*pow(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:Ct(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
234
+ #pragma mapbox: define lowp float base
235
+ #pragma mapbox: define lowp float height
236
+ #pragma mapbox: define lowp vec4 pattern_from
237
+ #pragma mapbox: define lowp vec4 pattern_to
238
+ #pragma mapbox: define lowp float pixel_ratio_from
239
+ #pragma mapbox: define lowp float pixel_ratio_to
240
+ void main() {
241
+ #pragma mapbox: initialize lowp float base
242
+ #pragma mapbox: initialize lowp float height
243
+ #pragma mapbox: initialize mediump vec4 pattern_from
244
+ #pragma mapbox: initialize mediump vec4 pattern_to
245
+ #pragma mapbox: initialize lowp float pixel_ratio_from
246
+ #pragma mapbox: initialize lowp float pixel_ratio_to
247
+ 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=texture2D(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=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;
248
+ #ifdef OVERDRAW_INSPECTOR
249
+ gl_FragColor=vec4(1.0);
250
+ #endif
251
+ }`,`uniform mat4 u_matrix;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 vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;
252
+ #ifdef TERRAIN3D
253
+ attribute vec2 a_centroid;
254
+ #endif
255
+ varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
256
+ #pragma mapbox: define lowp float base
257
+ #pragma mapbox: define lowp float height
258
+ #pragma mapbox: define lowp vec4 pattern_from
259
+ #pragma mapbox: define lowp vec4 pattern_to
260
+ #pragma mapbox: define lowp float pixel_ratio_from
261
+ #pragma mapbox: define lowp float pixel_ratio_to
262
+ void main() {
263
+ #pragma mapbox: initialize lowp float base
264
+ #pragma mapbox: initialize lowp float height
265
+ #pragma mapbox: initialize mediump vec4 pattern_from
266
+ #pragma mapbox: initialize mediump vec4 pattern_to
267
+ #pragma mapbox: initialize lowp float pixel_ratio_from
268
+ #pragma mapbox: initialize lowp float pixel_ratio_to
269
+ 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=a_normal_ed.xyz;float edgedistance=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;
270
+ #ifdef TERRAIN3D
271
+ float baseDelta=10.0;float ele=get_elevation(a_centroid);
272
+ #else
273
+ float baseDelta=0.0;float ele=0.0;
274
+ #endif
275
+ base=max(0.0,ele+base-baseDelta);height=max(0.0,ele+height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
276
+ ? a_pos
277
+ : vec2(edgedistance,z*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+base)*pow(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:Ct(`#ifdef GL_ES
278
+ precision highp float;
279
+ #endif
280
+ uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);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))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
281
+ #ifdef OVERDRAW_INSPECTOR
282
+ gl_FragColor=vec4(1.0);
283
+ #endif
284
+ }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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:Ct(`uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
285
+ #define PI 3.141592653589793
286
+ void main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;
287
+ #ifdef OVERDRAW_INSPECTOR
288
+ gl_FragColor=vec4(1.0);
289
+ #endif
290
+ }`,"uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),line:Ct(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
291
+ #pragma mapbox: define highp vec4 color
292
+ #pragma mapbox: define lowp float blur
293
+ #pragma mapbox: define lowp float opacity
294
+ void main() {
295
+ #pragma mapbox: initialize highp vec4 color
296
+ #pragma mapbox: initialize lowp float blur
297
+ #pragma mapbox: initialize lowp float opacity
298
+ 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);gl_FragColor=color*(alpha*opacity);
299
+ #ifdef OVERDRAW_INSPECTOR
300
+ gl_FragColor=vec4(1.0);
301
+ #endif
302
+ }`,`
303
+ #define scale 0.015873016
304
+ attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;
305
+ #pragma mapbox: define highp vec4 color
306
+ #pragma mapbox: define lowp float blur
307
+ #pragma mapbox: define lowp float opacity
308
+ #pragma mapbox: define mediump float gapwidth
309
+ #pragma mapbox: define lowp float offset
310
+ #pragma mapbox: define mediump float width
311
+ void main() {
312
+ #pragma mapbox: initialize highp vec4 color
313
+ #pragma mapbox: initialize lowp float blur
314
+ #pragma mapbox: initialize lowp float opacity
315
+ #pragma mapbox: initialize mediump float gapwidth
316
+ #pragma mapbox: initialize lowp float offset
317
+ #pragma mapbox: initialize mediump float width
318
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
319
+ #ifdef TERRAIN3D
320
+ v_gamma_scale=1.0;
321
+ #else
322
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
323
+ #endif
324
+ v_width2=vec2(outset,inset);}`),lineGradient:Ct(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;
325
+ #pragma mapbox: define lowp float blur
326
+ #pragma mapbox: define lowp float opacity
327
+ void main() {
328
+ #pragma mapbox: initialize lowp float blur
329
+ #pragma mapbox: initialize lowp float opacity
330
+ 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=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
331
+ #ifdef OVERDRAW_INSPECTOR
332
+ gl_FragColor=vec4(1.0);
333
+ #endif
334
+ }`,`
335
+ #define scale 0.015873016
336
+ attribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;
337
+ #pragma mapbox: define lowp float blur
338
+ #pragma mapbox: define lowp float opacity
339
+ #pragma mapbox: define mediump float gapwidth
340
+ #pragma mapbox: define lowp float offset
341
+ #pragma mapbox: define mediump float width
342
+ void main() {
343
+ #pragma mapbox: initialize lowp float blur
344
+ #pragma mapbox: initialize lowp float opacity
345
+ #pragma mapbox: initialize mediump float gapwidth
346
+ #pragma mapbox: initialize lowp float offset
347
+ #pragma mapbox: initialize mediump float width
348
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;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=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
349
+ #ifdef TERRAIN3D
350
+ v_gamma_scale=1.0;
351
+ #else
352
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
353
+ #endif
354
+ v_width2=vec2(outset,inset);}`),linePattern:Ct(`#ifdef GL_ES
355
+ precision highp float;
356
+ #endif
357
+ uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
358
+ #pragma mapbox: define lowp vec4 pattern_from
359
+ #pragma mapbox: define lowp vec4 pattern_to
360
+ #pragma mapbox: define lowp float pixel_ratio_from
361
+ #pragma mapbox: define lowp float pixel_ratio_to
362
+ #pragma mapbox: define lowp float blur
363
+ #pragma mapbox: define lowp float opacity
364
+ void main() {
365
+ #pragma mapbox: initialize mediump vec4 pattern_from
366
+ #pragma mapbox: initialize mediump vec4 pattern_to
367
+ #pragma mapbox: initialize lowp float pixel_ratio_from
368
+ #pragma mapbox: initialize lowp float pixel_ratio_to
369
+ #pragma mapbox: initialize lowp float blur
370
+ #pragma mapbox: initialize lowp float opacity
371
+ 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(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
372
+ #ifdef OVERDRAW_INSPECTOR
373
+ gl_FragColor=vec4(1.0);
374
+ #endif
375
+ }`,`
376
+ #define scale 0.015873016
377
+ #define LINE_DISTANCE_SCALE 2.0
378
+ attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;
379
+ #pragma mapbox: define lowp float blur
380
+ #pragma mapbox: define lowp float opacity
381
+ #pragma mapbox: define lowp float offset
382
+ #pragma mapbox: define mediump float gapwidth
383
+ #pragma mapbox: define mediump float width
384
+ #pragma mapbox: define lowp float floorwidth
385
+ #pragma mapbox: define lowp vec4 pattern_from
386
+ #pragma mapbox: define lowp vec4 pattern_to
387
+ #pragma mapbox: define lowp float pixel_ratio_from
388
+ #pragma mapbox: define lowp float pixel_ratio_to
389
+ void main() {
390
+ #pragma mapbox: initialize lowp float blur
391
+ #pragma mapbox: initialize lowp float opacity
392
+ #pragma mapbox: initialize lowp float offset
393
+ #pragma mapbox: initialize mediump float gapwidth
394
+ #pragma mapbox: initialize mediump float width
395
+ #pragma mapbox: initialize lowp float floorwidth
396
+ #pragma mapbox: initialize mediump vec4 pattern_from
397
+ #pragma mapbox: initialize mediump vec4 pattern_to
398
+ #pragma mapbox: initialize lowp float pixel_ratio_from
399
+ #pragma mapbox: initialize lowp float pixel_ratio_to
400
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
401
+ #ifdef TERRAIN3D
402
+ v_gamma_scale=1.0;
403
+ #else
404
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
405
+ #endif
406
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Ct(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
407
+ #pragma mapbox: define highp vec4 color
408
+ #pragma mapbox: define lowp float blur
409
+ #pragma mapbox: define lowp float opacity
410
+ #pragma mapbox: define mediump float width
411
+ #pragma mapbox: define lowp float floorwidth
412
+ void main() {
413
+ #pragma mapbox: initialize highp vec4 color
414
+ #pragma mapbox: initialize lowp float blur
415
+ #pragma mapbox: initialize lowp float opacity
416
+ #pragma mapbox: initialize mediump float width
417
+ #pragma mapbox: initialize lowp float floorwidth
418
+ 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=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);
419
+ #ifdef OVERDRAW_INSPECTOR
420
+ gl_FragColor=vec4(1.0);
421
+ #endif
422
+ }`,`
423
+ #define scale 0.015873016
424
+ #define LINE_DISTANCE_SCALE 2.0
425
+ attribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;
426
+ #pragma mapbox: define highp vec4 color
427
+ #pragma mapbox: define lowp float blur
428
+ #pragma mapbox: define lowp float opacity
429
+ #pragma mapbox: define mediump float gapwidth
430
+ #pragma mapbox: define lowp float offset
431
+ #pragma mapbox: define mediump float width
432
+ #pragma mapbox: define lowp float floorwidth
433
+ void main() {
434
+ #pragma mapbox: initialize highp vec4 color
435
+ #pragma mapbox: initialize lowp float blur
436
+ #pragma mapbox: initialize lowp float opacity
437
+ #pragma mapbox: initialize mediump float gapwidth
438
+ #pragma mapbox: initialize lowp float offset
439
+ #pragma mapbox: initialize mediump float width
440
+ #pragma mapbox: initialize lowp float floorwidth
441
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;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);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;
442
+ #ifdef TERRAIN3D
443
+ v_gamma_scale=1.0;
444
+ #else
445
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
446
+ #endif
447
+ v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:Ct(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 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=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
448
+ #ifdef OVERDRAW_INSPECTOR
449
+ gl_FragColor=vec4(1.0);
450
+ #endif
451
+ }`,"uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),symbolIcon:Ct(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
452
+ #pragma mapbox: define lowp float opacity
453
+ void main() {
454
+ #pragma mapbox: initialize lowp float opacity
455
+ lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
456
+ #ifdef OVERDRAW_INSPECTOR
457
+ gl_FragColor=vec4(1.0);
458
+ #endif
459
+ }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;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 highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;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;varying vec2 v_tex;varying float v_fade_opacity;
460
+ #pragma mapbox: define lowp float opacity
461
+ void main() {
462
+ #pragma mapbox: initialize lowp float opacity
463
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
464
+ camera_to_anchor_distance/u_camera_to_center_distance :
465
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:Ct(`#define SDF_PX 8.0
466
+ uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
467
+ #pragma mapbox: define highp vec4 fill_color
468
+ #pragma mapbox: define highp vec4 halo_color
469
+ #pragma mapbox: define lowp float opacity
470
+ #pragma mapbox: define lowp float halo_width
471
+ #pragma mapbox: define lowp float halo_blur
472
+ void main() {
473
+ #pragma mapbox: initialize highp vec4 fill_color
474
+ #pragma mapbox: initialize highp vec4 halo_color
475
+ #pragma mapbox: initialize lowp float opacity
476
+ #pragma mapbox: initialize lowp float halo_width
477
+ #pragma mapbox: initialize lowp float halo_blur
478
+ 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 fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
479
+ #ifdef OVERDRAW_INSPECTOR
480
+ gl_FragColor=vec4(1.0);
481
+ #endif
482
+ }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;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_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;
483
+ #pragma mapbox: define highp vec4 fill_color
484
+ #pragma mapbox: define highp vec4 halo_color
485
+ #pragma mapbox: define lowp float opacity
486
+ #pragma mapbox: define lowp float halo_width
487
+ #pragma mapbox: define lowp float halo_blur
488
+ void main() {
489
+ #pragma mapbox: initialize highp vec4 fill_color
490
+ #pragma mapbox: initialize highp vec4 halo_color
491
+ #pragma mapbox: initialize lowp float opacity
492
+ #pragma mapbox: initialize lowp float halo_width
493
+ #pragma mapbox: initialize lowp float halo_blur
494
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
495
+ camera_to_anchor_distance/u_camera_to_center_distance :
496
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:Ct(`#define SDF_PX 8.0
497
+ #define SDF 1.0
498
+ #define ICON 0.0
499
+ uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
500
+ #pragma mapbox: define highp vec4 fill_color
501
+ #pragma mapbox: define highp vec4 halo_color
502
+ #pragma mapbox: define lowp float opacity
503
+ #pragma mapbox: define lowp float halo_width
504
+ #pragma mapbox: define lowp float halo_blur
505
+ void main() {
506
+ #pragma mapbox: initialize highp vec4 fill_color
507
+ #pragma mapbox: initialize highp vec4 halo_color
508
+ #pragma mapbox: initialize lowp float opacity
509
+ #pragma mapbox: initialize lowp float halo_width
510
+ #pragma mapbox: initialize lowp float halo_blur
511
+ float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;
512
+ #ifdef OVERDRAW_INSPECTOR
513
+ gl_FragColor=vec4(1.0);
514
+ #endif
515
+ 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;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);
516
+ #ifdef OVERDRAW_INSPECTOR
517
+ gl_FragColor=vec4(1.0);
518
+ #endif
519
+ }`,`const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;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_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;
520
+ #pragma mapbox: define highp vec4 fill_color
521
+ #pragma mapbox: define highp vec4 halo_color
522
+ #pragma mapbox: define lowp float opacity
523
+ #pragma mapbox: define lowp float halo_width
524
+ #pragma mapbox: define lowp float halo_blur
525
+ void main() {
526
+ #pragma mapbox: initialize highp vec4 fill_color
527
+ #pragma mapbox: initialize highp vec4 halo_color
528
+ #pragma mapbox: initialize lowp float opacity
529
+ #pragma mapbox: initialize lowp float halo_width
530
+ #pragma mapbox: initialize lowp float halo_blur
531
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);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;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
532
+ camera_to_anchor_distance/u_camera_to_center_distance :
533
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:Ct("uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}",vn),terrainDepth:Ct("varying 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() {gl_FragColor=pack(v_depth);}",vn),terrainCoords:Ct("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}",vn)};function Ct(a,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=t.match(/attribute ([\w]+) ([\w]+)/g),u=a.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),d=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=d?d.concat(u):u,_={};return{fragmentSource:a=a.replace(n,(y,v,T,I,M)=>(_[M]=!0,v==="define"?`
534
+ #ifndef HAS_UNIFORM_u_${M}
535
+ varying ${T} ${I} ${M};
536
+ #else
537
+ uniform ${T} ${I} u_${M};
538
+ #endif
539
+ `:`
540
+ #ifdef HAS_UNIFORM_u_${M}
541
+ ${T} ${I} ${M} = u_${M};
542
+ #endif
543
+ `)),vertexSource:t=t.replace(n,(y,v,T,I,M)=>{const U=I==="float"?"vec2":"vec4",F=M.match(/color/)?"color":U;return _[M]?v==="define"?`
544
+ #ifndef HAS_UNIFORM_u_${M}
545
+ uniform lowp float u_${M}_t;
546
+ attribute ${T} ${U} a_${M};
547
+ varying ${T} ${I} ${M};
548
+ #else
549
+ uniform ${T} ${I} u_${M};
550
+ #endif
551
+ `:F==="vec4"?`
552
+ #ifndef HAS_UNIFORM_u_${M}
553
+ ${M} = a_${M};
554
+ #else
555
+ ${T} ${I} ${M} = u_${M};
556
+ #endif
557
+ `:`
558
+ #ifndef HAS_UNIFORM_u_${M}
559
+ ${M} = unpack_mix_${F}(a_${M}, u_${M}_t);
560
+ #else
561
+ ${T} ${I} ${M} = u_${M};
562
+ #endif
563
+ `:v==="define"?`
564
+ #ifndef HAS_UNIFORM_u_${M}
565
+ uniform lowp float u_${M}_t;
566
+ attribute ${T} ${U} a_${M};
567
+ #else
568
+ uniform ${T} ${I} u_${M};
569
+ #endif
570
+ `:F==="vec4"?`
571
+ #ifndef HAS_UNIFORM_u_${M}
572
+ ${T} ${I} ${M} = a_${M};
573
+ #else
574
+ ${T} ${I} ${M} = u_${M};
575
+ #endif
576
+ `:`
577
+ #ifndef HAS_UNIFORM_u_${M}
578
+ ${T} ${I} ${M} = unpack_mix_${F}(a_${M}, u_${M}_t);
579
+ #else
580
+ ${T} ${I} ${M} = u_${M};
581
+ #endif
582
+ `}),staticAttributes:s,staticUniforms:f}}class Qo{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,s,u,d,f,_,y,v){this.context=t;let T=this.boundPaintVertexBuffers.length!==u.length;for(let I=0;!T&&I<u.length;I++)this.boundPaintVertexBuffers[I]!==u[I]&&(T=!0);t.extVertexArrayObject&&this.vao&&this.boundProgram===n&&this.boundLayoutVertexBuffer===s&&!T&&this.boundIndexBuffer===d&&this.boundVertexOffset===f&&this.boundDynamicVertexBuffer===_&&this.boundDynamicVertexBuffer2===y&&this.boundDynamicVertexBuffer3===v?(t.bindVertexArrayOES.set(this.vao),_&&_.bind(),d&&d.dynamicDraw&&d.bind(),y&&y.bind(),v&&v.bind()):this.freshBind(n,s,u,d,f,_,y,v)}freshBind(t,n,s,u,d,f,_,y){let v;const T=t.numAttributes,I=this.context,M=I.gl;if(I.extVertexArrayObject)this.vao&&this.destroy(),this.vao=I.extVertexArrayObject.createVertexArrayOES(),I.bindVertexArrayOES.set(this.vao),v=0,this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=u,this.boundVertexOffset=d,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=y;else{v=I.currentNumAttributes||0;for(let U=T;U<v;U++)M.disableVertexAttribArray(U)}n.enableAttributes(M,t);for(const U of s)U.enableAttributes(M,t);f&&f.enableAttributes(M,t),_&&_.enableAttributes(M,t),y&&y.enableAttributes(M,t),n.bind(),n.setVertexAttribPointers(M,t,d);for(const U of s)U.bind(),U.setVertexAttribPointers(M,t,d);f&&(f.bind(),f.setVertexAttribPointers(M,t,d)),u&&u.bind(),_&&(_.bind(),_.setVertexAttribPointers(M,t,d)),y&&(y.bind(),y.setVertexAttribPointers(M,t,d)),I.currentNumAttributes=T}destroy(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)}}function es(a){const t=[];for(let n=0;n<a.length;n++){if(a[n]===null)continue;const s=a[n].split(" ");t.push(s.pop())}return t}class ta{constructor(t,n,s,u,d,f,_){const y=t.gl;this.program=y.createProgram();const v=es(s.staticAttributes),T=u?u.getBinderAttributes():[],I=v.concat(T),M=Gn.prelude.staticUniforms?es(Gn.prelude.staticUniforms):[],U=s.staticUniforms?es(s.staticUniforms):[],F=u?u.getBinderUniforms():[],O=M.concat(U).concat(F),H=[];for(const he of O)H.indexOf(he)<0&&H.push(he);const Y=u?u.defines():[];f&&Y.push("#define OVERDRAW_INSPECTOR;"),_&&Y.push("#define TERRAIN3D;");const te=Y.concat(Gn.prelude.fragmentSource,s.fragmentSource).join(`
583
+ `),$=Y.concat(Gn.prelude.vertexSource,s.vertexSource).join(`
584
+ `),ne=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(ne,te),y.compileShader(ne),y.attachShader(this.program,ne);const ie=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(ie,$),y.compileShader(ie),y.attachShader(this.program,ie),this.attributes={};const ue={};this.numAttributes=I.length;for(let he=0;he<this.numAttributes;he++)I[he]&&(y.bindAttribLocation(this.program,he,I[he]),this.attributes[I[he]]=he);y.linkProgram(this.program),y.deleteShader(ie),y.deleteShader(ne);for(let he=0;he<H.length;he++){const ve=H[he];if(ve&&!ue[ve]){const ce=y.getUniformLocation(this.program,ve);ce&&(ue[ve]=ce)}}this.fixedUniforms=d(t,ue),this.terrainUniforms=((he,ve)=>({u_depth:new l.Uniform1i(he,ve.u_depth),u_terrain:new l.Uniform1i(he,ve.u_terrain),u_terrain_dim:new l.Uniform1f(he,ve.u_terrain_dim),u_terrain_matrix:new l.UniformMatrix4f(he,ve.u_terrain_matrix),u_terrain_unpack:new l.Uniform4f(he,ve.u_terrain_unpack),u_terrain_offset:new l.Uniform1f(he,ve.u_terrain_offset),u_terrain_exaggeration:new l.Uniform1f(he,ve.u_terrain_exaggeration)}))(t,ue),this.binderUniforms=u?u.getUniforms(t,ue):[]}draw(t,n,s,u,d,f,_,y,v,T,I,M,U,F,O,H,Y,te){const $=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(s),t.setStencilMode(u),t.setColorMode(d),t.setCullFace(f),y){t.activeTexture.set($.TEXTURE2),$.bindTexture($.TEXTURE_2D,y.depthTexture),t.activeTexture.set($.TEXTURE3),$.bindTexture($.TEXTURE_2D,y.texture);for(const ie in this.terrainUniforms)this.terrainUniforms[ie].set(y[ie])}for(const ie in this.fixedUniforms)this.fixedUniforms[ie].set(_[ie]);O&&O.setUniforms(t,this.binderUniforms,U,{zoom:F});let ne=0;switch(n){case $.LINES:ne=2;break;case $.TRIANGLES:ne=3;break;case $.LINE_STRIP:ne=1}for(const ie of M.get()){const ue=ie.vaos||(ie.vaos={});(ue[v]||(ue[v]=new Qo)).bind(t,this,T,O?O.getPaintVertexBuffers():[],I,ie.vertexOffset,H,Y,te),$.drawElements(n,ie.primitiveLength*ne,$.UNSIGNED_SHORT,ie.primitiveOffset*ne*2)}}}function ia(a,t,n){const s=1/Zt(n,1,t.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),d=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,f=d*(n.tileID.canonical.x+n.tileID.wrap*u),_=d*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const ts=(a,t,n,s)=>{const u=t.style.light,d=u.properties.get("position"),f=[d.x,d.y,d.z],_=l.create$1();u.properties.get("anchor")==="viewport"&&l.fromRotation(_,-t.transform.angle),l.transformMat3(f,f,_);const y=u.properties.get("color");return{u_matrix:a,u_lightpos:f,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[y.r,y.g,y.b],u_vertical_gradient:+n,u_opacity:s}},pl=(a,t,n,s,u,d,f)=>l.extend(ts(a,t,n,s),ia(d,t,f),{u_height_factor:-Math.pow(2,u.overscaledZ)/f.tileSize/8}),bo=a=>({u_matrix:a}),is=(a,t,n,s)=>l.extend(bo(a),ia(n,t,s)),ra=(a,t)=>({u_matrix:a,u_world:t}),na=(a,t,n,s,u)=>l.extend(is(a,t,n,s),{u_world:u}),oa=(a,t,n,s)=>{const u=a.transform;let d,f;if(s.paint.get("circle-pitch-alignment")==="map"){const _=Zt(n,1,u.zoom);d=!0,f=[_,_]}else d=!1,f=u.pixelsToGLUnits;return{u_camera_to_center_distance:u.cameraToCenterDistance,u_scale_with_map:+(s.paint.get("circle-pitch-scale")==="map"),u_matrix:a.translatePosMatrix(t.posMatrix,n,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_pitch_with_map:+d,u_device_pixel_ratio:a.pixelRatio,u_extrude_scale:f}},Wr=(a,t,n)=>{const s=Zt(n,1,t.zoom),u=Math.pow(2,t.zoom-n.tileID.overscaledZ),d=n.tileID.overscaleFactor();return{u_matrix:a,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:s,u_extrude_scale:[t.pixelsToGLUnits[0]/(s*u),t.pixelsToGLUnits[1]/(s*u)],u_overscale_factor:d}},qn=(a,t,n=1)=>({u_matrix:a,u_color:t,u_overlay:0,u_overlay_scale:n}),bn=a=>({u_matrix:a}),wo=(a,t,n,s)=>({u_matrix:a,u_extrude_scale:Zt(t,1,n),u_intensity:s});function To(a,t){const n=Math.pow(2,t.canonical.z),s=t.canonical.y;return[new l.MercatorCoordinate(0,s/n).toLngLat().lat,new l.MercatorCoordinate(0,(s+1)/n).toLngLat().lat]}const wn=(a,t,n,s)=>{const u=a.transform;return{u_matrix:jn(a,t,n,s),u_ratio:1/Zt(t,1,u.zoom),u_device_pixel_ratio:a.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},rs=(a,t,n,s,u)=>l.extend(wn(a,t,n,u),{u_image:0,u_image_height:s}),Eo=(a,t,n,s,u)=>{const d=a.transform,f=Rt(t,d);return{u_matrix:jn(a,t,n,u),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Zt(t,1,d.zoom),u_device_pixel_ratio:a.pixelRatio,u_image:0,u_scale:[f,s.fromScale,s.toScale],u_fade:s.t,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]]}},Zn=(a,t,n,s,u,d)=>{const f=a.lineAtlas,_=Rt(t,a.transform),y=n.layout.get("line-cap")==="round",v=f.getDash(s.from,y),T=f.getDash(s.to,y),I=v.width*u.fromScale,M=T.width*u.toScale;return l.extend(wn(a,t,n,d),{u_patternscale_a:[_/I,-v.height/2],u_patternscale_b:[_/M,-T.height/2],u_sdfgamma:f.width/(256*Math.min(I,M)*a.pixelRatio)/2,u_image:0,u_tex_y_a:v.y,u_tex_y_b:T.y,u_mix:u.t})};function Rt(a,t){return 1/Zt(a,1,t.tileZoom)}function jn(a,t,n,s){return a.translatePosMatrix(s?s.posMatrix:t.tileID.posMatrix,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const sa=(a,t,n,s,u)=>{return{u_matrix:a,u_tl_parent:t,u_scale_parent:n,u_buffer_scale:1,u_fade_t:s.mix,u_opacity:s.opacity*u.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:u.paint.get("raster-brightness-min"),u_brightness_high:u.paint.get("raster-brightness-max"),u_saturation_factor:(f=u.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(d=u.paint.get("raster-contrast"),d>0?1/(1-d):1+d),u_spin_weights:aa(u.paint.get("raster-hue-rotate"))};var d,f};function aa(a){a*=Math.PI/180;const t=Math.sin(a),n=Math.cos(a);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const ns=(a,t,n,s,u,d,f,_,y,v)=>{const T=u.transform;return{u_is_size_zoom_constant:+(a==="constant"||a==="source"),u_is_size_feature_constant:+(a==="constant"||a==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:T.cameraToCenterDistance,u_pitch:T.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:T.width/T.height,u_fade_change:u.options.fadeDuration?u.symbolFadeChange:1,u_matrix:d,u_label_plane_matrix:f,u_coord_matrix:_,u_is_text:+y,u_pitch_with_map:+s,u_texsize:v,u_texture:0}},So=(a,t,n,s,u,d,f,_,y,v,T)=>{const I=u.transform;return l.extend(ns(a,t,n,s,u,d,f,_,y,v),{u_gamma_scale:s?Math.cos(I._pitch)*I.cameraToCenterDistance:1,u_device_pixel_ratio:u.pixelRatio,u_is_halo:+T})},la=(a,t,n,s,u,d,f,_,y,v)=>l.extend(So(a,t,n,s,u,d,f,_,!0,y,!0),{u_texsize_icon:v,u_texture_icon:1}),fl=(a,t,n)=>({u_matrix:a,u_opacity:t,u_color:n}),ml=(a,t,n,s,u,d)=>l.extend(function(f,_,y,v){const T=y.imageManager.getPattern(f.from.toString()),I=y.imageManager.getPattern(f.to.toString()),{width:M,height:U}=y.imageManager.getPixelSize(),F=Math.pow(2,v.tileID.overscaledZ),O=v.tileSize*Math.pow(2,y.transform.tileZoom)/F,H=O*(v.tileID.canonical.x+v.tileID.wrap*F),Y=O*v.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:I.tl,u_pattern_br_b:I.br,u_texsize:[M,U],u_mix:_.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:I.displaySize,u_scale_a:_.fromScale,u_scale_b:_.toScale,u_tile_units_to_pixels:1/Zt(v,1,y.transform.tileZoom),u_pixel_coord_upper:[H>>16,Y>>16],u_pixel_coord_lower:[65535&H,65535&Y]}}(s,d,n,u),{u_matrix:a,u_opacity:t}),os={fillExtrusion:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_lightpos:new l.Uniform3f(a,t.u_lightpos),u_lightintensity:new l.Uniform1f(a,t.u_lightintensity),u_lightcolor:new l.Uniform3f(a,t.u_lightcolor),u_vertical_gradient:new l.Uniform1f(a,t.u_vertical_gradient),u_opacity:new l.Uniform1f(a,t.u_opacity)}),fillExtrusionPattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_lightpos:new l.Uniform3f(a,t.u_lightpos),u_lightintensity:new l.Uniform1f(a,t.u_lightintensity),u_lightcolor:new l.Uniform3f(a,t.u_lightcolor),u_vertical_gradient:new l.Uniform1f(a,t.u_vertical_gradient),u_height_factor:new l.Uniform1f(a,t.u_height_factor),u_image:new l.Uniform1i(a,t.u_image),u_texsize:new l.Uniform2f(a,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade),u_opacity:new l.Uniform1f(a,t.u_opacity)}),fill:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),fillPattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_image:new l.Uniform1i(a,t.u_image),u_texsize:new l.Uniform2f(a,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade)}),fillOutline:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_world:new l.Uniform2f(a,t.u_world)}),fillOutlinePattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_world:new l.Uniform2f(a,t.u_world),u_image:new l.Uniform1i(a,t.u_image),u_texsize:new l.Uniform2f(a,t.u_texsize),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade)}),circle:(a,t)=>({u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_scale_with_map:new l.Uniform1i(a,t.u_scale_with_map),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_extrude_scale:new l.Uniform2f(a,t.u_extrude_scale),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),collisionBox:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pixels_to_tile_units:new l.Uniform1f(a,t.u_pixels_to_tile_units),u_extrude_scale:new l.Uniform2f(a,t.u_extrude_scale),u_overscale_factor:new l.Uniform1f(a,t.u_overscale_factor)}),collisionCircle:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_inv_matrix:new l.UniformMatrix4f(a,t.u_inv_matrix),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_viewport_size:new l.Uniform2f(a,t.u_viewport_size)}),debug:(a,t)=>({u_color:new l.UniformColor(a,t.u_color),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_overlay:new l.Uniform1i(a,t.u_overlay),u_overlay_scale:new l.Uniform1f(a,t.u_overlay_scale)}),clippingMask:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),heatmap:(a,t)=>({u_extrude_scale:new l.Uniform1f(a,t.u_extrude_scale),u_intensity:new l.Uniform1f(a,t.u_intensity),u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),heatmapTexture:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_world:new l.Uniform2f(a,t.u_world),u_image:new l.Uniform1i(a,t.u_image),u_color_ramp:new l.Uniform1i(a,t.u_color_ramp),u_opacity:new l.Uniform1f(a,t.u_opacity)}),hillshade:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_image:new l.Uniform1i(a,t.u_image),u_latrange:new l.Uniform2f(a,t.u_latrange),u_light:new l.Uniform2f(a,t.u_light),u_shadow:new l.UniformColor(a,t.u_shadow),u_highlight:new l.UniformColor(a,t.u_highlight),u_accent:new l.UniformColor(a,t.u_accent)}),hillshadePrepare:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_image:new l.Uniform1i(a,t.u_image),u_dimension:new l.Uniform2f(a,t.u_dimension),u_zoom:new l.Uniform1f(a,t.u_zoom),u_unpack:new l.Uniform4f(a,t.u_unpack)}),line:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels)}),lineGradient:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels),u_image:new l.Uniform1i(a,t.u_image),u_image_height:new l.Uniform1f(a,t.u_image_height)}),linePattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_texsize:new l.Uniform2f(a,t.u_texsize),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_image:new l.Uniform1i(a,t.u_image),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels),u_scale:new l.Uniform3f(a,t.u_scale),u_fade:new l.Uniform1f(a,t.u_fade)}),lineSDF:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_ratio:new l.Uniform1f(a,t.u_ratio),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_units_to_pixels:new l.Uniform2f(a,t.u_units_to_pixels),u_patternscale_a:new l.Uniform2f(a,t.u_patternscale_a),u_patternscale_b:new l.Uniform2f(a,t.u_patternscale_b),u_sdfgamma:new l.Uniform1f(a,t.u_sdfgamma),u_image:new l.Uniform1i(a,t.u_image),u_tex_y_a:new l.Uniform1f(a,t.u_tex_y_a),u_tex_y_b:new l.Uniform1f(a,t.u_tex_y_b),u_mix:new l.Uniform1f(a,t.u_mix)}),raster:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_tl_parent:new l.Uniform2f(a,t.u_tl_parent),u_scale_parent:new l.Uniform1f(a,t.u_scale_parent),u_buffer_scale:new l.Uniform1f(a,t.u_buffer_scale),u_fade_t:new l.Uniform1f(a,t.u_fade_t),u_opacity:new l.Uniform1f(a,t.u_opacity),u_image0:new l.Uniform1i(a,t.u_image0),u_image1:new l.Uniform1i(a,t.u_image1),u_brightness_low:new l.Uniform1f(a,t.u_brightness_low),u_brightness_high:new l.Uniform1f(a,t.u_brightness_high),u_saturation_factor:new l.Uniform1f(a,t.u_saturation_factor),u_contrast_factor:new l.Uniform1f(a,t.u_contrast_factor),u_spin_weights:new l.Uniform3f(a,t.u_spin_weights)}),symbolIcon:(a,t)=>({u_is_size_zoom_constant:new l.Uniform1i(a,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(a,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(a,t.u_size_t),u_size:new l.Uniform1f(a,t.u_size),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(a,t.u_pitch),u_rotate_symbol:new l.Uniform1i(a,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(a,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(a,t.u_fade_change),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(a,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(a,t.u_coord_matrix),u_is_text:new l.Uniform1i(a,t.u_is_text),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_texsize:new l.Uniform2f(a,t.u_texsize),u_texture:new l.Uniform1i(a,t.u_texture)}),symbolSDF:(a,t)=>({u_is_size_zoom_constant:new l.Uniform1i(a,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(a,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(a,t.u_size_t),u_size:new l.Uniform1f(a,t.u_size),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(a,t.u_pitch),u_rotate_symbol:new l.Uniform1i(a,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(a,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(a,t.u_fade_change),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(a,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(a,t.u_coord_matrix),u_is_text:new l.Uniform1i(a,t.u_is_text),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_texsize:new l.Uniform2f(a,t.u_texsize),u_texture:new l.Uniform1i(a,t.u_texture),u_gamma_scale:new l.Uniform1f(a,t.u_gamma_scale),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_is_halo:new l.Uniform1i(a,t.u_is_halo)}),symbolTextAndIcon:(a,t)=>({u_is_size_zoom_constant:new l.Uniform1i(a,t.u_is_size_zoom_constant),u_is_size_feature_constant:new l.Uniform1i(a,t.u_is_size_feature_constant),u_size_t:new l.Uniform1f(a,t.u_size_t),u_size:new l.Uniform1f(a,t.u_size),u_camera_to_center_distance:new l.Uniform1f(a,t.u_camera_to_center_distance),u_pitch:new l.Uniform1f(a,t.u_pitch),u_rotate_symbol:new l.Uniform1i(a,t.u_rotate_symbol),u_aspect_ratio:new l.Uniform1f(a,t.u_aspect_ratio),u_fade_change:new l.Uniform1f(a,t.u_fade_change),u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_label_plane_matrix:new l.UniformMatrix4f(a,t.u_label_plane_matrix),u_coord_matrix:new l.UniformMatrix4f(a,t.u_coord_matrix),u_is_text:new l.Uniform1i(a,t.u_is_text),u_pitch_with_map:new l.Uniform1i(a,t.u_pitch_with_map),u_texsize:new l.Uniform2f(a,t.u_texsize),u_texsize_icon:new l.Uniform2f(a,t.u_texsize_icon),u_texture:new l.Uniform1i(a,t.u_texture),u_texture_icon:new l.Uniform1i(a,t.u_texture_icon),u_gamma_scale:new l.Uniform1f(a,t.u_gamma_scale),u_device_pixel_ratio:new l.Uniform1f(a,t.u_device_pixel_ratio),u_is_halo:new l.Uniform1i(a,t.u_is_halo)}),background:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_opacity:new l.Uniform1f(a,t.u_opacity),u_color:new l.UniformColor(a,t.u_color)}),backgroundPattern:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_opacity:new l.Uniform1f(a,t.u_opacity),u_image:new l.Uniform1i(a,t.u_image),u_pattern_tl_a:new l.Uniform2f(a,t.u_pattern_tl_a),u_pattern_br_a:new l.Uniform2f(a,t.u_pattern_br_a),u_pattern_tl_b:new l.Uniform2f(a,t.u_pattern_tl_b),u_pattern_br_b:new l.Uniform2f(a,t.u_pattern_br_b),u_texsize:new l.Uniform2f(a,t.u_texsize),u_mix:new l.Uniform1f(a,t.u_mix),u_pattern_size_a:new l.Uniform2f(a,t.u_pattern_size_a),u_pattern_size_b:new l.Uniform2f(a,t.u_pattern_size_b),u_scale_a:new l.Uniform1f(a,t.u_scale_a),u_scale_b:new l.Uniform1f(a,t.u_scale_b),u_pixel_coord_upper:new l.Uniform2f(a,t.u_pixel_coord_upper),u_pixel_coord_lower:new l.Uniform2f(a,t.u_pixel_coord_lower),u_tile_units_to_pixels:new l.Uniform1f(a,t.u_tile_units_to_pixels)}),terrain:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_texture:new l.Uniform1i(a,t.u_texture)}),terrainDepth:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix)}),terrainCoords:(a,t)=>({u_matrix:new l.UniformMatrix4f(a,t.u_matrix),u_texture:new l.Uniform1i(a,t.u_texture),u_terrain_coords_id:new l.Uniform1f(a,t.u_terrain_coords_id)})};class ss{constructor(t,n,s){this.context=t;const u=t.gl;this.buffer=u.createBuffer(),this.dynamicDraw=Boolean(s),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),u.bufferData(u.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const as={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ls{constructor(t,n,s,u){this.length=n.length,this.attributes=s,this.itemSize=n.bytesPerElement,this.dynamicDraw=u,this.context=t;const d=t.gl;this.buffer=d.createBuffer(),t.bindVertexBuffer.set(this.buffer),d.bufferData(d.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?d.DYNAMIC_DRAW:d.STATIC_DRAW),this.dynamicDraw||delete n.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let s=0;s<this.attributes.length;s++){const u=n.attributes[this.attributes[s].name];u!==void 0&&t.enableVertexAttribArray(u)}}setVertexAttribPointers(t,n,s){for(let u=0;u<this.attributes.length;u++){const d=this.attributes[u],f=n.attributes[d.name];f!==void 0&&t.vertexAttribPointer(f,d.components,t[as[d.type]],!1,this.itemSize,d.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class yt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class ca extends yt{getDefault(){return l.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class gl extends yt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Xn extends yt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Wn extends yt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ua extends yt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Mi extends yt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class cs extends yt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Io extends yt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Co extends yt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class us extends yt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class hs extends yt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Ao extends yt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class ds extends yt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class ps extends yt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Mo extends yt{getDefault(){return l.Color.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ha extends yt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class da extends yt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Tn extends yt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class _l extends yt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class yl extends yt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class xl extends yt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class vl extends yt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class bl extends yt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class wl extends yt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class fs extends yt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class zo extends yt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class ms extends yt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class gs extends yt{constructor(t){super(t),this.vao=t.extVertexArrayObject}getDefault(){return null}set(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)}}class En extends yt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class pa extends yt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class fa extends yt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Po extends yt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Hr extends Po{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class ma extends Po{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Sn{constructor(t,n,s,u){this.context=t,this.width=n,this.height=s;const d=t.gl,f=this.framebuffer=d.createFramebuffer();if(this.colorAttachment=new Hr(t,f),u&&(this.depthAttachment=new ma(t,f)),d.checkFramebufferStatus(d.FRAMEBUFFER)!==d.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const s=this.depthAttachment.get();s&&t.deleteRenderbuffer(s)}t.deleteFramebuffer(this.framebuffer)}}class Pt{constructor(t,n,s){this.blendFunction=t,this.blendColor=n,this.mask=s}}Pt.Replace=[1,0],Pt.disabled=new Pt(Pt.Replace,l.Color.transparent,[!1,!1,!1,!1]),Pt.unblended=new Pt(Pt.Replace,l.Color.transparent,[!0,!0,!0,!0]),Pt.alphaBlended=new Pt([1,771],l.Color.transparent,[!0,!0,!0,!0]);class ga{constructor(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new ca(this),this.clearDepth=new gl(this),this.clearStencil=new Xn(this),this.colorMask=new Wn(this),this.depthMask=new ua(this),this.stencilMask=new Mi(this),this.stencilFunc=new cs(this),this.stencilOp=new Io(this),this.stencilTest=new Co(this),this.depthRange=new us(this),this.depthTest=new hs(this),this.depthFunc=new Ao(this),this.blend=new ds(this),this.blendFunc=new ps(this),this.blendColor=new Mo(this),this.blendEquation=new ha(this),this.cullFace=new da(this),this.cullFaceSide=new Tn(this),this.frontFace=new _l(this),this.program=new yl(this),this.activeTexture=new xl(this),this.viewport=new vl(this),this.bindFramebuffer=new bl(this),this.bindRenderbuffer=new wl(this),this.bindTexture=new fs(this),this.bindVertexBuffer=new zo(this),this.bindElementBuffer=new ms(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new gs(this),this.pixelStoreUnpack=new En(this),this.pixelStoreUnpackPremultiplyAlpha=new pa(this),this.pixelStoreUnpackFlipY=new fa(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&(t.getExtension("OES_texture_half_float_linear"),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float")),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE)}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=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new ss(this,t,n)}createVertexBuffer(t,n,s){return new ls(this,t,n,s)}createRenderbuffer(t,n,s){const u=this.gl,d=u.createRenderbuffer();return this.bindRenderbuffer.set(d),u.renderbufferStorage(u.RENDERBUFFER,t,n,s),this.bindRenderbuffer.set(null),d}createFramebuffer(t,n,s){return new Sn(this,t,n,s)}clear({color:t,depth:n}){const s=this.gl;let u=0;t&&(u|=s.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(u|=s.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),s.clear(u)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){we(t.blendFunction,Pt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}unbindVAO(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)}}class at{constructor(t,n,s){this.func=t,this.mask=n,this.range=s}}at.ReadOnly=!1,at.ReadWrite=!0,at.disabled=new at(519,at.ReadOnly,[0,1]);const xt=7680;class zt{constructor(t,n,s,u,d,f){this.test=t,this.ref=n,this.mask=s,this.fail=u,this.depthFail=d,this.pass=f}}zt.disabled=new zt({func:519,mask:0},0,0,xt,xt,xt);class Bt{constructor(t,n,s){this.enable=t,this.mode=n,this.frontFace=s}}let Hn;function In(a,t,n,s,u,d,f){const _=a.context,y=_.gl,v=a.useProgram("collisionBox"),T=[];let I=0,M=0;for(let $=0;$<s.length;$++){const ne=s[$],ie=t.getTile(ne),ue=ie.getBucket(n);if(!ue)continue;let he=ne.posMatrix;u[0]===0&&u[1]===0||(he=a.translatePosMatrix(ne.posMatrix,ie,u,d));const ve=f?ue.textCollisionBox:ue.iconCollisionBox,ce=ue.collisionCircleArray;if(ce.length>0){const Le=l.create(),Se=he;l.mul(Le,ue.placementInvProjMatrix,a.transform.glCoordMatrix),l.mul(Le,Le,ue.placementViewportMatrix),T.push({circleArray:ce,circleOffset:M,transform:Se,invTransform:Le,coord:ne}),I+=ce.length/4,M=I}ve&&v.draw(_,y.LINES,at.disabled,zt.disabled,a.colorModeForRenderPass(),Bt.disabled,Wr(he,a.transform,ie),a.style.terrain&&a.style.terrain.getTerrainData(ne),n.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,null,a.transform.zoom,null,null,ve.collisionVertexBuffer)}if(!f||!T.length)return;const U=a.useProgram("collisionCircle"),F=new l.CollisionCircleLayoutArray;F.resize(4*I),F._trim();let O=0;for(const $ of T)for(let ne=0;ne<$.circleArray.length/4;ne++){const ie=4*ne,ue=$.circleArray[ie+0],he=$.circleArray[ie+1],ve=$.circleArray[ie+2],ce=$.circleArray[ie+3];F.emplace(O++,ue,he,ve,ce,0),F.emplace(O++,ue,he,ve,ce,1),F.emplace(O++,ue,he,ve,ce,2),F.emplace(O++,ue,he,ve,ce,3)}(!Hn||Hn.length<2*I)&&(Hn=function($){const ne=2*$,ie=new l.QuadTriangleArray;ie.resize(ne),ie._trim();for(let ue=0;ue<ne;ue++){const he=6*ue;ie.uint16[he+0]=4*ue+0,ie.uint16[he+1]=4*ue+1,ie.uint16[he+2]=4*ue+2,ie.uint16[he+3]=4*ue+2,ie.uint16[he+4]=4*ue+3,ie.uint16[he+5]=4*ue+0}return ie}(I));const H=_.createIndexBuffer(Hn,!0),Y=_.createVertexBuffer(F,l.collisionCircleLayout.members,!0);for(const $ of T){const ne={u_matrix:$.transform,u_inv_matrix:$.invTransform,u_camera_to_center_distance:(te=a.transform).cameraToCenterDistance,u_viewport_size:[te.width,te.height]};U.draw(_,y.TRIANGLES,at.disabled,zt.disabled,a.colorModeForRenderPass(),Bt.disabled,ne,a.style.terrain&&a.style.terrain.getTerrainData($.coord),n.id,Y,H,l.SegmentVector.simpleSegment(0,2*$.circleOffset,$.circleArray.length,$.circleArray.length/2),null,a.transform.zoom,null,null,null)}var te;Y.destroy(),H.destroy()}Bt.disabled=new Bt(!1,1029,2305),Bt.backCCW=new Bt(!0,1029,2305);const Tl=l.identity(new Float32Array(16));function El(a,t,n,s,u,d){const{horizontalAlign:f,verticalAlign:_}=l.getAnchorAlignment(a),y=-(f-.5)*t,v=-(_-.5)*n,T=l.evaluateVariableOffset(a,s);return new l.pointGeometry((y/u+T[0])*d,(v/u+T[1])*d)}function _a(a,t,n,s,u,d,f,_,y,v,T){const I=a.text.placedSymbolArray,M=a.text.dynamicLayoutVertexArray,U=a.icon.dynamicLayoutVertexArray,F={};M.clear();for(let O=0;O<I.length;O++){const H=I.get(O),Y=a.allowVerticalPlacement&&!H.placedOrientation,te=H.hidden||!H.crossTileID||Y?null:s[H.crossTileID];if(te){const $=new l.pointGeometry(H.anchorX,H.anchorY),ne=dt($,n?f:d,T),ie=Oi(u.cameraToCenterDistance,ne.signedDistanceFromCamera);let ue=l.evaluateSizeForFeature(a.textSizeData,y,H)*ie/l.ONE_EM;n&&(ue*=a.tilePixelRatio/_);const{width:he,height:ve,anchor:ce,textOffset:Le,textBoxScale:Se}=te,Re=El(ce,he,ve,Le,Se,ue),Qe=n?dt($.add(Re),d,T).point:ne.point.add(t?Re.rotate(-u.angle):Re),it=a.allowVerticalPlacement&&H.placedOrientation===l.WritingMode.vertical?Math.PI/2:0;for(let Ge=0;Ge<H.numGlyphs;Ge++)l.addDynamicAttributes(M,Qe,it);v&&H.associatedIconIndex>=0&&(F[H.associatedIconIndex]={shiftedAnchor:Qe,angle:it})}else Je(H.numGlyphs,M)}if(v){U.clear();const O=a.icon.placedSymbolArray;for(let H=0;H<O.length;H++){const Y=O.get(H);if(Y.hidden)Je(Y.numGlyphs,U);else{const te=F[H];if(te)for(let $=0;$<Y.numGlyphs;$++)l.addDynamicAttributes(U,te.shiftedAnchor,te.angle);else Je(Y.numGlyphs,U)}}a.icon.dynamicLayoutVertexBuffer.updateData(U)}a.text.dynamicLayoutVertexBuffer.updateData(M)}function Sl(a,t,n){return n.iconsInText&&t?"symbolTextAndIcon":a?"symbolSDF":"symbolIcon"}function ko(a,t,n,s,u,d,f,_,y,v,T,I){const M=a.context,U=M.gl,F=a.transform,O=_==="map",H=y==="map",Y=_!=="viewport"&&n.layout.get("symbol-placement")!=="point",te=O&&!H&&!Y,$=!n.layout.get("symbol-sort-key").isConstant();let ne=!1;const ie=a.depthModeForSublayer(0,at.ReadOnly),ue=n.layout.get("text-variable-anchor"),he=[];for(const ve of s){const ce=t.getTile(ve),Le=ce.getBucket(n);if(!Le)continue;const Se=u?Le.text:Le.icon;if(!Se||!Se.segments.get().length)continue;const Re=Se.programConfigurations.get(n.id),Qe=u||Le.sdfIcons,it=u?Le.textSizeData:Le.iconSizeData,Ge=H||F.pitch!==0,wt=a.useProgram(Sl(Qe,u,Le),Re),Tt=l.evaluateSizeForZoom(it,F.zoom),ut=a.style.terrain&&a.style.terrain.getTerrainData(ve);let mt,St,ei,rr,Xi=[0,0],nr=null;if(u){if(St=ce.glyphAtlasTexture,ei=U.LINEAR,mt=ce.glyphAtlasTexture.size,Le.iconsInText){Xi=ce.imageAtlasTexture.size,nr=ce.imageAtlasTexture;const Vi=it.kind==="composite"||it.kind==="camera";rr=Ge||a.options.rotating||a.options.zooming||Vi?U.LINEAR:U.NEAREST}}else{const Vi=n.layout.get("icon-size").constantOr(0)!==1||Le.iconsNeedLinear;St=ce.imageAtlasTexture,ei=Qe||a.options.rotating||a.options.zooming||Vi||Ge?U.LINEAR:U.NEAREST,mt=ce.imageAtlasTexture.size}const Ur=Zt(ce,1,a.transform.zoom),$i=qr(ve.posMatrix,H,O,a.transform,Ur),vi=Zi(ve.posMatrix,H,O,a.transform,Ur),yr=ue&&Le.hasTextData(),$o=n.layout.get("icon-text-fit")!=="none"&&yr&&Le.hasIconData();if(Y){const Vi=a.style.terrain?(Ps,kn)=>a.style.terrain.getElevation(ve,Ps,kn):null,Qr=n.layout.get("text-rotation-alignment")==="map";Ai(Le,ve.posMatrix,a,u,$i,vi,H,v,Qr,Vi)}const Ht=a.translatePosMatrix(ve.posMatrix,ce,d,f),nt=Y||u&&ue||$o?Tl:$i,vt=a.translatePosMatrix(vi,ce,d,f,!0),ti=Qe&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ii;ii=Qe?Le.iconsInText?la(it.kind,Tt,te,H,a,Ht,nt,vt,mt,Xi):So(it.kind,Tt,te,H,a,Ht,nt,vt,u,mt,!0):ns(it.kind,Tt,te,H,a,Ht,nt,vt,u,mt);const Ot={program:wt,buffers:Se,uniformValues:ii,atlasTexture:St,atlasTextureIcon:nr,atlasInterpolation:ei,atlasInterpolationIcon:rr,isSDF:Qe,hasHalo:ti};if($&&Le.canOverlap){ne=!0;const Vi=Se.segments.get();for(const Qr of Vi)he.push({segments:new l.SegmentVector([Qr]),sortKey:Qr.sortKey,state:Ot,terrainData:ut})}else he.push({segments:Se.segments,sortKey:0,state:Ot,terrainData:ut})}ne&&he.sort((ve,ce)=>ve.sortKey-ce.sortKey);for(const ve of he){const ce=ve.state;if(M.activeTexture.set(U.TEXTURE0),ce.atlasTexture.bind(ce.atlasInterpolation,U.CLAMP_TO_EDGE),ce.atlasTextureIcon&&(M.activeTexture.set(U.TEXTURE1),ce.atlasTextureIcon&&ce.atlasTextureIcon.bind(ce.atlasInterpolationIcon,U.CLAMP_TO_EDGE)),ce.isSDF){const Le=ce.uniformValues;ce.hasHalo&&(Le.u_is_halo=1,Kn(ce.buffers,ve.segments,n,a,ce.program,ie,T,I,Le,ve.terrainData)),Le.u_is_halo=0}Kn(ce.buffers,ve.segments,n,a,ce.program,ie,T,I,ce.uniformValues,ve.terrainData)}}function Kn(a,t,n,s,u,d,f,_,y,v){const T=s.context;u.draw(T,T.gl.TRIANGLES,d,f,_,Bt.disabled,y,v,n.id,a.layoutVertexBuffer,a.indexBuffer,t,n.paint,s.transform.zoom,a.programConfigurations.get(n.id),a.dynamicLayoutVertexBuffer,a.opacityVertexBuffer)}function Jn(a,t,n,s,u,d,f){const _=a.context.gl,y=n.paint.get("fill-pattern"),v=y&&y.constantOr(1),T=n.getCrossfadeParameters();let I,M,U,F,O;f?(M=v&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",I=_.LINES):(M=v?"fillPattern":"fill",I=_.TRIANGLES);for(const H of s){const Y=t.getTile(H);if(v&&!Y.patternsLoaded())continue;const te=Y.getBucket(n);if(!te)continue;const $=te.programConfigurations.get(n.id),ne=a.useProgram(M,$),ie=a.style.terrain&&a.style.terrain.getTerrainData(H);v&&(a.context.activeTexture.set(_.TEXTURE0),Y.imageAtlasTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),$.updatePaintBuffers(T));const ue=y.constantOr(null);if(ue&&Y.imageAtlas){const ce=Y.imageAtlas,Le=ce.patternPositions[ue.to.toString()],Se=ce.patternPositions[ue.from.toString()];Le&&Se&&$.setConstantPatternPositions(Le,Se)}const he=ie?H:null,ve=a.translatePosMatrix(he?he.posMatrix:H.posMatrix,Y,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(f){F=te.indexBuffer2,O=te.segments2;const ce=[_.drawingBufferWidth,_.drawingBufferHeight];U=M==="fillOutlinePattern"&&v?na(ve,a,T,Y,ce):ra(ve,ce)}else F=te.indexBuffer,O=te.segments,U=v?is(ve,a,T,Y):bo(ve);ne.draw(a.context,I,u,a.stencilModeForClipping(H),d,Bt.disabled,U,ie,n.id,te.layoutVertexBuffer,F,O,n.paint,a.transform.zoom,$)}}function Yn(a,t,n,s,u,d,f){const _=a.context,y=_.gl,v=n.paint.get("fill-extrusion-pattern"),T=v.constantOr(1),I=n.getCrossfadeParameters(),M=n.paint.get("fill-extrusion-opacity");for(const U of s){const F=t.getTile(U),O=F.getBucket(n);if(!O)continue;const H=a.style.terrain&&a.style.terrain.getTerrainData(U),Y=O.programConfigurations.get(n.id),te=a.useProgram(T?"fillExtrusionPattern":"fillExtrusion",Y);T&&(a.context.activeTexture.set(y.TEXTURE0),F.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),Y.updatePaintBuffers(I));const $=v.constantOr(null);if($&&F.imageAtlas){const he=F.imageAtlas,ve=he.patternPositions[$.to.toString()],ce=he.patternPositions[$.from.toString()];ve&&ce&&Y.setConstantPatternPositions(ve,ce)}const ne=a.translatePosMatrix(U.posMatrix,F,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ie=n.paint.get("fill-extrusion-vertical-gradient"),ue=T?pl(ne,a,ie,M,U,I,F):ts(ne,a,ie,M);te.draw(_,_.gl.TRIANGLES,u,d,f,Bt.backCCW,ue,H,n.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,n.paint,a.transform.zoom,Y,a.style.terrain&&O.centroidVertexBuffer)}}function _s(a,t,n,s,u,d,f){const _=a.context,y=_.gl,v=n.fbo;if(!v)return;const T=a.useProgram("hillshade"),I=a.style.terrain&&a.style.terrain.getTerrainData(t);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment.get()),T.draw(_,y.TRIANGLES,u,d,f,Bt.disabled,((M,U,F,O)=>{const H=F.paint.get("hillshade-shadow-color"),Y=F.paint.get("hillshade-highlight-color"),te=F.paint.get("hillshade-accent-color");let $=F.paint.get("hillshade-illumination-direction")*(Math.PI/180);F.paint.get("hillshade-illumination-anchor")==="viewport"&&($-=M.transform.angle);const ne=!M.options.moving;return{u_matrix:O?O.posMatrix:M.transform.calculatePosMatrix(U.tileID.toUnwrapped(),ne),u_image:0,u_latrange:To(0,U.tileID),u_light:[F.paint.get("hillshade-exaggeration"),$],u_shadow:H,u_highlight:Y,u_accent:te}})(a,n,s,I?t:null),I,s.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments)}function ya(a,t,n,s,u,d){const f=a.context,_=f.gl,y=t.dem;if(y&&y.data){const v=y.dim,T=y.stride,I=y.getPixels();if(f.activeTexture.set(_.TEXTURE1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||a.getTileTexture(T),t.demTexture){const U=t.demTexture;U.update(I,{premultiply:!1}),U.bind(_.NEAREST,_.CLAMP_TO_EDGE)}else t.demTexture=new He(f,I,_.RGBA,{premultiply:!1}),t.demTexture.bind(_.NEAREST,_.CLAMP_TO_EDGE);f.activeTexture.set(_.TEXTURE0);let M=t.fbo;if(!M){const U=new He(f,{width:v,height:v,data:null},_.RGBA);U.bind(_.LINEAR,_.CLAMP_TO_EDGE),M=t.fbo=f.createFramebuffer(v,v,!0),M.colorAttachment.set(U.texture)}f.bindFramebuffer.set(M.framebuffer),f.viewport.set([0,0,v,v]),a.useProgram("hillshadePrepare").draw(f,_.TRIANGLES,s,u,d,Bt.disabled,((U,F)=>{const O=F.stride,H=l.create();return l.ortho(H,0,l.EXTENT,-l.EXTENT,0,0,1),l.translate(H,H,[0,-l.EXTENT,0]),{u_matrix:H,u_image:1,u_dimension:[O,O],u_zoom:U.overscaledZ,u_unpack:F.getUnpackVector()}})(t.tileID,y),null,n.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function Do(a,t,n,s,u,d){const f=s.paint.get("raster-fade-duration");if(!d&&f>0){const _=l.exported.now(),y=(_-a.timeAdded)/f,v=t?(_-t.timeAdded)/f:-1,T=n.getSource(),I=u.coveringZoomLevel({tileSize:T.tileSize,roundZoom:T.roundZoom}),M=!t||Math.abs(t.tileID.overscaledZ-I)>Math.abs(a.tileID.overscaledZ-I),U=M&&a.refreshedUponExpiration?1:l.clamp(M?y:1-v,0,1);return a.refreshedUponExpiration&&y>=1&&(a.refreshedUponExpiration=!1),t?{opacity:1,mix:1-U}:{opacity:U,mix:0}}return{opacity:1,mix:0}}const Lo=new l.Color(1,0,0,1),ji=new l.Color(0,1,0,1),xa=new l.Color(0,0,1,1),ys=new l.Color(1,0,1,1),va=new l.Color(0,1,1,1);function Kr(a,t,n,s){Cn(a,0,t+n/2,a.transform.width,n,s)}function Qn(a,t,n,s){Cn(a,t-n/2,0,n,a.transform.height,s)}function Cn(a,t,n,s,u,d){const f=a.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(t*a.pixelRatio,n*a.pixelRatio,s*a.pixelRatio,u*a.pixelRatio),f.clear({color:d}),_.disable(_.SCISSOR_TEST)}function Il(a,t,n){const s=a.context,u=s.gl,d=n.posMatrix,f=a.useProgram("debug"),_=at.disabled,y=zt.disabled,v=a.colorModeForRenderPass(),T="$debug",I=a.style.terrain&&a.style.terrain.getTerrainData(n);s.activeTexture.set(u.TEXTURE0),a.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE);const M=t.getTileByID(n.key).latestRawTileData,U=Math.floor((M&&M.byteLength||0)/1024),F=t.getTile(n).tileSize,O=512/Math.min(F,512)*(n.overscaledZ/a.transform.zoom)*.5;let H=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(H+=` => ${n.overscaledZ}`),function(Y,te){Y.initDebugOverlayCanvas();const $=Y.debugOverlayCanvas,ne=Y.context.gl,ie=Y.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,$.width,$.height),ie.shadowColor="white",ie.shadowBlur=2,ie.lineWidth=1.5,ie.strokeStyle="white",ie.textBaseline="top",ie.font="bold 36px Open Sans, sans-serif",ie.fillText(te,5,5),ie.strokeText(te,5,5),Y.debugOverlayTexture.update($),Y.debugOverlayTexture.bind(ne.LINEAR,ne.CLAMP_TO_EDGE)}(a,`${H} ${U}kB`),f.draw(s,u.TRIANGLES,_,y,Pt.alphaBlended,Bt.disabled,qn(d,l.Color.transparent,O),null,T,a.debugBuffer,a.quadTriangleIndexBuffer,a.debugSegments),f.draw(s,u.LINE_STRIP,_,y,v,Bt.disabled,qn(d,l.Color.red),I,T,a.debugBuffer,a.tileBorderIndexBuffer,a.debugSegments)}function Ro(a,t,n){const s=a.context,u=s.gl,d=a.colorModeForRenderPass(),f=new at(u.LEQUAL,at.ReadWrite,a.depthRangeFor3D),_=a.useProgram("terrain"),y=t.getTerrainMesh(),v=t.getTerrainData(n.tileID);s.bindFramebuffer.set(null),s.viewport.set([0,0,a.width,a.height]),s.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const T=a.transform.calculatePosMatrix(n.tileID.toUnwrapped());_.draw(s,u.TRIANGLES,f,zt.disabled,d,Bt.backCCW,{u_matrix:T,u_texture:0},v,"terrain",y.vertexBuffer,y.indexBuffer,y.segments)}function ba(a,t,n,s){const u=a.context,d=n.tileSize*t.qualityFactor;n.textures[s]||(n.textures[s]=a.getTileTexture(d)||new He(u,{width:d,height:d,data:null},u.gl.RGBA),n.textures[s].bind(u.gl.LINEAR,u.gl.CLAMP_TO_EDGE),s===0&&t.sourceCache.renderHistory.unshift(n.tileID.key));const f=t.getRTTFramebuffer();f.colorAttachment.set(n.textures[s].texture),u.bindFramebuffer.set(f.framebuffer),u.viewport.set([0,0,d,d])}class wa{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const t=this.painter.style,n=t.terrain;for(const s in t.sourceCaches){this._coordsDescendingInv[s]={};const u=t.sourceCaches[s].getVisibleCoordinates();for(const d of u){const f=n.sourceCache.getTerrainCoords(d);for(const _ in f)this._coordsDescendingInv[s][_]||(this._coordsDescendingInv[s][_]=[]),this._coordsDescendingInv[s][_].push(f[_])}}for(const s of t._order){const u=t._layers[s],d=u.source;if(this._renderToTexture[u.type]&&!this._coordsDescendingInvStr[d]){this._coordsDescendingInvStr[d]={};for(const f in this._coordsDescendingInv[d])this._coordsDescendingInvStr[d][f]=this._coordsDescendingInv[d][f].map(_=>_.key).sort().join()}}return this._renderableTiles.forEach(s=>{for(const u in this._coordsDescendingInvStr){const d=this._coordsDescendingInvStr[u][s.tileID.key];d&&d!==s.textureCoords[u]&&s.clearTextures(this.painter),n.needsRerender(u,s.tileID)&&s.clearTextures(this.painter)}this._rerender[s.tileID.key]=!s.textures.length}),n.clearRerenderCache(),n.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const n=t.type,s=this.painter,u=s.style._order,d=s.currentLayer,f=d+1===u.length;if(this._renderToTexture[n]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(u[d]),!f))return!0;if(this._renderToTexture[this._prevType]||n==="hillshade"||this._renderToTexture[n]&&f){this._prevType=n;const _=this._stacks.length-1,y=this._stacks[_]||[];for(const v of this._renderableTiles){if(ba(s,s.style.terrain,v,_),this._rerender[v.tileID.key]){s.context.clear({color:l.Color.transparent});for(let T=0;T<y.length;T++){const I=s.style._layers[y[T]],M=I.source?this._coordsDescendingInv[I.source][v.tileID.key]:[v.tileID];s._renderTileClippingMasks(I,M),s.renderLayer(s,s.style.sourceCaches[I.source],I,M),I.source&&(v.textureCoords[I.source]=this._coordsDescendingInvStr[I.source][v.tileID.key])}}Ro(s,s.style.terrain,v)}if(n==="hillshade"){this._stacks.push([u[d]]);for(const v of this._renderableTiles){const T=this._coordsDescendingInv[t.source][v.tileID.key];ba(s,s.style.terrain,v,this._stacks.length-1),s.context.clear({color:l.Color.transparent}),s._renderTileClippingMasks(t,T),s.renderLayer(s,s.style.sourceCaches[t.source],t,T),Ro(s,s.style.terrain,v)}return!0}return this._renderToTexture[n]}return!1}}const eo={symbol:function(a,t,n,s,u){if(a.renderPass!=="translucent")return;const d=zt.disabled,f=a.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(_,y,v,T,I,M,U){const F=y.transform,O=I==="map",H=M==="map";for(const Y of _){const te=T.getTile(Y),$=te.getBucket(v);if(!$||!$.text||!$.text.segments.get().length)continue;const ne=l.evaluateSizeForZoom($.textSizeData,F.zoom),ie=Zt(te,1,y.transform.zoom),ue=qr(Y.posMatrix,H,O,y.transform,ie),he=v.layout.get("icon-text-fit")!=="none"&&$.hasIconData();if(ne){const ve=Math.pow(2,F.zoom-te.tileID.overscaledZ);_a($,O,H,U,F,ue,Y.posMatrix,ve,ne,he,y.style.terrain?(ce,Le)=>y.style.terrain.getElevation(Y,ce,Le):null)}}}(s,a,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),u),n.paint.get("icon-opacity").constantOr(1)!==0&&ko(a,t,n,s,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),d,f),n.paint.get("text-opacity").constantOr(1)!==0&&ko(a,t,n,s,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),d,f),t.map.showCollisionBoxes&&(In(a,t,n,s,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),In(a,t,n,s,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(a,t,n,s){if(a.renderPass!=="translucent")return;const u=n.paint.get("circle-opacity"),d=n.paint.get("circle-stroke-width"),f=n.paint.get("circle-stroke-opacity"),_=!n.layout.get("circle-sort-key").isConstant();if(u.constantOr(1)===0&&(d.constantOr(1)===0||f.constantOr(1)===0))return;const y=a.context,v=y.gl,T=a.depthModeForSublayer(0,at.ReadOnly),I=zt.disabled,M=a.colorModeForRenderPass(),U=[];for(let F=0;F<s.length;F++){const O=s[F],H=t.getTile(O),Y=H.getBucket(n);if(!Y)continue;const te=Y.programConfigurations.get(n.id),$=a.useProgram("circle",te),ne=Y.layoutVertexBuffer,ie=Y.indexBuffer,ue=a.style.terrain&&a.style.terrain.getTerrainData(O),he={programConfiguration:te,program:$,layoutVertexBuffer:ne,indexBuffer:ie,uniformValues:oa(a,O,H,n),terrainData:ue};if(_){const ve=Y.segments.get();for(const ce of ve)U.push({segments:new l.SegmentVector([ce]),sortKey:ce.sortKey,state:he})}else U.push({segments:Y.segments,sortKey:0,state:he})}_&&U.sort((F,O)=>F.sortKey-O.sortKey);for(const F of U){const{programConfiguration:O,program:H,layoutVertexBuffer:Y,indexBuffer:te,uniformValues:$,terrainData:ne}=F.state;H.draw(y,v.TRIANGLES,T,I,M,Bt.disabled,$,ne,n.id,Y,te,F.segments,n.paint,a.transform.zoom,O)}},heatmap:function(a,t,n,s){if(n.paint.get("heatmap-opacity")!==0)if(a.renderPass==="offscreen"){const u=a.context,d=u.gl,f=zt.disabled,_=new Pt([d.ONE,d.ONE],l.Color.transparent,[!0,!0,!0,!0]);(function(y,v,T){const I=y.gl;y.activeTexture.set(I.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let M=T.heatmapFbo;if(M)I.bindTexture(I.TEXTURE_2D,M.colorAttachment.get()),y.bindFramebuffer.set(M.framebuffer);else{const U=I.createTexture();I.bindTexture(I.TEXTURE_2D,U),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_S,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_T,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_MIN_FILTER,I.LINEAR),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_MAG_FILTER,I.LINEAR),M=T.heatmapFbo=y.createFramebuffer(v.width/4,v.height/4,!1),function(F,O,H,Y){const te=F.gl;te.texImage2D(te.TEXTURE_2D,0,te.RGBA,O.width/4,O.height/4,0,te.RGBA,F.extRenderToTextureHalfFloat?F.extTextureHalfFloat.HALF_FLOAT_OES:te.UNSIGNED_BYTE,null),Y.colorAttachment.set(H)}(y,v,U,M)}})(u,a,n),u.clear({color:l.Color.transparent});for(let y=0;y<s.length;y++){const v=s[y];if(t.hasRenderableParent(v))continue;const T=t.getTile(v),I=T.getBucket(n);if(!I)continue;const M=I.programConfigurations.get(n.id),U=a.useProgram("heatmap",M),{zoom:F}=a.transform;U.draw(u,d.TRIANGLES,at.disabled,f,_,Bt.disabled,wo(v.posMatrix,T,F,n.paint.get("heatmap-intensity")),null,n.id,I.layoutVertexBuffer,I.indexBuffer,I.segments,n.paint,a.transform.zoom,M)}u.viewport.set([0,0,a.width,a.height])}else a.renderPass==="translucent"&&(a.context.setColorMode(a.colorModeForRenderPass()),function(u,d){const f=u.context,_=f.gl,y=d.heatmapFbo;if(!y)return;f.activeTexture.set(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,y.colorAttachment.get()),f.activeTexture.set(_.TEXTURE1);let v=d.colorRampTexture;v||(v=d.colorRampTexture=new He(f,d.colorRamp,_.RGBA)),v.bind(_.LINEAR,_.CLAMP_TO_EDGE),u.useProgram("heatmapTexture").draw(f,_.TRIANGLES,at.disabled,zt.disabled,u.colorModeForRenderPass(),Bt.disabled,((T,I,M,U)=>{const F=l.create();l.ortho(F,0,T.width,T.height,0,0,1);const O=T.context.gl;return{u_matrix:F,u_world:[O.drawingBufferWidth,O.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:I.paint.get("heatmap-opacity")}})(u,d),null,d.id,u.viewportBuffer,u.quadTriangleIndexBuffer,u.viewportSegments,d.paint,u.transform.zoom)}(a,n))},line:function(a,t,n,s){if(a.renderPass!=="translucent")return;const u=n.paint.get("line-opacity"),d=n.paint.get("line-width");if(u.constantOr(1)===0||d.constantOr(1)===0)return;const f=a.depthModeForSublayer(0,at.ReadOnly),_=a.colorModeForRenderPass(),y=n.paint.get("line-dasharray"),v=n.paint.get("line-pattern"),T=v.constantOr(1),I=n.paint.get("line-gradient"),M=n.getCrossfadeParameters(),U=T?"linePattern":y?"lineSDF":I?"lineGradient":"line",F=a.context,O=F.gl;let H=!0;for(const Y of s){const te=t.getTile(Y);if(T&&!te.patternsLoaded())continue;const $=te.getBucket(n);if(!$)continue;const ne=$.programConfigurations.get(n.id),ie=a.context.program.get(),ue=a.useProgram(U,ne),he=H||ue.program!==ie,ve=a.style.terrain&&a.style.terrain.getTerrainData(Y),ce=v.constantOr(null);if(ce&&te.imageAtlas){const Re=te.imageAtlas,Qe=Re.patternPositions[ce.to.toString()],it=Re.patternPositions[ce.from.toString()];Qe&&it&&ne.setConstantPatternPositions(Qe,it)}const Le=ve?Y:null,Se=T?Eo(a,te,n,M,Le):y?Zn(a,te,n,y,M,Le):I?rs(a,te,n,$.lineClipsArray.length,Le):wn(a,te,n,Le);if(T)F.activeTexture.set(O.TEXTURE0),te.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),ne.updatePaintBuffers(M);else if(y&&(he||a.lineAtlas.dirty))F.activeTexture.set(O.TEXTURE0),a.lineAtlas.bind(F);else if(I){const Re=$.gradients[n.id];let Qe=Re.texture;if(n.gradientVersion!==Re.version){let it=256;if(n.stepInterpolant){const Ge=t.getSource().maxzoom,wt=Y.canonical.z===Ge?Math.ceil(1<<a.transform.maxZoom-Y.canonical.z):1;it=l.clamp(l.nextPowerOfTwo($.maxLineLength/l.EXTENT*1024*wt),256,F.maxTextureSize)}Re.gradient=l.renderColorRamp({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:it,image:Re.gradient||void 0,clips:$.lineClipsArray}),Re.texture?Re.texture.update(Re.gradient):Re.texture=new He(F,Re.gradient,O.RGBA),Re.version=n.gradientVersion,Qe=Re.texture}F.activeTexture.set(O.TEXTURE0),Qe.bind(n.stepInterpolant?O.NEAREST:O.LINEAR,O.CLAMP_TO_EDGE)}ue.draw(F,O.TRIANGLES,f,a.stencilModeForClipping(Y),_,Bt.disabled,Se,ve,n.id,$.layoutVertexBuffer,$.indexBuffer,$.segments,n.paint,a.transform.zoom,ne,$.layoutVertexBuffer2),H=!1}},fill:function(a,t,n,s){const u=n.paint.get("fill-color"),d=n.paint.get("fill-opacity");if(d.constantOr(1)===0)return;const f=a.colorModeForRenderPass(),_=n.paint.get("fill-pattern"),y=a.opaquePassEnabledForLayer()&&!_.constantOr(1)&&u.constantOr(l.Color.transparent).a===1&&d.constantOr(0)===1?"opaque":"translucent";if(a.renderPass===y){const v=a.depthModeForSublayer(1,a.renderPass==="opaque"?at.ReadWrite:at.ReadOnly);Jn(a,t,n,s,v,f,!1)}if(a.renderPass==="translucent"&&n.paint.get("fill-antialias")){const v=a.depthModeForSublayer(n.getPaintProperty("fill-outline-color")?2:0,at.ReadOnly);Jn(a,t,n,s,v,f,!0)}},"fill-extrusion":function(a,t,n,s){const u=n.paint.get("fill-extrusion-opacity");if(u!==0&&a.renderPass==="translucent"){const d=new at(a.context.gl.LEQUAL,at.ReadWrite,a.depthRangeFor3D);if(u!==1||n.paint.get("fill-extrusion-pattern").constantOr(1))Yn(a,t,n,s,d,zt.disabled,Pt.disabled),Yn(a,t,n,s,d,a.stencilModeFor3D(),a.colorModeForRenderPass());else{const f=a.colorModeForRenderPass();Yn(a,t,n,s,d,zt.disabled,f)}}},hillshade:function(a,t,n,s){if(a.renderPass!=="offscreen"&&a.renderPass!=="translucent")return;const u=a.context,d=a.depthModeForSublayer(0,at.ReadOnly),f=a.colorModeForRenderPass(),[_,y]=a.renderPass==="translucent"?a.stencilConfigForOverlap(s):[{},s];for(const v of y){const T=t.getTile(v);T.needsHillshadePrepare!==void 0&&T.needsHillshadePrepare&&a.renderPass==="offscreen"?ya(a,T,n,d,zt.disabled,f):a.renderPass==="translucent"&&_s(a,v,T,n,d,_[v.overscaledZ],f)}u.viewport.set([0,0,a.width,a.height])},raster:function(a,t,n,s){if(a.renderPass!=="translucent"||n.paint.get("raster-opacity")===0||!s.length)return;const u=a.context,d=u.gl,f=t.getSource(),_=a.useProgram("raster"),y=a.colorModeForRenderPass(),[v,T]=f instanceof Gi?[{},s]:a.stencilConfigForOverlap(s),I=T[T.length-1].overscaledZ,M=!a.options.moving;for(const U of T){const F=a.depthModeForSublayer(U.overscaledZ-I,n.paint.get("raster-opacity")===1?at.ReadWrite:at.ReadOnly,d.LESS),O=t.getTile(U);O.registerFadeDuration(n.paint.get("raster-fade-duration"));const H=t.findLoadedParent(U,0),Y=Do(O,H,t,n,a.transform,a.style.terrain);let te,$;const ne=n.paint.get("raster-resampling")==="nearest"?d.NEAREST:d.LINEAR;u.activeTexture.set(d.TEXTURE0),O.texture.bind(ne,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),u.activeTexture.set(d.TEXTURE1),H?(H.texture.bind(ne,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),te=Math.pow(2,H.tileID.overscaledZ-O.tileID.overscaledZ),$=[O.tileID.canonical.x*te%1,O.tileID.canonical.y*te%1]):O.texture.bind(ne,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST);const ie=a.style.terrain&&a.style.terrain.getTerrainData(U),ue=ie?U:null,he=ue?ue.posMatrix:a.transform.calculatePosMatrix(U.toUnwrapped(),M),ve=sa(he,$||[0,0],te||1,Y,n);f instanceof Gi?_.draw(u,d.TRIANGLES,F,zt.disabled,y,Bt.disabled,ve,ie,n.id,f.boundsBuffer,a.quadTriangleIndexBuffer,f.boundsSegments):_.draw(u,d.TRIANGLES,F,v[U.overscaledZ],y,Bt.disabled,ve,ie,n.id,a.rasterBoundsBuffer,a.quadTriangleIndexBuffer,a.rasterBoundsSegments)}},background:function(a,t,n,s){const u=n.paint.get("background-color"),d=n.paint.get("background-opacity");if(d===0)return;const f=a.context,_=f.gl,y=a.transform,v=y.tileSize,T=n.paint.get("background-pattern");if(a.isPatternMissing(T))return;const I=!T&&u.a===1&&d===1&&a.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.renderPass!==I)return;const M=zt.disabled,U=a.depthModeForSublayer(0,I==="opaque"?at.ReadWrite:at.ReadOnly),F=a.colorModeForRenderPass(),O=a.useProgram(T?"backgroundPattern":"background"),H=s||y.coveringTiles({tileSize:v,terrain:a.style.terrain});T&&(f.activeTexture.set(_.TEXTURE0),a.imageManager.bind(a.context));const Y=n.getCrossfadeParameters();for(const te of H){const $=s?te.posMatrix:a.transform.calculatePosMatrix(te.toUnwrapped()),ne=T?ml($,d,a,T,{tileID:te,tileSize:v},Y):fl($,d,u),ie=a.style.terrain&&a.style.terrain.getTerrainData(te);O.draw(f,_.TRIANGLES,U,M,F,Bt.disabled,ne,ie,n.id,a.tileExtentBuffer,a.quadTriangleIndexBuffer,a.tileExtentSegments)}},debug:function(a,t,n){for(let s=0;s<n.length;s++)Il(a,t,n[s])},custom:function(a,t,n){const s=a.context,u=n.implementation;if(a.renderPass==="offscreen"){const d=u.prerender;d&&(a.setCustomLayerDefaults(),s.setColorMode(a.colorModeForRenderPass()),d.call(u,s.gl,a.transform.customLayerMatrix()),s.setDirty(),a.setBaseState())}else if(a.renderPass==="translucent"){a.setCustomLayerDefaults(),s.setColorMode(a.colorModeForRenderPass()),s.setStencilMode(zt.disabled);const d=u.renderingMode==="3d"?new at(a.context.gl.LEQUAL,at.ReadWrite,a.depthRangeFor3D):a.depthModeForSublayer(0,at.ReadOnly);s.setDepthMode(d),u.render(s.gl,a.transform.customLayerMatrix()),s.setDirty(),a.setBaseState(),s.bindFramebuffer.set(null)}}};class xs{constructor(t,n){this.context=new ga(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:l.create(),renderTime:0},this.setup(),this.numSublayers=yi.maxUnderzooming+yi.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Xe,this.gpuTimers={}}resize(t,n,s){if(this.width=t*s,this.height=n*s,this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style._order)this.style._layers[u].resize()}setup(){const t=this.context,n=new l.PosArray;n.emplaceBack(0,0),n.emplaceBack(l.EXTENT,0),n.emplaceBack(0,l.EXTENT),n.emplaceBack(l.EXTENT,l.EXTENT),this.tileExtentBuffer=t.createVertexBuffer(n,pt.members),this.tileExtentSegments=l.SegmentVector.simpleSegment(0,0,4,2);const s=new l.PosArray;s.emplaceBack(0,0),s.emplaceBack(l.EXTENT,0),s.emplaceBack(0,l.EXTENT),s.emplaceBack(l.EXTENT,l.EXTENT),this.debugBuffer=t.createVertexBuffer(s,pt.members),this.debugSegments=l.SegmentVector.simpleSegment(0,0,4,5);const u=new l.RasterBoundsArray;u.emplaceBack(0,0,0,0),u.emplaceBack(l.EXTENT,0,l.EXTENT,0),u.emplaceBack(0,l.EXTENT,0,l.EXTENT),u.emplaceBack(l.EXTENT,l.EXTENT,l.EXTENT,l.EXTENT),this.rasterBoundsBuffer=t.createVertexBuffer(u,ur.members),this.rasterBoundsSegments=l.SegmentVector.simpleSegment(0,0,4,2);const d=new l.PosArray;d.emplaceBack(0,0),d.emplaceBack(1,0),d.emplaceBack(0,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,pt.members),this.viewportSegments=l.SegmentVector.simpleSegment(0,0,4,2);const f=new l.LineStripIndexArray;f.emplaceBack(0),f.emplaceBack(1),f.emplaceBack(3),f.emplaceBack(2),f.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(f);const _=new l.TriangleIndexArray;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_),this.emptyTexture=new He(t,{width:1,height:1,data:new Uint8Array([0,0,0,0])},t.gl.RGBA);const y=this.context.gl;this.stencilClearMode=new zt({func:y.ALWAYS,mask:0},0,255,y.ZERO,y.ZERO,y.ZERO)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=l.create();l.ortho(s,0,this.width,this.height,0,0,1),l.scale(s,s,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,n.TRIANGLES,at.disabled,this.stencilClearMode,Pt.disabled,Bt.disabled,bn(s),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source;const s=this.context,u=s.gl;this.nextStencilID+n.length>256&&this.clearStencil(),s.setColorMode(Pt.disabled),s.setDepthMode(at.disabled);const d=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const f of n){const _=this._tileClippingMaskIDs[f.key]=this.nextStencilID++,y=this.style.terrain&&this.style.terrain.getTerrainData(f);d.draw(s,u.TRIANGLES,at.disabled,new zt({func:u.ALWAYS,mask:0},_,255,u.KEEP,u.KEEP,u.REPLACE),Pt.disabled,Bt.disabled,bn(f.posMatrix),y,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new zt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new zt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,s=t.sort((f,_)=>_.overscaledZ-f.overscaledZ),u=s[s.length-1].overscaledZ,d=s[0].overscaledZ-u+1;if(d>1){this.currentStencilSource=void 0,this.nextStencilID+d>256&&this.clearStencil();const f={};for(let _=0;_<d;_++)f[_+u]=new zt({func:n.GEQUAL,mask:255},_+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=d,[f,s]}return[{[u]:zt.disabled},s]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Pt([t.CONSTANT_COLOR,t.ONE],new l.Color(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Pt.unblended:Pt.alphaBlended}depthModeForSublayer(t,n,s){if(!this.opaquePassEnabledForLayer())return at.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new at(s||this.context.gl.LEQUAL,n,[u,u])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(l.exported.now()),this.imageManager.beginFrame();const s=this.style._order,u=this.style.sourceCaches,d=this.style.terrain&&new wa(this);for(const v in u){const T=u[v];T.used&&T.prepare(this.context)}const f={},_={},y={};for(const v in u){const T=u[v];f[v]=T.getVisibleCoordinates(),_[v]=f[v].slice().reverse(),y[v]=T.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let v=0;v<s.length;v++)if(this.style._layers[s[v]].is3D()){this.opaquePassCutoff=v;break}if(d){this.opaquePassCutoff=0;const v=this.style.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!l.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||v.length)&&(l.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(T,I){const M=T.context,U=M.gl,F=Pt.unblended,O=new at(U.LEQUAL,at.ReadWrite,[0,1]),H=I.getTerrainMesh(),Y=I.sourceCache.getRenderableTiles(),te=T.useProgram("terrainDepth");M.bindFramebuffer.set(I.getFramebuffer("depth").framebuffer),M.viewport.set([0,0,T.width/devicePixelRatio,T.height/devicePixelRatio]),M.clear({color:l.Color.transparent,depth:1});for(const $ of Y){const ne=I.getTerrainData($.tileID),ie=T.transform.calculatePosMatrix($.tileID.toUnwrapped());te.draw(M,U.TRIANGLES,O,zt.disabled,F,Bt.backCCW,{u_matrix:ie},ne,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}M.bindFramebuffer.set(null),M.viewport.set([0,0,T.width,T.height])}(this,this.style.terrain),function(T,I){const M=T.context,U=M.gl,F=Pt.unblended,O=new at(U.LEQUAL,at.ReadWrite,[0,1]),H=I.getTerrainMesh(),Y=I.getCoordsTexture(),te=I.sourceCache.getRenderableTiles(),$=T.useProgram("terrainCoords");M.bindFramebuffer.set(I.getFramebuffer("coords").framebuffer),M.viewport.set([0,0,T.width/devicePixelRatio,T.height/devicePixelRatio]),M.clear({color:l.Color.transparent,depth:1}),I.coordsIndex=[];for(const ne of te){const ie=I.getTerrainData(ne.tileID);M.activeTexture.set(U.TEXTURE0),U.bindTexture(U.TEXTURE_2D,Y.texture);const ue=T.transform.calculatePosMatrix(ne.tileID.toUnwrapped());$.draw(M,U.TRIANGLES,O,zt.disabled,F,Bt.backCCW,{u_matrix:ue,u_terrain_coords_id:(255-I.coordsIndex.length)/255,u_texture:0},ie,"terrain",H.vertexBuffer,H.indexBuffer,H.segments),I.coordsIndex.push(ne.tileID.key)}M.bindFramebuffer.set(null),M.viewport.set([0,0,T.width,T.height])}(this,this.style.terrain))}this.renderPass="offscreen";for(const v of s){const T=this.style._layers[v];if(!T.hasOffscreenPass()||T.isHidden(this.transform.zoom))continue;const I=_[T.source];(T.type==="custom"||I.length)&&this.renderLayer(this,u[T.source],T,I)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?l.Color.black:l.Color.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!d)for(this.renderPass="opaque",this.currentLayer=s.length-1;this.currentLayer>=0;this.currentLayer--){const v=this.style._layers[s[this.currentLayer]],T=u[v.source],I=f[v.source];this._renderTileClippingMasks(v,I),this.renderLayer(this,T,v,I)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<s.length;this.currentLayer++){const v=this.style._layers[s[this.currentLayer]],T=u[v.source];if(d&&d.renderLayer(v))continue;const I=(v.type==="symbol"?y:_)[v.source];this._renderTileClippingMasks(v,f[v.source]),this.renderLayer(this,T,v,I)}if(this.options.showTileBoundaries){let v,T;Object.values(this.style._layers).forEach(I=>{I.source&&!I.isHidden(this.transform.zoom)&&(I.source!==(T&&T.id)&&(T=this.style.sourceCaches[I.source]),(!v||v.getSource().maxzoom<T.getSource().maxzoom)&&(v=T))}),v&&eo.debug(this,v,v.getVisibleCoordinates())}this.options.showPadding&&function(v){const T=v.transform.padding;Kr(v,v.transform.height-(T.top||0),3,Lo),Kr(v,T.bottom||0,3,ji),Qn(v,T.left||0,3,xa),Qn(v,v.transform.width-(T.right||0),3,ys);const I=v.transform.centerPoint;(function(M,U,F,O){Cn(M,U-1,F-10,2,20,O),Cn(M,U-10,F-1,20,2,O)})(v,I.x,v.transform.height-I.y,va)}(this),this.context.setDefault()}renderLayer(t,n,s,u){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(u||[]).length)&&(this.id=s.id,this.gpuTimingStart(s),eo[s.type](t,n,s,u,this.style.placement.variableOffsets),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery;let s=this.gpuTimers[t.id];s||(s=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:n.createQueryEXT()}),s.calls++,n.beginQueryEXT(n.TIME_ELAPSED_EXT,s.query)}gpuTimingEnd(){if(!this.options.gpuTiming)return;const t=this.context.extTimerQuery;t.endQueryEXT(t.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}queryGpuTimers(t){const n={};for(const s in t){const u=t[s],d=this.context.extTimerQuery,f=d.getQueryObjectEXT(u.query,d.QUERY_RESULT_EXT)/1e6;d.deleteQueryEXT(u.query),n[s]=f}return n}translatePosMatrix(t,n,s,u,d){if(!s[0]&&!s[1])return t;const f=d?u==="map"?this.transform.angle:0:u==="viewport"?-this.transform.angle:0;if(f){const v=Math.sin(f),T=Math.cos(f);s=[s[0]*T-s[1]*v,s[0]*v+s[1]*T]}const _=[d?s[0]:Zt(n,s[0],this.transform.zoom),d?s[1]:Zt(n,s[1],this.transform.zoom),0],y=new Float32Array(16);return l.translate(y,t,_),y}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),s=this.imageManager.getPattern(t.to.toString());return!n||!s}useProgram(t,n){this.cache=this.cache||{};const s=t+(n?n.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[s]||(this.cache[s]=new ta(this.context,t,Gn[t],n,os[t],this._showOverdrawInspector,this.style.terrain)),this.cache[s]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new He(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class Bo{constructor(t,n){this.points=t,this.planes=n}static fromInvProjectionMatrix(t,n,s){const u=Math.pow(2,s),d=[[-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]].map(_=>{const y=1/(_=l.transformMat4([],_,t))[3]/n*u;return l.mul$1(_,_,[y,y,1/_[3],y])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=l.sub([],d[_[0]],d[_[1]]),v=l.sub([],d[_[2]],d[_[1]]),T=l.normalize([],l.cross([],y,v)),I=-l.dot(T,d[_[1]]);return T.concat(I)});return new Bo(d,f)}}class to{constructor(t,n){this.min=t,this.max=n,this.center=l.scale$1([],l.add([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],s=l.clone$2(this.min),u=l.clone$2(this.max);for(let d=0;d<n.length;d++)s[d]=n[d]?this.min[d]:this.center[d],u[d]=n[d]?this.center[d]:this.max[d];return u[2]=this.max[2],new to(s,u)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){const n=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]];let s=!0;for(let u=0;u<t.planes.length;u++){const d=t.planes[u];let f=0;for(let _=0;_<n.length;_++)l.dot$1(d,n[_])>=0&&f++;if(f===0)return 0;f!==n.length&&(s=!1)}if(s)return 2;for(let u=0;u<3;u++){let d=Number.MAX_VALUE,f=-Number.MAX_VALUE;for(let _=0;_<t.points.length;_++){const y=t.points[_][u]-this.min[u];d=Math.min(d,y),f=Math.max(f,y)}if(f<0||d>this.max[u]-this.min[u])return 0}return 1}}class An{constructor(t=0,n=0,s=0,u=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(s)||s<0||isNaN(u)||u<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=s,this.right=u}interpolate(t,n,s){return n.top!=null&&t.top!=null&&(this.top=l.number(t.top,n.top,s)),n.bottom!=null&&t.bottom!=null&&(this.bottom=l.number(t.bottom,n.bottom,s)),n.left!=null&&t.left!=null&&(this.left=l.number(t.left,n.left,s)),n.right!=null&&t.right!=null&&(this.right=l.number(t.right,n.right,s)),this}getCenter(t,n){const s=l.clamp((this.left+t-this.right)/2,0,t),u=l.clamp((this.top+n-this.bottom)/2,0,n);return new l.pointGeometry(s,u)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new An(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class io{constructor(t,n,s,u,d){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=d===void 0||!!d,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=s==null?0:s,this._maxPitch=u==null?60:u,this.setMaxBounds(),this.width=0,this.height=0,this._center=new l.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new An,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new io(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new l.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const n=-l.wrap(t,-180,180)*Math.PI/180;var s;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=(s=new l.ARRAY_TYPE(4),l.ARRAY_TYPE!=Float32Array&&(s[1]=0,s[2]=0),s[0]=1,s[3]=1,s),function(u,d,f){var _=d[0],y=d[1],v=d[2],T=d[3],I=Math.sin(f),M=Math.cos(f);u[0]=_*M+v*I,u[1]=y*M+T*I,u[2]=_*-I+v*M,u[3]=y*-I+T*M}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=l.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this.scale=this.zoomScale(n),this.tileZoom=Math.floor(n),this.zoomFraction=n-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,s){this._unmodified=!1,this._edgeInsets.interpolate(t,n,s),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new l.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const s=this.pointCoordinate(new l.pointGeometry(0,0)),u=this.pointCoordinate(new l.pointGeometry(this.width,0)),d=this.pointCoordinate(new l.pointGeometry(this.width,this.height)),f=this.pointCoordinate(new l.pointGeometry(0,this.height)),_=Math.floor(Math.min(s.x,u.x,d.x,f.x)),y=Math.floor(Math.max(s.x,u.x,d.x,f.x)),v=1;for(let T=_-v;T<=y+v;T++)T!==0&&n.push(new l.UnwrappedTileID(T,t))}return n}coveringTiles(t){var n,s;let u=this.coveringZoomLevel(t);const d=u;if(t.minzoom!==void 0&&u<t.minzoom)return[];t.maxzoom!==void 0&&u>t.maxzoom&&(u=t.maxzoom);const f=this.pointCoordinate(this.getCameraPoint()),_=l.MercatorCoordinate.fromLngLat(this.center),y=Math.pow(2,u),v=[y*f.x,y*f.y,0],T=[y*_.x,y*_.y,0],I=Bo.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,u);let M=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(M=u);const U=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,F=$=>({aabb:new to([$*y,0,0],[($+1)*y,y,0]),zoom:0,x:0,y:0,wrap:$,fullyVisible:!1}),O=[],H=[],Y=u,te=t.reparseOverscaled?d:u;if(this._renderWorldCopies)for(let $=1;$<=3;$++)O.push(F(-$)),O.push(F($));for(O.push(F(0));O.length>0;){const $=O.pop(),ne=$.x,ie=$.y;let ue=$.fullyVisible;if(!ue){const Re=$.aabb.intersects(I);if(Re===0)continue;ue=Re===2}const he=t.terrain?v:T,ve=$.aabb.distanceX(he),ce=$.aabb.distanceY(he),Le=Math.max(Math.abs(ve),Math.abs(ce)),Se=U+(1<<Y-$.zoom)-2;if($.zoom===Y||Le>Se&&$.zoom>=M){const Re=Y-$.zoom,Qe=v[0]-.5-(ne<<Re),it=v[1]-.5-(ie<<Re);H.push({tileID:new l.OverscaledTileID($.zoom===Y?te:$.zoom,$.wrap,$.zoom,ne,ie),distanceSq:l.sqrLen([T[0]-.5-ne,T[1]-.5-ie]),tileDistanceToCamera:Math.sqrt(Qe*Qe+it*it)})}else for(let Re=0;Re<4;Re++){const Qe=(ne<<1)+Re%2,it=(ie<<1)+(Re>>1),Ge=$.zoom+1;let wt=$.aabb.quadrant(Re);if(t.terrain){const Tt=new l.OverscaledTileID(Ge,$.wrap,Ge,Qe,it),ut=t.terrain.getMinMaxElevation(Tt),mt=(n=ut.minElevation)!==null&&n!==void 0?n:this.elevation,St=(s=ut.maxElevation)!==null&&s!==void 0?s:this.elevation;wt=new to([wt.min[0],wt.min[1],mt],[wt.max[0],wt.max[1],St])}O.push({aabb:wt,zoom:Ge,x:Qe,y:it,wrap:$.wrap,fullyVisible:ue})}}return H.sort(($,ne)=>$.distanceSq-ne.distanceSq).map($=>$.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=l.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new l.pointGeometry(l.mercatorXfromLng(t.lng)*this.worldSize,l.mercatorYfromLat(n)*this.worldSize)}unproject(t){return new l.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,n){const s=l.MercatorCoordinate.fromLngLat(t),u=(1<<this.tileZoom)*l.EXTENT,d=s.x*u,f=s.y*u,_=Math.floor(d/l.EXTENT),y=Math.floor(f/l.EXTENT),v=new l.OverscaledTileID(this.tileZoom,0,this.tileZoom,_,y);return n.getElevation(v,d%l.EXTENT,f%l.EXTENT,l.EXTENT)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(t){const n=this.pointLocation(this.centerPoint,t),s=this.getElevation(n,t);if(!(this.elevation-s))return;const u=this.getCameraPosition(),d=l.MercatorCoordinate.fromLngLat(u.lngLat,u.altitude),f=l.MercatorCoordinate.fromLngLat(n,s),_=d.x-f.x,y=d.y-f.y,v=d.z-f.z,T=Math.sqrt(_*_+y*y+v*v),I=this.scaleZoom(this.cameraToCenterDistance/T/this.tileSize);this._elevation=s,this._center=n,this.zoom=I}setLocationAtPoint(t,n){const s=this.pointCoordinate(n),u=this.pointCoordinate(this.centerPoint),d=this.locationCoordinate(t),f=new l.MercatorCoordinate(d.x-(s.x-u.x),d.y-(s.y-u.y));this.center=this.coordinateLocation(f),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,n){return n?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,n),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,n){return this.coordinateLocation(this.pointCoordinate(t,n))}locationCoordinate(t){return l.MercatorCoordinate.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,n){if(n){const M=n.pointCoordinate(t);if(M!=null)return M}const s=[t.x,t.y,0,1],u=[t.x,t.y,1,1];l.transformMat4(s,s,this.pixelMatrixInverse),l.transformMat4(u,u,this.pixelMatrixInverse);const d=s[3],f=u[3],_=s[1]/d,y=u[1]/f,v=s[2]/d,T=u[2]/f,I=v===T?0:(0-v)/(T-v);return new l.MercatorCoordinate(l.number(s[0]/d,u[0]/f,I)/this.worldSize,l.number(_,y,I)/this.worldSize)}coordinatePoint(t,n=0,s=this.pixelMatrix){const u=[t.x*this.worldSize,t.y*this.worldSize,n,1];return l.transformMat4(u,u,s),new l.pointGeometry(u[0]/u[3],u[1]/u[3])}getBounds(){const t=Math.max(0,this.height/2-this.getHorizon());return new l.LngLatBounds().extend(this.pointLocation(new l.pointGeometry(0,t))).extend(this.pointLocation(new l.pointGeometry(this.width,t))).extend(this.pointLocation(new l.pointGeometry(this.width,this.height))).extend(this.pointLocation(new l.pointGeometry(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new l.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,n=!1){const s=t.key,u=n?this._alignedPosMatrixCache:this._posMatrixCache;if(u[s])return u[s];const d=t.canonical,f=this.worldSize/this.zoomScale(d.z),_=d.x+Math.pow(2,d.z)*t.wrap,y=l.identity(new Float64Array(16));return l.translate(y,y,[_*f,d.y*f,0]),l.scale(y,y,[f/l.EXTENT,f/l.EXTENT,1]),l.multiply(y,n?this.alignedProjMatrix:this.projMatrix,y),u[s]=new Float32Array(y),u[s]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t,n,s,u,d=-90,f=90,_=-180,y=180;const v=this.size,T=this._unmodified;if(this.latRange){const U=this.latRange;d=l.mercatorYfromLat(U[1])*this.worldSize,f=l.mercatorYfromLat(U[0])*this.worldSize,t=f-d<v.y?v.y/(f-d):0}if(this.lngRange){const U=this.lngRange;_=l.wrap(l.mercatorXfromLng(U[0])*this.worldSize,0,this.worldSize),y=l.wrap(l.mercatorXfromLng(U[1])*this.worldSize,0,this.worldSize),y<_&&(y+=this.worldSize),n=y-_<v.x?v.x/(y-_):0}const I=this.point,M=Math.max(n||0,t||0);if(M)return this.center=this.unproject(new l.pointGeometry(n?(y+_)/2:I.x,t?(f+d)/2:I.y)),this.zoom+=this.scaleZoom(M),this._unmodified=T,void(this._constraining=!1);if(this.latRange){const U=I.y,F=v.y/2;U-F<d&&(u=d+F),U+F>f&&(u=f-F)}if(this.lngRange){const U=(_+y)/2,F=l.wrap(I.x,U-this.worldSize/2,U+this.worldSize/2),O=v.x/2;F-O<_&&(s=_+O),F+O>y&&(s=y-O)}s===void 0&&u===void 0||(this.center=this.unproject(new l.pointGeometry(s!==void 0?s:I.x,u!==void 0?u:I.y)).wrap()),this._unmodified=T,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.point.x,s=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=l.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let u=l.identity(new Float64Array(16));l.scale(u,u,[this.width/2,-this.height/2,1]),l.translate(u,u,[1,-1,0]),this.labelPlaneMatrix=u,u=l.identity(new Float64Array(16)),l.scale(u,u,[1,-1,1]),l.translate(u,u,[-1,-1,0]),l.scale(u,u,[2/this.width,2/this.height,1]),this.glCoordMatrix=u,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const d=Math.PI/2+this._pitch,f=this._fov*(.5+t.y/this.height),_=Math.sin(f)*this.cameraToSeaLevelDistance/Math.sin(l.clamp(Math.PI-d-f,.01,Math.PI-.01)),y=this.getHorizon(),v=2*Math.atan(y/this.cameraToCenterDistance)*(.5+t.y/(2*y)),T=Math.sin(v)*this.cameraToSeaLevelDistance/Math.sin(l.clamp(Math.PI-d-v,.01,Math.PI-.01)),I=Math.cos(Math.PI/2-this._pitch)*_+this.cameraToSeaLevelDistance,M=Math.cos(Math.PI/2-this._pitch)*T+this.cameraToSeaLevelDistance,U=1.01*Math.min(I,M),F=this.height/50;u=new Float64Array(16),l.perspective(u,this._fov,this.width/this.height,F,U),u[8]=2*-t.x/this.width,u[9]=2*t.y/this.height,l.scale(u,u,[1,-1,1]),l.translate(u,u,[0,0,-this.cameraToCenterDistance]),l.rotateX(u,u,this._pitch),l.rotateZ(u,u,this.angle),l.translate(u,u,[-n,-s,0]),this.mercatorMatrix=l.scale([],u,[this.worldSize,this.worldSize,this.worldSize]),l.scale(u,u,[1,1,this._pixelPerMeter]),this.pixelMatrix=l.multiply(new Float64Array(16),this.labelPlaneMatrix,u),l.translate(u,u,[0,0,-this.elevation]),this.projMatrix=u,this.invProjMatrix=l.invert([],u),this.pixelMatrix3D=l.multiply(new Float64Array(16),this.labelPlaneMatrix,u);const O=this.width%2/2,H=this.height%2/2,Y=Math.cos(this.angle),te=Math.sin(this.angle),$=n-Math.round(n)+Y*O+te*H,ne=s-Math.round(s)+Y*H+te*O,ie=new Float64Array(u);if(l.translate(ie,ie,[$>.5?$-1:$,ne>.5?ne-1:ne,0]),this.alignedProjMatrix=ie,u=l.invert(new Float64Array(16),this.pixelMatrix),!u)throw new Error("failed to invert matrix");this.pixelMatrixInverse=u,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new l.pointGeometry(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return l.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new l.pointGeometry(0,t))}getCameraQueryGeometry(t){const n=this.getCameraPoint();if(t.length===1)return[t[0],n];{let s=n.x,u=n.y,d=n.x,f=n.y;for(const _ of t)s=Math.min(s,_.x),u=Math.min(u,_.y),d=Math.max(d,_.x),f=Math.max(f,_.y);return[new l.pointGeometry(s,u),new l.pointGeometry(d,u),new l.pointGeometry(d,f),new l.pointGeometry(s,f),new l.pointGeometry(s,u)]}}}class Ta{constructor(t){this._hashName=t&&encodeURIComponent(t),l.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(n,s){let u=!1,d=null;const f=()=>{d=null,u&&(n(),d=setTimeout(f,300),u=!1)};return()=>(u=!0,d||f(),d)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const n=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,u=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),d=Math.pow(10,u),f=Math.round(n.lng*d)/d,_=Math.round(n.lat*d)/d,y=this._map.getBearing(),v=this._map.getPitch();let T="";if(T+=t?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(y||v)&&(T+="/"+Math.round(10*y)/10),v&&(T+=`/${Math.round(v)}`),this._hashName){const I=this._hashName;let M=!1;const U=window.location.hash.slice(1).split("&").map(F=>{const O=F.split("=")[0];return O===I?(M=!0,`${O}=${T}`):F}).filter(F=>F);return M||U.push(`${I}=${T}`),`#${U.join("&")}`}return`#${T}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(s=>s.split("=")).forEach(s=>{s[0]===this._hashName&&(n=s)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(n=>isNaN(n))){const n=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:n,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const ro={linearity:.3,easing:l.bezier(0,0,.3,1)},Ea=l.extend({deceleration:2500,maxSpeed:1400},ro),Sa=l.extend({deceleration:20,maxSpeed:1400},ro),Ia=l.extend({deceleration:1e3,maxSpeed:360},ro),Mn=l.extend({deceleration:1e3,maxSpeed:90},ro);class Ca{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=l.exported.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,pan:new l.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:d}of this._inertiaBuffer)n.zoom+=d.zoomDelta||0,n.bearing+=d.bearingDelta||0,n.pitch+=d.pitchDelta||0,d.panDelta&&n.pan._add(d.panDelta),d.around&&(n.around=d.around),d.pinchAround&&(n.pinchAround=d.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,u={};if(n.pan.mag()){const d=oo(n.pan.mag(),s,l.extend({},Ea,t||{}));u.offset=n.pan.mult(d.amount/n.pan.mag()),u.center=this._map.transform.center,no(u,d)}if(n.zoom){const d=oo(n.zoom,s,Sa);u.zoom=this._map.transform.zoom+d.amount,no(u,d)}if(n.bearing){const d=oo(n.bearing,s,Ia);u.bearing=this._map.transform.bearing+l.clamp(d.amount,-179,179),no(u,d)}if(n.pitch){const d=oo(n.pitch,s,Mn);u.pitch=this._map.transform.pitch+d.amount,no(u,d)}if(u.zoom||u.bearing){const d=n.pinchAround===void 0?n.around:n.pinchAround;u.around=d?this._map.unproject(d):this._map.getCenter()}return this.clear(),l.extend(u,{noMoveStart:!0})}}function no(a,t){(!a.duration||a.duration<t.duration)&&(a.duration=t.duration,a.easing=t.easing)}function oo(a,t,n){const{maxSpeed:s,linearity:u,deceleration:d}=n,f=l.clamp(a*u/(t/1e3),-s,s),_=Math.abs(f)/(d*u);return{easing:n.easing,duration:1e3*_,amount:f*(_/2)}}class zi extends l.Event{constructor(t,n,s,u={}){const d=se.mousePos(n.getCanvasContainer(),s),f=n.unproject(d);super(t,l.extend({point:d,lngLat:f,originalEvent:s},u)),this._defaultPrevented=!1,this.target=n}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class so extends l.Event{constructor(t,n,s){const u=t==="touchend"?s.changedTouches:s.touches,d=se.touchPos(n.getCanvasContainer(),u),f=d.map(y=>n.unproject(y)),_=d.reduce((y,v,T,I)=>y.add(v.div(I.length)),new l.pointGeometry(0,0));super(t,{points:d,point:_,lngLats:f,lngLat:n.unproject(_),originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Pi extends l.Event{constructor(t,n,s){super(t,{originalEvent:s}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class Cl{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Pi(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new zi(t.type,this._map,t))}mouseup(t){this._map.fire(new zi(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new zi(t.type,this._map,t))}dblclick(t){return this._firePreventable(new zi(t.type,this._map,t))}mouseover(t){this._map.fire(new zi(t.type,this._map,t))}mouseout(t){this._map.fire(new zi(t.type,this._map,t))}touchstart(t){return this._firePreventable(new so(t.type,this._map,t))}touchmove(t){this._map.fire(new so(t.type,this._map,t))}touchend(t){this._map.fire(new so(t.type,this._map,t))}touchcancel(t){this._map.fire(new so(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Dr{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new zi(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new zi(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Aa{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(se.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const s=n;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const u=this._startPos;this._lastPos=s,this._box||(this._box=se.create("div","maplibregl-boxzoom mapboxgl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair","mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const d=Math.min(u.x,s.x),f=Math.max(u.x,s.x),_=Math.min(u.y,s.y),y=Math.max(u.y,s.y);se.setTransform(this._box,`translate(${d}px,${_}px)`),this._box.style.width=f-d+"px",this._box.style.height=y-_+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const s=this._startPos,u=n;if(this.reset(),se.suppressClick(),s.x!==u.x||s.y!==u.y)return this._map.fire(new l.Event("boxzoomend",{originalEvent:t})),{cameraAnimation:d=>d.fitScreenCoordinates(s,u,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(se.remove(this._box),this._box=null),se.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new l.Event(t,{originalEvent:n}))}}function gr(a,t){if(a.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${a.length}, points ${t.length}`);const n={};for(let s=0;s<a.length;s++)n[a[s].identifier]=t[s];return n}class ao{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),s.length===this.numTouches&&(this.centroid=function(u){const d=new l.pointGeometry(0,0);for(const f of u)d._add(f);return d.div(u.length)}(n),this.touches=gr(s,n)))}touchmove(t,n,s){if(this.aborted||!this.centroid)return;const u=gr(s,n);for(const d in this.touches){const f=this.touches[d],_=u[d];(!_||_.dist(f)>30)&&(this.aborted=!0)}}touchend(t,n,s){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const u=!this.aborted&&this.centroid;if(this.reset(),u)return u}}}class vs{constructor(t){this.singleTap=new ao(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,s){this.singleTap.touchstart(t,n,s)}touchmove(t,n,s){this.singleTap.touchmove(t,n,s)}touchend(t,n,s){const u=this.singleTap.touchend(t,n,s);if(u){const d=t.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(u)<30;if(d&&f||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=u,this.count===this.numTaps)return this.reset(),u}}}class Al{constructor(){this._zoomIn=new vs({numTouches:1,numTaps:2}),this._zoomOut=new vs({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,s){this._zoomIn.touchstart(t,n,s),this._zoomOut.touchstart(t,n,s)}touchmove(t,n,s){this._zoomIn.touchmove(t,n,s),this._zoomOut.touchmove(t,n,s)}touchend(t,n,s){const u=this._zoomIn.touchend(t,n,s),d=this._zoomOut.touchend(t,n,s);return u?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()+1,around:f.unproject(u)},{originalEvent:t})}):d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:f=>f.easeTo({duration:300,zoom:f.getZoom()-1,around:f.unproject(d)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Ml={0:1,2:2};class Fo{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const s=se.mouseButton(t);this._correctButton(t,s)&&(this._lastPoint=n,this._eventButton=s)}mousemoveWindow(t,n){const s=this._lastPoint;if(s){if(t.preventDefault(),function(u,d){const f=Ml[d];return u.buttons===void 0||(u.buttons&f)!==f}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(s)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(s,n)}}mouseupWindow(t){this._lastPoint&&se.mouseButton(t)===this._eventButton&&(this._moved&&se.suppressClick(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lo extends Fo{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class _r extends Fo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=.8*(n.x-t.x);if(s)return this._active=!0,{bearingDelta:s}}contextmenu(t){t.preventDefault()}}class Fe extends Fo{_correctButton(t,n){return n===0&&t.ctrlKey||n===2}_move(t,n){const s=-.5*(n.y-t.y);if(s)return this._active=!0,{pitchDelta:s}}contextmenu(t){t.preventDefault()}}class Ma{constructor(t,n){this._minTouches=t.cooperativeGestures?2:1,this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new l.pointGeometry(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(t,n,s){return this._calculateTransform(t,n,s)}touchmove(t,n,s){if(this._map._cooperativeGestures&&(this._minTouches===2&&s.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,s.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(s.length<this._minTouches))return t.preventDefault(),this._calculateTransform(t,n,s)}touchend(t,n,s){this._calculateTransform(t,n,s),this._active&&s.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,s){s.length>0&&(this._active=!0);const u=gr(s,n),d=new l.pointGeometry(0,0),f=new l.pointGeometry(0,0);let _=0;for(const v in u){const T=u[v],I=this._touches[v];I&&(d._add(T),f._add(T.sub(I)),_++,u[v]=T)}if(this._touches=u,_<this._minTouches||!f.mag())return;const y=f.div(_);return this._sum._add(y),this._sum.mag()<this._clickTolerance?void 0:{around:d.div(_),panDelta:y}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Jr{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}_start(t){}_move(t,n,s){return{}}touchstart(t,n,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,s){if(!this._firstTwoTouches)return;t.preventDefault();const[u,d]=this._firstTwoTouches,f=Lr(s,n,u),_=Lr(s,n,d);if(!f||!_)return;const y=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],y,t)}touchend(t,n,s){if(!this._firstTwoTouches)return;const[u,d]=this._firstTwoTouches,f=Lr(s,n,u),_=Lr(s,n,d);f&&_||(this._active&&se.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Lr(a,t,n){for(let s=0;s<a.length;s++)if(a[s].identifier===n)return t[s]}function bs(a,t){return Math.log(a/t)/Math.LN2}class ze extends Jr{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const s=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(bs(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:bs(this._distance,s),pinchAround:n}}}function Oo(a,t){return 180*a.angleWith(t)/Math.PI}class zl extends Jr{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const s=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Oo(this._vector,s),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,s=Oo(t,this._startVector);return Math.abs(s)<n}}function ws(a){return Math.abs(a.y)>Math.abs(a.x)}class Ts extends Jr{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,s){super.touchstart(t,n,s),this._currentTouchCount=s.length}_start(t){this._lastPoints=t,ws(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,s){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const u=t[0].sub(this._lastPoints[0]),d=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(u,d,s.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(u.y+d.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,s){if(this._valid!==void 0)return this._valid;const u=t.mag()>=2,d=n.mag()>=2;if(!u&&!d)return;if(!u||!d)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=t.y>0==n.y>0;return ws(t)&&ws(n)&&f}}const za={panStep:100,bearingStep:15,pitchStep:10};class Pa{constructor(){const t=za;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,s=0,u=0,d=0,f=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?s=-1:(t.preventDefault(),d=-1);break;case 39:t.shiftKey?s=1:(t.preventDefault(),d=1);break;case 38:t.shiftKey?u=1:(t.preventDefault(),f=-1);break;case 40:t.shiftKey?u=-1:(t.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,u=0),{cameraAnimation:_=>{const y=_.getZoom();_.easeTo({duration:300,easeId:"keyboardHandler",easing:Pl,zoom:n?Math.round(y)+n*(t.shiftKey?2:1):y,bearing:_.getBearing()+s*this._bearingStep,pitch:_.getPitch()+u*this._pitchStep,offset:[-d*this._panStep,-f*this._panStep],center:_.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Pl(a){return a*(2-a)}const ka=4.000244140625;class Es{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,l.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const s=l.exported.now(),u=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,n!==0&&n%ka==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":u>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(u*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=se.mousePos(this._el,t);this._around=l.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>ka?this._wheelZoomRate:this._defaultZoomRate;let y=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&y!==0&&(y=1/y);const v=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(v*y))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,s=this._startZoom,u=this._easing;let d,f=!1;if(this._type==="wheel"&&s&&u){const _=Math.min((l.exported.now()-this._lastWheelEventTime)/200,1),y=u(_);d=l.number(s,n,y),_<1?this._frameId||(this._frameId=!0):f=!0}else d=n,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!f,zoomDelta:d-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=l.ease;if(this._prevEase){const s=this._prevEase,u=(l.exported.now()-s.start)/s.duration,d=s.easing(u+.01)-s.easing(u),f=.27/Math.sqrt(d*d+1e-4)*.01,_=Math.sqrt(.0729-f*f);n=l.bezier(f,_,.25,1)}return this._prevEase={start:l.exported.now(),duration:t,easing:n},n}reset(){this._active=!1}}class Ss{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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()}}class Is{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:s.getZoom()+(t.shiftKey?-1:1),around:s.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Cs{constructor(){this._tap=new vs({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,n,s){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?s.length>0&&(this._swipePoint=n[0],this._swipeTouch=s[0].identifier):this._tap.touchstart(t,n,s))}touchmove(t,n,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const u=n[0],d=u.y-this._swipePoint.y;return this._swipePoint=u,t.preventDefault(),this._active=!0,{zoomDelta:d/128}}}else this._tap.touchmove(t,n,s)}touchend(t,n,s){this._tapTime?this._swipePoint&&s.length===0&&this.reset():this._tap.touchend(t,n,s)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xi{constructor(t,n,s){this._el=t,this._mousePan=n,this._touchPan=s}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Rr{constructor(t,n,s){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=s}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Da{constructor(t,n,s,u){this._el=t,this._touchZoom=n,this._touchRotate=s,this._tapDragZoom=u,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-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()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const zn=a=>a.zoom||a.drag||a.pitch||a.rotate;class As extends l.Event{}function co(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}class La{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ca(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),l.bindAll(["handleEvent","handleWindowEvent"],this);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[u,d,f]of this._listeners)se.addEventListener(u,d,u===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[t,n,s]of this._listeners)se.removeEventListener(t,n,t===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(t){const n=this._map,s=n.getCanvasContainer();this._add("mapEvent",new Cl(n,t));const u=n.boxZoom=new Aa(n,t);this._add("boxZoom",u);const d=new Al,f=new Is;n.doubleClickZoom=new Ss(f,d),this._add("tapZoom",d),this._add("clickZoom",f);const _=new Cs;this._add("tapDragZoom",_);const y=n.touchPitch=new Ts(n);this._add("touchPitch",y);const v=new _r(t),T=new Fe(t);n.dragRotate=new Rr(t,v,T),this._add("mouseRotate",v,["mousePitch"]),this._add("mousePitch",T,["mouseRotate"]);const I=new lo(t),M=new Ma(t,n);n.dragPan=new xi(s,I,M),this._add("mousePan",I),this._add("touchPan",M,["touchZoom","touchRotate"]);const U=new zl,F=new ze;n.touchZoomRotate=new Da(s,F,U,_),this._add("touchRotate",U,["touchPan","touchZoom"]),this._add("touchZoom",F,["touchPan","touchRotate"]);const O=n.scrollZoom=new Es(n,this);this._add("scrollZoom",O,["mousePan"]);const H=n.keyboard=new Pa;this._add("keyboard",H),this._add("blockableMapEvent",new Dr(n));for(const Y of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[Y]&&n[Y].enable(t[Y])}_add(t,n,s){this._handlers.push({handlerName:t,handler:n,allowed:s}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(zn(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,n,s){for(const u in t)if(u!==s&&(!n||n.indexOf(u)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const s of t)this._el.contains(s.target)&&n.push(s);return n}handleEvent(t,n){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const s=t.type==="renderFrame"?void 0:t,u={needsRenderFrame:!1},d={},f={},_=t.touches,y=_?this._getMapTouches(_):void 0,v=y?se.touchPos(this._el,y):se.mousePos(this._el,t);for(const{handlerName:M,handler:U,allowed:F}of this._handlers){if(!U.isEnabled())continue;let O;this._blockedByActive(f,F,M)?U.reset():U[n||t.type]&&(O=U[n||t.type](t,v,y),this.mergeHandlerResult(u,d,O,M,s),O&&O.needsRenderFrame&&this._triggerRenderFrame()),(O||U.isActive())&&(f[M]=U)}const T={};for(const M in this._previousActiveHandlers)f[M]||(T[M]=s);this._previousActiveHandlers=f,(Object.keys(T).length||co(u))&&(this._changes.push([u,d,T]),this._triggerRenderFrame()),(Object.keys(f).length||co(u))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:I}=u;I&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],I(this._map))}mergeHandlerResult(t,n,s,u,d){if(!s)return;l.extend(t,s);const f={handlerName:u,originalEvent:s.originalEvent||d};s.zoomDelta!==void 0&&(n.zoom=f),s.panDelta!==void 0&&(n.drag=f),s.pitchDelta!==void 0&&(n.pitch=f),s.bearingDelta!==void 0&&(n.rotate=f)}_applyChanges(){const t={},n={},s={};for(const[u,d,f]of this._changes)u.panDelta&&(t.panDelta=(t.panDelta||new l.pointGeometry(0,0))._add(u.panDelta)),u.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+u.zoomDelta),u.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+u.bearingDelta),u.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+u.pitchDelta),u.around!==void 0&&(t.around=u.around),u.pinchAround!==void 0&&(t.pinchAround=u.pinchAround),u.noInertia&&(t.noInertia=u.noInertia),l.extend(n,d),l.extend(s,f);this._updateMapTransform(t,n,s),this._changes=[]}_updateMapTransform(t,n,s){const u=this._map,d=u.transform,f=u.style&&u.style.terrain;if(!(co(t)||f&&this._drag))return this._fireEvents(n,s,!0);let{panDelta:_,zoomDelta:y,bearingDelta:v,pitchDelta:T,around:I,pinchAround:M}=t;M!==void 0&&(I=M),u._stop(!0),I=I||u.transform.centerPoint;const U=d.pointLocation(_?I.sub(_):I);v&&(d.bearing+=v),T&&(d.pitch+=T),y&&(d.zoom+=y),f?n.drag&&!this._drag?(this._drag={center:d.centerPoint,lngLat:d.pointLocation(I),point:I,handlerName:n.drag.handlerName},u.fire(new l.Event("freezeElevation",{freeze:!0}))):this._drag&&s[this._drag.handlerName]?(u.fire(new l.Event("freezeElevation",{freeze:!1})),this._drag=null):n.drag&&this._drag&&(d.center=d.pointLocation(d.centerPoint.sub(_))):d.setLocationAtPoint(U,I),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,s,!0)}_fireEvents(t,n,s){const u=zn(this._eventsInProgress),d=zn(t),f={};for(const T in t){const{originalEvent:I}=t[T];this._eventsInProgress[T]||(f[`${T}start`]=I),this._eventsInProgress[T]=t[T]}!u&&d&&this._fireEvent("movestart",d.originalEvent);for(const T in f)this._fireEvent(T,f[T]);d&&this._fireEvent("move",d.originalEvent);for(const T in t){const{originalEvent:I}=t[T];this._fireEvent(T,I)}const _={};let y;for(const T in this._eventsInProgress){const{handlerName:I,originalEvent:M}=this._eventsInProgress[T];this._handlersById[I].isActive()||(delete this._eventsInProgress[T],y=n[I]||M,_[`${T}end`]=y)}for(const T in _)this._fireEvent(T,_[T]);const v=zn(this._eventsInProgress);if(s&&(u||d)&&!v){this._updatingCamera=!0;const T=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),I=M=>M!==0&&-this._bearingSnap<M&&M<this._bearingSnap;T?(I(T.bearing||this._map.getBearing())&&(T.bearing=0),this._map.easeTo(T,{originalEvent:y})):(this._map.fire(new l.Event("moveend",{originalEvent:y})),I(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new l.Event(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new As("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Ui={extend:(a,...t)=>l.extend(a,...t),run(a){a()},logToElement(a,t=!1,n="log"){const s=window.document.getElementById(n);s&&(t&&(s.innerHTML=""),s.innerHTML+=`<br>${a}`)}};class Ft extends l.Evented{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,l.bindAll(["_renderFrameCallback"],this)}getCenter(){return new l.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,s){return t=l.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,l.extend({offset:t},n),s)}panTo(t,n,s){return this.easeTo(l.extend({center:t},n),s)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,s){return this.easeTo(l.extend({zoom:t},n),s)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,s){return this.easeTo(l.extend({bearing:t},n),s)}resetNorth(t,n){return this.rotateTo(0,l.extend({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(l.extend({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=l.LngLatBounds.convert(t);const s=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),s,n)}_cameraForBoxAndBearing(t,n,s,u){const d={top:0,bottom:0,right:0,left:0};if(typeof(u=l.extend({padding:d,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const ie=u.padding;u.padding={top:ie,bottom:ie,right:ie,left:ie}}u.padding=l.extend(d,u.padding);const f=this.transform,_=f.padding,y=f.project(l.LngLat.convert(t)),v=f.project(l.LngLat.convert(n)),T=y.rotate(-s*Math.PI/180),I=v.rotate(-s*Math.PI/180),M=new l.pointGeometry(Math.max(T.x,I.x),Math.max(T.y,I.y)),U=new l.pointGeometry(Math.min(T.x,I.x),Math.min(T.y,I.y)),F=M.sub(U),O=(f.width-(_.left+_.right+u.padding.left+u.padding.right))/F.x,H=(f.height-(_.top+_.bottom+u.padding.top+u.padding.bottom))/F.y;if(H<0||O<0)return void l.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Y=Math.min(f.scaleZoom(f.scale*Math.min(O,H)),u.maxZoom),te=l.pointGeometry.convert(u.offset),$=new l.pointGeometry((u.padding.left-u.padding.right)/2,(u.padding.top-u.padding.bottom)/2).rotate(s*Math.PI/180),ne=te.add($).mult(f.scale/f.zoomScale(Y));return{center:f.unproject(y.add(v).div(2).sub(ne)),zoom:Y,bearing:s}}fitBounds(t,n,s){return this._fitInternal(this.cameraForBounds(t,n),n,s)}fitScreenCoordinates(t,n,s,u,d){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(l.pointGeometry.convert(t)),this.transform.pointLocation(l.pointGeometry.convert(n)),s,u),u,d)}_fitInternal(t,n,s){return t?(delete(n=l.extend(t,n)).padding,n.linear?this.easeTo(n,s):this.flyTo(n,s)):this}jumpTo(t,n){this.stop();const s=this.transform;let u=!1,d=!1,f=!1;return"zoom"in t&&s.zoom!==+t.zoom&&(u=!0,s.zoom=+t.zoom),t.center!==void 0&&(s.center=l.LngLat.convert(t.center)),"bearing"in t&&s.bearing!==+t.bearing&&(d=!0,s.bearing=+t.bearing),"pitch"in t&&s.pitch!==+t.pitch&&(f=!0,s.pitch=+t.pitch),t.padding==null||s.isPaddingEqual(t.padding)||(s.padding=t.padding),this.fire(new l.Event("movestart",n)).fire(new l.Event("move",n)),u&&this.fire(new l.Event("zoomstart",n)).fire(new l.Event("zoom",n)).fire(new l.Event("zoomend",n)),d&&this.fire(new l.Event("rotatestart",n)).fire(new l.Event("rotate",n)).fire(new l.Event("rotateend",n)),f&&this.fire(new l.Event("pitchstart",n)).fire(new l.Event("pitch",n)).fire(new l.Event("pitchend",n)),this.fire(new l.Event("moveend",n))}calculateCameraOptionsFromTo(t,n,s,u=0){const d=l.MercatorCoordinate.fromLngLat(t,n),f=l.MercatorCoordinate.fromLngLat(s,u),_=f.x-d.x,y=f.y-d.y,v=f.z-d.z,T=Math.hypot(_,y,v);if(T===0)throw new Error("Can't calculate camera options with same From and To");const I=Math.hypot(_,y),M=this.transform.scaleZoom(this.transform.cameraToCenterDistance/T/this.transform.tileSize),U=180*Math.atan2(_,-y)/Math.PI;let F=180*Math.acos(I/T)/Math.PI;return F=v<0?90-F:90+F,{center:f.toLngLat(),zoom:M,pitch:F,bearing:U}}easeTo(t,n){this._stop(!1,t.easeId),((t=l.extend({offset:[0,0],duration:500,easing:l.ease},t)).animate===!1||!t.essential&&l.exported.prefersReducedMotion)&&(t.duration=0);const s=this.transform,u=this.getZoom(),d=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?+t.zoom:u,v="bearing"in t?this._normalizeBearing(t.bearing,d):d,T="pitch"in t?+t.pitch:f,I="padding"in t?t.padding:s.padding,M=l.pointGeometry.convert(t.offset);let U=s.centerPoint.add(M);const F=s.pointLocation(U),O=l.LngLat.convert(t.center||F);this._normalizeCenter(O);const H=s.project(F),Y=s.project(O).sub(H),te=s.zoomScale(y-u);let $,ne;t.around&&($=l.LngLat.convert(t.around),ne=s.locationPoint($));const ie={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||y!==u,this._rotating=this._rotating||d!==v,this._pitching=this._pitching||T!==f,this._padding=!s.isPaddingEqual(I),this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,ie),this._ease(ue=>{if(this._zooming&&(s.zoom=l.number(u,y,ue)),this._rotating&&(s.bearing=l.number(d,v,ue)),this._pitching&&(s.pitch=l.number(f,T,ue)),this._padding&&(s.interpolatePadding(_,I,ue),U=s.centerPoint.add(M)),$)s.setLocationAtPoint($,ne);else{const he=s.zoomScale(s.zoom-u),ve=y>u?Math.min(2,te):Math.max(.5,te),ce=Math.pow(ve,1-ue),Le=s.unproject(H.add(Y.mult(ue*ce)).mult(he));s.setLocationAtPoint(s.renderWorldCopies?Le.wrap():Le,U)}this._fireMoveEvents(n)},ue=>{this._afterEase(n,ue)},t),this}_prepareEase(t,n,s={}){this._moving=!0,this.fire(new l.Event("freezeElevation",{freeze:!0})),n||s.moving||this.fire(new l.Event("movestart",t)),this._zooming&&!s.zooming&&this.fire(new l.Event("zoomstart",t)),this._rotating&&!s.rotating&&this.fire(new l.Event("rotatestart",t)),this._pitching&&!s.pitching&&this.fire(new l.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new l.Event("move",t)),this._zooming&&this.fire(new l.Event("zoom",t)),this._rotating&&this.fire(new l.Event("rotate",t)),this._pitching&&this.fire(new l.Event("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId,this.fire(new l.Event("freezeElevation",{freeze:!1}));const s=this._zooming,u=this._rotating,d=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,s&&this.fire(new l.Event("zoomend",t)),u&&this.fire(new l.Event("rotateend",t)),d&&this.fire(new l.Event("pitchend",t)),this.fire(new l.Event("moveend",t))}flyTo(t,n){if(!t.essential&&l.exported.prefersReducedMotion){const Ge=l.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ge,n)}this.stop(),t=l.extend({offset:[0,0],speed:1.2,curve:1.42,easing:l.ease},t);const s=this.transform,u=this.getZoom(),d=this.getBearing(),f=this.getPitch(),_=this.getPadding(),y="zoom"in t?l.clamp(+t.zoom,s.minZoom,s.maxZoom):u,v="bearing"in t?this._normalizeBearing(t.bearing,d):d,T="pitch"in t?+t.pitch:f,I="padding"in t?t.padding:s.padding,M=s.zoomScale(y-u),U=l.pointGeometry.convert(t.offset);let F=s.centerPoint.add(U);const O=s.pointLocation(F),H=l.LngLat.convert(t.center||O);this._normalizeCenter(H);const Y=s.project(O),te=s.project(H).sub(Y);let $=t.curve;const ne=Math.max(s.width,s.height),ie=ne/M,ue=te.mag();if("minZoom"in t){const Ge=l.clamp(Math.min(t.minZoom,u,y),s.minZoom,s.maxZoom),wt=ne/s.zoomScale(Ge-u);$=Math.sqrt(wt/ue*2)}const he=$*$;function ve(Ge){const wt=(ie*ie-ne*ne+(Ge?-1:1)*he*he*ue*ue)/(2*(Ge?ie:ne)*he*ue);return Math.log(Math.sqrt(wt*wt+1)-wt)}function ce(Ge){return(Math.exp(Ge)-Math.exp(-Ge))/2}function Le(Ge){return(Math.exp(Ge)+Math.exp(-Ge))/2}const Se=ve(0);let Re=function(Ge){return Le(Se)/Le(Se+$*Ge)},Qe=function(Ge){return ne*((Le(Se)*(ce(wt=Se+$*Ge)/Le(wt))-ce(Se))/he)/ue;var wt},it=(ve(1)-Se)/$;if(Math.abs(ue)<1e-6||!isFinite(it)){if(Math.abs(ne-ie)<1e-6)return this.easeTo(t,n);const Ge=ie<ne?-1:1;it=Math.abs(Math.log(ie/ne))/$,Qe=function(){return 0},Re=function(wt){return Math.exp(Ge*$*wt)}}return t.duration="duration"in t?+t.duration:1e3*it/("screenSpeed"in t?+t.screenSpeed/$:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=d!==v,this._pitching=T!==f,this._padding=!s.isPaddingEqual(I),this._prepareEase(n,!1),this._ease(Ge=>{const wt=Ge*it,Tt=1/Re(wt);s.zoom=Ge===1?y:u+s.scaleZoom(Tt),this._rotating&&(s.bearing=l.number(d,v,Ge)),this._pitching&&(s.pitch=l.number(f,T,Ge)),this._padding&&(s.interpolatePadding(_,I,Ge),F=s.centerPoint.add(U));const ut=Ge===1?H:s.unproject(Y.add(te.mult(Qe(wt))).mult(Tt));s.setLocationAtPoint(s.renderWorldCopies?ut.wrap():ut,F),this._fireMoveEvents(n)},()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const s=this._onEaseEnd;delete this._onEaseEnd,s.call(this,n)}if(!t){const s=this.handlers;s&&s.stop(!1)}return this}_ease(t,n,s){s.animate===!1||s.duration===0?(t(1),n()):(this._easeStart=l.exported.now(),this._easeOptions=s,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((l.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=l.wrap(t,-180,180);const s=Math.abs(t-n);return Math.abs(t-360-n)<s&&(t-=360),Math.abs(t+360-n)<s&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(!n.renderWorldCopies||n.lngRange)return;const s=t.lng-n.center.lng;t.lng+=s>180?-360:s<-180?360:0}}class uo{constructor(t={}){this.options=t,l.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=se.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=se.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=se.create("div","maplibregl-ctrl-attrib-inner mapboxgl-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(){se.remove(this._container),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(t,n){const s=this._map._getUIString(`AttributionControl.${n}`);t.title=s,t.setAttribute("aria-label",s)}_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","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(u=>typeof u!="string"?"":u)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const u=this._map.style.stylesheet;this.styleOwner=u.owner,this.styleId=u.id}const n=this._map.style.sourceCaches;for(const u in n){const d=n[u];if(d.used||d.usedForTerrain){const f=d.getSource();f.attribution&&t.indexOf(f.attribution)<0&&t.push(f.attribution)}}t=t.filter(u=>String(u).trim()),t.sort((u,d)=>u.length-d.length),t=t.filter((u,d)=>{for(let f=d+1;f<t.length;f++)if(t[f].indexOf(u)>=0)return!1;return!0});const s=t.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,t.length?(this._innerContainer.innerHTML=s,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?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","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class Uo{constructor(t={}){this.options=t,l.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=se.create("div","maplibregl-ctrl mapboxgl-ctrl");const n=se.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){se.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&n.classList.add("maplibregl-compact","mapboxgl-compact"):n.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class Ra{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,s=n?this._queue.concat(n):this._queue;for(const u of s)if(u.id===t)return void(u.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const s of n)if(!s.cancelled&&(s.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Ba={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},Fa={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},kl={showCompass:!0,showZoom:!0,visualizePitch:!1};class tr{constructor(t,n,s=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new _r({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,s&&(this.mousePitch=new Fe({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),l.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),se.addEventListener(n,"mousedown",this.mousedown),se.addEventListener(n,"touchstart",this.touchstart,{passive:!1}),se.addEventListener(n,"touchmove",this.touchmove),se.addEventListener(n,"touchend",this.touchend),se.addEventListener(n,"touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),se.disableDrag()}move(t,n){const s=this.map,u=this.mouseRotate.mousemoveWindow(t,n);if(u&&u.bearingDelta&&s.setBearing(s.getBearing()+u.bearingDelta),this.mousePitch){const d=this.mousePitch.mousemoveWindow(t,n);d&&d.pitchDelta&&s.setPitch(s.getPitch()+d.pitchDelta)}}off(){const t=this.element;se.removeEventListener(t,"mousedown",this.mousedown),se.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),se.removeEventListener(t,"touchmove",this.touchmove),se.removeEventListener(t,"touchend",this.touchend),se.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){se.enableDrag(),se.removeEventListener(window,"mousemove",this.mousemove),se.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(l.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),se.mousePos(this.element,t)),se.addEventListener(window,"mousemove",this.mousemove),se.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,se.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=se.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=se.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function ho(a,t,n){if(a=new l.LngLat(a.lng,a.lat),t){const s=new l.LngLat(a.lng-360,a.lat),u=new l.LngLat(a.lng+360,a.lat),d=n.locationPoint(a).distSqr(t);n.locationPoint(s).distSqr(t)<d?a=s:n.locationPoint(u).distSqr(t)<d&&(a=u)}for(;Math.abs(a.lng-n.center.lng)>180;){const s=n.locationPoint(a);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;a.lng>n.center.lng?a.lng-=360:a.lng+=360}return a}const Ve={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 je(a,t,n){const s=a.classList;for(const u in Ve)s.remove(`maplibregl-${n}-anchor-${u}`,`mapboxgl-${n}-anchor-${u}`);s.add(`maplibregl-${n}-anchor-${t}`,`mapboxgl-${n}-anchor-${t}`)}class Pn extends l.Evented{constructor(t,n){if(super(),(t instanceof HTMLElement||n)&&(t=l.extend({element:t},n)),l.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=l.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=se.create("div"),this._element.setAttribute("aria-label","Map marker");const s=se.createNS("http://www.w3.org/2000/svg","svg"),u=41,d=27;s.setAttributeNS(null,"display","block"),s.setAttributeNS(null,"height",`${u}px`),s.setAttributeNS(null,"width",`${d}px`),s.setAttributeNS(null,"viewBox",`0 0 ${d} ${u}`);const f=se.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"stroke","none"),f.setAttributeNS(null,"stroke-width","1"),f.setAttributeNS(null,"fill","none"),f.setAttributeNS(null,"fill-rule","evenodd");const _=se.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"fill-rule","nonzero");const y=se.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(3.0, 29.0)"),y.setAttributeNS(null,"fill","#000000");const v=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const te of v){const $=se.createNS("http://www.w3.org/2000/svg","ellipse");$.setAttributeNS(null,"opacity","0.04"),$.setAttributeNS(null,"cx","10.5"),$.setAttributeNS(null,"cy","5.80029008"),$.setAttributeNS(null,"rx",te.rx),$.setAttributeNS(null,"ry",te.ry),y.appendChild($)}const T=se.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const I=se.createNS("http://www.w3.org/2000/svg","path");I.setAttributeNS(null,"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"),T.appendChild(I);const M=se.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"opacity","0.25"),M.setAttributeNS(null,"fill","#000000");const U=se.createNS("http://www.w3.org/2000/svg","path");U.setAttributeNS(null,"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"),M.appendChild(U);const F=se.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=se.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=se.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const Y=se.createNS("http://www.w3.org/2000/svg","circle");Y.setAttributeNS(null,"fill","#FFFFFF"),Y.setAttributeNS(null,"cx","5.5"),Y.setAttributeNS(null,"cy","5.5"),Y.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(Y),_.appendChild(y),_.appendChild(T),_.appendChild(M),_.appendChild(F),_.appendChild(O),s.appendChild(_),s.setAttributeNS(null,"height",u*this._scale+"px"),s.setAttributeNS(null,"width",d*this._scale+"px"),this._element.appendChild(s),this._offset=l.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",s=>{s.preventDefault()}),this._element.addEventListener("mousedown",s=>{s.preventDefault()}),je(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",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),se.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=l.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const u=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[u,-1*(38.1-13.5+u)],"bottom-right":[-u,-1*(38.1-13.5+u)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const n=t.code,s=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&s!==32&&s!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,s=this._element;this._popup&&(n===s||s.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=ho(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let s="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?s="rotateX(0deg)":this._pitchAlignment==="map"&&(s=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),se.setTransform(this._element,`${Ve[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${s} ${n}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const u=this._map.unproject(this._pos),d=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=u.distanceTo(this._lngLat)>20*d?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=l.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const n=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=n}this._isDragging&&(this._pos=t.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 l.Event("dragstart"))),this.fire(new l.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new l.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.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))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(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}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Ms={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Br,si=0,Fr=!1;const ir={maxWidth:100,unit:"metric"};function Oa(a,t,n){const s=n&&n.maxWidth||100,u=a._container.clientHeight/2,d=a.unproject([0,u]),f=a.unproject([s,u]),_=d.distanceTo(f);if(n&&n.unit==="imperial"){const y=3.2808*_;y>5280?Or(t,s,y/5280,a._getUIString("ScaleControl.Miles")):Or(t,s,y,a._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Or(t,s,_/1852,a._getUIString("ScaleControl.NauticalMiles")):_>=1e3?Or(t,s,_/1e3,a._getUIString("ScaleControl.Kilometers")):Or(t,s,_,a._getUIString("ScaleControl.Meters"))}function Or(a,t,n,s){const u=function(d){const f=Math.pow(10,`${Math.floor(d)}`.length-1);let _=d/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(y){const v=Math.pow(10,Math.ceil(-Math.log(y)/Math.LN10));return Math.round(y*v)/v}(_),f*_}(n);a.style.width=t*(u/n)+"px",a.innerHTML=`${u}&nbsp;${s}`}const Nt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},jt=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function zs(a){if(a){if(typeof a=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(a,2)));return{center:new l.pointGeometry(0,0),top:new l.pointGeometry(0,a),"top-left":new l.pointGeometry(t,t),"top-right":new l.pointGeometry(-t,t),bottom:new l.pointGeometry(0,-a),"bottom-left":new l.pointGeometry(t,-t),"bottom-right":new l.pointGeometry(-t,-t),left:new l.pointGeometry(a,0),right:new l.pointGeometry(-a,0)}}if(a instanceof l.pointGeometry||Array.isArray(a)){const t=l.pointGeometry.convert(a);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:l.pointGeometry.convert(a.center||[0,0]),top:l.pointGeometry.convert(a.top||[0,0]),"top-left":l.pointGeometry.convert(a["top-left"]||[0,0]),"top-right":l.pointGeometry.convert(a["top-right"]||[0,0]),bottom:l.pointGeometry.convert(a.bottom||[0,0]),"bottom-left":l.pointGeometry.convert(a["bottom-left"]||[0,0]),"bottom-right":l.pointGeometry.convert(a["bottom-right"]||[0,0]),left:l.pointGeometry.convert(a.left||[0,0]),right:l.pointGeometry.convert(a.right||[0,0])}}return zs(new l.pointGeometry(0,0))}const Yr={supported:ye,setRTLTextPlugin:l.setRTLTextPlugin,getRTLTextPluginStatus:l.getRTLTextPluginStatus,Map:class extends Ft{constructor(a){var t;if(l.PerformanceUtils.mark(l.PerformanceMarkers.create),(a=l.extend({},Fa,a)).minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new io(a.minZoom,a.maxZoom,a.minPitch,a.maxPitch,a.renderWorldCopies),{bearingSnap:a.bearingSnap}),this._interactive=a.interactive,this._cooperativeGestures=a.cooperativeGestures,this._maxTileCacheSize=a.maxTileCacheSize,this._failIfMajorPerformanceCaveat=a.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=a.preserveDrawingBuffer,this._antialias=a.antialias,this._trackResize=a.trackResize,this._bearingSnap=a.bearingSnap,this._refreshExpiredTiles=a.refreshExpiredTiles,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=a.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=a.collectResourceTiming,this._renderTaskQueue=new Ra,this._controls=[],this._mapId=l.uniqueId(),this._locale=l.extend({},Ba,a.locale),this._clickTolerance=a.clickTolerance,this._pixelRatio=(t=a.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new gt(a.transformRequest),typeof a.container=="string"){if(this._container=document.getElementById(a.container),!this._container)throw new Error(`Container '${a.container}' not found.`)}else{if(!(a.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=a.container}if(a.maxBounds&&this.setMaxBounds(a.maxBounds),l.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window!="undefined"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new La(this,a),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=a.hash&&new Ta(typeof a.hash=="string"&&a.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,l.extend({},a.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=a.localIdeographFontFamily,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new uo({customAttribution:a.customAttribution})),a.maplibreLogo&&this.addControl(new Uo,a.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new l.Event(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new l.Event(`${n.dataType}dataloading`,n))}),this.on("dataabort",n=>{this.fire(new l.Event("sourcedataabort",n))})}_getMapId(){return this._mapId}addControl(a,t){if(t===void 0&&(t=a.getDefaultPosition?a.getDefaultPosition():"top-right"),!a||!a.onAdd)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=a.onAdd(this);this._controls.push(a);const s=this._controlPositions[t];return t.indexOf("bottom")!==-1?s.insertBefore(n,s.firstChild):s.appendChild(n),this}removeControl(a){if(!a||!a.onRemove)return this.fire(new l.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(a);return t>-1&&this._controls.splice(t,1),a.onRemove(this),this}hasControl(a){return this._controls.indexOf(a)>-1}calculateCameraOptionsFromTo(a,t,n,s){return s==null&&this.style.terrain&&(s=this.transform.getElevation(n,this.style.terrain)),super.calculateCameraOptionsFromTo(a,t,n,s)}resize(a){const t=this._containerDimensions(),n=t[0],s=t[1];this._resizeCanvas(n,s,this.getPixelRatio()),this.transform.resize(n,s),this.painter.resize(n,s,this.getPixelRatio());const u=!this._moving;return u&&(this.stop(),this.fire(new l.Event("movestart",a)).fire(new l.Event("move",a))),this.fire(new l.Event("resize",a)),u&&this.fire(new l.Event("moveend",a)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(a){const[t,n]=this._containerDimensions();this._pixelRatio=a,this._resizeCanvas(t,n,a),this.painter.resize(t,n,a)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(a){return this.transform.setMaxBounds(l.LngLatBounds.convert(a)),this._update()}setMinZoom(a){if((a=a==null?-2:a)>=-2&&a<=this.transform.maxZoom)return this.transform.minZoom=a,this._update(),this.getZoom()<a&&this.setZoom(a),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(a){if((a=a==null?22:a)>=this.transform.minZoom)return this.transform.maxZoom=a,this._update(),this.getZoom()>a&&this.setZoom(a),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(a){if((a=a==null?0:a)<0)throw new Error("minPitch must be greater than or equal to 0");if(a>=0&&a<=this.transform.maxPitch)return this.transform.minPitch=a,this._update(),this.getPitch()<a&&this.setPitch(a),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(a){if((a=a==null?60:a)>85)throw new Error("maxPitch must be less than or equal to 85");if(a>=this.transform.minPitch)return this.transform.maxPitch=a,this._update(),this.getPitch()>a&&this.setPitch(a),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(a){return this.transform.renderWorldCopies=a,this._update()}project(a){return this.transform.locationPoint(l.LngLat.convert(a),this.style&&this.style.terrain)}unproject(a){return this.transform.pointLocation(l.pointGeometry.convert(a),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(a,t,n){if(a==="mouseenter"||a==="mouseover"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:d=>{const f=this.getLayer(t)?this.queryRenderedFeatures(d.point,{layers:[t]}):[];f.length?s||(s=!0,n.call(this,new zi(a,this,d.originalEvent,{features:f}))):s=!1},mouseout:()=>{s=!1}}}}if(a==="mouseleave"||a==="mouseout"){let s=!1;return{layer:t,listener:n,delegates:{mousemove:f=>{(this.getLayer(t)?this.queryRenderedFeatures(f.point,{layers:[t]}):[]).length?s=!0:s&&(s=!1,n.call(this,new zi(a,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,n.call(this,new zi(a,this,f.originalEvent)))}}}}{const s=u=>{const d=this.getLayer(t)?this.queryRenderedFeatures(u.point,{layers:[t]}):[];d.length&&(u.features=d,n.call(this,u),delete u.features)};return{layer:t,listener:n,delegates:{[a]:s}}}}on(a,t,n){if(n===void 0)return super.on(a,t);const s=this._createDelegatedListener(a,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[a]=this._delegatedListeners[a]||[],this._delegatedListeners[a].push(s);for(const u in s.delegates)this.on(u,s.delegates[u]);return this}once(a,t,n){if(n===void 0)return super.once(a,t);const s=this._createDelegatedListener(a,t,n);for(const u in s.delegates)this.once(u,s.delegates[u]);return this}off(a,t,n){return n===void 0?super.off(a,t):(this._delegatedListeners&&this._delegatedListeners[a]&&(s=>{const u=this._delegatedListeners[a];for(let d=0;d<u.length;d++){const f=u[d];if(f.layer===t&&f.listener===n){for(const _ in f.delegates)this.off(_,f.delegates[_]);return u.splice(d,1),this}}})(),this)}queryRenderedFeatures(a,t){if(!this.style)return[];let n;if(t!==void 0||a===void 0||a instanceof l.pointGeometry||Array.isArray(a)||(t=a,a=void 0),t=t||{},(a=a||[[0,0],[this.transform.width,this.transform.height]])instanceof l.pointGeometry||typeof a[0]=="number")n=[l.pointGeometry.convert(a)];else{const s=l.pointGeometry.convert(a[0]),u=l.pointGeometry.convert(a[1]);n=[s,new l.pointGeometry(u.x,s.y),u,new l.pointGeometry(s.x,u.y),s]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(a,t){return this.style.querySourceFeatures(a,t)}setStyle(a,t){return(t=l.extend({},{localIdeographFontFamily:this._localIdeographFontFamily},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&a?(this._diffStyle(a,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(a,t))}setTransformRequest(a){return this._requestManager.setTransformRequest(a),this}_getUIString(a){const t=this._locale[a];if(t==null)throw new Error(`Missing UI string '${a}'`);return t}_updateStyle(a,t){return this.style&&(this.style.setEventedParent(null),this.style._remove()),a?(this.style=new li(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof a=="string"?this.style.loadURL(a):this.style.loadJSON(a),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new li(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(a,t){if(typeof a=="string"){const n=this._requestManager.transformRequest(a,l.ResourceType.Style);l.getJSON(n,(s,u)=>{s?this.fire(new l.ErrorEvent(s)):u&&this._updateDiff(u,t)})}else typeof a=="object"&&this._updateDiff(a,t)}_updateDiff(a,t){try{this.style.setState(a)&&this._update(!0)}catch(n){l.warnOnce(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(a,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():l.warnOnce("There is no style added to the map.")}addSource(a,t){return this._lazyInitEmptyStyle(),this.style.addSource(a,t),this._update(!0)}isSourceLoaded(a){const t=this.style&&this.style.sourceCaches[a];if(t!==void 0)return t.loaded();this.fire(new l.ErrorEvent(new Error(`There is no source with ID '${a}'`)))}setTerrain(a){return this.style.setTerrain(a),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const a=this.style&&this.style.sourceCaches;for(const t in a){const n=a[t]._tiles;for(const s in n){const u=n[s];if(u.state!=="loaded"&&u.state!=="errored")return!1}}return!0}addSourceType(a,t,n){return this._lazyInitEmptyStyle(),this.style.addSourceType(a,t,n)}removeSource(a){return this.style.removeSource(a),this._update(!0)}getSource(a){return this.style.getSource(a)}addImage(a,t,{pixelRatio:n=1,sdf:s=!1,stretchX:u,stretchY:d,content:f}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||l.isImageBitmap(t)){const{width:_,height:y,data:v}=l.exported.getImageData(t);this.style.addImage(a,{data:new l.RGBAImage({width:_,height:y},v),pixelRatio:n,stretchX:u,stretchY:d,content:f,sdf:s,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new l.ErrorEvent(new 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`")));{const{width:_,height:y,data:v}=t,T=t;this.style.addImage(a,{data:new l.RGBAImage({width:_,height:y},new Uint8Array(v)),pixelRatio:n,stretchX:u,stretchY:d,content:f,sdf:s,version:0,userImage:T}),T.onAdd&&T.onAdd(this,a)}}}updateImage(a,t){const n=this.style.getImage(a);if(!n)return this.fire(new l.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=t instanceof HTMLImageElement||l.isImageBitmap(t)?l.exported.getImageData(t):t,{width:u,height:d,data:f}=s;if(u===void 0||d===void 0)return this.fire(new l.ErrorEvent(new 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(u!==n.data.width||d!==n.data.height)return this.fire(new l.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(t instanceof HTMLImageElement||l.isImageBitmap(t));n.data.replace(f,_),this.style.updateImage(a,n)}hasImage(a){return a?!!this.style.getImage(a):(this.fire(new l.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(a){this.style.removeImage(a)}loadImage(a,t){l.getImage(this._requestManager.transformRequest(a,l.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(a,t){return this._lazyInitEmptyStyle(),this.style.addLayer(a,t),this._update(!0)}moveLayer(a,t){return this.style.moveLayer(a,t),this._update(!0)}removeLayer(a){return this.style.removeLayer(a),this._update(!0)}getLayer(a){return this.style.getLayer(a)}setLayerZoomRange(a,t,n){return this.style.setLayerZoomRange(a,t,n),this._update(!0)}setFilter(a,t,n={}){return this.style.setFilter(a,t,n),this._update(!0)}getFilter(a){return this.style.getFilter(a)}setPaintProperty(a,t,n,s={}){return this.style.setPaintProperty(a,t,n,s),this._update(!0)}getPaintProperty(a,t){return this.style.getPaintProperty(a,t)}setLayoutProperty(a,t,n,s={}){return this.style.setLayoutProperty(a,t,n,s),this._update(!0)}getLayoutProperty(a,t){return this.style.getLayoutProperty(a,t)}setLight(a,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(a,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(a,t){return this.style.setFeatureState(a,t),this._update()}removeFeatureState(a,t){return this.style.removeFeatureState(a,t),this._update()}getFeatureState(a){return this.style.getFeatureState(a)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let a=0,t=0;return this._container&&(a=this._container.clientWidth||400,t=this._container.clientHeight||300),[a,t]}_setupContainer(){const a=this._container;a.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=se.create("div","maplibregl-canvas-container mapboxgl-canvas-container",a);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=se.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const n=this._containerDimensions();this._resizeCanvas(n[0],n[1],this.getPixelRatio());const s=this._controlContainer=se.create("div","maplibregl-control-container mapboxgl-control-container",a),u=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(d=>{u[d]=se.create("div",`maplibregl-ctrl-${d} mapboxgl-ctrl-${d}`,s)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const a=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=se.create("div","maplibregl-cooperative-gesture-screen",a);let t="Control",n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(n=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`
585
+ <div class="maplibregl-desktop-message">${n}</div>
586
+ <div class="maplibregl-mobile-message">${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}</div>
587
+ `,document.addEventListener("keydown",s=>{s.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",s=>{s.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",s=>{this._onCooperativeGesture(s,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(a,t,n){this._canvas.width=n*a,this._canvas.height=n*t,this._canvas.style.width=`${a}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const a=l.extend({},ye.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",a)||this._canvas.getContext("experimental-webgl",a);t?(this.painter=new xs(t,this.transform),l.exported$1.testSupport(t)):this.fire(new l.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(a){a.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new l.Event("webglcontextlost",{originalEvent:a}))}_contextRestored(a){this._setupPainter(),this.resize(),this._update(),this.fire(new l.Event("webglcontextrestored",{originalEvent:a}))}_onMapScroll(a){if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(a,t,n){return!t&&n<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(a){return this.style?(this._styleDirty=this._styleDirty||a,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(a){return this._update(),this._renderTaskQueue.add(a)}_cancelRenderFrame(a){this._renderTaskQueue.remove(a)}_render(a){let t,n=0;const s=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=s.createQueryEXT(),s.beginQueryEXT(s.TIME_ELAPSED_EXT,t),n=l.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(a),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,_=l.exported.now();this.style.zoomHistory.update(f,_);const y=new l.EvaluationParameters(f,{now:_,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),v=y.crossFadingFactor();v===1&&v===this._crossFadingFactor||(u=!0,this._crossFadingFactor=v),this.style.update(y)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new l.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.load),this.fire(new l.Event("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const f=l.exported.now()-n;s.endQueryEXT(s.TIME_ELAPSED_EXT,t),setTimeout(()=>{const _=s.getQueryObjectEXT(t,s.QUERY_RESULT_EXT)/1e6;s.deleteQueryEXT(t),this.fire(new l.Event("gpu-timing-frame",{cpuTime:f,gpuTime:_}))},50)}if(this.listens("gpu-timing-layer")){const f=this.painter.collectGpuTimers();setTimeout(()=>{const _=this.painter.queryGpuTimers(f);this.fire(new l.Event("gpu-timing-layer",{layerTimes:_}))},50)}const d=this._sourcesDirty||this._styleDirty||this._placementDirty;return d||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new l.Event("idle")),!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,l.PerformanceUtils.mark(l.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window!="undefined"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const a=this.painter.context.gl.getExtension("WEBGL_lose_context");a&&a.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),se.remove(this._canvasContainer),se.remove(this._controlContainer),this._cooperativeGestures&&se.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),l.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new l.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=l.exported.frame(a=>{l.PerformanceUtils.frame(a),this._frame=null,this._render(a)}))}_onWindowOnline(){this._update()}_onWindowResize(a){this._trackResize&&this.resize({originalEvent:a})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(a){this._showTileBoundaries!==a&&(this._showTileBoundaries=a,this._update())}get showPadding(){return!!this._showPadding}set showPadding(a){this._showPadding!==a&&(this._showPadding=a,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(a){this._showCollisionBoxes!==a&&(this._showCollisionBoxes=a,a?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(a){this._showOverdrawInspector!==a&&(this._showOverdrawInspector=a,this._update())}get repaint(){return!!this._repaint}set repaint(a){this._repaint!==a&&(this._repaint=a,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(a){this._vertices=a,this._update()}_setCacheLimits(a,t){l.setCacheLimits(a,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(a){this.options=l.extend({},kl,a),this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(l.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(l.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const a=this._map.getZoom(),t=a===this._map.getMaxZoom(),n=a===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){const a=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=a}onAdd(a){return this._map=a,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new tr(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){se.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(a,t){const n=se.create("button",a,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(a,t){const n=this._map._getUIString(`NavigationControl.${t}`);a.title=n,a.setAttribute("aria-label",n)}},GeolocateControl:class extends l.Evented{constructor(a){super(),this.options=l.extend({},Ms,a),l.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(a){var t;return this._map=a,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,Br!==void 0?t(Br):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(n=>{Br=n.state!=="denied",t(Br)}):(Br=!!window.navigator.geolocation,t(Br)),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(),se.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,si=0,Fr=!1}_isOutOfMapMaxBounds(a){const t=this._map.getMaxBounds(),n=a.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(a){if(this._map){if(this._isOutOfMapMaxBounds(a))return this._setErrorState(),this.fire(new l.Event("outofmaxbounds",a)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=a,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(a),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(a),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("geolocate",a)),this._finish()}}_updateCamera(a){const t=new l.LngLat(a.coords.longitude,a.coords.latitude),n=a.coords.accuracy,s=this._map.getBearing(),u=l.extend({bearing:s},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),u,{geolocateSource:!0})}_updateMarker(a){if(a){const t=new l.LngLat(a.coords.longitude,a.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=a.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const a=this._map._container.clientHeight/2,t=this._map.unproject([0,a]),n=this._map.unproject([1,a]),s=t.distanceTo(n),u=Math.ceil(2*this._accuracy/s);this._circleElement.style.width=`${u}px`,this._circleElement.style.height=`${u}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(a){if(this._map){if(this.options.trackUserLocation)if(a.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(a.code===3&&Fr)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new l.Event("error",a)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(a){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=se.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",a===!1){l.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=se.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Pn(this._dotElement),this._circleElement=se.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Pn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new l.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return l.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new l.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":si--,Fr=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new l.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new l.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let a;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),si++,si>1?(a={maximumAge:6e5,timeout:0},Fr=!0):(a=this.options.positionOptions,Fr=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,a)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:uo,LogoControl:Uo,ScaleControl:class{constructor(a){this.options=l.extend({},ir,a),l.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Oa(this._map,this._container,this.options)}onAdd(a){return this._map=a,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",a.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){se.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(a){this.options.unit=a,Oa(this._map,this._container,this.options)}},FullscreenControl:class{constructor(a){this._fullscreen=!1,a&&a.container&&(a.container instanceof HTMLElement?this._container=a.container:l.warnOnce("Full screen control 'container' must be a DOM element.")),l.bindAll(["_onClickFullscreen","_changeIcon"],this),"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(a){return this._map=a,this._container||(this._container=this._map.getContainer()),this._controlContainer=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",l.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){se.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const a=this._fullscreenButton=se.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);se.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",a).setAttribute("aria-hidden","true"),a.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const a=this._getTitle();this._fullscreenButton.setAttribute("aria-label",a),this._fullscreenButton.title=a}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(a){this.options=a,l.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(a){return this._map=a,this._container=se.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=se.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),se.create("span","maplibregl-ctrl-icon mapboxgl-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(){se.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends l.Evented{constructor(a){super(),this.options=l.extend(Object.create(Nt),a),l.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(a){return this._map&&this.remove(),this._map=a,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._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new l.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&se.remove(this._content),this._container&&(se.remove(this._container),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("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new l.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(a){return this._lngLat=l.LngLat.convert(a),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(a){return this.setDOMContent(document.createTextNode(a))}setHTML(a){const t=document.createDocumentFragment(),n=document.createElement("body");let s;for(n.innerHTML=a;s=n.firstChild,s;)t.appendChild(s);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(a){return this.options.maxWidth=a,this._update(),this}setDOMContent(a){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=se.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(a),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(a){this._container&&this._container.classList.add(a)}removeClassName(a){this._container&&this._container.classList.remove(a)}setOffset(a){return this.options.offset=a,this._update(),this}toggleClassName(a){if(this._container)return this._container.classList.toggle(a)}_createCloseButton(){this.options.closeButton&&(this._closeButton=se.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(a){this._update(a.point)}_onMouseMove(a){this._update(a.point)}_onDrag(a){this._update(a.point)}_update(a){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=se.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=se.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(d=>this._container.classList.add(d)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ho(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!a))return;const t=this._pos=this._trackPointer&&a?a:this._map.project(this._lngLat);let n=this.options.anchor;const s=zs(this.options.offset);if(!n){const d=this._container.offsetWidth,f=this._container.offsetHeight;let _;_=t.y+s.bottom.y<f?["top"]:t.y>this._map.transform.height-f?["bottom"]:[],t.x<d/2?_.push("left"):t.x>this._map.transform.width-d/2&&_.push("right"),n=_.length===0?"bottom":_.join("-")}const u=t.add(s[n]).round();se.setTransform(this._container,`${Ve[n]} translate(${u.x}px,${u.y}px)`),je(this._container,n,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const a=this._container.querySelector(jt);a&&a.focus()}_onClose(){this.remove()}},Marker:Pn,Style:li,LngLat:l.LngLat,LngLatBounds:l.LngLatBounds,Point:l.pointGeometry,MercatorCoordinate:l.MercatorCoordinate,Evented:l.Evented,AJAXError:l.AJAXError,config:l.config,CanvasSource:Gr,GeoJSONSource:cr,ImageSource:Gi,RasterDEMTileSource:We,RasterTileSource:Tr,VectorTileSource:cn,VideoSource:qi,prewarm:function(){fn().acquire(hr)},clearPrewarmedResources:function(){const a=Ar;a&&(a.isPreloaded()&&a.numActive()===1?(a.release(hr),Ar=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()"))},get version(){return"2.4.0"},get workerCount(){return Ii.workerCount},set workerCount(a){Ii.workerCount=a},get maxParallelImageRequests(){return l.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(a){l.config.MAX_PARALLEL_IMAGE_REQUESTS=a},clearStorage(a){l.clearTileCache(a)},workerUrl:"",addProtocol(a,t){l.config.REGISTERED_PROTOCOLS[a]=t},removeProtocol(a){delete l.config.REGISTERED_PROTOCOLS[a]}};return Ui.extend(Yr,{isSafari:l.isSafari,getPerformanceMetrics:l.PerformanceUtils.getPerformanceMetrics}),Yr});var ge=Z;return ge})})(vh);var dm=vh.exports;const vf=lt.memo(({marker:A})=>rh(ff,{latitude:A.lat,longitude:A.lng,style:{zIndex:1},children:rh(Pp.Root,{options:{style:"pin"}})}));vf.displayName="Pin";const bf={all:()=>["pois"],list:A=>[...bf.all(),A]},wf={all:()=>["schools"],list:A=>[...wf.all(),A]},Tf={all:()=>["scores"],list:A=>[...Tf.all(),A]};function Ec(A,L=[]){let B=[];function j(X,ge){const l=_e.exports.createContext(ge),ye=B.length;B=[...B,ge];function pe(we){const{scope:se,children:gt,...st}=we,He=(se==null?void 0:se[A][ye])||l,_t=_e.exports.useMemo(()=>st,Object.values(st));return _e.exports.createElement(He.Provider,{value:_t},gt)}function Me(we,se){const gt=(se==null?void 0:se[A][ye])||l,st=_e.exports.useContext(gt);if(st)return st;if(ge!==void 0)return ge;throw new Error(`\`${we}\` must be used within \`${X}\``)}return pe.displayName=X+"Provider",[pe,Me]}const Z=()=>{const X=B.map(ge=>_e.exports.createContext(ge));return function(l){const ye=(l==null?void 0:l[A])||X;return _e.exports.useMemo(()=>({[`__scope${A}`]:{...l,[A]:ye}}),[l,ye])}};return Z.scopeName=A,[j,Ef(Z,...L)]}function Ef(...A){const L=A[0];if(A.length===1)return L;const B=()=>{const j=A.map(Z=>({useScope:Z(),scopeName:Z.scopeName}));return function(X){const ge=j.reduce((l,{useScope:ye,scopeName:pe})=>{const we=ye(X)[`__scope${pe}`];return{...l,...we}},{});return _e.exports.useMemo(()=>({[`__scope${L.scopeName}`]:ge}),[ge])}};return B.scopeName=L.scopeName,B}function Sf(A,L){typeof A=="function"?A(L):A!=null&&(A.current=L)}function wh(...A){return L=>A.forEach(B=>Sf(B,L))}function Js(...A){return _e.exports.useCallback(wh(...A),A)}const cl=_e.exports.forwardRef((A,L)=>{const{children:B,...j}=A,Z=_e.exports.Children.toArray(B),X=Z.find(Cf);if(X){const ge=X.props.children,l=Z.map(ye=>ye===X?_e.exports.Children.count(ge)>1?_e.exports.Children.only(null):_e.exports.isValidElement(ge)?ge.props.children:null:ye);return _e.exports.createElement(vc,Ei({},j,{ref:L}),_e.exports.isValidElement(ge)?_e.exports.cloneElement(ge,void 0,l):null)}return _e.exports.createElement(vc,Ei({},j,{ref:L}),B)});cl.displayName="Slot";const vc=_e.exports.forwardRef((A,L)=>{const{children:B,...j}=A;return _e.exports.isValidElement(B)?_e.exports.cloneElement(B,{...Af(j,B.props),ref:wh(L,B.ref)}):_e.exports.Children.count(B)>1?_e.exports.Children.only(null):null});vc.displayName="SlotClone";const If=({children:A})=>_e.exports.createElement(_e.exports.Fragment,null,A);function Cf(A){return _e.exports.isValidElement(A)&&A.type===If}function Af(A,L){const B={...L};for(const j in L){const Z=A[j],X=L[j];/^on[A-Z]/.test(j)?B[j]=(...l)=>{X==null||X(...l),Z==null||Z(...l)}:j==="style"?B[j]={...Z,...X}:j==="className"&&(B[j]=[Z,X].filter(Boolean).join(" "))}return{...A,...B}}function Mf(A){const L=A+"CollectionProvider",[B,j]=Ec(L),[Z,X]=B(L,{collectionRef:{current:null},itemMap:new Map}),ge=gt=>{const{scope:st,children:He}=gt,_t=lt.useRef(null),Mt=lt.useRef(new Map).current;return lt.createElement(Z,{scope:st,itemMap:Mt,collectionRef:_t},He)},l=A+"CollectionSlot",ye=lt.forwardRef((gt,st)=>{const{scope:He,children:_t}=gt,Mt=X(l,He),ct=Js(st,Mt.collectionRef);return lt.createElement(cl,{ref:ct},_t)}),pe=A+"CollectionItemSlot",Me="data-radix-collection-item",we=lt.forwardRef((gt,st)=>{const{scope:He,children:_t,...Mt}=gt,ct=lt.useRef(null),bt=Js(st,ct),Si=X(pe,He);return lt.useEffect(()=>(Si.itemMap.set(ct,{ref:ct,...Mt}),()=>void Si.itemMap.delete(ct))),lt.createElement(cl,{[Me]:"",ref:bt},_t)});function se(gt){const st=X(A+"CollectionConsumer",gt);return lt.useCallback(()=>{const _t=st.collectionRef.current;if(!_t)return[];const Mt=Array.from(_t.querySelectorAll(`[${Me}]`));return Array.from(st.itemMap.values()).sort((Si,Vt)=>Mt.indexOf(Si.ref.current)-Mt.indexOf(Vt.ref.current))},[st.collectionRef,st.itemMap])}return[{Provider:ge,Slot:ye,ItemSlot:we},se,j]}function Th(A,L,{checkForDefaultPrevented:B=!0}={}){return function(Z){if(A==null||A(Z),B===!1||!Z.defaultPrevented)return L==null?void 0:L(Z)}}function Eh(A){const L=_e.exports.useRef(A);return _e.exports.useEffect(()=>{L.current=A}),_e.exports.useMemo(()=>(...B)=>{var j;return(j=L.current)===null||j===void 0?void 0:j.call(L,...B)},[])}function Sc({prop:A,defaultProp:L,onChange:B=()=>{}}){const[j,Z]=zf({defaultProp:L,onChange:B}),X=A!==void 0,ge=X?A:j,l=Eh(B),ye=_e.exports.useCallback(pe=>{if(X){const we=typeof pe=="function"?pe(A):pe;we!==A&&l(we)}else Z(pe)},[X,A,Z,l]);return[ge,ye]}function zf({defaultProp:A,onChange:L}){const B=_e.exports.useState(A),[j]=B,Z=_e.exports.useRef(j),X=Eh(L);return _e.exports.useEffect(()=>{Z.current!==j&&(X(j),Z.current=j)},[j,Z,X]),B}const Pf=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"],Qs=Pf.reduce((A,L)=>{const B=_e.exports.forwardRef((j,Z)=>{const{asChild:X,...ge}=j,l=X?cl:L;return _e.exports.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),_e.exports.createElement(l,Ei({},ge,{ref:Z}))});return B.displayName=`Primitive.${L}`,{...A,[L]:B}},{}),ul=Boolean(globalThis==null?void 0:globalThis.document)?_e.exports.useLayoutEffect:()=>{};function kf(A,L){return _e.exports.useReducer((B,j)=>{const Z=L[B][j];return Z!=null?Z:B},A)}const Sh=A=>{const{present:L,children:B}=A,j=Df(L),Z=typeof B=="function"?B({present:j.isPresent}):_e.exports.Children.only(B),X=Js(j.ref,Z.ref);return typeof B=="function"||j.isPresent?_e.exports.cloneElement(Z,{ref:X}):null};Sh.displayName="Presence";function Df(A){const[L,B]=_e.exports.useState(),j=_e.exports.useRef({}),Z=_e.exports.useRef(A),X=_e.exports.useRef("none"),ge=A?"mounted":"unmounted",[l,ye]=kf(ge,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _e.exports.useEffect(()=>{const pe=ll(j.current);X.current=l==="mounted"?pe:"none"},[l]),ul(()=>{const pe=j.current,Me=Z.current;if(Me!==A){const se=X.current,gt=ll(pe);A?ye("MOUNT"):gt==="none"||(pe==null?void 0:pe.display)==="none"?ye("UNMOUNT"):ye(Me&&se!==gt?"ANIMATION_OUT":"UNMOUNT"),Z.current=A}},[A,ye]),ul(()=>{if(L){const pe=we=>{const gt=ll(j.current).includes(we.animationName);we.target===L&&gt&&wc.exports.flushSync(()=>ye("ANIMATION_END"))},Me=we=>{we.target===L&&(X.current=ll(j.current))};return L.addEventListener("animationstart",Me),L.addEventListener("animationcancel",pe),L.addEventListener("animationend",pe),()=>{L.removeEventListener("animationstart",Me),L.removeEventListener("animationcancel",pe),L.removeEventListener("animationend",pe)}}else ye("ANIMATION_END")},[L,ye]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:_e.exports.useCallback(pe=>{pe&&(j.current=getComputedStyle(pe)),B(pe)},[])}}function ll(A){return(A==null?void 0:A.animationName)||"none"}const Lf=kp["useId".toString()]||(()=>{});let Rf=0;function Ih(A){const[L,B]=_e.exports.useState(Lf());return ul(()=>{A||B(j=>j!=null?j:String(Rf++))},[A]),A||(L?`radix-${L}`:"")}const Ch="Collapsible",[Bf,Ah]=Ec(Ch),[Ff,Ic]=Bf(Ch),Of=_e.exports.forwardRef((A,L)=>{const{__scopeCollapsible:B,open:j,defaultOpen:Z,disabled:X,onOpenChange:ge,...l}=A,[ye=!1,pe]=Sc({prop:j,defaultProp:Z,onChange:ge});return _e.exports.createElement(Ff,{scope:B,disabled:X,contentId:Ih(),open:ye,onOpenToggle:_e.exports.useCallback(()=>pe(Me=>!Me),[pe])},_e.exports.createElement(Qs.div,Ei({"data-state":Cc(ye),"data-disabled":X?"":void 0},l,{ref:L})))}),Uf="CollapsibleTrigger",$f=_e.exports.forwardRef((A,L)=>{const{__scopeCollapsible:B,...j}=A,Z=Ic(Uf,B);return _e.exports.createElement(Qs.button,Ei({type:"button","aria-controls":Z.contentId,"aria-expanded":Z.open||!1,"data-state":Cc(Z.open),"data-disabled":Z.disabled?"":void 0,disabled:Z.disabled},j,{ref:L,onClick:Th(A.onClick,Z.onOpenToggle)}))}),Mh="CollapsibleContent",Vf=_e.exports.forwardRef((A,L)=>{const{forceMount:B,...j}=A,Z=Ic(Mh,A.__scopeCollapsible);return _e.exports.createElement(Sh,{present:B||Z.open},({present:X})=>_e.exports.createElement(Nf,Ei({},j,{ref:L,present:X})))}),Nf=_e.exports.forwardRef((A,L)=>{const{__scopeCollapsible:B,present:j,children:Z,...X}=A,ge=Ic(Mh,B),[l,ye]=_e.exports.useState(j),pe=_e.exports.useRef(null),Me=Js(L,pe),we=_e.exports.useRef(0),se=we.current,gt=_e.exports.useRef(0),st=gt.current,He=ge.open||l,_t=_e.exports.useRef(He),Mt=_e.exports.useRef();return _e.exports.useEffect(()=>{const ct=requestAnimationFrame(()=>_t.current=!1);return()=>cancelAnimationFrame(ct)},[]),ul(()=>{const ct=pe.current;if(ct){Mt.current=Mt.current||{transitionDuration:ct.style.transitionDuration,animationDuration:ct.style.animationDuration,animationFillMode:ct.style.animationFillMode},ct.style.transitionDuration="0s",ct.style.animationDuration="0s",ct.style.animationFillMode="none";const bt=ct.getBoundingClientRect();we.current=bt.height,gt.current=bt.width,_t.current||(ct.style.transitionDuration=Mt.current.transitionDuration,ct.style.animationDuration=Mt.current.animationDuration,ct.style.animationFillMode=Mt.current.animationFillMode),ye(j)}},[ge.open,j]),_e.exports.createElement(Qs.div,Ei({"data-state":Cc(ge.open),"data-disabled":ge.disabled?"":void 0,id:ge.contentId,hidden:!He},X,{ref:Me,style:{["--radix-collapsible-content-height"]:se?`${se}px`:void 0,["--radix-collapsible-content-width"]:st?`${st}px`:void 0,...A.style}}),He&&Z)});function Cc(A){return A?"open":"closed"}const Gf=Of,qf=$f,Zf=Vf,ea="Accordion",jf=["Home","End","ArrowDown","ArrowUp"],[Ac,Xf,Wf]=Mf(ea),[dl,pm]=Ec(ea,[Wf,Ah]),Mc=Ah(),zh=lt.forwardRef((A,L)=>{const{type:B,...j}=A,Z=j,X=j;return lt.createElement(Ac.Provider,{scope:A.__scopeAccordion},B==="multiple"?lt.createElement(Yf,Ei({},X,{ref:L})):lt.createElement(Jf,Ei({},Z,{ref:L})))});zh.propTypes={type(A){const L=A.value||A.defaultValue;return A.type&&!["single","multiple"].includes(A.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):A.type==="multiple"&&typeof L=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):A.type==="single"&&Array.isArray(L)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[Ph,Hf]=dl(ea),[kh,Kf]=dl(ea,{collapsible:!1}),Jf=lt.forwardRef((A,L)=>{const{value:B,defaultValue:j,onValueChange:Z=()=>{},collapsible:X=!1,...ge}=A,[l,ye]=Sc({prop:B,defaultProp:j,onChange:Z});return lt.createElement(Ph,{scope:A.__scopeAccordion,value:l?[l]:[],onItemOpen:ye,onItemClose:lt.useCallback(()=>X&&ye(""),[X,ye])},lt.createElement(kh,{scope:A.__scopeAccordion,collapsible:X},lt.createElement(Dh,Ei({},ge,{ref:L}))))}),Yf=lt.forwardRef((A,L)=>{const{value:B,defaultValue:j,onValueChange:Z=()=>{},...X}=A,[ge=[],l]=Sc({prop:B,defaultProp:j,onChange:Z}),ye=lt.useCallback(Me=>l((we=[])=>[...we,Me]),[l]),pe=lt.useCallback(Me=>l((we=[])=>we.filter(se=>se!==Me)),[l]);return lt.createElement(Ph,{scope:A.__scopeAccordion,value:ge,onItemOpen:ye,onItemClose:pe},lt.createElement(kh,{scope:A.__scopeAccordion,collapsible:!0},lt.createElement(Dh,Ei({},X,{ref:L}))))}),[Qf,em]=dl(ea),Dh=lt.forwardRef((A,L)=>{const{__scopeAccordion:B,disabled:j,...Z}=A,X=lt.useRef(null),ge=Js(X,L),l=Xf(B),ye=Th(A.onKeyDown,pe=>{var Me;if(!jf.includes(pe.key))return;const we=pe.target,se=l().filter(Mt=>{var ct;return!((ct=Mt.ref.current)!==null&&ct!==void 0&&ct.disabled)}),gt=se.findIndex(Mt=>Mt.ref.current===we),st=se.length;if(gt===-1)return;pe.preventDefault();let He=gt;switch(pe.key){case"Home":He=0;break;case"End":He=st-1;break;case"ArrowDown":He=gt+1;break;case"ArrowUp":He=gt-1,He<0&&(He=st-1);break}const _t=He%st;(Me=se[_t].ref.current)===null||Me===void 0||Me.focus()});return lt.createElement(Qf,{scope:B,disabled:j},lt.createElement(Ac.Slot,{scope:B},lt.createElement(Qs.div,Ei({},Z,{ref:ge,onKeyDown:j?void 0:ye}))))}),bc="AccordionItem",[tm,zc]=dl(bc),im=lt.forwardRef((A,L)=>{const{__scopeAccordion:B,value:j,...Z}=A,X=em(bc,B),ge=Hf(bc,B),l=Mc(B),ye=Ih(),pe=j&&ge.value.includes(j)||!1,Me=X.disabled||A.disabled;return lt.createElement(tm,{scope:B,open:pe,disabled:Me,triggerId:ye},lt.createElement(Gf,Ei({"data-state":pe?"open":"closed"},l,Z,{ref:L,disabled:Me,open:pe,onOpenChange:we=>{we?ge.onItemOpen(j):ge.onItemClose(j)}})))}),rm="AccordionHeader",nm=lt.forwardRef((A,L)=>{const{__scopeAccordion:B,...j}=A,Z=zc(rm,B);return lt.createElement(Qs.h3,Ei({"data-state":lm(Z.open),"data-disabled":Z.disabled?"":void 0},j,{ref:L}))}),dh="AccordionTrigger",om=lt.forwardRef((A,L)=>{const{__scopeAccordion:B,...j}=A,Z=zc(dh,B),X=Kf(dh,B),ge=Mc(B);return lt.createElement(Ac.ItemSlot,{scope:B},lt.createElement(qf,Ei({"aria-disabled":Z.open&&!X.collapsible||void 0,id:Z.triggerId},ge,j,{ref:L})))}),sm="AccordionContent",am=lt.forwardRef((A,L)=>{const{__scopeAccordion:B,...j}=A,Z=zc(sm,B),X=Mc(B);return lt.createElement(Zf,Ei({role:"region","aria-labelledby":Z.triggerId},X,j,{ref:L,style:{["--radix-accordion-content-height"]:"var(--radix-collapsible-content-height)",["--radix-accordion-content-width"]:"var(--radix-collapsible-content-width)",...A.style}}))});function lm(A){return A?"open":"closed"}const fm=zh,mm=im,gm=nm,_m=om,ym=am,xm=A=>_e.exports.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...A},_e.exports.createElement("path",{d:"M9.99984 6L8.58984 7.41L13.1698 12L8.58984 16.59L9.99984 18L15.9998 12L9.99984 6Z"}));export{gm as $,ff as M,hm as N,vf as P,xm as S,Tf as a,_m as b,Dp as c,ym as d,mm as e,fm as f,gh as g,am as h,dm as m,bf as p,wf as s,um as u};