@mapvx/web-js 3.6.0-dev.1 → 4.0.0-dev.2

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 (191) hide show
  1. package/README.md +6 -1
  2. package/dist/cjs/index.js +2 -95
  3. package/dist/cjs/index.js.LICENSE.txt +1 -0
  4. package/dist/cjs/index.js.map +1 -1
  5. package/dist/es/controllers/routeController.d.ts.map +1 -1
  6. package/dist/es/controllers/routeController.js +25 -8
  7. package/dist/es/controllers/routeController.js.map +1 -1
  8. package/dist/es/domain/models/scene3D.d.ts +13 -0
  9. package/dist/es/domain/models/scene3D.d.ts.map +1 -1
  10. package/dist/es/logger/sentry.js +1 -1
  11. package/dist/es/map/liveMapFitTransform.d.ts +11 -5
  12. package/dist/es/map/liveMapFitTransform.d.ts.map +1 -1
  13. package/dist/es/map/liveMapFitTransform.js +28 -19
  14. package/dist/es/map/liveMapFitTransform.js.map +1 -1
  15. package/dist/es/map/map.d.ts +0 -1
  16. package/dist/es/map/map.d.ts.map +1 -1
  17. package/dist/es/map/map.js +7 -22
  18. package/dist/es/map/map.js.map +1 -1
  19. package/dist/es/map/scene3DController.d.ts +15 -4
  20. package/dist/es/map/scene3DController.d.ts.map +1 -1
  21. package/dist/es/map/scene3DController.js +22 -10
  22. package/dist/es/map/scene3DController.js.map +1 -1
  23. package/dist/umd/index.js +961 -166
  24. package/dist/umd/index.js.map +1 -1
  25. package/dist/umd/styles.css +1 -1
  26. package/dist/umd/styles.css.map +1 -1
  27. package/package.json +7 -4
  28. package/dist/cjs/assets/icons.js +0 -85
  29. package/dist/cjs/assets/icons.js.map +0 -1
  30. package/dist/cjs/config/draco.js +0 -15
  31. package/dist/cjs/config/draco.js.map +0 -1
  32. package/dist/cjs/config/sdkConfig.js +0 -3
  33. package/dist/cjs/config/sdkConfig.js.map +0 -1
  34. package/dist/cjs/controllers/markerLayoutController.js +0 -359
  35. package/dist/cjs/controllers/markerLayoutController.js.map +0 -1
  36. package/dist/cjs/controllers/routeController.js +0 -1549
  37. package/dist/cjs/controllers/routeController.js.map +0 -1
  38. package/dist/cjs/domain/models/_internal.js +0 -14
  39. package/dist/cjs/domain/models/_internal.js.map +0 -1
  40. package/dist/cjs/domain/models/_rtl.js +0 -10
  41. package/dist/cjs/domain/models/_rtl.js.map +0 -1
  42. package/dist/cjs/domain/models/animation.js +0 -64
  43. package/dist/cjs/domain/models/animation.js.map +0 -1
  44. package/dist/cjs/domain/models/banner.js +0 -24
  45. package/dist/cjs/domain/models/banner.js.map +0 -1
  46. package/dist/cjs/domain/models/campaign.js +0 -73
  47. package/dist/cjs/domain/models/campaign.js.map +0 -1
  48. package/dist/cjs/domain/models/categories.js +0 -37
  49. package/dist/cjs/domain/models/categories.js.map +0 -1
  50. package/dist/cjs/domain/models/circle.js +0 -253
  51. package/dist/cjs/domain/models/circle.js.map +0 -1
  52. package/dist/cjs/domain/models/cityFilterOption.js +0 -3
  53. package/dist/cjs/domain/models/cityFilterOption.js.map +0 -1
  54. package/dist/cjs/domain/models/configuration.js +0 -3
  55. package/dist/cjs/domain/models/configuration.js.map +0 -1
  56. package/dist/cjs/domain/models/cssCustomization.js +0 -3
  57. package/dist/cjs/domain/models/cssCustomization.js.map +0 -1
  58. package/dist/cjs/domain/models/fitOptions.js +0 -3
  59. package/dist/cjs/domain/models/fitOptions.js.map +0 -1
  60. package/dist/cjs/domain/models/innerFloors.js +0 -3
  61. package/dist/cjs/domain/models/innerFloors.js.map +0 -1
  62. package/dist/cjs/domain/models/institution.js +0 -45
  63. package/dist/cjs/domain/models/institution.js.map +0 -1
  64. package/dist/cjs/domain/models/latLng.js +0 -3
  65. package/dist/cjs/domain/models/latLng.js.map +0 -1
  66. package/dist/cjs/domain/models/location.js +0 -3
  67. package/dist/cjs/domain/models/location.js.map +0 -1
  68. package/dist/cjs/domain/models/loggeable.js +0 -52
  69. package/dist/cjs/domain/models/loggeable.js.map +0 -1
  70. package/dist/cjs/domain/models/mapCamera.js +0 -3
  71. package/dist/cjs/domain/models/mapCamera.js.map +0 -1
  72. package/dist/cjs/domain/models/mapConfig.js +0 -37
  73. package/dist/cjs/domain/models/mapConfig.js.map +0 -1
  74. package/dist/cjs/domain/models/marker.js +0 -502
  75. package/dist/cjs/domain/models/marker.js.map +0 -1
  76. package/dist/cjs/domain/models/multilanguage.js +0 -17
  77. package/dist/cjs/domain/models/multilanguage.js.map +0 -1
  78. package/dist/cjs/domain/models/openingHours.js +0 -3
  79. package/dist/cjs/domain/models/openingHours.js.map +0 -1
  80. package/dist/cjs/domain/models/place.js +0 -127
  81. package/dist/cjs/domain/models/place.js.map +0 -1
  82. package/dist/cjs/domain/models/platform.js +0 -3
  83. package/dist/cjs/domain/models/platform.js.map +0 -1
  84. package/dist/cjs/domain/models/popover.js +0 -3
  85. package/dist/cjs/domain/models/popover.js.map +0 -1
  86. package/dist/cjs/domain/models/product.js +0 -3
  87. package/dist/cjs/domain/models/product.js.map +0 -1
  88. package/dist/cjs/domain/models/property.js +0 -104
  89. package/dist/cjs/domain/models/property.js.map +0 -1
  90. package/dist/cjs/domain/models/route.js +0 -166
  91. package/dist/cjs/domain/models/route.js.map +0 -1
  92. package/dist/cjs/domain/models/routeConfiguration.js +0 -82
  93. package/dist/cjs/domain/models/routeConfiguration.js.map +0 -1
  94. package/dist/cjs/domain/models/routeInstance.js +0 -30
  95. package/dist/cjs/domain/models/routeInstance.js.map +0 -1
  96. package/dist/cjs/domain/models/routeStyle.js +0 -3
  97. package/dist/cjs/domain/models/routeStyle.js.map +0 -1
  98. package/dist/cjs/domain/models/scene3D.js +0 -3
  99. package/dist/cjs/domain/models/scene3D.js.map +0 -1
  100. package/dist/cjs/domain/models/transport.js +0 -22
  101. package/dist/cjs/domain/models/transport.js.map +0 -1
  102. package/dist/cjs/domain/ports/ICache.js +0 -3
  103. package/dist/cjs/domain/ports/ICache.js.map +0 -1
  104. package/dist/cjs/domain/ports/IHttpClient.js +0 -3
  105. package/dist/cjs/domain/ports/IHttpClient.js.map +0 -1
  106. package/dist/cjs/domain/ports/ILogger.js +0 -23
  107. package/dist/cjs/domain/ports/ILogger.js.map +0 -1
  108. package/dist/cjs/domain/ports/index.js +0 -10
  109. package/dist/cjs/domain/ports/index.js.map +0 -1
  110. package/dist/cjs/infrastructure/cache/CacheManager.js +0 -258
  111. package/dist/cjs/infrastructure/cache/CacheManager.js.map +0 -1
  112. package/dist/cjs/infrastructure/cache/LRUCache.js +0 -153
  113. package/dist/cjs/infrastructure/cache/LRUCache.js.map +0 -1
  114. package/dist/cjs/infrastructure/cache/PersistentCache.js +0 -168
  115. package/dist/cjs/infrastructure/cache/PersistentCache.js.map +0 -1
  116. package/dist/cjs/infrastructure/cache/cacheConfig.js +0 -70
  117. package/dist/cjs/infrastructure/cache/cacheConfig.js.map +0 -1
  118. package/dist/cjs/infrastructure/http/FetchHttpClient.js +0 -75
  119. package/dist/cjs/infrastructure/http/FetchHttpClient.js.map +0 -1
  120. package/dist/cjs/infrastructure/logging/MVXLogger.js +0 -80
  121. package/dist/cjs/infrastructure/logging/MVXLogger.js.map +0 -1
  122. package/dist/cjs/interfaces/cache.js +0 -3
  123. package/dist/cjs/interfaces/cache.js.map +0 -1
  124. package/dist/cjs/interfaces/healthResponse.js +0 -3
  125. package/dist/cjs/interfaces/healthResponse.js.map +0 -1
  126. package/dist/cjs/interfaces/institutionResponse.js +0 -3
  127. package/dist/cjs/interfaces/institutionResponse.js.map +0 -1
  128. package/dist/cjs/interfaces/metadata.js +0 -3
  129. package/dist/cjs/interfaces/metadata.js.map +0 -1
  130. package/dist/cjs/interfaces/placeResponse.js +0 -3
  131. package/dist/cjs/interfaces/placeResponse.js.map +0 -1
  132. package/dist/cjs/interfaces/routeCacheResponse.js +0 -3
  133. package/dist/cjs/interfaces/routeCacheResponse.js.map +0 -1
  134. package/dist/cjs/interfaces/routeResponse.js +0 -3
  135. package/dist/cjs/interfaces/routeResponse.js.map +0 -1
  136. package/dist/cjs/interfaces/styleResponse.js +0 -3
  137. package/dist/cjs/interfaces/styleResponse.js.map +0 -1
  138. package/dist/cjs/logger/logger.js +0 -78
  139. package/dist/cjs/logger/logger.js.map +0 -1
  140. package/dist/cjs/logger/sentry.js +0 -81
  141. package/dist/cjs/logger/sentry.js.map +0 -1
  142. package/dist/cjs/map/fitCamera.js +0 -124
  143. package/dist/cjs/map/fitCamera.js.map +0 -1
  144. package/dist/cjs/map/liveMapFitTransform.js +0 -180
  145. package/dist/cjs/map/liveMapFitTransform.js.map +0 -1
  146. package/dist/cjs/map/map.js +0 -2766
  147. package/dist/cjs/map/map.js.map +0 -1
  148. package/dist/cjs/map/mapInteractionOptions.js +0 -73
  149. package/dist/cjs/map/mapInteractionOptions.js.map +0 -1
  150. package/dist/cjs/map/scene3DController.js +0 -849
  151. package/dist/cjs/map/scene3DController.js.map +0 -1
  152. package/dist/cjs/repository/repository.js +0 -694
  153. package/dist/cjs/repository/repository.js.map +0 -1
  154. package/dist/cjs/repository/requester.js +0 -771
  155. package/dist/cjs/repository/requester.js.map +0 -1
  156. package/dist/cjs/sdk.js +0 -438
  157. package/dist/cjs/sdk.js.map +0 -1
  158. package/dist/cjs/utils/3d.js +0 -245
  159. package/dist/cjs/utils/3d.js.map +0 -1
  160. package/dist/cjs/utils/deckLayers.js +0 -153
  161. package/dist/cjs/utils/deckLayers.js.map +0 -1
  162. package/dist/cjs/utils/error.js +0 -19
  163. package/dist/cjs/utils/error.js.map +0 -1
  164. package/dist/cjs/utils/images.js +0 -25
  165. package/dist/cjs/utils/images.js.map +0 -1
  166. package/dist/cjs/utils/loadGlb.js +0 -190
  167. package/dist/cjs/utils/loadGlb.js.map +0 -1
  168. package/dist/cjs/utils/mapvxHostname.js +0 -21
  169. package/dist/cjs/utils/mapvxHostname.js.map +0 -1
  170. package/dist/cjs/utils/nav-functions.js +0 -150
  171. package/dist/cjs/utils/nav-functions.js.map +0 -1
  172. package/dist/cjs/utils/opening-hours-helper.js +0 -914
  173. package/dist/cjs/utils/opening-hours-helper.js.map +0 -1
  174. package/dist/cjs/utils/preconnect.js +0 -131
  175. package/dist/cjs/utils/preconnect.js.map +0 -1
  176. package/dist/cjs/utils/route-utils.js +0 -57
  177. package/dist/cjs/utils/route-utils.js.map +0 -1
  178. package/dist/cjs/utils/semaphore.js +0 -143
  179. package/dist/cjs/utils/semaphore.js.map +0 -1
  180. package/dist/cjs/utils/three.js +0 -113
  181. package/dist/cjs/utils/three.js.map +0 -1
  182. package/dist/cjs/utils/threeScene.js +0 -126
  183. package/dist/cjs/utils/threeScene.js.map +0 -1
  184. package/dist/cjs/utils/update-css.js +0 -76
  185. package/dist/cjs/utils/update-css.js.map +0 -1
  186. package/dist/cjs/utils/utils.js +0 -104
  187. package/dist/cjs/utils/utils.js.map +0 -1
  188. package/dist/es/domain/models/_rtl.d.ts +0 -7
  189. package/dist/es/domain/models/_rtl.d.ts.map +0 -1
  190. package/dist/es/domain/models/_rtl.js +0 -7
  191. package/dist/es/domain/models/_rtl.js.map +0 -1
package/dist/cjs/index.js CHANGED
@@ -1,96 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadStyles = exports.MAPVX_DEFAULT_PRECONNECT_HOSTS = exports.injectPreconnects = exports.isMapVxRequestHostname = exports.OpeningHoursHelper = exports.loadCustomization = exports.MVXTransport = exports.UnitSystem = exports.TransportationMode = exports.AnnounceFormat = exports.MVXRouteStep = exports.MVXRouteLeg = exports.MVXRoute = exports.MVXPlace = exports.TextPosition = exports.MAPLIBRE_MAX_TILE_CACHE_HARD_CAP = exports.DEFAULT_TILE_CACHE_CONFIG = exports.DEFAULT_MARKER_LAYOUT_CONFIG = exports.Institution = exports.isValidCircleConfig = exports.MAPVX_BRAND_COLOR = exports.CIRCLE_DEFAULTS = exports.circleRing = exports.isBasicWithLogo = exports.isBasicWithImageUrl = exports.isBasicWithIcon = exports.Campaign = exports.Banner = exports.createRouteAnimationIconDataUrl = exports.initializeSDK = exports.MVXLogger = exports.FetchHttpClient = exports.DEFAULT_MAX_STORAGE_BYTES = exports.DEFAULT_CACHE_CONFIGS = exports.CacheManager = exports.PersistentCache = exports.LRUCache = void 0;
4
- // ─── Infrastructure: Cache ───────────────────────────────────────────────────
5
- var LRUCache_1 = require("./infrastructure/cache/LRUCache");
6
- Object.defineProperty(exports, "LRUCache", { enumerable: true, get: function () { return LRUCache_1.LRUCache; } });
7
- var PersistentCache_1 = require("./infrastructure/cache/PersistentCache");
8
- Object.defineProperty(exports, "PersistentCache", { enumerable: true, get: function () { return PersistentCache_1.PersistentCache; } });
9
- var CacheManager_1 = require("./infrastructure/cache/CacheManager");
10
- Object.defineProperty(exports, "CacheManager", { enumerable: true, get: function () { return CacheManager_1.CacheManager; } });
11
- var cacheConfig_1 = require("./infrastructure/cache/cacheConfig");
12
- Object.defineProperty(exports, "DEFAULT_CACHE_CONFIGS", { enumerable: true, get: function () { return cacheConfig_1.DEFAULT_CACHE_CONFIGS; } });
13
- Object.defineProperty(exports, "DEFAULT_MAX_STORAGE_BYTES", { enumerable: true, get: function () { return cacheConfig_1.DEFAULT_MAX_STORAGE_BYTES; } });
14
- // ─── Infrastructure: HTTP ────────────────────────────────────────────────────
15
- var FetchHttpClient_1 = require("./infrastructure/http/FetchHttpClient");
16
- Object.defineProperty(exports, "FetchHttpClient", { enumerable: true, get: function () { return FetchHttpClient_1.FetchHttpClient; } });
17
- // ─── Infrastructure: Logging ─────────────────────────────────────────────────
18
- var MVXLogger_1 = require("./infrastructure/logging/MVXLogger");
19
- Object.defineProperty(exports, "MVXLogger", { enumerable: true, get: function () { return MVXLogger_1.MVXLogger; } });
20
- // ─── SDK ─────────────────────────────────────────────────────────────────────
21
- var sdk_1 = require("./sdk");
22
- Object.defineProperty(exports, "initializeSDK", { enumerable: true, get: function () { return sdk_1.initializeSDK; } });
23
- // ─── Domain Models: Assets / Icons ───────────────────────────────────────────
24
- var icons_1 = require("./assets/icons");
25
- Object.defineProperty(exports, "createRouteAnimationIconDataUrl", { enumerable: true, get: function () { return icons_1.createRouteAnimationIconDataUrl; } });
26
- // ─── Domain Models: Banner ───────────────────────────────────────────────────
27
- var banner_1 = require("./domain/models/banner");
28
- Object.defineProperty(exports, "Banner", { enumerable: true, get: function () { return banner_1.Banner; } });
29
- // ─── Domain Models: Campaigns ────────────────────────────────────────────────
30
- var campaign_1 = require("./domain/models/campaign");
31
- Object.defineProperty(exports, "Campaign", { enumerable: true, get: function () { return campaign_1.Campaign; } });
32
- // ─── Domain Models: Categories ───────────────────────────────────────────────
33
- var categories_1 = require("./domain/models/categories");
34
- Object.defineProperty(exports, "isBasicWithIcon", { enumerable: true, get: function () { return categories_1.isBasicWithIcon; } });
35
- Object.defineProperty(exports, "isBasicWithImageUrl", { enumerable: true, get: function () { return categories_1.isBasicWithImageUrl; } });
36
- Object.defineProperty(exports, "isBasicWithLogo", { enumerable: true, get: function () { return categories_1.isBasicWithLogo; } });
37
- // ─── Domain Models: Circle ───────────────────────────────────────────────────
38
- var circle_1 = require("./domain/models/circle");
39
- Object.defineProperty(exports, "circleRing", { enumerable: true, get: function () { return circle_1.circleRing; } });
40
- Object.defineProperty(exports, "CIRCLE_DEFAULTS", { enumerable: true, get: function () { return circle_1.CIRCLE_DEFAULTS; } });
41
- Object.defineProperty(exports, "MAPVX_BRAND_COLOR", { enumerable: true, get: function () { return circle_1.MAPVX_BRAND_COLOR; } });
42
- Object.defineProperty(exports, "isValidCircleConfig", { enumerable: true, get: function () { return circle_1.isValidCircleConfig; } });
43
- // ─── Domain Models: Institution ──────────────────────────────────────────────
44
- var institution_1 = require("./domain/models/institution");
45
- Object.defineProperty(exports, "Institution", { enumerable: true, get: function () { return institution_1.Institution; } });
46
- // ─── Domain Models: Map Config ───────────────────────────────────────────────
47
- var mapConfig_1 = require("./domain/models/mapConfig");
48
- Object.defineProperty(exports, "DEFAULT_MARKER_LAYOUT_CONFIG", { enumerable: true, get: function () { return mapConfig_1.DEFAULT_MARKER_LAYOUT_CONFIG; } });
49
- Object.defineProperty(exports, "DEFAULT_TILE_CACHE_CONFIG", { enumerable: true, get: function () { return mapConfig_1.DEFAULT_TILE_CACHE_CONFIG; } });
50
- Object.defineProperty(exports, "MAPLIBRE_MAX_TILE_CACHE_HARD_CAP", { enumerable: true, get: function () { return mapConfig_1.MAPLIBRE_MAX_TILE_CACHE_HARD_CAP; } });
51
- // ─── Domain Models: Marker ───────────────────────────────────────────────────
52
- var marker_1 = require("./domain/models/marker");
53
- Object.defineProperty(exports, "TextPosition", { enumerable: true, get: function () { return marker_1.TextPosition; } });
54
- // ─── Domain Models: Place ────────────────────────────────────────────────────
55
- var place_1 = require("./domain/models/place");
56
- Object.defineProperty(exports, "MVXPlace", { enumerable: true, get: function () { return place_1.MVXPlace; } });
57
- // ─── Domain Models: Route ────────────────────────────────────────────────────
58
- var route_1 = require("./domain/models/route");
59
- Object.defineProperty(exports, "MVXRoute", { enumerable: true, get: function () { return route_1.MVXRoute; } });
60
- Object.defineProperty(exports, "MVXRouteLeg", { enumerable: true, get: function () { return route_1.MVXRouteLeg; } });
61
- Object.defineProperty(exports, "MVXRouteStep", { enumerable: true, get: function () { return route_1.MVXRouteStep; } });
62
- // ─── Domain Models: Route Configuration ──────────────────────────────────────
63
- var routeConfiguration_1 = require("./domain/models/routeConfiguration");
64
- Object.defineProperty(exports, "AnnounceFormat", { enumerable: true, get: function () { return routeConfiguration_1.AnnounceFormat; } });
65
- Object.defineProperty(exports, "TransportationMode", { enumerable: true, get: function () { return routeConfiguration_1.TransportationMode; } });
66
- Object.defineProperty(exports, "UnitSystem", { enumerable: true, get: function () { return routeConfiguration_1.UnitSystem; } });
67
- // ─── Domain Models: Transport ────────────────────────────────────────────────
68
- var transport_1 = require("./domain/models/transport");
69
- Object.defineProperty(exports, "MVXTransport", { enumerable: true, get: function () { return transport_1.MVXTransport; } });
70
- // ─── Utils ───────────────────────────────────────────────────────────────────
71
- var update_css_1 = require("./utils/update-css");
72
- Object.defineProperty(exports, "loadCustomization", { enumerable: true, get: function () { return update_css_1.loadCustomization; } });
73
- var opening_hours_helper_1 = require("./utils/opening-hours-helper");
74
- Object.defineProperty(exports, "OpeningHoursHelper", { enumerable: true, get: function () { return opening_hours_helper_1.OpeningHoursHelper; } });
75
- var mapvxHostname_1 = require("./utils/mapvxHostname");
76
- Object.defineProperty(exports, "isMapVxRequestHostname", { enumerable: true, get: function () { return mapvxHostname_1.isMapVxRequestHostname; } });
77
- var preconnect_1 = require("./utils/preconnect");
78
- Object.defineProperty(exports, "injectPreconnects", { enumerable: true, get: function () { return preconnect_1.injectPreconnects; } });
79
- Object.defineProperty(exports, "MAPVX_DEFAULT_PRECONNECT_HOSTS", { enumerable: true, get: function () { return preconnect_1.MAPVX_DEFAULT_PRECONNECT_HOSTS; } });
80
- /**
81
- * Function to load default styles
82
- * @group Utils
83
- */
84
- const loadStyles = () => {
85
- // Check if styles are already loaded
86
- if (document.querySelector("link[data-mapvx-styles]")) {
87
- return;
88
- }
89
- const link = document.createElement("link");
90
- link.rel = "stylesheet";
91
- link.href = "./styles.css"; // Adjust path as needed
92
- link.setAttribute("data-mapvx-styles", "true");
93
- document.head.appendChild(link);
94
- };
95
- exports.loadStyles = loadStyles;
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ (()=>{var e={586(e){function t(e){const t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=586,e.exports=t},741(e){"use strict";e.exports=require("@deck.gl/geo-layers")},589(e){"use strict";e.exports=require("@deck.gl/layers")},452(e){"use strict";e.exports=require("@deck.gl/mapbox")},912(e){"use strict";e.exports=require("three")},502(e){"use strict";e.exports=require("three/addons/libs/meshopt_decoder.module.js")},303(e){"use strict";e.exports=require("three/addons/loaders/DRACOLoader.js")},833(e){"use strict";e.exports=require("three/addons/loaders/GLTFLoader.js")},373(e){"use strict";e.exports=require("three/addons/loaders/KTX2Loader.js")}};const t={};function r(i){const n=t[i];if(void 0!==n)return n.exports;const a=t[i]={exports:{}};return e[i](a,a.exports,r),a.exports}(()=>{const e=Object.getPrototypeOf;let t;r.t=function(i,n){if(1&n&&(i=this(i)),8&n)return i;if("object"==typeof i&&i){if(4&n&&i.__esModule)return i;if(16&n&&"function"==typeof i.then)return i}const a=Object.create(null);r.r(a);const o={};t=t||[null,e({}),e([]),e(e)];for(var s=2&n&&i;("object"==typeof s||"function"==typeof s)&&!~t.indexOf(s);s=e(s))Object.getOwnPropertyNames(s).forEach(e=>o[e]=()=>i[e]);return o.default=()=>i,r.d(a,o),a}})(),r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};let i={};(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||n(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){if(e){if("string"==typeof e)return a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function o(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,l(i.key),i)}}function s(e,t,r){return(t=l(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(t){var r=function(t){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,"string");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:r+""}r.r(i),r.d(i,{AnnounceFormat:()=>lF,Banner:()=>D,CIRCLE_DEFAULTS:()=>EF,CacheManager:()=>K,Campaign:()=>aR,DEFAULT_CACHE_CONFIGS:()=>m,DEFAULT_MARKER_LAYOUT_CONFIG:()=>jF,DEFAULT_MAX_STORAGE_BYTES:()=>f,DEFAULT_TILE_CACHE_CONFIG:()=>OF,FetchHttpClient:()=>se,Institution:()=>cR,LRUCache:()=>u,MAPLIBRE_MAX_TILE_CACHE_HARD_CAP:()=>BF,MAPVX_BRAND_COLOR:()=>TF,MAPVX_DEFAULT_PRECONNECT_HOSTS:()=>yO,MVXLogger:()=>La,MVXPlace:()=>B,MVXRoute:()=>YF,MVXRouteLeg:()=>JF,MVXRouteStep:()=>QF,MVXTransport:()=>mR,OpeningHoursHelper:()=>fO,PersistentCache:()=>w,TextPosition:()=>lM,TransportationMode:()=>cF,UnitSystem:()=>uF,circleRing:()=>kF,createRouteAnimationIconDataUrl:()=>Zk,initializeSDK:()=>Jz,injectPreconnects:()=>_O,isBasicWithIcon:()=>tO,isBasicWithImageUrl:()=>rO,isBasicWithLogo:()=>eO,isMapVxRequestHostname:()=>gR,isValidCircleConfig:()=>IF,loadCustomization:()=>aO,loadStyles:()=>xO});var u=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),s(this,"hits",0),s(this,"misses",0),s(this,"accessCounter",0),this.cache=new Map,this.maxItems=t.maxItems,this.ttlMs=t.ttlMs},(r=[{key:"get",value:function(e){var t=this.cache.get(e);if(t)return this.ttlMs>0&&this.isExpired(t)?(this.cache.delete(e),void this.misses++):(t.accessTime=++this.accessCounter,this.hits++,t.value);this.misses++}},{key:"set",value:function(e,t){var r=Date.now(),i=++this.accessCounter;this.cache.has(e)||this.cache.size>=this.maxItems&&this.evictLRU(),this.cache.set(e,{value:t,timestamp:r,accessTime:i})}},{key:"has",value:function(e){var t=this.cache.get(e);return!(!t||this.ttlMs>0&&this.isExpired(t)&&(this.cache.delete(e),1))}},{key:"delete",value:function(e){return this.cache.delete(e)}},{key:"clear",value:function(){this.cache.clear(),this.hits=0,this.misses=0}},{key:"keys",value:function(){return Array.from(this.cache.keys())}},{key:"getStats",value:function(){var e=this.hits+this.misses,t=e>0?this.hits/e*100:void 0;return{size:this.cache.size,maxItems:this.maxItems,hitRate:t}}},{key:"isExpired",value:function(e){return Date.now()-e.timestamp>this.ttlMs}},{key:"evictLRU",value:function(){var e,r=null,i=1/0,a=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=n(e))){t&&(e=t);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw a}}}}(this.cache);try{for(a.s();!(e=a.n()).done;){var o=t(e.value,2),s=o[0],l=o[1];l.accessTime<i&&(i=l.accessTime,r=s)}}catch(e){a.e(e)}finally{a.f()}null!==r&&this.cache.delete(r)}}])&&o(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,r}();function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?h(Object(r),!0).forEach(function(t){p(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function p(e,t,r){return(t=function(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f=5242880,m={places:{maxItems:500,ttlMs:18e5,persistenceKey:"mvx_places"},routes:{maxItems:100,ttlMs:3e5,persistenceKey:"mvx_routes"},accessibleRoutes:{maxItems:100,ttlMs:3e5,persistenceKey:"mvx_accessible_routes"},configurations:{maxItems:10,ttlMs:36e5,persistenceKey:"mvx_configurations"},categories:{maxItems:20,ttlMs:36e5,persistenceKey:"mvx_categories"},vehicles:{maxItems:50,ttlMs:6e4,persistenceKey:"mvx_vehicles"},stops:{maxItems:100,ttlMs:6e4,persistenceKey:"mvx_stops"},subPlaces:{maxItems:200,ttlMs:9e5,persistenceKey:"mvx_subplaces"}};function g(e,t){return d(d({},m[e]),t)}function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function _(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return v(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function b(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,x(i.key),i)}}function x(e){var t=function(e){if("object"!=y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==y(t)?t:t+""}var w=function(){return e=function e(t,r,i){var n,a,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n=this,o=!0,(a=x(a="storageAvailable"))in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o,this.lruCache=new u(t),this.persistenceKey=t.persistenceKey||"mvx_cache",this.maxStorageBytes=null!=r?r:f,this.ttlMs=t.ttlMs,this.deserialize=i,this.hydrate()},(t=[{key:"get",value:function(e){return this.lruCache.get(e)}},{key:"set",value:function(e,t){this.lruCache.set(e,t),this.persist()}},{key:"has",value:function(e){return this.lruCache.has(e)}},{key:"delete",value:function(e){var t=this.lruCache.delete(e);return t&&this.persist(),t}},{key:"clear",value:function(){this.lruCache.clear(),this.removeFromStorage()}},{key:"keys",value:function(){return this.lruCache.keys()}},{key:"getStats",value:function(){return this.lruCache.getStats()}},{key:"hydrate",value:function(){if(this.isStorageAvailable())try{var e=localStorage.getItem(this.persistenceKey);if(!e)return;var t=JSON.parse(e);if(!t.entries||!Array.isArray(t.entries))return;var r,i=Date.now(),n=_(t.entries);try{for(n.s();!(r=n.n()).done;){var a=r.value;this.ttlMs>0&&i-a.timestamp>this.ttlMs||this.lruCache.set(a.key,this.deserialize?this.deserialize(a.value):a.value)}}catch(e){n.e(e)}finally{n.f()}}catch(e){this.storageAvailable=this.isStorageAvailable()}else this.storageAvailable=!1}},{key:"persist",value:function(){if(this.storageAvailable)try{var e,t=[],r=_(this.lruCache.keys());try{for(r.s();!(e=r.n()).done;){var i=e.value,n=this.lruCache.get(i);void 0!==n&&t.push({key:i,value:n,timestamp:Date.now(),accessTime:Date.now()})}}catch(e){r.e(e)}finally{r.f()}var a={entries:t},o=JSON.stringify(a);if(o.length>this.maxStorageBytes)return;localStorage.setItem(this.persistenceKey,o)}catch(e){this.storageAvailable=!1}}},{key:"removeFromStorage",value:function(){if(this.storageAvailable)try{localStorage.removeItem(this.persistenceKey)}catch(e){}}},{key:"isStorageAvailable",value:function(){try{var e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}}])&&b(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}function T(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,E(i.key),i)}}function P(e,t,r){return t&&T(e.prototype,t),r&&T(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function E(e){var t=function(e){if("object"!=S(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==S(t)?t:t+""}var D=P(function e(t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t.url,this.tags=null!==(r=t.tags)&&void 0!==r?r:[],this.urlAction=t.url_action,this.sameLink=t.sameLink,this.description=t.description});function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function I(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,C(i.key),i)}}function C(e){var t=function(e){if("object"!=A(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=A(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==A(t)?t:t+""}var k=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},(t=[{key:"parseProperties",value:function(e){var t=this;try{var r=[];return e&&e.forEach(function(e){if(e.child_places){var i,n=e.child_places,a={childPlaces:[],title:e.key,subtitle:e.text,childParentPlace:e.child_parent_place,icon:e.icon,imageUrl:e.imageUrl,iconPrefix:null!==(i=e.iconPrefix)&&void 0!==i?i:"fas",sortChildrenBy:e.sortChildrenBy};n.forEach(function(e){if("string"==typeof e)a.childPlaces.push(e);else{var t=new B(e);a.childPlaces.push(t)}}),r.push(a)}else if(e.child_properties){var o,s=e.child_properties,l={childProperties:[],title:e.key,subtitle:e.text,childParentPlace:e.child_parent_place,icon:e.icon,imageUrl:e.imageUrl,iconPrefix:null!==(o=e.iconPrefix)&&void 0!==o?o:"fas",sortChildrenBy:e.sortChildrenBy},u=t.parseProperties(s);l.childProperties=u,r.push(l)}else if(e.url){var c={title:e.key,subtitle:e.text,icon:e.icon,imageUrl:e.imageUrl,iconPrefix:e.iconPrefix,url:e.url,type:e.type,sortChildrenBy:e.sortChildrenBy};r.push(c)}else{var h,d={title:e.key,subtitle:e.text,childParentPlace:e.child_parent_place,icon:e.icon,imageUrl:e.imageUrl,type:e.type,iconPrefix:null!==(h=e.iconPrefix)&&void 0!==h?h:"fas",sortChildrenBy:e.sortChildrenBy};r.push(d)}}),r}catch(t){return console.log(t),console.log(e),[]}}}])&&I(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function F(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?F(Object(r),!0).forEach(function(t){L(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function L(e,t,r){return(t=O(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,O(i.key),i)}}function O(e){var t=function(e){if("object"!=M(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=M(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==M(t)?t:t+""}var B=function(){function e(t){var r,i,n,a,o,s,l,u,c,h;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var d=(null!==(r=t.tags)&&void 0!==r?r:[]).concat(null!==(i=t.keywords)&&void 0!==i?i:[]);for(var p in this.mapvxId=t.id,this.clientId=null!==(n=t.alias)&&void 0!==n?n:t.externalId,this.title=t.title,this.hidePlace=d.includes("hide_search"),this.description=t.description,this.shortDescription=t.shortDescription,this.position={lat:t.lat,lng:t.lng||t.lon},this.category=t.category,this.tags=null!==(a=t.tags)&&void 0!==a?a:[],this.generalCategory=t.general_category,this.localizedCategory=null!==(o=t.localizedCategory)&&void 0!==o?o:"",this.parentInstitutionId=t.parent_institution,this.inFloors=t.inFloor,this.innerFloors=[],t.innerFloors)this.innerFloors.push(R(R({},t.innerFloors[p]),{},{key:p}));this.innerFloors.sort(function(e,t){return e.index-t.index}),this.openingHours=t.opening_hours,this.address=t.address,this.transportLine=null===(s=t.properties)||void 0===s?void 0:s.filter(function(e){return"transport_line"===e.type}),t.logo&&(this.logo="string"==typeof t.logo?t.logo:t.logo.light),this.images=null!==(l=t.images)&&void 0!==l?l:[],this.banners=(null!==(u=t.banners)&&void 0!==u?u:[]).map(function(e){return new D(e)}),this.properties=k.parseProperties(null!==(c=t.properties)&&void 0!==c?c:[]),this.parentId=t.parent_id,this.parentType=t.parent_type,this.metadata=t.metadata,this.visibility=null!==(h=t.visibility)&&void 0!==h?h:"public"}return t=e,i=[{key:"fromCache",value:function(t){return t instanceof e||null===t||"object"!==M(t)?t:Object.assign(Object.create(e.prototype),t)}}],(r=[{key:"inFloor",value:function(e){var t=this;return this.inFloors&&0!==this.inFloors.length?e.find(function(e){var r;return e.key===(null===(r=t.inFloors)||void 0===r?void 0:r[0])}):e.find(function(e){return e.reachableFromGPS})}},{key:"toString",value:function(){return"MVXPlace ".concat(this.mapvxId)}}])&&z(t.prototype,r),i&&z(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,i}();function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||V(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=V(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function V(e,t){if(e){if("string"==typeof e)return $(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?$(e,t):void 0}}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function G(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,H(i.key),i)}}function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?q(Object(r),!0).forEach(function(t){W(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function W(e,t,r){return(t=H(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H(e){var t=function(e){if("object"!=j(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==j(t)?t:t+""}var X={places:function(e){return B.fromCache(e)},subPlaces:function(e){var t=e;return t&&Array.isArray(t.data)?Z(Z({},t),{},{data:t.data.map(function(e){return B.fromCache(e)})}):e}},K=function(){return e=function e(t){var r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.caches=new Map,this.persistent=null!==(r=null==t?void 0:t.persistent)&&void 0!==r&&r,this.maxStorageBytes=null!==(i=null==t?void 0:t.maxStorageBytes)&&void 0!==i?i:f;for(var n=0,a=["places","routes","accessibleRoutes","configurations","categories","vehicles","stops","subPlaces"];n<a.length;n++){var o,s=a[n],l=g(s,null==t||null===(o=t.configs)||void 0===o?void 0:o[s]);this.caches.set(s,this.createCache(l,X[s]))}},t=[{key:"createCache",value:function(e,t){return this.persistent&&e.persistenceKey?new w(e,this.maxStorageBytes,t):new u(e)}},{key:"makeKey",value:function(e,t){return"".concat(e,"_").concat(t)}},{key:"makeConfigKey",value:function(e,t,r){return"".concat(e||"default","_").concat(t||"default","_").concat(r)}},{key:"getPlace",value:function(e,t){return this.caches.get("places").get(this.makeKey(e,t))}},{key:"setPlace",value:function(e,t,r){this.caches.get("places").set(this.makeKey(e,r),t)}},{key:"hasPlace",value:function(e,t){return this.caches.get("places").has(this.makeKey(e,t))}},{key:"getRoute",value:function(e){return this.caches.get("routes").get(e)}},{key:"setRoute",value:function(e,t){this.caches.get("routes").set(e,t)}},{key:"cleanRoutesCache",value:function(){this.caches.get("routes").clear()}},{key:"getAccessibleRoute",value:function(e){return this.caches.get("accessibleRoutes").get(e)}},{key:"setAccessibleRoute",value:function(e,t){this.caches.get("accessibleRoutes").set(e,t)}},{key:"cleanAccessibleRoutesCache",value:function(){this.caches.get("accessibleRoutes").clear()}},{key:"getConfiguration",value:function(e,t,r){return this.caches.get("configurations").get(this.makeConfigKey(e,t,r))}},{key:"setConfiguration",value:function(e,t,r,i){this.caches.get("configurations").set(this.makeConfigKey(e,t,r),i)}},{key:"getCategories",value:function(e,t){return this.caches.get("categories").get(this.makeKey(e||"default",t))}},{key:"setCategories",value:function(e,t,r){this.caches.get("categories").set(this.makeKey(e||"default",t),r)}},{key:"getVehicle",value:function(e,t){return this.caches.get("vehicles").get(this.makeKey(e,t))}},{key:"setVehicle",value:function(e,t,r){this.caches.get("vehicles").set(this.makeKey(e,r),t)}},{key:"getStops",value:function(e,t){return this.caches.get("stops").get(this.makeKey(e,t))}},{key:"setStops",value:function(e,t,r){this.caches.get("stops").set(this.makeKey(e,r),t)}},{key:"getSubPlaces",value:function(e,t){return this.caches.get("subPlaces").get(this.makeKey(e,t))}},{key:"setSubPlaces",value:function(e,t,r){this.caches.get("subPlaces").set(this.makeKey(e,t),r)}},{key:"cleanAllCache",value:function(){var e,t=U(this.caches.values());try{for(t.s();!(e=t.n()).done;)e.value.clear()}catch(e){t.e(e)}finally{t.f()}}},{key:"cleanLanguageCache",value:function(e){for(var t="_".concat(e),r=0,i=["places","configurations","categories","vehicles","stops","subPlaces"];r<i.length;r++){var n,a=i[r],o=this.caches.get(a),s=U(o.keys());try{for(s.s();!(n=s.n()).done;){var l=n.value;l.endsWith(t)&&o.delete(l)}}catch(e){s.e(e)}finally{s.f()}}}},{key:"getCacheStats",value:function(e){var t=this.caches.get(e);return t?t.getStats():{size:0,maxItems:0}}},{key:"getAllCacheStats",value:function(){var e,t={},r=U(this.caches);try{for(r.s();!(e=r.n()).done;){var i=N(e.value,2),n=i[0],a=i[1];t[n]=a.getStats()}}catch(e){r.e(e)}finally{r.f()}return t}}],t&&G(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Y(e){return Y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Y(e)}function J(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?J(Object(r),!0).forEach(function(t){ee(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):J(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ee(e,t,r){return(t=oe(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function te(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var l=i&&i.prototype instanceof s?i:s,u=Object.create(l.prototype);return re(u,"_invoke",function(r,i,n){var a,s,l,u=0,c=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,s=0,l=e,d.n=r,o}};function p(r,i){for(s=r,l=i,t=0;!h&&u&&!n&&t<c.length;t++){var n,a=c[t],p=d.p,f=a[2];r>3?(n=f===i)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((n=r<2&&p<a[1])?(s=0,d.v=i,d.n=a[1]):p<f&&(n=r<3||a[0]>i||i>f)&&(a[4]=r,a[5]=i,d.n=f,s=0))}if(n||r>1)return o;throw h=!0,i}return function(n,c,f){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,f),s=c,l=f;(t=s<2?e:l)||!h;){a||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(u=2,a){if(s||(n="next"),t=a[n]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);a=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==o)break}catch(t){a=e,s=1,l=t}finally{u=1}}return{value:t,done:h}}}(r,n,a),!0),u}var o={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):(re(t={},i,function(){return this}),t),h=u.prototype=s.prototype=Object.create(c);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,re(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,re(h,"constructor",u),re(u,"constructor",l),l.displayName="GeneratorFunction",re(u,n,"GeneratorFunction"),re(h),re(h,n,"Generator"),re(h,i,function(){return this}),re(h,"toString",function(){return"[object Generator]"}),(te=function(){return{w:a,m:d}})()}function re(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}re=function(e,t,r,i){function a(t,r){re(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},re(e,t,r,i)}function ie(e,t,r,i,n,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function ne(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(e){ie(a,i,n,o,s,"next",e)}function s(e){ie(a,i,n,o,s,"throw",e)}o(void 0)})}}function ae(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,oe(i.key),i)}}function oe(e){var t=function(e){if("object"!=Y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Y(t)?t:t+""}var se=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},t=[{key:"get",value:function(){var e=ne(te().m(function e(t,r){return te().w(function(e){for(;;)if(0===e.n)return e.a(2,this.request(t,"GET",void 0,r))},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"post",value:(a=ne(te().m(function e(t,r,i){return te().w(function(e){for(;;)if(0===e.n)return e.a(2,this.request(t,"POST",r,i))},e,this)})),function(e,t,r){return a.apply(this,arguments)})},{key:"put",value:(n=ne(te().m(function e(t,r,i){return te().w(function(e){for(;;)if(0===e.n)return e.a(2,this.request(t,"PUT",r,i))},e,this)})),function(e,t,r){return n.apply(this,arguments)})},{key:"delete",value:(i=ne(te().m(function e(t,r){return te().w(function(e){for(;;)if(0===e.n)return e.a(2,this.request(t,"DELETE",void 0,r))},e,this)})),function(e,t){return i.apply(this,arguments)})},{key:"request",value:(r=ne(te().m(function e(t,r,i,n){var a,o,s,l;return te().w(function(e){for(;;)switch(e.n){case 0:return a=Q({},null==n?void 0:n.headers),void 0===i||a["Content-Type"]||(a["Content-Type"]="application/json"),o={method:r,headers:a},void 0!==i&&(o.body=JSON.stringify(i)),e.n=1,fetch(t,o);case 1:return s=e.v,e.n=2,s.json();case 2:return l=e.v,e.a(2,{ok:s.ok,status:s.status,statusText:s.statusText,data:l})}},e)})),function(e,t,i,n){return r.apply(this,arguments)})}],t&&ae(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,i,n,a}();const le="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,ue="10.74.0",ce=globalThis;function he(){return de(ce),ce}function de(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||ue,t[ue]=t[ue]||{}}function pe(e,t,r=ce){const i=r.__SENTRY__=r.__SENTRY__||{},n=i[ue]=i[ue]||{};return n[e]||(n[e]=t())}const fe=["debug","info","warn","error","log","assert","trace"],me={};function ge(e){if(!("console"in ce))return e();const t=ce.console,r={},i=Object.keys(me);i.forEach(e=>{const i=me[e];r[e]=t[e],t[e]=i});try{return e()}finally{i.forEach(e=>{t[e]=r[e]})}}function ye(){return ve().enabled}function _e(e,...t){le&&ye()&&ge(()=>{ce.console[e](`Sentry Logger [${e}]:`,...t)})}function ve(){return le?pe("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const be={enable:function(){ve().enabled=!0},disable:function(){ve().enabled=!1},isEnabled:ye,log:function(...e){_e("log",...e)},warn:function(...e){_e("warn",...e)},error:function(...e){_e("error",...e)}},xe=[];function we(e,t){for(const r of t)r?.afterAllSetup&&r.afterAllSetup(e)}function Se(e,t,r){if(r[t.name])le&&be.log(`Integration skipped because it was already installed: ${t.name}`);else{if(r[t.name]=t,xe.includes(t.name)||"function"!=typeof t.setupOnce||(t.setupOnce(),xe.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),"function"==typeof t.preprocessEvent){const r=t.preprocessEvent.bind(t);e.on("preprocessEvent",(t,i)=>r(t,i,e))}if("function"==typeof t.processEvent){const r=t.processEvent.bind(t),i=Object.assign((t,i)=>r(t,i,e),{id:t.name});e.addEventProcessor(i)}["processSpan","processSegmentSpan"].forEach(r=>{const i=t[r];"function"==typeof i&&e.on(r,r=>i.call(t,r,e))}),le&&be.log(`Integration installed: ${t.name}`)}}function Te(e){const t=[];e.message&&t.push(e.message);try{const r=e.exception.values[e.exception.values.length-1];r?.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`))}catch{}return t}const Pe=Object.prototype.toString;function Ee(e){switch(Pe.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Oe(e,Error)}}function De(e,t){return Pe.call(e)===`[object ${t}]`}function Ae(e){return De(e,"ErrorEvent")}function Ie(e){return De(e,"DOMError")}function Ce(e){return De(e,"String")}function ke(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function Me(e){return null===e||ke(e)||"object"!=typeof e&&"function"!=typeof e}function Fe(e){return De(e,"Object")}function Re(e){return"object"==typeof e&&null!==e}function Le(e){return"undefined"!=typeof Event&&Oe(e,Event)}function ze(e){return Boolean(e?.then&&"function"==typeof e.then)}function Oe(e,t){try{return e instanceof t}catch{return!1}}function Be(e){return"undefined"!=typeof Request&&Oe(e,Request)}function je(e,t,r){if(!(t in e))return;const i=e[t];if("function"!=typeof i)return;const n=r(i);"function"==typeof n&&Ue(n,i);try{e[t]=n}catch{le&&be.log(`Failed to replace method "${t}" in object`,e)}}function Ne(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{le&&be.log(`Failed to add non-enumerable property "${String(t)}" to object`,e)}}function Ue(e,t){try{const r=t.prototype||{};e.prototype=t.prototype=r,Ne(e,"__sentry_original__",t)}catch{}}function Ve(e){return e.__sentry_original__}function $e(e){if(Ee(e))return{message:e.message,name:e.name,stack:e.stack,...Ge(e)};if(Le(e)){const{type:t,target:r,currentTarget:i,detail:n}=e;return{type:t,target:r,currentTarget:i,...n?{detail:n}:{},...Ge(e)}}return e}function Ge(e){return Re(e)?Object.fromEntries(Object.entries(e)):{}}let qe,Ze;function We(e){if(void 0!==qe)return qe?qe(e):e();const t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),r=ce;return t in r&&"function"==typeof r[t]?(qe=r[t],qe(e)):(qe=null,e())}function He(){return We(()=>Math.random())}function Xe(){return We(()=>Date.now())}function Ke(e=function(){const e=ce;return e.crypto||e.msCrypto}()){try{if(e?.randomUUID)return We(()=>e.randomUUID()).replace(/-/g,"")}catch{}return Ze||(Ze="10000000100040008000100000000000"),Ze.replace(/[018]/g,e=>(e^(16*He()&15)>>e/4).toString(16))}function Ye(e){return e.exception?.values?.[0]}function Je(e){const{message:t,event_id:r}=e;if(t)return t;const i=Ye(e);return i?i.type&&i.value?`${i.type}: ${i.value}`:i.type||i.value||r||"<unknown>":r||"<unknown>"}function Qe(e,t,r){const i=e.exception=e.exception||{},n=i.values=i.values||[],a=n[0]=n[0]||{};a.value||(a.value=t||""),a.type||(a.type=r||"Error")}function et(e,t){const r=Ye(e);if(!r)return;const i=r.mechanism;if(r.mechanism={type:"generic",handled:!0,...i,...t},t&&"data"in t){const e={...i?.data,...t.data};r.mechanism.data=e}}function tt(e){if(function(e){try{return e.__sentry_captured__}catch{}}(e))return!0;try{Ne(e,"__sentry_captured__",!0)}catch{}return!1}const rt=Symbol.for("sentry.skipNormalization"),it=Symbol.for("sentry.overrideNormalizationDepth"),nt=/\(error: (.*)\)/,at=/captureMessage|captureException/;function ot(e){return e[e.length-1]||{}}const st="<anonymous>";function lt(e){try{return e&&"function"==typeof e&&e.name||st}catch{return st}}function ut(e){const t=e.exception;if(t){const e=[];try{return t.values.forEach(t=>{t.stacktrace.frames&&e.push(...t.stacktrace.frames)}),e}catch{return}}}function ct(e,t=100,r=1/0){try{return dt("",e,t,r)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function ht(e,t=3,r=102400){const i=ct(e,t);return n=i,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(n))>r?ht(e,t-1,r):i;var n}function dt(e,t,r=1/0,i=1/0,n=function(){const e=new WeakSet;return[function(t){return!!e.has(t)||(e.add(t),!1)},function(t){e.delete(t)}]}()){const[a,o]=n;if(null==t||["boolean","string"].includes(typeof t)||"number"==typeof t&&Number.isFinite(t))return t;const s=pt(0,t);if(!s.startsWith("[object "))return s;if(function(e){return Boolean(e[rt])}(t))return t;const l=function(e){const t=e[it];return"number"==typeof t?t:void 0}(t),u=void 0!==l?l:r;if(0===u)return s.replace("object ","");if(a(t))return"[Circular ~]";const c=t;if(c&&"function"==typeof c.toJSON)try{return dt("",c.toJSON(),u-1,i,n)}catch{}const h=Array.isArray(t)?[]:{};let d=0;const p=$e(t);for(const e in p){if(!Object.prototype.hasOwnProperty.call(p,e))continue;if(d>=i){h[e]="[MaxProperties ~]";break}const t=p[e];h[e]=dt(e,t,u-1,i,n),d++}return o(t),h}function pt(e,t){try{if("undefined"!=typeof global&&t===global)return"[Global]";if("number"==typeof t&&!Number.isFinite(t))return`[${t}]`;if("function"==typeof t)return`[Function: ${lt(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const e=function(e){const t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}(t);return`[object ${e}]`}catch(e){return`**non-serializable** (${e})`}}function ft(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function mt(e,t){if(!Array.isArray(e))return"";const r=[];for(let t=0;t<e.length;t++){const i=e[t];Me(i)?r.push(String(i)):i instanceof Error?r.push(i.message?`${i.name}: ${i.message}`:i.name):r.push(pt(0,i))}return r.join(t)}function gt(e,t,r=!1){return!!Ce(e)&&(De(t,"RegExp")?t.test(e):Ce(t)?r?e===t:e.includes(t):"function"==typeof t&&t(e))}function yt(e,t=[],r=!1){for(const i of t)if(gt(e,i,r))return!0;return!1}const _t=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/Java exception was raised during method invocation$/,/Java object is gone$/],vt=(e={})=>{let t;return{name:"EventFilters",setup(r){const i=r.getOptions();t=xt(e,i)},processEvent(r,i,n){if(!t){const r=n.getOptions();t=xt(e,r)}return function(e,t){if(e.type){if("transaction"===e.type&&function(e,t){if(!t?.length)return!1;const r=e.transaction;return!!r&&yt(r,t)}(e,t.ignoreTransactions))return le&&be.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${Je(e)}`),!0}else{if(function(e,t){return!!t?.length&&Te(e).some(e=>yt(e,t))}(e,t.ignoreErrors))return le&&be.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${Je(e)}`),!0;if(function(e){return!!e.exception?.values?.length&&(!e.message&&!e.exception.values.some(e=>e.stacktrace||e.type&&"Error"!==e.type||e.value))}(e))return le&&be.warn(`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${Je(e)}`),!0;if(function(e,t){if(!t?.length)return!1;const r=wt(e);return!!r&&yt(r,t)}(e,t.denyUrls))return le&&be.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${Je(e)}.\nUrl: ${wt(e)}`),!0;if(!function(e,t){if(!t?.length)return!0;const r=wt(e);return!r||yt(r,t)}(e,t.allowUrls))return le&&be.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${Je(e)}.\nUrl: ${wt(e)}`),!0}return!1}(r,t)?null:r}}},bt=(e={})=>({...vt(e),name:"InboundFilters"});function xt(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:_t],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function wt(e){try{const t=[...e.exception?.values??[]].reverse().find(e=>void 0===e.mechanism?.parent_id&&e.stacktrace?.frames?.length),r=t?.stacktrace?.frames;return r?function(e=[]){for(let t=e.length-1;t>=0;t--){const r=e[t];if(r&&"<anonymous>"!==r.filename&&"[native code]"!==r.filename)return r.filename||null}return null}(r):null}catch{return le&&be.error(`Cannot extract url for event ${Je(e)}`),null}}function St(){return Xe()/1e3}let Tt;function Pt(){return(Tt??(Tt=function(){const{performance:e}=ce;if(!e?.now||!e.timeOrigin)return St;const t=e.timeOrigin;return()=>(t+We(()=>e.now()))/1e3}()))()}function Et(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Pt(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:Ke()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Dt(e,t,r=2){if(!t||"object"!=typeof t||r<=0)return t;if(e&&0===Object.keys(t).length)return e;const i={...e};for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=Dt(i[e],t[e],r-1));return i}function At(){return Ke()}function It(){return Ke().substring(16)}function Ct(e){if(e){if("object"==typeof e&&"deref"in e&&"function"==typeof e.deref)try{return e.deref()}catch{return}return e}}const kt="_sentrySpan";function Mt(e,t){t?Ne(e,kt,function(e){try{const t=ce.WeakRef;if("function"==typeof t)return new t(e)}catch{}return e}(t)):delete e[kt]}function Ft(e){return Ct(e[kt])}class Rt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:At(),sampleRand:He()}}clone(){const e=new Rt;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,Mt(e,Ft(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Et(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this.setTags({[e]:t})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,t){return this.setAttributes({[e]:t})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e,r=t instanceof Rt?t.getScopeData():Fe(t)?e:void 0,{tags:i,attributes:n,extra:a,user:o,contexts:s,level:l,fingerprint:u=[],propagationContext:c,conversationId:h}=r||{};return this._tags={...this._tags,...i},this._attributes={...this._attributes,...n},this._extra={...this._extra,...a},this._contexts={...this._contexts,...s},o&&Object.keys(o).length&&(this._user=o),l&&(this._level=l),u.length&&(this._fingerprint=u),c&&(this._propagationContext=c),h&&(this._conversationId=h),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Mt(this,void 0),this._attachments=[],this.setPropagationContext({traceId:At(),sampleRand:He()}),this._notifyScopeListeners(),this}addBreadcrumb(e,t){const r="number"==typeof t?t:100;if(r<=0)return this;const i={timestamp:St(),...e,message:e.message?ft(e.message,2048):e.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Ft(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Dt(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const r=t?.event_id||Ke();if(!this._client)return le&&be.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...t,event_id:r},this),r}captureMessage(e,t,r){const i=r?.event_id||Ke();if(!this._client)return le&&be.warn("No client configured on scope - will not capture message!"),i;const n=r?.syntheticException??new Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:n,...r,event_id:i},this),i}captureEvent(e,t){const r=e.event_id||t?.event_id||Ke();return this._client?(this._client.captureEvent(e,{...t,event_id:r},this),r):(le&&be.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}const Lt=e=>e instanceof Promise&&!e[zt],zt=Symbol("chained PromiseLike");class Ot{constructor(e,t){let r,i;r=e||new Rt,i=t||new Rt,this._stack=[{scope:r}],this._isolationScope=i}withScope(e){const t=this._pushScope();let r;try{r=e(t)}catch(e){throw this._popScope(),e}return ze(r)?((e,t,r)=>{const i=e.then(e=>(t(),e),e=>{throw r(),e});return Lt(i)&&Lt(e)?i:((e,t)=>{if(!t)return e;let r=!1;for(const i in e){if(i in t)continue;r=!0;const n=e[i];"function"==typeof n?Object.defineProperty(t,i,{value:(...t)=>n.apply(e,t),enumerable:!0,configurable:!0,writable:!0}):t[i]=n}return r&&Object.assign(t,{[zt]:!0}),t})(e,i)})(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return!(this._stack.length<=1||!this._stack.pop())}}function Bt(){const e=de(he());return e.stack=e.stack||new Ot(pe("defaultCurrentScope",()=>new Rt),pe("defaultIsolationScope",()=>new Rt))}function jt(e){return Bt().withScope(e)}function Nt(e,t){const r=Bt();return r.withScope(()=>(r.getStackTop().scope=e,t(e)))}function Ut(e){return Bt().withScope(()=>e(Bt().getIsolationScope()))}function Vt(e){const t=de(e);return t.acs?t.acs:{withIsolationScope:Ut,withScope:jt,withSetScope:Nt,withSetIsolationScope:(e,t)=>Ut(t),getCurrentScope:()=>Bt().getScope(),getIsolationScope:()=>Bt().getIsolationScope()}}function $t(){return Vt(he()).getCurrentScope()}function Gt(){return Vt(he()).getIsolationScope()}function qt(){return $t().getClient()}function Zt(e){const t=void 0;const r=e.getPropagationContext(),{traceId:i,parentSpanId:n,propagationSpanId:a}=r,o={trace_id:i,span_id:a||It()};return n&&(o.parent_span_id=n),o}const Wt=new WeakMap,Ht=()=>({name:"FunctionToString",setupOnce(){const e=Function.prototype.toString;try{Function.prototype.toString=function(...t){const r=Ve(this);let i;try{Wt.has(qt())&&void 0!==r&&(i=r)}catch{}return e.apply(i??this,t)}}catch{}},setup(e){Wt.set(e,!0)}}),Xt="sentry.profile_id",Kt="sentry.exclusive_time";function Yt(e,t){const{value:r,unit:i}="object"==typeof(n=e)&&null!=n&&!Array.isArray(n)&&Object.keys(n).includes("value")?e:{value:e,unit:void 0};var n;const a=function(e){if(Array.isArray(e))return{value:e,type:"array"};const t="string"==typeof e?"string":"boolean"==typeof e?"boolean":"number"!=typeof e||Number.isNaN(e)?null:Number.isInteger(e)?"integer":"double";return t?{value:e,type:t}:void 0}(r),o=i&&"string"==typeof i?{unit:i}:{};if(a)return{...a,...o};if(!t||"skip-undefined"===t&&void 0===r)return;let s="";try{s=JSON.stringify(r)??""}catch{}return{value:s,type:"string",...o}}function Jt(e,t=!1){const r={};for(const[i,n]of Object.entries(e??{})){const e=Yt(n,t);e&&(r[i]=e)}return r}function Qt(e){const t=e;return{scope:t._sentryScope,isolationScope:Ct(t._sentryIsolationScope)}}let er=!1;function tr(e){const{spanId:t,traceId:r,isRemote:i}=e.spanContext(),n=i?t:ar(e).parent_span_id,a=Qt(e).scope;return{parent_span_id:n,span_id:i?a?.getPropagationContext().propagationSpanId||It():t,trace_id:r}}function rr(e){return e&&e.length>0?e.map(({context:{spanId:e,traceId:t,traceFlags:r,...i},attributes:n})=>({span_id:e,trace_id:t,sampled:1===r,attributes:n,...i})):void 0}function ir(e){return"number"==typeof e?nr(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?nr(e.getTime()):Pt()}function nr(e){return e>9999999999?e/1e3:e}function ar(e){if(function(e){return"function"==typeof e.getSpanJSON}(e))return e.getSpanJSON();const{spanId:t,traceId:r}=e.spanContext();if(function(e){const t=e;return!!(t.attributes&&t.startTime&&t.name&&t.endTime&&t.status)}(e)){const{attributes:i,startTime:n,name:a,endTime:o,status:s,links:l}=e;return{span_id:t,trace_id:r,data:i,description:a,parent_span_id:or(e),start_timestamp:ir(n),timestamp:ir(o)||void 0,status:sr(s),op:i["sentry.op"],origin:i["sentry.origin"],links:rr(l)}}return{span_id:t,trace_id:r,start_timestamp:0,data:{}}}function or(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function sr(e){if(e&&0!==e.code)return 1===e.code?"ok":e.message||"internal_error"}const lr=function(e){return e._sentryRootSpan||e};function ur(){er||(ge(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),er=!0)}const cr=()=>{let e;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if(function(e,t){return!!t&&(!!function(e,t){const r=e.message,i=t.message;return!(!r&&!i)&&(!(r&&!i||!r&&i)&&(r===i&&(!!dr(e,t)&&!!hr(e,t))))}(e,t)||!!function(e,t){const r=pr(t),i=pr(e);return!(!r||!i)&&(r.type===i.type&&r.value===i.value&&(!!dr(e,t)&&!!hr(e,t)))}(e,t))}(t,e))return le&&be.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return e=t}}};function hr(e,t){let r=ut(e),i=ut(t);if(!r&&!i)return!0;if(r&&!i||!r&&i)return!1;if(i.length!==r.length)return!1;for(let e=0;e<i.length;e++){const t=i[e],n=r[e];if(t.filename!==n.filename||t.lineno!==n.lineno||t.colno!==n.colno||t.function!==n.function)return!1}return!0}function dr(e,t){let r=e.fingerprint,i=t.fingerprint;if(!r&&!i)return!0;if(r&&!i||!r&&i)return!1;try{return!(r.join("")!==i.join(""))}catch{return!1}}function pr(e){return e.exception?.values?.[0]}const fr={},mr={};function gr(e,t){return fr[e]=fr[e]||[],fr[e].push(t),()=>{const r=fr[e];if(r){const e=r.indexOf(t);-1!==e&&r.splice(e,1)}}}function yr(e,t){if(!mr[e]){mr[e]=!0;try{t()}catch(t){le&&be.error(`Error while instrumenting ${e}`,t)}}}function _r(e,t){const r=e&&fr[e];if(r)for(const i of r)try{i(t)}catch(t){le&&be.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${lt(i)}\nError:`,t)}}const vr=new Set([]),br=new Set;function xr(){"console"in ce&&fe.forEach(function(e){!br.has(e)&&e in ce.console&&(br.add(e),je(ce.console,e,function(t){return me[e]=t,function(...t){const r=t[0],i=me[e],n=vr.size&&"string"==typeof r&&yt(r,vr);n||_r("console",{args:t,level:e}),(!n||le&&be.isEnabled())&&i?.apply(ce.console,t)}}))})}const wr=ce;function Sr(e){return e&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Tr(e,t=!1){t&&!function(){if("string"==typeof EdgeRuntime)return!0;if(!function(){if(!("fetch"in wr))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}())return!1;if(Sr(wr.fetch))return!0;let e=!1;const t=wr.document;if(t&&"function"==typeof t.createElement)try{const r=t.createElement("iframe");r.hidden=!0,t.head.appendChild(r),r.contentWindow?.fetch&&(e=Sr(r.contentWindow.fetch)),t.head.removeChild(r)}catch(e){le&&be.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",e)}return e}()||je(ce,"fetch",function(t){return function(...r){const i=new Error,{method:n,url:a}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,r]=e;return{url:Er(t),method:Pr(r,"method")?String(r.method).toUpperCase():Be(t)&&Pr(t,"method")?String(t.method).toUpperCase():"GET"}}const t=e[0];return{url:Er(t),method:Pr(t,"method")?String(t.method).toUpperCase():"GET"}}(r),o={args:r,fetchData:{method:n,url:a},startTimestamp:1e3*Pt(),virtualError:i,headers:Dr(r)};return e||_r("fetch",{...o}),t.apply(ce,r).then(async t=>(e?e(t):_r("fetch",{...o,endTimestamp:1e3*Pt(),response:t}),t),e=>{_r("fetch",{...o,endTimestamp:1e3*Pt(),error:e}),Ee(e)&&void 0===e.stack&&(e.stack=i.stack,Ne(e,"framesToPop",1));const t=qt(),r=t?.getOptions().enhanceFetchErrorMessages??"always";if(!1!==r&&Ee(e)&&"TypeError"===e.name&&("Failed to fetch"===e.message||"Load failed"===e.message||"NetworkError when attempting to fetch resource."===e.message))try{const t=new URL(o.fetchData.url).host;"always"===r?e.message=`${e.message} (${t})`:Ne(e,"__sentry_fetch_url_host__",t)}catch{}throw e})}})}function Pr(e,t){return Re(e)&&!!e[t]}function Er(e){return"string"==typeof e?e:e?Pr(e,"url")?e.url:e.toString?e.toString():"":""}function Dr(e){const[t,r]=e;try{if("object"==typeof r&&null!==r&&"headers"in r&&r.headers)return new Headers(r.headers);if(Be(t))return new Headers(t.headers)}catch{}}const Ar=100;function Ir(e,t){const r=qt(),i=Gt();if(!r)return;const{beforeBreadcrumb:n=null,maxBreadcrumbs:a=Ar}=r.getOptions();if(a<=0)return;const o={timestamp:St(),...e},s=n?ge(()=>n(o,t)):o;null!==s&&(r.emit&&r.emit("beforeAddBreadcrumb",s,t),i.addBreadcrumb(s,a))}const Cr=ce;function kr(){try{return Cr.document.location.href}catch{return""}}function Mr(e){return void 0===e?void 0:e>=400&&e<500?"warning":e>=500?"error":void 0}function Fr(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const r=t[6]||"",i=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:r,hash:i,relative:t[5]+r+i}}const Rr=ce;let Lr,zr,Or;function Br(){if(!Rr.document)return;const e=_r.bind(null,"dom"),t=jr(e,!0);Rr.document.addEventListener("click",t,!1),Rr.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(t=>{const r=Rr,i=r[t]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(je(i,"addEventListener",function(t){return function(r,i,n){if("click"===r||"keypress"==r)try{const i=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},a=i[r]=i[r]||{refCount:0};if(!a.handler){const i=jr(e);a.handler=i,t.call(this,r,i,n)}a.refCount++}catch{}return t.call(this,r,i,n)}}),je(i,"removeEventListener",function(e){return function(t,r,i){if("click"===t||"keypress"==t)try{const r=this.__sentry_instrumentation_handlers__||{},n=r[t];n&&(n.refCount--,n.refCount<=0&&(e.call(this,t,n.handler,i),n.handler=void 0,delete r[t]),0===Object.keys(r).length&&delete this.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,r,i)}}))})}function jr(e,t=!1){return r=>{if(!r||r._sentryCaptured)return;const i=function(e){try{return e.target}catch{return null}}(r);if(function(e,t){return"keypress"===e&&(!t?.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)}(r.type,i))return;Ne(r,"_sentryCaptured",!0),i&&!i._sentryId&&Ne(i,"_sentryId",Ke());const n="keypress"===r.type?"input":r.type;(function(e){if(e.type!==zr)return!1;try{if(!e.target||e.target._sentryId!==Or)return!1}catch{}return!0})(r)||(e({event:r,name:n,global:t}),zr=r.type,Or=i?i._sentryId:void 0),clearTimeout(Lr),Lr=Rr.setTimeout(()=>{Or=void 0,zr=void 0},1e3)}}const Nr="__sentry_xhr_v3__";function Ur(){if(!Rr.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;e.open=new Proxy(e.open,{apply(e,t,r){const i=new Error,n=1e3*Pt(),a=Ce(r[0])?r[0].toUpperCase():void 0,o=function(e){if(Ce(e))return e;try{return e.toString()}catch{}}(r[1]);if(!a||!o)return e.apply(t,r);t[Nr]={method:a,url:o,request_headers:{}},"POST"===a&&o.match(/sentry_key/)&&(t.__sentry_own_request__=!0);const s=()=>{const e=t[Nr];if(e&&4===t.readyState){try{e.status_code=t.status}catch{}_r("xhr",{endTimestamp:1e3*Pt(),startTimestamp:n,xhr:t,virtualError:i}),t.removeEventListener("readystatechange",s)}};return"onreadystatechange"in t&&"function"==typeof t.onreadystatechange?t.onreadystatechange=new Proxy(t.onreadystatechange,{apply:(e,t,r)=>(s(),e.apply(t,r))}):t.addEventListener("readystatechange",s),t.setRequestHeader=new Proxy(t.setRequestHeader,{apply(e,t,r){const[i,n]=r,a=t[Nr];return a&&Ce(i)&&Ce(n)&&(a.request_headers[i.toLowerCase()]=n),e.apply(t,r)}}),e.apply(t,r)}}),e.send=new Proxy(e.send,{apply(e,t,r){const i=t[Nr];return i?(void 0!==r[0]&&(i.body=r[0]),_r("xhr",{startTimestamp:1e3*Pt(),xhr:t}),e.apply(t,r)):e.apply(t,r)}})}let Vr;function $r(e){const t="history";gr(t,e),yr(t,Gr)}function Gr(){function e(e){return function(...t){const r=t.length>2?t[2]:void 0;if(r){const i=Vr,n=function(e){try{return new URL(e,Rr.location.origin).toString()}catch{return e}}(String(r));if(Vr=n,i===n)return e.apply(this,t);_r("history",{from:i,to:n})}return e.apply(this,t)}}Rr.addEventListener("popstate",()=>{const e=Rr.location.href,t=Vr;Vr=e,t!==e&&_r("history",{from:t,to:e})}),"history"in wr&&wr.history&&(je(Rr.history,"pushState",e),je(Rr.history,"replaceState",e))}const qr={};try{"undefined"!=typeof Node&&(qr.parentNode=Object.getOwnPropertyDescriptor(Node.prototype,"parentNode").get),"undefined"!=typeof Element&&(qr.tagName=Object.getOwnPropertyDescriptor(Element.prototype,"tagName").get,qr.id=Object.getOwnPropertyDescriptor(Element.prototype,"id").get,qr.className=Object.getOwnPropertyDescriptor(Element.prototype,"className").get,qr.getAttribute=Element.prototype.getAttribute),"undefined"!=typeof HTMLElement&&(qr.dataset=Object.getOwnPropertyDescriptor(HTMLElement.prototype,"dataset").get)}catch{}function Zr(e,t,r){const i=qr[t];if(i)try{return i.call(e,r)}catch{}const n=e[t];return"function"==typeof n?n.call(e,r):n}function Wr(e,t){const r=[],i=Zr(e,"tagName");if(!i)return"";if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement){const t=Zr(e,"dataset");if(t){if(t.sentryComponent)return t.sentryComponent;if(t.sentryElement)return t.sentryElement}}r.push(i.toLowerCase());const n=t?.length?t.filter(t=>Zr(e,"getAttribute",t)).map(t=>[t,Zr(e,"getAttribute",t)]):null;if(n?.length)n.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else{const t=Zr(e,"id");t&&r.push(`#${t}`);const i=Zr(e,"className");if(i&&Ce(i)){const e=i.split(/\s+/);for(const t of e)r.push(`.${t}`)}}for(const t of["aria-label","type","name","title","alt"]){const i=Zr(e,"getAttribute",t);i&&r.push(`[${t}="${i}"]`)}return r.join("")}const Hr="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,Xr="production";function Kr(e){return new Jr(t=>{t(e)})}function Yr(e){return new Jr((t,r)=>{r(e)})}class Jr{constructor(e){this._state=0,this._handlers=[],this._runExecutor(e)}then(e,t){return new Jr((r,i)=>{this._handlers.push([!1,t=>{if(e)try{r(e(t))}catch(e){i(e)}else r(t)},e=>{if(t)try{r(t(e))}catch(e){i(e)}else i(e)}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(e){return new Jr((t,r)=>{let i,n;return this.then(t=>{n=!1,i=t,e&&e()},t=>{n=!0,i=t,e&&e()}).then(()=>{n?r(i):t(i)})})}_executeHandlers(){if(0===this._state)return;const e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||(1===this._state&&e[1](this._value),2===this._state&&e[2](this._value),e[0]=!0)})}_runExecutor(e){const t=(e,t)=>{0===this._state&&(ze(t)?t.then(r,i):(this._state=e,this._value=t,this._executeHandlers()))},r=e=>{t(1,e)},i=e=>{t(2,e)};try{e(r,i)}catch(e){i(e)}}}function Qr(e,t,r,i=0){try{const n=ei(t,r,e,i);return ze(n)?n:Kr(n)}catch(e){return Yr(e)}}function ei(e,t,r,i){const n=r[i];if(!e||!n)return e;const a=n({...e},t);return le&&null===a&&be.log(`Event processor "${n.id||"?"}" dropped event`),ze(a)?a.then(e=>ei(e,t,r,i+1)):ei(a,t,r,i+1)}let ti,ri,ii,ni;function ai(e){return e.split(",").map(e=>{const t=e.indexOf("=");return-1===t?[]:[e.slice(0,t),e.slice(t+1)].map(e=>{try{return decodeURIComponent(e.trim())}catch{return}})}).reduce((e,[t,r])=>(t&&r&&(e[t]=r),e),{})}const oi=/^o(\d+)\./,si=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function li(e,t=!1){const{host:r,path:i,pass:n,port:a,projectId:o,protocol:s,publicKey:l}=e;return`${s}://${l}${t&&n?`:${n}`:""}@${r}${a?`:${a}`:""}/${i?`${i}/`:i}${o}`}function ui(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function ci(e){const t=e.getOptions(),{host:r}=e.getDsn()||{};let i;return t.orgId?i=String(t.orgId):r&&(i=function(e){const t=e.match(oi);return t?.[1]}(r)),i}function hi(e){if("boolean"==typeof __SENTRY_TRACING__&&!__SENTRY_TRACING__)return!1;const t=e||qt()?.getOptions();return!(!t||null==t.tracesSampleRate&&!t.tracesSampler)}const di=Symbol.for("sentry.nonRecordingSpan");function pi(e,t){const r=t.getOptions(),{publicKey:i}=t.getDsn()||{},n={environment:r.environment||Xr,release:r.release,public_key:i,trace_id:e,org_id:ci(t)};return t.emit("createDsc",n),n}function fi(e,t){const r=t.getPropagationContext();return r.dsc||pi(r.traceId,e)}function mi(e){const t=qt();if(!t)return{};const r=lr(e),i=ar(r),n=i.data,a=r.spanContext().traceState,o=a?.get("sentry.sample_rate")??n["sentry.sample_rate"]??n["sentry.previous_trace_sample_rate"];function s(e){return"number"!=typeof o&&"string"!=typeof o||(e.sample_rate=`${o}`),e}const l=r._frozenDsc;if(l)return s(l);const u=function(e){return!!e&&!0===e[di]}(r),c=u&&"ignored"===r.dropReason;if(u&&(!hi(t.getOptions())||c)){const e=Qt(r).scope;if(e){const r={...fi(t,e)};return c&&(r.sampled="false"),s(r)}}const h=a?.get("sentry.dsc"),d=h&&function(e){const t=function(e){if(e&&(Ce(e)||Array.isArray(e)))return Array.isArray(e)?e.reduce((e,t)=>{const r=ai(t);return Object.entries(r).forEach(([t,r])=>{e[t]=r}),e},{}):ai(e)}(e);if(!t)return;const r=Object.entries(t).reduce((e,[t,r])=>(t.startsWith("sentry-")&&(e[t.slice(7)]=r),e),{});return Object.keys(r).length>0?r:void 0}(h);if(d)return s(d);const p=pi(e.spanContext().traceId,t),f=n["sentry.source"]??n["sentry.segment.name.source"],m=i.description;return"url"!==f&&m&&(p.transaction=m),hi()&&(p.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return 1===t}(r)),p.sample_rand=a?.get("sentry.sample_rand")??Qt(r).scope?.getPropagationContext().sampleRand.toString()),s(p),t.emit("createDsc",p,r),p}function gi(e,t){const{extra:r,tags:i,attributes:n,user:a,contexts:o,level:s,sdkProcessingMetadata:l,breadcrumbs:u,fingerprint:c,eventProcessors:h,attachments:d,propagationContext:p,transactionName:f,span:m}=t;yi(e,"extra",r),yi(e,"tags",i),yi(e,"attributes",n),yi(e,"user",a),yi(e,"contexts",o),e.sdkProcessingMetadata=Dt(e.sdkProcessingMetadata,l,2),s&&(e.level=s),f&&(e.transactionName=f),m&&(e.span=m),u.length&&(e.breadcrumbs=[...e.breadcrumbs,...u]),c.length&&(e.fingerprint=[...e.fingerprint,...c]),h.length&&(e.eventProcessors=[...e.eventProcessors,...h]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...p}}function yi(e,t,r){e[t]=Dt(e[t],r,1)}function _i(e,t){const r=pe("globalScope",()=>new Rt).getScopeData();return e&&gi(r,e.getScopeData()),t&&gi(r,t.getScopeData()),r}function vi(e,t,r,i,n,a){const{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,l={...t,event_id:t.event_id||r.event_id||Ke(),timestamp:t.timestamp||St()},u=r.integrations||e.integrations.map(e=>e.name);!function(e,t){const{environment:r,release:i,dist:n,maxValueLength:a}=t;e.environment=e.environment||r||Xr,!e.release&&i&&(e.release=i),!e.dist&&n&&(e.dist=n);const o=e.request;o?.url&&a&&(o.url=ft(o.url,a)),a&&e.exception?.values?.forEach(e=>{e.value&&(e.value=ft(e.value,a))})}(l,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(l,u),n&&n.emit("applyFrameMetadata",t),void 0===t.type&&function(e,t){const r=function(e){const t=ce._sentryDebugIds,r=ce._debugIds;if(!t&&!r)return{};const i=t?Object.keys(t):[],n=r?Object.keys(r):[];if(ni&&i.length===ri&&n.length===ii)return ni;ri=i.length,ii=n.length,ni={},ti||(ti={});const a=(t,r)=>{for(const i of t){const t=r[i],n=ti?.[i];if(n&&ni&&t)ni[n[0]]=t,ti&&(ti[i]=[n[0],t]);else if(t){const r=e(i);for(let e=r.length-1;e>=0;e--){const n=r[e],a=n?.filename;if(a&&ni&&ti){ni[a]=t,ti[i]=[a,t];break}}}}};return t&&a(i,t),r&&a(n,r),ni}(t);e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.filename&&(e.debug_id=r[e.filename])})})}(l,e.stackParser);const c=function(e,t){if(!t)return e;const r=e?e.clone():new Rt;return r.update(t),r}(i,r.captureContext);r.mechanism&&et(l,r.mechanism);const h=n?n.getEventProcessors():[],d=_i(a,c),p=[...r.attachments||[],...d.attachments];p.length&&(r.attachments=p),function(e,t){const{fingerprint:r,span:i,breadcrumbs:n,sdkProcessingMetadata:a}=t;!function(e,t){const{extra:r,tags:i,user:n,contexts:a,level:o,transactionName:s}=t;Object.keys(r).length&&(e.extra={...r,...e.extra}),Object.keys(i).length&&(e.tags={...i,...e.tags}),Object.keys(n).length&&(e.user={...n,...e.user}),Object.keys(a).length&&(e.contexts={...a,...e.contexts}),o&&(e.level=o),s&&"transaction"!==e.type&&(e.transaction=s)}(e,t),i&&function(e,t){e.contexts={trace:tr(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:mi(t),...e.sdkProcessingMetadata};const r=ar(lr(t)).description;r&&!e.transaction&&"transaction"===e.type&&(e.transaction=r)}(e,i),function(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}(e,r),function(e,t){const r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}(e,n),function(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}(e,a)}(l,d);const f=[...h,...d.eventProcessors];return(r.data&&!0===r.data.__sentry__?Kr(l):Qr(f,l,r)).then(e=>(e&&function(e){const t={};if(e.exception?.values?.forEach(e=>{e.stacktrace?.frames?.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})}),0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const r=e.debug_meta.images;Object.entries(t).forEach(([e,t])=>{r.push({type:"sourcemap",code_file:e,debug_id:t})})}(e),"number"==typeof o&&o>0?function(e,t,r){if(!e)return null;const i={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:ct(e.data,t,r)}}))},...e.user&&{user:ct(e.user,t,r)},...e.contexts&&{contexts:ct(e.contexts,t,r)},...e.extra&&{extra:ct(e.extra,t,r)}};return e.contexts?.trace&&i.contexts&&(i.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(i.contexts.trace.data=ct(e.contexts.trace.data,t,r))),e.spans&&(i.spans=e.spans.map(e=>({...e,...e.data&&{data:ct(e.data,t,r)}}))),e.contexts?.flags&&i.contexts&&(i.contexts.flags=ct(e.contexts.flags,3,r)),i}(e,o,s):e))}const bi=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function xi(e,t){return $t().captureEvent(e,t)}function wi(e){const t=Gt(),{user:r}=_i(t,$t()),{userAgent:i}=ce.navigator||{},n=function(e){const t=Pt(),r={sid:Ke(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return{sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}(r)};return e&&Et(r,e),r}({user:r,...i&&{userAgent:i},...e}),a=t.getSession();return"ok"===a?.status&&Et(a,{status:"exited"}),Si(),t.setSession(n),n}function Si(){const e=Gt(),t=$t().getSession()||e.getSession();t&&function(e){let t={};"ok"===e.status&&(t={status:"exited"}),Et(e,t)}(t),Ti(),e.setSession()}function Ti(){const e=Gt(),t=qt(),r=e.getSession();r&&t&&t.captureSession(r)}function Pi(e=!1){e?Si():Ti()}const Ei=ce;let Di=0;function Ai(){return Di>0}function Ii(e,t={}){if("function"!=typeof e)return e;try{if(Object.prototype.hasOwnProperty.call(e,"__sentry_wrapped__")){const t=e.__sentry_wrapped__;return"function"==typeof t?t:e}if(Ve(e))return e}catch{return e}const r=function(...r){ce._sentryWrappedDepth=(ce._sentryWrappedDepth||0)+1;try{const i=r.map(e=>Ii(e,t));return e.apply(this,i)}catch(e){throw Di++,setTimeout(()=>{Di--}),function(...e){const t=Vt(he());if(2===e.length){const[r,i]=e;return r?t.withSetScope(r,i):t.withScope(i)}t.withScope(e[0])}(i=>{var n;i.addEventProcessor(e=>(t.mechanism&&(Qe(e,void 0,void 0),et(e,t.mechanism)),e.extra={...e.extra,arguments:r},e)),n=e,$t().captureException(n,function(e){if(e)return function(e){return e instanceof Rt||"function"==typeof e}(e)||function(e){return Object.keys(e).some(e=>bi.includes(e))}(e)?{captureContext:e}:e}(void 0))}),e}finally{ce._sentryWrappedDepth=(ce._sentryWrappedDepth||0)-1}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}catch{}Ue(r,e),Ne(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>e.name})}catch{}return r}function Ci(){const e=kr(),{referrer:t}=Ei.document||{},{userAgent:r}=Ei.navigator||{};return{url:e,headers:{...t&&{Referer:t},...r&&{"User-Agent":r}}}}const ki=(e={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:"Breadcrumbs",setup(e){var r;t.console&&function(e){const t="console";gr(t,e);yr(t,xr)}(function(e){return function(t){if(qt()!==e)return;const r={category:"console",data:{arguments:t.args,logger:"console"},level:(i=t.level,"warn"===i?"warning":["fatal","error","warning","log","info","debug"].includes(i)?i:"log"),message:mt(t.args," ")};var i;if("assert"===t.level){if(!1!==t.args[0])return;r.message=`Assertion failed: ${mt(t.args.slice(1)," ")||"console.assert"}`,r.data.arguments=t.args.slice(1)}Ir(r,{input:t.args,level:t.level})}}(e)),t.dom&&(r=function(e,t){return function(r){if(qt()!==e)return;let i,n,a="object"==typeof t?t.serializeAttribute:void 0,o="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;o&&o>1024&&(Hr&&be.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${o} was configured. Sentry will use 1024 instead.`),o=1024),"string"==typeof a&&(a=[a]);try{const e=r.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;i=function(e,t={}){if(!e)return"<unknown>";try{let r=e;const i=5,n=[];let a=0,o=0;const s=" > ",l=s.length;let u;const c=Array.isArray(t)?t:t.keyAttrs,h=!Array.isArray(t)&&t.maxStringLength||80;for(;r&&a++<i&&(u=Wr(r,c),!("html"===u||a>1&&o+n.length*l+u.length>=h));)n.push(u),o+=u.length,r=Zr(r,"parentNode");return n.reverse().join(s)}catch{return"<unknown>"}}(t,{keyAttrs:a,maxStringLength:o}),n=function(e,t=5){if(!Cr.HTMLElement)return null;let r=e;for(let e=0;e<t;e++){if(!r)return null;if(r instanceof HTMLElement){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}r=r.parentNode}return null}(t)}catch{i="<unknown>"}if(0===i.length)return;const s={category:`ui.${r.name}`,message:i};n&&(s.data={"ui.component_name":n}),Ir(s,{event:r.event,name:r.name,global:r.global})}}(e,t.dom),gr("dom",r),yr("dom",Br)),t.xhr&&function(e){gr("xhr",e),yr("xhr",Ur)}(function(e){return function(t){if(qt()!==e)return;const{startTimestamp:r,endTimestamp:i}=t,n=t.xhr[Nr];if(!r||!i||!n)return;const{method:a,url:o,status_code:s,body:l}=n,u={method:a,url:o,status_code:s},c={xhr:t.xhr,input:l,startTimestamp:r,endTimestamp:i},h={category:"xhr",data:u,type:"http",level:Mr(s)};e.emit("beforeOutgoingRequestBreadcrumb",h,c),Ir(h,c)}}(e)),t.fetch&&function(e){const t="fetch";gr(t,e);yr(t,()=>Tr(void 0,void 0))}(function(e){return function(t){if(qt()!==e)return;const{startTimestamp:r,endTimestamp:i}=t;if(i&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){const n={data:t.error,input:t.args,startTimestamp:r,endTimestamp:i},a={category:"fetch",data:t.fetchData,level:"error",type:"http"};e.emit("beforeOutgoingRequestBreadcrumb",a,n),Ir(a,n)}else{const n=t.response,a={...t.fetchData,status_code:n?.status},o={input:t.args,response:n,startTimestamp:r,endTimestamp:i},s={category:"fetch",data:a,type:"http",level:Mr(a.status_code)};e.emit("beforeOutgoingRequestBreadcrumb",s,o),Ir(s,o)}}}(e)),t.history&&$r(function(e){return function(t){if(qt()!==e)return;let r=t.from,i=t.to;const n=Fr(Ei.location.href);let a=r?Fr(r):void 0;const o=Fr(i);a?.path||(a=n),n.protocol===o.protocol&&n.host===o.host&&(i=o.relative),n.protocol===a.protocol&&n.host===a.host&&(r=a.relative),Ir({category:"navigation",data:{from:r,to:i}})}}(e)),t.sentry&&e.on("beforeSendEvent",function(e){return function(t){qt()===e&&Ir({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:Je(t)},{event:t})}}(e))}}},Mi="EventTarget,Window,Node,ApplicationCache,AudioTrackList,BroadcastChannel,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,SharedWorker,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(","),Fi=(e={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...e};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&je(Ei,"setTimeout",Ri),t.setInterval&&je(Ei,"setInterval",Ri),t.requestAnimationFrame&&je(Ei,"requestAnimationFrame",Li),t.XMLHttpRequest&&"XMLHttpRequest"in Ei&&je(XMLHttpRequest.prototype,"send",zi);const e=t.eventTarget;e&&(Array.isArray(e)?e:Mi).forEach(e=>function(e,t){const r=Ei,i=r[e]?.prototype;i?.hasOwnProperty?.("addEventListener")&&(je(i,"addEventListener",function(r){return function(i,n,a){try{"function"==typeof n.handleEvent&&(n.handleEvent=Ii(n.handleEvent,{mechanism:{data:{handler:lt(n),target:e},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return t.unregisterOriginalCallbacks&&function(e,t,r){e&&"object"==typeof e&&"removeEventListener"in e&&"function"==typeof e.removeEventListener&&e.removeEventListener(t,r)}(this,i,n),r.apply(this,[i,Ii(n,{mechanism:{data:{handler:lt(n),target:e},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),a])}}),je(i,"removeEventListener",function(e){return function(t,r,i){try{if(Object.prototype.hasOwnProperty.call(r,"__sentry_wrapped__")){const n=r.__sentry_wrapped__;n&&e.call(this,t,n,i)}}catch{}return e.call(this,t,r,i)}}))}(e,t))}}};function Ri(e){return function(...t){const r=t[0];return t[0]=Ii(r,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${lt(e)}`}}),e.apply(this,t)}}function Li(e){return function(t){return e.apply(this,[Ii(t,{mechanism:{data:{handler:lt(e)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function zi(e){return function(...t){const r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(e=>{e in r&&"function"==typeof r[e]&&je(r,e,function(t){const r={mechanism:{data:{handler:lt(t)},handled:!1,type:`auto.browser.browserapierrors.xhr.${e}`}},i=Ve(t);return i&&(r.mechanism.data.handler=lt(i)),Ii(t,r)})}),e.apply(this,t)}}function Oi(e,t,r){Rr.document&&Rr.addEventListener(e,t,r)}function Bi(e,t,r){Rr.document&&Rr.removeEventListener(e,t,r)}const ji=(e={})=>{const t=e.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(void 0===Ei.document)return void(Hr&&be.warn("Using the `browserSessionIntegration` in non-browser environments is not supported."));wi({ignoreDuration:!0});let e=!1;(e=>{const t=Rr.requestIdleCallback||Rr.setTimeout;"hidden"===Rr.document?.visibilityState?e():(Oi("visibilitychange",e=(e=>{let t=!1;return()=>{t||(e(),t=!0)}})(e),{once:!0,capture:!0}),Oi("pagehide",e,{once:!0,capture:!0}),t(()=>{e(),Bi("visibilitychange",e,{capture:!0}),Bi("pagehide",e,{capture:!0})}))})(()=>{e||(Pi(),e=!0)});const r=Gt();let i=r.getUser();r.addScopeListener(t=>{const r=t.getUser();i?.id===r?.id&&i?.ip_address===r?.ip_address||(i=r,e&&Pi())}),"route"===t&&$r(({from:t,to:r})=>{t!==r&&(wi({ignoreDuration:!0}),Pi(),e=!0)})}}};function Ni(e,t){const r=e.attributes??(e.attributes={});Object.entries(t).forEach(([e,t])=>{null==t||e in r||(r[e]=t)})}function Ui(){try{const e=Ei.Intl;if(!e)return;const t=e.DateTimeFormat().resolvedOptions();return{locale:t.locale,timezone:t.timeZone,calendar:t.calendar}}catch{return}}let Vi=null;function $i(){Vi=ce.onerror,ce.onerror=function(e,t,r,i,n){return _r("error",{column:i,error:n,line:r,msg:e,url:t}),!!Vi&&Vi.apply(this,arguments)},ce.onerror.__SENTRY_INSTRUMENTED__=!0}let Gi=null;function qi(){Gi=ce.onunhandledrejection,ce.onunhandledrejection=function(e){return _r("unhandledrejection",e),!Gi||Gi.apply(this,arguments)},ce.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Zi(e){return function(e){return Ee(e)&&"__sentry_fetch_url_host__"in e&&"string"==typeof e.__sentry_fetch_url_host__}(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function Wi(e,t){const r=Xi(e,t),i={type:Ji(t),value:Qi(t)};return r.length&&(i.stacktrace={frames:r}),void 0===i.type&&""===i.value&&(i.value="Unrecoverable error caught"),i}function Hi(e,t){return{exception:{values:[Wi(e,t)]}}}function Xi(e,t){const r=t.stacktrace||t.stack||"",i=function(e){return e&&Ki.test(e.message)?1:0}(t),n=function(e){return"number"==typeof e.framesToPop?e.framesToPop:0}(t);try{return e(r,i,n)}catch{}return[]}const Ki=/Minified React error #\d+;/i;function Yi(e){return"undefined"!=typeof WebAssembly&&void 0!==WebAssembly.Exception&&e instanceof WebAssembly.Exception}function Ji(e){const t=e?.name;return!t&&Yi(e)?e.message&&Array.isArray(e.message)&&2==e.message.length?e.message[0]:"WebAssembly.Exception":t}function Qi(e){const t=e?.message;return Yi(e)?Array.isArray(e.message)&&2==e.message.length?e.message[1]:"wasm exception":t?t.error&&"string"==typeof t.error.message?Zi(t.error):Zi(e):"No error message"}function en(e,t,r,i,n){let a;if(Ae(t)&&t.error)return Hi(e,t.error);if(Ie(t)||De(t,"DOMException")){const n=t;if("stack"in t){a=Hi(e,t);const n=a.exception?.values?.[0];if(i&&r&&n&&!n.stacktrace){const t=Xi(e,r);t.length&&(n.stacktrace={frames:t},et(a,{synthetic:!0}))}}else{const t=n.name||(Ie(n)?"DOMError":"DOMException"),o=n.message?`${t}: ${n.message}`:t;a=tn(e,o,r,i),Qe(a,o)}return"code"in n&&(a.tags={...a.tags,"DOMException.code":`${n.code}`}),a}return Ee(t)?Hi(e,t):Fe(t)||Le(t)?(a=function(e,t,r,i){const n=qt(),a=n?.getOptions().normalizeDepth,o=(s=t,Object.values(s).find(Ee));var s;const l={__serialized__:ht(t,a)};if(o)return{exception:{values:[Wi(e,o)]},extra:l};const u={exception:{values:[{type:Le(t)?t.constructor.name:i?"UnhandledRejection":"Error",value:rn(t,{isUnhandledRejection:i})}]},extra:l};if(r){const t=Xi(e,r);t.length&&(u.exception.values[0].stacktrace={frames:t})}return u}(e,t,r,n),et(a,{synthetic:!0}),a):(a=tn(e,t,r,i),Qe(a,`${t}`,void 0),et(a,{synthetic:!0}),a)}function tn(e,t,r,i){const n={};if(i&&r){const i=Xi(e,r);i.length&&(n.exception={values:[{value:t,stacktrace:{frames:i}}]}),et(n,{synthetic:!0})}if(ke(t)){const{__sentry_template_string__:e,__sentry_template_values__:r}=t;return n.logentry={message:e,params:r},n}return n.message=t,n}function rn(e,{isUnhandledRejection:t}){const r=function(e){const t=Object.keys($e(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}(e),i=t?"promise rejection":"exception";return Ae(e)?`Event \`ErrorEvent\` captured as ${i} with message \`${e.message}\``:Le(e)?`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}(e)}\` (type=${e.type}) captured as ${i}`:`Object captured as ${i} with keys: ${r}`}const nn=(e={})=>{const t={onerror:!0,onunhandledrejection:!0,...e};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(function(e){!function(){const t="error";gr(t,t=>{const{stackParser:r,attachStacktrace:i}=on();if(qt()!==e||Ai())return;const{msg:n,url:a,line:o,column:s,error:l}=t,u=function(e,t,r,i){const n=e.exception=e.exception||{},a=n.values=n.values||[],o=a[0]=a[0]||{},s=o.stacktrace=o.stacktrace||{},l=s.frames=s.frames||[];return 0===l.length&&l.push({colno:i,lineno:r,filename:sn(t)??kr(),function:"?",in_app:!0}),e}(en(r,l||n,void 0,i,!1),a,o,s);u.level="error",xi(u,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})}),yr(t,$i)}()}(e),an("onerror")),t.onunhandledrejection&&(function(e){!function(){const t="unhandledrejection";gr(t,t=>{const{stackParser:r,attachStacktrace:i}=on();if(qt()!==e||Ai())return;const n=function(e){if(Me(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}(t),a=Me(n)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`}]}}:en(r,n,void 0,i,!0);a.level="error",xi(a,{originalException:n,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})}),yr(t,qi)}()}(e),an("onunhandledrejection"))}}};function an(e){Hr&&be.log(`Global Handler attached: ${e}`)}function on(){const e=qt();return e?.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}function sn(e){if(Ce(e)&&0!==e.length)return e.startsWith("data:")?`<${function(e,t=!0){if(e.startsWith("data:")){const r=e.match(/^data:([^;,]+)/),i=r?r[1]:"text/plain",n=e.includes(";base64,"),a=e.indexOf(",");let o="";if(t&&-1!==a){const t=e.slice(a+1);o=t.length>10?`${t.slice(0,10)}... [truncated]`:t}return`data:${i}${n?",base64":""}${o?`,${o}`:""}`}return e}(e,!1)}>`:e}const ln="url.full",un="user_agent.original";function cn(e,t,r,i,n,a){if(!n.exception?.values||!a||!Ee(a.originalException))return;const o=n.exception.values.length>0?n.exception.values[n.exception.values.length-1]:void 0;o&&(n.exception.values=hn(e,t,i,a.originalException,r,n.exception.values,o,0))}function hn(e,t,r,i,n,a,o,s){if(a.length>=r+1)return a;let l=[...a];if(Ee(i[n])){pn(o,s,i);const a=e(t,i[n]),u=l.length;fn(a,n,u,s),l=hn(e,t,r,i[n],n,[a,...l],a,u)}return dn(i)&&i.errors.forEach((a,u)=>{if(Ee(a)){pn(o,s,i);const c=e(t,a),h=l.length;fn(c,`errors[${u}]`,h,s),l=hn(e,t,r,a,n,[c,...l],c,h)}}),l}function dn(e){return Array.isArray(e.errors)}function pn(e,t,r){e.mechanism={handled:!0,type:"auto.core.linked_errors",...dn(r)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function fn(e,t,r,i){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:r,parent_id:i}}const mn=(e={})=>{const t=e.limit||5,r=e.key||"cause";return{name:"LinkedErrors",preprocessEvent(e,i,n){cn(Wi,n.getOptions().stackParser,r,t,e,i)}}};function gn(e,t=[]){return[e,t]}function yn(e,t){const[r,i]=e;return[r,[...i,t]]}function _n(e,t){const r=e[1];for(const e of r)if(t(e,e[0].type))return!0;return!1}function vn(e){const t=de(ce);return t.encodePolyfill?t.encodePolyfill(e):(new TextEncoder).encode(e)}function bn(e){const[t,r]=e;let i=JSON.stringify(t);function n(e){"string"==typeof i?i="string"==typeof e?i+e:[vn(i),e]:i.push("string"==typeof e?vn(e):e)}for(const e of r){const[t,r]=e;if(n(`\n${JSON.stringify(t)}\n`),"string"==typeof r||r instanceof Uint8Array)n(r);else{let e;try{e=JSON.stringify(r)}catch{e=JSON.stringify(ct(r))}n(e)}}return"string"==typeof i?i:function(e){const t=e.reduce((e,t)=>e+t.length,0),r=new Uint8Array(t);let i=0;for(const t of e)r.set(t,i),i+=t.length;return r}(i)}function xn(e){const t="string"==typeof e.data?vn(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}const wn={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function Sn(e){return function(e){return e in wn}(e)?wn[e]:e}function Tn(e){if(!e?.sdk)return;const{name:t,version:r}=e.sdk;return{name:t,version:r}}function Pn(){return"undefined"!=typeof window&&(!(("undefined"==typeof __SENTRY_BROWSER_BUNDLE__||!__SENTRY_BROWSER_BUNDLE__)&&"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0))||function(){const e=ce.process;return"renderer"===e?.type}())}function En(e,t){const r=t?"auto":"never";return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{version:2,...Pn()&&{ingest_settings:{infer_ip:r,infer_user_agent:r}},items:e}]}function Dn(e,t){const r=t??function(e){return An().get(e)}(e)??[];if(0===r.length)return;const i=e.getOptions(),n=function(e,t,r,i,n){const a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),r&&i&&(a.dsn=li(i)),gn(a,[En(e,n)])}(r,i._metadata,i.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);An().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(n)}function An(){return pe("clientToLogBufferMap",()=>new WeakMap)}function In(e,t){const r=t?"auto":"never";return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{version:2,...Pn()&&{ingest_settings:{infer_ip:r,infer_user_agent:r}},items:e}]}function Cn(e,t){const r=t??function(e){return kn().get(e)}(e)??[];if(0===r.length)return;const i=e.getOptions(),n=function(e,t,r,i,n){const a={};return t?.sdk&&(a.sdk={name:t.sdk.name,version:t.sdk.version}),r&&i&&(a.dsn=li(i)),gn(a,[In(e,n)])}(r,i._metadata,i.tunnel,e.getDsn(),e.getDataCollectionOptions().userInfo);kn().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(n)}function kn(){return pe("clientToMetricBufferMap",()=>new WeakMap)}function Mn(e){return t={trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,name:e.description||"",start_timestamp:e.start_timestamp,end_timestamp:e.timestamp||e.start_timestamp,status:e.status&&"ok"!==e.status&&"cancelled"!==e.status?"error":"ok",is_segment:!1,attributes:{...e.data},links:e.links},{...t,attributes:Jt(t.attributes),links:t.links?.map(e=>({...e,attributes:Jt(e.attributes)}))};var t}function Fn(e){return"object"==typeof e&&"function"==typeof e.unref&&e.unref(),e}const Rn=Symbol.for("SentryBufferFullError");function Ln(e=100){const t=new Set;function r(e){t.delete(e)}return{get $(){return Array.from(t)},add:function(i){if(!(t.size<e))return Yr(Rn);const n=i();return t.add(n),n.then(()=>r(n),()=>r(n)),n},drain:function(e){if(!t.size)return Kr(!0);const r=Promise.allSettled(Array.from(t)).then(()=>!0);if(!e)return r;const i=[r,new Promise(t=>Fn(setTimeout(()=>t(!1),e)))];return Promise.race(i)}}}function zn(e){be.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function On(e,t){if(!t?.length)return!1;for(const r of t){if(jn(r)){if(e.description&&gt(e.description,r))return le&&zn(e),!0;continue}const t=!!r.attributes&&Object.keys(r.attributes).length>0;if(!r.name&&!r.op&&!t)continue;const i=!r.name||e.description&&gt(e.description,r.name),n=!r.op||e.op&&gt(e.op,r.op),a=!r.attributes||Object.entries(r.attributes).every(([t,r])=>{return i=e.attributes?.[t],n=r,"string"==typeof i&&("string"==typeof n||n instanceof RegExp)?gt(i,n):Array.isArray(i)&&Array.isArray(n)?i.length===n.length&&i.every((e,t)=>e===n[t]):i===n;var i,n});if(i&&n&&a)return le&&zn(e),!0}return!1}function Bn(e,t){const r=t.parent_span_id,i=t.span_id;if(r)for(const t of e)t.parent_span_id===i&&(t.parent_span_id=r)}function jn(e){return"string"==typeof e||e instanceof RegExp}const Nn=["forwarded","-ip","remote-","via","-user"],Un={userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:5};const Vn="Not capturing exception because it's already been captured.",$n="Discarded session because of missing or non-string release",Gn=Symbol.for("SentryInternalError"),qn=Symbol.for("SentryDoNotSendEventError");function Zn(e){return{message:e,[Gn]:!0}}function Wn(e){return{message:e,[qn]:!0}}function Hn(e){return Re(e)&&Gn in e}function Xn(e){return Re(e)&&qn in e}function Kn(e,t,r,i,n){let a,o=0,s=!1;e.on(r,()=>{o=0,clearTimeout(a),s=!1}),e.on(t,t=>{if(o+=i(t),o>=8e5)n(e);else if(!s){const t=e.getOptions()._flushInterval??5e3;t>0&&(s=!0,a=Fn(setTimeout(()=>{n(e)},t)))}}),e.on("flush",()=>{n(e)})}class Yn{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Ln(e.transportOptions?.bufferSize??64),this._dataCollection=function(e){const t=null!=e.dataCollection?Un:!0===e.sendDefaultPii?{userInfo:!0,cookies:!0,httpHeaders:{request:!0,response:!0},httpBodies:["incomingRequest","outgoingRequest","incomingResponse","outgoingResponse"],urlQueryParams:!0,graphQL:{document:!0,variables:!0},genAI:{inputs:!0,outputs:!0},databaseQueryData:!0,stackFrameVariables:!0,frameContextLines:7}:{userInfo:!1,cookies:{deny:Nn},httpHeaders:{request:{deny:Nn},response:{deny:Nn}},httpBodies:[],urlQueryParams:{deny:Nn},graphQL:{document:!0,variables:!0},genAI:{inputs:!1,outputs:!1},databaseQueryData:!1,stackFrameVariables:!0,frameContextLines:7},r=e.dataCollection??{};return{userInfo:r.userInfo??t.userInfo,cookies:r.cookies??t.cookies,httpHeaders:{request:r.httpHeaders?.request??t.httpHeaders.request,response:r.httpHeaders?.response??t.httpHeaders.response},httpBodies:r.httpBodies??t.httpBodies,urlQueryParams:r.urlQueryParams??r.queryParams??t.urlQueryParams,graphQL:{document:r.graphQL?.document??t.graphQL.document,variables:r.graphQL?.variables??t.graphQL.variables},genAI:{inputs:r.genAI?.inputs??t.genAI.inputs,outputs:r.genAI?.outputs??t.genAI.outputs},databaseQueryData:r.databaseQueryData??t.databaseQueryData,stackFrameVariables:r.stackFrameVariables??t.stackFrameVariables,frameContextLines:r.frameContextLines??t.frameContextLines}}(e),e.dsn?this._dsn=function(e){const t="string"==typeof e?function(e){const t=si.exec(e);if(!t)return void ge(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});const[r,i,n="",a="",o="",s=""]=t.slice(1);let l="",u=s;const c=u.split("/");if(c.length>1&&(l=c.slice(0,-1).join("/"),u=c.pop()),u){const e=u.match(/^\d+/);e&&(u=e[0])}return ui({host:a,pass:n,path:l,projectId:u,port:o,protocol:r,publicKey:i})}(e):ui(e);if(t&&function(e){if(!le)return!0;const{port:t,projectId:r,protocol:i}=e;return!(["protocol","publicKey","host","projectId"].find(t=>!e[t]&&(be.error(`Invalid Sentry Dsn: ${t} missing`),!0))||(r.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(i)?t&&isNaN(parseInt(t,10))&&(be.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(be.error(`Invalid Sentry Dsn: Invalid protocol ${i}`),1):(be.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),1)))}(t))return t}(e.dsn):le&&be.warn("No DSN provided, client will not send events."),this._dsn){const n=(t=this._dsn,r=e.tunnel,i=e._metadata?e._metadata.sdk:void 0,r||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",r=e.port?`:${e.port}`:"";return`${t}//${e.host}${r}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(t)}?${function(e,t){const r={sentry_version:"7"};return e.publicKey&&(r.sentry_key=e.publicKey),t&&(r.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(r).toString()}(t,i)}`);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:n})}var t,r,i;this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs??!0,this._options.enableLogs&&Kn(this,"afterCaptureLog","flushLogs",ra,Dn),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&Kn(this,"afterCaptureMetric","flushMetrics",ta,Cn)}captureException(e,t,r){const i=Ke();if(tt(e))return le&&be.log(Vn),i;const n={event_id:i,...t};return this._process(()=>this.eventFromException(e,n).then(e=>this._captureEvent(e,n,r)).then(e=>e),"error"),n.event_id}captureMessage(e,t,r,i){const n={event_id:Ke(),...r},a=ke(e)?e:String(e),o=Me(e),s=o?this.eventFromMessage(a,t,n):this.eventFromException(e,n);return this._process(()=>s.then(e=>this._captureEvent(e,n,i)),o?"unknown":"error"),n.event_id}captureEvent(e,t,r){const i=Ke();if(t?.originalException&&tt(t.originalException))return le&&be.log(Vn),i;const n={event_id:i,...t},a=e.sdkProcessingMetadata||{},o=a.capturedSpanScope,s=a.capturedSpanIsolationScope,l=Jn(e.type);return this._process(()=>this._captureEvent(e,n,o||r,s),l),n.event_id}captureSession(e){this.sendSession(e),Et(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getDataCollectionOptions(){return this._dataCollection}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){const t=this._transport;if(this.emit("flush"),!t)return!0;const r=await this._isClientDoneProcessing(e),i=await t.flush(e);return r&&i}async close(e){const t=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),t}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}getIntegrationNames(){return Object.keys(this._integrations)}addIntegration(e){const t=this._integrations[e.name];!t&&e.beforeSetup&&e.beforeSetup(this),Se(this,e,this._integrations),t||we(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);const r=function(e,t){if("transaction"!==e.type||!e.spans?.length||!e.sdkProcessingMetadata?.hasGenAiSpans||!1===t.getOptions().streamGenAiSpans||function(e){return"stream"===e.getOptions().traceLifecycle}(t))return;const r=[],i=[];for(const t of e.spans)t.op?.startsWith("gen_ai.")?r.push(Mn(t)):i.push(t);if(0===r.length)return;e.spans=i;const n=t.getDataCollectionOptions().userInfo?"auto":"never";return[{type:"span",item_count:r.length,content_type:"application/vnd.sentry.items.span.v2+json"},{version:2,...Pn()&&{ingest_settings:{infer_ip:n,infer_user_agent:n}},items:r}]}(e,this);let i=function(e,t,r,i){const n=Tn(r),a=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){if(!t)return e;const r=e.sdk||{};e.sdk={...r,name:r.name||t.name,version:r.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0}}(e,r?.sdk);const o=function(e,t,r,i){const n=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date(Xe()).toISOString(),...t&&{sdk:t},...!!r&&i&&{dsn:li(i)},...n&&{trace:n}}}(e,n,i,t);return delete e.sdkProcessingMetadata,gn(o,[[{type:a},e]])}(e,this._dsn,this._options._metadata,this._options.tunnel);for(const e of t.attachments||[])i=yn(i,xn(e));r&&(i=yn(i,r)),this.sendEnvelope(i).then(t=>this.emit("afterSendEvent",e,t))}sendSession(e){const{release:t,environment:r=Xr}=this._options;if("aggregates"in e){const i=e.attrs||{};if(!i.release&&!t)return void(le&&be.warn($n));i.release=i.release||t,i.environment=i.environment||r,e.attrs=i}else{if(!e.release&&!t)return void(le&&be.warn($n));e.release=e.release||t,e.environment=e.environment||r}this.emit("beforeSendSession",e);const i=function(e,t,r,i){const n=Tn(r);return gn({sent_at:new Date(Xe()).toISOString(),...n&&{sdk:n},...!!i&&t&&{dsn:li(t)}},["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,t,r=1){if(this._options.sendClientReports){const i=`${e}:${t}`;le&&be.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(e,t){const r=this._hooks[e]=this._hooks[e]||new Set,i=(...e)=>t(...e);return r.add(i),()=>{r.delete(i)}}emit(e,...t){const r=this._hooks[e];r&&r.forEach(e=>e(...t))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(e){return le&&be.error("Error while sending envelope:",e),{}}return le&&be.error("Transport disabled"),{}}registerCleanup(e){}dispose(){}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const r={};return t.forEach(t=>{t?.beforeSetup&&t.beforeSetup(e)}),t.forEach(t=>{t&&Se(e,t,r)}),r}(this,e),we(this,e)}_updateSessionFromEvent(e,t){let r="fatal"===t.level,i=!1;const n=t.exception?.values;if(n){i=!0,r=!1;for(const e of n)if(!1===e.mechanism?.handled){r=!0;break}}const a="ok"===e.status;(a&&0===e.errors||a&&r)&&(Et(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let t=0;for(;!e||t<e;){if(await new Promise(e=>setTimeout(e,1)),!this._numProcessing)return!0;t++}return!1}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,r,i){const n=this.getOptions(),a=this.getIntegrationNames();return!t.integrations&&a.length&&(t.integrations=a),this.emit("preprocessEvent",e,t),e.type||i.setLastEventId(e.event_id||t.event_id),vi(n,e,t,r,this,i).then(e=>{if(null===e)return e;this.emit("postprocessEvent",e,t),e.contexts={trace:{...e.contexts?.trace,...Zt(r)},...e.contexts};const i=fi(this,r);return e.sdkProcessingMetadata={dynamicSamplingContext:i,...e.sdkProcessingMetadata},e})}_captureEvent(e,t={},r=$t(),i=Gt()){return le&&Qn(e)&&be.log(`Captured error event \`${Te(e)[0]||"<unknown>"}\``),this._processEvent(e,t,r,i).then(e=>e.event_id,e=>{le&&(Xn(e)?be.log(e.message):Hn(e)?be.warn(e.message):be.warn(e))})}_processEvent(e,t,r,i){const n=this.getOptions(),{sampleRate:a}=n,o=ea(e),s=Qn(e),l=`before send for type \`${e.type||"error"}\``,u=void 0===a?void 0:function(e){if("boolean"==typeof e)return Number(e);const t="string"==typeof e?parseFloat(e):e;return"number"!=typeof t||isNaN(t)||t<0||t>1?void 0:t}(a),c=Jn(e.type);return this._prepareEvent(e,t,r,i).then(e=>{if(null===e)throw this.recordDroppedEvent("event_processor",c),Wn("An event processor returned `null`, will not send event.");if(!0===t.data?.__sentry__)return e;const r=function(e,t,r,i){const{beforeSend:n,beforeSendTransaction:a,ignoreSpans:o}=t,s=!((l=t.beforeSendSpan)&&"function"==typeof l&&"_streamed"in l&&l._streamed)&&t.beforeSendSpan;var l;let u=r;if(Qn(u)&&n)return n(u,i);if(ea(u)){if(s||o){const t=function(e){const{trace_id:t,parent_span_id:r,span_id:i,status:n,origin:a,data:o,op:s}=e.contexts?.trace??{};return{data:o??{},description:e.transaction,op:s,parent_span_id:r,span_id:i??"",start_timestamp:e.start_timestamp??0,status:n,timestamp:e.timestamp,trace_id:t??"",origin:a,profile_id:o?.[Xt],exclusive_time:o?.[Kt],measurements:e.measurements,is_segment:!0}}(u);if(o?.length&&On({description:t.description,op:t.op,attributes:t.data},o))return null;if(s){const e=s(t);e?u=Dt(r,{type:"transaction",timestamp:(c=e).timestamp,start_timestamp:c.start_timestamp,transaction:c.description,contexts:{trace:{trace_id:c.trace_id,span_id:c.span_id,parent_span_id:c.parent_span_id,op:c.op,status:c.status,origin:c.origin,data:{...c.data,...c.profile_id&&{[Xt]:c.profile_id},...c.exclusive_time&&{[Kt]:c.exclusive_time}}}},measurements:c.measurements}):ur()}if(u.spans){const t=[],r=u.spans;for(const e of r)if(o?.length&&On({description:e.description,op:e.op,attributes:e.data},o))Bn(r,e);else if(s){const r=s(e);r?t.push(r):(ur(),t.push(e))}else t.push(e);const i=u.spans.length-t.length;i&&e.recordDroppedEvent("before_send","span",i),u.spans=t}}if(a){if(u.spans){const e=u.spans.length;u.sdkProcessingMetadata={...r.sdkProcessingMetadata,spanCountBeforeProcessing:e}}return a(u,i)}}var c;return u}(this,n,e,t);return function(e,t){const r=`${t} must return \`null\` or a valid event.`;if(ze(e))return e.then(e=>{if(!Fe(e)&&null!==e)throw Zn(r);return e},e=>{throw Zn(`${t} rejected with ${e}`)});if(!Fe(e)&&null!==e)throw Zn(r);return e}(r,l)}).then(n=>{if(null===n){if(this.recordDroppedEvent("before_send",c),o){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw Wn(`${l} returned \`null\`, will not send event.`)}const h=r.getSession()||i.getSession();if(s&&h&&this._updateSessionFromEvent(h,n),s&&"number"==typeof u&&He()>u)throw this.recordDroppedEvent("sample_rate","error"),Wn(`Discarding event because it's not included in the random sample (sampling rate = ${a})`);if(o){const e=(n.sdkProcessingMetadata?.spanCountBeforeProcessing||0)-(n.spans?n.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const d=n.transaction_info;if(o&&d&&n.transaction!==e.transaction){const e="custom";n.transaction_info={...d,source:e}}return this.sendEvent(n,t),n}).then(null,e=>{if(Xn(e)||Hn(e))throw e;throw this.captureException(e,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:e}),Zn(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)})}_process(e,t){this._numProcessing++,this._promiseBuffer.add(e).then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e===Rn&&this.recordDroppedEvent("queue_overflow",t),e))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([e,t])=>{const[r,i]=e.split(":");return{reason:r,category:i,quantity:t}})}_flushOutcomes(){le&&be.log("Flushing outcomes...");const e=this._clearOutcomes();if(0===e.length)return void(le&&be.log("No outcomes to send"));if(!this._dsn)return void(le&&be.log("No dsn provided, will not send outcomes"));le&&be.log("Sending outcomes:",e);const t=(r=e,gn((i=this._options.tunnel&&li(this._dsn))?{dsn:i}:{},[[{type:"client_report"},{timestamp:St(),discarded_events:r}]]));var r,i;this.sendEnvelope(t)}}function Jn(e){return"replay_event"===e?"replay":e||"error"}function Qn(e){return void 0===e.type}function ea(e){return"transaction"===e.type}function ta(e){let t=0;return e.name&&(t+=2*e.name.length),t+=8,t+ia(e.attributes)}function ra(e){let t=0;return e.message&&(t+=2*e.message.length),t+ia(e.attributes)}function ia(e){if(!e)return 0;let t=0;return Object.values(e).forEach(e=>{Array.isArray(e)?t+=e.length*na(e[0]):Me(e)?t+=na(e):t+=100}),t}function na(e){return"string"==typeof e?2*e.length:"number"==typeof e?8:"boolean"==typeof e?4:0}function aa(e){"aggregates"in e?void 0===e.attrs?.ip_address&&(e.attrs={...e.attrs,ip_address:"{{auto}}"}):void 0===e.ipAddress&&(e.ipAddress="{{auto}}")}class oa extends Yn{constructor(e){const t=(r=e,{release:"string"==typeof __SENTRY_RELEASE__?__SENTRY_RELEASE__:Ei.SENTRY_RELEASE?.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...r});var r;!function(e,t,r=[t],i="npm"){const n=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};n.name||(n.name=`sentry.javascript.${t}`,n.packages=r.map(e=>({name:`${i}:@sentry/${e}`,version:ue})),n.version=ue)}(t,"browser",["browser"],Ei.SENTRY_SDK_SOURCE||"npm"),super(t);const{userInfo:i}=this.getDataCollectionOptions();t._metadata?.sdk&&(t._metadata.sdk.settings={infer_ip:i?"auto":"never",...t._metadata.sdk.settings});const{sendClientReports:n}=this._options;Ei.document&&Ei.document.addEventListener("visibilitychange",()=>{"hidden"===Ei.document.visibilityState&&(n&&this._flushOutcomes(),queueMicrotask(()=>{this.flush()}))}),i&&this.on("beforeSendSession",aa)}eventFromException(e,t){return function(e,t,r,i){const n=en(e,t,r?.syntheticException||void 0,i);return et(n),n.level="error",r?.event_id&&(n.event_id=r.event_id),Kr(n)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",r){return function(e,t,r="info",i,n){const a=tn(e,t,i?.syntheticException||void 0,n);return a.level=r,i?.event_id&&(a.event_id=i.event_id),Kr(a)}(this._options.stackParser,e,t,r,this._options.attachStacktrace)}_prepareEvent(e,t,r,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,r,i)}}function sa(e,t,r=Ln(e.bufferSize||64)){let i={};return{send:function(n){const a=[];if(_n(n,(t,r)=>{const n=Sn(r);!function(e,t,r=Xe()){return function(e,t){return e[t]||e.all||0}(e,t)>r}(i,n)?a.push(t):e.recordDroppedEvent("ratelimit_backoff",n)}),0===a.length)return Promise.resolve({});const o=gn(n[0],a),s=t=>{!function(e,t){return _n(e,(e,r)=>t.includes(r))}(o,["client_report"])?_n(o,(r,i)=>{e.recordDroppedEvent(t,Sn(i))}):le&&be.warn(`Dropping client report. Will not send outcomes (reason: ${t}).`)};return r.add(()=>t({body:bn(o)}).then(e=>413===e.statusCode?(le&&be.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),s("send_error"),e):(le&&void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&be.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),i=function(e,{statusCode:t,headers:r},i=Xe()){const n={...e},a=r?.["x-sentry-rate-limits"],o=r?.["retry-after"];if(a)for(const e of a.trim().split(",")){const[t,r,,,a]=e.split(":",5),o=parseInt(t,10),s=1e3*(isNaN(o)?60:o);if(r)for(const e of r.split(";"))"metric_bucket"===e&&a&&!a.split(";").includes("custom")||(n[e]=i+s);else n.all=i+s}else o?n.all=i+function(e,t=Xe()){const r=parseInt(`${e}`,10);if(!isNaN(r))return 1e3*r;const i=Date.parse(`${e}`);return isNaN(i)?6e4:i-t}(o,i):429===t&&(n.all=i+6e4);return n}(i,e),e),e=>{throw s("network_error"),le&&be.error("Encountered error running transport request:",e),e})).then(e=>e,e=>{if(e===Rn)return le&&be.error("Skipped sending event because buffer is full."),s("queue_overflow"),Promise.resolve({});throw e})},flush:e=>r.drain(e)}}const la="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,ua={};function ca(e,t=function(e){const t=ua[e];if(t)return t;let r=Rr[e];if(Sr(r))return ua[e]=r.bind(Rr);const i=Rr.document;if(i&&"function"==typeof i.createElement)try{const t=i.createElement("iframe");t.hidden=!0,i.head.appendChild(t);const n=t.contentWindow;n?.[e]&&(r=n[e]),i.head.removeChild(t)}catch(t){la&&be.warn(`Could not create sandbox iframe for ${e} check, bailing to window.${e}: `,t)}return r?ua[e]=r.bind(Rr):r}("fetch")){let r=0,i=0;return sa(e,async function(n){const a=n.body.length;r+=a,i++;const o={body:n.body,method:"POST",referrerPolicy:"strict-origin",headers:e.headers,keepalive:r<=6e4&&i<15,...e.fetchOptions};try{const r=await t(e.url,o);return{statusCode:r.status,headers:{"x-sentry-rate-limits":r.headers.get("X-Sentry-Rate-Limits"),"retry-after":r.headers.get("Retry-After")}}}catch(e){throw ua.fetch=void 0,e}finally{r-=a,i--}},Ln(e.bufferSize||40))}function ha(e,t,r,i){const n={filename:e,function:"<anonymous>"===t?"?":t,in_app:!0};return void 0!==r&&(n.lineno=r),void 0!==i&&(n.colno=i),n}const da=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,pa=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fa=/\((\S*)(?::(\d+))(?::(\d+))\)/,ma=/at (.+?) ?\(data:(.+?),/,ga=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ya=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,_a=function(...e){const t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,r=0,i=0)=>{const n=[],a=e.split("\n");for(let e=r;e<a.length;e++){let r=a[e];r.length>1024&&(r=r.slice(0,1024));const o=nt.test(r)?r.replace(nt,"$1"):r;if(!o.includes("Error: ")){for(const e of t){const t=e(o);if(t){n.push(t);break}}if(n.length>=50+i)break}}return function(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(ot(t).function||"")&&t.pop(),t.reverse(),at.test(ot(t).function||"")&&(t.pop(),at.test(ot(t).function||"")&&t.pop()),t.slice(0,50).map(e=>({...e,filename:e.filename||ot(t).filename,function:e.function||"?"}))}(n.slice(i))}}([30,e=>{const t=e.match(ma);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const r=da.exec(e);if(r){const[,e,t,i]=r;return ha(e,"?",+t,+i)}const i=pa.exec(e);if(i){if(0===i[2]?.indexOf("eval")){const e=fa.exec(i[2]);e&&(i[2]=e[1],i[3]=e[2],i[4]=e[3])}const[e,t]=va(i[1]||"?",i[2]);return ha(t,e,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}}],[50,e=>{const t=ga.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=ya.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],r=t[1]||"?";return[r,e]=va(r,e),ha(e,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),va=(e,t)=>{const r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};var ba="undefined"==typeof VERSION?"4.0.0-dev.2":VERSION,xa="undefined"!=typeof SENTRY_DSN&&SENTRY_DSN?SENTRY_DSN:"https://872f598f020e3cd73a0933b562d24c81@sentry.mapvx.app/5",wa=new Set(["BrowserApiErrors","BrowserSession","Breadcrumbs","GlobalHandlers"]);function Sa(e){if("string"==typeof e)return e;if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(t){return String(e)}}function Ta(e){return Ta="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ta(e)}function Pa(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Ea(i.key),i)}}function Ea(e){var t=function(e){if("object"!=Ta(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Ta(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ta(t)?t:t+""}var Da="undefined"!=typeof DEBUG&&DEBUG,Aa=function(){function e(){var t,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Da?console.log("Initializing logger (debug mode — Sentry disabled)"):this.sentry=(t=[bt(),Ht(),{name:"ConversationId",setup(e){e.on("spanStart",e=>{const t=$t().getScopeData(),r=Gt().getScopeData(),i=t.conversationId||r.conversationId;if(i){const{op:t,data:r,description:n}=ar(e);if(!t?.startsWith("gen_ai.")&&!r["ai.operationId"]&&!n?.startsWith("ai."))return;e.setAttribute("gen_ai.conversation.id",i)}})}},Fi(),ki(),nn(),mn(),cr(),{name:"HttpContext",preprocessEvent(e){if(!Ei.navigator&&!Ei.location&&!Ei.document)return;const t=Ci(),r={...t.headers,...e.request?.headers};e.request={...t,...e.request,headers:r}},processSpan(e){if(!Ei.navigator&&!Ei.location&&!Ei.document)return;const t=Ci();Ni(e,{[un]:t.headers["User-Agent"],...e.is_segment&&{[ln]:"http.client"!==e.attributes?.["sentry.op"]?t.url:void 0,"http.request.header.referer":t.headers.Referer}})}},{name:"CultureContext",preprocessEvent(e){const t=Ui();t&&(e.contexts={...e.contexts,culture:{...t,...e.contexts?.culture}})},processSegmentSpan(e){const t=Ui();t&&Ni(e,{"culture.locale":t.locale,"culture.timezone":t.timezone,"culture.calendar":t.calendar})}},ji()].filter(function(e){return!wa.has(e.name)}),r=new oa({dsn:xa,transport:ca,stackParser:_a,integrations:t,release:"@mapvx/web-js@".concat(ba),environment:"production",tracesSampleRate:0}),(i=new Rt).setClient(r),r.init(),i)}return t=e,r=[{key:"logEvent",value:function(e,t){var r;Da?console.log(e,t):null===(r=this.sentry)||void 0===r||r.addBreadcrumb({category:"event",message:e,level:"info",data:t})}},{key:"logDebug",value:function(){var e;Da&&(e=console).log.apply(e,arguments)}},{key:"logWarning",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i,n;Da?(i=console).warn.apply(i,t):null===(n=this.sentry)||void 0===n||n.addBreadcrumb({category:"warning",level:"warning",message:t.map(Sa).join(" ")})}},{key:"logError",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Da){var i;(i=console).error.apply(i,t)}else{var n,a=t[0],o=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}(t).slice(1),s=a instanceof Error?a:new Error(Sa(a));null===(n=this.sentry)||void 0===n||n.captureException(s,o.length>0?{data:{args:o}}:void 0)}}},{key:"debugLog",value:function(){var e;Da&&(e=console).log.apply(e,arguments)}}],i=[{key:"getInstance",value:function(){var t;return null!==(t=e.instance)&&void 0!==t||(e.instance=new e),e.instance}}],r&&Pa(t.prototype,r),i&&Pa(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,r,i}();function Ia(e){return Ia="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ia(e)}function Ca(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function ka(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ca(Object(r),!0).forEach(function(t){Ma(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ca(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Ma(e,t,r){return(t=Ra(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Fa(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Ra(i.key),i)}}function Ra(e){var t=function(e){if("object"!=Ia(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Ia(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ia(t)?t:t+""}var La=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.logger=Aa.getInstance()},t=[{key:"logEvent",value:function(e,t){var r=this.enrichSegmentation(t);this.logger.logEvent(e,r)}},{key:"logError",value:function(e,t){e instanceof Error?this.logger.logError(e,t):this.logger.logError(String(e),t)}},{key:"logWarning",value:function(e,t){e instanceof Error?this.logger.logWarning(e,t):this.logger.logWarning(String(e),t)}},{key:"logDebug",value:function(){var e;(e=this.logger).debugLog.apply(e,arguments)}},{key:"setToken",value:function(e){this.token=e}},{key:"enrichSegmentation",value:function(e){var t=null!=e?e:{};return this.token?ka(ka({},t),{},{token:this.token}):t}}],t&&Fa(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),za=Object.create,Oa=Object.defineProperty,Ba=Object.getOwnPropertyDescriptor,ja=Object.getOwnPropertyNames,Na=Object.getPrototypeOf,Ua=Object.prototype.hasOwnProperty,Va=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);function $a(e,t){this.x=e,this.y=t}let Ga,qa;function Za(){return Ga??=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap,Ga}function Wa(){if(null==qa&&(qa=!1,Za())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let t=0;t<25;t++){let r=4*t;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(t%5,Math.floor(t/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let e=0;e<100;e++)if(e%4!=3&&t[e]!==e){qa=!0;break}}}return qa||!1}$a.prototype={clone(){return new $a(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),r=Math.sin(e),i=t*this.x-r*this.y,n=r*this.x+t*this.y;return this.x=i,this.y=n,this},_rotateAround(e,t){let r=Math.cos(e),i=Math.sin(e),n=t.x+r*(this.x-t.x)-i*(this.y-t.y),a=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=n,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:$a},$a.convert=function(e){if(e instanceof $a)return e;if(Array.isArray(e))return new $a(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new $a(+e.x,+e.y);throw Error("Expected [x, y] or {x, y} point format")};var Ha=typeof Float32Array<"u"?Float32Array:Array;function Xa(){var e=new Ha(9);return Ha!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Ka(){var e=new Ha(16);return Ha!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function Ya(e){var t=new Ha(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Ja(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Qa(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],y=t[15],_=r*s-i*o,v=r*l-n*o,b=r*u-a*o,x=i*l-n*s,w=i*u-a*s,S=n*u-a*l,T=c*m-h*f,P=c*g-d*f,E=c*y-p*f,D=h*g-d*m,A=h*y-p*m,I=d*y-p*g,C=_*I-v*A+b*D+x*E-w*P+S*T;return C?(C=1/C,e[0]=(s*I-l*A+u*D)*C,e[1]=(n*A-i*I-a*D)*C,e[2]=(m*S-g*w+y*x)*C,e[3]=(d*w-h*S-p*x)*C,e[4]=(l*E-o*I-u*P)*C,e[5]=(r*I-n*E+a*P)*C,e[6]=(g*b-f*S-y*v)*C,e[7]=(c*S-d*b+p*v)*C,e[8]=(o*A-s*E+u*T)*C,e[9]=(i*E-r*A-a*T)*C,e[10]=(f*w-m*b+y*_)*C,e[11]=(h*b-c*w-p*_)*C,e[12]=(s*P-o*D-l*T)*C,e[13]=(r*D-i*P+n*T)*C,e[14]=(m*v-f*x-g*_)*C,e[15]=(c*x-h*v+d*_)*C,e):null}function eo(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],y=t[14],_=t[15],v=r[0],b=r[1],x=r[2],w=r[3];return e[0]=v*i+b*s+x*h+w*m,e[1]=v*n+b*l+x*d+w*g,e[2]=v*a+b*u+x*p+w*y,e[3]=v*o+b*c+x*f+w*_,v=r[4],b=r[5],x=r[6],w=r[7],e[4]=v*i+b*s+x*h+w*m,e[5]=v*n+b*l+x*d+w*g,e[6]=v*a+b*u+x*p+w*y,e[7]=v*o+b*c+x*f+w*_,v=r[8],b=r[9],x=r[10],w=r[11],e[8]=v*i+b*s+x*h+w*m,e[9]=v*n+b*l+x*d+w*g,e[10]=v*a+b*u+x*p+w*y,e[11]=v*o+b*c+x*f+w*_,v=r[12],b=r[13],x=r[14],w=r[15],e[12]=v*i+b*s+x*h+w*m,e[13]=v*n+b*l+x*d+w*g,e[14]=v*a+b*u+x*p+w*y,e[15]=v*o+b*c+x*f+w*_,e}function to(e,t,r){var i,n,a,o,s,l,u,c,h,d,p,f,m=r[0],g=r[1],y=r[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*y+t[12],e[13]=t[1]*m+t[5]*g+t[9]*y+t[13],e[14]=t[2]*m+t[6]*g+t[10]*y+t[14],e[15]=t[3]*m+t[7]*g+t[11]*y+t[15]):(i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],p=t[10],f=t[11],e[0]=i,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=d,e[10]=p,e[11]=f,e[12]=i*m+s*g+h*y+t[12],e[13]=n*m+l*g+d*y+t[13],e[14]=a*m+u*g+p*y+t[14],e[15]=o*m+c*g+f*y+t[15]),e}function ro(e,t,r){var i=r[0],n=r[1],a=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function io(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*n+u*i,e[5]=o*n+c*i,e[6]=s*n+h*i,e[7]=l*n+d*i,e[8]=u*n-a*i,e[9]=c*n-o*i,e[10]=h*n-s*i,e[11]=d*n-l*i,e}function no(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[0],o=t[1],s=t[2],l=t[3],u=t[8],c=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n-u*i,e[1]=o*n-c*i,e[2]=s*n-h*i,e[3]=l*n-d*i,e[8]=a*i+u*n,e[9]=o*i+c*n,e[10]=s*i+h*n,e[11]=l*i+d*n,e}function ao(e,t,r){var i=Math.sin(r),n=Math.cos(r),a=t[0],o=t[1],s=t[2],l=t[3],u=t[4],c=t[5],h=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*n+u*i,e[1]=o*n+c*i,e[2]=s*n+h*i,e[3]=l*n+d*i,e[4]=u*n-a*i,e[5]=c*n-o*i,e[6]=h*n-s*i,e[7]=d*n-l*i,e}Math.PI,Math.PI;var oo=function(e,t,r,i,n){var a=1/Math.tan(t/2);if(e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0){var o=1/(i-n);e[10]=(n+i)*o,e[14]=2*n*i*o}else e[10]=-1,e[14]=-2*i;return e},so=function(e,t,r,i,n,a,o){var s=1/(t-r),l=1/(i-n),u=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*s,e[13]=(n+i)*l,e[14]=(o+a)*u,e[15]=1,e};function lo(){var e=new Ha(3);return Ha!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function uo(e){var t=new Ha(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function co(e){var t=e[0],r=e[1],i=e[2];return Math.sqrt(t*t+r*r+i*i)}function ho(e,t,r){var i=new Ha(3);return i[0]=e,i[1]=t,i[2]=r,i}function po(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function fo(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function mo(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function go(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e}function yo(e,t){var r=t[0],i=t[1],n=t[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function _o(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function vo(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2];return e[0]=n*l-a*s,e[1]=a*o-i*l,e[2]=i*s-n*o,e}function bo(e,t,r){var i=r[0],n=r[1],a=r[2],o=r[3],s=t[0],l=t[1],u=t[2],c=n*u-a*l,h=a*s-i*u,d=i*l-n*s;return c+=c,h+=h,d+=d,e[0]=s+o*c+n*d-a*h,e[1]=l+o*h+a*c-i*d,e[2]=u+o*d+i*h-n*c,e}function xo(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0],a[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),a[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function wo(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),a[1]=n[1],a[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function So(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),a[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),a[2]=n[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}var To=fo,Po=co;function Eo(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*o,e[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*o,e[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*o,e[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*o,e}lo();var Do;function Ao(){var e=new Ha(4);return Ha!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function Io(e,t,r,i){var n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",a=Math.PI/360;t*=a,i*=a,r*=a;var o=Math.sin(t),s=Math.cos(t),l=Math.sin(r),u=Math.cos(r),c=Math.sin(i),h=Math.cos(i);switch(n){case"xyz":e[0]=o*u*h+s*l*c,e[1]=s*l*h-o*u*c,e[2]=s*u*c+o*l*h,e[3]=s*u*h-o*l*c;break;case"xzy":e[0]=o*u*h-s*l*c,e[1]=s*l*h-o*u*c,e[2]=s*u*c+o*l*h,e[3]=s*u*h+o*l*c;break;case"yxz":e[0]=o*u*h+s*l*c,e[1]=s*l*h-o*u*c,e[2]=s*u*c-o*l*h,e[3]=s*u*h+o*l*c;break;case"yzx":e[0]=o*u*h+s*l*c,e[1]=s*l*h+o*u*c,e[2]=s*u*c-o*l*h,e[3]=s*u*h-o*l*c;break;case"zxy":e[0]=o*u*h-s*l*c,e[1]=s*l*h+o*u*c,e[2]=s*u*c+o*l*h,e[3]=s*u*h-o*l*c;break;case"zyx":e[0]=o*u*h-s*l*c,e[1]=s*l*h+o*u*c,e[2]=s*u*c-o*l*h,e[3]=s*u*h+o*l*c;break;default:throw Error("Unknown angle order "+n)}return e}Do=new Ha(4),Ha!=Float32Array&&(Do[0]=0,Do[1]=0,Do[2]=0,Do[3]=0);var Co=function(e,t,r,i){var n=new Ha(4);return n[0]=e,n[1]=t,n[2]=r,n[3]=i,n};function ko(){var e=new Ha(2);return Ha!=Float32Array&&(e[0]=0,e[1]=0),e}function Mo(e,t){var r=new Ha(2);return r[0]=e,r[1]=t,r}function Fo(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function Ro(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function Lo(e){return e[0]=0,e[1]=0,e}lo(),ho(1,0,0),ho(0,1,0),Ao(),Ao(),Xa();var zo=function(e){var t=e[0],r=e[1];return t*t+r*r};ko();const Oo=8192;function Bo(e,t,r){return t*(Oo/(e.tileSize*2**(r-e.tileID.overscaledZ)))}function jo(e){return e instanceof Error?e:Error("string"==typeof e?e:String(e))}function No(){return new Float64Array(4)}function Uo(){return new Float64Array(3)}function Vo(){return new Float64Array(16)}function $o(){let e=new Float64Array(16);return Ja(e),e}function Go(){let e=new Float32Array(16);return Ja(e),e}function qo(e,t,r,i,n=!1){if(!r[0]&&!r[1])return[0,0];let a=n?"map"===i?-e.bearingInRadians:0:"viewport"===i?e.bearingInRadians:0;if(a){let e=Math.sin(a),t=Math.cos(a);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}return[n?r[0]:Bo(t,r[0],e.zoom),n?r[1]:Bo(t,r[1],e.zoom)]}function Zo(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function Wo(e,t,r){let i=function(e){var t=e[3],r=e[4],i=e[5],n=e[6],a=e[7],o=e[8];return e[0]*(o*r-i*a)+e[1]*(-o*t+i*n)+e[2]*(a*t-r*n)}([e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2]]);if(0===i)return null;let n=vo([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),a=vo([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),o=vo([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),s=mo([],n,-e[3]);return po(s,s,mo([],a,-t[3])),po(s,s,mo([],o,-r[3])),mo(s,s,1/i),s}function Ho(e,t,r){let i=e[0]*r[0]+e[1]*r[1]+e[2]*r[2],n=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return 0===n?null:(-i-r[3])/n}function Xo(e,t,r,i){let n=Math.sqrt(e*e+t*t),a=Math.sqrt(r*r+i*i),o=(e/=n)*(r/=a)+(t/=n)*(i/=a),s=Math.acos(o);return-t*r+e*i>0?s:-s}function Ko(e,t){let r=Jo(e,360),i=Jo(t,360),n=i-r,a=i>r?n-360:n+360;return Math.abs(n)<Math.abs(a)?n:a}function Yo(e,t){let r=Jo(e,2*Math.PI),i=Jo(t,2*Math.PI);return Math.min(Math.abs(r-i),Math.abs(r-i+2*Math.PI),Math.abs(r-i-2*Math.PI))}function Jo(e,t){return(e%t+t)%t}function Qo(e,t,r,i,n){return es(i,n,ns((e-t)/(r-t),0,1))}function es(e,t,r){return e*(1-r)+t*r}function ts(e){let t=1/0,r=1/0,i=-1/0,n=-1/0;for(let a of e)t=Math.min(t,a.x),r=Math.min(r,a.y),i=Math.max(i,a.x),n=Math.max(n,a.y);return[t,r,i,n]}function rs(e,t,r,i){return function(e,t,r,i){let n=3*e,a=3*(r-e)-n,o=1-n-a,s=3*t,l=3*(i-t)-s,u=1-s-l;return function(e,t=1e-6){if(e<=0)return 0;if(e>=1)return 1;let r=e;for(let i=0;i<8;i++){let i=((o*r+a)*r+n)*r-e;if(Math.abs(i)<t)return((u*r+l)*r+s)*r;let c=(3*o*r+2*a)*r+n;if(Math.abs(c)<1e-6)break;r-=i/c}let i=0,c=1;r=e;for(let s=0;s<20;s++){let s=((o*r+a)*r+n)*r;if(Math.abs(s-e)<t)break;e>s?i=r:c=r,r=.5*(i+c)}return((u*r+l)*r+s)*r}}(e,t,r,i)}const is=rs(.25,.1,.25,1);function ns(e,t,r){return Math.min(r,Math.max(t,e))}function as(e,t,r){let i=r-t,n=((e-t)%i+i)%i+t;return n===t?r:n}function os(e,...t){for(let r of t)for(let t in r)e[t]=r[t];return e}function ss(e,t){let r={};for(let i of t)i in e&&(r[i]=e[i]);return r}let ls=1;function us(){return ls++}function cs(e){return 2**e}function hs(e){return Math.log(e)/Math.LN2}function ds(e,t,r){if(t<=0)return e;let i=1/t;return void 0===r||Math.abs(r)<1e-10?Math.round(e*i)/i:(r>0?Math.ceil(e*i-1e-9):Math.floor(e*i+1e-10))/i}function ps(e,t,r){let i={};for(let n in e)i[n]=t.call(r||this,e[n],n,e);return i}function fs(e,t,r){let i={};for(let n in e)t.call(r||this,e[n],n,e)&&(i[n]=e[n]);return i}function ms(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!ms(e[r],t[r]))return!1;return!0}if("object"==typeof e&&e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!ms(e[r],t[r]))return!1;return!0}return e===t}function gs(e){return Array.isArray(e)?e.map(gs):"object"==typeof e&&e?ps(e,gs):e}const ys={};function _s(e){ys[e]||(typeof console<"u"&&console.warn(e),ys[e]=!0)}function vs(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function bs(e){return typeof WorkerGlobalScope<"u"&&void 0!==e&&e instanceof WorkerGlobalScope}let xs=null;function ws(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}function Ss(e,t,r,i){return e.addEventListener(t,r,i),{unsubscribe:()=>{e.removeEventListener(t,r,i)}}}function Ts(e){return e*Math.PI/180}function Ps(e){return e/Math.PI*180}function Es(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function Ds(e,t,r){let i=Mo(t.x-r.x,t.y-r.y),n=Mo(e.x-r.x,e.y-r.y),a=i[0]*n[1]-i[1]*n[0];return Ps(Math.atan2(a,function(e,t){return e[0]*t[0]+e[1]*t[1]}(i,n)))}function As(e,t,r){let i=new Float64Array(4);return Io(i,e,t-90,r),i}const Is=85.051129,Cs={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},ks={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function Ms(e,t){return Cs[t]&&"touches"in e}function Fs(e,t){if(!ks[t])return!1;let r=e,i=(r?.target)?.ownerDocument?.defaultView||window;return r instanceof i.MouseEvent||r instanceof i.WheelEvent}function Rs(e){return Cs[e]||ks[e]}const Ls="AbortError";var zs=class extends Error{constructor(e=Ls){super(e instanceof Error?e.message:e),this.name=Ls,e instanceof Error&&e.stack&&(this.stack=e.stack)}};function Os(e){return e instanceof Error&&"AbortError"===e.name}function Bs(e){if(e.aborted)throw new zs(e.reason)}const js={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Ns(e){return js.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}const Us="global-dispatcher";var Vs=class extends Error{constructor(e,t,r,i){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=i}};function $s(){if(bs(self))return self.worker?.referrer;if("blob:"===window.location.protocol)try{return window.parent.location.href}catch{}return window.location.href}const Gs=async function(e,t){if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){let r=Ns(e.url);if(r){let i=await r(e,t);return i.data||"arrayBuffer"!==e.type?i:os(i,{data:new ArrayBuffer(0)})}if(bs(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:Us},t)}if(!(e=>e.startsWith("file:")||$s()?.startsWith("file:")&&!/^\w+:/.test(e))(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return async function(e,t){let r,i,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:$s(),referrerPolicy:e.referrerPolicy,signal:t.signal});"json"===e.type&&!n.headers.has("Accept")&&n.headers.set("Accept","application/json");try{r=await fetch(n)}catch(t){throw Os(t)?t:new Vs(0,jo(t).message,e.url,new Blob)}if(!r.ok){let t=await r.blob();throw new Vs(r.status,r.statusText,e.url,t)}i="arrayBuffer"===e.type||"image"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text();let a=await i;return Bs(t.signal),{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),etag:r.headers.get("ETag")}}(e,t);if(bs(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:Us},t)}return function(e,t){return new Promise((r,i)=>{let n=new XMLHttpRequest;n.open(e.method||"GET",e.url,!0),("arrayBuffer"===e.type||"image"===e.type)&&(n.responseType="arraybuffer");for(let t in e.headers)n.setRequestHeader(t,e.headers[t]);"json"===e.type&&(n.responseType="text",e.headers?.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials="include"===e.credentials,n.onerror=()=>{i(Error(n.statusText))},n.onload=()=>{if(!t.signal.aborted)if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){let t=n.response;if("json"===e.type)try{t=JSON.parse(n.response)}catch(e){return void i(e)}r({data:t,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires"),etag:n.getResponseHeader("ETag")})}else{let t=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new Vs(n.status,n.statusText,e.url,t))}},t.signal.addEventListener("abort",()=>{n.abort(),i(new zs(t.signal.reason))}),n.send(e.body)})}(e,t)},qs=(e,t)=>Gs(os(e,{type:"json"}),t),Zs=(e,t)=>Gs(os(e,{type:"arrayBuffer"}),t);function Ws(e){if(!e||e.startsWith("data:image/"))return!0;if(e.startsWith("blob:")&&(e=e.slice(5)).startsWith("null"))return!1;if(e.indexOf("://")<=0)return!0;let t=new URL(e),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function Hs(e,t,r){r[e]?.includes(t)||(r[e]||=[],r[e].push(t))}function Xs(e,t,r){if(r?.[e]){let i=r[e].indexOf(t);-1!==i&&r[e].splice(i,1)}}var Ks=class{constructor(e,t={}){os(this,t),this.type=e}},Ys=class extends Ks{constructor(e,t={}){super("error",os({error:e},t))}},Js=class{on(e,t){return this._listeners||={},Hs(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return Xs(e,t,this._listeners),Xs(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||={},Hs(e,t,this._oneTimeListeners),this):new Promise(t=>this.once(e,t))}fire(e,t){let r="string"==typeof e?new Ks(e,t||{}):e,i=r.type;if(this.listens(i)){r.target=this;let e=this._listeners?.[i]?.slice()??[];for(let t of e)t.call(this,r);let t=this._oneTimeListeners?.[i]?.slice()??[];for(let e of t)Xs(i,e,this._oneTimeListeners),e.call(this,r);let n=this._eventedParent;n&&(os(r,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),n.fire(r))}else r instanceof Ys&&console.error(r.error);return this}listens(e){return!!(this._listeners?.[e]?.length||this._oneTimeListeners?.[e]?.length||this._eventedParent?.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}},Qs={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},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},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!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:{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:{},"color-relief":{},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_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-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","feature"]},"property-type":"data-driven"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!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-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!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"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!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-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,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,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default: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-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"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","feature"]},"property-type":"cross-faded-data-driven"},"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,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:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",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"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};const el=Qs,tl=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var rl=class{constructor(e,t,r,i,n="error"){this.message=(e?`${e}: `:"")+r,i&&(this.identifier=i),this.severity=n,null!=t&&t.__line__&&(this.line=t.__line__)}};const il={kind:"null"},nl={kind:"number"},al={kind:"string"},ol={kind:"boolean"},sl={kind:"color"},ll={kind:"projectionDefinition"},ul={kind:"object"},cl={kind:"value"},hl={kind:"collator"},dl={kind:"formatted"},pl={kind:"padding"},fl={kind:"colorArray"},ml={kind:"numberArray"},gl={kind:"resolvedImage"},yl={kind:"variableAnchorOffsetCollection"};function _l(e,t){return{kind:"array",itemType:e,N:t}}function vl(e){if("array"===e.kind){let t=vl(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const bl=[il,nl,al,ol,sl,ll,dl,ul,_l(cl),pl,ml,fl,gl,yl];function xl(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!xl(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(let e of bl)if(!xl(e,t))return null}return`Expected ${vl(e)} but found ${vl(t)} instead.`}function wl(e,t){return t.some(t=>t.kind===e.kind)}function Sl(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function Tl(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const Pl=.96422,El=.82521,Dl=4/29,Al=6/29,Il=.12841854934601665,Cl=Math.PI/180,kl=180/Math.PI;function Ml(e){return(e%=360)<0&&(e+=360),e}function Fl([e,t,r,i]){let n,a,o=Ll((.2225045*(e=Rl(e))+.7168786*(t=Rl(t))+.0606169*(r=Rl(r)))/1);e===t&&t===r?n=a=o:(n=Ll((.4360747*e+.3850649*t+.1430804*r)/Pl),a=Ll((.0139322*e+.0971045*t+.7141733*r)/El));let s=116*o-16;return[s<0?0:s,500*(n-o),200*(o-a),i]}function Rl(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Ll(e){return e>.008856451679035631?e**(1/3):e/Il+Dl}function zl([e,t,r,i]){let n=(e+16)/116,a=isNaN(t)?n:n+t/500,o=isNaN(r)?n:n-r/200;return n=1*Bl(n),a=Pl*Bl(a),o=El*Bl(o),[Ol(3.1338561*a-1.6168667*n-.4906146*o),Ol(-.9787684*a+1.9161415*n+.033454*o),Ol(.0719453*a-.2289914*n+1.4052427*o),i]}function Ol(e){return(e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055)<0?0:e>1?1:e}function Bl(e){return e>Al?e*e*e:Il*(e-Dl)}const jl=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Nl(e,t){return jl(e,t)?e[t]:void 0}function Ul(e){return parseInt(e.padEnd(2,e),16)/255}function Vl(e,t){return $l(t?e/100:e,0,1)}function $l(e,t,r){return Math.min(Math.max(t,e),r)}function Gl(e){return!e.some(Number.isNaN)}const ql={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Zl(e,t,r){return e+r*(t-e)}function Wl(e,t,r){return e.map((e,i)=>Zl(e,t[i],r))}var Hl=class e{constructor(e,t,r,i=1,n=!0){this.r=e,this.g=t,this.b=r,this.a=i,n||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,t,r,i]))}static{this.black=new e(0,0,0,1)}static{this.white=new e(1,1,1,1)}static{this.transparent=new e(0,0,0,0)}static{this.red=new e(1,0,0,1)}static parse(t){if(t instanceof e)return t;if("string"!=typeof t)return;let r=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];let t=Nl(ql,e);if(t){let[e,r,i]=t;return[e/255,r/255,i/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,r=1;return[Ul(e.slice(r,r+=t)),Ul(e.slice(r,r+=t)),Ul(e.slice(r,r+=t)),Ul(e.slice(r,r+t)||"ff")]}if(e.startsWith("rgb")){let t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){let[e,r,i,n,a,o,s,l,u,c,h,d]=t,p=[n||" ",s||" ",c].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){let e=[i,o,u].join(""),t="%%%"===e?100:""===e?255:0;if(t){let e=[$l(+r/t,0,1),$l(+a/t,0,1),$l(+l/t,0,1),h?Vl(+h,d):1];if(Gl(e))return e}}return}}let r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[e,t,i,n,a,o,s,l,u]=r,c=[i||" ",a||" ",s].join("");if(" "===c||" /"===c||",,"===c||",,,"===c){let e=[+t,$l(+n,0,100),$l(+o,0,100),l?Vl(+l,u):1];if(Gl(e))return function([e,t,r,i]){function n(i){let n=(i+e/30)%12,a=t*Math.min(r,1-r);return r-a*Math.max(-1,Math.min(n-3,9-n,1))}return e=Ml(e),t/=100,r/=100,[n(0),n(8),n(4),i]}(e)}}}(t);return r?new e(...r,!1):void 0}get rgb(){let{r:e,g:t,b:r,a:i}=this,n=i||1/0;return this.overwriteGetter("rgb",[e/n,t/n,r/n,i])}get hcl(){return this.overwriteGetter("hcl",function(e){let[t,r,i,n]=Fl(e),a=Math.sqrt(r*r+i*i);return[Math.round(1e4*a)?Ml(Math.atan2(i,r)*kl):NaN,a,t,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Fl(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,r,i]=this.rgb;return`rgba(${[e,t,r].map(e=>Math.round(255*e)).join(",")},${i})`}static interpolate(t,r,i,n="rgb"){switch(n){case"rgb":{let[n,a,o,s]=Wl(t.rgb,r.rgb,i);return new e(n,a,o,s,!1)}case"hcl":{let n,a,[o,s,l,u]=t.hcl,[c,h,d,p]=r.hcl;if(isNaN(o)||isNaN(c))isNaN(o)?isNaN(c)?n=NaN:(n=c,(1===l||0===l)&&(a=h)):(n=o,(1===d||0===d)&&(a=s));else{let e=c-o;c>o&&e>180?e-=360:c<o&&o-c>180&&(e+=360),n=o+i*e}let[f,m,g,y]=function([e,t,r,i]){return e=isNaN(e)?0:e*Cl,zl([r,Math.cos(e)*t,Math.sin(e)*t,i])}([n,a??Zl(s,h,i),Zl(l,d,i),Zl(u,p,i)]);return new e(f,m,g,y,!1)}case"lab":{let[n,a,o,s]=zl(Wl(t.lab,r.lab,i));return new e(n,a,o,s,!1)}}}};const Xl=["bottom","center","top"];var Kl=class{constructor(e,t,r,i,n,a){this.text=e,this.image=t,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=a}},Yl=class e{constructor(e){this.sections=e}static fromString(t){return new e([new Kl(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(t){return t instanceof e?t:e.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}},Jl=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("number"==typeof t)return new e([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i){return new e(Wl(t.values,r.values,i))}},Ql=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("number"==typeof t)return new e([t]);if(Array.isArray(t)){for(let e of t)if("number"!=typeof e)return;return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i){return new e(Wl(t.values,r.values,i))}},eu=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("string"==typeof t){let r=Hl.parse(t);return r?new e([r]):void 0}if(!Array.isArray(t))return;let r=[];for(let e of t){if("string"!=typeof e)return;let t=Hl.parse(e);if(!t)return;r.push(t)}return new e(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i,n="rgb"){let a=[];if(t.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let e=0;e<t.values.length;e++)a.push(Hl.interpolate(t.values[e],r.values[e],i,n));return new e(a)}},tu=class extends Error{constructor(e,t){super(e),this.name="RuntimeError",this.path=t}toJSON(){return this.message}};const ru=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var iu=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){let r=t[e],i=t[e+1];if("string"!=typeof r||!ru.has(r)||!Array.isArray(i)||2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])return}return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i,n){let a=t.values,o=r.values;if(a.length!==o.length)throw new tu(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`,n);let s=[];for(let e=0;e<a.length;e+=2){if(a[e]!==o[e])throw new tu(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${a[e]}, to[${e}]: ${o[e]}`,n);s.push(a[e]);let[t,r]=a[e+1],[l,u]=o[e+1];s.push([Zl(t,l,i),Zl(r,u,i)])}return new e(s)}},nu=class e{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(t){return t?new e({name:t,available:!1}):null}},au=class e{constructor(e,t,r){this.from=e,this.to=t,this.transition=r}toString(){return this.from===this.to&&1===this.transition?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(t,r,i){return new e(t,r,i)}static parse(t){return t instanceof e?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new e(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new e(t.from,t.to,t.transition):"string"==typeof t?new e(t,t,1):void 0}},ou=class{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};function su(e,t,r,i){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:`Invalid rgba value [${[e,t,r,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof i?[e,t,r,i]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function lu(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof au||e instanceof Hl||e instanceof ou||e instanceof Yl||e instanceof Jl||e instanceof Ql||e instanceof eu||e instanceof iu||e instanceof nu)return!0;if(Array.isArray(e)){for(let t of e)if(!lu(t))return!1;return!0}if("object"==typeof e){for(let t in e)if(!lu(e[t]))return!1;return!0}return!1}function uu(e){if(null===e)return il;if("string"==typeof e)return al;if("boolean"==typeof e)return ol;if("number"==typeof e)return nl;if(e instanceof Hl)return sl;if(e instanceof au)return ll;if(e instanceof ou)return hl;if(e instanceof Yl)return dl;if(e instanceof Jl)return pl;if(e instanceof Ql)return ml;if(e instanceof eu)return fl;if(e instanceof iu)return yl;if(e instanceof nu)return gl;if(Array.isArray(e)){let t,r=e.length;for(let r of e){let e=uu(r);if(t){if(t===e)continue;t=cl;break}t=e}return _l(t||cl,r)}return ul}function cu(e){let t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Hl||e instanceof au||e instanceof Yl||e instanceof Jl||e instanceof Ql||e instanceof eu||e instanceof iu||e instanceof nu?e.toString():JSON.stringify(e)}var hu=class e{constructor(e,t){this.type=e,this.value=t}static parse(t,r){if(2!==t.length)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!lu(t[1]))return r.error(`invalid value of type "${typeof t[1]}"`);let i=t[1],n=uu(i),a=r.expectedType;return"array"===n.kind&&0===n.N&&a&&"array"===a.kind&&("number"!=typeof a.N||0===a.N)&&(n=a),new e(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const du=["Unknown","Point","LineString","Polygon"];var pu=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?du[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 t=this._parseColorCache.get(e);return t||(t=Hl.parse(e),this._parseColorCache.set(e,t)),t}};function fu(e,t,r){let i,n,a=e.length-1,o=0,s=a,l=0;for(;o<=s;)if(l=Math.floor((o+s)/2),i=e[l],n=e[l+1],i<=t){if(l===a||t<n)return l;o=l+1}else{if(!(i>t))throw new tu("Input is not a number.",r);s=l-1}return 0}var mu=class e{constructor(e,t,r,i){this.type=e,this.input=t,this.key=i,this.labels=[],this.outputs=[];for(let[e,t]of r)this.labels.push(e),this.outputs.push(t)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let i=r.parse(t[1],1,nl);if(!i)return null;let n=[],a=null;r.expectedType&&"value"!==r.expectedType.kind&&(a=r.expectedType);for(let e=1;e<t.length;e+=2){let i=1===e?-1/0:t[e],o=t[e+1],s=e,l=e+1;if("number"!=typeof i)return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',s);if(n.length&&n[n.length-1][0]>=i)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',s);let u=r.parse(o,l,a);if(!u)return null;a||=u.type,n.push([i,u])}return new e(a,i,n,r.key)}evaluate(e){let t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);let i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);let n=t.length;return i>=t[n-1]?r[n-1].evaluate(e):r[fu(t,i,this.key)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}},gu=class e{constructor(e,t,r,i,n,a){this.type=e,this.operator=t,this.interpolation=r,this.input=i,this.key=a,this.labels=[],this.outputs=[];for(let[e,t]of n)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,r,i){let n=0;if("exponential"===e.name)n=yu(t,e.base,r,i);else if("linear"===e.name)n=yu(t,1,r,i);else if("cubic-bezier"===e.name){let a=e.controlPoints;n=function(e,t,r,i){let n=3*e,a=3*(r-e)-n,o=1-n-a,s=3*t,l=3*(i-t)-s,u=1-s-l;return function(e,t=1e-6){if(e<=0)return 0;if(e>=1)return 1;let r=e;for(let i=0;i<8;i++){let i=((o*r+a)*r+n)*r-e;if(Math.abs(i)<t)return((u*r+l)*r+s)*r;let c=(3*o*r+2*a)*r+n;if(Math.abs(c)<1e-6)break;r-=i/c}let i=0,c=1;r=e;for(let s=0;s<20;s++){let s=((o*r+a)*r+n)*r;if(Math.abs(s-e)<t)break;e>s?i=r:c=r,r=.5*(i+c)}return((u*r+l)*r+s)*r}}(a[0],a[1],a[2],a[3])(yu(t,1,r,i))}return n}static parse(t,r){let[i,n,a,...o]=t;if(!Array.isArray(n)||0===n.length)return r.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){let e=n[1];if("number"!=typeof e)return r.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:e}}else{if("cubic-bezier"!==n[0])return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);{let e=n.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:e}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(a=r.parse(a,2,nl),!a)return null;let s=[],l=null;"interpolate-hcl"!==i&&"interpolate-lab"!==i||r.expectedType==fl?r.expectedType&&"value"!==r.expectedType.kind&&(l=r.expectedType):l=sl;for(let e=0;e<o.length;e+=2){let t=o[e],i=o[e+1],n=e+3,a=e+4;if("number"!=typeof t)return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(s.length&&s[s.length-1][0]>=t)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);let u=r.parse(i,a,l);if(!u)return null;l||=u.type,s.push([t,u])}return Tl(l,nl)||Tl(l,ll)||Tl(l,sl)||Tl(l,pl)||Tl(l,ml)||Tl(l,fl)||Tl(l,yl)||Tl(l,_l(nl))?new e(l,i,n,a,s,r.key):r.error(`Type ${vl(l)} is not interpolatable.`)}evaluate(t){let r=this.labels,i=this.outputs;if(1===r.length)return i[0].evaluate(t);let n=this.input.evaluate(t);if(n<=r[0])return i[0].evaluate(t);let a=r.length;if(n>=r[a-1])return i[a-1].evaluate(t);let o=fu(r,n,this.key),s=r[o],l=r[o+1],u=e.interpolationFactor(this.interpolation,n,s,l),c=i[o].evaluate(t),h=i[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Zl(c,h,u);case"color":return Hl.interpolate(c,h,u);case"padding":return Jl.interpolate(c,h,u);case"colorArray":return eu.interpolate(c,h,u);case"numberArray":return Ql.interpolate(c,h,u);case"variableAnchorOffsetCollection":return iu.interpolate(c,h,u,this.key);case"array":return Wl(c,h,u);case"projectionDefinition":return au.interpolate(c,h,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return Hl.interpolate(c,h,u,"hcl");case"colorArray":return eu.interpolate(c,h,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Hl.interpolate(c,h,u,"lab");case"colorArray":return eu.interpolate(c,h,u,"lab")}}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function yu(e,t,r,i){let n=i-r,a=e-r;return 0===n?0:1===t?a/n:(t**+a-1)/(t**+n-1)}const _u={color:Hl.interpolate,number:Zl,padding:Jl.interpolate,numberArray:Ql.interpolate,colorArray:eu.interpolate,variableAnchorOffsetCollection:iu.interpolate,array:Wl};var vu=class e{constructor(e){this.type=dl,this.sections=e}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return r.error("First argument must be an image or text section.");let n=[],a=!1;for(let e=1;e<=t.length-1;++e){let i=t[e];if(a&&"object"==typeof i&&!Array.isArray(i)){a=!1;let e=null;if(i["font-scale"]&&(e=r.parse(i["font-scale"],1,nl),!e))return null;let t=null;if(i["text-font"]&&(t=r.parse(i["text-font"],1,_l(al)),!t))return null;let o=null;if(i["text-color"]&&(o=r.parse(i["text-color"],1,sl),!o))return null;let s=null;if(i["vertical-align"]){if("string"==typeof i["vertical-align"]&&!Xl.includes(i["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${i["vertical-align"]}' instead.`);if(s=r.parse(i["vertical-align"],1,al),!s)return null}let l=n[n.length-1];l.scale=e,l.font=t,l.textColor=o,l.verticalAlign=s}else{let i=r.parse(t[e],1,cl);if(!i)return null;let o=i.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,n.push({content:i,scale:null,font:null,textColor:null,verticalAlign:null})}}return new e(n)}evaluate(e){return new Yl(this.sections.map(t=>{let r=t.content.evaluate(e);return uu(r)===gl?new Kl("",r,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new Kl(cu(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}};function bu(e,t,r=0,i=e.length-1,n=wu){for(;i>r;){if(i-r>600){let a=i-r+1,o=t-r+1,s=Math.log(a),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(a-l)/a)*(o-a/2<0?-1:1);bu(e,t,Math.max(r,Math.floor(t-o*l/a+u)),Math.min(i,Math.floor(t+(a-o)*l/a+u)),n)}let a=e[t],o=r,s=i;for(xu(e,r,t),n(e[i],a)>0&&xu(e,r,i);o<s;){for(xu(e,o,s),o++,s--;n(e[o],a)<0;)o++;for(;n(e[s],a)>0;)s--}0===n(e[r],a)?xu(e,r,s):(s++,xu(e,s,i)),s<=t&&(r=s+1),t<=s&&(i=s-1)}}function xu(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function wu(e,t){return e<t?-1:+(e>t)}function Su(e,t){if(e.length<=1)return[e];let r,i,n=[];for(let t of e){let e=Pu(t);0!==e&&(t.area=Math.abs(e),void 0===i&&(i=e<0),i===e<0?(r&&n.push(r),r=[t]):r.push(t))}if(r&&n.push(r),t>1)for(let e=0;e<n.length;e++)n[e].length<=t||(bu(n[e],t,1,n[e].length-1,Tu),n[e]=n[e].slice(0,t));return n}function Tu(e,t){return t.area-e.area}function Pu(e){let t=0;for(let r,i,n=0,a=e.length,o=a-1;n<a;o=n++)r=e[n],i=e[o],t+=(i.x-r.x)*(r.y+i.y);return t}const Eu={string:al,number:nl,boolean:ol,object:ul};var Du=class e{constructor(e,t,r){this.type=e,this.args=t,this.key=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i,n=1,a=t[0];if("array"===a){let e,a;if(t.length>2){let i=t[1];if("string"!=typeof i||!(i in Eu)||"object"===i)return r.error('The item type argument of "array" must be one of string, number, boolean',1);e=Eu[i],n++}else e=cl;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);a=t[2],n++}i=_l(e,a)}else{if(!Eu[a])throw Error(`Types doesn't contain name = ${a}`);i=Eu[a]}let o=[];for(;n<t.length;n++){let e=r.parse(t[n],n,cl);if(!e)return null;o.push(e)}return new e(i,o,r.key)}evaluate(e){for(let t=0;t<this.args.length;t++){let r=this.args[t].evaluate(e);if(!xl(this.type,uu(r)))return r;if(t===this.args.length-1)throw new tu(`Expected value to be of type ${vl(this.type)}, but found ${vl(uu(r))} instead.`,this.key)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};const Au={"to-boolean":ol,"to-color":sl,"to-number":nl,"to-string":al};var Iu=class e{constructor(e,t,r){this.type=e,this.args=t,this.key=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=t[0];if(!Au[i])throw Error(`Can't parse ${i} as it is not part of the known types`);if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return r.error("Expected one argument.");let n=Au[i],a=[];for(let e=1;e<t.length;e++){let i=r.parse(t[e],e,cl);if(!i)return null;a.push(i)}return new e(n,a,r.key)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,r;for(let i of this.args){if(t=i.evaluate(e),r=null,t instanceof Hl)return t;if("string"==typeof t){let r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:su(t[0],t[1],t[2],t[3]),!r))return new Hl(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new tu(r||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}case"padding":{let t;for(let r of this.args){t=r.evaluate(e);let i=Jl.parse(t);if(i)return i}throw new tu(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}case"numberArray":{let t;for(let r of this.args){t=r.evaluate(e);let i=Ql.parse(t);if(i)return i}throw new tu(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}case"colorArray":{let t;for(let r of this.args){t=r.evaluate(e);let i=eu.parse(t);if(i)return i}throw new tu(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}case"variableAnchorOffsetCollection":{let t;for(let r of this.args){t=r.evaluate(e);let i=iu.parse(t);if(i)return i}throw new tu(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}case"number":{let t=null;for(let r of this.args){if(t=r.evaluate(e),null===t)return 0;let i=Number(t);if(!isNaN(i))return i}throw new tu(`Could not convert ${JSON.stringify(t)} to number.`,this.key)}case"formatted":return Yl.fromString(cu(this.args[0].evaluate(e)));case"resolvedImage":return nu.fromString(cu(this.args[0].evaluate(e)));case"projectionDefinition":{let t=this.args[0].evaluate(e);if(au.parse(t))return t;throw new tu(`Could not parse projectionDefinition from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}default:return cu(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Cu=class e{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let i=[];for(let e=1;e<t.length-1;e+=2){let n=t[e];if("string"!=typeof n)return r.error(`Expected string, but found ${typeof n} instead.`,e);if(/[^a-zA-Z0-9_]/.test(n))return r.error("Variable names must contain only alphanumeric characters or '_'.",e);let a=r.parse(t[e+1],e+1);if(!a)return null;i.push([n,a])}let n=r.parse(t[t.length-1],t.length-1,r.expectedType,i);return n?new e(i,n):null}outputDefined(){return this.result.outputDefined()}},ku=class e{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(t,r){if(2!==t.length||"string"!=typeof t[1])return r.error("'var' expression requires exactly one string literal argument.");let i=t[1];return r.scope.has(i)?new e(i,r.scope.get(i)):r.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Mu=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=null,n=r.expectedType;n&&"value"!==n.kind&&(i=n);let a=[];for(let e of t.slice(1)){let t=r.parse(e,1+a.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i||=t.type,a.push(t)}if(!i)throw Error("No output type");return n&&a.some(e=>xl(n,e.type))?new e(cl,a):new e(i,a)}evaluate(e){let t,r=null,i=0;for(let n of this.args)if(i++,r=n.evaluate(e),r&&r instanceof nu&&!r.available&&(t||=r.name,r=null,i===this.args.length&&(r=t)),null!==r)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function Fu(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function Ru(e,t,r,i){return 0===i.compare(t,r)}function Lu(e,t,r){let i="=="!==e&&"!="!==e;return class n{constructor(e,t,r,i){this.lhs=e,this.rhs=t,this.key=r,this.collator=i,this.type=ol,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");let r=e[0],a=t.parse(e[1],1,cl);if(!a)return null;if(!Fu(r,a.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${vl(a.type)}'.`);let o=t.parse(e[2],2,cl);if(!o)return null;if(!Fu(r,o.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${vl(o.type)}'.`);if(a.type.kind!==o.type.kind&&"value"!==a.type.kind&&"value"!==o.type.kind)return t.error(`Cannot compare types '${vl(a.type)}' and '${vl(o.type)}'.`);i&&("value"===a.type.kind&&"value"!==o.type.kind?a=new Du(o.type,[a],t.key):"value"!==a.type.kind&&"value"===o.type.kind&&(o=new Du(a.type,[o],t.key)));let s=null;if(4===e.length){if("string"!==a.type.kind&&"string"!==o.type.kind&&"value"!==a.type.kind&&"value"!==o.type.kind)return t.error("Cannot use collator to compare non-string types.");if(s=t.parse(e[3],3,hl),!s)return null}return new n(a,o,t.key,s)}evaluate(n){let a=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(i&&this.hasUntypedArgument){let t=uu(a),r=uu(o);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new tu(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let e=uu(a),r=uu(o);if("string"!==e.kind||"string"!==r.kind)return t(n,a,o)}return this.collator?r(n,a,o,this.collator.evaluate(n)):t(n,a,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const zu=Lu("==",function(e,t,r){return t===r},Ru),Ou=Lu("!=",function(e,t,r){return t!==r},function(e,t,r,i){return!Ru(0,t,r,i)}),Bu=Lu("<",function(e,t,r){return t<r},function(e,t,r,i){return i.compare(t,r)<0}),ju=Lu(">",function(e,t,r){return t>r},function(e,t,r,i){return i.compare(t,r)>0}),Nu=Lu("<=",function(e,t,r){return t<=r},function(e,t,r,i){return i.compare(t,r)<=0}),Uu=Lu(">=",function(e,t,r){return t>=r},function(e,t,r,i){return i.compare(t,r)>=0});var Vu=class e{constructor(e,t,r){this.type=hl,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(t,r){if(2!==t.length)return r.error("Expected one argument.");let i=t[1];if("object"!=typeof i||Array.isArray(i))return r.error("Collator options argument must be an object.");let n=r.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,ol);if(!n)return null;let a=r.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,ol);if(!a)return null;let o=null;return i.locale&&(o=r.parse(i.locale,1,al),!o)?null:new e(n,a,o)}evaluate(e){return new ou(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 $u=8192;function Gu(e,t){let r=function(e){return(180+e)/360}(e[0]),i=function(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}(e[1]),n=2**t.z;return[Math.round(r*n*$u),Math.round(i*n*$u)]}function qu(e,t){let r=2**t.z,i=(e[0]/$u+t.x)/r,n=(e[1]/$u+t.y)/r;return[Zu(i),Wu(n)]}function Zu(e){return 360*e-180}function Wu(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function Hu(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Xu(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Ku(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Yu(e,t,r){let i=e[0]-t[0],n=e[1]-t[1],a=e[0]-r[0],o=e[1]-r[1];return i*o-a*n===0&&i*a<=0&&n*o<=0}function Ju(e,t,r,i){let n=[t[0]-e[0],t[1]-e[1]];return 0!==function(e,t){return e[0]*t[1]-e[1]*t[0]}([i[0]-r[0],i[1]-r[1]],n)&&!(!nc(e,t,r,i)||!nc(r,i,e,t))}function Qu(e,t,r){for(let i of r)for(let r=0;r<i.length-1;++r)if(Ju(e,t,i[r],i[r+1]))return!0;return!1}function ec(e,t,r=!1){let i=!1;for(let n of t)for(let t=0;t<n.length-1;t++){if(Yu(e,n[t],n[t+1]))return r;Ku(e,n[t],n[t+1])&&(i=!i)}return i}function tc(e,t){for(let r of t)if(ec(e,r))return!0;return!1}function rc(e,t){for(let r of e)if(!ec(r,t))return!1;for(let r=0;r<e.length-1;++r)if(Qu(e[r],e[r+1],t))return!1;return!0}function ic(e,t){for(let r of t)if(rc(e,r))return!0;return!1}function nc(e,t,r,i){let n=e[0]-r[0],a=e[1]-r[1],o=t[0]-r[0],s=t[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],c=n*u-l*a,h=o*u-l*s;return c>0&&h<0||c<0&&h>0}function ac(e,t,r){let i=[];for(let n=0;n<e.length;n++){let a=[];for(let i=0;i<e[n].length;i++){let o=Gu(e[n][i],r);Hu(t,o),a.push(o)}i.push(a)}return i}function oc(e,t,r){let i=[];for(let n=0;n<e.length;n++){let a=ac(e[n],t,r);i.push(a)}return i}function sc(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){let t=.5*i,n=e[0]-r[0]>t?-i:r[0]-e[0]>t?i:0;0===n&&(n=e[0]-r[2]>t?-i:r[2]-e[0]>t?i:0),e[0]+=n}Hu(t,e)}function lc(e,t,r,i){let n=2**i.z*$u,a=[i.x*$u,i.y*$u],o=[];for(let i of e)for(let e of i){let i=[e.x+a[0],e.y+a[1]];sc(i,t,r,n),o.push(i)}return o}function uc(e,t,r,i){let n=2**i.z*$u,a=[i.x*$u,i.y*$u],o=[];for(let r of e){let e=[];for(let i of r){let r=[i.x+a[0],i.y+a[1]];Hu(t,r),e.push(r)}o.push(e)}if(t[2]-t[0]<=n/2){!function(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}(t);for(let e of o)for(let i of e)sc(i,t,r,n)}return o}var cc=class e{constructor(e,t){this.type=ol,this.geojson=e,this.geometries=t}static parse(t,r){if(2!==t.length)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(lu(t[1])){let r=t[1];if("FeatureCollection"===r.type){let t=[];for(let e of r.features){let{type:r,coordinates:i}=e.geometry;"Polygon"===r&&t.push(i),"MultiPolygon"===r&&t.push(...i)}if(t.length)return new e(r,{type:"MultiPolygon",coordinates:t})}else if("Feature"===r.type){let t=r.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new e(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new e(r,r)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){let a=ac(t.coordinates,i,n),o=lc(e.geometry(),r,i,n);if(!Xu(r,i))return!1;for(let e of o)if(!ec(e,a))return!1}if("MultiPolygon"===t.type){let a=oc(t.coordinates,i,n),o=lc(e.geometry(),r,i,n);if(!Xu(r,i))return!1;for(let e of o)if(!tc(e,a))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=e.canonicalID();if("Polygon"===t.type){let a=ac(t.coordinates,i,n),o=uc(e.geometry(),r,i,n);if(!Xu(r,i))return!1;for(let e of o)if(!rc(e,a))return!1}if("MultiPolygon"===t.type){let a=oc(t.coordinates,i,n),o=uc(e.geometry(),r,i,n);if(!Xu(r,i))return!1;for(let e of o)if(!ic(e,a))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},hc=class{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:r}=this,i=t[e];for(;e>0;){let n=e-1>>1,a=t[n];if(r(i,a)>=0)break;t[e]=a,e=n}t[e]=i}_down(e){let{data:t,compare:r}=this,i=this.length>>1,n=t[e];for(;e<i;){let i=1+(e<<1),a=i+1;if(a<this.length&&r(t[a],t[i])<0&&(i=a),r(t[i],n)>=0)break;t[e]=t[i],e=i}t[e]=n}};const dc=Math.PI/180;var pc=class{constructor(e){let t=6378.137*dc*1e3,r=Math.cos(e*dc),i=1/(1-.0066943799901413165*(1-r*r)),n=Math.sqrt(i);this.kx=t*n*r,this.ky=t*n*i*.9933056200098587}distance(e,t){let r=this.wrap(e[0]-t[0])*this.kx,i=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(e,t){let r,i,n,a,o=1/0;for(let s=0;s<e.length-1;s++){let l=e[s][0],u=e[s][1],c=this.wrap(e[s+1][0]-l)*this.kx,h=(e[s+1][1]-u)*this.ky,d=0;(0!==c||0!==h)&&(d=(this.wrap(t[0]-l)*this.kx*c+(t[1]-u)*this.ky*h)/(c*c+h*h),d>1?(l=e[s+1][0],u=e[s+1][1]):d>0&&(l+=c/this.kx*d,u+=h/this.ky*d)),c=this.wrap(t[0]-l)*this.kx,h=(t[1]-u)*this.ky;let p=c*c+h*h;p<o&&(o=p,r=l,i=u,n=s,a=d)}return{point:[r,i],index:n,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}};function fc(e,t){return t[0]-e[0]}function mc(e){return e[1]-e[0]+1}function gc(e,t){return e[1]>=e[0]&&e[1]<t}function yc(e,t){if(e[0]>e[1])return[null,null];let r=mc(e);if(t){if(2===r)return[e,null];let t=Math.floor(r/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===r)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}function _c(e,t){if(!gc(t,e.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=t[0];i<=t[1];++i)Hu(r,e[i]);return r}function vc(e){let t=[1/0,1/0,-1/0,-1/0];for(let r of e)for(let e of r)Hu(t,e);return t}function bc(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function xc(e,t,r){if(!bc(e)||!bc(t))return NaN;let i=0,n=0;return e[2]<t[0]&&(i=t[0]-e[2]),e[0]>t[2]&&(i=e[0]-t[2]),e[1]>t[3]&&(n=e[1]-t[3]),e[3]<t[1]&&(n=t[1]-e[3]),r.distance([0,0],[i,n])}function wc(e,t,r){let i=r.pointOnLine(t,e);return r.distance(e,i.point)}function Sc(e,t,r,i,n){let a=Math.min(wc(e,[r,i],n),wc(t,[r,i],n)),o=Math.min(wc(r,[e,t],n),wc(i,[e,t],n));return Math.min(a,o)}function Tc(e,t,r,i,n){if(!gc(t,e.length)||!gc(i,r.length))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let t=e[o],s=e[o+1];for(let e=i[0];e<i[1];++e){let i=r[e],o=r[e+1];if(Ju(t,s,i,o))return 0;a=Math.min(a,Sc(t,s,i,o,n))}}return a}function Pc(e,t,r,i,n){if(!gc(t,e.length)||!gc(i,r.length))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let t=i[0];t<=i[1];++t)if(a=Math.min(a,n.distance(e[o],r[t])),0===a)return a;return a}function Ec(e,t,r){if(ec(e,t,!0))return 0;let i=1/0;for(let n of t){let t=n[0],a=n[n.length-1];if(t!==a&&(i=Math.min(i,wc(e,[a,t],r)),0===i))return i;let o=r.pointOnLine(n,e);if(i=Math.min(i,r.distance(e,o.point)),0===i)return i}return i}function Dc(e,t,r,i){if(!gc(t,e.length))return NaN;for(let i=t[0];i<=t[1];++i)if(ec(e[i],r,!0))return 0;let n=1/0;for(let a=t[0];a<t[1];++a){let t=e[a],o=e[a+1];for(let e of r)for(let r=0,a=e.length,s=a-1;r<a;s=r++){let a=e[s],l=e[r];if(Ju(t,o,a,l))return 0;n=Math.min(n,Sc(t,o,a,l,i))}}return n}function Ac(e,t){for(let r of e)for(let e of r)if(ec(e,t,!0))return!0;return!1}function Ic(e,t,r,i=1/0){let n=vc(e),a=vc(t);if(i!==1/0&&xc(n,a,r)>=i)return i;if(Xu(n,a)){if(Ac(e,t))return 0}else if(Ac(t,e))return 0;let o=1/0;for(let i of e)for(let e=0,n=i.length,a=n-1;e<n;a=e++){let n=i[a],s=i[e];for(let e of t)for(let t=0,i=e.length,a=i-1;t<i;a=t++){let i=e[a],l=e[t];if(Ju(n,s,i,l))return 0;o=Math.min(o,Sc(n,s,i,l,r))}}return o}function Cc(e,t,r,i,n,a){if(!a)return;let o=xc(_c(i,a),n,r);o<t&&e.push([o,a,[0,0]])}function kc(e,t,r,i,n,a,o){if(!a||!o)return;let s=xc(_c(i,a),_c(n,o),r);s<t&&e.push([s,a,o])}function Mc(e,t,r,i,n=1/0){let a=Math.min(i.distance(e[0],r[0][0]),n);if(0===a)return a;let o=new hc([[0,[0,e.length-1],[0,0]]],fc),s=vc(r);for(;o.length>0;){let n=o.pop();if(n[0]>=a)continue;let l=n[1],u=t?50:100;if(mc(l)<=u){if(!gc(l,e.length))return NaN;if(t){let t=Dc(e,l,r,i);if(isNaN(t)||0===t)return t;a=Math.min(a,t)}else for(let t=l[0];t<=l[1];++t){let n=Ec(e[t],r,i);if(a=Math.min(a,n),0===a)return 0}}else{let r=yc(l,t);Cc(o,a,i,e,s,r[0]),Cc(o,a,i,e,s,r[1])}}return a}function Fc(e,t,r,i,n,a=1/0){let o=Math.min(a,n.distance(e[0],r[0]));if(0===o)return o;let s=new hc([[0,[0,e.length-1],[0,r.length-1]]],fc);for(;s.length>0;){let a=s.pop();if(a[0]>=o)continue;let l=a[1],u=a[2],c=t?50:100,h=i?50:100;if(mc(l)<=c&&mc(u)<=h){if(!gc(l,e.length)&&gc(u,r.length))return NaN;let a;if(t&&i)a=Tc(e,l,r,u,n),o=Math.min(o,a);else if(t&&!i){let t=e.slice(l[0],l[1]+1);for(let e=u[0];e<=u[1];++e)if(a=wc(r[e],t,n),o=Math.min(o,a),0===o)return o}else if(!t&&i){let t=r.slice(u[0],u[1]+1);for(let r=l[0];r<=l[1];++r)if(a=wc(e[r],t,n),o=Math.min(o,a),0===o)return o}else a=Pc(e,l,r,u,n),o=Math.min(o,a)}else{let a=yc(l,t),c=yc(u,i);kc(s,o,n,e,r,a[0],c[0]),kc(s,o,n,e,r,a[0],c[1]),kc(s,o,n,e,r,a[1],c[0]),kc(s,o,n,e,r,a[1],c[1])}}return o}function Rc(e){return"MultiPolygon"===e.type?e.coordinates.map(e=>({type:"Polygon",coordinates:e})):"MultiLineString"===e.type?e.coordinates.map(e=>({type:"LineString",coordinates:e})):"MultiPoint"===e.type?e.coordinates.map(e=>({type:"Point",coordinates:e})):[e]}var Lc=class e{constructor(e,t){this.type=nl,this.geojson=e,this.geometries=t}static parse(t,r){if(2!==t.length)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(lu(t[1])){let r=t[1];if("FeatureCollection"===r.type)return new e(r,r.features.map(e=>Rc(e.geometry)).flat());if("Feature"===r.type)return new e(r,Rc(r.geometry));if("type"in r&&"coordinates"in r)return new e(r,Rc(r))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){let r=e.geometry(),i=r.flat().map(t=>qu([t.x,t.y],e.canonical));if(0===r.length)return NaN;let n=new pc(i[0][1]),a=1/0;for(let e of t){switch(e.type){case"Point":a=Math.min(a,Fc(i,!1,[e.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,Fc(i,!1,e.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Mc(i,!1,e.coordinates,n,a))}if(0===a)return a}return a}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){let r=e.geometry(),i=r.flat().map(t=>qu([t.x,t.y],e.canonical));if(0===r.length)return NaN;let n=new pc(i[0][1]),a=1/0;for(let e of t){switch(e.type){case"Point":a=Math.min(a,Fc(i,!0,[e.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,Fc(i,!0,e.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,Mc(i,!0,e.coordinates,n,a))}if(0===a)return a}return a}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){let r=e.geometry();if(0===r.length||0===r[0].length)return NaN;let i=Su(r,0).map(t=>t.map(t=>t.map(t=>qu([t.x,t.y],e.canonical)))),n=new pc(i[0][0][0][1]),a=1/0;for(let e of t)for(let t of i){switch(e.type){case"Point":a=Math.min(a,Mc([e.coordinates],!1,t,n,a));break;case"LineString":a=Math.min(a,Mc(e.coordinates,!0,t,n,a));break;case"Polygon":a=Math.min(a,Ic(t,e.coordinates,n,a))}if(0===a)return a}return a}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},zc=class e{constructor(e){this.key=e,this.type=cl}static parse(t,r){if(2!==t.length)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=t[1];return null==i?r.error("Global state property must be defined."):"string"==typeof i?new e(i):r.error(`Global state property must be string, but found ${typeof t[1]} instead.`)}evaluate(e){let t=e.globals?.globalState;return t&&0!==Object.keys(t).length?Nl(t,this.key)??null:null}eachChild(){}outputDefined(){return!1}};const Oc={"==":zu,"!=":Ou,">":ju,"<":Bu,">=":Uu,"<=":Nu,array:Du,at:class e{constructor(e,t,r,i){this.type=e,this.index=t,this.input=r,this.key=i}static parse(t,r){if(3!==t.length)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,nl),n=r.parse(t[2],2,_l(r.expectedType||cl));if(!i||!n)return null;let a=n.type;return new e(a.itemType,i,n,r.key)}evaluate(e){let t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new tu(`Array index out of bounds: ${t} < 0.`,this.key);if(t>=r.length)throw new tu(`Array index out of bounds: ${t} > ${r.length-1}.`,this.key);if(t!==Math.floor(t))throw new tu(`Array index must be an integer, but found ${t} instead.`,this.key);return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},boolean:Du,case:class e{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let i;r.expectedType&&"value"!==r.expectedType.kind&&(i=r.expectedType);let n=[];for(let e=1;e<t.length-1;e+=2){let a=r.parse(t[e],e,ol);if(!a)return null;let o=r.parse(t[e+1],e+1,i);if(!o)return null;n.push([a,o]),i||=o.type}let a=r.parse(t[t.length-1],t.length-1,i);if(!a)return null;if(!i)throw Error("Can't infer output type");return new e(i,n,a)}evaluate(e){for(let[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},coalesce:Mu,collator:Vu,format:vu,image:class e{constructor(e){this.type=gl,this.input=e}static parse(t,r){if(2!==t.length)return r.error("Expected two arguments.");let i=r.parse(t[1],1,al);return i?new e(i):r.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),r=nu.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}},in:class e{constructor(e,t,r){this.needle=e,this.haystack=t,this.key=r,this.type=ol}static parse(t,r){if(3!==t.length)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,cl),n=r.parse(t[2],2,cl);return i&&n?wl(i.type,[ol,al,nl,il,cl])?new e(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${vl(i.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!Sl(t,["boolean","string","number","null"]))throw new tu(`Expected first argument to be of type boolean, string, number or null, but found ${vl(uu(t))} instead.`,this.key);if(!Sl(r,["string","array"]))throw new tu(`Expected second argument to be of type array or string, but found ${vl(uu(r))} instead.`,this.key);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},"index-of":class e{constructor(e,t,r,i){this.needle=e,this.haystack=t,this.key=r,this.fromIndex=i,this.type=nl}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,cl),n=r.parse(t[2],2,cl);if(!i||!n)return null;if(!wl(i.type,[ol,al,nl,il,cl]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${vl(i.type)} instead`);if(4===t.length){let a=r.parse(t[3],3,nl);return a?new e(i,n,r.key,a):null}return new e(i,n,r.key)}evaluate(e){let t,r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!Sl(r,["boolean","string","number","null"]))throw new tu(`Expected first argument to be of type boolean, string, number or null, but found ${vl(uu(r))} instead.`,this.key);if(this.fromIndex&&(t=this.fromIndex.evaluate(e)),Sl(i,["string"])){let e=i.indexOf(r,t);return-1===e?-1:[...i.slice(0,e)].length}if(Sl(i,["array"]))return i.indexOf(r,t);throw new tu(`Expected second argument to be of type array or string, but found ${vl(uu(i))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},interpolate:gu,"interpolate-hcl":gu,"interpolate-lab":gu,length:class e{constructor(e,t){this.input=e,this.key=t,this.type=nl}static parse(t,r){if(2!==t.length)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=r.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?r.error(`Expected argument of type string or array, but found ${vl(i.type)} instead.`):new e(i,r.key):null}evaluate(e){let t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new tu(`Expected value to be of type string or array, but found ${vl(uu(t))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},let:Cu,literal:hu,match:class e{constructor(e,t,r,i,n,a){this.inputType=e,this.type=t,this.input=r,this.cases=i,this.outputs=n,this.otherwise=a}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let i,n;r.expectedType&&"value"!==r.expectedType.kind&&(n=r.expectedType);let a={},o=[];for(let e=2;e<t.length-1;e+=2){let s=t[e],l=t[e+1];Array.isArray(s)||(s=[s]);let u=r.concat(e);if(0===s.length)return u.error("Expected at least one branch label.");for(let e of s){if("number"!=typeof e&&"string"!=typeof e)return u.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>2**53-1)return u.error(`Branch labels must be integers no larger than ${2**53-1}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(i){if(u.checkSubtype(i,uu(e)))return null}else i=uu(e);if(void 0!==a[String(e)])return u.error("Branch labels must be unique.");a[String(e)]=o.length}let c=r.parse(l,e,n);if(!c)return null;n||=c.type,o.push(c)}let s=r.parse(t[1],1,cl);if(!s)return null;let l=r.parse(t[t.length-1],t.length-1,n);return!l||"value"!==s.type.kind&&r.concat(1).checkSubtype(i,s.type)?null:new e(i,n,s,a,o,l)}evaluate(e){let t=this.input.evaluate(e);return(uu(t)===this.inputType&&this.outputs[this.cases[t]]||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()}},number:Du,"number-format":class e{constructor(e,t,r,i,n,a){this.type=al,this.number=e,this.locale=t,this.currency=r,this.unit=i,this.minFractionDigits=n,this.maxFractionDigits=a}static parse(t,r){if(3!==t.length)return r.error("Expected two arguments.");let i=r.parse(t[1],1,nl);if(!i)return null;let n=t[2];if("object"!=typeof n||Array.isArray(n))return r.error("NumberFormat options argument must be an object.");let a=null;if(n.locale&&(a=r.parse(n.locale,1,al),!a))return null;let o=null;if(n.currency&&(o=r.parse(n.currency,1,al),!o))return null;let s=null;if(n.unit&&(s=r.parse(n.unit,1,al),!s))return null;if(o&&s)return r.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(n["min-fraction-digits"]&&(l=r.parse(n["min-fraction-digits"],1,nl),!l))return null;let u=null;return n["max-fraction-digits"]&&(u=r.parse(n["max-fraction-digits"],1,nl),!u)?null:new e(i,a,o,s,l,u)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.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.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},object:Du,semiliteral:class e{constructor(e){let t=null;for(let r of e){if(t){if(t===r.type)continue;t=cl;break}t=r.type}this.type=_l(t??cl,e.length),this.arr=e}static parse(t,r){if(2!==t.length)return r.error(`'semiliteral' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!lu(t[1]))return r.error(`invalid value of type "${typeof t[1]}"`);let i=t[1],n=uu(i);if("array"===n.kind){let t=i.map(e=>r.parse(e,null,cl));return new e(t)}return new hu(n,i)}evaluate(e){return this.arr.map(t=>t.evaluate(e))}eachChild(e){this.arr.forEach(e)}outputDefined(){return this.arr.every(e=>e.outputDefined())}},slice:class e{constructor(e,t,r,i,n){this.type=e,this.input=t,this.beginIndex=r,this.key=i,this.endIndex=n}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,cl),n=r.parse(t[2],2,nl);if(!i||!n)return null;if(!wl(i.type,[_l(cl),al,cl]))return r.error(`Expected first argument to be of type array or string, but found ${vl(i.type)} instead`);if(4===t.length){let a=r.parse(t[3],3,nl);return a?new e(i.type,i,n,r.key,a):null}return new e(i.type,i,n,r.key)}evaluate(e){let t,r=this.input.evaluate(e),i=this.beginIndex.evaluate(e);if(this.endIndex&&(t=this.endIndex.evaluate(e)),Sl(r,["string"]))return[...r].slice(i,t).join("");if(Sl(r,["array"]))return r.slice(i,t);throw new tu(`Expected first argument to be of type array or string, but found ${vl(uu(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},step:mu,string:Du,"to-boolean":Iu,"to-color":Iu,"to-number":Iu,"to-string":Iu,var:ku,within:cc,distance:Lc,"global-state":zc};var Bc=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},jc=class e{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,r]of t)this.bindings[e]=r}concat(t){return new e(this,t)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}},Nc=class e{constructor(e,t,r=[],i,n=new jc,a=[]){this.registry=e,this.path=r,this.key=r.map(e=>`[${e}]`).join(""),this.scope=n,this.errors=a,this.expectedType=i,this._isConstant=t}parse(e,t,r,i,n={}){return t?this.concat(t,r,i)._parse(e,n):this._parse(e,n)}_parse(e,t){(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e)&&(e=["literal",e]);let r=this.key;function i(e,t,i){return"assert"===i?new Du(t,[e],r):"coerce"===i?new Iu(t,[e],r):e}if(Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let n=this.registry[r];if(n){let r=n.parse(e,this);if(!r)return null;if(this.expectedType){let e=this.expectedType,n=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind){if("projectionDefinition"===e.kind&&["string","array","value"].includes(n.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(n.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(n.kind)||"colorArray"===e.kind&&["value","string","array"].includes(n.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(n.kind))r=i(r,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,n))return null}else r=i(r,e,t.typeAnnotation||"assert")}if(!(r instanceof hu)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){let t=new pu;try{r=new hu(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===e?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(t,r,i){let n="number"==typeof t?this.path.concat(t):this.path,a=i?this.scope.concat(i):this.scope;return new e(this.registry,this._isConstant,n,r||null,a,this.errors)}error(e,...t){let r=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new Bc(r,e))}checkSubtype(e,t){let r=xl(e,t);return r&&this.error(r),r}},Uc=class e{constructor(e,t,r,i,n){this.name=e,this.type=t,this._evaluate=r,this.args=i,this.key=n}evaluate(e){return this._evaluate(e,this.args,this.key)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(t,r){let i=t[0],n=e.definitions[i];if(!n)return r.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(n)?n[0]:n.type,o=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=o.filter(([e])=>!Array.isArray(e)||e.length===t.length-1),l=null;for(let[n,o]of s){l=new Nc(r.registry,Zc,r.path,null,r.scope);let s=[],u=!1;for(let e=1;e<t.length;e++){let r=t[e],i=Array.isArray(n)?n[e-1]:n.type,a=l.parse(r,1+s.length,i);if(!a){u=!0;break}s.push(a)}if(!u){if(Array.isArray(n)&&n.length!==s.length){l.error(`Expected ${n.length} arguments, but found ${s.length} instead.`);continue}for(let e=0;e<s.length;e++){let t=Array.isArray(n)?n[e]:n.type,r=s[e];l.concat(e+1).checkSubtype(t,r.type)}if(0===l.errors.length)return new e(i,a,o,s,r.key)}}if(1===s.length)r.errors.push(...l.errors);else{let e=(s.length?s:o).map(([e])=>function(e){return Array.isArray(e)?`(${e.map(vl).join(", ")})`:`(${vl(e.type)}...)`}(e)).join(" | "),i=[];for(let e=1;e<t.length;e++){let n=r.parse(t[e],1+i.length);if(!n)return null;i.push(vl(n.type))}r.error(`Expected arguments of type ${e}, but found (${i.join(", ")}) instead.`)}return null}static register(t,r){e.definitions=r;for(let i in r)t[i]=e}};function Vc(e,[t,r,i,n],a){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);let o=n?n.evaluate(e):1,s=su(t,r,i,o);if(s)throw new tu(s,a);return new Hl(t/255,r/255,i/255,o,!1)}function $c(e,t){return e in t&&void 0!==t[e]}function Gc(e,t){let r=t[e];return void 0===r?null:r}function qc(e){return{type:e}}function Zc(e){if(e instanceof ku)return Zc(e.boundExpression);if(e instanceof Uc&&"error"===e.name||e instanceof Vu||e instanceof cc||e instanceof Lc||e instanceof zc)return!1;let t=e instanceof Iu||e instanceof Du,r=!0;return e.eachChild(e=>{r&&=t?Zc(e):e instanceof hu}),!!r&&Wc(e)&&Xc(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Wc(e){if(e instanceof Uc&&("get"===e.name&&1===e.args.length||"feature-state"===e.name||"has"===e.name&&1===e.args.length||"properties"===e.name||"geometry-type"===e.name||"id"===e.name||/^filter-/.test(e.name))||e instanceof cc||e instanceof Lc)return!1;let t=!0;return e.eachChild(e=>{t&&!Wc(e)&&(t=!1)}),t}function Hc(e){if(e instanceof Uc&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!Hc(e)&&(t=!1)}),t}function Xc(e,t){if(e instanceof Uc&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!Xc(e,t)&&(r=!1)}),r}function Kc(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function Yc(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Jc(e){return!!e.expression&&e.expression.interpolated}Uc.register(Oc,{error:[{kind:"error"},[al],(e,[t],r)=>{throw new tu(t.evaluate(e),r)}],typeof:[al,[cl],(e,[t])=>vl(uu(t.evaluate(e)))],"to-rgba":[_l(nl,4),[sl],(e,[t])=>{let[r,i,n,a]=t.evaluate(e).rgb;return[255*r,255*i,255*n,a]}],rgb:[sl,[nl,nl,nl],Vc],rgba:[sl,[nl,nl,nl,nl],Vc],has:{type:ol,overloads:[[[al],(e,[t])=>$c(t.evaluate(e),e.properties())],[[al,ul],(e,[t,r])=>$c(t.evaluate(e),r.evaluate(e))]]},get:{type:cl,overloads:[[[al],(e,[t])=>Gc(t.evaluate(e),e.properties())],[[al,ul],(e,[t,r])=>Gc(t.evaluate(e),r.evaluate(e))]]},"feature-state":[cl,[al],(e,[t])=>Gc(t.evaluate(e),e.featureState||{})],properties:[ul,[],e=>e.properties()],"geometry-type":[al,[],e=>e.geometryType()],id:[cl,[],e=>e.id()],zoom:[nl,[],e=>e.globals.zoom],"heatmap-density":[nl,[],e=>e.globals.heatmapDensity||0],elevation:[nl,[],e=>e.globals.elevation||0],"line-progress":[nl,[],e=>e.globals.lineProgress||0],accumulated:[cl,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[nl,qc(nl),(e,t)=>{let r=0;for(let i of t)r+=i.evaluate(e);return r}],"*":[nl,qc(nl),(e,t)=>{let r=1;for(let i of t)r*=i.evaluate(e);return r}],"-":{type:nl,overloads:[[[nl,nl],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[nl],(e,[t])=>-t.evaluate(e)]]},"/":[nl,[nl,nl],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[nl,[nl,nl],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[nl,[],()=>Math.LN2],pi:[nl,[],()=>Math.PI],e:[nl,[],()=>Math.E],"^":[nl,[nl,nl],(e,[t,r])=>t.evaluate(e)**+r.evaluate(e)],sqrt:[nl,[nl],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[nl,[nl],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[nl,[nl],(e,[t])=>Math.log(t.evaluate(e))],log2:[nl,[nl],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[nl,[nl],(e,[t])=>Math.sin(t.evaluate(e))],cos:[nl,[nl],(e,[t])=>Math.cos(t.evaluate(e))],tan:[nl,[nl],(e,[t])=>Math.tan(t.evaluate(e))],asin:[nl,[nl],(e,[t])=>Math.asin(t.evaluate(e))],acos:[nl,[nl],(e,[t])=>Math.acos(t.evaluate(e))],atan:[nl,[nl],(e,[t])=>Math.atan(t.evaluate(e))],min:[nl,qc(nl),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[nl,qc(nl),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[nl,[nl],(e,[t])=>Math.abs(t.evaluate(e))],round:[nl,[nl],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[nl,[nl],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[nl,[nl],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ol,[al,cl],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[ol,[cl],(e,[t])=>e.id()===t.value],"filter-type-==":[ol,[al],(e,[t])=>e.geometryType()===t.value],"filter-<":[ol,[al,cl],(e,[t,r])=>{let i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i<n}],"filter-id-<":[ol,[cl],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<i}],"filter->":[ol,[al,cl],(e,[t,r])=>{let i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[ol,[cl],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>i}],"filter-<=":[ol,[al,cl],(e,[t,r])=>{let i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[ol,[cl],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<=i}],"filter->=":[ol,[al,cl],(e,[t,r])=>{let i=e.properties()[t.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[ol,[cl],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>=i}],"filter-has":[ol,[cl],(e,[t])=>{let r=t.value,i=e.properties();return r in i&&void 0!==i[r]}],"filter-has-id":[ol,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[ol,[_l(al)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ol,[_l(cl)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ol,[al,_l(cl)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ol,[al,_l(cl)],(e,[t,r])=>function(e,t,r,i){for(;r<=i;){let n=r+i>>1;if(t[n]===e)return!0;t[n]>e?i=n-1:r=n+1}return!1}(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:ol,overloads:[[[ol,ol],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[qc(ol),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:ol,overloads:[[[ol,ol],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[qc(ol),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[ol,[ol],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ol,[al],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[al,[al],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[al,[al],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[al,qc(cl),(e,t)=>t.map(t=>cu(t.evaluate(e))).join("")],split:[_l(al),[al,al],(e,[t,r])=>t.evaluate(e).split(r.evaluate(e))],join:[al,[_l(al),al],(e,[t,r])=>t.evaluate(e).join(r.evaluate(e))],"resolved-locale":[al,[hl],(e,[t])=>t.evaluate(e).resolvedLocale()]});const Qc=/^(.*)-transition$/;function eh(e,...t){for(let r of t)for(let t in r)e[t]=r[t];return e}function th(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function rh(e){return"object"==typeof e&&!!e&&!Array.isArray(e)&&uu(e)===ul}function ih(e){return e}function nh(e,t){let r=e.stops&&"object"==typeof e.stops[0][0],i=r||void 0!==e.property,n=r||!i,a=e.type||(Jc(t)?"exponential":"interval"),o=function(e){switch(e.type){case"color":return Hl.parse;case"padding":return Jl.parse;case"numberArray":return Ql.parse;case"colorArray":return eu.parse;default:return null}}(t);if(o&&((e=eh({},e)).stops&&(e.stops=e.stops.map(e=>[e[0],o(e[1])])),e.default?e.default=o(e.default):e.default=o(t.default)),e.colorSpace&&!function(e){return"rgb"===e||"hcl"===e||"lab"===e}(e.colorSpace))throw Error(`Unknown color space: "${e.colorSpace}"`);let s,l,u=function(e){switch(e){case"exponential":return lh;case"interval":return sh;case"categorical":return oh;case"identity":return uh;default:throw Error(`Unknown function type "${e}"`)}}(a);if("categorical"===a){s=Object.create(null);for(let t of e.stops)s[t[0]]=t[1];l=typeof e.stops[0][0]}if(r){let r={},i=[];for(let t=0;t<e.stops.length;t++){let n=e.stops[t],a=n[0].zoom;void 0===r[a]&&(r[a]={zoom:a,type:e.type,property:e.property,default:e.default,stops:[]},i.push(a)),r[a].stops.push([n[0].value,n[1]])}let n=[];for(let e of i)n.push([r[e].zoom,nh(r[e],t)]);let a={name:"linear"};return{kind:"composite",interpolationType:a,interpolationFactor:gu.interpolationFactor.bind(void 0,a),zoomStops:n.map(e=>e[0]),evaluate:({zoom:r},i)=>lh({stops:n,base:e.base},t,r).evaluate(r,i)}}if(n){let r="exponential"===a?{name:"exponential",base:void 0===e.base?1:e.base}:null;return{kind:"camera",interpolationType:r,interpolationFactor:gu.interpolationFactor.bind(void 0,r),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:r})=>u(e,t,r,s,l)}}return{kind:"source",evaluate(r,i){let n=i&&i.properties?i.properties[e.property]:void 0;return void 0===n?ah(e.default,t.default):u(e,t,n,s,l)}}}function ah(e,t,r){return void 0!==e?e:void 0!==t?t:void 0!==r?r:void 0}function oh(e,t,r,i,n){return ah(typeof r===n?i[r]:void 0,e.default,t.default)}function sh(e,t,r){if("number"!==th(r))return ah(e.default,t.default);let i=e.stops.length;if(1===i||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let n=fu(e.stops.map(e=>e[0]),r,"");return e.stops[n][1]}function lh(e,t,r){let i=void 0===e.base?1:e.base;if("number"!==th(r))return ah(e.default,t.default);let n=e.stops.length;if(1===n||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let a=fu(e.stops.map(e=>e[0]),r,""),o=function(e,t,r,i){let n=i-r,a=e-r;return 0===n?0:1===t?a/n:(t**+a-1)/(t**+n-1)}(r,i,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],l=e.stops[a+1][1],u=_u[t.type]||ih;return"function"==typeof s.evaluate?{evaluate(...t){let r=s.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==i)return u(r,i,o,e.colorSpace)}}:u(s,l,o,e.colorSpace)}function uh(e,t,r){switch(t.type){case"color":r=Hl.parse(r);break;case"formatted":r=Yl.fromString(r.toString());break;case"resolvedImage":r=nu.fromString(r.toString());break;case"padding":r=Jl.parse(r);break;case"colorArray":r=eu.parse(r);break;case"numberArray":r=Ql.parse(r);break;default:th(r)!==t.type&&("enum"!==t.type||!t.values[r])&&(r=void 0)}return ah(r,e.default,t.default)}function ch(e){return{result:"success",value:e}}function hh(e){return{result:"error",value:e}}var dh=class{constructor(e,t,r,i){this.expression=e,this._warningHistory={},this._evaluator=new pu,this._defaultValue=r?Sh(r):null,this._enumValues=r&&"enum"===r.type?r.values:null,this._globalState=i,this._rootKey=t}evaluateWithoutErrorHandling(e,t,r,i,n,a){return this._globalState&&(e=Th(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,i,n,a){this._globalState&&(e=Th(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new tu(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`,"");return e}catch(e){let t=e instanceof tu?e.path:"",r=`${t}|${e.message}`;return this._warningHistory[r]||(this._warningHistory[r]=!0,typeof console<"u"&&console.warn(ph(this._rootKey,t,e.message,this._defaultValue))),this._defaultValue}}};function ph(e,t,r,i){return`${e}${t}: ${r}${null==i?"":` Falling back to ${String(i)}.`}`}function fh(e){if(!e)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".')}function mh(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Oc}function gh(e,t,r,i){fh(t);let n=new Nc(Oc,Zc,[],r?function(e){let t={color:sl,string:al,number:nl,enum:al,boolean:ol,formatted:dl,padding:pl,numberArray:ml,colorArray:fl,projectionDefinition:ll,resolvedImage:gl,variableAnchorOffsetCollection:yl};return"array"===e.type?_l(t[e.value]||cl,e.length):t[e.type]}(r):void 0),a=n.parse(e,void 0,void 0,void 0,r&&"string"===r.type?{typeAnnotation:"coerce"}:void 0);return a?ch(new dh(a,t,r,i)):hh(n.errors)}var yh=class{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Hc(t.expression),this.globalStateRefs=wh(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,n,a){return this._globalState&&(e=Th(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,n,a)}evaluate(e,t,r,i,n,a){return this._globalState&&(e=Th(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,n,a)}},_h=class{constructor(e,t,r,i,n){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Hc(t.expression),this.globalStateRefs=wh(t.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(e,t,r,i,n,a){return this._globalState&&(e=Th(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,n,a)}evaluate(e,t,r,i,n,a){return this._globalState&&(e=Th(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,n,a)}interpolationFactor(e,t,r){return this.interpolationType?gu.interpolationFactor(this.interpolationType,e,t,r):0}};function vh(e,t,r,i){let n=gh(e,t,r,i);if("error"===n.result)return n;let a=n.value.expression,o=Wc(a);if(!o&&!Kc(r))return hh([new Bc("","data expressions not supported")]);let s=Xc(a,["zoom"]);if(!s&&!Yc(r))return hh([new Bc("","zoom expressions not supported")]);let l=xh(a);if(!l&&!s)return hh([new Bc("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof Bc)return hh([l]);if(l instanceof gu&&!Jc(r))return hh([new Bc("",'"interpolate" expressions cannot be used with this property')]);if(!l)return ch(new yh(o?"constant":"source",n.value,i));let u=l instanceof gu?l.interpolation:void 0;return ch(new _h(o?"camera":"composite",n.value,l.labels,u,i))}var bh=class e{constructor(e,t,r){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,fh(t),this._parameters=e,this._specification=r,this._rootKey=t,this._defaultValue=Sh(r),this._warningHistory={};let i=nh(this._parameters,this._specification);this.kind=i.kind,this.interpolationFactor=i.interpolationFactor,this.zoomStops=i.zoomStops,this.interpolationType=i.interpolationType,this._innerEvaluate=i.evaluate}evaluate(e,t){try{return this._innerEvaluate(e,t)}catch(e){let t=e instanceof Error?e.message:String(e),r=`|${t}`;return this._warningHistory[r]||(this._warningHistory[r]=!0,typeof console<"u"&&console.warn(ph(this._rootKey,"",t,this._defaultValue))),this._defaultValue}}static deserialize(t){return new e(t._parameters,t._rootKey,t._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function xh(e){let t=null;if(e instanceof Cu)t=xh(e.result);else if(e instanceof Mu){for(let r of e.args)if(t=xh(r),t)break}else(e instanceof mu||e instanceof gu)&&e.input instanceof Uc&&"zoom"===e.input.name&&(t=e);return t instanceof Bc||e.eachChild(e=>{let r=xh(e);r instanceof Bc?t=r:!t&&r?t=new Bc("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new Bc("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function wh(e,t=new Set){return e instanceof zc&&t.add(e.key),e.eachChild(e=>{wh(e,t)}),t}function Sh(e){if("color"===e.type&&rh(e.default))return new Hl(0,0,0,0);switch(e.type){case"color":return Hl.parse(e.default)||null;case"padding":return Jl.parse(e.default)||null;case"numberArray":return Ql.parse(e.default)||null;case"colorArray":return eu.parse(e.default)||null;case"variableAnchorOffsetCollection":return iu.parse(e.default)||null;case"projectionDefinition":return au.parse(e.default)||null;default:return void 0===e.default?null:e.default}}function Th(e,t){let{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:o,accumulated:s}=e??{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:o,accumulated:s,globalState:t}}function Ph(e){if("boolean"==typeof e)return"neutral";if(!Array.isArray(e)||0===e.length)return"legacy";switch(e[0]){case"has":return e.length<2||"$id"===e[1]||"$type"===e[1]?"legacy":2===e.length?"neutral":"expression";case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]))?"expression":"legacy";case"!in":case"!has":case"none":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2])?"expression":"legacy";case"any":case"all":return function(e){let t=!1;for(let r of e){let e=Ph(r);if("expression"===e)return"expression";"legacy"===e&&(t=!0)}return t?"legacy":"neutral"}(e.slice(1));default:return"expression"}}function Eh(e){return"legacy"!==Ph(e)}function Dh(e){return"$type"===e?["geometry-type"]:"$id"===e?["id"]:["get",e]}function Ah(e){if(("<"===e[0]||"<="===e[0]||">"===e[0]||">="===e[0])&&"$type"===e[1])return`"$type" cannot be use with operator "${e[0]}"`;let t=function(e){switch(e[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return 3!==e.length||"string"!=typeof e[1]?null:[e[0],Dh(e[1]),e[2]];case"in":case"!in":{if(e.length<2||"string"!=typeof e[1])return null;let t=["in",Dh(e[1]),["literal",e.slice(2)]];return"!in"===e[0]?["!",t]:t}case"has":case"!has":{if(2!==e.length||"string"!=typeof e[1]||"$type"===e[1]||"$id"===e[1])return null;let t=["has",e[1]];return"!has"===e[0]?["!",t]:t}default:return null}}(e);return t?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(e)} with ${JSON.stringify(t)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(e)} to expression syntax.`}function Ih(e,t,r){let i=r[e];return Array.isArray(i)?Eh(i)?Ch(i,t.concat(e)):{path:t.concat(e),legacyFilter:i}:null}function Ch(e,t=[]){if(!Array.isArray(e)||e.length<1)return null;switch(e[0]){case"all":case"any":case"none":for(let r=1;r<e.length;r++){let i=Ih(r,t,e);if(i)return i}break;case"!":{let r=Ih(1,t,e);if(r)return r;break}case"case":for(let r=1;r<e.length-1;r+=2){let i=Ih(r,t,e);if(i)return i}}return null}const kh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Mh(e,t,r){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Eh(e)?function(e,t){let r=Ch(e);if(!r||typeof console>"u")return;let i=r.path.map(e=>`[${e}]`).join("");console.warn(`${t}${i}: ${Ah(r.legacyFilter)}`)}(e,t):e=Lh(e);let i=gh(e,t,kh,r);if("error"===i.result)throw Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,t,r)=>i.value.evaluate(e,t,{},r),needGeometry:Rh(e),getGlobalStateRefs:()=>wh(i.value.expression)}}function Fh(e,t){return e<t?-1:+(e>t)}function Rh(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(Rh(e[t]))return!0;return!1}function Lh(e){if(!e)return!0;let t=e[0];return e.length<=1?"any"!==t:"=="===t?zh(e[1],e[2],"=="):"!="===t?jh(zh(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?zh(e[1],e[2],t):"any"===t?function(e){return["any"].concat(e.map(Lh))}(e.slice(1)):"all"===t?["all"].concat(e.slice(1).map(Lh)):"none"===t?["all"].concat(e.slice(1).map(Lh).map(jh)):"in"===t?Oh(e[1],e.slice(2)):"!in"===t?jh(Oh(e[1],e.slice(2))):"has"===t?Bh(e[1]):"!has"!==t||jh(Bh(e[1]))}function zh(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function Oh(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(Fh)]]:["filter-in-small",e,["literal",t]]}}function Bh(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function jh(e){return["!",e]}function Nh(e){let t=e.key,r=e.value;return r?[new rl(t,r,"constants have been deprecated as of v8")]:[]}function Uh(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Vh(e){if(Array.isArray(e))return e.map(Vh);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=Vh(e[r]);return t}return Uh(e)}function $h(e){let t=e.key,r=e.value,i=e.valueSpec||{},n=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,l=[],u=th(r);if("object"!==u)return[new rl(t,r,`object expected, ${u} found`)];for(let e in r){let u,c=e.split(".")[0],h=Nl(i,c)||i["*"];if(Nl(n,c))u=n[c];else if(Nl(i,c)){if(void 0===r[e])continue;u=s}else if(n["*"])u=n["*"];else{if(!i["*"]){l.push(new rl(t,r[e],`unknown property "${e}"`));continue}u=s}l=l.concat(u({key:(t&&`${t}.`)+e,value:r[e],valueSpec:h,style:a,styleSpec:o,object:r,objectKey:e,validateSpec:s},r))}for(let e in i)n[e]||i[e].required&&void 0===i[e].default&&void 0===r[e]&&l.push(new rl(t,r,`missing required property "${e}"`));return l}function Gh(e){let t=e.value,r=e.valueSpec,i=e.validateSpec,n=e.style,a=e.styleSpec,o=e.key,s=e.arrayElementValidator||i;if("array"!==th(t))return[new rl(o,t,`array expected, ${th(t)} found`)];if(r.length&&t.length!==r.length)return[new rl(o,t,`array length ${r.length} expected, length ${t.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),"object"===th(r.value)&&(l=r.value);let u=[];for(let r=0;r<t.length;r++)u=u.concat(s({array:t,arrayIndex:r,value:t[r],valueSpec:l,validateSpec:e.validateSpec,style:n,styleSpec:a,key:`${o}[${r}]`}));return u}function qh(e){let t=e.key,r=e.value,i=e.valueSpec,n=th(r);return"number"===n&&r!=r&&(n="NaN"),"number"===n?"minimum"in i&&r<i.minimum?[new rl(t,r,`${r} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&r>i.maximum?[new rl(t,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new rl(t,r,`number expected, ${n} found`)]}function Zh(e){let t,r,i,n=e.valueSpec,a=Uh(e.value.type),o={},s="categorical"!==a&&void 0===e.value.property,l=!s,u="array"===th(e.value.stops)&&"array"===th(e.value.stops[0])&&"object"===th(e.value.stops[0][0]),c=$h({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===a)return[new rl(e.key,e.value,'identity function may not have a "stops" property')];let t=[],r=e.value;return t=t.concat(Gh({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===th(r)&&0===r.length&&t.push(new rl(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:n,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&s&&c.push(new rl(e.key,e.value,'missing required property "property"')),"identity"!==a&&!e.value.stops&&c.push(new rl(e.key,e.value,'missing required property "stops"')),"exponential"===a&&e.valueSpec.expression&&!Jc(e.valueSpec)&&c.push(new rl(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Kc(e.valueSpec)?c.push(new rl(e.key,e.value,"property functions not supported")):s&&!Yc(e.valueSpec)&&c.push(new rl(e.key,e.value,"zoom functions not supported"))),("categorical"===a||u)&&void 0===e.value.property&&c.push(new rl(e.key,e.value,'"property" property is required')),c;function h(e){let t=[],a=e.value,s=e.key;if("array"!==th(a))return[new rl(s,a,`array expected, ${th(a)} found`)];if(2!==a.length)return[new rl(s,a,`array length 2 expected, length ${a.length} found`)];if(u){if("object"!==th(a[0]))return[new rl(s,a,`object expected, ${th(a[0])} found`)];if(void 0===a[0].zoom)return[new rl(s,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new rl(s,a,"object stop key must have value")];if(i&&i>Uh(a[0].zoom))return[new rl(s,a[0].zoom,"stop zoom values must appear in ascending order")];Uh(a[0].zoom)!==i&&(i=Uh(a[0].zoom),r=void 0,o={}),t=t.concat($h({key:`${s}[0]`,value:a[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:qh,value:d}}))}else t=t.concat(d({key:`${s}[0]`,value:a[0],valueSpec:{},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},a));return mh(Vh(a[1]))?t.concat([new rl(`${s}[1]`,a[1],"expressions are not allowed in function stops.")]):t.concat(e.validateSpec({key:`${s}[1]`,value:a[1],valueSpec:n,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,i){let s=th(e.value),l=Uh(e.value),u=null===e.value?i:e.value;if(t){if(s!==t)return[new rl(e.key,u,`${s} stop domain type must match previous stop domain type ${t}`)]}else t=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new rl(e.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==a){let t=`number expected, ${s} found`;return Kc(n)&&void 0===a&&(t+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new rl(e.key,u,t)]}return"categorical"!==a||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==a&&"number"===s&&void 0!==r&&l<r?[new rl(e.key,u,"stop domain values must appear in ascending order")]:(r=l,"categorical"===a&&l in o?[new rl(e.key,u,"stop domain values must be unique")]:(o[l]=!0,[])):[new rl(e.key,u,`integer expected, found ${l}`)]}}function Wh(e){let t=("property"===e.expressionContext?vh:gh)(Vh(e.value),e.key,e.valueSpec);if("error"===t.result)return t.value.map(t=>new rl(`${e.key}${t.key}`,e.value,t.message));let r=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!r.outputDefined())return[new rl(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!Hc(r))return[new rl(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!Hc(r))return[new rl(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!Xc(r,["zoom","feature-state"]))return[new rl(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Wc(r))return[new rl(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Hh(e){let t=e.key,r=e.value,i=th(r);return"string"===i?Hl.parse(String(r))?[]:[new rl(t,r,`color expected, "${r}" found`)]:[new rl(t,r,`color expected, ${i} found`)]}function Xh(e){let t=e.key,r=e.value,i=e.valueSpec,n=[];return Array.isArray(i.values)?-1===i.values.indexOf(Uh(r))&&n.push(new rl(t,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(i.values).indexOf(Uh(r))&&n.push(new rl(t,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function Kh(e,t){let r=e;for(let e of t)r=r[e];return r}function Yh(e,t){let r=Ch(t);return r?[new rl(`${e.key}${r.path.map(e=>`[${e}]`).join("")}`,Kh(e.value,r.path),Ah(r.legacyFilter),null,"warning")]:[]}function Jh(e){let t=Vh(e.value);return Eh(t)?[...Yh(e,t),...Wh(eh({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:Qh(e)}function Qh(e){let t=e.value,r=e.key;if("array"!==th(t))return[new rl(r,t,`array expected, ${th(t)} found`)];let i,n=e.styleSpec,a=[];if(t.length<1)return[new rl(r,t,"filter array must have at least 1 element")];switch(a=a.concat(Xh({key:`${r}[0]`,value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),Uh(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Uh(t[1])&&a.push(new rl(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&a.push(new rl(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(i=th(t[1]),"string"!==i&&a.push(new rl(`${r}[1]`,t[1],`string expected, ${i} found`)));for(let o=2;o<t.length;o++)i=th(t[o]),"$type"===Uh(t[1])?a=a.concat(Xh({key:`${r}[${o}]`,value:t[o],valueSpec:n.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&a.push(new rl(`${r}[${o}]`,t[o],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let i=1;i<t.length;i++)a=a.concat(Qh({key:`${r}[${i}]`,value:t[i],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=th(t[1]),2===t.length?"string"!==i&&a.push(new rl(`${r}[1]`,t[1],`string expected, ${i} found`)):a.push(new rl(r,t,`filter array for "${t[0]}" operator must have 2 elements`))}return a}function ed(e,t){let r=e.key,i=e.validateSpec,n=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,l=a[`${t}_${e.layerType}`];if(!l)return[];let u=s.match(Qc);if("paint"===t&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:o,valueSpec:a.transition,style:n,styleSpec:a});let c,h=e.valueSpec||l[s];if(!h)return[new rl(r,o,`unknown property "${s}"`)];if("string"===th(o)&&Kc(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(o)))return[new rl(r,o,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(c[1])} }\`.`)];let d=[];return"symbol"===e.layerType&&"text-font"===s&&rh(Vh(o))&&"identity"===Uh(o.type)&&d.push(new rl(r,o,'"text-font" does not support identity functions')),d.concat(i({key:e.key,value:o,valueSpec:h,style:n,styleSpec:a,expressionContext:"property",propertyType:t,propertyKey:s}))}function td(e){return ed(e,"paint")}function rd(e){return ed(e,"layout")}function id(e){let t=[],r=e.value,i=e.key,n=e.style,a=e.styleSpec;if("object"!==th(r))return[new rl(i,r,`object expected, ${th(r)} found`)];!r.type&&!r.ref&&t.push(new rl(i,r,'either "type" or "ref" is required'));let o=Uh(r.type),s=Uh(r.ref);if(r.id){let a=Uh(r.id);for(let o=0;o<e.arrayIndex;o++){let e=n.layers[o];Uh(e.id)===a&&t.push(new rl(i,r.id,`duplicate layer id "${r.id}", previously used at line ${e.id.__line__}`))}}if("ref"in r){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in r&&t.push(new rl(i,r[e],`"${e}" is prohibited for ref layers`))}),n.layers.forEach(t=>{Uh(t.id)===s&&(e=t)}),e?e.ref?t.push(new rl(i,r.ref,"ref cannot reference another ref layer")):o=Uh(e.type):t.push(new rl(i,r.ref,`ref layer "${s}" not found`))}else if("background"!==o)if(r.source){let e=n.sources&&n.sources[r.source],a=e&&Uh(e.type);e?"vector"===a&&"raster"===o?t.push(new rl(i,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==a&&"hillshade"===o||"raster-dem"!==a&&"color-relief"===o?t.push(new rl(i,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===a&&"raster"!==o?t.push(new rl(i,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==a||r["source-layer"]?"raster-dem"===a&&"hillshade"!==o&&"color-relief"!==o?t.push(new rl(i,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"===o&&r.paint&&r.paint["line-gradient"]&&("geojson"!==a||!e.lineMetrics)&&t.push(new rl(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new rl(i,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new rl(i,r.source,`source "${r.source}" not found`))}else t.push(new rl(i,r,'missing required property "source"'));return"raster"===o&&r.paint?.resampling&&r.paint?.["raster-resampling"]&&t.push(new rl(i,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),t=t.concat($h({key:i,value:r,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${i}.type`,value:r.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"}),filter:Jh,layout:e=>$h({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>rd(eh({layerType:o},e))}}),paint:e=>$h({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>td(eh({layerType:o},e))}})}})),t}function nd(e){let t=e.value,r=e.key,i=th(t);return"string"===i?[]:[new rl(r,t,`string expected, ${i} found`)]}const ad={promoteId:function({key:e,value:t}){if("string"===th(t))return nd({key:e,value:t});{let r=[];for(let i in t)r.push(...nd({key:`${e}.${i}`,value:t[i]}));return r}}};function od(e){let t=e.value,r=e.key,i=e.styleSpec,n=e.style,a=e.validateSpec;if(!t.type)return[new rl(r,t,'"type" is required')];let o,s=Uh(t.type);switch(s){case"vector":case"raster":return o=$h({key:r,value:t,valueSpec:i[`source_${s.replace("-","_")}`],style:e.style,styleSpec:i,objectElementValidators:ad,validateSpec:a}),o;case"raster-dem":return o=function(e){let t=e.sourceName??"",r=e.value,i=e.styleSpec,n=i.source_raster_dem,a=e.style,o=[],s=th(r);if(void 0===r)return o;if("object"!==s)return o.push(new rl("source_raster_dem",r,`object expected, ${s} found`)),o;let l="custom"===Uh(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],c=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let s in r)!l&&u.includes(s)?o.push(new rl(s,r[s],`In "${t}": "${s}" is only valid when "encoding" is set to "custom". ${c} encoding found`)):n[s]?o=o.concat(e.validateSpec({key:s,value:r[s],valueSpec:n[s],validateSpec:e.validateSpec,style:a,styleSpec:i})):o.push(new rl(s,r[s],`unknown property "${s}"`));return o}({sourceName:r,value:t,style:e.style,styleSpec:i,validateSpec:a}),o;case"geojson":if(o=$h({key:r,value:t,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:ad}),t.cluster)for(let e in t.clusterProperties){let[i,n]=t.clusterProperties[e],s="string"==typeof i?[i,["accumulated"],["get",e]]:i;o.push(...Wh({key:`${r}.${e}.map`,value:n,validateSpec:a,expressionContext:"cluster-map"})),o.push(...Wh({key:`${r}.${e}.reduce`,value:s,validateSpec:a,expressionContext:"cluster-reduce"}))}return o;case"video":return $h({key:r,value:t,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case"image":return $h({key:r,value:t,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case"canvas":return[new rl(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Xh({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:a,styleSpec:i})}}function sd(e){let t=e.value,r=e.styleSpec,i=r.light,n=e.style,a=[],o=th(t);if(void 0===t)return a;if("object"!==o)return a=a.concat([new rl("light",t,`object expected, ${o} found`)]),a;for(let o in t){let s=o.match(Qc);a=s&&i[s[1]]&&i[s[1]].transition?a.concat(e.validateSpec({key:o,value:t[o],valueSpec:r.transition,validateSpec:e.validateSpec,style:n,styleSpec:r})):i[o]?a.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],validateSpec:e.validateSpec,style:n,styleSpec:r})):a.concat([new rl(o,t[o],`unknown property "${o}"`)])}return a}function ld(e){let t=e.value,r=e.styleSpec,i=r.sky,n=e.style,a=th(t);if(void 0===t)return[];if("object"!==a)return[new rl("sky",t,`object expected, ${a} found`)];let o=[];for(let a in t){let s=a.match(Qc);o=s&&i[s[1]]&&i[s[1]].transition?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:r.transition,style:n,styleSpec:r})):i[a]?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:i[a],style:n,styleSpec:r})):o.concat([new rl(a,t[a],`unknown property "${a}"`)])}return o}function ud(e){let t=e.value,r=e.styleSpec,i=r.terrain,n=e.style,a=[],o=th(t);if(void 0===t)return a;if("object"!==o)return a=a.concat([new rl("terrain",t,`object expected, ${o} found`)]),a;for(let o in t)a=i[o]?a.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],validateSpec:e.validateSpec,style:n,styleSpec:r})):a.concat([new rl(o,t[o],`unknown property "${o}"`)]);return a}function cd(e){let t=[],r=e.value,i=e.key;if(Array.isArray(r)){let n=[],a=[];for(let o in r)r[o].id&&n.includes(r[o].id)&&t.push(new rl(i,r,`all the sprites' ids must be unique, but ${r[o].id} is duplicated`)),n.push(r[o].id),r[o].url&&a.includes(r[o].url)&&t.push(new rl(i,r,`all the sprites' URLs must be unique, but ${r[o].url} is duplicated`)),a.push(r[o].url),t=t.concat($h({key:`${i}[${o}]`,value:r[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return nd({key:i,value:r})}function hd(e){return!!e&&e.constructor===Object}function dd(e){return hd(e.value)?[]:[new rl(e.key,e.value,`object expected, ${th(e.value)} found`)]}const pd=1114111,fd=/^u\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\?{1,6}))$/i;function md(e,t){if("string"!==th(t))return[];let r=`${t}`,i=()=>[new rl(e,t,'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"')],n=r.match(fd);if(!n)return i();let[,a,o,s]=n;if(void 0!==s)return s.length>6?i():[];let l=parseInt(a,16),u=void 0===o?l:parseInt(o,16);return l>pd||u>pd?[new rl(e,t,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new rl(e,t,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function gd(e){let t=e.key??"font-faces",r=e.value,i=e.validateSpec,n=e.styleSpec??Qs,a=e.style;if(!hd(r))return[new rl(t,r,`object expected, ${th(r)} found`)];let o=[];for(let e in r){let s=r[e],l=th(s);if("string"===l)o.push(...nd({key:`${t}.${e}`,value:s}));else if("array"===l){let r={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[l,u]of s.entries()){let s=`${t}.${e}[${l}]`;o.push(...$h({key:s,value:u,valueSpec:r,styleSpec:n,style:a,validateSpec:i}));let c=hd(u)?u["unicode-range"]:void 0;if("array"===th(c))for(let[e,t]of c.entries())o.push(...md(`${s}.unicode-range[${e}]`,t))}}else o.push(new rl(`${t}.${e}`,s,`string or array expected, ${l} found`))}return o}const yd={"*":()=>[],array:Gh,boolean:function(e){let t=e.value,r=e.key,i=th(t);return"boolean"===i?[]:[new rl(r,t,`boolean expected, ${i} found`)]},number:qh,color:Hh,constants:Nh,enum:Xh,filter:Jh,function:Zh,layer:id,object:$h,source:od,light:sd,sky:ld,terrain:ud,projection:function(e){let t=e.value,r=e.styleSpec,i=r.projection,n=e.style,a=th(t);if(void 0===t)return[];if("object"!==a)return[new rl("projection",t,`object expected, ${a} found`)];let o=[];for(let a in t)o=i[a]?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:i[a],style:n,styleSpec:r})):o.concat([new rl(a,t[a],`unknown property "${a}"`)]);return o},projectionDefinition:function(e){let t=e.key,r=e.value;r=r instanceof String?r.valueOf():r;let i=th(r);return"array"!==i||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(r)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(r)?["array","string"].includes(i)?[]:[new rl(t,r,`projection expected, invalid type "${i}" found`)]:[new rl(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:nd,formatted:function(e){return 0===nd(e).length?[]:Wh(e)},resolvedImage:function(e){return 0===nd(e).length?[]:Wh(e)},padding:function(e){let t=e.key,r=e.value;if("array"===th(r)){if(r.length<1||r.length>4)return[new rl(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},n=[];for(let a=0;a<r.length;a++)n=n.concat(e.validateSpec({key:`${t}[${a}]`,value:r[a],validateSpec:e.validateSpec,valueSpec:i}));return n}return qh({key:t,value:r,valueSpec:{}})},numberArray:function(e){let t=e.key,r=e.value;if("array"===th(r)){let i={type:"number"};if(r.length<1)return[new rl(t,r,"array length at least 1 expected, length 0 found")];let n=[];for(let a=0;a<r.length;a++)n=n.concat(e.validateSpec({key:`${t}[${a}]`,value:r[a],validateSpec:e.validateSpec,valueSpec:i}));return n}return qh({key:t,value:r,valueSpec:{}})},colorArray:function(e){let t=e.key,r=e.value;if("array"===th(r)){if(r.length<1)return[new rl(t,r,"array length at least 1 expected, length 0 found")];let e=[];for(let i=0;i<r.length;i++)e=e.concat(Hh({key:`${t}[${i}]`,value:r[i],valueSpec:{}}));return e}return Hh({key:t,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(e){let t=e.key,r=e.value,i=th(r),n=e.styleSpec;if("array"!==i||r.length<1||r.length%2!=0)return[new rl(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let i=0;i<r.length;i+=2)a=a.concat(Xh({key:`${t}[${i}]`,value:r[i],valueSpec:n.layout_symbol["text-anchor"]})),a=a.concat(Gh({key:`${t}[${i+1}]`,value:r[i+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:n}));return a},sprite:cd,state:dd,fontFaces:gd};function _d(e){let t=e.value,r=e.valueSpec,i=e.styleSpec;return e.validateSpec=_d,r.expression&&rh(Uh(t))?Zh(e):r.expression&&mh(Vh(t))?Wh(e):r.type&&yd[r.type]?yd[r.type](e):$h(eh({},e,{valueSpec:r.type?i[r.type]:r}))}function vd(e){let t=e.value,r=e.key,i=nd(e);return i.length||(-1===t.indexOf("{fontstack}")&&i.push(new rl(r,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&i.push(new rl(r,t,'"glyphs" url must include a "{range}" token'))),i}function bd(e,t=el){let r=[];return r=r.concat(_d({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:_d,objectElementValidators:{glyphs:vd,"*":()=>[]}})),e.constants&&(r=r.concat(Nh({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:_d}))),wd(r)}function xd(e){return function(t){return e(Object.assign({},t,{validateSpec:_d}))}}function wd(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function Sd(e){return function(...t){return wd(e.apply(this,t))}}bd.source=Sd(xd(od)),bd.sprite=Sd(xd(cd)),bd.glyphs=Sd(xd(vd)),bd.fontFaces=Sd(xd(gd)),bd.light=Sd(xd(sd)),bd.sky=Sd(xd(ld)),bd.terrain=Sd(xd(ud)),bd.state=Sd(xd(dd)),bd.layer=Sd(xd(id)),bd.filter=Sd(xd(Jh)),bd.paintProperty=Sd(xd(td)),bd.layoutProperty=Sd(xd(rd));const Td={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};var Pd=class{constructor(e,t,r){this._rootKey=t,this._globalState=r,this.setValue(e)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(e){if(null==e||"visible"===e||"none"===e)return this._literalValue="none"===e?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let t=gh(e,this._rootKey,Td,this._globalState);if("error"===t.result)throw this._literalValue="visible",this._compiledValue=void 0,Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=wh(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};const Ed=bd,Dd=new Set(Object.keys(el).filter(e=>e.startsWith("source_")).map(e=>e.slice(7).replaceAll("_","-")));function Ad(e,t){let r=function(e){return Object.entries(e.sources??{}).filter(([,e])=>!Dd.has(e.type)).map(([e])=>`sources.${e}`)}(t);return Id(e,Ed(t).filter(({message:e})=>!r.some(t=>e.startsWith(`${t}:`)||e.startsWith(`${t}.`))))}function Id(e,t){let r=!1;for(let i of t)"warning"!==i.severity?(e.fire(new Ys(Error(i.message))),r=!0):_s(i.message);return r}function Cd(e,t,r,i){return!1!==i?.validate&&Id(e,t({styleSpec:el,...r}))}var kd=class e{constructor(e,t,r){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let n=new Int32Array(this.arrayBuffer);e=n[0],t=n[1],r=n[2],this.d=t+2*r;for(let e=0;e<this.d*this.d;e++){let t=n[3+e],r=n[3+e+1];i.push(t===r?null:n.subarray(t,r))}let a=n[3+i.length],o=n[3+i.length+1];this.keys=n.subarray(a,o),this.bboxes=n.subarray(o),this.insert=this._insertReadonly}else{this.d=t+2*r;for(let e=0;e<this.d*this.d;e++)i.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=r,this.scale=t/e,this.uid=0;let n=r/t*e;this.min=-n,this.max=e+n}insert(e,t,r,i,n){this._forEachCell(t,r,i,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,r,i,n,a){this.cells[n].push(a)}query(e,t,r,i,n){let a=this.min,o=this.max;if(e<=a&&t<=a&&o<=r&&o<=i&&!n)return[...this.keys];{let a=[];return this._forEachCell(e,t,r,i,this._queryCell,a,{},n),a}}_queryCell(e,t,r,i,n,a,o,s){let l=this.cells[n];if(null!==l){let n=this.keys,u=this.bboxes;for(let c of l)if(void 0===o[c]){let l=4*c;(s?s(u[l+0],u[l+1],u[l+2],u[l+3]):e<=u[l+2]&&t<=u[l+3]&&r>=u[l+0]&&i>=u[l+1])?(o[c]=!0,a.push(n[c])):o[c]=!1}}}_forEachCell(e,t,r,i,n,a,o,s){let l=this._convertToCellCoord(e),u=this._convertToCellCoord(t),c=this._convertToCellCoord(r),h=this._convertToCellCoord(i);for(let d=l;d<=c;d++)for(let l=u;l<=h;l++){let u=this.d*l+d;if((!s||s(this._convertFromCellCoord(d),this._convertFromCellCoord(l),this._convertFromCellCoord(d+1),this._convertFromCellCoord(l+1)))&&n.call(this,e,t,r,i,u,a,o,s))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;let e=this.cells,t=3+this.cells.length+1+1,r=0;for(let e of this.cells)r+=e.length;let i=new Int32Array(t+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let n=t;for(let t=0;t<e.length;t++){let r=e[t];i[3+t]=n,i.set(r,n),n+=r.length}return i[3+e.length]=n,i.set(this.keys,n),n+=this.keys.length,i[3+e.length+1]=n,i.set(this.bboxes,n),n+=this.bboxes.length,i.buffer}static serialize(e,t){let r=e.toArrayBuffer();return t&&t.push(r),{buffer:r}}static deserialize(t){return new e(t.buffer)}};const Md={};function Fd(e,t,r={}){if(Md[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),Md[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}Fd("Object",Object),Fd("Set",Set),Fd("TransferableGridIndex",kd),Fd("Color",Hl),Fd("Error",Error),Fd("AJAXError",Vs),Fd("ResolvedImage",nu),Fd("StylePropertyFunction",bh),Fd("StyleExpression",dh,{omit:["_evaluator"]}),Fd("ZoomDependentExpression",_h),Fd("ZoomConstantExpression",yh),Fd("CompoundExpression",Uc,{omit:["_evaluate"]});for(let e in Oc)Oc[e]._classRegistryKey||Fd(`Expression_${e}`,Oc[e]);function Rd(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||"ArrayBuffer"===e.constructor?.name)}function Ld(e){let t=e.constructor;return e.$name||t._classRegistryKey}function zd(e){return!function(e){if("object"!=typeof e||!e)return!1;let t=Ld(e);return t&&"Object"!==t}(e)&&(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||Rd(e)||ws(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function Od(e,t){if(zd(e))return(Rd(e)||ws(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let r=[];for(let i of e)r.push(Od(i,t));return r}if("object"!=typeof e)throw Error("can't serialize object of type "+typeof e);let r=Ld(e);if(!r)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!Md[r])throw Error(`${r} is not registered.`);let{klass:i}=Md[r],n=i.serialize?i.serialize(e,t):{};if(i.serialize){if(n===t?.[t.length-1])throw Error("statically serialized object won't survive transfer of $name property")}else{for(let i in e){if(!e.hasOwnProperty(i)||Md[r].omit.includes(i))continue;let a=e[i];void 0!==a&&(n[i]=Md[r].shallow.includes(i)?a:Od(a,t))}e instanceof Error&&(n.message=e.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(n.$name=r),n}function Bd(e){if(zd(e))return e;if(Array.isArray(e))return e.map(Bd);if("object"!=typeof e)throw Error("can't deserialize object of type "+typeof e);let t=Ld(e)||"Object";if(!Md[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:r}=Md[t];if(!r)throw Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(e);let i=Object.create(r.prototype);for(let r of Object.keys(e)){if("$name"===r)continue;let n=e[r];i[r]=Md[t].shallow.includes(r)?n:Bd(n)}return i}var jd=class{constructor(){this.first=!0}update(e,t){let r=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=r,!0))}},Nd=class{constructor(e,t){this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new jd,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new jd,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),r=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*t}}};var Ud=class{constructor(e,t,r,i){this.property=e,this.value=t,this.expression=function(e,t,r,i){if(rh(e))return new bh(e,t,r);if(mh(e)){let n=vh(e,t,r,i);if("error"===n.result)throw Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));return n.value}{let t=e;return"color"===r.type&&"string"==typeof e?t=Hl.parse(e):"padding"!==r.type||"number"!=typeof e&&!Array.isArray(e)?"numberArray"!==r.type||"number"!=typeof e&&!Array.isArray(e)?"colorArray"!==r.type||"string"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===r.type&&Array.isArray(e)?t=iu.parse(e):"projectionDefinition"===r.type&&"string"==typeof e&&(t=au.parse(e)):t=eu.parse(e):t=Ql.parse(e):t=Jl.parse(e),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>t}}}(void 0===t?e.specification.default:t,r,e.specification,i)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,r){return this.property.possiblyEvaluate(this,e,t,r)}},Vd=class{constructor(e,t,r){this.property=e,this.value=new Ud(e,void 0,t,r)}transitioned(e,t){return new Gd(this.property,this.value,t,os({},e.transition,this.transition),e.now)}untransitioned(){return new Gd(this.property,this.value,null,{},0)}},$d=class{constructor(e,t,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=t}_propertyRootKey(e){return`${this._rootKey}.${String(e)}`}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return gs(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Vd(this._values[e].property,this._propertyRootKey(e),this._globalState)),this._values[e].value=new Ud(this._values[e].property,null===t?void 0:gs(t),this._propertyRootKey(e),this._globalState)}getTransition(e){return gs(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Vd(this._values[e].property,this._propertyRootKey(e),this._globalState)),this._values[e].transition=gs(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);void 0!==r&&(e[t]=r);let i=this.getTransition(t);void 0!==i&&(e[`${t}-transition`]=i)}return e}transitioned(e,t){let r=new qd(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(e,t._values[i]);return r}untransitioned(){let e=new qd(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},Gd=class{constructor(e,t,r,i,n){this.property=e,this.value=t,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(e,t,r){let i=e.now||0,n=this.value.possiblyEvaluate(e,t,r),a=this.prior;if(!a)return n;if(i>this.end||this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return a.possiblyEvaluate(e,t,r);{let o=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,r),n,function(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}(o))}}},qd=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,r){let i=new Hd(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(e,t,r);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},Zd=class{constructor(e,t,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=r,this._rootKey=t}_propertyRootKey(e){return`${this._rootKey}.${String(e)}`}hasValue(e){return void 0!==this._values[e].value}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return gs(this._values[e].value)}setValue(e,t){this._values[e]=new Ud(this._values[e].property,null===t?void 0:gs(t),this._propertyRootKey(e),this._globalState)}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);void 0!==r&&(e[t]=r)}return e}possiblyEvaluate(e,t,r){let i=new Hd(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(e,t,r);return i}},Wd=class{constructor(e,t,r){this.property=e,this.value=t,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,r,i){return this.property.evaluate(this.value,this.parameters,e,t,r,i)}},Hd=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}};function Xd(e){if(Array.isArray(e))return e.length;let t=e?.values;return Array.isArray(t)?t.length:void 0}function Kd(e,t){let r=Xd(e),i=Xd(t);return void 0!==r&&void 0!==i&&r!==i}var Yd=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t){if(e.isDataDriven())throw Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,r){if(Kd(e,t))return _s(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),t;let i=this.specification.type,n=_u[i];return n?n(e,t,r):e}},Jd=class{constructor(e,t,r){this.specification=e,this.name=t,this.overrides=r}possiblyEvaluate(e,t,r,i){return"constant"===e.expression.kind||"camera"===e.expression.kind?new Wd(this,{kind:"constant",value:e.expression.evaluate(t,null,{},r,i)},t):new Wd(this,e.expression,t)}interpolate(e,t,r){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new Wd(this,{kind:"constant",value:void 0},e.parameters);if(Kd(e.value.value,t.value.value))return _s(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),t;let i=this.specification.type,n=_u[i];if(n){let i=n(e.value.value,t.value.value,r);return new Wd(this,{kind:"constant",value:i},e.parameters)}return e}evaluate(e,t,r,i,n,a){return"constant"===e.kind?e.value:e.evaluate(t,r,i,n,a)}},Qd=class extends Jd{possiblyEvaluate(e,t,r,i){if(void 0===e.value)return new Wd(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){let n=e.expression.evaluate(t,null,{},r,i),a="resolvedImage"===e.property.specification.type&&"string"!=typeof n?n.name:n,o=this._calculate(a,a,a,t);return new Wd(this,{kind:"constant",value:o},t)}if("camera"===e.expression.kind){let r=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Wd(this,{kind:"constant",value:r},t)}return new Wd(this,e.expression,t)}evaluate(e,t,r,i,n,a){if("source"===e.kind){let o=e.evaluate(t,r,i,n,a);return this._calculate(o,o,o,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},r,i),e.evaluate({zoom:Math.floor(t.zoom)},r,i),e.evaluate({zoom:Math.floor(t.zoom)+1},r,i),t):e.value}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}},ep=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t,r,i){if(void 0!==e.value){if("constant"===e.expression.kind){let n=e.expression.evaluate(t,null,{},r,i);return this._calculate(n,n,n,t)}return this._calculate(e.expression.evaluate(new Nd(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Nd(Math.floor(t.zoom),t)),e.expression.evaluate(new Nd(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}},tp=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t,r,i){return!!e.expression.evaluate(t,null,{},r,i)}interpolate(){return!1}},rp=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let r=e[t];r.specification.overridable&&this.overridableProperties.push(t);let i=this.defaultPropertyValues[t]=new Ud(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[t]=new Vd(r,r.name,void 0);this.defaultTransitioningPropertyValues[t]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=i.possiblyEvaluate({})}}};Fd("DataDrivenProperty",Jd),Fd("DataConstantProperty",Yd),Fd("CrossFadedDataDrivenProperty",Qd),Fd("CrossFadedProperty",ep),Fd("ColorRampProperty",tp);const ip=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",np=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";var ap=class extends Js{constructor(e,t,r){if(super(),this.id=e.id,this.type=e.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(e,t,r){return new Pd(e,t,r)}(this.visibility,`layers[${this.id}].layout.visibility`,r),"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Mh(e.filter,`layers[${this.id}].filter`,r)),t.layout&&(this._unevaluatedLayout=new Zd(t.layout,`layers[${this.id}].layout`,r)),t.paint)){this._transitionablePaint=new $d(t.paint,`layers[${this.id}].paint`,r);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Hd(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=Mh(e,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){if("visibility"===e)return this.visibility;if(this._transitionablePaint?.hasProperty(e))throw Error(e+ip);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[t];for(let t of r.getGlobalStateRefs())e.add(t)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){let e=new globalThis.Map;if(this._transitionablePaint)for(let t in this._transitionablePaint._values){let r=this._transitionablePaint._values[t].value;for(let i of r.getGlobalStateRefs()){let n=e.get(i)??[];n.push({name:t,value:r.value}),e.set(i,n)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,r={}){if("visibility"===e)return this.visibility=t,this._visibilityExpression.setValue(t),void this.recalculateVisibility();this._transitionablePaint?.hasProperty(e)?this.fire(new Ys(Error(e+ip))):null!=t&&this._validate(Ed.layoutProperty,`layers.${this.id}.layout.${e}`,e,t,r)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){if(e.endsWith("-transition")){let t=e.slice(0,-11);if("visibility"===t||this._unevaluatedLayout?.hasProperty(t))throw Error(e+np);return this._transitionablePaint.getTransition(t)}if("visibility"===e||this._unevaluatedLayout?.hasProperty(e))throw Error(e+np);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,r={}){if("visibility"===e||this._unevaluatedLayout?.hasProperty(e))return this.fire(new Ys(Error(e+np))),!1;if(null!=t&&this._validate(Ed.paintProperty,`layers.${this.id}.paint.${e}`,e,t,r))return!1;if(e.endsWith("-transition"))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let r=this._transitionablePaint._values[e],i="cross-faded-data-driven"===r.property.specification["property-type"],n=r.value.isDataDriven(),a=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let o=this._transitionablePaint._values[e].value;return o.isDataDriven()||n||i||this._handleOverridablePaintPropertyUpdate(e,a,o)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,r){return!1}isHidden(e=this.minzoom,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&e>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let 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?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(e.layout||={},e.layout.visibility=this.visibility),fs(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}_validate(e,t,r,i,n={}){return Cd(this,e,{key:t,layerType:this.type,objectKey:r,value:i},n)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(t instanceof Wd&&Kc(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}};let op;var sp={get paint(){return op||=new rp({"raster-opacity":new Yd(el.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new Yd(el.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new Yd(el.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new Yd(el.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new Yd(el.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new Yd(el.paint_raster["raster-contrast"],"raster-contrast"),resampling:new Yd(el.paint_raster.resampling,"resampling"),"raster-resampling":new Yd(el.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new Yd(el.paint_raster["raster-fade-duration"],"raster-fade-duration")})}};const lp=e=>"raster"===e.type;var up=class extends ap{constructor(e,t){super(e,sp,t)}};const cp={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};var hp=class{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},dp=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_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);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function pp(e,t=1){let r=0,i=0;return{members:e.map(e=>{let n=function(e){return cp[e].BYTES_PER_ELEMENT}(e.type),a=r=fp(r,Math.max(t,n)),o=e.components||1;return i=Math.max(i,n),r+=n*o,{name:e.name,type:e.type,components:o,offset:a}}),size:fp(r,Math.max(i,t)),alignment:t}}function fp(e,t){return Math.ceil(e/t)*t}var mp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=2*e;return this.int16[i+0]=t,this.int16[i+1]=r,e}};mp.prototype.bytesPerElement=4,Fd("StructArrayLayout2i4",mp);var gp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let n=3*e;return this.int16[n+0]=t,this.int16[n+1]=r,this.int16[n+2]=i,e}};gp.prototype.bytesPerElement=6,Fd("StructArrayLayout3i6",gp);var yp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){let a=4*e;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=n,e}};yp.prototype.bytesPerElement=8,Fd("StructArrayLayout4i8",yp);var _p=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,i,n,a)}emplace(e,t,r,i,n,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,e}};_p.prototype.bytesPerElement=12,Fd("StructArrayLayout2i4i12",_p);var vp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,i,n,a)}emplace(e,t,r,i,n,a,o){let s=4*e,l=8*e;return this.int16[s+0]=t,this.int16[s+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=o,e}};vp.prototype.bytesPerElement=8,Fd("StructArrayLayout2i4ub8",vp);var bp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=2*e;return this.float32[i+0]=t,this.float32[i+1]=r,e}};bp.prototype.bytesPerElement=8,Fd("StructArrayLayout2f8",bp);var xp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a,o,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,t,r,i,n,a,o,s,l,u)}emplace(e,t,r,i,n,a,o,s,l,u,c){let h=10*e;return this.uint16[h+0]=t,this.uint16[h+1]=r,this.uint16[h+2]=i,this.uint16[h+3]=n,this.uint16[h+4]=a,this.uint16[h+5]=o,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,e}};xp.prototype.bytesPerElement=20,Fd("StructArrayLayout10ui20",xp);var wp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,r,i,n,a,o,s)}emplace(e,t,r,i,n,a,o,s,l){let u=8*e;return this.uint16[u+0]=t,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=o,this.uint16[u+6]=s,this.uint16[u+7]=l,e}};wp.prototype.bytesPerElement=16,Fd("StructArrayLayout8ui16",wp);var Sp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a,o,s,l,u,c,h,d){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,r,i,n,a,o,s,l,u,c,h,d)}emplace(e,t,r,i,n,a,o,s,l,u,c,h,d,p){let f=14*e,m=7*e;return this.int16[f+0]=t,this.int16[f+1]=r,this.int16[f+2]=i,this.int16[f+3]=n,this.uint16[f+4]=a,this.uint16[f+5]=o,this.uint16[f+6]=s,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=d,this.float32[m+6]=p,e}};Sp.prototype.bytesPerElement=28,Fd("StructArrayLayout4i4ui4i1f28",Sp);var Tp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let n=3*e;return this.float32[n+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,e}};Tp.prototype.bytesPerElement=12,Fd("StructArrayLayout3f12",Tp);var Pp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.uint32[r+0]=t,e}};Pp.prototype.bytesPerElement=4,Fd("StructArrayLayout1ul4",Pp);var Ep=class extends dp{_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,t,r,i,n,a,o,s,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,r,i,n,a,o,s,l)}emplace(e,t,r,i,n,a,o,s,l,u){let c=10*e,h=5*e;return this.int16[c+0]=t,this.int16[c+1]=r,this.int16[c+2]=i,this.int16[c+3]=n,this.int16[c+4]=a,this.int16[c+5]=o,this.uint32[h+3]=s,this.uint16[c+8]=l,this.uint16[c+9]=u,e}};Ep.prototype.bytesPerElement=20,Fd("StructArrayLayout6i1ul2ui20",Ep);var Dp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,i,n,a)}emplace(e,t,r,i,n,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=r,this.int16[s+2]=i,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=o,e}};Dp.prototype.bytesPerElement=12,Fd("StructArrayLayout2i2i2i12",Dp);var Ap=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i,n)}emplace(e,t,r,i,n,a){let o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=r,this.float32[o+2]=i,this.int16[s+6]=n,this.int16[s+7]=a,e}};Ap.prototype.bytesPerElement=16,Fd("StructArrayLayout2f1f2i16",Ap);var Ip=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,n,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,i,n,a)}emplace(e,t,r,i,n,a,o){let s=16*e,l=4*e,u=8*e;return this.uint8[s+0]=t,this.uint8[s+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=o,e}};Ip.prototype.bytesPerElement=16,Fd("StructArrayLayout2ub2f2i16",Ip);var Cp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let n=3*e;return this.uint16[n+0]=t,this.uint16[n+1]=r,this.uint16[n+2]=i,e}};Cp.prototype.bytesPerElement=6,Fd("StructArrayLayout3ui6",Cp);var kp=class extends dp{_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,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y)}emplace(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_){let v=26*e,b=13*e,x=52*e;return this.int16[v+0]=t,this.int16[v+1]=r,this.uint16[v+2]=i,this.uint16[v+3]=n,this.uint32[b+2]=a,this.uint32[b+3]=o,this.uint32[b+4]=s,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=c,this.float32[b+7]=h,this.float32[b+8]=d,this.uint8[x+36]=p,this.uint8[x+37]=f,this.uint8[x+38]=m,this.uint32[b+10]=g,this.int16[v+22]=y,this.float32[b+12]=_,e}};kp.prototype.bytesPerElement=52,Fd("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",kp);var Mp=class extends dp{_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,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_,v,b,x,w,S,T,P,E,D,A){let I=this.length;return this.resize(I+1),this.emplace(I,e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_,v,b,x,w,S,T,P,E,D,A)}emplace(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_,v,b,x,w,S,T,P,E,D,A,I){let C=34*e,k=17*e;return this.int16[C+0]=t,this.int16[C+1]=r,this.int16[C+2]=i,this.int16[C+3]=n,this.int16[C+4]=a,this.int16[C+5]=o,this.int16[C+6]=s,this.int16[C+7]=l,this.uint16[C+8]=u,this.uint16[C+9]=c,this.uint16[C+10]=h,this.uint16[C+11]=d,this.uint16[C+12]=p,this.uint16[C+13]=f,this.uint16[C+14]=m,this.uint16[C+15]=g,this.uint16[C+16]=y,this.uint16[C+17]=_,this.uint16[C+18]=v,this.uint16[C+19]=b,this.uint16[C+20]=x,this.uint16[C+21]=w,this.uint16[C+22]=S,this.uint32[k+12]=T,this.float32[k+13]=P,this.float32[k+14]=E,this.uint16[C+30]=D,this.uint16[C+31]=A,this.float32[k+16]=I,e}};Mp.prototype.bytesPerElement=68,Fd("StructArrayLayout8i15ui1ul2f2ui1f68",Mp);var Fp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.float32[r+0]=t,e}};Fp.prototype.bytesPerElement=4,Fd("StructArrayLayout1f4",Fp);var Rp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let n=6*e,a=3*e;return this.uint16[n+0]=t,this.float32[a+1]=r,this.float32[a+2]=i,e}};Rp.prototype.bytesPerElement=12,Fd("StructArrayLayout1ui2f12",Rp);var Lp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let n=2*e,a=4*e;return this.uint32[n+0]=t,this.uint16[a+2]=r,this.uint16[a+3]=i,e}};Lp.prototype.bytesPerElement=8,Fd("StructArrayLayout1ul2ui8",Lp);var zp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=2*e;return this.uint16[i+0]=t,this.uint16[i+1]=r,e}};zp.prototype.bytesPerElement=4,Fd("StructArrayLayout2ui4",zp);var Op=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.uint16[r+0]=t,e}};Op.prototype.bytesPerElement=2,Fd("StructArrayLayout1ui2",Op);var Bp=class extends dp{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i)}emplace(e,t,r,i,n){let a=4*e;return this.float32[a+0]=t,this.float32[a+1]=r,this.float32[a+2]=i,this.float32[a+3]=n,e}};Bp.prototype.bytesPerElement=16,Fd("StructArrayLayout4f16",Bp);var jp=class extends hp{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 $a(this.anchorPointX,this.anchorPointY)}};jp.prototype.size=20;var Np=class extends Ep{get(e){return new jp(this,e)}};Fd("CollisionBoxArray",Np);var Up=class extends hp{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]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Up.prototype.size=52;var Vp=class extends kp{get(e){return new Up(this,e)}};Fd("PlacedSymbolArray",Vp);var $p=class extends hp{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 collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};$p.prototype.size=68;var Gp=class extends Mp{get(e){return new $p(this,e)}};Fd("SymbolInstanceArray",Gp);var qp=class extends Fp{getoffsetX(e){return this.float32[1*e+0]}};Fd("GlyphOffsetArray",qp);var Zp=class extends gp{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}};Fd("SymbolLineVertexArray",Zp);var Wp=class extends hp{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};Wp.prototype.size=12;var Hp=class extends Rp{get(e){return new Wp(this,e)}};Fd("TextAnchorOffsetArray",Hp);var Xp=class extends hp{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]}};Xp.prototype.size=8;var Kp=class extends Lp{get(e){return new Xp(this,e)}};Fd("FeatureIndexArray",Kp);var Yp=class extends mp{},Jp=class extends gp{},Qp=class extends yp{},ef=class extends mp{},tf=class extends mp{},rf=class extends _p{},nf=class extends vp{},af=class extends bp{},of=class extends xp{},sf=class extends wp{},lf=class extends Sp{},uf=class extends Tp{},cf=class extends Pp{},hf=class extends Dp{},df=class extends Ap{},pf=class extends Ip{},ff=class extends Cp{},mf=class extends Cp{},gf=class extends zp{},yf=class extends Op{};const _f=pp([{name:"a_pos",components:2,type:"Int16"}],4),vf=_f.members;_f.size,_f.alignment;var bf=class e{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(t,r,i,n){let a=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&_s(`Max vertices per segment is ${e.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${e.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+t>e.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(r,i,n):a}createNewSegment(e,t,r){let i={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==r&&(i.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(i),i}getOrCreateLatestSegment(e,t,r){return this.prepareSegment(0,e,t,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(t,r,i,n){return new e([{vertexOffset:t,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};function xf(e,t){return 256*(e=ns(Math.floor(e),0,255))+ns(Math.floor(t),0,255)}bf.MAX_VERTEX_ARRAY_LENGTH=65535,Fd("SegmentVector",bf);const wf=pp([{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"}]),Sf=pp([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var Tf,Pf,Ef=Va((e,t)=>{void 0!==t&&(t.exports=function(e,t){for(var r,i,n=3&e.length,a=e.length-n,o=t,s=3432918353,l=461845907,u=0;u<a;)i=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,o=27492+(65535&(r=5*(65535&(o=(o^=i=(65535&(i=(i=(65535&i)*s+(((i>>>16)*s&65535)<<16)&4294967295)<<15|i>>>17))*l+(((i>>>16)*l&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+(((r>>>16)+58964&65535)<<16);switch(i=0,n){case 3:i^=(255&e.charCodeAt(u+2))<<16;case 2:i^=(255&e.charCodeAt(u+1))<<8;case 1:o^=i=(65535&(i=(i=(65535&(i^=255&e.charCodeAt(u)))*s+(((i>>>16)*s&65535)<<16)&4294967295)<<15|i>>>17))*l+(((i>>>16)*l&65535)<<16)&4294967295}return o^=e.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0})}),Df=Va((e,t)=>{t.exports=function(e,t){for(var r,i=e.length,n=t^i,a=0;i>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(r>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),i-=4,++a;switch(i){case 3:n^=(255&e.charCodeAt(a+2))<<16;case 2:n^=(255&e.charCodeAt(a+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(a)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}}),Af=(Tf=Va((e,t)=>{var r=Ef(),i=Df();t.exports=r,t.exports.murmur3=r,t.exports.murmur2=i})(),Pf=null==Tf?{}:za(Na(Tf)),((e,t,r,i)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var n,a=ja(t),o=0,s=a.length;o<s;o++)n=a[o],!Ua.call(e,n)&&void 0!==n&&Oa(e,n,{get:(e=>t[e]).bind(null,n),enumerable:!(i=Ba(t,n))||i.enumerable});return e})(Oa(Pf,"default",{value:Tf,enumerable:!0}),Tf)),If=class e{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,r,i){this.ids.push(Cf(e)),this.positions.push(t,r,i)}getPositions(e){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let t=Cf(e),r=0,i=this.ids.length-1;for(;r<i;){let e=r+i>>1;this.ids[e]>=t?i=e:r=e+1}let n=[];for(;this.ids[r]===t;){let e=this.positions[3*r],t=this.positions[3*r+1],i=this.positions[3*r+2];n.push({index:e,start:t,end:i}),r++}return n}static serialize(e,t){let r=new Float64Array(e.ids),i=new Uint32Array(e.positions);return kf(r,i,0,r.length-1),t&&t.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(t){let r=new e;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}};function Cf(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:(0,Af.default)(String(e))}function kf(e,t,r,i){for(;r<i;){let n=e[r+i>>1],a=r-1,o=i+1;for(;;){do{a++}while(e[a]<n);do{o--}while(e[o]>n);if(a>=o)break;Mf(e,a,o),Mf(t,3*a,3*o),Mf(t,3*a+1,3*o+1),Mf(t,3*a+2,3*o+2)}o-r<i-o?(kf(e,t,r,o),r=o+1):(kf(e,t,o+1,i),i=o)}}function Mf(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}Fd("FeaturePositionMap",If);var Ff=class{constructor(e,t){this.gl=e.gl,this.location=t}},Rf=class extends Ff{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},Lf=class extends Ff{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},zf=class extends Ff{constructor(e,t){super(e,t),this.current=[0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1])&&(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},Of=class extends Ff{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2])&&(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},Bf=class extends Ff{constructor(e,t){super(e,t),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]))}},jf=class extends Ff{constructor(e,t){super(e,t),this.current=Hl.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))}},Nf=class extends Ff{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(4*e.length);for(let r=0;r<e.length;r++)t[4*r]=e[r].r,t[4*r+1]=e[r].g,t[4*r+2]=e[r].b,t[4*r+3]=e[r].a;this.gl.uniform4fv(this.location,t)}}},Uf=class extends Ff{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}};const Vf=new Float32Array(16);var $f=class extends Ff{constructor(e,t){super(e,t),this.current=Vf}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};function Gf(e){return[xf(255*e.r,255*e.g),xf(255*e.b,255*e.a)]}var qf=class{constructor(e,t,r){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=r}setUniform(e,t,r){e.set(r.constantOr(this.value))}getBinding(e,t,r){return"color"===this.type?new jf(e,t):new Lf(e,t)}},Zf=class{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,r,i){let n=null;"u_pattern_to"===i?n=this.patternTo:"u_pattern_from"===i?n=this.patternFrom:"u_dasharray_to"===i?n=this.dashTo:"u_dasharray_from"===i?n=this.dashFrom:"u_pixel_ratio_to"===i?n=this.pixelRatioTo:"u_pixel_ratio_from"===i&&(n=this.pixelRatioFrom),null!==n&&e.set(n)}getBinding(e,t,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new Bf(e,t):new Lf(e,t)}},Wf=class{constructor(e,t,r,i){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,t,r){let i=this.paintVertexArray.length,n=this.expression.evaluate(new Nd(0,r),t,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(i,e,n)}updatePaintArray(e,t,r,i,n){let a=this.expression.evaluate(new Nd(0,n),r,i);this._setPaintValue(e,t,a)}_setPaintValue(e,t,r){if("color"===this.type){let i=Gf(r);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i[0],i[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray?.arrayBuffer.byteLength&&(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()}},Hf=class{constructor(e,t,r,i,n,a){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,r){let i=this.expression.evaluate(new Nd(this.zoom,r),t,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new Nd(this.zoom+1,r),t,{},r.canonical,[],r.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(a,e,i,n)}updatePaintArray(e,t,r,i,n){let a=this.expression.evaluate(new Nd(this.zoom,n),r,i),o=this.expression.evaluate(new Nd(this.zoom+1,n),r,i);this._setPaintValue(e,t,a,o)}_setPaintValue(e,t,r,i){if("color"===this.type){let n=Gf(r),a=Gf(i);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n[0],n[1],a[0],a[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(e){this.paintVertexArray?.arrayBuffer.byteLength&&(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,t){let r=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,i=ns(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,t,r){return new Lf(e,t)}},Xf=class{constructor(e,t,r,i,n,a){this.expression=e,this.type=t,this.useIntegerZoom=r,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(e,t,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,this.getPositionIds(t),r)}updatePaintArray(e,t,r,i,n){this._setPaintValues(e,t,this.getPositionIds(r),n)}_setPaintValues(e,t,r,i){let n=this.getPositions(i);if(!n||!r)return;let a=n[r.min],o=n[r.mid],s=n[r.max];if(a&&o&&s)for(let r=e;r<t;r++)this.emplace(this.zoomInPaintVertexArray,r,a,o),this.emplace(this.zoomOutPaintVertexArray,r,s,o)}upload(e){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Kf=class extends Xf{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns?.[this.layerId]}getVertexAttributes(){return wf.members}emplace(e,t,r,i){e.emplace(t,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.pixelRatio,i.pixelRatio)}},Yf=class extends Xf{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes?.[this.layerId]}getVertexAttributes(){return Sf.members}emplace(e,t,r,i){e.emplace(t,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}},Jf=class{constructor(e,t,r){this.binders={},this._buffers=[];let i=[];for(let n in e.paint._values){if(!r(n))continue;let a=e.paint.get(n);if(!(a instanceof Wd&&Kc(a.property.specification)))continue;let o=em(n,e.type),s=a.value,l=a.property.specification.type,u=a.property.useIntegerZoom,c=a.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===s.kind)this.binders[n]=h?new Zf(s.value,o):new qf(s.value,o,l),i.push(`/u_${n}`);else if("source"===s.kind||h){let r=tm(n,l,"source");this.binders[n]=h?"line-dasharray"===n?new Yf(s,l,u,t,r,e.id):new Kf(s,l,u,t,r,e.id):new Wf(s,o,l,r),i.push(`/a_${n}`)}else{let e=tm(n,l,"composite");this.binders[n]=new Hf(s,o,l,u,t,e),i.push(`/z_${n}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Wf||t instanceof Hf?t.maxValue:0}populatePaintArrays(e,t,r){for(let i in this.binders){let n=this.binders[i];(n instanceof Wf||n instanceof Hf||n instanceof Xf)&&n.populatePaintArray(e,t,r)}}setConstantPatternPositions(e,t){for(let r in this.binders){let i=this.binders[r];i instanceof Zf&&i.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(let r in this.binders){let i=this.binders[r];i instanceof Zf&&i.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,r,i,n){let a=!1;for(let o of e){let e=t.getPositions(o.id);for(let t of e){let e=r.feature(t.index);for(let r in this.binders){let s=this.binders[r];(s instanceof Wf||s instanceof Hf||s instanceof Xf)&&!0===s.expression.isStateDependent&&(s.expression=i.paint.get(r).value,s.updatePaintArray(t.start,t.end,e,o.state,n),a=!0)}}}return a}defines(){let e=[];for(let t in this.binders){let r=this.binders[t];(r instanceof qf||r instanceof Zf)&&e.push(...r.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof Wf||r instanceof Hf)for(let t of r.paintVertexAttributes)e.push(t.name);else if(r instanceof Xf){let t=r.getVertexAttributes();for(let r of t)e.push(r.name)}}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof qf||r instanceof Zf||r instanceof Hf)for(let t of r.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let r=[];for(let i in this.binders){let n=this.binders[i];if(n instanceof qf||n instanceof Zf||n instanceof Hf)for(let a of n.uniformNames)if(t[a]){let o=n.getBinding(e,t[a],a);r.push({name:a,property:i,binding:o})}}return r}setUniforms(e,t,r,i){for(let{name:e,property:n,binding:a}of t)this.binders[n].setUniform(a,i,r.get(n),e)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let r=this.binders[t];if(e&&r instanceof Xf){let t=2===e.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(r instanceof Wf||r instanceof Hf)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(e){for(let t in this.binders){let r=this.binders[t];(r instanceof Wf||r instanceof Hf||r instanceof Xf)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Wf||t instanceof Hf||t instanceof Xf)&&t.destroy()}}},Qf=class{constructor(e,t,r=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new Jf(i,t,r);this.needsUpload=!1,this._featureMap=new If,this._bufferOffset=0}populatePaintArrays(e,t,r,i){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,t,i);void 0!==t.id&&this._featureMap.add(t.id,r,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,r,i){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(e,this._featureMap,t,n,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function em(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function tm(e,t,r){let i={color:{source:bp,composite:Bp},number:{source:Fp,composite:bp}};return function(e){return{"line-pattern":{source:of,composite:of},"fill-pattern":{source:of,composite:of},"fill-extrusion-pattern":{source:of,composite:of},"line-dasharray":{source:sf,composite:sf}}[e]}(e)?.[r]||i[t][r]}Fd("ConstantBinder",qf),Fd("CrossFadedConstantBinder",Zf),Fd("SourceExpressionBinder",Wf),Fd("CrossFadedPatternBinder",Kf),Fd("CrossFadedDasharrayBinder",Yf),Fd("CompositeExpressionBinder",Hf),Fd("ProgramConfiguration",Jf,{omit:["_buffers"]}),Fd("ProgramConfigurationSet",Qf);const rm=-16384;function im(e){let t=Oo/e.extent,r=e.loadGeometry();for(let e of r)for(let r of e){let e=Math.round(r.x*t),i=Math.round(r.y*t);r.x=ns(e,rm,16383),r.y=ns(i,rm,16383),(e<r.x||e>r.x+1||i<r.y||i>r.y+1)&&_s("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function nm(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?im(e):[]}}const am=-32768;function om(e,t,r,i,n){e.emplaceBack(am+8*t+i,am+8*r+n)}var sm=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new ef,this.indexArray=new mf,this.segments=new bf,this.programConfigurations=new Qf(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){let i=this.layers[0],n=[],a=null,o=!1,s="heatmap"===i.type;if("circle"===i.type){let e=i;a=e.layout.get("circle-sort-key"),o=!a.isConstant(),s||="map"===e.paint.get("circle-pitch-alignment")}let l=s?t.subdivisionGranularity.circle:1,u=new Nd(this.zoom),c=this.layers[0]._featureFilter.needGeometry;for(let{feature:t,id:i,index:s,sourceLayerIndex:l}of e){let e=nm(t,c);if(!this.layers[0]._featureFilter.filter(u,e,r))continue;let h=o?a.evaluate(e,{},r):void 0,d={id:i,properties:t.properties,type:t.type,sourceLayerIndex:l,index:s,geometry:c?e.geometry:im(t),patterns:{},sortKey:h};n.push(d)}o&&n.sort((e,t)=>e.sortKey-t.sortKey);for(let i of n){let{geometry:n,index:a,sourceLayerIndex:o}=i,s=e[a].feature;this.addFeature(i,n,a,r,l),t.featureIndex.insert(s,n,a,o,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}addFeatures(e){}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,vf),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,t,r,i,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let o=a.length;for(let r of t)for(let t of r){let r=t.x,i=t.y;if(r<0||r>=8192||i<0||i>=8192)continue;let n=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,e.sortKey),s=n.vertexLength;for(let e=0;e<o;e++)for(let t=0;t<o;t++)om(this.layoutVertexArray,r,i,a[t],a[e]);for(let e=0;e<o-1;e++)for(let t=0;t<o-1;t++){let r=s+e*o+t,i=s+(e+1)*o+t;this.indexArray.emplaceBack(r,i+1,r+1),this.indexArray.emplaceBack(r,i,i+1)}n.vertexLength+=o*o,n.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:{},canonical:i})}};function lm(e,t){for(let r of e)if(ym(t,r))return!0;for(let r of t)if(ym(e,r))return!0;return dm(e,t)}function um(e,t,r){return!!ym(e,t)||fm(t,e,r)}function cm(e,t){if(1===e.length)return gm(t,e[0]);for(let r of t)for(let t of r)if(ym(e,t))return!0;for(let r of e)if(gm(t,r))return!0;for(let r of t)if(dm(e,r))return!0;return!1}function hm(e,t,r){if(e.length>1){if(dm(e,t))return!0;for(let i of t)if(fm(i,e,r))return!0}for(let i of e)if(fm(i,t,r))return!0;return!1}function dm(e,t){if(0===e.length||0===t.length)return!1;for(let r=0;r<e.length-1;r++){let i=e[r],n=e[r+1];for(let e=0;e<t.length-1;e++)if(pm(i,n,t[e],t[e+1]))return!0}return!1}function pm(e,t,r,i){return vs(e,r,i)!==vs(t,r,i)&&vs(e,t,r)!==vs(e,t,i)}function fm(e,t,r){let i=r*r;if(1===t.length)return e.distSqr(t[0])<i;for(let r=1;r<t.length;r++)if(mm(e,t[r-1],t[r])<i)return!0;return!1}function mm(e,t,r){let i=t.distSqr(r);if(0===i)return e.distSqr(t);let n=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/i;return n<0?e.distSqr(t):n>1?e.distSqr(r):e.distSqr(r.sub(t)._mult(n)._add(t))}function gm(e,t){let r,i,n,a=!1;for(let o of e){r=o;for(let e=0,o=r.length-1;e<r.length;o=e++)i=r[e],n=r[o],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(a=!a)}return a}function ym(e,t){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let a=e[i],o=e[n];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(r=!r)}return r}function _m(e,t,r){let i=r[0],n=r[2];if(e.x<i.x&&t.x<i.x||e.x>n.x&&t.x>n.x||e.y<i.y&&t.y<i.y||e.y>n.y&&t.y>n.y)return!1;let a=vs(e,t,r[0]);return a!==vs(e,t,r[1])||a!==vs(e,t,r[2])||a!==vs(e,t,r[3])}function vm(e,t,r){let i=t.paint.get(e).value;return"constant"===i.kind?i.value:r.programConfigurations.get(t.id).getMaxValue(e)}function bm(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function xm(e,t,r,i,n){if(!t[0]&&!t[1])return e;let a=$a.convert(t)._mult(n);"viewport"===r&&a._rotate(-i);let o=[];for(let t of e)o.push(t.sub(a));return o}function wm(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],n=t.at(-1);(0===r||n&&!i.equals(n))&&t.push(i)}return t}function Sm({queryGeometry:e,size:t},r){return um(e,r,t)}function Tm({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},a){return um(e,a,t*(r.projectTileCoordinates(a.x,a.y,i,n?.(a.x,a.y)).signedDistanceFromCamera/r.cameraToCenterDistance))}function Pm({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},a){let o=r.projectTileCoordinates(a.x,a.y,i,n?.(a.x,a.y)).signedDistanceFromCamera,s=t*(r.cameraToCenterDistance/o);return um(e,Am(a,r,i,n),s)}function Em({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n},a){return um(e,Am(a,r,i,n),t)}function Dm({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n,pitchAlignment:a="map",pitchScale:o="map"},s){let l="map"===a?"map"===o?Sm:Tm:"map"===o?Pm:Em,u={queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:n};for(let e of s)for(let t of e)if(l(u,t))return!0;return!1}function Am(e,t,r,i){let n=t.projectTileCoordinates(e.x,e.y,r,i?.(e.x,e.y)).point;return new $a((.5*n.x+.5)*t.width,(.5*-n.y+.5)*t.height)}let Im,Cm;Fd("CircleBucket",sm,{omit:["layers"]});var km={get paint(){return Cm||=new rp({"circle-radius":new Jd(el.paint_circle["circle-radius"],"circle-radius"),"circle-color":new Jd(el.paint_circle["circle-color"],"circle-color"),"circle-blur":new Jd(el.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new Jd(el.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new Yd(el.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new Yd(el.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new Yd(el.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new Yd(el.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new Jd(el.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new Jd(el.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new Jd(el.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")})},get layout(){return Im||=new rp({"circle-sort-key":new Jd(el.layout_circle["circle-sort-key"],"circle-sort-key")})}},Mm=class extends ap{constructor(e,t){super(e,km,t)}createBucket(e){return new sm(e)}queryRadius(e){let t=e;return vm("circle-radius",this,t)+vm("circle-stroke-width",this,t)+bm(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){let l,u,c=xm(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,a),h=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r),d=this.paint.get("circle-pitch-scale"),p=this.paint.get("circle-pitch-alignment");return"map"===p?(l=c,u=h*a):(l=function(e,t,r,i){return e.map(e=>Am(e,t,r,i))}(c,n,o,s),u=h),Dm({queryGeometry:l,size:u,transform:n,unwrappedTileID:o,getElevation:s,pitchAlignment:p,pitchScale:d},i)}},Fm=class extends sm{};let Rm;Fd("HeatmapBucket",Fm,{omit:["layers"]});var Lm={get paint(){return Rm||=new rp({"heatmap-radius":new Jd(el.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new Jd(el.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new Yd(el.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new tp(el.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new Yd(el.paint_heatmap["heatmap-opacity"],"heatmap-opacity")})}};function zm(e,{width:t,height:r},i,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==t*r*i)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${t*r*i}`)}else n=new Uint8Array(t*r*i);return e.width=t,e.height=r,e.data=n,e}function Om(e,{width:t,height:r},i){if(t===e.width&&r===e.height)return;let n=zm({},{width:t,height:r},i);Bm(e,n,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},i),e.width=t,e.height=r,e.data=n.data}function Bm(e,t,r,i,n,a){if(0===n.width||0===n.height)return t;if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw RangeError("out of range destination coordinates for image copy");let o=e.data,s=t.data;if(o===s)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){let u=((r.y+l)*e.width+r.x)*a,c=((i.y+l)*t.width+i.x)*a;for(let e=0;e<n.width*a;e++)s[c+e]=o[u+e]}return t}var jm=class e{constructor(e,t){zm(this,e,1,t)}resize(e){Om(this,e,1)}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,n){Bm(e,t,r,i,n,1)}},Nm=class e{constructor(e,t){zm(this,e,4,t)}resize(e){Om(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,n){Bm(e,t,r,i,n,4)}setPixel(e,t,r){let i=4*(e*this.width+t);this.data[i+0]=Math.round(255*r.r/r.a),this.data[i+1]=Math.round(255*r.g/r.a),this.data[i+2]=Math.round(255*r.b/r.a),this.data[i+3]=Math.round(255*r.a)}};function Um(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=4){let i=e[r+3];t[r+0]=Math.round(e[r+0]*i/255),t[r+1]=Math.round(e[r+1]*i/255),t[r+2]=Math.round(e[r+2]*i/255),t[r+3]=i}return t}function Vm(e){let t={},r=e.resolution||256,i=e.clips?e.clips.length:1,n=e.image||new Nm({width:r,height:i});if(!function(e){return Math.log(e)/Math.LN2%1==0}(r))throw Error(`width is not a power of 2 - ${r}`);let a=(i,a,o)=>{t[e.evaluationKey]=o;let s=e.expression.evaluate(t);n.setPixel(i/4/r,a/4,s)};if(e.clips)for(let t=0,n=0;t<i;++t,n+=4*r)for(let i=0,o=0;i<r;i++,o+=4){let s=i/(r-1),{start:l,end:u}=e.clips[t];a(n,o,l*(1-s)+u*s)}else for(let e=0,t=0;e<r;e++,t+=4)a(0,t,e/(r-1));return n}Fd("AlphaImage",jm),Fd("RGBAImage",Nm);var $m=class extends ap{createBucket(e){return new Fm(e)}constructor(e,t){super(e,Lm,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Vm({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete("big-fb")}queryRadius(e){return vm("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){return Dm({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(t,r)*a,transform:n,unwrappedTileID:o,getElevation:s},i)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}};let Gm;var qm={get paint(){return Gm||=new rp({"hillshade-illumination-direction":new Yd(el.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new Yd(el.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new Yd(el.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new Yd(el.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new Yd(el.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new Yd(el.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new Yd(el.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new Yd(el.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new Yd(el.paint_hillshade.resampling,"resampling")})}},Zm=class extends ap{constructor(e,t){super(e,qm,t),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,n=Math.max(e.length,t.length,r.length,i.length);e=e.concat(Array(n-e.length).fill(e.at(-1))),t=t.concat(Array(n-t.length).fill(t.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));let a=t.map(Ts);return{directionRadians:e.map(Ts),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}};let Wm;var Hm={get paint(){return Wm||=new rp({"color-relief-opacity":new Yd(el["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new tp(el["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new Yd(el["paint_color-relief"].resampling,"resampling")})}};function Xm(e){return"data"in e}var Km=class{constructor(e,t,r,i){this.context=e,this.format=r,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,i)}update(e,t,r){let{width:i,height:n}=e,a=(this.size?.[0]!==i||this.size[1]!==n)&&!r,{context:o}=this,{gl:s}=o;this.useMipmap=!!t?.useMipmap,a&&this.size&&this.format===s.RGBA&&(s.deleteTexture(this.texture),this.texture=s.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1);let l=this.format===s.RGBA&&!1!==t?.premultiply;if(a)if(this.size=[i,n],this.format===s.RGBA&&i>0&&n>0){let t=this.useMipmap?Math.floor(Math.log2(Math.max(i,n)))+1:1;if(s.texStorage2D(s.TEXTURE_2D,t,s.RGBA8,i,n),Xm(e)){o.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:t}=e;l&&t&&(t=Um(t)),t&&s.texSubImage2D(s.TEXTURE_2D,0,0,0,i,n,s.RGBA,s.UNSIGNED_BYTE,t)}else o.pixelStoreUnpackPremultiplyAlpha.set(l),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,e)}else Xm(e)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,l,i,n,s)):(o.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(e,s));else{let{x:t,y:a}=r||{x:0,y:0};Xm(e)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,l,t,a,i,n,s)):(o.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(e,t,a,s))}this.useMipmap&&!(Xm(e)&&null===e.data)&&s.generateMipmap(s.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,r,i,n){let{data:a}=e;t&&a&&(a=Um(a)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,i,0,this.format,n.UNSIGNED_BYTE,a)}_updateDomImage(e,t,r,i){i.texSubImage2D(i.TEXTURE_2D,0,t,r,i.RGBA,i.UNSIGNED_BYTE,e)}_updateRawData(e,t,r,i,n,a,o){let{data:s}=e;t&&s&&(s=Um(s)),o.texSubImage2D(o.TEXTURE_2D,0,r,i,n,a,o.RGBA,o.UNSIGNED_BYTE,s)}bind(e,t,r){let{context:i}=this,{gl:n}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),(r===n.LINEAR_MIPMAP_NEAREST||r===n.LINEAR_MIPMAP_LINEAR)&&!this.useMipmap&&(r=n.LINEAR);let a=r||e;e!==this.magFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),this.magFilter=e),a!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,a),this.minFilter=a),t!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrap=t)}generateMipmap(){if(!this.useMipmap)return;let{gl:e}=this.context;e.bindTexture(e.TEXTURE_2D,this.texture),e.generateMipmap(e.TEXTURE_2D)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},Ym=class e{static{this.byteViewCache=new WeakMap}constructor(t,r,i,n=1,a=1,o=1,s=0){if(this.uid=t,r.height!==r.width)throw RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void _s(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;let l=this.dim=r.height-4;switch(this.data=new Uint32Array(r.data.buffer),e.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=a,this.blueFactor=o,this.baseShift=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=-2;e<l+2;e++){let t=this._idx(0,Math.max(0,Math.min(l-1,e)));(e<0||e>=l)&&this.data.copyWithin(this._idx(0,e),t,t+l),this.data.fill(this.data[t],this._idx(-2,e),this._idx(0,e)),this.data.fill(this.data[t+l-1],this._idx(l,e),this._idx(l+1,e)+1)}let u=this._getByteView();this.min=2**53-1,this.max=-(2**53-1);for(let e=0;e<l;e++)for(let t=0;t<l;t++){let r=4*this._idx(e,t),i=this._unpackAtIndex(u,r);i>this.max&&(this.max=i),i<this.min&&(this.min=i)}}get(e,t){let r=this._getByteView(),i=4*this._idx(e,t);return this._unpackAtIndex(r,i)}sampleBilinear(e,t){let r=Math.floor(e),i=Math.floor(t);if(r<-1||r>=this.dim||i<-1||i>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${t}, dim: ${this.dim}`);let n=this._getByteView(),a=4*((i+2)*this.stride+r+2),o=4*this.stride,s=e-r,l=t-i;return this._unpackAtIndex(n,a)*(1-s)*(1-l)+this._unpackAtIndex(n,a+4)*s*(1-l)+this._unpackAtIndex(n,a+o)*(1-s)*l+this._unpackAtIndex(n,a+o+4)*s*l}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-2||e>=this.dim+2||t<-2||t>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${t}, dim: ${this.dim}`);return(t+2)*this.stride+(e+2)}unpack(e,t,r){return e*this.redFactor+t*this.greenFactor+r*this.blueFactor-this.baseShift}pack(e){return Jm(e,this.getUnpackVector())}getPixels(){return new Nm({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(e,t,r){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let i=t*this.dim,n=t*this.dim+this.dim,a=r*this.dim,o=r*this.dim+this.dim;switch(t){case-1:i=n-2;break;case 1:n=i+2}switch(r){case-1:a=o-2;break;case 1:o=a+2}let s=-t*this.dim,l=-r*this.dim;for(let t=a;t<o;t++)for(let r=i;r<n;r++)this.data[this._idx(r,t)]=e.data[this._idx(r+s,t+l)]}_getByteView(){let t=e.byteViewCache.get(this);return t?.buffer!==this.data.buffer&&(t=new Uint8Array(this.data.buffer),e.byteViewCache.set(this,t)),t}_unpackAtIndex(e,t){return this.unpack(e[t],e[t+1],e[t+2])}};function Jm(e,t){let r=t[0],i=t[1],n=t[2],a=t[3],o=Math.min(r,i,n),s=Math.round((e+a)/o);return{r:Math.floor(s*o/r)%256,g:Math.floor(s*o/i)%256,b:Math.floor(s*o/n)%256}}Fd("DEMData",Ym);var Qm=class extends ap{constructor(e,t){super(e,Hm,t)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof yh&&r._styleExpression.expression instanceof gu){this.colorRampExpression=r;let e=r._styleExpression.expression;t.elevationStops=e.labels,t.colorStops=[];for(let r of t.elevationStops)t.colorStops.push(e.evaluate({globals:{elevation:r}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[Hl.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let i={elevationStops:[],colorStops:[]},n=(t.elevationStops.length-1)/(e-1);for(let e=0;e<t.elevationStops.length-.5;e+=n)i.elevationStops.push(t.elevationStops[Math.round(e)]),i.colorStops.push(t.colorStops[Math.round(e)]);return _s(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(t),n=new Nm({width:i.colorStops.length,height:1}),a=new Nm({width:i.colorStops.length,height:1});for(let e=0;e<i.elevationStops.length;e++){let t=Jm(i.elevationStops[e],r);a.setPixel(0,e,new Hl(t.r/255,t.g/255,t.b/255,1)),n.setPixel(0,e,i.colorStops[e])}return this.colorRampTextures={elevationTexture:new Km(e,a,e.gl.RGBA),colorTexture:new Km(e,n,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}};const eg=pp([{name:"a_pos",components:2,type:"Int16"}],4),tg=eg.members;function rg(e,t,r){let i=r.patternDependencies,n=!1;for(let r of t){let t=r.paint.get(`${e}-pattern`);t.isConstant()||(n=!0);let a=t.constantOr(null);a&&(n=!0,i[a.to]=!0,i[a.from]=!0)}return n}function ig(e,t,r,i,n){let{zoom:a}=i,o=n.patternDependencies;for(let i of t){let t=i.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:a-1},r,{},n.availableImages),s=t.evaluate({zoom:a},r,{},n.availableImages),l=t.evaluate({zoom:a+1},r,{},n.availableImages);e=e?.name?e.name:e,s=s?.name?s.name:s,l=l?.name?l.name:l,o[e]=!0,o[s]=!0,o[l]=!0,r.patterns[i.id]={min:e,mid:s,max:l}}}return r}eg.size,eg.alignment;const ng=new Set;let ag=!1;function og(e,t,r,i,n){let a=null;if(n===function(e,t,r,i){let n=0;for(let a=t,o=r-i;a<r;a+=i)n+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return n}(e,t,r,i)>0)for(let n=t;n<r;n+=i)a=Ng(n/i|0,e[n],e[n+1],a);else for(let n=r-i;n>=t;n-=i)a=Ng(n/i|0,e[n],e[n+1],a);return a&&Lg(a,a.next)&&(Ug(a),a=a.next),a}function sg(e,t=e){let r,i=t===e,n=e;do{r=!1,n===n.next||0!==ng.size&&ng.has(n)||!Lg(n,n.next)&&0!==Rg(n.prev,n,n.next)?(i||n!==t)&&(n=n.next,r=!i):((i||n===t)&&(t=n.prev),ag=!0,Ug(n),n=n.prev,r=!0)}while(r||n!==t);return t}function lg(e,t,r,i,n){n&&function(e,t,r,i){let n=e,a=0;do{n.z=Cg(n.x,n.y,t,r,i),Tg[a++]=n,n=n.next}while(n!==e);!function(e){if(e<=32)for(let t=1;t<e;t++){let e=Tg[t],r=e.z,i=t-1;for(;i>=0&&Tg[i].z>r;)Tg[i+1]=Tg[i],i--;Tg[i+1]=e}else{Eg.length<e&&(Eg=new Uint32Array(e),Dg=new Uint32Array(e),Pg=Array(e));for(let t=0;t<e;t++)Eg[t]=Tg[t].z;Ig(e,Tg,Eg,Pg,Dg,0),Ig(e,Pg,Dg,Tg,Eg,8),Ig(e,Tg,Eg,Pg,Dg,16),Ig(e,Pg,Dg,Tg,Eg,24)}}(a);let o=null;for(let e=0;e<a;e++){let t=Tg[e];t.prevZ=o,o&&(o.nextZ=t),o=t}o.nextZ=null}(e,r,i,n);let a=e,o=!1;for(;e.prev!==e.next;){let s=e.prev,l=e.next;if(Rg(s,e,l)<0&&(n?cg(e,r,i,n):ug(e)))t.push(s.i,e.i,l.i),Ug(e),e=l,a=l;else if((e=l)===a){if(ag=!1,e=sg(e),ag){a=e;continue}if(!o){a=e=hg(e,t),o=!0;continue}dg(e,t,r,i,n);break}}}function ug(e){let t=e.prev,r=e,i=e.next,n=t.x,a=r.x,o=i.x,s=t.y,l=r.y,u=i.y,c=Math.min(n,a,o),h=Math.min(s,l,u),d=Math.max(n,a,o),p=Math.max(s,l,u),f=i.next;for(;f!==t;){if(f.x>=c&&f.x<=d&&f.y>=h&&f.y<=p&&(n!==f.x||s!==f.y)&&Mg(n,s,a,l,o,u,f.x,f.y)&&Rg(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function cg(e,t,r,i){let n=e.prev,a=e,o=e.next,s=n.x,l=a.x,u=o.x,c=n.y,h=a.y,d=o.y,p=Math.min(s,l,u),f=Math.min(c,h,d),m=Math.max(s,l,u),g=Math.max(c,h,d),y=Cg(p,f,t,r,i),_=Cg(m,g,t,r,i),v=e.prevZ;for(;v&&v.z>=y;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==o&&(s!==v.x||c!==v.y)&&Mg(s,c,l,h,u,d,v.x,v.y)&&Rg(v.prev,v,v.next)>=0)return!1;v=v.prevZ}let b=e.nextZ;for(;b&&b.z<=_;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==o&&(s!==b.x||c!==b.y)&&Mg(s,c,l,h,u,d,b.x,b.y)&&Rg(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function hg(e,t){let r=e,i=!1;do{let n=r.prev,a=r.next.next;zg(n,r,r.next,a,!1)&&Bg(n,a)&&Bg(a,n)&&(t.push(n.i,r.i,a.i),Ug(r),Ug(r.next),r=e=a,i=!0),r=r.next}while(r!==e);return i?sg(r):r}function dg(e,t,r,i,n){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&Fg(a,e)){let o=jg(a,e);return a=sg(a,a.next),o=sg(o,o.next),lg(a,t,r,i,n),void lg(o,t,r,i,n)}e=e.next}a=a.next}while(a!==e)}let pg=!1;function fg(e,t){return e.x-t.x||e.y-t.y||(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}function mg(e,t){let r=function(e,t){let r,i=t,n=e.x,a=e.y,o=-1/0;if(Lg(e,i))return i;for(let t=0,s=0;t<yg;t++,s+=4){if(a<gg[s+1]||a>gg[s+3]||gg[s]>n||gg[s+2]<=o)continue;let l=xg(t);i=wg(t);do{if(i.prev.next===i){if(Lg(e,i.next))return i.next;if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){let e=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=n&&e>o&&(o=e,r=i.x<i.next.x?i:i.next,e===n))return r}}i=i.next}while(i!==l)}if(!r)return null;let s=r.x,l=r.y,u=Math.min(a,l),c=Math.max(a,l),h=1/0;for(let t=0,d=0;t<yg;t++,d+=4){if(gg[d+2]<s||gg[d]>n||gg[d+3]<u||gg[d+1]>c)continue;let p=xg(t);i=wg(t);do{if(i.prev.next===i&&n>=i.x&&i.x>=s&&n!==i.x&&Mg(a<l?n:o,a,s,l,a<l?o:n,a,i.x,i.y)){let t=Math.abs(a-i.y)/(n-i.x);(Bg(i,e)||i.y===a&&i.next.y===a&&i.next.x>n)&&(t<h||t===h&&(i.x>r.x||i.x===r.x&&Sg(r,i)))&&(r=i,h=t)}i=i.next}while(i!==p)}return r}(e,t);if(!r)return t;let i=jg(r,e);return bg(r,i.next.next),sg(i,i.next),sg(r,r.next)}let gg=new Float64Array,yg=0;const _g=[],vg=[];function bg(e,t){let r=e;do{let e=yg++;_g[e]=r;let i=1/0,n=1/0,a=-1/0,o=-1/0,s=0;do{let t=r.next;r.z=e,r.x<i&&(i=r.x),r.x>a&&(a=r.x),r.y<n&&(n=r.y),r.y>o&&(o=r.y),t.x<i&&(i=t.x),t.x>a&&(a=t.x),t.y<n&&(n=t.y),t.y>o&&(o=t.y),r=t}while(++s<16&&r!==t);vg[e]=r;let l=4*e;gg[l]=i,gg[l+1]=n,gg[l+2]=a,gg[l+3]=o}while(r!==t)}function xg(e){let t=vg[e];for(;t.prev.next!==t;)t=t.next;return vg[e]=t,t}function wg(e){let t=_g[e];for(;t.prev.next!==t;)t=t.next;return _g[e]=t,t}function Sg(e,t){return Rg(e.prev,e,t.prev)<0&&Rg(t.next,e,e.next)<0}const Tg=[];let Pg=[],Eg=new Uint32Array,Dg=new Uint32Array;const Ag=new Uint32Array(256);function Ig(e,t,r,i,n,a){Ag.fill(0);for(let t=0;t<e;t++)Ag[r[t]>>>a&255]++;let o=0;for(let e=0;e<256;e++){let t=Ag[e];Ag[e]=o,o+=t}for(let o=0;o<e;o++){let e=r[o],s=Ag[e>>>a&255]++;i[s]=t[o],n[s]=e}}function Cg(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function kg(e){let t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function Mg(e,t,r,i,n,a,o,s){return(n-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(i-s)>=(r-o)*(t-s)&&(r-o)*(a-s)>=(n-o)*(i-s)}function Fg(e,t){let r=Lg(e,t)&&Rg(e.prev,e,e.next)>0&&Rg(t.prev,t,t.next)>0;return e.next.i!==t.i&&(r||Bg(e,t)&&Bg(t,e)&&(0!==Rg(e.prev,e,t.prev)||0!==Rg(e,t.prev,t)))&&!function(e,t){let r=Math.min(e.x,t.x),i=Math.max(e.x,t.x),n=Math.min(e.y,t.y),a=Math.max(e.y,t.y),o=e;do{let s=o.next;if(o.x>i&&s.x>i||o.x<r&&s.x<r||o.y>a&&s.y>a||o.y<n&&s.y<n)o=s;else{if(o.i!==e.i&&s.i!==e.i&&o.i!==t.i&&s.i!==t.i&&zg(o,s,e,t))return!0;o=s}}while(o!==e);return!1}(e,t)&&(r||function(e,t){let r=e,i=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do{let e=r.next;r.y>a!=e.y>a&&n<(e.x-r.x)*(a-r.y)/(e.y-r.y)+r.x&&(i=!i),r=e}while(r!==e);return i}(e,t))}function Rg(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Lg(e,t){return e.x===t.x&&e.y===t.y}function zg(e,t,r,i,n=!0){let a=Rg(e,t,r),o=Rg(e,t,i),s=Rg(r,i,e),l=Rg(r,i,t);return(a>0&&o<0||a<0&&o>0)&&(s>0&&l<0||s<0&&l>0)||!!n&&!!(0===a&&Og(e,r,t)||0===o&&Og(e,i,t)||0===s&&Og(r,e,i)||0===l&&Og(r,t,i))}function Og(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Bg(e,t){return Rg(e.prev,e,e.next)<0?Rg(e,t,e.next)>=0&&Rg(e,e.prev,t)>=0:Rg(e,t,e.prev)<0||Rg(e,e.next,t)<0}function jg(e,t){let r=Vg(e.i,e.x,e.y),i=Vg(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function Ng(e,t,r,i){let n=Vg(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Ug(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ),pg&&function(e,t){let r=4*e.z;t.x<gg[r]&&(gg[r]=t.x),t.y<gg[r+1]&&(gg[r+1]=t.y),t.x>gg[r+2]&&(gg[r+2]=t.x),t.y>gg[r+3]&&(gg[r+3]=t.y)}(e.prev,e.next)}function Vg(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}var $g=class{constructor(e,t){if(t>e)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){let t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}},Gg=class e{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}static{this.noSubdivision=new e({fill:new $g(0,0),line:new $g(0,0),tile:new $g(0,0),stencil:new $g(0,0),circle:1})}};Fd("SubdivisionGranularityExpression",$g),Fd("SubdivisionGranularitySetting",Gg);const qg=-32768,Zg=32767;var Wg=class{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Oo/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|t+32768}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let r=0|Math.round(e),i=0|Math.round(t),n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(r,i),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){let r=[];for(let i=0;i<t.length;i+=3){let n=t[i],a=t[i+1],o=t[i+2],s=e[2*n],l=e[2*n+1],u=e[2*a],c=e[2*a+1],h=e[2*o];(u-s)*(e[2*o+1]-l)-(c-l)*(h-s)>0?(r.push(n),r.push(o),r.push(a)):(r.push(n),r.push(a),r.push(o))}return r}(this._vertexBuffer,e);let t=[],r=e.length;for(let i=0;i<r;i+=3){let r=[e[i+0],e[i+1],e[i+2]],n=[this._vertexBuffer[2*e[i+0]+0],this._vertexBuffer[2*e[i+0]+1],this._vertexBuffer[2*e[i+1]+0],this._vertexBuffer[2*e[i+1]+1],this._vertexBuffer[2*e[i+2]+0],this._vertexBuffer[2*e[i+2]+1]],a=1/0,o=1/0,s=-1/0,l=-1/0;for(let e=0;e<3;e++){let t=n[2*e],r=n[2*e+1];a=Math.min(a,t),s=Math.max(s,t),o=Math.min(o,r),l=Math.max(l,r)}if(a===s||o===l)continue;let u=Math.floor(a/this._granularityCellSize),c=Math.ceil(s/this._granularityCellSize),h=Math.floor(o/this._granularityCellSize),d=Math.ceil(l/this._granularityCellSize);if(u!==c||h!==d)for(let e=h;e<d;e++){let i=this._scanlineGenerateVertexRingForCellRow(e,n,r);Kg(this._vertexBuffer,i,t)}else t.push(...r)}return t}_scanlineGenerateVertexRingForCellRow(e,t,r){let i=e*this._granularityCellSize,n=i+this._granularityCellSize,a=[];for(let e=0;e<3;e++){let o=t[2*e],s=t[2*e+1],l=t[2*(e+1)%6],u=t[(2*(e+1)+1)%6],c=t[2*(e+2)%6],h=t[(2*(e+2)+1)%6],d=l-o,p=u-s,f=0===d,m=0===p,g=(i-s)/p,y=(n-s)/p,_=Math.min(g,y),v=Math.max(g,y);if(!m&&(_>=1||v<=0)||m&&(s<i||s>n)){u>=i&&u<=n&&a.push(r[(e+1)%3]);continue}if(!m&&_>0){let e=o+d*_,t=s+p*_;a.push(this._vertexToIndex(e,t))}let b=o+d*Math.max(_,0),x=o+d*Math.min(v,1);if(f||this._generateIntraEdgeVertices(a,o,s,l,u,b,x),!m&&v<1){let e=o+d*v,t=s+p*v;a.push(this._vertexToIndex(e,t))}(m||u>=i&&u<=n)&&a.push(r[(e+1)%3]),!m&&(u<=i||u>=n)&&this._generateInterEdgeVertices(a,o,s,l,u,c,h,x,i,n)}return a}_generateIntraEdgeVertices(e,t,r,i,n,a,o){let s=i-t,l=n-r,u=0===l,c=u?Math.min(t,i):Math.min(a,o),h=u?Math.max(t,i):Math.max(a,o),d=Math.floor(c/this._granularityCellSize)+1,p=Math.ceil(h/this._granularityCellSize)-1;if(u?t<i:a<o)for(let i=d;i<=p;i++){let n=i*this._granularityCellSize,a=r+l*(n-t)/s;e.push(this._vertexToIndex(n,a))}else for(let i=p;i>=d;i--){let n=i*this._granularityCellSize,a=r+l*(n-t)/s;e.push(this._vertexToIndex(n,a))}}_generateInterEdgeVertices(e,t,r,i,n,a,o,s,l,u){let c=n-r,h=a-i,d=o-n,p=(l-n)/d,f=(u-n)/d,m=Math.min(p,f),g=Math.max(p,f),y=i+h*m,_=Math.floor(Math.min(y,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(y,s)/this._granularityCellSize)-1,b=s<y,x=0===d;if(x&&(o===l||o===u))return;if(x||m>=1||g<=0){let e=r-o,i=(l-o)/e,n=(u-o)/e,c=a+(t-a)*Math.min(i,n);_=Math.floor(Math.min(c,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(c,s)/this._granularityCellSize)-1,b=s<c}let w=c>0?u:l;if(b)for(let t=_;t<=v;t++){let r=t*this._granularityCellSize;e.push(this._vertexToIndex(r,w))}else for(let t=v;t>=_;t--){let r=t*this._granularityCellSize;e.push(this._vertexToIndex(r,w))}}_generateOutline(e){let t=[];for(let r of e){let e=Xg(r,this._granularity,!0),i=this._pointArrayToIndices(e),n=[];for(let e=1;e<i.length;e++)n.push(i[e-1]),n.push(i[e]);t.push(n)}return t}_handlePoles(e){let t=!1,r=!1;this._canonical&&(0===this._canonical.y&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(t||r)&&this._fillPoles(e,t,r)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let r=e[t+1];-32768===r&&(e[t+1]=-32767),32767===r&&(e[t+1]=32766)}}_generatePoleQuad(e,t,r,i,n,a){i>n==(-32768===a)?(e.push(r),e.push(t),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(n,a)),e.push(r),e.push(this._vertexToIndex(i,a))):(e.push(t),e.push(r),e.push(this._vertexToIndex(i,a)),e.push(r),e.push(this._vertexToIndex(n,a)),e.push(this._vertexToIndex(i,a)))}_fillPoles(e,t,r){let i=this._vertexBuffer,n=Oo,a=e.length;for(let o=2;o<a;o+=3){let a=e[o-2],s=e[o-1],l=e[o],u=i[2*a],c=i[2*a+1],h=i[2*s],d=i[2*s+1],p=i[2*l],f=i[2*l+1];t&&(0===c&&0===d&&this._generatePoleQuad(e,a,s,u,h,qg),0===d&&0===f&&this._generatePoleQuad(e,s,l,h,p,qg),0===f&&0===c&&this._generatePoleQuad(e,l,a,p,u,qg)),r&&(c===n&&d===n&&this._generatePoleQuad(e,a,s,u,h,Zg),d===n&&f===n&&this._generatePoleQuad(e,s,l,h,p,Zg),f===n&&c===n&&this._generatePoleQuad(e,l,a,p,u,Zg))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let r,{flattened:i,holeIndices:n}=function(e){let t=[],r=[];for(let i of e)if(0!==i.length){i!==e[0]&&t.push(r.length/2);for(let e of i)r.push(e.x),r.push(e.y)}return{flattened:r,holeIndices:t}}(e);this._initializeVertices(i);try{let e=function(e,t,r=2){let i=t&&t.length,n=i?t[0]*r:e.length;ng.size&&ng.clear();let a=og(e,0,n,r,!0),o=[];if(!a||a.next===a.prev)return o;let s=0,l=0,u=0;if(i&&(a=function(e,t,r,i){let n=[];for(let r=0,a=t.length;r<a;r++){let o=og(e,t[r]*i,r<a-1?t[r+1]*i:e.length,i,!1);o===o.next&&ng.add(o),n.push(kg(o))}n.sort(fg),function(e,t){let r=Math.ceil((e+2*t)/16)+t+2;gg.length<4*r&&(gg=new Float64Array(4*r)),yg=0}(e.length/i,t.length),bg(r,r),pg=!0;for(let e=0;e<n.length;e++)r=mg(n[e],r);return pg=!1,sg(r)}(e,t,a,r)),e.length>80*r){s=e[0],l=e[1];let t=s,i=l;for(let a=r;a<n;a+=r){let r=e[a],n=e[a+1];r<s&&(s=r),n<l&&(l=n),r>t&&(t=r),n>i&&(i=n)}u=Math.max(t-s,i-l),u=0===u?0:32767/u}return lg(a,o,s,l,u),o}(i,n),t=this._convertIndices(i,e);r=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(r),this._granularity>=2&&0===this._canonical?.z&&(r=this._removeTrianglesOutsideTileX(r),a=a.map(e=>this._removeLinesOutsideTileX(e))),{verticesFlattened:this._vertexBuffer,indicesTriangles:r,indicesLineList:a}}_vertexOutsideTileX(e){let t=this._vertexBuffer[2*e];return t<0||t>8192}_removeTrianglesOutsideTileX(e){let t=[];for(let r=0;r<e.length;r+=3)this._vertexOutsideTileX(e[r])||this._vertexOutsideTileX(e[r+1])||this._vertexOutsideTileX(e[r+2])||t.push(e[r],e[r+1],e[r+2]);return t}_removeLinesOutsideTileX(e){let t=[];for(let r=0;r<e.length;r+=2)this._vertexOutsideTileX(e[r])||this._vertexOutsideTileX(e[r+1])||t.push(e[r],e[r+1]);return t}_convertIndices(e,t){let r=[];for(let i of t){let t=e[2*i],n=e[2*i+1];r.push(this._vertexToIndex(t,n))}return r}_pointArrayToIndices(e){let t=[];for(let r of e)t.push(this._vertexToIndex(r.x,r.y));return t}};function Hg(e,t,r,i=!0){return new Wg(r,t).subdividePolygonInternal(e,i)}function Xg(e,t,r=!1){if(!e||e.length<1||e.length<2)return[];let i=e[0],n=e[e.length-1],a=r&&(i.x!==n.x||i.y!==n.y);if(t<2)return a?[...e,e[0]]:[...e];let o=Math.floor(Oo/t),s=[];s.push(new $a(e[0].x,e[0].y));let l=e.length,u=a?l:l-1;for(let t=0;t<u;t++){let r=e[t],i=t<l-1?e[t+1]:e[0],n=r.x,a=r.y,u=i.x,c=i.y,h=n!==u,d=a!==c;if(!h&&!d)continue;let p=u-n,f=c-a,m=Math.abs(p),g=Math.abs(f),y=n,_=a;for(;;){let e=p>0?(Math.floor(y/o)+1)*o:(Math.ceil(y/o)-1)*o,t=f>0?(Math.floor(_/o)+1)*o:(Math.ceil(_/o)-1)*o,r=Math.abs(y-e),i=Math.abs(_-t),n=Math.abs(y-u),a=Math.abs(_-c),l=h?r/m:1/0,v=d?i/g:1/0;if((n<=r||!h)&&(a<=i||!d))break;if(l<v&&h||!d){y=e,_+=f*l;let t=new $a(y,Math.round(_));(s[s.length-1].x!==t.x||s[s.length-1].y!==t.y)&&s.push(t)}else{y+=p*v,_=t;let e=new $a(Math.round(y),_);(s[s.length-1].x!==e.x||s[s.length-1].y!==e.y)&&s.push(e)}}let v=new $a(u,c);(s[s.length-1].x!==v.x||s[s.length-1].y!==v.y)&&s.push(v)}return s}function Kg(e,t,r){if(0===t.length)throw Error("Subdivision vertex ring is empty.");let i=0,n=e[2*t[0]];for(let r=1;r<t.length;r++){let a=e[2*t[r]];a<n&&(n=a,i=r)}let a=t.length,o=i,s=(o+1)%a;for(;;){let i=o-1>=0?o-1:a-1,n=(s+1)%a,l=e[2*t[i]],u=e[2*t[i]+1],c=e[2*t[n]],h=e[2*t[n]+1],d=e[2*t[o]],p=e[2*t[o]+1],f=e[2*t[s]],m=e[2*t[s]+1],g=!1;if(l<c)g=!0;else if(l>c)g=!1;else{let e=m-p,t=-(f-d),r=p<m?1:-1;((l-d)*e+(u-p)*t)*r>((c-d)*e+(h-p)*t)*r&&(g=!0)}if(g){let e=t[i],n=t[o],l=t[s];e!==n&&e!==l&&n!==l&&r.push(l,n,e),o--,o<0&&(o=a-1)}else{let e=t[n],i=t[o],l=t[s];e!==i&&e!==l&&i!==l&&r.push(l,i,e),s++,s>=a&&(s=0)}if(i===n)break}}function Yg(e,t,r,i,n,a,o,s,l){let u=n.length/2,c=o&&s&&l;if(u<bf.MAX_VERTEX_ARRAY_LENGTH){let h,d,p=t.prepareSegment(u,r,i),f=p.vertexLength;for(let e=0;e<a.length;e+=3)i.emplaceBack(f+a[e],f+a[e+1],f+a[e+2]);p.vertexLength+=u,p.primitiveLength+=a.length/3,c&&(d=o.prepareSegment(u,r,s),h=d.vertexLength,d.vertexLength+=u);for(let t=0;t<n.length;t+=2)e(n[t],n[t+1]);if(c)for(let e of l){for(let t=1;t<e.length;t+=2)s.emplaceBack(h+e[t-1],h+e[t]);d.primitiveLength+=e.length/2}}else(function(e,t,r,i,n,a){let o=[];for(let e=0;e<i.length/2;e++)o.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),c=u.vertexLength;for(let h=2;h<n.length;h+=3){let d=n[h-2],p=n[h-1],f=n[h],m=o[d]<l,g=o[p]<l,y=o[f]<l,_=+!!m+ +!!g+ +!!y;u.vertexLength+_>bf.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=s.count,m=!0,g=!0,y=!0,c=0);let v=Jg(o,i,a,s,d,m,u),b=Jg(o,i,a,s,p,g,u),x=Jg(o,i,a,s,f,y,u);r.emplaceBack(c+v-l,c+b-l,c+x-l),u.primitiveLength++}})(t,r,i,n,a,e),c&&function(e,t,r,i,n,a){let o=[];for(let e=0;e<i.length/2;e++)o.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),c=u.vertexLength;for(let h of n)for(let n=1;n<h.length;n+=2){let d=h[n-1],p=h[n],f=o[d]<l,m=o[p]<l,g=+!!f+ +!!m;u.vertexLength+g>bf.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=s.count,f=!0,m=!0,c=0);let y=Jg(o,i,a,s,d,f,u),_=Jg(o,i,a,s,p,m,u);r.emplaceBack(c+y-l,c+_-l),u.primitiveLength++}}(o,r,s,n,l,e),t.forceNewSegmentOnNextPrepare(),o?.forceNewSegmentOnNextPrepare()}function Jg(e,t,r,i,n,a,o){if(a){let a=i.count;return r(t[2*n],t[2*n+1]),e[n]=i.count,i.count++,o.vertexLength++,a}return e[n]}var Qg=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new tf,this.indexArray=new mf,this.indexArray2=new gf,this.programConfigurations=new Qf(e.layers,e.zoom),this.segments=new bf,this.segments2=new bf,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.hasDependencies=rg("fill",this.layers,t);let i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),a=[],o=new Nd(this.zoom),s=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:c,sourceLayerIndex:h}of e){let e=nm(l,s);if(!this.layers[0]._featureFilter.filter(o,e,r))continue;let d=n?i.evaluate(e,{},r,t.availableImages):void 0,p={id:u,properties:l.properties,type:l.type,sourceLayerIndex:h,index:c,geometry:s?e.geometry:im(l),patterns:{},sortKey:d};a.push(p)}n&&a.sort((e,t)=>e.sortKey-t.sortKey);for(let i of a){let{geometry:n,index:a,sourceLayerIndex:o}=i;if(this.hasDependencies){let e=ig("fill",this.layers,i,{zoom:this.zoom},t);this.patternFeatures.push(e)}else this.addFeature(i,n,a,r,{},t.subdivisionGranularity);let s=e[a].feature;t.featureIndex.insert(s,n,a,o,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}addFeatures({options:e,canonical:t,patternPositions:r,patternMap:i}){this.detectSdfPatterns(i);for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,r,e.subdivisionGranularity)}detectSdfPatterns(e){for(let t of this.patternFeatures)for(let r in t.patterns){let i=t.patterns[r];this.recordSdfPattern(r,e[i.min]),this.recordSdfPattern(r,e[i.mid]),this.recordSdfPattern(r,e[i.max])}for(let t of this.layers){let r=t.paint.get("fill-pattern").constantOr(null);r&&(this.recordSdfPattern(t.id,e[r.from.toString()]),this.recordSdfPattern(t.id,e[r.to.toString()]))}}recordSdfPattern(e,t){if(!t)return;let r=!0===t.sdf,i=this.sdfPatterns[e];void 0===i?this.sdfPatterns[e]=r:i!==r&&_s(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer "${e}"`)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,tg),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,t,r,i,n,a){for(let e of Su(t,500)){let t=Hg(e,i,a.fill.getGranularityForZoomLevel(i.z)),r=this.layoutVertexArray;Yg((e,t)=>{r.emplaceBack(e,t)},this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,canonical:i})}};let ey,ty;Fd("FillBucket",Qg,{omit:["layers","patternFeatures"]});var ry={get paint(){return ty||=new rp({"fill-antialias":new Yd(el.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new Jd(el.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new Yd(el.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new Jd(el.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new Jd(el.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new Yd(el.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new Yd(el.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new Qd(el.paint_fill["fill-pattern"],"fill-pattern")})},get layout(){return ey||=new rp({"fill-sort-key":new Jd(el.layout_fill["fill-sort-key"],"fill-sort-key")})}},iy=class extends ap{constructor(e,t){super(e,ry,t)}recalculate(e,t){super.recalculate(e,t);let r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Qg(e)}queryRadius(){return bm(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:r,pixelsToTileUnits:i}){return cm(xm(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),t)}isTileClipped(){return!0}};const ny=pp([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ay=pp([{name:"a_centroid",components:2,type:"Int16"}],4),oy=ny.members;ny.size,ny.alignment;var sy=class e{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(t){let r=new e;return r.extend(t(new $a(this.minX,this.minY))),r.extend(t(new $a(this.maxX,this.minY))),r.extend(t(new $a(this.minX,this.maxY))),r.extend(t(new $a(this.maxX,this.maxY))),r}static fromPoints(t){let r=new e;for(let e of t)r.extend(e);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}};const ly=sy.fromPoints([new $a(0,0),new $a(Oo,Oo)]);function uy(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function cy(e){return e.every(e=>e.x<0)||e.every(e=>e.x>8192)||e.every(e=>e.y<0)||e.every(e=>e.y>8192)}var hy=class{constructor(e,t,r,i,n){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=n;e.pos<t;){let t=e.readVarint();if(8===t)this.id=e.readVarint();else if(18===t){let t=e.readVarint()+e.pos;for(;e.pos<t;){let t=i[e.readVarint()],r=n[e.readVarint()];this.properties[t]=r}}else 24===t?this.type=e.readVarint():(34===t&&(this._geometry=e.pos),e.skip(t))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");let e=this._pbf;e.pos=this._geometry;let t,r=e.readVarint()+e.pos,i=[],n=1,a=0,o=0,s=0;for(;e.pos<r;){if(a<=0){let t=e.readVarint();if(n=7&t,a=t>>3,0===a)continue}if(a--,1===n)o+=e.readSVarint(),s+=e.readSVarint(),t&&i.push(t),t=[new $a(o,s)];else if(2===n)o+=e.readSVarint(),s+=e.readSVarint(),t&&t.push(new $a(o,s));else{if(7!==n)throw Error(`unknown command ${n}`);t&&t.push(t[0].clone())}}return t&&i.push(t),i}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,r=1,i=0,n=0,a=0,o=1/0,s=-1/0,l=1/0,u=-1/0;for(;e.pos<t;){if(i<=0){let t=e.readVarint();if(r=7&t,i=t>>3,0===i)continue}if(i--,1===r||2===r)n+=e.readSVarint(),a+=e.readSVarint(),n<o&&(o=n),n>s&&(s=n),a<l&&(l=a),a>u&&(u=a);else if(7!==r)throw Error(`unknown command ${r}`)}return[o,l,s,u]}toGeoJSON(e,t,r){let i,n=this.extent*2**r,a=this.extent*e,o=this.extent*t,s=this.loadGeometry();function l(e){return[360*(e.x+a)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+o)/n)*Math.PI))-90]}function u(e){return e.map(l)}if(1===this.type){let e=[];for(let t of s)e.push(t[0]);let t=u(e);i=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){let e=s.map(u);i=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw Error("unknown feature type");{let e=dy(s),t=[];for(let r of e)t.push(r.map(u));i=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}let c={type:"Feature",geometry:i,properties:this.properties};return null!=this.id&&(c.id=this.id),c}};function dy(e){let t=e.length;if(t<=1)return[e];let r,i,n=[];for(let a=0;a<t;a++){let t=py(e[a]);0!==t&&(void 0===i&&(i=t<0),i===t<0?(r&&n.push(r),r=[e[a]]):r&&r.push(e[a]))}return r&&n.push(r),n}function py(e){let t=0;for(let r,i,n=0,a=e.length,o=a-1;n<a;o=n++)r=e[n],i=e[o],t+=(i.x-r.x)*(r.y+i.y);return t}hy.types=["Unknown","Point","LineString","Polygon"];var fy=class{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],void 0===t&&(t=e.length);e.pos<t;){let t=e.readVarint();10===t?this.name=e.readString():18===t?(this._features.push(e.pos),e.skip(t)):26===t?this._keys.push(e.readString()):34===t?this._values.push(my(e)):40===t?this.extent=e.readVarint():120===t?this.version=e.readVarint():e.skip(t)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new hy(this._pbf,t,this.extent,this._keys,this._values)}};function my(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let r=e.readVarint();t=10===r?e.readString():21===r?e.readFloat():25===r?e.readDouble():32===r?e.readVarint(!0):40===r?e.readVarint():48===r?e.readSVarint():56===r?e.readBoolean():(e.skip(r),null)}if(null==t)throw Error("unknown feature value");return t}var gy=class{constructor(e,t=e.length){let r=Object.create(null);for(;e.pos<t;){let t=e.readVarint();if(26===t){let t=new fy(e,e.readVarint()+e.pos);t.length&&(r[t.name]=t)}else e.skip(t)}this.layers=r}};const yy=6371008.8;var _y=class e{constructor(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new e(as(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,r=this.lat*t,i=e.lat*t,n=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((e.lng-this.lng)*t);return yy*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof e)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new e(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&t)return new e(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};const vy=2*Math.PI*yy;function by(e){return vy*Math.cos(e*Math.PI/180)}function xy(e){return(180+e)/360}function wy(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Sy(e,t){return e/by(t)}function Ty(e){return 360*e-180}function Py(e){let t=180-360*e;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function Ey(e,t){return e*by(Py(t))}var Dy=class e{constructor(e,t,r=0){this.x=+e,this.y=+t,this.z=+r}static fromLngLat(t,r=0){let i=_y.convert(t);return new e(xy(i.lng),wy(i.lat),Sy(r,i.lat))}toLngLat(){return new _y(Ty(this.x),Py(this.y))}toAltitude(){return Ey(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/vy*function(e){return 1/Math.cos(e*Math.PI/180)}(Py(this.y))}};function Ay(e,t,r){let i=1/(1<<r.z);return new Dy(e/Oo*i+r.x*i,t/Oo*i+r.y*i)}function Iy(e,t){let r=ns(t.lat,-85.051129,Is);return new $a(xy(t.lng)*e,wy(r)*e)}function Cy(e,t){return new Dy(t.x/e,t.y/e).toLngLat()}function ky(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(Ts(90-e.pitch)),Math.tan(Ts(89.25-e.pitch)))}function My(e,t){let r=e.canonical,i=t/cs(r.z),n=r.x+2**r.z*e.wrap,a=new Float64Array(16);return Ja(a),to(a,a,[n*i,r.y*i,0]),ro(a,a,[i/Oo,i/Oo,1]),a}function Fy(e,t,r,i,n){let a=Dy.fromLngLat(e,t),o=n*Sy(1,e.lat),{x:s,y:l,z:u}=Ry(r,i),c=o*-s,h=o*-l,d=o*u;return new Dy(a.x+c,a.y+h,a.z+d)}function Ry(e,t){let r=Ts(e),i=Ts(t),n=Math.cos(-r),a=Math.sin(r);return{x:a*Math.sin(i),y:-a*Math.cos(i),z:n}}function Ly(e,t,r){if(t<=0||!e||0===e.length)return e;let i=function(e,t){let r=function(e,t,r){return Ay(4096,4096,r).toLngLat()}(0,0,t);return e*Dy.fromLngLat(r).meterInMercatorCoordinateUnits()*((1<<t.z)*Oo)}(t,r);return e.map(e=>function(e,t){if(!e||e.length<3)return e;let r=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,i=r?e.length-1:e.length;if(i<3)return e;let n=[];for(let r=0;r<i;r++){let a=e[(r-1+i)%i],o=e[r],s=e[(r+1)%i];uy(a,o)||uy(o,s)?n.push(o.clone()):zy(n,a,o,s,t)}let a=function(e){let t=[];for(let r of e){let e=r.round(),i=t[t.length-1];(i?.x!==e.x||i?.y!==e.y)&&t.push(e)}for(;t.length>1&&t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y;)t.pop();return t}(n);return a.length<3?e:(r&&a.push(a[0].clone()),a)}(e,i))}function zy(e,t,r,i,n){let a=t.sub(r),o=i.sub(r),s=a.mag(),l=o.mag();if(s<1e-6||l<1e-6)return void e.push(r.clone());a._div(s),o._div(l);let u=a.x*o.x+a.y*o.y;if(Math.abs(u)>Math.cos(5*Math.PI/180))return void e.push(r.clone());let c=Math.min(n,.2*s,.2*l),h=r.add(a.mult(c)),d=r.add(o.mult(c)),p=Math.sqrt((1+u)/2),f=r.add(a.add(o)._unit()._mult(c/p)),m=h.sub(f).angleWith(d.sub(f)),g=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let t=0;t<=g;t++)e.push(h.rotateAround(t/g*m,f))}const Oy=8192;function By(e,t,r,i,n,a,o,s){e.emplaceBack(t,r,2*Math.floor(i*Oy)+o,n*Oy*2,a*Oy*2,Math.round(s))}var jy=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new rf,this.centroidVertexArray=new Yp,this.indexArray=new mf,this.programConfigurations=new Qf(e.layers,e.zoom),this.segments=new bf,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.features=[],this.hasDependencies=rg("fill-extrusion",this.layers,t);let i=new Nd(this.zoom),n=this.layers[0],a=n.layout.get("fill-extrusion-rounded-corner-distance"),o=n._featureFilter.needGeometry;for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let e=nm(s,o);if(!n._featureFilter.filter(i,e,r))continue;let h=o?e.geometry:im(s),d={id:l,sourceLayerIndex:c,index:u,geometry:a>0?Ly(h,a,r):h,properties:s.properties,type:s.type,patterns:{}};this.hasDependencies?this.features.push(ig("fill-extrusion",this.layers,d,{zoom:this.zoom},t)):this.addFeature(d,d.geometry,u,r,{},t.subdivisionGranularity),t.featureIndex.insert(s,d.geometry,u,c,this.index,!0)}}addFeatures({options:e,canonical:t,patternPositions:r}){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,t,r,e.subdivisionGranularity)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,oy),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ay.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,t,r,i,n,a){let o=this.layers[0],s=o.layout?o.layout.get("fill-extrusion-rounded-corner-distance"):0,l=s>0?Ly(t,s,i):t;for(let t of Su(l,500)){let r={x:0,y:0,sampleCount:0},n=this.layoutVertexArray.length;this.processPolygon(r,i,e,t,a);let o=this.layoutVertexArray.length-n,s=Math.floor(r.x/r.sampleCount),l=Math.floor(r.y/r.sampleCount);for(let e=0;e<o;e++)this.centroidVertexArray.emplaceBack(s,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,canonical:i})}processPolygon(e,t,r,i,n){if(i.length<1||cy(i[0]))return;for(let t of i)0!==t.length&&Ny(e,t);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=n.fill.getGranularityForZoomLevel(t.z),s="Polygon"===hy.types[r.type];for(let e of i){if(0===e.length||cy(e))continue;let t=Xg(e,o,s);this._generateSideFaces(t,a)}if(!s)return;let l=Hg(i,t,o,!1),u=this.layoutVertexArray;Yg((e,t)=>{By(u,e,t,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let r=0;for(let i=1;i<e.length;i++){let n=e[i],a=e[i-1];if(uy(n,a))continue;t.segment.vertexLength+4>bf.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let o=n.sub(a)._perp()._unit(),s=a.dist(n);r+s>32768&&(r=0),By(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,0,r),By(this.layoutVertexArray,n.x,n.y,o.x,o.y,0,1,r),r+=s,By(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,0,r),By(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,1,r);let l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}};function Ny(e,t){for(let r=0;r<t.length;r++){let i=t[r];(r!==t.length-1||t[0].x!==i.x||t[0].y!==i.y)&&(e.x+=i.x,e.y+=i.y,e.sampleCount++)}}let Uy,Vy;Fd("FillExtrusionBucket",jy,{omit:["layers","features"]});var $y={get paint(){return Vy||=new rp({"fill-extrusion-opacity":new Yd(el["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new Jd(el["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new Yd(el["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new Yd(el["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new Qd(el["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new Jd(el["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new Jd(el["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new Yd(el["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")})},get layout(){return Uy||=new rp({"fill-extrusion-rounded-corner-distance":new Yd(el["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")})}},Gy=class extends ap{constructor(e,t){super(e,$y,t)}createBucket(e){return new jy(e)}queryRadius(){return bm(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,pixelPosMatrix:o}){let s=xm(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(t,r),u=this.paint.get("fill-extrusion-base").evaluate(t,r),c=function(e,t){let r=[];for(let i of e){let e=[i.x,i.y,0,1];Eo(e,e,t),r.push(new $a(e[0]/e[3],e[1]/e[3]))}return r}(s,o),h=function(e,t,r,i){let n=[],a=[],o=i[8]*t,s=i[9]*t,l=i[10]*t,u=i[11]*t,c=i[8]*r,h=i[9]*r,d=i[10]*r,p=i[11]*r;for(let t of e){let e=[],r=[];for(let n of t){let t=n.x,a=n.y,f=i[0]*t+i[4]*a+i[12],m=i[1]*t+i[5]*a+i[13],g=i[2]*t+i[6]*a+i[14],y=i[3]*t+i[7]*a+i[15],_=g+l,v=y+u,b=f+c,x=m+h,w=g+d,S=y+p,T=new $a((f+o)/v,(m+s)/v);T.z=_/v,e.push(T);let P=new $a(b/S,x/S);P.z=w/S,r.push(P)}n.push(e),a.push(r)}return[n,a]}(i,u,l,o);return function(e,t,r){let i=1/0;cm(r,t)&&(i=Zy(r,t[0]));for(let n=0;n<t.length;n++){let a=t[n],o=e[n];for(let e=0;e<a.length-1;e++){let t=a[e],n=a[e+1],s=o[e],l=[t,n,o[e+1],s,t];lm(r,l)&&(i=Math.min(i,Zy(r,l)))}}return i!==1/0&&i}(h[0],h[1],c)}};function qy(e,t){return e.x*t.x+e.y*t.y}function Zy(e,t){if(1===e.length){let r,i=0,n=t[i++];for(;!r||n.equals(r);)if(r=t[i++],!r)return 1/0;for(;i<t.length;i++){let a=t[i],o=e[0],s=r.sub(n),l=a.sub(n),u=o.sub(n),c=qy(s,s),h=qy(s,l),d=qy(l,l),p=qy(u,s),f=qy(u,l),m=c*d-h*h,g=(d*p-h*f)/m,y=(c*f-h*p)/m,_=1-g-y,v=n.z*_+r.z*g+a.z*y;if(isFinite(v))return v}return 1/0}{let e=1/0;for(let r of t)e=Math.min(e,r.z);return e}}new Uint32Array(96);const Wy=pp([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),Hy=Wy.members;Wy.size,Wy.alignment;const Xy=pp([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),Ky=Xy.members;Xy.size,Xy.alignment;const Yy=Math.cos(Math.PI/180*37.5);var Jy=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new nf,this.layoutVertexArray2=new af,this.indexArray=new mf,this.programConfigurations=new Qf(e.layers,e.zoom),this.segments=new bf,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.hasDependencies=rg("line",this.layers,t)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),a=[],o=new Nd(this.zoom),s=this.layers[0]._featureFilter.needGeometry;for(let{feature:t,id:l,index:u,sourceLayerIndex:c}of e){let e=nm(t,s);if(!this.layers[0]._featureFilter.filter(o,e,r))continue;let h=n?i.evaluate(e,{},r):void 0,d={id:l,properties:t.properties,type:t.type,sourceLayerIndex:c,index:u,geometry:s?e.geometry:im(t),patterns:{},dashes:{},sortKey:h};a.push(d)}n&&a.sort((e,t)=>e.sortKey-t.sortKey);for(let i of a){let{geometry:n,index:a,sourceLayerIndex:o}=i;this.hasDependencies?(rg("line",this.layers,t)?ig("line",this.layers,i,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,i,this.zoom,t),this.patternFeatures.push(i)):this.addFeature(i,n,a,r,{},{},t.subdivisionGranularity);let s=e[a].feature;t.featureIndex.insert(s,n,a,o,this.index)}}update(e,t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures({options:e,canonical:t,patternPositions:r,dashPositions:i}){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,r,i,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Ky)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Hy),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.hasOwn(e.properties,"geojsonvt_clip_start")&&Object.hasOwn(e.properties,"geojsonvt_clip_end"))return{start:+e.properties.geojsonvt_clip_start,end:+e.properties.geojsonvt_clip_end}}addFeature(e,t,r,i,n,a,o){let s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),u=s.get("line-cap").evaluate(e,{}),c=s.get("line-miter-limit").evaluate(e,{}),h=s.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let r of t)this.addLine(r,e,l,u,c,h,i,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:n,dashPositions:a,canonical:i})}addLine(e,t,r,i,n,a,o,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Xg(e,o?s.line.getGranularityForZoomLevel(o.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let l="Polygon"===hy.types[t.type],u=e.length;for(;u>=2&&e[u-1].equals(e[u-2]);)u--;let c=0;for(;c<u-1&&e[c].equals(e[c+1]);)c++;if(u-c<(l?3:2))return;"bevel"===r&&(n=1.05);let h,d,p,f,m,g=this.overscaling<=16?122880/(512*this.overscaling):0,y=this.segments.prepareSegment(10*u,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,l&&(h=e[u-2],m=e[c].sub(h)._unit()._perp());for(let t=c;t<u;t++){if(p=t===u-1?l?e[c+1]:void 0:e[t+1],p&&e[t].equals(p))continue;m&&(f=m),h&&(d=h),h=e[t],m=p?p.sub(h)._unit()._perp():f,f||=m;let o=f.add(m);(0!==o.x||0!==o.y)&&o._unit();let s=f.x*m.x+f.y*m.y,_=o.x*m.x+o.y*m.y,v=0===_?1/0:1/_,b=2*Math.sqrt(2-2*_),x=_<Yy&&d&&p,w=f.x*m.y-f.y*m.x>0;if(x&&t>c){let e=h.dist(d);if(e>2*g){let t=h.sub(h.sub(d)._mult(g/e)._round());this.updateDistance(d,t),this.addCurrentVertex(t,f,0,0,y),d=t}}let S=d&&p,T=S?r:l?"butt":i;if(S&&"round"===T&&(v<a?T="miter":v<=2&&(T="fakeround")),"miter"===T&&v>n&&(T="bevel"),"bevel"===T&&(v>2&&(T="flipbevel"),v<n&&(T="miter")),d&&this.updateDistance(d,h),"miter"===T)o._mult(v),this.addCurrentVertex(h,o,0,0,y);else if("flipbevel"===T){if(v>100)o=m.mult(-1);else{let e=v*f.add(m).mag()/f.sub(m).mag();o._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(h,o,0,0,y),this.addCurrentVertex(h,o.mult(-1),0,0,y)}else if("bevel"===T||"fakeround"===T){let e=-Math.sqrt(v*v-1),t=w?e:0,r=w?0:e;if(d&&this.addCurrentVertex(h,f,t,r,y),"fakeround"===T){let e=Math.round(180*b/Math.PI/20);for(let t=1;t<e;t++){let r=t/e;if(.5!==r){let e=r-.5;r+=r*e*(r-1)*((1.0904+s*(s*(3.55645-1.43519*s)-3.2452))*e*e+(.848013+s*(.215638*s-1.06021)))}let i=m.sub(f)._mult(r)._add(f)._unit()._mult(w?-1:1);this.addHalfVertex(h,i.x,i.y,!1,w,0,y)}}p&&this.addCurrentVertex(h,m,-t,-r,y)}else if("butt"===T)this.addCurrentVertex(h,o,0,0,y);else if("square"===T){let e=d?1:-1;this.addCurrentVertex(h,o,e,e,y)}else"round"===T&&(d&&(this.addCurrentVertex(h,f,0,0,y),this.addCurrentVertex(h,f,1,1,y,!0)),p&&(this.addCurrentVertex(h,m,-1,-1,y,!0),this.addCurrentVertex(h,m,0,0,y)));if(x&&t<u-1){let e=h.dist(p);if(e>2*g){let t=h.add(p.sub(h)._mult(g/e)._round());this.updateDistance(h,t),this.addCurrentVertex(t,m,0,0,y),h=t}}}}addCurrentVertex(e,t,r,i,n,a=!1){let o=t.x+t.y*r,s=t.y-t.x*r,l=-t.x+t.y*i,u=-t.y-t.x*i;this.addHalfVertex(e,o,s,a,!1,r,n),this.addHalfVertex(e,l,u,a,!0,-i,n),this.distance>16384&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,r,i,n,a))}addHalfVertex({x:e,y:t},r,i,n,a,o,s){let l=.5*(this.lineClips?32767*this.scaledDistance:this.scaledDistance);if(this.layoutVertexArray.emplaceBack(+!!n+(e<<1),+!!a+(t<<1),Math.round(63*r)+128,Math.round(63*i)+128,1+(0===o?0:o<0?-1:1)|(63&l)<<2,l>>6),this.lineClips){let e=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(e,this.lineClipsArray.length)}let u=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),s.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}hasLineDasharray(e){for(let t of e){let e=t.paint.get("line-dasharray");if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,r,i){for(let n of e){let e=n.paint.get("line-dasharray");if(!e||"constant"===e.value.kind)continue;let a="round"===n.layout.get("line-cap").evaluate(t,{}),o={dasharray:e.value.evaluate({zoom:r-1},t,{}),round:a},s={dasharray:e.value.evaluate({zoom:r},t,{}),round:a},l={dasharray:e.value.evaluate({zoom:r+1},t,{}),round:a},u=`${o.dasharray.join(",")},${o.round}`,c=`${s.dasharray.join(",")},${s.round}`,h=`${l.dasharray.join(",")},${l.round}`;i.dashDependencies[u]=o,i.dashDependencies[c]=s,i.dashDependencies[h]=l,t.dashes[n.id]={min:u,mid:c,max:h}}}};let Qy,e_;Fd("LineBucket",Jy,{omit:["layers","patternFeatures"]});var t_={get paint(){return e_||=new rp({"line-opacity":new Jd(el.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new Yd(el.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new Jd(el.paint_line["line-color"],"line-color"),"line-translate":new Yd(el.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new Yd(el.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new Jd(el.paint_line["line-width"],"line-width"),"line-gap-width":new Jd(el.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new Jd(el.paint_line["line-offset"],"line-offset"),"line-blur":new Jd(el.paint_line["line-blur"],"line-blur"),"line-dasharray":new Qd(el.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new Qd(el.paint_line["line-pattern"],"line-pattern"),"line-gradient":new tp(el.paint_line["line-gradient"],"line-gradient")})},get layout(){return Qy||=new rp({"line-cap":new Jd(el.layout_line["line-cap"],"line-cap"),"line-join":new Jd(el.layout_line["line-join"],"line-join"),"line-miter-limit":new Jd(el.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new Jd(el.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new Jd(el.layout_line["line-sort-key"],"line-sort-key")})}},r_=class extends Jd{possiblyEvaluate(e,t){return t=new Nd(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,i){return t=os({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,i)}};let i_;var n_=class extends ap{constructor(e,t){super(e,t_,t),this.gradientVersion=0,i_||(i_=new r_(t_.paint.properties["line-width"].specification,"line-floorwidth"),i_.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this.gradientExpression();this.stepInterpolant=!!function(e){return void 0!==e._styleExpression}(e)&&e._styleExpression.expression instanceof mu,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=i_.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Jy(e)}queryRadius(e){let t=e,r=a_(vm("line-width",this,t),vm("line-gap-width",this,t)),i=vm("line-offset",this,t);return r/2+Math.abs(i)+bm(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a}){let o=xm(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),s=a/2*a_(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),l=this.paint.get("line-offset").evaluate(t,r);return l&&(i=function(e,t){let r=[];for(let i of e){let e=wm(i),n=[];for(let r=0;r<e.length;r++){let i=e[r],a=e[r-1],o=e[r+1],s=0===r?new $a(0,0):i.sub(a)._unit()._perp(),l=r===e.length-1?new $a(0,0):o.sub(i)._unit()._perp(),u=s._add(l)._unit(),c=u.x*l.x+u.y*l.y;0!==c&&u._mult(1/c),n.push(u._mult(t)._add(i))}r.push(n)}return r}(i,l*a)),function(e,t,r){for(let i of t){if(e.length>=3)for(let t of i)if(ym(e,t))return!0;if(hm(e,i,r))return!0}return!1}(o,i,s)}isTileClipped(){return!0}};function a_(e,t){return t>0?t+2*e:e}const o_=pp([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),s_=pp([{name:"a_projected_pos",components:3,type:"Float32"}],4);pp([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const l_=pp([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);pp([{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 u_=pp([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),c_=pp([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);pp([{name:"triangle",components:3,type:"Uint16"}]),pp([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Float32",name:"heightOffset"}]),pp([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),pp([{type:"Float32",name:"offsetX"}]),pp([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),pp([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const h_=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(h_.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;let r=e.pluginURL,i=new Promise(e=>{this.loadScriptResolve=e}),n=new Promise(e=>setTimeout(()=>e(),this.TIMEOUT));if(await t(r),await Promise.race([i,n]),this.isParsed()){let e={pluginStatus:"loaded",pluginURL:r};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)}};function d_(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function p_(e){return/[\u02EA\u02EB\u1100-\u11FF\u1401-\u167F\u18B0-\u18FF\u2065\u20DD-\u20E0\u20E2-\u20E4\u2B97\u2BF0-\u2BFF\u2E50\u2E51\u2E80-\u3007\u3012\u3013\u3020-\u302F\u3031-\u30FB\u30FD-\uA4CF\uA960-\uA97F\uAC00-\uD7FF\uF900-\uFAFF\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7\uFFF0-\uFFF8]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|[\uD80C-\uD810\uD81C-\uD822\uD83C\uD83D\uD840-\uD87E\uD880-\uD8BE][\uDC00-\uDFFF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFFF]|\uD823[\uDC00-\uDDFF]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFF]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83E[\uDD00-\uDEFF]|[\uD87F\uD8BF][\uDC00-\uDFFD]/gim.test(String.fromCodePoint(e))}function f_(e){return/[\u0E01-\u0E3A\u0E40-\u0E4E\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0EDC-\u0EDF\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA\u1000-\u103F\u1050-\u108F\u109A-\u109F\u1780-\u17D3\u17D7\u17DC\u17DD\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19DE\u19DF\u1A20-\u1A5E\u1A60-\u1A7C\u1AA0-\u1AAD\u1B00-\u1B4C\u1B4E-\u1B7F\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE-\uA9EF\uA9FA-\uA9FE\uAA60-\uAAC2\uAADB-\uAADF]|\uD805[\uDF00-\uDF1A\uDF1D-\uDF2B\uDF3A\uDF3B\uDF3F-\uDF46]/gim.test(String.fromCodePoint(e))}function m_(e,t){return/(?:[\u1039\u17D2\u1A60\u1BAB\u200D\uAAF6]|\uD802\uDE3F|\uD804[\uDD33\uDFD0]|\uD806[\uDD3E\uDE47\uDE99]|\uD807[\uDD45\uDD97\uDF42])$/.test(e)||/^\p{gc=Mc}/u.test(t)}const g_={C:"18g,1;g2,3;4nb,1",D:"17k,1;5,1;1,1;1,5;4,d;1,7;1,2;z,2;8,g;i,12;1,2;9,1;1,1;1,2;14,3;2,1;28,9;3,f;2,4;1,1;2,3;2,6;7a,1;2,5;1,1;g,a;5,2;2,6;1,f",R:"17m,4;1,1;1,1;5,4;l,1;14,3;1,3;g,i;12,1;2,9;1,1;1,1;2,2;1,1;o,2;2x,3;f,2;4,1;1,2;3,2;6u,j;b,1;r,3;1,1;2,2;6,1",T:"174,b;1,1;1a,l;g,1;2t,7;2,6;2,2;1,4;bt,9;16,o;1,t;1clb,1"},y_={1569:[65152,0,0,0],1570:[65153,65154,0,0],1571:[65155,65156,0,0],1572:[65157,65158,0,0],1573:[65159,65160,0,0],1574:[65161,65162,65163,65164],1575:[65165,65166,0,0],1576:[65167,65168,65169,65170],1577:[65171,65172,0,0],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194,0,0],1584:[65195,65196,0,0],1585:[65197,65198,0,0],1586:[65199,65200,0,0],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262,0,0],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1611:[65136,0,0,65137],1612:[65138,0,0,0],1613:[65140,0,0,0],1614:[65142,0,0,65143],1615:[65144,0,0,65145],1616:[65146,0,0,65147],1617:[65148,0,0,65149],1618:[65150,0,0,65151],1649:[64336,64337,0,0],1655:[64477,0,0,0],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393,0,0],1676:[64388,64389,0,0],1677:[64386,64387,0,0],1678:[64390,64391,0,0],1681:[64396,64397,0,0],1688:[64394,64395,0,0],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415,0,0],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421,0,0],1729:[64422,64423,64424,64425],1733:[64480,64481,0,0],1734:[64473,64474,0,0],1735:[64471,64472,0,0],1736:[64475,64476,0,0],1737:[64482,64483,0,0],1739:[64478,64479,0,0],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431,0,0],1747:[64432,64433,0,0]},__={لآ:[65269,65270],لأ:[65271,65272],لإ:[65273,65274],لا:[65275,65276]},v_=/[\u0600-\u06ff\u0750-\u077f\u0870-\u089f\u08a0-\u08ff\ufb50-\ufdff\ufe70-\ufeff]/;function b_(e,t,r){let i=0;for(let n of e.split(";")){let[e,a]=n.split(",").map(e=>parseInt(e,36)),o=i+e;for(let e=o;e<o+a;e++)r.set(e,t);i=o+a}}const x_=new Map;for(let[e,t]of Object.entries(g_))b_(t,e,x_);function w_(e){return x_.get(e)??"U"}function S_(e){return"D"===e||"L"===e||"C"===e}function T_(e){return"D"===e||"R"===e||"C"===e}function P_(e,t,r){return"D"===e?t&&r?3:t?1:r?2:0:"R"===e?+!!t:"L"===e?r?2:0:null}function E_(e){if(!v_.test(e))return e;let t=function(e){return[...e].map(e=>{let t=e.codePointAt(0);return{codePoint:t,type:w_(t),form:null}})}(e);return function(e){let t=e.filter(e=>"T"!==e.type);for(let e=0;e<t.length;e++){let r=t[e],i=e>0&&S_(t[e-1].type),n=e+1<t.length&&T_(t[e+1].type);r.form=P_(r.type,i,n)}}(t),function(e){let t=!1;for(let r of e)"T"===r.type?r.form=t?3:0:t=2===r.form||3===r.form}(t),function(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r];if(1604!==i.codePoint){t.push(i);continue}let n=r+1;for(;n<e.length&&"T"===e[n].type;)n++;let a=e[n],o=a&&__[String.fromCodePoint(1604,a.codePoint)];if(!o){t.push(i);continue}let s=3===i.form||1===i.form;t.push({codePoint:o[+!!s],type:"R",form:0}),t.push(...e.slice(r+1,n)),r=n}return t}(t).map(e=>String.fromCodePoint(function(e){if(null===e.form)return e.codePoint;let t=y_[e.codePoint];return t&&(t[e.form]||t[0])||e.codePoint}(e))).join("")}function D_(e,t,r){let i=t.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?e=e.toLocaleUpperCase():"lowercase"===i&&(e=e.toLocaleLowerCase()),(h_.applyArabicShaping??E_)(e)}function A_(e,t,r){for(let i of e.sections)i.text=D_(i.text,t,r);return e}const I_=typeof Intl<"u"&&"Segmenter"in Intl;let C_,k_;function M_(e){if(!I_||!function(e){return/[\r\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0600-\u0605\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DD\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0890\u0891\u0897-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E33-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB3-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1037\u1039-\u103E\u1056-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1084-\u1086\u108D\u109D\u1100-\u11FF\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60\u1A62\u1A65-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA960-\uA97C\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCBD\uDCC2\uDCCD\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC2\uDDC3\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF1F\uDF22-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE84-\uDE99\uDF60-\uDF67]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6\uDF00-\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD2F]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDD63\uDD67-\uDD6A\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF\uDDEE\uDDEF\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDDE6-\uDDFF\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF]/.test(e)}(e))return[...e];C_??=new Intl.Segmenter(void 0,{granularity:"grapheme"});let t=[];for(let{segment:r}of C_.segment(e)){let e=t.length-1;e>=0&&m_(t[e],r)?t[e]+=r:t.push(r)}return t}function F_(e){let t=new Set;if(I_){k_??=new Intl.Segmenter(void 0,{granularity:"word"});for(let{index:r}of k_.segment(e))t.add(r);return t}let r=0;for(let i of e.split(/\b|(?=\p{Ideo})/u))t.add(r),r+=i.length;return t}function R_(e){let t=e.codePointAt(0);return e.length>(t>65535?2:1)}function L_(e){return/\s/u.test(String.fromCodePoint(e))}function z_(e){for(let t of e)if(p_(t.codePointAt(0)))return!0;return!1}function O_(e){for(let t of e)if(!B_(t.codePointAt(0)))return!1;return!0}function B_(e){return!function(e){return/[\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u070D\u070F-\u074A\u074D-\u077F\u07C0-\u07FA\u07FD-\u07FF\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u08E1\u08E3-\u08FF\u1800\u1801\u1804\u1806-\u1819\u1820-\u1878\u1880-\u18AA\uA840-\uA877\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD802[\uDEC0-\uDEE6\uDEEB-\uDEF6\uDF80-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]|\uD803[\uDD00-\uDD27\uDD30-\uDD39\uDE60-\uDE7E\uDEC2-\uDEC7\uDED0-\uDED8\uDEFA-\uDEFF\uDF30-\uDF59\uDF70-\uDF89\uDFB0-\uDFCB]|\uD805[\uDE60-\uDE6C]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9C-\uDC9F]|\uD83A[\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/gim.test(String.fromCodePoint(e))}(e)}function j_(e){return!(p_(e)||function(e){return/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))}(e))}function N_(e){return/\p{sc=Arab}/u.test(String.fromCodePoint(e))}function U_(e){return function(e){return/[\u0591-\u05C7\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u070D\u070F-\u074A\u074D-\u07B1\u07C0-\u07FA\u07FD-\u082D\u0830-\u083E\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u08E1\u08E3-\u08FF\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC57-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD1F-\uDD39\uDD3F-\uDD59\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F-\uDE48\uDE50-\uDE58\uDE60-\uDE9F\uDEC0-\uDEE6\uDEEB-\uDEF6\uDF00-\uDF35\uDF39-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD27\uDD30-\uDD39\uDD40-\uDD65\uDD69-\uDD85\uDD8E\uDD8F\uDE60-\uDE7E\uDE80-\uDEA9\uDEAB-\uDEAD\uDEB0\uDEB1\uDEC2-\uDEC7\uDED0-\uDED8\uDEFA-\uDF27\uDF30-\uDF59\uDF70-\uDF89\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/gim.test(String.fromCodePoint(e))}(e)}function V_(e){for(let t of e)if(U_(t.codePointAt(0)))return!0;return!1}const $_={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},G_={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},q_={40:!0};function Z_(e,t,r,i,n,a){if("fontStack"in t){let i=r[t.fontStack],a=i?.[e];if(a)return a.metrics.advance*t.scale+n;let o=0;for(let r of e){let e=i?.[r];e&&(o+=e.metrics.advance*t.scale+n)}return o}{let e=i[t.imageName];return e?e.displaySize[0]*t.scale*24/a+n:0}}function W_(e,t,r,i){let n=(e-t)**2;return i?e<t?n/2:2*n:n+Math.abs(r)*r}function H_(e){return/^\s+$/u.test(e)}function X_(e,t,r){let i=0;return(10===e||13===e)&&(i-=1e4),r&&(i+=150),(40===e||65288===e)&&(i+=50),(41===t||65289===t)&&(i+=50),i}function K_(e,t,r,i,n,a){let o=null,s=W_(t,r,n,a);for(let e of i){let i=W_(t-e.x,r,n,a)+e.badness;i<=s&&(o=e,s=i)}return{index:e,x:t,priorBreak:o,badness:s}}function Y_(e){return e?Y_(e.priorBreak).concat(e.index):[]}var J_=class e{constructor(e="",t=[],r=[]){this.text=e,this.sections=t,this.sectionIndex=r,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??=M_(this.text),this._graphemes}static fromFeature(t,r){let i=new e;for(let e of t.sections)e.image?i.addImageSection(e):i.addTextSection(e,r);return i}length(){return this.graphemes().length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t="",r={premature:!0,value:void 0},i=e[Symbol.iterator](),n=i.next(),a=e[Symbol.iterator]();a.next();let o=a.next();for(;!n.done;)!o.done&&j_(o.value.codePointAt(0))&&!$_[o.value]||!r.premature&&j_(r.value.codePointAt(0))&&!$_[r.value]||!$_[n.value]?t+=n.value:t+=$_[n.value],r={value:n.value,premature:!1},n=i.next(),o=a.next();return t}(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){let e=this.graphemes(),t=0;for(;t<e.length&&H_(e[t]);)t++;let r=e.length;for(;r>t&&H_(e[r-1]);)r--;this.text=e.slice(t,r).join(""),this.sectionIndex=this.sectionIndex.slice(t,r),this._graphemes=null}substring(t,r){let i=this.graphemes().slice(t,r).join(""),n=this.sectionIndex.slice(t,r);return new e(i,this.sections,n)}toCodeUnitIndex(e){return this.graphemes().slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}getMaxImageSize(e){let t=0,r=0;for(let i=0;i<this.length();i++){let n=this.getSection(i);if("imageName"in n){let i=e[n.imageName];if(!i)continue;let a=i.displaySize;t=Math.max(t,a[0]),r=Math.max(r,a[1])}}return{maxImageWidth:t,maxImageHeight:r}}_appendSection(e,t){let r=this.graphemes(),i=r.length>0?r[r.length-1]:"",n=M_(i+e);this.text+=e,this._graphemes=r.slice(0,i?-1:void 0).concat(n);let a=n.length-+!!i;for(let e=0;e<a;e++)this.sectionIndex.push(t)}addTextSection(e,t){this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||t}),this._appendSection(e.text,this.sections.length-1)}addImageSection(e){let t=e.image?e.image.name:"";if(0===t.length)return void _s("Can't add FormattedSection with an empty image.");let r=this.getNextImageSectionCharCode();r?(this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:t}),this._appendSection(String.fromCharCode(r),this.sections.length-1)):_s("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,r,i,n){let a=[],o=this.determineAverageLineWidth(e,t,r,i,n),s=this.hasZeroWidthSpaces(),l=this.graphemes(),u=null,c=0,h=0;for(let t=0;t<l.length;t++){let d=l[t];if(t>0){let e=l[t-1].codePointAt(0),r=d.codePointAt(0),i=d_(e),n=f_(e)&&f_(r);(G_[e]||i||"imageName"in this.getSection(t-1)||void 0!==l[t+1]&&q_[r]||n&&(u??=F_(this.text)).has(h))&&a.push(K_(t,c,o,a,X_(e,r,i&&s),!1))}L_(d.codePointAt(0))||(c+=Z_(d,this.getSection(t),r,i,e,n)),h+=d.length}return Y_(K_(this.length(),c,o,a,0,!0))}determineAverageLineWidth(e,t,r,i,n){let a=0,o=0;for(let t of this.graphemes())a+=Z_(t,this.getSection(o),r,i,e,n),o++;return a/Math.max(1,Math.ceil(a/t))}};const Q_=function(e){var t={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},i={};r.L=1,i[1]="L",Object.keys(t).forEach(function(e,t){r[e]=1<<t+1,i[r[e]]=e}),Object.freeze(r);var n=r.LRI|r.RLI|r.FSI,a=r.L|r.R|r.AL,o=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,s=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,l=r.S|r.WS|r.B|n|r.PDI|s,u=null;function c(e){return function(){if(!u){u=new Map;var e=0;for(var i in t)if(t.hasOwnProperty(i))for(var n=t[i],a="",o=void 0,s=!1,l=0,c=0;c<=n.length+1;c+=1){var h=n[c];if(","!==h&&c!==n.length)"+"===h?(s=!0,l=e=l+parseInt(a,36),a=""):a+=h;else{s?o=e+parseInt(a,36):(l=e=l+parseInt(a,36),o=e),s=!1,a="",l=o;for(var d=e;d<o+1;d+=1)u.set(d,r[i])}}}}(),u.get(e.codePointAt(0))||r.L}var h,d,p,f="14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",m="6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye";function g(e,t){var r,i=0,n=new Map,a=t&&new Map;return e.split(",").forEach(function e(o){if(-1!==o.indexOf("+"))for(var s=+o;s--;)e(r);else{r=o;var l=o.split(">"),u=l[0],c=l[1];u=String.fromCodePoint(i+=parseInt(u,36)),c=String.fromCodePoint(i+=parseInt(c,36)),n.set(u,c),t&&a.set(c,u)}}),{map:n,reverseMap:a}}function y(){if(!h){var e=g(f,!0),t=e.map,r=e.reverseMap;h=t,d=r,p=g(m,!1).map}}function _(e){return y(),h.get(e)||null}function v(e){return y(),d.get(e)||null}function b(e){return y(),p.get(e)||null}var x,w=r.L,S=r.R,T=r.EN,P=r.ES,E=r.ET,D=r.AN,A=r.CS,I=r.B,C=r.S,k=r.ON,M=r.BN,F=r.NSM,R=r.AL,L=r.LRO,z=r.RLO,O=r.LRE,B=r.RLE,j=r.PDF,N=r.LRI,U=r.RLI,V=r.FSI,$=r.PDI;function G(e){return function(){if(!x){var e=g("14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",!0),t=e.map;e.reverseMap.forEach(function(e,r){t.set(r,e)}),x=t}}(),x.get(e)||null}function q(e,t,r,i){var n=e.length;r=Math.max(0,null==r?0:+r),i=Math.min(n-1,null==i?n-1:+i);var a=[];return t.paragraphs.forEach(function(n){var o=Math.max(r,n.start),s=Math.min(i,n.end);if(o<s){for(var u=t.levels.slice(o,s+1),h=s;h>=o&&c(e[h])&l;h--)u[h]=n.level;for(var d=n.level,p=1/0,f=0;f<u.length;f++){var m=u[f];m>d&&(d=m),m<p&&(p=1|m)}for(var g=d;g>=p;g--)for(var y=0;y<u.length;y++)if(u[y]>=g){for(var _=y;y+1<u.length&&u[y+1]>=g;)y++;y>_&&a.push([_+o,y+o])}}}),a}function Z(e,t,r,i){for(var n=q(e,t,r,i),a=[],o=0;o<e.length;o++)a[o]=o;return n.forEach(function(e){for(var t=e[0],r=e[1],i=a.slice(t,r+1),n=i.length;n--;)a[r-n]=i[n]}),a}return e.closingToOpeningBracket=v,e.getBidiCharType=c,e.getBidiCharTypeName=function(e){return i[c(e)]},e.getCanonicalBracket=b,e.getEmbeddingLevels=function(e,t){for(var r=new Uint32Array(e.length),i=0;i<e.length;i++)r[i]=c(e[i]);var u=new Map;function h(e,t){var i=r[e];r[e]=t,u.set(i,u.get(i)-1),i&o&&u.set(o,u.get(o)-1),u.set(t,(u.get(t)||0)+1),t&o&&u.set(o,(u.get(o)||0)+1)}for(var d=new Uint8Array(e.length),p=new Map,f=[],m=null,g=0;g<e.length;g++)m||f.push(m={start:g,end:e.length-1,level:"rtl"===t?1:"ltr"===t?0:Nt(g,!1)}),r[g]&I&&(m.end=g,m=null);for(var y=B|O|z|L|n|$|j|I,x=function(e){return e+(1&e?1:2)},G=function(e){return e+(1&e?2:1)},q=0;q<f.length;q++){var Z=[{_level:(m=f[q]).level,_override:0,_isolate:0}],W=void 0,H=0,X=0,K=0;u.clear();for(var Y=m.start;Y<=m.end;Y++){var J=r[Y];if(W=Z[Z.length-1],u.set(J,(u.get(J)||0)+1),J&o&&u.set(o,(u.get(o)||0)+1),J&y)if(J&(B|O)){d[Y]=W._level;var Q=(J===B?G:x)(W._level);Q<=125&&!H&&!X?Z.push({_level:Q,_override:0,_isolate:0}):H||X++}else if(J&(z|L)){d[Y]=W._level;var ee=(J===z?G:x)(W._level);ee<=125&&!H&&!X?Z.push({_level:ee,_override:J&z?S:w,_isolate:0}):H||X++}else if(J&n){J&V&&(J=1===Nt(Y+1,!0)?U:N),d[Y]=W._level,W._override&&h(Y,W._override);var te=(J===U?G:x)(W._level);te<=125&&0===H&&0===X?(K++,Z.push({_level:te,_override:0,_isolate:1,_isolInitIndex:Y})):H++}else if(J&$){if(H>0)H--;else if(K>0){for(X=0;!Z[Z.length-1]._isolate;)Z.pop();var re=Z[Z.length-1]._isolInitIndex;null!=re&&(p.set(re,Y),p.set(Y,re)),Z.pop(),K--}W=Z[Z.length-1],d[Y]=W._level,W._override&&h(Y,W._override)}else J&j?(0===H&&(X>0?X--:!W._isolate&&Z.length>1&&(Z.pop(),W=Z[Z.length-1])),d[Y]=W._level):J&I&&(d[Y]=m.level);else d[Y]=W._level,W._override&&J!==M&&h(Y,W._override)}for(var ie=[],ne=null,ae=m.start;ae<=m.end;ae++){var oe=r[ae];if(!(oe&s)){var se=d[ae],le=oe&n,ue=oe===$;ne&&se===ne._level?(ne._end=ae,ne._endsWithIsolInit=le):ie.push(ne={_start:ae,_end:ae,_level:se,_startsWithPDI:ue,_endsWithIsolInit:le})}}for(var ce=[],he=0;he<ie.length;he++){var de=ie[he];if(!de._startsWithPDI||de._startsWithPDI&&!p.has(de._start)){for(var pe=[ne=de],fe=void 0;ne&&ne._endsWithIsolInit&&null!=(fe=p.get(ne._end));)for(var me=he+1;me<ie.length;me++)if(ie[me]._start===fe){pe.push(ne=ie[me]);break}for(var ge=[],ye=0;ye<pe.length;ye++)for(var _e=pe[ye],ve=_e._start;ve<=_e._end;ve++)ge.push(ve);for(var be=d[ge[0]],xe=m.level,we=ge[0]-1;we>=0;we--)if(!(r[we]&s)){xe=d[we];break}var Se=ge[ge.length-1],Te=d[Se],Pe=m.level;if(!(r[Se]&n))for(var Ee=Se+1;Ee<=m.end;Ee++)if(!(r[Ee]&s)){Pe=d[Ee];break}ce.push({_seqIndices:ge,_sosType:Math.max(xe,be)%2?S:w,_eosType:Math.max(Pe,Te)%2?S:w})}}for(var De=0;De<ce.length;De++){var Ae=ce[De],Ie=Ae._seqIndices,Ce=Ae._sosType,ke=Ae._eosType,Me=1&d[Ie[0]]?S:w;if(u.get(F))for(var Fe=0;Fe<Ie.length;Fe++){var Re=Ie[Fe];if(r[Re]&F){for(var Le=Ce,ze=Fe-1;ze>=0;ze--)if(!(r[Ie[ze]]&s)){Le=r[Ie[ze]];break}h(Re,Le&(n|$)?k:Le)}}if(u.get(T))for(var Oe=0;Oe<Ie.length;Oe++){var Be=Ie[Oe];if(r[Be]&T)for(var je=Oe-1;je>=-1;je--){var Ne=-1===je?Ce:r[Ie[je]];if(Ne&a){Ne===R&&h(Be,D);break}}}if(u.get(R))for(var Ue=0;Ue<Ie.length;Ue++){var Ve=Ie[Ue];r[Ve]&R&&h(Ve,S)}if(u.get(P)||u.get(A))for(var $e=1;$e<Ie.length-1;$e++){var Ge=Ie[$e];if(r[Ge]&(P|A)){for(var qe=0,Ze=0,We=$e-1;We>=0&&(qe=r[Ie[We]])&s;We--);for(var He=$e+1;He<Ie.length&&(Ze=r[Ie[He]])&s;He++);qe===Ze&&(r[Ge]===P?qe===T:qe&(T|D))&&h(Ge,qe)}}if(u.get(T))for(var Xe=0;Xe<Ie.length;Xe++)if(r[Ie[Xe]]&T){for(var Ke=Xe-1;Ke>=0&&r[Ie[Ke]]&(E|s);Ke--)h(Ie[Ke],T);for(Xe++;Xe<Ie.length&&r[Ie[Xe]]&(E|s|T);Xe++)r[Ie[Xe]]!==T&&h(Ie[Xe],T)}if(u.get(E)||u.get(P)||u.get(A))for(var Ye=0;Ye<Ie.length;Ye++){var Je=Ie[Ye];if(r[Je]&(E|P|A)){h(Je,k);for(var Qe=Ye-1;Qe>=0&&r[Ie[Qe]]&s;Qe--)h(Ie[Qe],k);for(var et=Ye+1;et<Ie.length&&r[Ie[et]]&s;et++)h(Ie[et],k)}}if(u.get(T))for(var tt=0,rt=Ce;tt<Ie.length;tt++){var it=Ie[tt],nt=r[it];nt&T?rt===w&&h(it,w):nt&a&&(rt=nt)}if(u.get(o)){for(var at=S|T|D,ot=at|w,st=[],lt=[],ut=0;ut<Ie.length;ut++)if(r[Ie[ut]]&o){var ct=e[Ie[ut]],ht=void 0;if(null!==_(ct)){if(!(lt.length<63))break;lt.push({char:ct,seqIndex:ut})}else if(null!==(ht=v(ct)))for(var dt=lt.length-1;dt>=0;dt--){var pt=lt[dt].char;if(pt===ht||pt===v(b(ct))||_(b(pt))===ct){st.push([lt[dt].seqIndex,ut]),lt.length=dt;break}}}st.sort(function(e,t){return e[0]-t[0]});for(var ft=0;ft<st.length;ft++){for(var mt=st[ft],gt=mt[0],yt=mt[1],_t=!1,vt=0,bt=gt+1;bt<yt;bt++){var xt=Ie[bt];if(r[xt]&ot){_t=!0;var wt=r[xt]&at?S:w;if(wt===Me){vt=wt;break}}}if(_t&&!vt){vt=Ce;for(var St=gt-1;St>=0;St--){var Tt=Ie[St];if(r[Tt]&ot){var Pt=r[Tt]&at?S:w;vt=Pt===Me?Me:Pt;break}}}if(vt){if(r[Ie[gt]]=r[Ie[yt]]=vt,vt!==Me)for(var Et=gt+1;Et<Ie.length;Et++)if(!(r[Ie[Et]]&s)){c(e[Ie[Et]])&F&&(r[Ie[Et]]=vt);break}if(vt!==Me)for(var Dt=yt+1;Dt<Ie.length;Dt++)if(!(r[Ie[Dt]]&s)){c(e[Ie[Dt]])&F&&(r[Ie[Dt]]=vt);break}}}for(var At=0;At<Ie.length;At++)if(r[Ie[At]]&o){for(var It=At,Ct=At,kt=Ce,Mt=At-1;Mt>=0;Mt--){if(!(r[Ie[Mt]]&s)){kt=r[Ie[Mt]]&at?S:w;break}It=Mt}for(var Ft=ke,Rt=At+1;Rt<Ie.length;Rt++){if(!(r[Ie[Rt]]&(o|s))){Ft=r[Ie[Rt]]&at?S:w;break}Ct=Rt}for(var Lt=It;Lt<=Ct;Lt++)r[Ie[Lt]]=kt===Ft?kt:Me;At=Ct}}}for(var zt=m.start;zt<=m.end;zt++){var Ot=d[zt],Bt=r[zt];if(1&Ot?Bt&(w|T|D)&&d[zt]++:Bt&S?d[zt]++:Bt&(D|T)&&(d[zt]+=2),Bt&s&&(d[zt]=0===zt?m.level:d[zt-1]),zt===m.end||c(e[zt])&(C|I))for(var jt=zt;jt>=0&&c(e[jt])&l;jt--)d[jt]=m.level}}return{levels:d,paragraphs:f};function Nt(t,i){for(var a=t;a<e.length;a++){var o=r[a];if(o&(S|R))return 1;if(o&(I|w)||i&&o===$)return 0;if(o&n){var s=Ut(a);a=-1===s?e.length:s}}return 0}function Ut(t){for(var i=1,a=t+1;a<e.length;a++){var o=r[a];if(o&I)break;if(o&$){if(0===--i)return a}else o&n&&i++}return-1}},e.getMirroredCharacter=G,e.getMirroredCharactersMap=function(e,t,r,i){var n=e.length;r=Math.max(0,null==r?0:+r),i=Math.min(n-1,null==i?n-1:+i);for(var a=new Map,o=r;o<=i;o++)if(1&t[o]){var s=G(e[o]);null!==s&&a.set(o,s)}return a},e.getReorderSegments=q,e.getReorderedIndices=Z,e.getReorderedString=function(e,t,r,i){var n=Z(e,t,r,i),a=[].concat(e);return n.forEach(function(r,i){a[i]=(1&t.levels[r]?G(e[r]):null)||e[r]}),a.join("")},e.openingToClosingBracket=_,Object.defineProperty(e,"__esModule",{value:!0}),e}({}),ev=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/,tv=new Set(["WS","FSI","LRI","RLI","PDI"]),rv=new Set(["S","B"]);function iv(e){return e.level%2==0?e.text:Q_.getMirroredCharacter(e.text)??e.text}function nv(e,t){let{levels:r,paragraphs:i}=Q_.getEmbeddingLevels(e);return function(e,t){let r=t.filter(t=>t>0&&t<e.length),i=[...new Set([0,...r,e.length])].sort((e,t)=>e-t),n=[];for(let e=0;e+1<i.length;e++)n.push([i[e],i[e+1]]);return n}(e,t.concat(i.map(e=>e.start))).map(([t,n])=>function(e,t,r,i,n){let a=function(e,t,r,i){let n=[],a=r;for(let o of M_(e.slice(r,i)))n.push({index:a,text:o,level:t[a]}),a+=o.length;return n}(e,t,i,n);!function(e,t){let r=!0;for(let i=e.length-1;i>=0;i--){let n=Q_.getBidiCharTypeName(e[i].text[0]);rv.has(n)?(e[i].level=t,r=!0):r&&tv.has(n)?e[i].level=t:r=!1}}(a,r);let o="",s=[];for(let e of function(e,t){let r=t,i=1/0;for(let{level:t}of e)t>r&&(r=t),(1|t)<i&&(i=1|t);let n=e.slice();for(let e=r;e>=i;e--)for(let t=0;t<n.length;t++){if(n[t].level<e)continue;let r=t;for(;r+1<n.length&&n[r+1].level>=e;)r++;for(let e=t,i=r;e<i;e++,i--)[n[e],n[i]]=[n[i],n[e]];t=r}return n}(a,r)){if(ev.test(e.text))continue;let t=iv(e);o+=t,s.push(...Array(t.length).fill(e.index))}return{text:o,sourceIndices:s}}(e,r,function(e,t){return e.find(e=>t>=e.start&&t<=e.end)?.level??0}(i,t),t,n))}const av=4294967296,ov=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");var sv=class{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,r=this.length){let i;for(;i=this.nextField(r);)e(i,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*av;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*av;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,r=t[this.pos++];if(r<128)return r;let i,n=127&r;return i=t[this.pos++],n|=(127&i)<<7,i<128||(i=t[this.pos++],n|=(127&i)<<14,i<128)||(i=t[this.pos++],n|=(127&i)<<21,i<128)?n:(i=t[this.pos],n|=(15&i)<<28,function(e,t,r){let i,n,a=r.buf;if(n=a[r.pos++],i=(112&n)>>4,n<128||(n=a[r.pos++],i|=(127&n)<<3,n<128)||(n=a[r.pos++],i|=(127&n)<<10,n<128)||(n=a[r.pos++],i|=(127&n)<<17,n<128)||(n=a[r.pos++],i|=(127&n)<<24,n<128)||(n=a[r.pos++],i|=(1&n)<<31,n<128))return function(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}(e,i,t);throw Error("Expected varint not more than 10 bytes")}(n,e,this))}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&ov?ov.decode(this.buf.subarray(t,e)):function(e,t,r){let i="",n=t;for(;n<r;){let t,a,o,s=e[n],l=null,u=s>239?4:s>223?3:s>191?2:1;if(n+u>r)break;1===u?s<128&&(l=s):2===u?(t=e[n+1],128==(192&t)&&(l=(31&s)<<6|63&t,l<=127&&(l=null))):3===u?(t=e[n+1],a=e[n+2],128==(192&t)&&128==(192&a)&&(l=(15&s)<<12|(63&t)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(t=e[n+1],a=e[n+2],o=e[n+3],128==(192&t)&&128==(192&a)&&128==(192&o)&&(l=(15&s)<<18|(63&t)<<12|(63&a)<<6|63&o,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),n+=u}return i}(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;let t=this.readVarint();return this.type=7&t,this._valueStart=this.pos,t>>>3}skip(e){let t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw Error(`Unimplemented type: ${t}`);this.pos+=8}}};function lv(e,t,r){1===e&&r.readMessage(uv,t)}function uv(e,t,r){if(3===e){let{id:e,bitmap:i,width:n,height:a,left:o,top:s,advance:l}=r.readMessage(cv,{});t.push({id:e,bitmap:new jm({width:n+6,height:a+6},i),metrics:{width:n,height:a,left:o,top:s,advance:l}})}}function cv(e,t,r){1===e?t.id=r.readVarint():2===e?t.bitmap=r.readBytes():3===e?t.width=r.readVarint():4===e?t.height=r.readVarint():5===e?t.left=r.readSVarint():6===e?t.top=r.readSVarint():7===e&&(t.advance=r.readVarint())}function hv(e){return"function"==typeof e?.renderWithWebGL}function dv(e){let{userImage:t}=e;return!(!t?.render||!t.render()||(hv(t.data)||e.data.replace(new Uint8Array(t.data.buffer)),0))}function pv(e){let t=0,r=0;for(let i of e)t+=i.w*i.h,r=Math.max(r,i.w);e.sort((e,t)=>t.h-e.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],n=0,a=0;for(let t of e)for(let e=i.length-1;e>=0;e--){let r=i[e];if(!(t.w>r.w||t.h>r.h)){if(t.x=r.x,t.y=r.y,a=Math.max(a,t.y+t.h),n=Math.max(n,t.x+t.w),t.w===r.w&&t.h===r.h){let t=i.pop();t&&e<i.length&&(i[e]=t)}else t.h===r.h?(r.x+=t.w,r.w-=t.w):t.w===r.w?(r.y+=t.h,r.h-=t.h):(i.push({x:r.x+t.w,y:r.y,w:r.w-t.w,h:t.h}),r.y+=t.h,r.h-=t.h);break}}return{w:n,h:a,fill:t/(n*a)||0}}var fv=class{constructor(e,{pixelRatio:t,version:r,isWebGLImage:i=!1,stretchX:n,stretchY:a,content:o,textFitWidth:s,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=n,this.stretchY=a,this.content=o,this.version=r,this.needsFirstWebGLRender=i,this.textFitWidth=s,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}};Fd("ImagePosition",fv),Fd("ImageAtlas",class{constructor(e,t){let r={},i={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let n=[];this.addImages(e,r,n),this.addImages(t,i,n);let{w:a,h:o}=pv(n),s=new Nm({width:a||1,height:o||1});for(let t in e){let i=e[t];if(i.isWebGLImage)continue;let n=r[t].paddedRect;Nm.copy(i.data,s,{x:0,y:0},{x:n.x+1,y:n.y+1},i.data)}for(let e in t){let r=t[e],n=i[e].paddedRect,a=n.x+1,o=n.y+1,l=r.data.width,u=r.data.height;Nm.copy(r.data,s,{x:0,y:0},{x:a,y:o},r.data),Nm.copy(r.data,s,{x:0,y:u-1},{x:a,y:o-1},{width:l,height:1}),Nm.copy(r.data,s,{x:0,y:0},{x:a,y:o+u},{width:l,height:1}),Nm.copy(r.data,s,{x:l-1,y:0},{x:a-1,y:o},{width:1,height:u}),Nm.copy(r.data,s,{x:0,y:0},{x:a+l,y:o},{width:1,height:u})}this.image=s,this.iconPositions=r,this.patternPositions=i}addImages(e,t,r){for(let i in e){let n=e[i],a={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(a),t[i]=new fv(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,t){if(e.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==e.updateVersion){this.patchedUpdateVersion=e.updateVersion;for(let r in this.iconPositions)this.patchUpdatedImage(this.iconPositions[r],e.getImage(r),t);for(let r in this.patternPositions)this.patchUpdatedImage(this.patternPositions[r],e.getImage(r),t)}}patchUpdatedImage(e,t,r){if(!e||!t||!e.needsFirstWebGLRender&&e.version===t.version)return;e.needsFirstWebGLRender=!1,e.version=t.version;let[i,n]=e.tl,a=t.userImage?.data;if(!hv(a))return void r.update(t.data,void 0,{x:i,y:n});let{width:o,height:s}=t.data;r.context.setCustomLayerDefaults(),a.renderWithWebGL({gl:r.context.gl,texture:r.texture,x:i,y:n,width:o,height:s}),r.context.setDirty()}});var mv=function(e){return e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e}(mv||{});const gv=/^\p{gc=M}$/u;function yv(e,t,r){let i=new J_(e.join(""),t,[]),n=0;for(let e of i.graphemes())i.sectionIndex.push(r[n]??0),n+=[...e].length;return i}function _v(e){let t=[],r=0;for(let i of e)t.push(r),r+=i.length;return t}function vv(e,t,r){let i=[...e],n=_v(i),a=function(e){let t=[],r=0;for(;r<e.length;){if(!gv.test(e[r])){t.push(r),r++;continue}let i=r;for(;i<e.length&&gv.test(e[i]);)i++;let n=e[i];if(void 0!==n&&U_(n.codePointAt(0))){t.push(i);for(let e=i-1;e>=r;e--)t.push(e);r=i+1}else{for(let e=r;e<i;e++)t.push(e);r=i}}return t}(i);return yv(a.map(e=>i[e]),t,a.map(e=>r[n[e]]??0))}function bv(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f){let m=J_.fromFeature(e,n);2===h&&m.verticalizePunctuation();let g=m.determineLineBreaks(u,a,t,i,p),y=V_(m.text)?function(e,t){let r=t.map(t=>e.toCodeUnitIndex(t)),i=h_.isParsed()?h_:null;if(1===e.sections.length)return i?i.processBidirectionalText(e.toString(),r).map(t=>vv(t,e.sections,[...t].map(()=>0))):function(e,t){return nv(e,t).map(e=>e.text)}(e.toString(),r).map(t=>yv([...t],e.sections,[...t].map(()=>0)));let n=function(e){let t=[],r=0;for(let i of e.graphemes())t.push(...Array(i.length).fill(e.sectionIndex[r])),r++;return t}(e);return i?i.processStyledBidirectionalText(e.text,n,r).map(([t,r])=>vv(t,e.sections,r)):function(e,t,r){return nv(e,r).map(e=>[e.text,e.sourceIndices.map(e=>t[e]??0)])}(e.text,n,r).map(([t,r])=>{let i=[...t];return yv(i,e.sections,_v(i).map(e=>r[e]??0))})}(m,g):function(e,t){let r=[],i=0;for(let n of t)r.push(e.substring(i,n)),i=n;return i<e.length()&&r.push(e.substring(i,e.length())),r}(m,g),_=[],v={positionedLines:_,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1};return function(e,t,r,i,n,a,o,s,l,u,c,h){let d=0,p=0,f=0,m=0,g="right"===s?1:"left"===s?0:.5,y=24/h,_=0;for(let o of n){o.trim();let n=o.getMaxScale(),s={positionedGlyphs:[],lineOffset:0};e.positionedLines[_]=s;let h=s.positionedGlyphs,v=0;if(!o.length()){p+=a,++_;continue}let b=wv(i,o,y),x=2!==l||c?null:Iv(o),w=o.graphemes();for(let a=0;a<w.length;a++){let s=o.getSection(a),f=w[a],m=f.codePointAt(0),g=x?x[a]:Tv(l,c,m),_="fontStack"in s&&R_(f)&&!t[s.fontStack]?.[f]?[...f]:[f];for(let l of _){let c,f={glyph:l.codePointAt(0),grapheme:l,imageName:null,x:d,y:p+-17,vertical:g,scale:1,fontStack:"",sectionIndex:o.getSectionIndex(a),metrics:null,rect:null};if("fontStack"in s){if(c=Cv(s,l,g,b,t,r),!c)continue;f.fontStack=s.fontStack}else{if(e.iconsInText=!0,s.scale*=y,c=kv(s,g,n,b,i),!c)continue;v=Math.max(v,c.imageOffset),f.imageName=s.imageName}let{rect:m,metrics:_,baselineOffset:x}=c;f.y+=x,f.scale=s.scale,f.metrics=_,f.rect=m,h.push(f),g?(e.verticalizable=!0,d+=("imageName"in s?_.advance:24)*s.scale+u):d+=_.advance*s.scale+u}}if(0!==h.length){let e=d-u;f=Math.max(e,f),Mv(h,0,h.length-1,g)}d=0;let S=24*(n-1);s.lineOffset=Math.max(v,S);let T=a*n+v;p+=T,m=Math.max(T,m),++_}let{horizontalAlign:v,verticalAlign:b}=xv(o);(function(e,t,r,i,n,a,o,s,l){let u=(t-r)*n,c=0;c=a===o?-i*l*o+.5*o:-s*i- -17;for(let t of e)for(let e of t.positionedGlyphs)e.x+=u,e.y+=c})(e.positionedLines,g,v,b,f,m,a,p,n.length),e.top+=-b*p,e.bottom=e.top+p,e.left+=-v*f,e.right=e.left+f}(v,t,r,i,y,o,s,l,h,u,d,f),!function(e){for(let t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(_)&&v}function xv(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function wv(e,t,r){let i=24*t.getMaxScale(),{maxImageWidth:n,maxImageHeight:a}=t.getMaxImageSize(e),o=Math.max(i,a*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:o}}function Sv(e){switch(e){case"top":return 0;case"center":return.5;default:return 1}}function Tv(e,t,r){return!(1===e||!t&&!p_(r)||t&&(L_(r)||N_(r)))}function Pv(e){return/\p{Nd}/u.test(String.fromCodePoint(e))}function Ev(e){return/\p{Lu}/u.test(String.fromCodePoint(e))}function Dv(e){let t=e.some(Pv)&&e.every(e=>Pv(e)||function(e){return/[\p{P}\p{S}]/u.test(String.fromCodePoint(e))}(e)),r=e.length<=3&&e.every(e=>Ev(e)||Pv(e));return t||r}function Av(e){return(Pv(e)||Ev(e))&&!N_(e)}function Iv(e){let t=e.graphemes().slice(),r=t.map(e=>e.codePointAt(0)),i=r.map(p_),n=t=>!i[t]&&!L_(r[t])&&!("imageName"in e.getSection(t));for(let e=0;e<r.length;e++){if(!n(e))continue;let t=e;for(;t+1<r.length&&n(t+1);)t++;if(Dv(r.slice(e,t+1)))for(let n=e;n<=t;n++)i[n]=Av(r[n]);e=t}return function(e,t){let r=!1;for(let i=0;i<e.length;i++){if(t[i])continue;let n=$_[e[i]];n&&(0===i||t[i-1])&&(i===e.length-1||t[i+1])&&(e[i]=n,t[i]=!0,r=!0)}return r}(t,i)&&(e.text=t.join(""),e._graphemes=null),i}function Cv(e,t,r,i,n,a){let o,s=a[e.fontStack]?.[t],l=function(e,t,r,i){if(e?.rect)return e;let n=t[r.fontStack]?.[i];return n?{rect:null,metrics:n.metrics}:null}(s,n,e,t);if(null===l)return null;if(r)o=i.verticalLineContentWidth-24*e.scale;else{let t=Sv(e.verticalAlign);o=(i.horizontalLineContentHeight-24*e.scale)*t}return{rect:l.rect,metrics:l.metrics,baselineOffset:o}}function kv(e,t,r,i,n){let a=n[e.imageName];if(!a)return null;let o,s=a.paddedRect,l=a.displaySize,u={width:l[0],height:l[1],left:1,top:-3,advance:t?l[1]:l[0]};if(t)o=i.verticalLineContentWidth-l[1]*e.scale;else{let t=Sv(e.verticalAlign);o=(i.horizontalLineContentHeight-l[1]*e.scale)*t}return{rect:s,metrics:u,baselineOffset:o,imageOffset:(t?l[0]:l[1])*e.scale-24*r}}function Mv(e,t,r,i){if(0===i)return;let n=e[r],a=n.metrics.advance*n.scale,o=(e[r].x+a)*i;for(let i=t;i<=r;i++)e[i].x-=o}function Fv(e,t,r){let{horizontalAlign:i,verticalAlign:n}=xv(r),a=t[0],o=t[1],s=a-e.displaySize[0]*i,l=s+e.displaySize[0],u=o-e.displaySize[1]*n;return{image:e,top:u,bottom:u+e.displaySize[1],left:s,right:l}}function Rv(e){let t=e.left,r=e.top,i=e.right-t,n=e.bottom-r,a=e.image.content[2]-e.image.content[0],o=e.image.content[3]-e.image.content[1],s=e.image.textFitWidth??"stretchOrShrink",l=e.image.textFitHeight??"stretchOrShrink",u=a/o;if("proportional"===l){if("stretchOnly"===s&&i/n<u||"proportional"===s){let e=Math.ceil(n*u);t*=e/i,i=e}}else if("proportional"===s&&"stretchOnly"===l&&0!==u&&i/n>u){let e=Math.ceil(i/u);r*=e/n,n=e}return{x1:t,y1:r,x2:t+i,y2:r+n}}function Lv(e,t,r,i,n,a){let o,s=e.image;if(s.content){let e=s.content,t=s.pixelRatio||1;o=[e[0]/t,e[1]/t,s.displaySize[0]-e[2]/t,s.displaySize[1]-e[3]/t]}let l,u,c,h,d=t.left*a,p=t.right*a;"width"===r||"both"===r?(h=n[0]+d-i[3],u=n[0]+p+i[1]):(h=n[0]+(d+p-s.displaySize[0])/2,u=h+s.displaySize[0]);let f=t.top*a,m=t.bottom*a;return"height"===r||"both"===r?(l=n[1]+f-i[0],c=n[1]+m+i[2]):(l=n[1]+(f+m-s.displaySize[1])/2,c=l+s.displaySize[1]),{image:s,top:l,right:u,bottom:c,left:h,collisionPadding:o}}function zv(e,t){let{expression:r}=t;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new Nd(e+1))};if("source"===r.kind)return{kind:"source"};if("composite"===r.kind){let{minZoom:t,maxZoom:i}=function(e,t){let r=0;for(;r<e.length&&e[r]<=t;)r++;r=Math.max(0,r-1);let i=r;for(;i<e.length&&e[i]<t+1;)i++;return i=Math.min(e.length-1,i),{minZoom:e[r],maxZoom:e[i]}}(r.zoomStops,e);return{kind:"composite",minZoom:t,maxZoom:i,interpolationType:r.interpolationType}}{let t=function(e){return e.zoomStops.map(t=>e.evaluate(new Nd(t===-1/0?e.zoomStops[1]-1:t)))}(r),i=r.evaluate(new Nd(e+1));return{kind:"camera",zoomStops:r.zoomStops,sizes:t,layoutSize:i,interpolationType:r.interpolationType}}}function Ov(e,{uSize:t,uSizeT:r},{lowerSize:i,upperSize:n}){return"source"===e.kind?i/128:"composite"===e.kind?_u.number(i/128,n/128,r):t}function Bv(e,t){let r=0,i=0;return"constant"===e.kind?i=e.layoutSize:"camera"===e.kind?i=function({zoomStops:e,sizes:t,layoutSize:r,interpolationType:i},n){let a=e.length-1;for(;a>0&&e[a]>n;)a--;let o=Math.min(a+1,e.length-1),s=i?ns(gu.interpolationFactor(i,n,e[a],e[o]),0,1):0;return Math.min(_u.number(t[a],t[o],s),r)}(e,t):"composite"===e.kind&&(r=function({interpolationType:e,minZoom:t,maxZoom:r},i){return e?ns(gu.interpolationFactor(e,i,t,r),0,1):0}(e,t)),{uSizeT:r,uSize:i}}var jv=class e extends $a{constructor(e,t,r,i){super(e,t),this.angle=r,void 0!==i&&(this.segment=i)}clone(){return new e(this.x,this.y,this.angle,this.segment)}};function Nv(e,t,r,i,n){if(void 0===t.segment||0===r)return!0;let a=t,o=t.segment+1,s=0;for(;s>-r/2;){if(o--,o<0)return!1;s-=e[o].dist(a),a=e[o]}s+=e[o].dist(e[o+1]),o++;let l=[],u=0;for(;s<r/2;){let t=e[o-1],r=e[o],a=e[o+1];if(!a)return!1;let c=t.angleTo(r)-r.angleTo(a);for(c=Math.abs((c+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:c}),u+=c;s-l[0].distance>i;)u-=l.shift().angleDelta;if(u>n)return!1;o++,s+=r.dist(a)}return!0}function Uv(e){let t=0;for(let r=0;r<e.length-1;r++)t+=e[r].dist(e[r+1]);return t}function Vv(e,t,r){return e?.6*t*r:0}function $v(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Gv(e,t,r,i,n,a){let o=Vv(r,n,a),s=$v(r,i)*a,l=0,u=Uv(e)/2;for(let r=0;r<e.length-1;r++){let i=e[r],n=e[r+1],a=i.dist(n);if(l+a>u){let c=(u-l)/a,h=new jv(_u.number(i.x,n.x,c),_u.number(i.y,n.y,c),n.angleTo(i),r);return h._round(),!o||Nv(e,h,s,o,t)?h:void 0}l+=a}}function qv(e,t,r,i,n,a,o,s,l){let u=Vv(i,a,o),c=$v(i,n),h=c*o,d=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h<t/4&&(t=h+t/4),Zv(e,d?t/2*s%t:(c/2+2*a)*o*s%t,t,u,r,h,d,!1,l)}function Zv(e,t,r,i,n,a,o,s,l){let u=a/2,c=Uv(e),h=0,d=t-r,p=[];for(let t=0;t<e.length-1;t++){let o=e[t],s=e[t+1],f=o.dist(s),m=s.angleTo(o);for(;d+r<h+f;){d+=r;let g=(d-h)/f,y=_u.number(o.x,s.x,g),_=_u.number(o.y,s.y,g);if(y>=0&&y<l&&_>=0&&_<l&&d-u>=0&&d+u<=c){let r=new jv(y,_,m,t);r._round(),(!i||Nv(e,r,a,i,n))&&p.push(r)}}h+=f}return!s&&!p.length&&!o&&(p=Zv(e,h/2,r,i,n,a,o,!0,l)),p}function Wv(e,t,r,i,n){let a=[];for(let o of e){let e;for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1];l.x<t&&u.x<t||(l.x<t?l=new $a(t,l.y+(u.y-l.y)*((t-l.x)/(u.x-l.x)))._round():u.x<t&&(u=new $a(t,l.y+(u.y-l.y)*((t-l.x)/(u.x-l.x)))._round()),!(l.y<r&&u.y<r)&&(l.y<r?l=new $a(l.x+(u.x-l.x)*((r-l.y)/(u.y-l.y)),r)._round():u.y<r&&(u=new $a(l.x+(u.x-l.x)*((r-l.y)/(u.y-l.y)),r)._round()),!(l.x>=i&&u.x>=i)&&(l.x>=i?l=new $a(i,l.y+(u.y-l.y)*((i-l.x)/(u.x-l.x)))._round():u.x>=i&&(u=new $a(i,l.y+(u.y-l.y)*((i-l.x)/(u.x-l.x)))._round()),!(l.y>=n&&u.y>=n)&&(l.y>=n?l=new $a(l.x+(u.x-l.x)*((n-l.y)/(u.y-l.y)),n)._round():u.y>=n&&(u=new $a(l.x+(u.x-l.x)*((n-l.y)/(u.y-l.y)),n)._round()),(!e||!l.equals(e[e.length-1]))&&(e=[l],a.push(e)),e.push(u)))))}}return a}function Hv(e,t,r,i){let n=[],a=e.image,o=a.pixelRatio,s=a.paddedRect.w-2,l=a.paddedRect.h-2,u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},c=a.stretchX||[[0,s]],h=a.stretchY||[[0,l]],d=(e,t)=>e+t[1]-t[0],p=c.reduce(d,0),f=h.reduce(d,0),m=s-p,g=l-f,y=0,_=p,v=0,b=f,x=0,w=m,S=0,T=g;if(a.content&&i){let t=a.content,r=t[2]-t[0],i=t[3]-t[1];(a.textFitWidth||a.textFitHeight)&&(u=Rv(e)),y=Xv(c,0,t[0]),v=Xv(h,0,t[1]),_=Xv(c,t[0],t[2]),b=Xv(h,t[1],t[3]),x=t[0]-y,S=t[1]-v,w=r-_,T=i-b}let P=u.x1,E=u.y1,D=u.x2-P,A=u.y2-E,I=(e,i,n,s)=>{let l=Yv(e.stretch-y,_,D,P),u=Jv(e.fixed-x,w,e.stretch,p),c=Yv(i.stretch-v,b,A,E),h=Jv(i.fixed-S,T,i.stretch,f),d=Yv(n.stretch-y,_,D,P),m=Jv(n.fixed-x,w,n.stretch,p),g=Yv(s.stretch-v,b,A,E),I=Jv(s.fixed-S,T,s.stretch,f),C=new $a(l,c),k=new $a(d,c),M=new $a(d,g),F=new $a(l,g),R=new $a(u/o,h/o),L=new $a(m/o,I/o),z=t*Math.PI/180;if(z){let e=Math.sin(z),t=Math.cos(z),r=[t,-e,e,t];C._matMult(r),k._matMult(r),F._matMult(r),M._matMult(r)}let O=e.stretch+e.fixed,B=n.stretch+n.fixed,j=i.stretch+i.fixed,N=s.stretch+s.fixed;return{tl:C,tr:k,bl:F,br:M,tex:{x:a.paddedRect.x+1+O,y:a.paddedRect.y+1+j,w:B-O,h:N-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:R,pixelOffsetBR:L,minFontScaleX:w/o/D,minFontScaleY:T/o/A,isSDF:r}};if(i&&(a.stretchX||a.stretchY)){let e=Kv(c,m,p),t=Kv(h,g,f);for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1];for(let e=0;e<t.length-1;e++){let r=t[e],o=t[e+1];n.push(I(i,r,a,o))}}}else n.push(I({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));return n}function Xv(e,t,r){let i=0;for(let n of e)i+=Math.max(t,Math.min(r,n[1]))-Math.max(t,Math.min(r,n[0]));return i}function Kv(e,t,r){let i=[{fixed:-1,stretch:0}];for(let[t,r]of e){let e=i[i.length-1];i.push({fixed:t-e.stretch,stretch:e.stretch}),i.push({fixed:t-e.stretch,stretch:e.stretch+(r-t)})}return i.push({fixed:t+1,stretch:r}),i}function Yv(e,t,r,i){return e/t*r+i}function Jv(e,t,r,i){return e-t*r/i}Fd("Anchor",jv);var Qv=class{constructor(e,t,r,i,n,a,o,s,l,u){if(this.boxStartIndex=e.length,l){let e=a.top,t=a.bottom,r=a.collisionPadding;r&&(e-=r[1],t+=r[3]);let i=t-e;i>0&&(i=Math.max(10,i),this.circleDiameter=i)}else{let l=a.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?Rv(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};l.y1=l.y1*o-s[0],l.y2=l.y2*o+s[2],l.x1=l.x1*o-s[3],l.x2=l.x2*o+s[1];let c=a.collisionPadding;if(c&&(l.x1-=c[0]*o,l.y1-=c[1]*o,l.x2+=c[2]*o,l.y2+=c[3]*o),u){let e=new $a(l.x1,l.y1),t=new $a(l.x2,l.y1),r=new $a(l.x1,l.y2),i=new $a(l.x2,l.y2),n=u*Math.PI/180;e._rotate(n),t._rotate(n),r._rotate(n),i._rotate(n),l.x1=Math.min(e.x,t.x,r.x,i.x),l.x2=Math.max(e.x,t.x,r.x,i.x),l.y1=Math.min(e.y,t.y,r.y,i.y),l.y2=Math.max(e.y,t.y,r.y,i.y)}e.emplaceBack(t.x,t.y,l.x1,l.y1,l.x2,l.y2,r,i,n)}this.boxEndIndex=e.length}},eb=class{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:r}=this,i=t[e];for(;e>0;){let n=e-1>>1,a=t[n];if(r(i,a)>=0)break;t[e]=a,e=n}t[e]=i}_down(e){let{data:t,compare:r}=this,i=this.length>>1,n=t[e];for(;e<i;){let i=1+(e<<1),a=i+1;if(a<this.length&&r(t[a],t[i])<0&&(i=a),r(t[i],n)>=0)break;t[e]=t[i],e=i}t[e]=n}};function tb(e,t=1){let r=sy.fromPoints(e[0]),i=Math.min(r.width(),r.height()),n=i/2,a=new eb([],rb),{minX:o,minY:s,maxX:l,maxY:u}=r;if(0===i)return new $a(o,s);for(let t=o;t<l;t+=i)for(let r=s;r<u;r+=i)a.push(new ib(t+n,r+n,n,e));let c=function(e){let t=0,r=0,i=0,n=e[0];for(let e=0,a=n.length,o=a-1;e<a;o=e++){let a=n[e],s=n[o],l=a.x*s.y-s.x*a.y;r+=(a.x+s.x)*l,i+=(a.y+s.y)*l,t+=3*l}return new ib(r/t,i/t,0,e)}(e),h=c;for(;a.length;){let r=a.pop();(r.d>h.d||!h.d)&&(h=r),!(r.max-h.d<=t)&&(n=r.h/2,a.push(new ib(r.p.x-n,r.p.y-n,n,e)),a.push(new ib(r.p.x+n,r.p.y-n,n,e)),a.push(new ib(r.p.x-n,r.p.y+n,n,e)),a.push(new ib(r.p.x+n,r.p.y+n,n,e)))}return c.d>0&&h.d-c.d<=t?c.p:h.p}function rb(e,t){return t.max-e.max}var ib=class{constructor(e,t,r,i){this.p=new $a(e,t),this.h=r,this.d=function(e,t){let r=!1,i=1/0;for(let n of t)for(let t=0,a=n.length,o=a-1;t<a;o=t++){let a=n[t],s=n[o];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(r=!r),i=Math.min(i,mm(e,a,s))}return(r?1:-1)*Math.sqrt(i)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}};let nb=function(e){return e[e.center=1]="center",e[e.left=2]="left",e[e.right=3]="right",e[e.top=4]="top",e[e.bottom=5]="bottom",e[e["top-left"]=6]="top-left",e[e["top-right"]=7]="top-right",e[e["bottom-left"]=8]="bottom-left",e[e["bottom-right"]=9]="bottom-right",e}({});const ab=1/0;function ob(e,t){return t[1]===ab?function(e,t){let r=0,i=0;t<0&&(t=0);let n=t/Math.SQRT2;switch(e){case"top-right":case"top-left":i=n-7;break;case"bottom-right":case"bottom-left":i=7-n;break;case"bottom":i=7-t;break;case"top":i=t-7}switch(e){case"top-right":case"bottom-right":r=-n;break;case"top-left":case"bottom-left":r=n;break;case"left":r=t;break;case"right":r=-t}return[r,i]}(e,t[0]):function(e,t,r){let i=0,n=0;switch(t=Math.abs(t),r=Math.abs(r),e){case"top-right":case"top-left":case"top":n=r-7;break;case"bottom-right":case"bottom-left":case"bottom":n=7-r}switch(e){case"top-right":case"bottom-right":case"right":i=-t;break;case"top-left":case"bottom-left":case"left":i=t}return[i,n]}(e,t[0],t[1])}function sb(e,t,r){let i=e.layout,n=i.get("text-variable-anchor-offset")?.evaluate(t,{},r);if(n){let e=n.values,t=[];for(let r=0;r<e.length;r+=2){let i=t[r]=e[r],n=e[r+1].map(e=>24*e);i.startsWith("top")?n[1]-=7:i.startsWith("bottom")&&(n[1]+=7),t[r+1]=n}return new iu(t)}let a=i.get("text-variable-anchor");if(a){let n;n=void 0===e._unevaluatedLayout.getValue("text-radial-offset")?i.get("text-offset").evaluate(t,{},r).map(e=>24*e):[24*i.get("text-radial-offset").evaluate(t,{},r),ab];let o=[];for(let e of a)o.push(e,ob(e,n));return new iu(o)}return null}function lb(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function ub(e,t,r,i,n,a,o,s,l,u,c,h){let d=a.textMaxSize.evaluate(t,{});void 0===d&&(d=o);let p,f=e.layers[0].layout,m=f.get("icon-offset").evaluate(t,{},c),g=hb(r.horizontal),y=o/24,_=e.tilePixelRatio*y,v=e.tilePixelRatio*d/24,b=e.tilePixelRatio*s,x=e.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*e.tilePixelRatio,S=function(e,t,r,i=1){let n=e.get("icon-padding").evaluate(t,{},r)?.values;return[n[0]*i,n[1]*i,n[2]*i,n[3]*i]}(f,t,c,e.tilePixelRatio),T=f.get("text-max-angle")/180*Math.PI,P="viewport"!==f.get("text-rotation-alignment")&&"point"!==f.get("symbol-placement"),E="map"===f.get("icon-rotation-alignment").constantOr("viewport")&&"point"!==f.get("symbol-placement"),D=f.get("symbol-placement"),A=x/2,I=f.get("icon-text-fit");i&&"none"!==I&&(e.allowVerticalPlacement&&r.vertical&&(p=Lv(i,r.vertical,I,f.get("icon-text-fit-padding"),m,y)),g&&(i=Lv(i,g,I,f.get("icon-text-fit-padding"),m,y)));let C=c?h.line.getGranularityForZoomLevel(c.z):1,k=(s,h)=>{h.x<0||h.x>=8192||h.y<0||h.y>=8192||function(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_,v,b,x,w,S,T){let P=e.addToLineVertexArray(t,r),E=s.layout.get("symbol-height-offset").evaluate(b,{},S);E>e.maxHeightOffset&&(e.maxHeightOffset=E);let D,A,I,C,k=0,M=0,F=0,R=0,L=-1,z=-1,O={},B=(0,Af.default)("");if(e.allowVerticalPlacement&&i.vertical){let e=s.layout.get("text-rotate").evaluate(b,{},S)+90,r=i.vertical;I=new Qv(l,t,u,c,h,r,d,p,f,e),o&&(C=new Qv(l,t,u,c,h,o,g,y,f,e))}if(n){let r=s.layout.get("icon-rotate").evaluate(b,{}),i="none"!==s.layout.get("icon-text-fit"),a=Hv(n,r,w,i),d=o?Hv(o,r,w,i):void 0;A=new Qv(l,t,u,c,h,n,g,y,!1,r),k=4*a.length;let p=e.iconSizeData,f=null;"source"===p.kind?(f=[128*s.layout.get("icon-size").evaluate(b,{})],f[0]>32640&&_s(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===p.kind&&(f=[128*x.compositeIconSizes[0].evaluate(b,{},S),128*x.compositeIconSizes[1].evaluate(b,{},S)],(f[0]>32640||f[1]>32640)&&_s(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,a,f,v,_,b,0,t,P.lineStartIndex,P.lineLength,-1,S,E),L=e.icon.placedSymbolArray.length-1,d&&(M=4*d.length,e.addSymbols(e.icon,d,f,v,_,b,2,t,P.lineStartIndex,P.lineLength,-1,S,E),z=e.icon.placedSymbolArray.length-1)}let j=Object.keys(i.horizontal);for(let r of j){let n=i.horizontal[r];D||=(B=(0,Af.default)(n.text),new Qv(l,t,u,c,h,n,d,p,f,s.layout.get("text-rotate").evaluate(b,{},S)));let o=1===n.positionedLines.length;if(F+=cb(e,t,n,a,s,f,b,m,E,P,i.vertical?1:3,o?j:[r],O,L,x,S),o)break}i.vertical&&(R+=cb(e,t,i.vertical,a,s,f,b,m,E,P,2,["vertical"],O,z,x,S));let N=D?D.boxStartIndex:e.collisionBoxArray.length,U=D?D.boxEndIndex:e.collisionBoxArray.length,V=I?I.boxStartIndex:e.collisionBoxArray.length,$=I?I.boxEndIndex:e.collisionBoxArray.length,G=A?A.boxStartIndex:e.collisionBoxArray.length,q=A?A.boxEndIndex:e.collisionBoxArray.length,Z=C?C.boxStartIndex:e.collisionBoxArray.length,W=C?C.boxEndIndex:e.collisionBoxArray.length,H=-1,X=(e,t)=>e?.circleDiameter?Math.max(e.circleDiameter,t):t;H=X(D,H),H=X(I,H),H=X(A,H),H=X(C,H);let K=+(H>-1);K&&(H*=T/24),e.glyphOffsetArray.length>=e.maxGlyphs&&_s("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey);let Y=sb(s,b,S),[J,Q]=function(e,t){let r=e.length,i=t?.values;if(i?.length>0)for(let t=0;t<i.length;t+=2){let r=nb[i[t]],n=i[t+1];e.emplaceBack(r,n[0],n[1])}return[r,e.length]}(e.textAnchorOffsets,Y);e.symbolInstances.emplaceBack(t.x,t.y,O.right>=0?O.right:-1,O.center>=0?O.center:-1,O.left>=0?O.left:-1,O.vertical||-1,L,z,B,N,U,V,$,G,q,Z,W,u,F,R,k,M,K,0,d,H,J,Q,E)}(e,h,s,r,i,n,p,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,_,[w,w,w,w],P,l,b,S,E,m,t,a,u,c,o)};if("line"===D)for(let n of Wv(t.geometry,0,0,Oo,Oo)){let t=Xg(n,C),a=qv(t,x,T,r.vertical||g,i,24,v,e.overscaling,Oo);for(let r of a)(!g||!db(e,g.text,A,r))&&k(t,r)}else if("line-center"===D){for(let e of t.geometry)if(e.length>1){let t=Xg(e,C),n=Gv(t,T,r.vertical||g,i,24,v);n&&k(t,n)}}else if("Polygon"===t.type)for(let e of Su(t.geometry,0)){let t=tb(e,16);k(Xg(e[0],C,!0),new jv(t.x,t.y,0))}else if("LineString"===t.type)for(let e of t.geometry){let t=Xg(e,C);k(t,new jv(t[0].x,t[0].y,0))}else if("Point"===t.type)for(let e of t.geometry)for(let t of e)k([t],new jv(t.x,t.y,0))}function cb(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m){let g=function(e,t,r,i,n,a,o,s){let l=i.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,u=[];for(let e of t.positionedLines)for(let i of e.positionedGlyphs){if(!i.rect)continue;let a=i.rect||{},c=4,h=!0,d=1,p=0,f=(n||s)&&i.vertical,m=i.metrics.advance*i.scale/2;if(s&&t.verticalizable){let t=24*(i.scale-1),r=(24-i.metrics.width*i.scale)/2;p=e.lineOffset/2-(i.imageName?-r:t)}if(i.imageName){let e=o[i.imageName];h=e.sdf,d=e.pixelRatio,c=1/d}let g=n?[i.x+m,i.y]:[0,0],y=n?[0,0]:[i.x+m+r[0],i.y+r[1]-p],_=[0,0];f&&(_=y,y=[0,0]);let v=i.metrics.isDoubleResolution?2:1,b=(i.metrics.left-c)*i.scale-m+y[0],x=(-i.metrics.top-c)*i.scale+y[1],w=b+a.w/v*i.scale/d,S=x+a.h/v*i.scale/d,T=new $a(b,x),P=new $a(w,x),E=new $a(b,S),D=new $a(w,S);if(f){let e=new $a(-m,m- -17),t=-Math.PI/2,r=12-m,n=new $a(22-r,-(i.imageName?r:0)),a=new $a(..._);T._rotateAround(t,e)._add(n)._add(a),P._rotateAround(t,e)._add(n)._add(a),E._rotateAround(t,e)._add(n)._add(a),D._rotateAround(t,e)._add(n)._add(a)}if(l){let e=Math.sin(l),t=Math.cos(l),r=[t,-e,e,t];T._matMult(r),P._matMult(r),E._matMult(r),D._matMult(r)}let A=new $a(0,0),I=new $a(0,0);u.push({tl:T,tr:P,bl:E,br:D,tex:a,writingMode:t.writingMode,glyphOffset:g,sectionIndex:i.sectionIndex,isSDF:h,pixelOffsetTL:A,pixelOffsetBR:I,minFontScaleX:0,minFontScaleY:0})}return u}(0,r,s,n,a,o,i,e.allowVerticalPlacement),y=e.textSizeData,_=null;"source"===y.kind?(_=[128*n.layout.get("text-size").evaluate(o,{})],_[0]>32640&&_s(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===y.kind&&(_=[128*f.compositeTextSizes[0].evaluate(o,{},m),128*f.compositeTextSizes[1].evaluate(o,{},m)],(_[0]>32640||_[1]>32640)&&_s(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,_,s,a,o,c,t,u.lineStartIndex,u.lineLength,p,m,l);for(let t of h)d[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function hb(e){for(let t in e)return e[t];return null}function db(e,t,r,i){let n=e.compareText;if(t in n){let e=n[t];for(let t=e.length-1;t>=0;t--)if(i.dist(e[t])<r)return!0}else n[t]=[];return n[t].push(i),!1}function pb(e,t,r){let i="never",n=e.get(t);return n?i=n:e.get(r)&&(i="always"),i}const fb=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function mb(e,t,r,i,n,a,o,s,l,u,c,h,d,p){let f=s?Math.min(32640,Math.round(s[0])):0,m=s?Math.min(32640,Math.round(s[1])):0;e.emplaceBack(t,r,Math.round(32*i),Math.round(32*n),a,o,+!!l+(f<<1),m,16*u,16*c,256*h,256*d,p)}function gb(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function yb(e){for(let t of e.sections)if(V_(t.text))return!0;return!1}var _b=class{constructor(e){this.layoutVertexArray=new lf,this.indexArray=new mf,this.programConfigurations=e,this.segments=new bf,this.dynamicLayoutVertexArray=new uf,this.opacityVertexArray=new cf,this.hasVisibleVertices=!1,this.placedSymbolArray=new Vp}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,o_.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,s_.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,fb,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&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())}};Fd("SymbolBuffers",_b);var vb=class{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new bf,this.collisionVertexArray=new pf}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,l_.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};Fd("CollisionBuffers",vb);var bb=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=zv(this.zoom,t["text-size"]),this.iconSizeData=zv(this.zoom,t["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap="never"!==pb(r,"text-overlap","text-allow-overlap")||"never"!==pb(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==n&&!i.isConstant();let a="viewport-y"===n||"auto"===n&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map(e=>mv[e])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=e.sourceID}createArrays(){this.text=new _b(new Qf(this.layers,this.zoom,e=>e.startsWith("text"))),this.icon=new _b(new Qf(this.layers,this.zoom,e=>e.startsWith("icon"))),this.glyphOffsetArray=new qp,this.lineVertexArray=new Zp,this.symbolInstances=new Gp,this.textAnchorOffsets=new Hp}calculateGlyphDependencies(e,t,r,i,n){let a=(i||this.allowVerticalPlacement)&&n,o=J_.fromFeature(e,r),s=o.graphemes();for(let e=0;e<s.length;e++){let r=o.getSection(e);if("imageName"in r)continue;let i=t[r.fontStack]||={},n=s[e];R_(n)&&(i[n]=!0);for(let e of n){if(i[e]=!0,!a)continue;let t=$_[e];t&&(i[t]=!0)}}}populate(e,t,r){let i=this.layers[0],n=i.layout,a=n.get("text-font"),o=n.get("text-field"),s=n.get("icon-image"),l=("constant"!==o.value.kind||o.value.value instanceof Yl&&!o.value.value.isEmpty()||o.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),u="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,c=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let h=t.iconDependencies,d=t.glyphDependencies,p=t.availableImages,f=new Nd(this.zoom);for(let{feature:t,id:o,index:s,sourceLayerIndex:m}of e){let e,g,y=i._featureFilter.needGeometry,_=nm(t,y);if(!i._featureFilter.filter(f,_,r))continue;if(y||(_.geometry=im(t)),l){let t=i.getValueAndResolveTokens("text-field",_,r,p),n=Yl.factory(t);this.hasRTLText||=yb(n),e=A_(n,i,_)}if(u){let e=i.getValueAndResolveTokens("icon-image",_,r,p);g=e instanceof nu?e:nu.fromString(e)}if(!e&&!g)continue;let v=this.sortFeaturesByKey?c.evaluate(_,{},r):void 0,b={id:o,text:e,icon:g,index:s,sourceLayerIndex:m,geometry:_.geometry,properties:t.properties,type:hy.types[t.type],sortKey:v};if(this.features.push(b),g&&(h[g.name]=!0),e){let t=a.evaluate(_,{},r).join(","),i="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement");this.allowVerticalPlacement=this.writingModes?.includes(2);let o=z_(e.toString());this.calculateGlyphDependencies(e,d,t,i,o);for(let t of e.sections)t.image&&(h[t.image.name]=!0)}}"line"===n.get("symbol-placement")&&(this.features=function(e){let t={},r={},i=[],n=0;function a(t){i.push(e[t]),n++}function o(e,t,n){let a=r[e];return delete r[e],r[t]=a,i[a].geometry[0].pop(),i[a].geometry[0]=i[a].geometry[0].concat(n[0]),a}function s(e,r,n){let a=t[r];return delete t[r],t[e]=a,i[a].geometry[0].shift(),i[a].geometry[0]=n[0].concat(i[a].geometry[0]),a}function l(e,t,r){let i=r?t[0][t[0].length-1]:t[0][0];return`${e}:${i.x}:${i.y}`}for(let u=0;u<e.length;u++){let c=e[u],h=c.geometry,d=c.text?c.text.toString():null;if(!d){a(u);continue}let p=l(d,h),f=l(d,h,!0);if(p in r&&f in t&&r[p]!==t[f]){let e=s(p,f,h),n=o(p,f,i[e].geometry);delete t[p],delete r[f],r[l(d,i[n].geometry,!0)]=n,i[e].geometry=null}else p in r?o(p,f,h):f in t?s(p,f,h):(a(u),t[p]=n-1,r[f]=n-1)}return i.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}))}addFeatures({options:e,canonical:t,glyphMap:r,glyphPositions:i,iconMap:n,iconPositions:a,showCollisionBoxes:o}){!function(e){e.bucket.createArrays();let t=512*e.bucket.overscaling;e.bucket.tilePixelRatio=Oo/t,e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;let r=e.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,a={layoutIconSize:n["icon-size"].possiblyEvaluate(new Nd(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new Nd(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new Nd(18))};if("composite"===e.bucket.textSizeData.kind){let{minZoom:t,maxZoom:r}=e.bucket.textSizeData;a.compositeTextSizes=[n["text-size"].possiblyEvaluate(new Nd(t),e.canonical),n["text-size"].possiblyEvaluate(new Nd(r),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){let{minZoom:t,maxZoom:r}=e.bucket.iconSizeData;a.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new Nd(t),e.canonical),n["icon-size"].possiblyEvaluate(new Nd(r),e.canonical)]}let o=24*i.get("text-line-height"),s="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement"),l=i.get("text-keep-upright"),u=i.get("text-size");for(let t of e.bucket.features){let n=i.get("text-font").evaluate(t,{},e.canonical).join(","),c=u.evaluate(t,{},e.canonical),h=a.layoutTextSize.evaluate(t,{},e.canonical),d=a.layoutIconSize.evaluate(t,{},e.canonical),p={horizontal:{},vertical:void 0},f=t.text,m=[0,0];if(f){let a=f.toString(),u=24*i.get("text-letter-spacing").evaluate(t,{},e.canonical),d=O_(a)?u:0,g=i.get("text-anchor").evaluate(t,{},e.canonical),y=sb(r,t,e.canonical);if(!y){let r=i.get("text-radial-offset").evaluate(t,{},e.canonical);m=r?ob(g,[24*r,ab]):i.get("text-offset").evaluate(t,{},e.canonical).map(e=>24*e)}let _=s?"center":i.get("text-justify").evaluate(t,{},e.canonical),v="point"===i.get("symbol-placement")?24*i.get("text-max-width").evaluate(t,{},e.canonical):1/0,b=()=>{e.bucket.allowVerticalPlacement&&z_(a)&&(p.vertical=bv(f,e.glyphMap,e.glyphPositions,e.imagePositions,n,v,o,g,"left",d,m,2,!0,h,c))};if(!s&&y){let t=new Set;if("auto"===_)for(let e=0;e<y.values.length;e+=2)t.add(lb(y.values[e]));else t.add(_);let r=!1;for(let i of t)if(!p.horizontal[i])if(r)p.horizontal[i]=p.horizontal[0];else{let t=bv(f,e.glyphMap,e.glyphPositions,e.imagePositions,n,v,o,"center",i,d,m,1,!1,h,c);t&&(p.horizontal[i]=t,r=1===t.positionedLines.length)}b()}else{"auto"===_&&(_=lb(g));let t=bv(f,e.glyphMap,e.glyphPositions,e.imagePositions,n,v,o,g,_,d,m,1,!1,h,c);t&&(p.horizontal[_]=t),b(),z_(a)&&s&&l&&(p.vertical=bv(f,e.glyphMap,e.glyphPositions,e.imagePositions,n,v,o,g,_,d,m,2,!1,h,c))}}let g,y=!1;if(t.icon?.name){let r=e.imageMap[t.icon.name];r&&(g=Fv(e.imagePositions[t.icon.name],i.get("icon-offset").evaluate(t,{},e.canonical),i.get("icon-anchor").evaluate(t,{},e.canonical)),y=!!r.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=y:e.bucket.sdfIcons!==y&&_s("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),r.pixelRatio===e.bucket.pixelRatio?0!==i.get("icon-rotate").constantOr(1)&&(e.bucket.iconsNeedLinear=!0):e.bucket.iconsNeedLinear=!0)}let _=hb(p.horizontal)||p.vertical;e.bucket.iconsInText||=!!_&&_.iconsInText,(_||g)&&ub(e.bucket,t,p,g,e.imageMap,a,h,d,m,y,e.canonical,e.subdivisionGranularity)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()}({bucket:this,glyphMap:r,glyphPositions:i,imageMap:n,imagePositions:a,showCollisionBoxes:o,canonical:t,subdivisionGranularity:e.subdivisionGranularity})}isEmpty(){return 0===this.symbolInstances.length}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,t){let r=this.lineVertexArray.length;if(void 0!==e.segment){let r=e.dist(t[e.segment+1]),i=e.dist(t[e.segment]),n={};for(let i=e.segment+1;i<t.length;i++)n[i]={x:t[i].x,y:t[i].y,tileUnitDistanceFromAnchor:r},i<t.length-1&&(r+=t[i+1].dist(t[i]));for(let r=e.segment||0;r>=0;r--)n[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:i},r>0&&(i+=t[r-1].dist(t[r]));for(let e=0;e<t.length;e++){let t=n[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,t,r,i,n,a,o,s,l,u,c,h,d){let p=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*t.length,f,p,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,y=m.vertexLength,_=this.allowVerticalPlacement&&2===o?Math.PI/2:0,v=a.text&&a.text.sections;for(let i=0;i<t.length;i++){let{tl:n,tr:o,bl:l,br:u,tex:c,pixelOffsetTL:g,pixelOffsetBR:y,minFontScaleX:b,minFontScaleY:x,glyphOffset:w,isSDF:S,sectionIndex:T}=t[i],P=m.vertexLength,E=w[1];mb(f,s.x,s.y,n.x,E+n.y,c.x,c.y,r,S,g.x,g.y,b,x,d),mb(f,s.x,s.y,o.x,E+o.y,c.x+c.w,c.y,r,S,y.x,g.y,b,x,d),mb(f,s.x,s.y,l.x,E+l.y,c.x,c.y+c.h,r,S,g.x,y.y,b,x,d),mb(f,s.x,s.y,u.x,E+u.y,c.x+c.w,c.y+c.h,r,S,y.x,y.y,b,x,d),gb(e.dynamicLayoutVertexArray,s,_),p.emplaceBack(P,P+2,P+1),p.emplaceBack(P+1,P+2,P+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(w[0]),(i===t.length-1||T!==t[i+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(f.length,a,a.index,{imagePositions:{},canonical:h,formattedSection:v?.[T]})}e.placedSymbolArray.emplaceBack(s.x,s.y,g,this.glyphOffsetArray.length-g,y,l,u,s.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],o,0,!1,0,c,d)}_addCollisionDebugVertex(e,t,r,i,n,a){return t.emplaceBack(0,0),e.emplaceBack(r.x,r.y,i,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,r,i,n,a,o){let s=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),l=s.vertexLength,u=n.layoutVertexArray,c=n.collisionVertexArray,h=o.anchorX,d=o.anchorY;this._addCollisionDebugVertex(u,c,a,h,d,new $a(e,t)),this._addCollisionDebugVertex(u,c,a,h,d,new $a(r,t)),this._addCollisionDebugVertex(u,c,a,h,d,new $a(r,i)),this._addCollisionDebugVertex(u,c,a,h,d,new $a(e,i)),s.vertexLength+=4;let p=n.indexArray;p.emplaceBack(l,l+1),p.emplaceBack(l+1,l+2),p.emplaceBack(l+2,l+3),p.emplaceBack(l+3,l),s.primitiveLength+=4}addDebugCollisionBoxes(e,t,r,i){for(let n=e;n<t;n++){let e=this.collisionBoxArray.get(n),t=e.x1,a=e.y1,o=e.x2,s=e.y2;this.addCollisionDebugVertices(t,a,o,s,i?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new vb(hf,u_.members,gf),this.iconCollisionBox=new vb(hf,u_.members,gf);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,r,i,n,a,o,s,l){let u={};for(let i=t;i<r;i++){let t=e.get(i);u.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},u.textFeatureIndex=t.featureIndex;break}for(let t=i;t<n;t++){let r=e.get(t);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let t=a;t<o;t++){let r=e.get(t);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let t=s;t<l;t++){let r=e.get(t);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.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,t){let r=e.placedSymbolArray.get(t),i=r.vertexStartIndex+4*r.numGlyphs;for(let t=r.vertexStartIndex;t<i;t+=4)e.indexArray.emplaceBack(t,t+2,t+1),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let t=Math.sin(e),r=Math.cos(e),i=[],n=[],a=[];for(let e=0;e<this.symbolInstances.length;++e){a.push(e);let o=this.symbolInstances.get(e);i.push(0|Math.round(t*o.anchorX+r*o.anchorY)),n.push(o.featureIndex)}return a.sort((e,t)=>i[e]-i[t]||n[t]-n[e]),a}addToSortKeyRanges(e,t){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r?.sortKey===t?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);let r=[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex];for(let e=0;e<r.length;e++){let t=r[e];t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};let xb,wb;Fd("SymbolBucket",bb,{omit:["layers","collisionBoxArray","features","compareText"]});var Sb={get paint(){return wb||=new rp({"icon-opacity":new Jd(el.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new Jd(el.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new Jd(el.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new Jd(el.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new Jd(el.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new Yd(el.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new Yd(el.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new Jd(el.paint_symbol["text-opacity"],"text-opacity"),"text-color":new Jd(el.paint_symbol["text-color"],"text-color",{runtimeType:sl,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Jd(el.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new Jd(el.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new Jd(el.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new Yd(el.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new Yd(el.paint_symbol["text-translate-anchor"],"text-translate-anchor")})},get layout(){return xb||=new rp({"symbol-placement":new Yd(el.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new Yd(el.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new Yd(el.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new Jd(el.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new Yd(el.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new Yd(el.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new Yd(el.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new Yd(el.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new Yd(el.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new Jd(el.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new Jd(el.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new Yd(el.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new Yd(el.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new Jd(el.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new Jd(el.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new Jd(el.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new Yd(el.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new Jd(el.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new Jd(el.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new Yd(el.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new Yd(el.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new Yd(el.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new Jd(el.layout_symbol["text-field"],"text-field"),"text-font":new Jd(el.layout_symbol["text-font"],"text-font"),"text-size":new Jd(el.layout_symbol["text-size"],"text-size"),"text-max-width":new Jd(el.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new Yd(el.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new Jd(el.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new Jd(el.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new Jd(el.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new Yd(el.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new Jd(el.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new Jd(el.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new Yd(el.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new Yd(el.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new Jd(el.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new Yd(el.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new Yd(el.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new Jd(el.layout_symbol["text-transform"],"text-transform"),"text-offset":new Jd(el.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new Yd(el.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new Yd(el.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new Yd(el.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new Yd(el.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new Jd(el.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new Yd(el.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")})}},Tb=class{constructor(e){if(void 0===e.property.overrides)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:il,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t?.hasOverride(e.formattedSection))return t.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}};Fd("FormatSectionOverride",Tb,{omit:["defaultValue"]});const Pb=e=>"symbol"===e.type;var Eb=class e extends ap{constructor(e,t){super(e,Sb,t)}recalculate(e,t){super.recalculate(e,t);let r=this.layout.get("icon-rotation-alignment");if(("constant"!==r.value.kind||"auto"===r.value.value)&&(this.layout._values["icon-rotation-alignment"]=new Wd(r.property,{kind:"constant",value:"point"===this.layout.get("symbol-placement")?"viewport":"map"},r.parameters)),"auto"===this.layout.get("text-rotation-alignment")&&("point"===this.layout.get("symbol-placement")?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),"point"===this.layout.get("symbol-placement")){let e=this.layout.get("text-writing-mode");if(e){let t=[];for(let r of e)t.includes(r)||t.push(r);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,r,i){let n=this.layout.get(e).evaluate(t,{},r,i),a=this._unevaluatedLayout._values[e];return a.isDataDriven()||mh(a.value)||!n?n:function(e,t){return t.replace(/{([^{}]+)}/g,(t,r)=>e&&r in e?String(e[r]):"")}(t.properties,n)}createBucket(e){return new bb(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of Sb.paint.overridableProperties){if(!e.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),i=new dh(new Tb(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),n=null;n="constant"===r.value.kind||"source"===r.value.kind?new yh("source",i):new _h("composite",i,r.value.zoomStops),this.paint._values[t]=new Wd(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,i){return!(!this.layout||r.isDataDriven()||i.isDataDriven())&&e.hasPaintOverride(this.layout,t)}static hasPaintOverride(e,t){let r=e.get("text-field"),i=Sb.paint.properties[t],n=!1,a=e=>{for(let t of e)if(i.overrides?.hasOverride(t))return void(n=!0)};if("constant"===r.value.kind&&r.value.value instanceof Yl)a(r.value.value.sections);else if("source"===r.value.kind||"composite"===r.value.kind){let e=t=>{if(!n)if(t instanceof hu&&uu(t.value)===dl){let e=t.value;a(e.sections)}else t instanceof vu?a(t.sections):t.eachChild(e)},t=r.value;t._styleExpression&&e(t._styleExpression.expression)}return n}};let Db;var Ab={get paint(){return Db||=new rp({"background-color":new Yd(el.paint_background["background-color"],"background-color"),"background-pattern":new ep(el.paint_background["background-pattern"],"background-pattern"),"background-opacity":new Yd(el.paint_background["background-opacity"],"background-opacity")})}},Ib=class extends ap{constructor(e,t){super(e,Ab,t)}},Cb=class extends ap{constructor(e,t){super(e,{},t),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function kb(e,t){if("custom"===e.type)return new Cb(e,t);switch(e.type){case"background":return new Ib(e,t);case"circle":return new Mm(e,t);case"color-relief":return new Qm(e,t);case"fill":return new iy(e,t);case"fill-extrusion":return new Gy(e,t);case"heatmap":return new $m(e,t);case"hillshade":return new Zm(e,t);case"line":return new n_(e,t);case"raster":return new up(e,t);case"symbol":return new Eb(e,t)}}var Mb=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){this._triggered||(this._triggered=!0,this._channel?.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};const Fb={once:!0};var Rb=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Mb(()=>this.process()),this.subscription=Ss(this.target,"message",e=>this.receive(e),!1),this.globalScope=bs(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((r,i)=>{let n=Math.round(1e18*Math.random()).toString(36).substring(0,10),a=t?Ss(t.signal,"abort",()=>{a?.unsubscribe(),delete this.resolveRejects[n];let r={id:n,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(r),i(new zs(t.signal.reason))},Fb):null;this.resolveRejects[n]={resolve:e=>{a?.unsubscribe(),r(e)},reject:e=>{a?.unsubscribe(),i(e)}};let o=[],s={...e,id:n,sourceMapId:this.mapId,origin:location.origin,data:Od(e.data,o)};this.target.postMessage(s,{transfer:o})})}receive(e){let t=e.data,r=t.id,i=["file://","resource://android","null"],n=[t.origin,location.origin],a=t.origin===location.origin,o=n.some(e=>i.includes(e));if((a||o)&&(!t.targetMapId||this.mapId===t.targetMapId)){if("<cancel>"===t.type){delete this.tasks[r];let e=this.abortControllers[r];return delete this.abortControllers[r],void(e&&e.abort())}if(bs(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(0===this.taskQueue.length)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if("<response>"===t.type){let r=this.resolveRejects[e];if(delete this.resolveRejects[e],!r)return;return void(t.error?r.reject(jo(Bd(t.error))):r.resolve(Bd(t.data)))}if(!this.messageHandlers[t.type])return void this.completeTask(e,null,null);let r=Bd(t.data),i=new AbortController;this.abortControllers[e]=i;try{let n=await this.messageHandlers[t.type](t.sourceMapId,r,i);this.completeTask(e,null,n)}catch(t){this.completeTask(e,jo(t))}}completeTask(e,t,r){let i=[];delete this.abortControllers[e];let n={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Od(t):null,data:Od(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function Lb(e,t){let{x:r,y:i}=Dy.fromLngLat(t);return!(e<0||e>25||i<0||i>=1||r<0||r>=1)}var zb=class{constructor(e,t,r){if(!function(e,t,r){return!(e<0||e>25||r<0||r>=2**e||t<0||t>=2**e)}(e,t,r))throw Error(`x=${t}, y=${r}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=r,this.key=jb(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,r){let i=function(e,t,r){let i=Ub(256*e,256*(t=2**r-t-1),r),n=Ub(256*(e+1),256*(t+1),r);return`${i[0]},${i[1]},${n[0]},${n[1]}`}(this.x,this.y,this.z),n=function(e,t,r){let i="";for(let n=e;n>0;n--){let e=1<<n-1;i+=(t&e?1:0)+(r&e?2:0)}return i}(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("tms"===r?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new $a((e.x*t-this.x)*Oo,(e.y*t-this.y)*Oo)}toString(){return`${this.z}/${this.x}/${this.y}`}},Ob=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=jb(e,t.z,t.z,t.x,t.y)}},Bb=class e{constructor(e,t,r,i,n){if(this.terrainRttPosMatrix32f=null,e<r)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${r}`);this.overscaledZ=e,this.wrap=t,this.canonical=new zb(r,+i,+n),this.key=jb(t,e,r,i,n)}clone(){return new e(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(t){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?new e(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new e(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,t){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?jb(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):jb(this.wrap*+t,e,e,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(0===e.overscaledZ)return this.overscaledZ>0;let t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(t){if(this.overscaledZ>=t)return[new e(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=2*this.canonical.x,n=2*this.canonical.y;return[new e(r,this.wrap,r,i,n),new e(r,this.wrap,r,i+1,n),new e(r,this.wrap,r,i,n+1),new e(r,this.wrap,r,i+1,n+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 e(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new e(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Ob(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Dy(e.x-this.wrap,e.y))}normalizeCoordinates(t,r,i=8192){if(t>=0&&t<i&&r>=0&&r<i)return{tileID:this,x:t,y:r};let n=Math.floor(t/i),a=Math.floor(r/i),o=t-n*i,s=r-a*i,l=this.canonical.z,u=1<<l,c=this.canonical.y+a;if(c<0||c>=u)return null;let h=this.canonical.x+n,d=this.wrap;return h<0?(d-=Math.ceil(-h/u),h=(h%u+u)%u):h>=u&&(d+=Math.floor(h/u),h%=u),{tileID:new e(this.overscaledZ,d,l,h,c),x:o,y:s}}};function jb(e,t,r,i,n){(e*=2)<0&&(e=-1*e-1);let a=1<<r;return(a*a*e+a*n+i).toString(36)+r.toString(36)+t.toString(36)}const Nb=6378137*Math.PI;function Ub(e,t,r){let i=2*Nb/256/2**r;return[e*i-Nb,t*i-Nb]}function Vb(e,t){let r=Math.abs(2*e.wrap)-+(e.wrap<0),i=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||i-r||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}Fd("CanonicalTileID",zb),Fd("OverscaledTileID",Bb,{omit:["terrainRttPosMatrix32f"]});const $b="_geojsonTileLayer";var Gb=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}},qb=class{constructor(e,t,r,i,n){this.type="Feature",this._vectorTileFeature=e,this._x=r,this._y=i,this._z=t;for(let t in e.properties)"string"==typeof e.properties[t]&&e.properties[t].startsWith("__$json__:")&&(e.properties[t]=JSON.parse(e.properties[t].slice(10)));this.properties=e.properties,this.id=n}projectPoint(e,t,r,i){return[360*(e.x+t)/i-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+r)/i)*Math.PI))-90]}projectLine(e,t,r,i){return e.map(e=>this.projectPoint(e,t,r,i))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*2**this._z,r=e.extent*this._x,i=e.extent*this._y,n=e.loadGeometry();switch(e.type){case 1:{let e=[];for(let t of n)e.push(t[0]);let a=this.projectLine(e,r,i,t);this._geometry=1===e.length?{type:"Point",coordinates:a[0]}:{type:"MultiPoint",coordinates:a};break}case 2:{let e=n.map(e=>this.projectLine(e,r,i,t));this._geometry=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e};break}case 3:{let e=dy(n),a=[];for(let n of e)a.push(n.map(e=>this.projectLine(e,r,i,t)));this._geometry=1===a.length?{type:"Polygon",coordinates:a[0]}:{type:"MultiPolygon",coordinates:a};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&"_x"!==t&&"_y"!==t&&"_z"!==t&&(e[t]=this[t]);return e}},Zb=class{constructor(e,t,r){this._name=e,this.dataBuffer=t,"number"==typeof r?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},Wb=class extends Zb{},Hb=class extends Wb{getValueFromBuffer(e){return this.dataBuffer[e]}},Xb=class extends Wb{getValueFromBuffer(e){return this.dataBuffer[e]}},Kb=class extends Zb{constructor(e,t,r,i){super(e,t,i),this.delta=r}},Yb=class extends Kb{constructor(e,t,r,i,n){super(e,n?Int32Array.of(t):Uint32Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}},Jb=class extends Zb{constructor(e,t,r,i){super(e,i?Int32Array.of(t):Uint32Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}},Qb=class{constructor(e,t,r,i,n=4096){if(this._name=e,this._geometryVector=t,this._idVector=r,this._propertyVectors=i,this._extent=n,0===e.length)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(e){return this.propertyVectorsMap||=new Map(this.propertyVectors.map(e=>[e.name,e])),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;if(this.idVector){let e=this.idVector.getValue(r);null!==e&&(i=this.containsMaxSafeIntegerValues(this.idVector)?Number(e):e)}let n={coordinates:t[r],type:this.geometryVector.geometryType(r)},a={};for(let e of this.propertyVectors){if(!e)continue;let t=e.name,i=e.getValue(r);null!==i&&(a[t]=i)}e.push({id:i,geometry:n,properties:a})}return e}containsMaxSafeIntegerValues(e){return e instanceof Hb||e instanceof Jb||e instanceof Yb||e instanceof Xb}};var ex,tx,rx=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}};!function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON"}(ex||={}),function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT"}(tx||={});const ix=new Uint32Array(33);ix[0]=0;for(let e=1;e<=32;e++)ix[e]=32===e?4294967295:4294967295>>>32-e;const nx=ix;function ax(e,t){return e-e%t}function ox(e){return ax(e+31,32)}function sx(e){let t=e>>>0;return((255&t)<<24|(65280&t)<<8|t>>>8&65280|t>>>24&255)>>>0}const lx=function(e){if(!Number.isFinite(e))return 65536;let t=ax(Math.floor(e),256);return 0===t?256:t}(65536),ux=3*lx/256+lx|0;function cx(){let e=new Uint8Array(ux);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function hx(e,t,r,i,n){switch(n){case 1:!function(e,t,r,i){let n=i,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0;r[n++]=t>>>0&1,r[n++]=t>>>1&1,r[n++]=t>>>2&1,r[n++]=t>>>3&1,r[n++]=t>>>4&1,r[n++]=t>>>5&1,r[n++]=t>>>6&1,r[n++]=t>>>7&1,r[n++]=t>>>8&1,r[n++]=t>>>9&1,r[n++]=t>>>10&1,r[n++]=t>>>11&1,r[n++]=t>>>12&1,r[n++]=t>>>13&1,r[n++]=t>>>14&1,r[n++]=t>>>15&1,r[n++]=t>>>16&1,r[n++]=t>>>17&1,r[n++]=t>>>18&1,r[n++]=t>>>19&1,r[n++]=t>>>20&1,r[n++]=t>>>21&1,r[n++]=t>>>22&1,r[n++]=t>>>23&1,r[n++]=t>>>24&1,r[n++]=t>>>25&1,r[n++]=t>>>26&1,r[n++]=t>>>27&1,r[n++]=t>>>28&1,r[n++]=t>>>29&1,r[n++]=t>>>30&1,r[n++]=t>>>31&1}}(e,t,r,i);break;case 2:!function(e,t,r,i){let n=i,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,i=e[a++]>>>0;r[n++]=t>>>0&3,r[n++]=t>>>2&3,r[n++]=t>>>4&3,r[n++]=t>>>6&3,r[n++]=t>>>8&3,r[n++]=t>>>10&3,r[n++]=t>>>12&3,r[n++]=t>>>14&3,r[n++]=t>>>16&3,r[n++]=t>>>18&3,r[n++]=t>>>20&3,r[n++]=t>>>22&3,r[n++]=t>>>24&3,r[n++]=t>>>26&3,r[n++]=t>>>28&3,r[n++]=t>>>30&3,r[n++]=i>>>0&3,r[n++]=i>>>2&3,r[n++]=i>>>4&3,r[n++]=i>>>6&3,r[n++]=i>>>8&3,r[n++]=i>>>10&3,r[n++]=i>>>12&3,r[n++]=i>>>14&3,r[n++]=i>>>16&3,r[n++]=i>>>18&3,r[n++]=i>>>20&3,r[n++]=i>>>22&3,r[n++]=i>>>24&3,r[n++]=i>>>26&3,r[n++]=i>>>28&3,r[n++]=i>>>30&3}}(e,t,r,i);break;case 3:!function(e,t,r,i){let n=i,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,i=e[a++]>>>0,o=e[a++]>>>0;r[n++]=t>>>0&7,r[n++]=t>>>3&7,r[n++]=t>>>6&7,r[n++]=t>>>9&7,r[n++]=t>>>12&7,r[n++]=t>>>15&7,r[n++]=t>>>18&7,r[n++]=t>>>21&7,r[n++]=t>>>24&7,r[n++]=t>>>27&7,r[n++]=7&(t>>>30|(1&i)<<2),r[n++]=i>>>1&7,r[n++]=i>>>4&7,r[n++]=i>>>7&7,r[n++]=i>>>10&7,r[n++]=i>>>13&7,r[n++]=i>>>16&7,r[n++]=i>>>19&7,r[n++]=i>>>22&7,r[n++]=i>>>25&7,r[n++]=i>>>28&7,r[n++]=7&(i>>>31|(3&o)<<1),r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n++]=o>>>29&7}}(e,t,r,i);break;case 4:!function(e,t,r,i){let n=i,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,i=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0;r[n++]=t>>>0&15,r[n++]=t>>>4&15,r[n++]=t>>>8&15,r[n++]=t>>>12&15,r[n++]=t>>>16&15,r[n++]=t>>>20&15,r[n++]=t>>>24&15,r[n++]=t>>>28&15,r[n++]=i>>>0&15,r[n++]=i>>>4&15,r[n++]=i>>>8&15,r[n++]=i>>>12&15,r[n++]=i>>>16&15,r[n++]=i>>>20&15,r[n++]=i>>>24&15,r[n++]=i>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15}}(e,t,r,i);break;case 5:!function(e,t,r,i){let n=i,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,i=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,l=e[a++]>>>0;r[n++]=t>>>0&31,r[n++]=t>>>5&31,r[n++]=t>>>10&31,r[n++]=t>>>15&31,r[n++]=t>>>20&31,r[n++]=t>>>25&31,r[n++]=31&(t>>>30|(7&i)<<2),r[n++]=i>>>3&31,r[n++]=i>>>8&31,r[n++]=i>>>13&31,r[n++]=i>>>18&31,r[n++]=i>>>23&31,r[n++]=31&(i>>>28|(1&o)<<4),r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>26&31,r[n++]=31&(o>>>31|(15&s)<<1),r[n++]=s>>>4&31,r[n++]=s>>>9&31,r[n++]=s>>>14&31,r[n++]=s>>>19&31,r[n++]=s>>>24&31,r[n++]=31&(s>>>29|(3&l)<<3),r[n++]=l>>>2&31,r[n++]=l>>>7&31,r[n++]=l>>>12&31,r[n++]=l>>>17&31,r[n++]=l>>>22&31,r[n++]=l>>>27&31}}(e,t,r,i);break;case 6:!function(e,t,r,i){let n=i,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,i=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0;r[n++]=t>>>0&63,r[n++]=t>>>6&63,r[n++]=t>>>12&63,r[n++]=t>>>18&63,r[n++]=t>>>24&63,r[n++]=63&(t>>>30|(15&i)<<2),r[n++]=i>>>4&63,r[n++]=i>>>10&63,r[n++]=i>>>16&63,r[n++]=i>>>22&63,r[n++]=63&(i>>>28|(3&o)<<4),r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=s>>>0&63,r[n++]=s>>>6&63,r[n++]=s>>>12&63,r[n++]=s>>>18&63,r[n++]=s>>>24&63,r[n++]=63&(s>>>30|(15&l)<<2),r[n++]=l>>>4&63,r[n++]=l>>>10&63,r[n++]=l>>>16&63,r[n++]=l>>>22&63,r[n++]=63&(l>>>28|(3&u)<<4),r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63}}(e,t,r,i);break;case 7:!function(e,t,r,i){let n=i,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,i=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,c=e[a++]>>>0;r[n++]=t>>>0&127,r[n++]=t>>>7&127,r[n++]=t>>>14&127,r[n++]=t>>>21&127,r[n++]=127&(t>>>28|(7&i)<<4),r[n++]=i>>>3&127,r[n++]=i>>>10&127,r[n++]=i>>>17&127,r[n++]=i>>>24&127,r[n++]=127&(i>>>31|(63&o)<<1),r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=127&(o>>>27|(3&s)<<5),r[n++]=s>>>2&127,r[n++]=s>>>9&127,r[n++]=s>>>16&127,r[n++]=s>>>23&127,r[n++]=127&(s>>>30|(31&l)<<2),r[n++]=l>>>5&127,r[n++]=l>>>12&127,r[n++]=l>>>19&127,r[n++]=127&(l>>>26|(1&u)<<6),r[n++]=u>>>1&127,r[n++]=u>>>8&127,r[n++]=u>>>15&127,r[n++]=u>>>22&127,r[n++]=127&(u>>>29|(15&c)<<3),r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n++]=c>>>25&127}}(e,t,r,i);break;case 8:!function(e,t,r,i){let n=i,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,i=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,c=e[a++]>>>0,h=e[a++]>>>0;r[n++]=t>>>0&255,r[n++]=t>>>8&255,r[n++]=t>>>16&255,r[n++]=t>>>24&255,r[n++]=i>>>0&255,r[n++]=i>>>8&255,r[n++]=i>>>16&255,r[n++]=i>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255}}(e,t,r,i);break;case 16:!function(e,t,r,i){let n=i,a=t;for(let t=0;t<128;t++){let t=e[a++]>>>0;r[n++]=65535&t,r[n++]=t>>>16&65535}}(e,t,r,i);break;default:!function(e,t,r,i,n){let a=nx[n]>>>0,o=t,s=0,l=e[o]>>>0,u=i;for(let t=0;t<8;t++){for(let t=0;t<32;t++)if(s+n<=32){let i=l>>>s&a;r[u+t]=0|i,s+=n,32===s&&(s=0,o++,31!==t&&(l=e[o]>>>0))}else{let i=32-s,c=l>>>s;o++,l=e[o]>>>0;let h=n-i,d=(c|(l&-1>>>32-h>>>0)<<i)&a;r[u+t]=0|d,s=h}u+=32,s=0,t<7&&(l=e[o]>>>0)}}(e,t,r,i,n)}return t+(n<<3)|0}function dx(e,t,r,i){if(r+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${t})`);let n=e[r++],a=e[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:r}}function px(e,t,r,i,n,a,o,s,l){let{maxBits:u,exceptionBitWidth:c,bytePosIn:h}=function(e,t,r,i,n,a){if(r+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${t})`);let o=e[r++];if(o<i||o>32)throw Error(`FastPFOR decode: invalid maxBits=${o} at block=${a} (bitWidth=${i}, expected ${i}..32)`);let s=o-i|0;if(s<1||s>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${s} at block=${a} (bitWidth=${i}, maxBits=${o})`);if(r+n>t)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${t-r})`);return{maxBits:o,exceptionBitWidth:s,bytePosIn:r}}(n,a,o,r,i,l);if(o=h,1===c){let a=1<<r;for(let r=0;r<i;r=r+1|0)e[n[o++]+t|0]|=a;return o}let d=s.dataToBePacked[c];if(!d)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${c} (bitWidth=${r}, maxBits=${u}) at block ${l}`);let p=s.dataPointers,f=0|p[c],m=0|s.exceptionSizes[c];if(f+i>m)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${c} (ptr=${f}, need ${i}, size=${m}) at block ${l}`);for(let a=0;a<i;a=a+1|0){let i=n[o++],a=0|d[f++];e[i+t|0]|=a<<r}return p[c]=f,o}function fx(e,t,r,i,n,a){let o=0|r,s=0|e[o];if(s<=0||o+s>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${s} at pageStart=${o} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let l=o+1|0,u=o+s|0,c=e[u]>>>0,h=c+3>>>2,d=u+1,p=d+h;if(p>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${c} (metaInts=${h}, pageStart=${o}, packedEnd=${u}, byteContainerStart=${d}) causes bitmapPos=${p} out of bounds (encoded.length=${e.length})`);let f=function(e,t,r,i){i.byteContainer.length<r&&(i.byteContainer=new Uint8Array(2*r),i.byteContainerI32=void 0);let n=i.byteContainer,a=r>>>2;if(3&n.byteOffset)for(let r=0;r<a;r=r+1|0){let i=0|e[t+r|0],a=r<<2;n[a]=255&i,n[a+1|0]=i>>>8&255,n[a+2|0]=i>>>16&255,n[a+3|0]=i>>>24&255}else{let r=i.byteContainerI32;(!r||r.buffer!==n.buffer||r.byteOffset!==n.byteOffset||r.length<a)&&(r=i.byteContainerI32=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>>2)),r.set(e.subarray(t,t+a))}let o=3&r;if(o>0){let r=0|e[t+a|0],i=a<<2;for(let e=0;e<o;e=e+1|0)n[i+e|0]=r>>>(e<<3)&255}return n}(e,d,c,a),m=c,g=function(e,t,r){let i=0|e[t++],n=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(i>>>a-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let o=e[t++]>>>0,s=ox(o),l=o*a+31>>>5;if(t+l>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${o}, streamWordIndex=${t}, needWords=${l}, availableWords=${e.length-t}, encodedWords=${e.length})`);let u=n[a];(!u||u.length<s)&&(u=n[a]=new Uint32Array(s));let c=0;for(;c<o;c=c+32|0)mx(e,t,u,c,a),t=t+a|0;t=t-((c-o|0)*a>>>5)|0,r.exceptionSizes[a]=o}return t}(e,p,a);return a.dataPointers.fill(0),function(e,t,r,i,n,a,o,s,l,u){let c=0|r,h=0;for(let t=0;t<o;t=t+1|0){let r=dx(s,l,h,t);h=r.bytePosIn;let i=r.bitWidth,o=r.exceptionCount,d=a+256*t|0;switch(i){case 0:n.fill(0,d,d+256);break;case 32:for(let t=0;t<256;t=t+1|0)n[d+t|0]=0|e[c+t|0];c=c+256|0;break;default:c=hx(e,c,n,d,i)}o>0&&(h=px(n,d,i,o,s,l,h,u,t))}if(c!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${r}, consumedPackedEnd=${c}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${e.length})`)}(e,o,l,u,t,0|i,n/256|0,f,m,a),g}function mx(e,t,r,i,n){switch(n){case 2:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0;r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3,r[n++]=o>>>0&3,r[n++]=o>>>2&3,r[n++]=o>>>4&3,r[n++]=o>>>6&3,r[n++]=o>>>8&3,r[n++]=o>>>10&3,r[n++]=o>>>12&3,r[n++]=o>>>14&3,r[n++]=o>>>16&3,r[n++]=o>>>18&3,r[n++]=o>>>20&3,r[n++]=o>>>22&3,r[n++]=o>>>24&3,r[n++]=o>>>26&3,r[n++]=o>>>28&3,r[n]=o>>>30&3}(e,t,r,i);case 3:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0;r[n++]=a>>>0&7,r[n++]=a>>>3&7,r[n++]=a>>>6&7,r[n++]=a>>>9&7,r[n++]=a>>>12&7,r[n++]=a>>>15&7,r[n++]=a>>>18&7,r[n++]=a>>>21&7,r[n++]=a>>>24&7,r[n++]=a>>>27&7,r[n++]=7&(a>>>30|(1&o)<<2),r[n++]=o>>>1&7,r[n++]=o>>>4&7,r[n++]=o>>>7&7,r[n++]=o>>>10&7,r[n++]=o>>>13&7,r[n++]=o>>>16&7,r[n++]=o>>>19&7,r[n++]=o>>>22&7,r[n++]=o>>>25&7,r[n++]=o>>>28&7,r[n++]=7&(o>>>31|(3&s)<<1),r[n++]=s>>>2&7,r[n++]=s>>>5&7,r[n++]=s>>>8&7,r[n++]=s>>>11&7,r[n++]=s>>>14&7,r[n++]=s>>>17&7,r[n++]=s>>>20&7,r[n++]=s>>>23&7,r[n++]=s>>>26&7,r[n]=s>>>29&7}(e,t,r,i);case 4:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0;r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n]=l>>>28&15}(e,t,r,i);case 5:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0;r[n++]=a>>>0&31,r[n++]=a>>>5&31,r[n++]=a>>>10&31,r[n++]=a>>>15&31,r[n++]=a>>>20&31,r[n++]=a>>>25&31,r[n++]=31&(a>>>30|(7&o)<<2),r[n++]=o>>>3&31,r[n++]=o>>>8&31,r[n++]=o>>>13&31,r[n++]=o>>>18&31,r[n++]=o>>>23&31,r[n++]=31&(o>>>28|(1&s)<<4),r[n++]=s>>>1&31,r[n++]=s>>>6&31,r[n++]=s>>>11&31,r[n++]=s>>>16&31,r[n++]=s>>>21&31,r[n++]=s>>>26&31,r[n++]=31&(s>>>31|(15&l)<<1),r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=31&(l>>>29|(3&u)<<3),r[n++]=u>>>2&31,r[n++]=u>>>7&31,r[n++]=u>>>12&31,r[n++]=u>>>17&31,r[n++]=u>>>22&31,r[n]=u>>>27&31}(e,t,r,i);case 6:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0;r[n++]=a>>>0&63,r[n++]=a>>>6&63,r[n++]=a>>>12&63,r[n++]=a>>>18&63,r[n++]=a>>>24&63,r[n++]=63&(a>>>30|(15&o)<<2),r[n++]=o>>>4&63,r[n++]=o>>>10&63,r[n++]=o>>>16&63,r[n++]=o>>>22&63,r[n++]=63&(o>>>28|(3&s)<<4),r[n++]=s>>>2&63,r[n++]=s>>>8&63,r[n++]=s>>>14&63,r[n++]=s>>>20&63,r[n++]=s>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=63&(l>>>30|(15&u)<<2),r[n++]=u>>>4&63,r[n++]=u>>>10&63,r[n++]=u>>>16&63,r[n++]=u>>>22&63,r[n++]=63&(u>>>28|(3&c)<<4),r[n++]=c>>>2&63,r[n++]=c>>>8&63,r[n++]=c>>>14&63,r[n++]=c>>>20&63,r[n]=c>>>26&63}(e,t,r,i);case 7:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0;r[n++]=a>>>0&127,r[n++]=a>>>7&127,r[n++]=a>>>14&127,r[n++]=a>>>21&127,r[n++]=127&(a>>>28|(7&o)<<4),r[n++]=o>>>3&127,r[n++]=o>>>10&127,r[n++]=o>>>17&127,r[n++]=o>>>24&127,r[n++]=127&(o>>>31|(63&s)<<1),r[n++]=s>>>6&127,r[n++]=s>>>13&127,r[n++]=s>>>20&127,r[n++]=127&(s>>>27|(3&l)<<5),r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=127&(l>>>30|(31&u)<<2),r[n++]=u>>>5&127,r[n++]=u>>>12&127,r[n++]=u>>>19&127,r[n++]=127&(u>>>26|(1&c)<<6),r[n++]=c>>>1&127,r[n++]=c>>>8&127,r[n++]=c>>>15&127,r[n++]=c>>>22&127,r[n++]=127&(c>>>29|(15&h)<<3),r[n++]=h>>>4&127,r[n++]=h>>>11&127,r[n++]=h>>>18&127,r[n]=h>>>25&127}(e,t,r,i);case 8:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0;r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n]=d>>>24&255}(e,t,r,i);case 9:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0;r[n++]=a>>>0&511,r[n++]=a>>>9&511,r[n++]=a>>>18&511,r[n++]=511&(a>>>27|(15&o)<<5),r[n++]=o>>>4&511,r[n++]=o>>>13&511,r[n++]=o>>>22&511,r[n++]=511&(o>>>31|(255&s)<<1),r[n++]=s>>>8&511,r[n++]=s>>>17&511,r[n++]=511&(s>>>26|(7&l)<<6),r[n++]=l>>>3&511,r[n++]=l>>>12&511,r[n++]=l>>>21&511,r[n++]=511&(l>>>30|(127&u)<<2),r[n++]=u>>>7&511,r[n++]=u>>>16&511,r[n++]=511&(u>>>25|(3&c)<<7),r[n++]=c>>>2&511,r[n++]=c>>>11&511,r[n++]=c>>>20&511,r[n++]=511&(c>>>29|(63&h)<<3),r[n++]=h>>>6&511,r[n++]=h>>>15&511,r[n++]=511&(h>>>24|(1&d)<<8),r[n++]=d>>>1&511,r[n++]=d>>>10&511,r[n++]=d>>>19&511,r[n++]=511&(d>>>28|(31&p)<<4),r[n++]=p>>>5&511,r[n++]=p>>>14&511,r[n]=p>>>23&511}(e,t,r,i);case 10:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0;r[n++]=a>>>0&1023,r[n++]=a>>>10&1023,r[n++]=a>>>20&1023,r[n++]=1023&(a>>>30|(255&o)<<2),r[n++]=o>>>8&1023,r[n++]=o>>>18&1023,r[n++]=1023&(o>>>28|(63&s)<<4),r[n++]=s>>>6&1023,r[n++]=s>>>16&1023,r[n++]=1023&(s>>>26|(15&l)<<6),r[n++]=l>>>4&1023,r[n++]=l>>>14&1023,r[n++]=1023&(l>>>24|(3&u)<<8),r[n++]=u>>>2&1023,r[n++]=u>>>12&1023,r[n++]=u>>>22&1023,r[n++]=c>>>0&1023,r[n++]=c>>>10&1023,r[n++]=c>>>20&1023,r[n++]=1023&(c>>>30|(255&h)<<2),r[n++]=h>>>8&1023,r[n++]=h>>>18&1023,r[n++]=1023&(h>>>28|(63&d)<<4),r[n++]=d>>>6&1023,r[n++]=d>>>16&1023,r[n++]=1023&(d>>>26|(15&p)<<6),r[n++]=p>>>4&1023,r[n++]=p>>>14&1023,r[n++]=1023&(p>>>24|(3&f)<<8),r[n++]=f>>>2&1023,r[n++]=f>>>12&1023,r[n]=f>>>22&1023}(e,t,r,i);case 11:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0;r[n++]=a>>>0&2047,r[n++]=a>>>11&2047,r[n++]=2047&(a>>>22|(1&o)<<10),r[n++]=o>>>1&2047,r[n++]=o>>>12&2047,r[n++]=2047&(o>>>23|(3&s)<<9),r[n++]=s>>>2&2047,r[n++]=s>>>13&2047,r[n++]=2047&(s>>>24|(7&l)<<8),r[n++]=l>>>3&2047,r[n++]=l>>>14&2047,r[n++]=2047&(l>>>25|(15&u)<<7),r[n++]=u>>>4&2047,r[n++]=u>>>15&2047,r[n++]=2047&(u>>>26|(31&c)<<6),r[n++]=c>>>5&2047,r[n++]=c>>>16&2047,r[n++]=2047&(c>>>27|(63&h)<<5),r[n++]=h>>>6&2047,r[n++]=h>>>17&2047,r[n++]=2047&(h>>>28|(127&d)<<4),r[n++]=d>>>7&2047,r[n++]=d>>>18&2047,r[n++]=2047&(d>>>29|(255&p)<<3),r[n++]=p>>>8&2047,r[n++]=p>>>19&2047,r[n++]=2047&(p>>>30|(511&f)<<2),r[n++]=f>>>9&2047,r[n++]=f>>>20&2047,r[n++]=2047&(f>>>31|(1023&m)<<1),r[n++]=m>>>10&2047,r[n]=m>>>21&2047}(e,t,r,i);case 12:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0;r[n++]=a>>>0&4095,r[n++]=a>>>12&4095,r[n++]=4095&(a>>>24|(15&o)<<8),r[n++]=o>>>4&4095,r[n++]=o>>>16&4095,r[n++]=4095&(o>>>28|(255&s)<<4),r[n++]=s>>>8&4095,r[n++]=s>>>20&4095,r[n++]=l>>>0&4095,r[n++]=l>>>12&4095,r[n++]=4095&(l>>>24|(15&u)<<8),r[n++]=u>>>4&4095,r[n++]=u>>>16&4095,r[n++]=4095&(u>>>28|(255&c)<<4),r[n++]=c>>>8&4095,r[n++]=c>>>20&4095,r[n++]=h>>>0&4095,r[n++]=h>>>12&4095,r[n++]=4095&(h>>>24|(15&d)<<8),r[n++]=d>>>4&4095,r[n++]=d>>>16&4095,r[n++]=4095&(d>>>28|(255&p)<<4),r[n++]=p>>>8&4095,r[n++]=p>>>20&4095,r[n++]=f>>>0&4095,r[n++]=f>>>12&4095,r[n++]=4095&(f>>>24|(15&m)<<8),r[n++]=m>>>4&4095,r[n++]=m>>>16&4095,r[n++]=4095&(m>>>28|(255&g)<<4),r[n++]=g>>>8&4095,r[n]=g>>>20&4095}(e,t,r,i);case 16:return void function(e,t,r,i){let n=i,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0,y=e[t+12]>>>0,_=e[t+13]>>>0,v=e[t+14]>>>0,b=e[t+15]>>>0;r[n++]=a>>>0&65535,r[n++]=a>>>16&65535,r[n++]=o>>>0&65535,r[n++]=o>>>16&65535,r[n++]=s>>>0&65535,r[n++]=s>>>16&65535,r[n++]=l>>>0&65535,r[n++]=l>>>16&65535,r[n++]=u>>>0&65535,r[n++]=u>>>16&65535,r[n++]=c>>>0&65535,r[n++]=c>>>16&65535,r[n++]=h>>>0&65535,r[n++]=h>>>16&65535,r[n++]=d>>>0&65535,r[n++]=d>>>16&65535,r[n++]=p>>>0&65535,r[n++]=p>>>16&65535,r[n++]=f>>>0&65535,r[n++]=f>>>16&65535,r[n++]=m>>>0&65535,r[n++]=m>>>16&65535,r[n++]=g>>>0&65535,r[n++]=g>>>16&65535,r[n++]=y>>>0&65535,r[n++]=y>>>16&65535,r[n++]=_>>>0&65535,r[n++]=_>>>16&65535,r[n++]=v>>>0&65535,r[n++]=v>>>16&65535,r[n++]=b>>>0&65535,r[n]=b>>>16&65535}(e,t,r,i);case 32:for(let n=0;n<32;n=n+1|0)r[i+n|0]=0|e[t+n|0];return}let a=nx[n]>>>0,o=t,s=0,l=e[o]>>>0;for(let t=0;t<32;t++)if(s+n<=32){let u=l>>>s&a;r[i+t]=0|u,s+=n,32===s&&(s=0,o++,31!==t&&(l=e[o]>>>0))}else{let u=32-s,c=l>>>s;o++,l=e[o]>>>0;let h=(c|(l&nx[n-u]>>>0)<<u)&a;r[i+t]=0|h,s=n-u}}function gx(e,t,r){let i=new Uint32Array(r),n=0,a=t.get();for(let t=0;t<i.length;t++){let t=e[a++],r=127&t;t<128||(t=e[a++],r|=(127&t)<<7,t<128||(t=e[a++],r|=(127&t)<<14,t<128||(t=e[a++],r|=(127&t)<<21,t<128||(t=e[a++],r|=(15&t)<<28)))),i[n++]=r}return t.set(a),i}function yx(e,t,r){let i=new BigUint64Array(r);for(let r=0;r<i.length;r++)i[r]=_x(e,t);return i}function _x(e,t){let r=0n,i=0,n=t.get();for(;n<e.length;){let t=e[n++];if(r|=BigInt(127&t)<<BigInt(i),!(128&t))break;if(i+=7,i>=64)throw Error("Varint too long")}return t.set(n),r}function vx(e,t){let r,i;return i=e[t.get()],t.increment(),r=127&i,i<128||(i=e[t.get()],t.increment(),r|=(127&i)<<7,i<128)||(i=e[t.get()],t.increment(),r|=(127&i)<<14,i<128)||(i=e[t.get()],t.increment(),r|=(127&i)<<21,i<128)?r:(i=e[t.get()],r|=(15&i)<<28,function(e,t,r){let i,n;if(n=t[r.get()],r.increment(),i=(112&n)>>4,n<128||(n=t[r.get()],r.increment(),i|=(127&n)<<3,n<128)||(n=t[r.get()],r.increment(),i|=(127&n)<<10,n<128)||(n=t[r.get()],r.increment(),i|=(127&n)<<17,n<128)||(n=t[r.get()],r.increment(),i|=(127&n)<<24,n<128)||(n=t[r.get()],r.increment(),i|=(1&n)<<31,n<128))return 4294967296*i+(e>>>0);throw Error("Expected varint not more than 10 bytes")}(r,e,t))}function bx(e,t,r,i){return function(e,t,r,i,n){let a=i.get();if(3&r)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let o=r>>>2,s=function(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let r=new Uint32Array(Math.max(16,2*t));return e.encodedWords=r,r}(n,o);!function(e,t,r,i){if(t<0||r<0||t+r>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${r}, bytes.length=${e.length})`);let n=Math.floor(r/4),a=r%4!=0,o=a?n+1:n;if(i.length<o)throw RangeError(`decodeBigEndianInt32sInto: out.length=${i.length} < ${o}`);if(n>0){let r=e.byteOffset+t;if(3&r)for(let r=0;r<n;r++){let n=t+4*r;i[r]=e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]}else{let t=new Uint32Array(e.buffer,r,n);for(let e=0;e<n;e++)i[e]=0|sx(t[e])}}if(a){let a=t+4*n,o=r-4*n,s=0;for(let t=0;t<o;t++)s|=e[a+t]<<24-8*t;i[n]=0|s}}(e,a,r,s);let l=function(e,t,r){let i=0,n=0,a=new Uint32Array(t),o=r??cx();if(e.length>0){let t=0|e[i];if(i=i+1|0,255&t)throw Error(`FastPFOR decode: invalid alignedLength=${t} (expected multiple of 256)`);if(n+t>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${t}, out.length=${a.length})`);i=function(e,t,r,i,n,a){let o=i+ax(n,256),s=i,l=r;for(;s!==o;){let r=Math.min(lx,o-s);l=fx(e,t,l,s,r,a),s=s+r|0}return l}(e,a,i,n,t,o),n=n+t|0}return function(e,t,r,i,n,a){if(0===a)return t;let o=0,s=t,l=t+r,u=n,c=n,h=n+a,d=0,p=0;for(;s<l&&c<h;){let t=e[s]>>>o&255;if(o+=8,s+=o>>>5,o&=31,d|=(127&t)<<p,128&t)i[c++]=0|d,d=0,p=0;else if(p+=7,p>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${d}, decoded=${c-u}/${a}, inPos=${s}, inEnd=${l})`)}if(c!==h)throw Error(`FastPFOR VByte: truncated stream (decoded=${c-u}, expected=${a}, consumedWords=${s-t}/${r}, vbyteStart=${t}, vbyteEnd=${l})`)}(e,i,e.length-i|0,a,n,t-n|0),a}(s.subarray(0,o),t,n.decoderWorkspace);return i.add(r),l}(e,t,r,i,function(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,0|e);return{encodedWords:new Uint32Array(t),decoderWorkspace:cx()}}(r>>>2))}function xx(e){return e>>>1^-(1&e)}function wx(e){return e>>1n^-(1n&e)}function Sx(e){return e%2==1?(e+1)/-2:e/2}function Tx(e,t,r){if(void 0===r){r=0;for(let i=0;i<t;i++)r+=e[i]}let i=new Uint32Array(r),n=0;for(let r=0;r<t;r++){let a=e[r],o=e[r+t];i.fill(o,n,n+a),n+=a}return i}function Px(e,t,r){if(void 0===r){r=0;for(let i=0;i<t;i++)r+=Number(e[i])}let i=new BigUint64Array(r),n=0;for(let r=0;r<t;r++){let a=Number(e[r]),o=e[r+t];i.fill(o,n,n+a),n+=a}return i}function Ex(e,t,r){let i=new Float64Array(r),n=0;for(let r=0;r<t;r++){let a=e[r],o=e[r+t];i.fill(o,n,n+a),n+=a}return i}function Dx(e){let t=new Int32Array(e.length);t[0]=xx(e[0]);let r=e.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let r=e[i],n=e[i+1],a=e[i+2],o=e[i+3];t[i]=xx(r)+t[i-1],t[i+1]=xx(n)+t[i],t[i+2]=xx(a)+t[i+1],t[i+3]=xx(o)+t[i+2]}for(;i!==e.length;++i)t[i]=xx(e[i])+t[i-1];return t}function Ax(e){let t=new BigInt64Array(e.length);t[0]=wx(e[0]);let r=e.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let r=e[i],n=e[i+1],a=e[i+2],o=e[i+3];t[i]=wx(r)+t[i-1],t[i+1]=wx(n)+t[i],t[i+2]=wx(a)+t[i+1],t[i+3]=wx(o)+t[i+2]}for(;i!==t.length;++i)t[i]=wx(e[i])+t[i-1];return t}function Ix(e){let t=e.length/4*4,r=1;if(t>=4)for(let i=e[0];r<t-4;r+=4)i=e[r]+=i,i=e[r+1]+=i,i=e[r+2]+=i,i=e[r+3]+=i;for(;r!==e.length;)e[r]+=e[r-1],++r}function Cx(e,t,r,i){if(e.length<2)return new Int32Array(e);let n=new Int32Array(e.length),a=xx(e[0]),o=xx(e[1]);n[0]=kx(Math.round(a*t),r,i),n[1]=kx(Math.round(o*t),r,i);let s=e.length/16,l=2;if(s>=4)for(;l<s-4;l+=4){let s=e[l],u=e[l+1],c=xx(s)+a,h=xx(u)+o;n[l]=kx(Math.round(c*t),r,i),n[l+1]=kx(Math.round(h*t),r,i);let d=e[l+2],p=e[l+3];a=xx(d)+c,o=xx(p)+h,n[l+2]=kx(Math.round(a*t),r,i),n[l+3]=kx(Math.round(o*t),r,i)}for(;l!==e.length;l+=2)a+=xx(e[l]),o+=xx(e[l+1]),n[l]=kx(Math.round(a*t),r,i),n[l+1]=kx(Math.round(o*t),r,i);return n}function kx(e,t,r){return Math.min(r,Math.max(t,e))}function Mx(e){let t=new Uint32Array(e.length);t[0]=xx(e[0])>>>0;for(let r=1;r<e.length;r++)t[r]=t[r-1]+xx(e[r])>>>0;return t}function Fx(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,wx(e[0]));for(let r=1;r<e.length;r++)t[r]=BigInt.asUintN(64,t[r-1]+wx(e[r]));return t}var Rx,Lx,zx,Ox;!function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"}(Rx||={}),function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"}(Lx||={}),function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"}(zx||={}),function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"}(Ox||={});const Bx=[Rx.PRESENT,Rx.DATA,Rx.OFFSET,Rx.LENGTH],jx=[ex.NONE,ex.DELTA,ex.COMPONENTWISE_DELTA,ex.RLE,ex.MORTON],Nx=[tx.NONE,tx.FAST_PFOR,tx.VARINT],Ux=[Lx.NONE,Lx.SINGLE,Lx.SHARED,Lx.VERTEX,Lx.MORTON,Lx.FSST],Vx=[zx.VERTEX,zx.INDEX,zx.STRING,zx.KEY],$x=[Ox.VAR_BINARY,Ox.GEOMETRIES,Ox.PARTS,Ox.RINGS,Ox.TRIANGLES,Ox.SYMBOL,Ox.DICTIONARY];function Gx(e,t){let r=function(e,t){let r=e[t.get()],i=Bx[r>>4],n={};switch(i){case Rx.DATA:n={dictionaryType:Ux[15&r]};break;case Rx.OFFSET:n={offsetType:Vx[15&r]};break;case Rx.LENGTH:n={lengthType:$x[15&r]}}t.increment();let a=e[t.get()],o=jx[a>>5],s=jx[a>>2&7],l=Nx[3&a];t.increment();let u=gx(e,t,2),c=u[0];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:o,logicalLevelTechnique2:s,physicalLevelTechnique:l,numValues:c,byteLength:u[1],decompressedCount:c}}(e,t);return r.logicalLevelTechnique1===ex.MORTON?function(e,t,r){let i=gx(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:i[0],coordinateShift:i[1]}}(r,e,t):ex.RLE!==r.logicalLevelTechnique1&&ex.RLE!==r.logicalLevelTechnique2||tx.NONE===r.physicalLevelTechnique?r:function(e,t,r){let i=gx(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}(r,e,t)}var qx;!function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(qx||={});var Zx=class{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8),r=e%8;return 1==(this.values[t]>>r&1)}set(e,t){let r=Math.floor(e/8),i=e%8;this.values[r]=this.values[r]|+!!t<<i}getInt(e){let t=Math.floor(e/8),r=e%8;return this.values[t]>>r&1}size(){return this._size}getBuffer(){return this.values}};function Wx(e,t,r){if(!t)return e;let i=t.size(),n=new(0,e.constructor)(i),a=0;for(let o=0;o<i;o++)n[o]=t.get(o)?e[a++]:r;return n}function Hx(e,t,r){for(let i=0;i<e;i++){let e=Gx(t,r);r.add(e.byteLength)}}function Xx(e,t,r,i,n){let a=function(e,t,r,i){let n=new Uint8Array(t),a=0,o=i.get()+r;for(;a<t&&!(i.get()>=o);){let r=e[i.increment()];if(r<=127){let o=r+3,s=e[i.increment()],l=Math.min(a+o,t);n.fill(s,a,l),a=l}else{let o=256-r;for(let r=0;r<o&&a<t;r++)n[a++]=e[i.increment()]}}return i.set(o),n}(e,Math.ceil(t/8),r,i);return n?function(e,t,r){if(!r)return e;let i=r.size(),n=new Zx(e,t),a=new Zx(new Uint8Array(Math.ceil(i/8)),i),o=0;for(let e=0;e<i;e++){let t=!!r.get(e)&&n.get(o++);a.set(e,t)}return a.getBuffer()}(a,t,n):a}function Kx(e,t,r,i){let n=t.get(),a=n+r*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(n,a)).buffer,s=new Float32Array(o);return t.set(a),i?Wx(s,i,0):s}function Yx(e,t,r,i){let n=t.get(),a=n+r*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(n,a)).buffer,s=new Float64Array(o);return t.set(a),i?Wx(s,i,0):s}const Jx=new TextDecoder;function Qx(e,t,r){return r-t>=12?Jx.decode(e.subarray(t,r)):function(e,t,r){let i="",n=t;for(;n<r;){let t,a,o,s=e[n],l=null,u=s>239?4:s>223?3:s>191?2:1;if(n+u>r)break;1===u?s<128&&(l=s):2===u?(t=e[n+1],128==(192&t)&&(l=(31&s)<<6|63&t,l<=127&&(l=null))):3===u?(t=e[n+1],a=e[n+2],128==(192&t)&&128==(192&a)&&(l=(15&s)<<12|(63&t)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(t=e[n+1],a=e[n+2],o=e[n+3],128==(192&t)&&128==(192&a)&&128==(192&o)&&(l=(15&s)<<18|(63&t)<<12|(63&a)<<6|63&o,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,i+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),i+=String.fromCharCode(l),n+=u}return i}(e,t,r)}function ew(e,t,r,i,n){return function(e,t,r,i){let n;switch(t.logicalLevelTechnique1){case ex.DELTA:if(t.logicalLevelTechnique2===ex.RLE){let r=t;if(!i)return function(e,t,r){let i=new Int32Array(r),n=0,a=0;for(let r=0;r<t;r++){let o=e[r],s=xx(e[r+t]);for(let e=0;e<o;e++)a+=s,i[n++]=a}return i}(e,r.runs,r.numRleValues);n=Dx(e=Tx(e,r.runs,r.numRleValues))}else n=Dx(e);break;case ex.RLE:n=function(e,t,r){if(void 0===r){r=0;for(let i=0;i<t;i++)r+=e[i]}let i=new Int32Array(r),n=0;for(let r=0;r<t;r++){let a=e[r],o=e[r+t];o=xx(o),i.fill(o,n,n+a),n+=a}return i}(e,t.runs,t.numRleValues);break;case ex.MORTON:Ix(e),n=new Int32Array(e);break;case ex.COMPONENTWISE_DELTA:if(r&&!i)return Cx(e,r.scale,r.min,r.max);n=function(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=xx(e[0]),t[1]=xx(e[1]);let r=e.length/4*4,i=2;if(r>=4)for(;i<r-4;i+=4){let r=e[i],n=e[i+1],a=e[i+2],o=e[i+3];t[i]=xx(r)+t[i-2],t[i+1]=xx(n)+t[i-1],t[i+2]=xx(a)+t[i],t[i+3]=xx(o)+t[i+1]}for(;i!==e.length;i+=2)t[i]=xx(e[i])+t[i-2],t[i+1]=xx(e[i+1])+t[i-1];return t}(e);break;case ex.NONE:n=function(e){let t=new Int32Array(e.length);for(let r=0;r<e.length;r++)t[r]=xx(e[r]);return t}(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Wx(n,i,0):n}(iw(e,t,r),r,i,n)}function tw(e,t,r,i,n){return function(e,t,r,i){let n;switch(t.logicalLevelTechnique1){case ex.DELTA:if(t.logicalLevelTechnique2===ex.RLE){let r=t;n=Mx(Tx(e,r.runs,r.numRleValues))}else n=Mx(e);break;case ex.RLE:n=Tx(e,t.runs,t.numRleValues);break;case ex.MORTON:Ix(e),n=e;break;case ex.COMPONENTWISE_DELTA:n=r&&!i?function(e,t,r,i){let n=Cx(e,t,r,i);return new Uint32Array(n)}(e,r.scale,r.min,r.max):function(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=xx(e[0])>>>0,t[1]=xx(e[1])>>>0;for(let r=2;r<e.length;r+=2)t[r]=t[r-2]+xx(e[r])>>>0,t[r+1]=t[r-1]+xx(e[r+1])>>>0;return t}(e);break;case ex.NONE:n=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Wx(n,i,0):n}(iw(e,t,r),r,i,n)}function rw(e,t,r){return function(e,t){if(t.logicalLevelTechnique1===ex.DELTA&&t.logicalLevelTechnique2===ex.NONE)return function(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=xx(e[0]);let r=t[1];for(let i=2;i!==t.length;++i)r+=xx(e[i-1]),t[i]=t[i-1]+r;return new Uint32Array(t)}(e);if(t.logicalLevelTechnique1===ex.RLE&&t.logicalLevelTechnique2===ex.NONE){let r=t;return function(e,t,r){let i=new Uint32Array(r+1);i[0]=0;let n=1,a=i[0];for(let r=0;r<t;r++){let o=e[r],s=e[r+t];for(let e=n;e<n+o;e++)i[e]=s+a,a=i[e];n+=o}return i}(e,r.runs,r.numRleValues)}if(t.logicalLevelTechnique1===ex.NONE&&t.logicalLevelTechnique2===ex.NONE){!function(e){let t=0;for(let r=0;r<e.length;r++)e[r]+=t,t=e[r]}(e);let r=new Uint32Array(t.numValues+1);return r[0]=0,r.set(e,1),r}if(t.logicalLevelTechnique1===ex.DELTA&&t.logicalLevelTechnique2===ex.RLE){let r=t,i=function(e,t,r){let i=new Int32Array(r+1);i[0]=0;let n=1,a=i[0];for(let r=0;r<t;r++){let o=e[r],s=e[r+t];s=xx(s);for(let e=n;e<n+o;e++)i[e]=s+a,a=i[e];n+=o}return i}(e,r.runs,r.numRleValues);return Ix(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}(iw(e,t,r),r)}function iw(e,t,r){let i=r.physicalLevelTechnique;switch(i){case tx.FAST_PFOR:return bx(e,r.numValues,r.byteLength,t);case tx.VARINT:return gx(e,t,r.numValues);case tx.NONE:return function(e,t,r){let i=t.get(),n=r*Uint32Array.BYTES_PER_ELEMENT,a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=new Uint32Array(r);for(let e=0;e<r;e++)o[e]=a.getUint32(i+e*Uint32Array.BYTES_PER_ELEMENT,!0);return t.add(n),o}(e,t,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function nw(e,t,r){let i=r.physicalLevelTechnique;switch(i){case tx.VARINT:return yx(e,t,r.numValues);case tx.NONE:return function(e,t,r){let i=t.get(),n=r*BigUint64Array.BYTES_PER_ELEMENT,a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=new BigUint64Array(r);for(let e=0;e<r;e++)o[e]=a.getBigUint64(i+e*BigUint64Array.BYTES_PER_ELEMENT,!0);return t.add(n),o}(e,t,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function aw(e,t,r){let i=iw(e,t,r);return 1===i.length?r.logicalLevelTechnique1===ex.DELTA?xx(i[0]):i[0]:function(e){return e[1]}(i)}function ow(e,t,r){return function(e){if(2===e.length){let t=xx(e[1]);return[t,t]}return[xx(e[2]),xx(e[3])]}(iw(e,t,r))}function sw(e,t,r){return function(e){if(2===e.length){let t=wx(e[1]);return[t,t]}return[wx(e[2]),wx(e[3])]}(yx(e,t,r.numValues))}function lw(e,t,r,i){return hw(nw(e,t,r),r,i)}function uw(e,t,r,i){return dw(nw(e,t,r),r,i)}function cw(e,t,r){let i=nw(e,t,r);return 1===i.length?r.logicalLevelTechnique1===ex.DELTA?wx(i[0]):i[0]:function(e){return e[1]}(i)}function hw(e,t,r){let i;switch(t.logicalLevelTechnique1){case ex.DELTA:if(t.logicalLevelTechnique2===ex.RLE){let n=t;if(!r)return function(e,t,r){let i=new BigInt64Array(r),n=0,a=0n;for(let r=0;r<t;r++){let o=Number(e[r]),s=wx(e[r+t]);for(let e=0;e<o;e++)a+=s,i[n++]=a}return i}(e,n.runs,n.numRleValues);i=Ax(e=Px(e,n.runs,n.numRleValues))}else i=Ax(e);break;case ex.RLE:i=function(e,t,r){if(void 0===r){r=0;for(let i=0;i<t;i++)r+=Number(e[i])}let i=new BigInt64Array(r),n=0;for(let r=0;r<t;r++){let a=Number(e[r]),o=e[r+t];o=wx(o),i.fill(o,n,n+a),n+=a}return i}(e,t.runs,t.numRleValues);break;case ex.NONE:i=function(e){let t=new BigInt64Array(e.length);for(let r=0;r<e.length;r++)t[r]=wx(e[r]);return t}(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Wx(i,r,0n):i}function dw(e,t,r){let i;switch(t.logicalLevelTechnique1){case ex.DELTA:if(t.logicalLevelTechnique2===ex.RLE){let r=t;i=Fx(Px(e,r.runs,r.numRleValues))}else i=Fx(e);break;case ex.RLE:i=Px(e,t.runs,t.numRleValues);break;case ex.NONE:i=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Wx(i,r,0n):i}function pw(e,t,r,i,n="int32"){let a=e.logicalLevelTechnique1;if(a===ex.RLE)return 1===e.runs?qx.CONST:qx.FLAT;if(a!==ex.DELTA||e.logicalLevelTechnique2!==ex.RLE)return 1===e.numValues?qx.CONST:qx.FLAT;let o=t instanceof Zx?t.size():t,s=e;if(s.numRleValues!==o)return qx.FLAT;if(1===s.runs)return qx.SEQUENCE;if(2!==s.runs)return 1===e.numValues?qx.CONST:qx.FLAT;let l=i.get();if(e.physicalLevelTechnique===tx.VARINT)return function(e,t,r){let i=new rx(t.get());if("int64"===r){let t=yx(e,i,4);return 2n===t[2]&&2n===t[3]}let n=gx(e,i,4);return 2===n[2]&&2===n[3]}(r,i,n)?qx.SEQUENCE:1===e.numValues?qx.CONST:qx.FLAT;let u=i.get(),c=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),2===c[2]&&2===c[3]?qx.SEQUENCE:1===e.numValues?qx.CONST:qx.FLAT}var fw,mw,gw,yw=class extends Wb{getValueFromBuffer(e){return this.dataBuffer[e]}},_w=class extends Kb{constructor(e,t,r,i,n){super(e,n?BigInt64Array.of(t):BigUint64Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}};function vw(e,t,r){return{x:bw(e,t)-r,y:bw(e>>1,t)-r}}function bw(e,t){let r=0;for(let i=0;i<t;i++)r|=(e&1<<2*i)>>i;return r}function xw(e,t,r,i,n,a,o){return e===gw.MORTON?function(e,t,r,i,n,a){let o=Array(n?i+1:i);for(let n=0;n<i;n++){let i=vw(e[t[r+n]],a.numBits,a.coordinateShift);o[n]=new $a(i.x,i.y)}return n&&(o[o.length-1]=o[0]),o}(t,r,i,n,a,o):function(e,t,r,i,n){let a=Array(n?i+1:i);for(let n=0;n<2*i;n+=2){let i=2*t[r+n/2],o=e[i],s=e[i+1];a[n/2]=new $a(o,s)}return n&&(a[a.length-1]=a[0]),a}(t,r,i,n,a)}function ww(e,t,r,i){let n=Array(i?r+1:r);for(let i=0;i<2*r;i+=2){let r=e[t+i],a=e[t+i+1];n[i/2]=new $a(r,a)}return i&&(n[n.length-1]=n[0]),n}!function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"}(fw||={}),function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"}(mw||={}),function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"}(gw||={});var Sw=class{constructor(e,t,r,i,n){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let t=this.vertexOffsets[e],r=vw(this.vertexBuffer[t],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[r.x,r.y]}let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return function(e){let t=Array(e.numGeometries),r=1,i=1,n=1,a=0,o=0,s=0,l=e.mortonSettings,u=e.topologyVector,c=u.geometryOffsets,h=u.partOffsets,d=u.ringOffsets,p=e.vertexOffsets,f=!p||0===p.length,m=e.containsPolygonGeometry(),g=e.vertexBuffer;for(let u=0;u<e.numGeometries;u++){let y=e.geometryType(u);switch(y){case fw.POINT:{let u,m;if(f)u=g[o++],m=g[o++];else if(e.vertexBufferType===gw.MORTON){let e=vw(g[p[s++]],l.numBits,l.coordinateShift);u=e.x,m=e.y}else{let e=2*p[s++];u=g[e],m=g[e+1]}t[a++]=[[new $a(u,m)]],c&&n++,h&&r++,d&&i++}break;case fw.MULTIPOINT:{let u,h=c[n]-c[n-1];if(n++,f){u=Array(h);for(let e=0;e<h;e++){let t=g[o++],r=g[o++];u[e]=new $a(t,r)}}else u=xw(e.vertexBufferType,g,p,s,h,!1,l),s+=h;t[a++]=u.map(e=>[e]),r+=h,i+=h}break;case fw.LINESTRING:{let u,y;m?(u=d[i]-d[i-1],i++):u=h[r]-h[r-1],r++,f?(y=ww(g,o,u,!1),o+=2*u):(y=xw(e.vertexBufferType,g,p,s,u,!1,l),s+=u),t[a++]=[y],c&&n++}break;case fw.POLYGON:{let u=h[r]-h[r-1];r++;let m,y=Array(u-1),_=d[i]-d[i-1];if(i++,f){m=ww(g,o,_,!0),o+=2*_;for(let e=0;e<y.length;e++)_=d[i]-d[i-1],i++,y[e]=ww(g,o,_,!0),o+=2*_}else{m=xw(e.vertexBufferType,g,p,s,_,!0,l),s+=_;for(let t=0;t<y.length;t++)_=d[i]-d[i-1],i++,y[t]=xw(e.vertexBufferType,g,p,s,_,!0,l),s+=_}t[a++]=[m].concat(y),c&&n++}break;case fw.MULTILINESTRING:{let u=c[n]-c[n-1];n++;let y=Array(u);for(let t=0;t<u;t++){let n;if(m?(n=d[i]-d[i-1],i++):n=h[r]-h[r-1],r++,f)y[t]=ww(g,o,n,!1),o+=2*n;else{let r=xw(e.vertexBufferType,g,p,s,n,!1,l);y[t]=r,s+=n}}t[a++]=y}break;case fw.MULTIPOLYGON:{let u=c[n]-c[n-1];n++;let m=Array(u);for(let t=0;t<u;t++){let n=h[r]-h[r-1];r++;let a,u=Array(n-1),c=d[i]-d[i-1];i++,f?(a=ww(g,o,c,!0),o+=2*c):(a=xw(e.vertexBufferType,g,p,s,c,!0,l),s+=c);for(let t=0;t<u.length;t++){let r=d[i]-d[i-1];i++,f?(u[t]=ww(g,o,r,!0),o+=2*r):(u[t]=xw(e.vertexBufferType,g,p,s,r,!0,l),s+=r)}m[t]=[a].concat(u)}t[a++]=m.flat()}break;default:throw Error(`The specified geometry type (${y}) is currently not supported.`)}}return t}(this)}get mortonSettings(){return this._mortonSettings}},Tw=class extends Sw{constructor(e,t,r,i,n,a,o){super(r,i,n,a,o),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===fw.POLYGON||this._geometryType===fw.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function Pw(e,t,r,i){return new Ew(gw.VEC_2,e,t,r,i)}var Ew=class extends Sw{constructor(e,t,r,i,n,a){super(e,r,i,n,a),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===fw.POLYGON||this.geometryType(e)===fw.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},Dw=class{constructor(e,t,r,i){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let e=new Uint32Array(this.numGeometries);for(let t=0;t<this.numGeometries;t++)e[t]=this.geometryType(t);return Pw(e,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function Aw(e,t,r,i,n,a){return new Iw(e,t,r,i,n,a)}var Iw=class extends Dw{constructor(e,t,r,i,n,a){super(r,i,n,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function Cw(e,t,r,i,n){return new kw(e,t,r,i,n)}var kw=class extends Dw{constructor(e,t,r,i,n){super(t,r,i,n),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function Mw(e,t,r,i,n){let a,o,s,l,u=Gx(e,r);if(pw(u,i,e,r)===qx.CONST){let c,h,d,p,f=aw(e,r,u);for(let i=0;i<t-1;i++){let t=Gx(e,r);switch(t.physicalStreamType){case Rx.LENGTH:switch(t.logicalStreamType.lengthType){case Ox.GEOMETRIES:c=rw(e,r,t);break;case Ox.PARTS:h=rw(e,r,t);break;case Ox.RINGS:d=rw(e,r,t);break;case Ox.TRIANGLES:p=rw(e,r,t)}break;case Rx.OFFSET:switch(t.logicalStreamType.offsetType){case zx.VERTEX:a=tw(e,r,t);break;case zx.INDEX:l=tw(e,r,t)}break;case Rx.DATA:if(Lx.VERTEX===t.logicalStreamType.dictionaryType)o=ew(e,r,t,n);else{let i=t;s={numBits:i.numBits,coordinateShift:i.coordinateShift},o=tw(e,r,t,n)}}}return l?void 0!==c||void 0!==h?Aw(i,f,p,l,o,{geometryOffsets:c,partOffsets:h,ringOffsets:d}):Aw(i,f,p,l,o):void 0===s?function(e,t,r,i,n){return new Tw(e,t,gw.VEC_2,r,i,n)}(i,f,{geometryOffsets:c,partOffsets:h,ringOffsets:d},a,o):function(e,t,r,i,n,a){return new Tw(e,t,gw.MORTON,r,i,n,a)}(i,f,{geometryOffsets:c,partOffsets:h,ringOffsets:d},a,o,s)}let c,h,d,p,f,m,g,y=tw(e,r,u);for(let i=0;i<t-1;i++){let t=Gx(e,r);switch(t.physicalStreamType){case Rx.LENGTH:switch(t.logicalStreamType.lengthType){case Ox.GEOMETRIES:c=tw(e,r,t);break;case Ox.PARTS:h=tw(e,r,t);break;case Ox.RINGS:d=tw(e,r,t);break;case Ox.TRIANGLES:p=rw(e,r,t)}break;case Rx.OFFSET:switch(t.logicalStreamType.offsetType){case zx.VERTEX:a=tw(e,r,t);break;case zx.INDEX:l=tw(e,r,t)}break;case Rx.DATA:if(Lx.VERTEX===t.logicalStreamType.dictionaryType)o=ew(e,r,t,n);else{let i=t;s={numBits:i.numBits,coordinateShift:i.coordinateShift},o=tw(e,r,t,n)}}}return c?(f=Fw(y,c,2),h&&d?(m=Rw(y,f,h,!1),g=function(e,t,r,i){let n=new Uint32Array(r[r.length-1]+1),a=0;n[0]=a;let o=1,s=1,l=0;for(let u=0;u<e.length;u++){let c=e[u],h=t[u+1]-t[u];if(0!==c&&3!==c)for(let e=0;e<h;e++){let e=r[o]-r[o-1];o++;for(let t=0;t<e;t++)a=n[s++]=a+i[l++]}else for(let e=0;e<h;e++)n[s++]=++a,o++}return n}(y,f,m,d)):h&&(m=function(e,t,r){let i=new Uint32Array(t[t.length-1]+1),n=0;i[0]=n;let a=1,o=0;for(let s=0;s<e.length;s++){let l=e[s],u=t[s+1]-t[s];if(4===l||1===l)for(let e=0;e<u;e++)n=i[a++]=n+r[o++];else for(let e=0;e<u;e++)i[a++]=++n}return i}(y,f,h))):h&&d?(m=Fw(y,h,1),g=Rw(y,m,d,!0)):h&&(m=Fw(y,h,0)),l&&!m?Cw(y,p,l,o):l?Cw(y,p,l,o,{geometryOffsets:f,partOffsets:m,ringOffsets:g}):void 0===s?Pw(y,{geometryOffsets:f,partOffsets:m,ringOffsets:g},a,o):function(e,t,r,i,n){return new Ew(gw.MORTON,e,t,r,i,n)}(y,{geometryOffsets:f,partOffsets:m,ringOffsets:g},a,o,s)}function Fw(e,t,r){let i=new Uint32Array(e.length+1),n=0;i[0]=n;let a=0;for(let o=0;o<e.length;o++)n=i[o+1]=n+(e[o]>r?t[a++]:1);return i}function Rw(e,t,r,i){let n=new Uint32Array(t[t.length-1]+1),a=0;n[0]=a;let o=1,s=0;for(let l=0;l<e.length;l++){let u=e[l],c=t[l+1]-t[l];if(5===u||2===u||i&&(4===u||1===u))for(let e=0;e<c;e++)a=n[o++]=a+r[s++];else for(let e=0;e<c;e++)n[o++]=++a}return n}var Lw=class extends Zb{constructor(e,t,r){super(e,t.getBuffer(),r),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}},zw=class extends Wb{getValueFromBuffer(e){return this.dataBuffer[e]}},Ow=class extends Zb{constructor(e,t,r,i){super(e,i?BigInt64Array.of(t):BigUint64Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}},Bw=class extends Zb{constructor(e,t,r,i){super(e,r,i),this.offsetBuffer=t}},jw=class extends Bw{constructor(e,t,r,i){super(e,t,r,i??t.length-1)}getValueFromBuffer(e){let t=this.offsetBuffer[e],r=this.offsetBuffer[e+1];return Qx(this.dataBuffer,t,r)}},Nw=class extends Bw{constructor(e,t,r,i,n){super(e,r,i,n??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return Qx(this.dataBuffer,r,i)}},Uw=class extends Bw{constructor(e,t,r,i,n,a,o,s){super(e,r,i,o??t.length),this.indexBuffer=t,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a,this.sharedDictionaryCache=s}getValueFromBuffer(e){this.decodedDictionary??(this.decodedDictionary=this.sharedDictionaryCache?.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return Qx(this.decodedDictionary,r,i)}decodeDictionary(){return this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),function(e,t,r){let i=new Uint32Array(t.length);for(let e=1;e<t.length;e++)i[e]=i[e-1]+t[e-1];let n=new Uint8Array(function(e,t){let r=0;for(let i=0;i<t.length;i++){let n=t[i];255===n?(r++,i++):r+=e[n]}return r}(t,r)),a=0;for(let o=0;o<r.length;o++){let s=r[o];if(255===s)o++,n[a++]=r[o];else{let r=t[s],o=i[s];for(;r-- >0;)n[a++]=e[o++]}}return n}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),r=e[0];for(let i=1;i<e.length;i++){let n=e[i];t[i-1]=n-r,r=n}return t}};function Vw(e,t,r,i,n){let a,o,s,l,u,c,h,d=n;for(let e=0;e<i;e++){let e=Gx(t,r);switch(e.physicalStreamType){case Rx.PRESENT:{let i=new Zx(Xx(t,e.numValues,e.byteLength,r),e.numValues);d=n??i;break}case Rx.OFFSET:o=tw(t,r,e,void 0,d);break;case Rx.LENGTH:{let i=rw(t,r,e);Ox.DICTIONARY===e.logicalStreamType.lengthType?a=i:Ox.SYMBOL===e.logicalStreamType.lengthType?l=i:c=i;break}case Rx.DATA:{let i=t.subarray(r.get(),r.get()+e.byteLength);r.add(e.byteLength);let n=e.logicalStreamType.dictionaryType;Lx.FSST===n?u=i:Lx.SINGLE===n||Lx.SHARED===n?s=i:Lx.NONE===n&&(h=i);break}}}return function(e,t,r,i,n,a,o){if(t){if(!(r&&i&&n&&a))throw Error(`Incomplete FSST dictionary string column "${e}"`);return new Uw(e,r,i,n,a,t,o)}}(e,u,o,a,s,l,d)??function(e,t,r,i,n){if(t){if(!r||!i)throw Error(`Incomplete dictionary string column "${e}"`);return n?new Nw(e,r,i,t,n):new Nw(e,r,i,t)}}(e,s,o,a,d)??function(e,t,r,i,n){if(t&&r){if(i)return n?new Nw(e,i,t,r,n):new Nw(e,i,t,r);if(n&&n.size()!==t.length-1){let i=new Uint32Array(n.size()),a=0;for(let e=0;e<n.size();e++)n.get(e)?i[e]=a++:i[e]=0;return new Nw(e,i,t,r,n)}return n?new jw(e,t,r,n):new jw(e,t,r)}}(e,c,h,o,d)}var $w,Gw,qw=class extends Zb{constructor(e,t,r){super(e,new Uint8Array,r??t.length),this.values=t}getValueFromBuffer(e){return this.values[e]}};function Zw(e,t,r,i,n){let a,{lengthStream:o,flattenedValues:s,presentStream:l,dictionary:u}=e,c=t*r,h=r;if(l){a=new Zx(new Uint8Array(Math.ceil(r/8)),r),h=0;for(let e=0;e<r;e++)l.get(c+e)&&(a.set(e,!0),h++)}let d=i+h;if(d>o.length)throw Error("Merged map counts underflow while decoding child streams");let p=Array(r),f=i,m=n;for(let e=0;e<r;e++){if(l&&!l.get(c+e)){p[e]=null;continue}let t=m+o[f++];if(t>s.length)throw Error("Map value stream underflow while decoding feature payload");let r=Ww(s,m,t,u);p[e]=r.value,m=r.nextIndex}let g=0;for(let e=i;e<d;e++)g+=o[e];let y=n+g;if(m!==y)throw Error("Unused flattened map values remain after decode");return{value:p,nullabilityBuffer:a,countsEnd:d,valuesEnd:y}}function Ww(e,t,r,i){return r-t===1||e[t]===Gw.START_LIST?Xw(e,t,r,i):Hw(e,t,r,i)}function Hw(e,t,r,i){let n=Object.create(null),a=t;for(;a<r;){let t=Yw(e[a++],i);if("string"!=typeof t)throw Error(`Map key dictionary index does not resolve to a string: ${t}`);let o=Xw(e,a,r,i);n[t]=o.value,a=o.nextIndex}return{value:n,nextIndex:a}}function Xw(e,t,r,i){if(t>=r)throw Error("Unexpected end of map value stream");let n=e[t];if(n===Gw.FALSE)return{value:!1,nextIndex:t+1};if(n===Gw.TRUE)return{value:!0,nextIndex:t+1};if(n===Gw.START_MAP){let n=Kw(e,t,r);return{value:Hw(e,t+2,n,i).value,nextIndex:n}}if(n===Gw.START_LIST){let n=Kw(e,t,r),a=[],o=t+2;for(;o<n;){let t=Xw(e,o,n,i);a.push(t.value),o=t.nextIndex}return{value:a,nextIndex:n}}return{value:Yw(n,i),nextIndex:t+1}}function Kw(e,t,r){if(t+1>=r)throw Error("Missing length for nested map/list payload");let i=e[t+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let n=t+i;if(n>r)throw Error("Nested payload exceeds containing payload bounds");return n}function Yw(e,t){let r=e-Gw.COUNT;if(r<0||r>=t.length)throw Error(`Scalar dictionary index out of range: ${e}`);return t[r]}function Jw(e,t){for(let r of t)e.push(r)}function Qw(e,t,r,i,n,a){return"scalarType"===r.type?a&&!a.has(r.name)?(Hx(i,e,t),null):function(e,t,r,i,n,a){let o;if(0===e)return null;if(a.nullable){let e=Gx(t,r),i=e.numValues,n=r.get(),a=Xx(t,i,e.byteLength,r);r.set(n+e.byteLength),o=new Zx(a,e.numValues)}let s=o??i;switch(n.physicalType){case 4:case 3:return function(e,t,r,i,n){let a=Gx(e,t),o=pw(a,n,e,t),s=3===i.physicalType;if(o===qx.FLAT){let i=eS(n)?n:void 0,o=s?ew(e,t,a,void 0,i):tw(e,t,a,void 0,i);return new Hb(r.name,o,n)}if(o===qx.SEQUENCE){let i=ow(e,t,a);return new Yb(r.name,i[0],i[1],a.numRleValues,s)}let l=s?function(e,t,r){let i=iw(e,t,r);return 1===i.length?xx(i[0]):function(e){return xx(e[1])}(i)}(e,t,a):aw(e,t,a);return new Jb(r.name,l,n,s)}(t,r,a,n,s);case 9:{let i=a.nullable?e-1:e;return Vw(a.name,t,r,i,o)??null}case 0:return function(e,t,r,i,n){let a=Gx(e,t),o=a.numValues,s=t.get(),l=eS(n)?n:void 0,u=Xx(e,o,a.byteLength,t,l);t.set(s+a.byteLength);let c=new Zx(u,o);return new Lw(r.name,c,n)}(t,r,a,0,s);case 6:case 5:return function(e,t,r,i,n){let a=Gx(e,t),o=pw(a,i,e,t,"int64"),s=5===n.physicalType;if(o===qx.FLAT){let n=eS(i)?i:void 0,o=s?lw(e,t,a,n):uw(e,t,a,n);return new yw(r.name,o,i)}if(o===qx.SEQUENCE){let i=sw(e,t,a);return new _w(r.name,i[0],i[1],a.numRleValues,s)}let l=s?function(e,t,r){let i=nw(e,t,r);return 1===i.length?wx(i[0]):function(e){return wx(e[1])}(i)}(e,t,a):cw(e,t,a);return new Ow(r.name,l,i,s)}(t,r,a,s,n);case 7:return function(e,t,r,i){let n=Gx(e,t),a=eS(i)?i:void 0,o=Kx(e,t,n.numValues,a);return new zw(r.name,o,i)}(t,r,a,s);case 8:return function(e,t,r,i){let n=Gx(e,t),a=eS(i)?i:void 0,o=Yx(e,t,n.numValues,a);return new Xb(r.name,o,i)}(t,r,a,s);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}(i,e,t,n,r.scalarType,r):2===r.complexType?.physicalType?function(e,t,r,i){let n=function(e){let t="complexType"===e.type?e.complexType.children:void 0;return t&&0!==t.length?t.map(t=>e.name+(t.name??"")):[e.name]}(r);if(0===i)return n.map(e=>new qw(e,[]));let a=function(e,t,r){let i=e[t.get()];t.add(1);let n=tw(e,t,Gx(e,t)),a=r-1,o=[];i&$w.STRING&&(a-=function(e,t,r){let i=e[t.get()];t.add(1);let n=Vw("",e,t,i);if(n)for(let e=0;e<n.size;e++)r.push(n.getValue(e));return i}(e,t,o)),a-=function(e,t,r,i){let n=0;return r&$w.INT32?(Jw(i,ew(e,t,Gx(e,t))),n++):r&$w.INT64&&(Jw(i,lw(e,t,Gx(e,t))),n++),r&$w.UINT32?(Jw(i,tw(e,t,Gx(e,t))),n++):r&$w.UINT64&&(Jw(i,uw(e,t,Gx(e,t))),n++),n}(e,t,i,o),a-=function(e,t,r,i){let n=0;return r&$w.FLOAT&&(Jw(i,Kx(e,t,Gx(e,t).numValues)),n++),r&$w.DOUBLE&&(Jw(i,Yx(e,t,Gx(e,t).numValues)),n++),n}(e,t,i,o);let s,l=0;if(i&$w.PRESENCE){let r=function(e,t){let r=Gx(e,t);if(r.physicalStreamType!==Rx.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${r.physicalStreamType}`);let i=r.numValues,n=t.get(),a=new Zx(Xx(e,i,r.byteLength,t),i);return t.set(n+r.byteLength),{value:a,count:i}}(e,t);s=r.value,l=r.count,a--}let u=new Uint32Array;if(a>0&&(u=tw(e,t,Gx(e,t)),a--),0!==a)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:n,dictionary:o,presentStream:s,presentCount:l,flattenedValues:u}}(e,t,i),o=(a.presentStream?a.presentCount:a.lengthStream.length)/n.length,s=[],l=0,u=0;for(let e=0;e<n.length;e++){let t=Zw(a,e,o,l,u);s.push(new qw(n[e],t.value,t.nullabilityBuffer)),l=t.countsEnd,u=t.valuesEnd}return s}(e,t,r,i):0===i?null:function(e,t,r,i){let n,a,o,s,l=!1;for(;!l;){let r=Gx(e,t);switch(r.physicalStreamType){case Rx.LENGTH:Ox.DICTIONARY===r.logicalStreamType.lengthType?n=rw(e,t,r):o=rw(e,t,r);break;case Rx.DATA:Lx.SINGLE===r.logicalStreamType.dictionaryType||Lx.SHARED===r.logicalStreamType.dictionaryType?(a=e.subarray(t.get(),t.get()+r.byteLength),l=!0):s=e.subarray(t.get(),t.get()+r.byteLength),t.add(r.byteLength)}}if("complexType"!==r.type)throw Error(`Shared dictionary column ${r.name} must be a complex (struct) column.`);if(!n||!a)throw Error(`Incomplete shared dictionary for column "${r.name}"`);let u=r.complexType.children,c=[],h=s?{}:void 0,d=0;for(let l of u){let u=gx(e,t,1)[0];if(0===u)continue;let p,f=l.name?`${r.name}${l.name}`:r.name;if(i&&!i.has(f)){Hx(u,e,t);continue}if("scalarField"!==l.type||9!==l.scalarField.physicalType)throw Error("Currently only scalar string fields are implemented for a struct.");if(u>1&&!l.nullable||1===u&&l.nullable)throw Error(`The number of streams for the child field ${l.name} does not match its nullability. nullibilty: ${l.nullable}, numStreams: ${u}`);if(l.nullable){let r=Gx(e,t);p=new Zx(Xx(e,r.numValues,r.byteLength,t),r.numValues)}let m=tw(e,t,Gx(e,t),void 0,p);if(s){if(!o)throw Error(`Incomplete shared FSST dictionary for column "${f}"`);c[d++]=new Uw(f,m,n,a,o,s,p,h)}else c[d++]=new Nw(f,m,n,a,p)}return c}(e,t,r,a)}function eS(e){return e instanceof Zx}!function(e){e[e.STRING=1]="STRING",e[e.INT32=2]="INT32",e[e.UINT32=4]="UINT32",e[e.INT64=8]="INT64",e[e.UINT64=16]="UINT64",e[e.FLOAT=32]="FLOAT",e[e.DOUBLE=64]="DOUBLE",e[e.PRESENCE=128]="PRESENCE"}($w||={}),function(e){e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e[e.START_MAP=2]="START_MAP",e[e.START_LIST=3]="START_LIST",e[e.COUNT=4]="COUNT"}(Gw||={});function tS(e){switch(e){case 0:case 1:case 2:case 3:return{nullable:!!(1&e),columnScope:0,type:"scalarType",scalarType:{longID:!!(2&e),type:"logicalType",logicalType:0}};case 4:return{nullable:!1,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:0,children:[]}};case 30:return{nullable:!1,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:1,children:[]}};case 31:return{nullable:!0,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:2,children:[]}};default:return function(e){let t;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}return{nullable:!!(1&e),columnScope:0,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:t}}}(e)}}function rS(e){return 30===e||31===e}function iS(e){if("scalarType"===e.type){let t=e.scalarType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if("logicalType"===t.type)return!1}else if("complexType"===e.type){let t=e.complexType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:case 2:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}function nS(e){return"scalarType"===e.type&&"logicalType"===e.scalarType?.type&&0===e.scalarType.logicalType}function aS(e){return"complexType"===e.type&&"physicalType"===e.complexType?.type&&0===e.complexType.physicalType}const oS=new TextDecoder,sS="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function lS(e,t){let r=gx(e,t,1)[0];if(0===r)return"";let i=t.get(),n=i+r,a=e.subarray(i,n);return t.add(r),oS.decode(a)}function uS(e,t){let r=gx(e,t,1)[0]>>>0,i=r>=10?tS(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n={...i,name:lS(e,t)};if("complexType"===n.type&&rS(r)){let r=n.complexType,i=gx(e,t,1)[0]>>>0;r.children=Array(i);for(let n=0;n<i;n++)r.children[n]=uS(e,t)}return function(e){let t=e.name,r=e.nullable;return"scalarType"===e.type?{type:"scalarField",scalarField:e.scalarType,name:t,nullable:r}:{type:"complexField",complexField:e.complexType,name:t,nullable:r}}(n)}function cS(e,t){let r,i=gx(e,t,1)[0]>>>0,n=tS(i);if(!n)throw Error(`Unsupported column type code ${i}. Supported: ${sS}`);if(function(e){return e>=10}(i))r=lS(e,t);else if(i<4)r="id";else{if(4!==i)throw Error(`Unsupported column type code ${i}. Supported: ${sS}`);r="geometry"}let a={...n,name:r};if("complexType"===a.type&&rS(i)){let r=gx(e,t,1)[0]>>>0,i=a.complexType;i.children=Array(r);for(let n=0;n<r;n++)i.children[n]=uS(e,t)}return a}function hS(e,t){let r={featureTables:[]},i={};if(i.name=lS(e,t),0===i.name.length)throw Error("Missing layer name");let n=gx(e,t,1)[0]>>>0,a=gx(e,t,1)[0]>>>0;i.columns=Array(a);for(let r=0;r<a;r++)i.columns[r]=cS(e,t);return r.featureTables.push(i),[r,n]}function dS(e,t,r,i,n,a,o=!1){let s=t.scalarType?.longID?6:4,l="number"==typeof a?void 0:a,u=pw(n,a,e,r,6===s?"int64":"int32");if(4===s)switch(u){case qx.FLAT:return new Hb(i,tw(e,r,n,void 0,l),a);case qx.SEQUENCE:{let t=ow(e,r,n);return new Yb(i,t[0],t[1],n.numRleValues,!1)}case qx.CONST:return new Jb(i,aw(e,r,n),a,!1)}switch(u){case qx.FLAT:return o?new Xb(i,function(e,t,r,i){let n=function(e,t,r){if(r.physicalLevelTechnique===tx.VARINT)return function(e,t){switch(t.logicalLevelTechnique1){case ex.DELTA:if(t.logicalLevelTechnique2===ex.RLE){let r=t;e=Ex(e,r.runs,r.numRleValues)}return function(e){e[0]=Sx(e[0]);let t=e.length/4*4,r=1;if(t>=4)for(;r<t-4;r+=4){let t=e[r],i=e[r+1],n=e[r+2],a=e[r+3];e[r]=Sx(t)+e[r-1],e[r+1]=Sx(i)+e[r],e[r+2]=Sx(n)+e[r+1],e[r+3]=Sx(a)+e[r+2]}for(;r!==e.length;++r)e[r]=Sx(e[r])+e[r-1]}(e),e;case ex.RLE:return function(e,t){return Ex(e,t.runs,t.numRleValues)}(e,t);case ex.NONE:return e;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}(function(e,t,r){let i=new Float64Array(r);for(let n=0;n<r;n++)i[n]=vx(e,t);return i}(e,t,r.numValues),r);let i=dw(nw(e,t,r),r);return Float64Array.from(i,Number)}(e,t,r);return i?Wx(n,i,0):n}(e,r,n,l),a):new yw(i,uw(e,r,n,l),a);case qx.SEQUENCE:{let t=sw(e,r,n);return new _w(i,t[0],t[1],n.numRleValues,!1)}case qx.CONST:return new Ow(i,cw(e,r,n),a,!1)}throw Error("Vector type not supported for id column.")}var pS=class{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case fw.POINT:case fw.MULTIPOINT:this.type=1;break;case fw.LINESTRING:case fw.MULTILINESTRING:this.type=2;break;case fw.POLYGON:case fw.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let r=[];for(let e of t)r.push(new $a(e.x,e.y));e.push(r)}return e}},fS=class{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new pS(this.features[e],this.extent)}},mS=class{constructor(e){this.layers={};let t=function(e,t,r=!0){let i=new rx(0),n=[];for(;i.get()<e.length;){let a=gx(e,i,1)[0]>>>0,o=i.get()+a;if(o>e.length)throw Error(`Block overruns tile: ${o} > ${e.length}`);let s=gx(e,i,1)[0]>>>0;if(1!==s&&2!==s){i.set(o);continue}let[l,u]=hS(e,i),c=l.featureTables[0],h=null,d=null,p=[],f=0;for(let n of c.columns){let a=n.name;if(nS(n)){let t=null;if(n.nullable){let r=Gx(e,i),n=i.get(),a=Xx(e,r.numValues,r.byteLength,i);i.set(n+r.byteLength),t=new Zx(a,r.numValues)}let o=Gx(e,i);f=t?t.size():o.decompressedCount,h=dS(e,n,i,a,o,t??f,r)}else if(aS(n)){let r=gx(e,i,1)[0];if(0===f){let t=i.get();f=Gx(e,i).decompressedCount,i.set(t)}t&&(t.scale=t.extent/u),d=Mw(e,r,i,f,t)}else{let t=iS(n)?gx(e,i,1)[0]:1;if(0===t)continue;let r=Qw(e,i,n,t,f,void 0);if(r)if(Array.isArray(r))for(let e of r)p.push(e);else p.push(r)}}let m=new Qb(c.name,d,h,p,u);n.push(m),i.set(o)}return n}(new Uint8Array(e));this.layers=t.reduce((e,t)=>({...e,[t.name]:new fS(t)}),{})}};function gS(e,t,r,i,n){return ps(e,(e,a)=>{let o=t instanceof Hd?t.get(a):null;return function(e){return"object"==typeof e&&!!e&&"evaluate"in e}(o)?o.evaluate(r,i,void 0,n):o})}function yS(e,t){return t-e}Fd("FeatureIndex",class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new kd(Oo,16,0),this.grid3D=new kd(Oo,16,0),this.featureIndexArray=new Kp,this.promoteId=t}insert(e,t,r,i,n,a){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let s=a?this.grid3D:this.grid;for(let e of t){let t=[1/0,1/0,-1/0,-1/0];for(let r of e)t[0]=Math.min(t[0],r.x),t[1]=Math.min(t[1],r.y),t[2]=Math.max(t[2],r.x),t[3]=Math.max(t[3],r.y);t[0]<8192&&t[1]<8192&&t[2]>=0&&t[3]>=0&&s.insert(o,t[0],t[1],t[2],t[3])}}loadVTLayers(){return this.vtLayers||("mlt"===this.encoding?this.vtLayers=new mS(this.rawTileData).layers:this.vtLayers=new gy(new sv(this.rawTileData)).layers,this.sourceLayerCoder=new Gb(this.vtLayers?Object.keys(this.vtLayers).sort():[$b])),this.vtLayers}query(e,t,r,i){this.loadVTLayers();let n=e.params,a=Oo/e.tileSize/e.scale,o=Mh(n.filter,"queryRenderedFeatures filter",n.globalState),s=e.queryGeometry,l=e.queryPadding*a,u=sy.fromPoints(s),c=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),h=sy.fromPoints(e.cameraQueryGeometry).expandBy(l),d=this.grid3D.query(h.minX,h.minY,h.maxX,h.maxY,(t,r,i,n)=>function(e,t,r,i,n){for(let a of e)if(t<=a.x&&r<=a.y&&i>=a.x&&n>=a.y)return!0;let a=[new $a(t,r),new $a(t,n),new $a(i,n),new $a(i,r)];if(e.length>2)for(let t of a)if(ym(e,t))return!0;for(let t=0;t<e.length-1;t++)if(_m(e[t],e[t+1],a))return!0;return!1}(e.cameraQueryGeometry,t-l,r-l,i+l,n+l));for(let e of d)c.push(e);c.sort(yS);let p,f={};for(let l of c){if(l===p)continue;p=l;let u=this.featureIndexArray.get(l),c=null;this.loadMatchingFeature(f,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,o,n.layers,n.availableImages,t,r,i,(t,r,i)=>(c||=im(t),r.queryIntersectsFeature({queryGeometry:s,feature:t,featureState:i,geometry:c,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return f}loadMatchingFeature(e,t,r,i,n,a,o,s,l,u,c){let h=this.bucketLayerIDs[t];if(a&&!h.some(e=>a.has(e)))return;let d=this.sourceLayerCoder.decode(r),p=this.vtLayers[d].feature(i);if(n.needGeometry){let e=nm(p,!0);if(!n.filter(new Nd(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!n.filter(new Nd(this.tileID.overscaledZ),p))return;let f=this.getId(p,d);for(let t of h){if(a&&!a.has(t))continue;let r=s[t];if(!r)continue;let n={};f&&u&&(n=u.getState(r.sourceLayer||"_geojsonTileLayer",f));let h=os({},l[t]);h.paint=gS(h.paint,r.paint,p,n,o),h.layout=gS(h.layout,r.layout,p,n,o);let d=!c||c(p,r,n);if(!d)continue;let m=new qb(p,this.z,this.x,this.y,f);m.layer=h;let g=e[t];void 0===g&&(g=e[t]=[]),g.push({featureIndex:i,feature:m,intersectionZ:d})}}lookupSymbolFeatures(e,t,r,i,n,a,o,s){let l={};this.loadVTLayers();let u=Mh(n.filterSpec,"queryRenderedFeatures symbol filter",n.globalState);for(let n of e)this.loadMatchingFeature(l,r,i,n,u,a,o,s,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let r of t)if(e===r)return!0;return!1}getId(e,t){let r=e.id;if(this.promoteId){let i="string"==typeof this.promoteId?this.promoteId:this.promoteId[t];r=e.properties[i],"boolean"==typeof r&&(r=Number(r)),void 0===r&&e.properties?.cluster&&this.promoteId&&(r=Number(e.properties.cluster_id))}return r}},{omit:["rawTileData","sourceLayerCoder"]});var _S=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,r){let i=e.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);let n={value:t,timeout:void 0};if(void 0!==r&&(n.timeout=setTimeout(()=>{this.remove(e,n)},r)),this.data[i].push(n),this.order.push(i),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let r=e.wrapped().key,i=void 0===t?0:this.data[r].indexOf(t),n=this.data[r][i];return this.data[r].splice(i,1),n.timeout&&clearTimeout(n.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(n.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let r in this.data)for(let i of this.data[r])e(i.value)||t.push(i);for(let e of t)this.remove(e.value.tileID,e)}};function vS(){var e=new Ha(4);return Ha!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let bS,xS,wS;const SS={frame(e,t,r,i){let n=i||window,a=n.requestAnimationFrame(e=>{o(),t(e)}),{unsubscribe:o}=Ss(e.signal,"abort",()=>{o(),n.cancelAnimationFrame(a),r(new zs(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((r,i)=>{this.frame(e,r,i,t)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t;if(Za()&&!Wa())t=new OffscreenCanvas(e.width,e.height).getContext("2d",{willReadFrequently:!0});else{let r=window.document.createElement("canvas");r.width=e.width,r.height=e.height,t=r.getContext("2d",{willReadFrequently:!0})}if(!t)throw Error("failed to create canvas 2d context");return t.drawImage(e,0,0,e.width,e.height),t},resolveURL:e=>(bS||=document.createElement("a"),bS.href=e,bS.href),get hardwareConcurrency(){return typeof navigator<"u"&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return void 0===wS?!!matchMedia&&(xS??=matchMedia("(prefers-reduced-motion: reduce)"),xS.matches):wS},set prefersReducedMotion(e){wS=e}},TS=new class{constructor(){this._frozenAt=null}getCurrentTime(){return null===this._frozenAt?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return null!==this._frozenAt}};function PS(){return TS.getCurrentTime()}var ES=class e{static{this.docStyle=typeof window<"u"&&window.document?.documentElement.style}static{this.selectProp=!e.docStyle||"userSelect"in e.docStyle?"userSelect":"webkitUserSelect"}static create(e,t,r){let i=window.document.createElement(e);return void 0!==t&&(i.className=t),r&&r.appendChild(i),i}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){e.docStyle&&e.selectProp&&(e.userSelect=e.docStyle[e.selectProp],e.docStyle[e.selectProp]="none")}static enableDrag(){e.docStyle&&e.selectProp&&(e.docStyle[e.selectProp]=e.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",e.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",e.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",e.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,t,r){let i=t.boundingClientRect;return new $a((r.clientX-i.left)/t.x-e.clientLeft,(r.clientY-i.top)/t.y-e.clientTop)}static mousePos(t,r){let i=e.getScale(t);return e.getPoint(t,i,r)}static touchPos(t,r){let i=[],n=e.getScale(t);for(let a of r)i.push(e.getPoint(t,n,a));return i}static sanitize(t){let r=(new DOMParser).parseFromString(t,"text/html").body||document.createElement("body"),i=r.querySelectorAll("script, iframe");for(let e of i)e.remove();return e.clean(r),r.innerHTML}static isPossiblyDangerous(e,t){let r=t.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(e)&&(r.includes("javascript:")||r.includes("data:"))||"srcdoc"===e||e.startsWith("on"))return!0}static clean(t){let r=t.children;for(let t of r)e.removeAttributes(t),e.clean(t)}static removeAttributes(t){for(let{name:r,value:i}of Array.from(t.attributes))e.isPossiblyDangerous(r,i)&&t.removeAttribute(r)}};let DS;(function(e){let t,r,i,n;e.resetRequestQueue=()=>{t=[],r=0,i=0,n={}},e.addThrottleControl=e=>{let t=i++;return n[t]=e,t},e.removeThrottleControl=e=>{delete n[e],s()},e.transformAndGetImage=async function(e,t,r,i,n=!0,a){let o=await e.transformRequest(t,r);return Bs(i.signal),DS.getImage(o,i,n,a)},e.getImage=(e,r,i=!0,n)=>new Promise((a,o)=>{e.headers||={},e.headers.accept="image/webp,*/*",os(e,{type:"image"});let l={abortController:r,requestParameters:e,supportImageRefresh:i,imageBitmapOptions:n,state:"queued",onError:e=>{o(e)},onSuccess:e=>{a(e)}};t.push(l),s()});let a=(e,t)=>"function"==typeof createImageBitmap?(async(e,t)=>{let r=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(r,t)}catch(e){throw Error(`Could not load image because of ${jo(e).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})(e,t):(e=>new Promise((t,r)=>{let i=new Image;i.onload=()=>{t(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>i.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=")},i.onerror=()=>r(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let n=new Blob([new Uint8Array(e)],{type:"image/png"});i.src=URL.createObjectURL(n)}))(e),o=async e=>{e.state="running";let{requestParameters:t,supportImageRefresh:i,imageBitmapOptions:n,onError:o,onSuccess:u,abortController:c}=e,h=!1===i&&!n&&!bs(self)&&!Ns(t.url)&&(!t.headers||Object.keys(t.headers).reduce((e,t)=>e&&"accept"===t,!0));r++;let d=h?l(t,c):Gs(t,c);try{let t=await d;delete e.abortController,e.state="completed",t.data instanceof HTMLImageElement||ws(t.data)?u(t):t.data&&0!==t.data.byteLength?u({data:await a(t.data,n),cacheControl:t.cacheControl,expires:t.expires}):u({data:null,cacheControl:t.cacheControl,expires:t.expires})}catch(t){delete e.abortController,o(jo(t))}finally{r--,s()}},s=()=>{let e=(()=>{for(let e of Object.keys(n))if(n[e]())return!0;return!1})()?js.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:js.MAX_PARALLEL_IMAGE_REQUESTS;for(let i=r;i<e&&t.length>0;i++){let e=t.shift();e.abortController.signal.aborted?i--:o(e)}},l=(e,t)=>new Promise((r,i)=>{let n=new Image,a=e.url,o=e.credentials;o&&"include"===o?n.crossOrigin="use-credentials":(o&&"same-origin"===o||!Ws(a))&&(n.crossOrigin="anonymous"),t.signal.addEventListener("abort",()=>{n.src="",i(new zs(t.signal.reason))}),n.fetchPriority="high",n.onload=()=>{n.onerror=n.onload=null,r({data:n})},n.onerror=()=>{n.onerror=n.onload=null,!t.signal.aborted&&i(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},n.src=a})})(DS||={}),DS.resetRequestQueue();var AS=class{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}},IS=class extends Ks{},CS=class extends IS{},kS=class extends IS{constructor(e={}){super("style.load",e)}},MS=class extends IS{constructor(e,t={}){super(e,t),this.dataType="style"}},FS=class extends IS{constructor(e,t={}){super(e,t),this.dataType="source"}},RS=class extends IS{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r,i={}){r=r instanceof MouseEvent?r:new MouseEvent(e,r);let n=ES.mousePos(t.getCanvas(),r);super(e,os({point:n,lngLat:t.unproject(n),originalEvent:r},i)),this._defaultPrevented=!1,this.target=t}},LS=class extends IS{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r){let i="touchend"===e?r.changedTouches:r.touches,n=ES.touchPos(t.getCanvasContainer(),i),a=n.map(e=>t.unproject(e)),o=n.reduce((e,t,r,i)=>e.add(t.div(i.length)),new $a(0,0));super(e,{points:n,point:o,lngLats:a,lngLat:t.unproject(o),originalEvent:r}),this._defaultPrevented=!1}},zS=class extends IS{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}},OS=class extends IS{},BS=class extends IS{constructor(e={}){super("terrain",e)}},jS=class extends IS{constructor(e={}){super("projectiontransition",e)}},NS=class extends IS{},US=class extends IS{constructor(e={}){super("styleimagemissing",e)}};function VS(e,t){let r={};for(let t in e)"ref"!==t&&(r[t]=e[t]);return tl.forEach(e=>{e in t&&(r[e]=t[e])}),r}function $S(e){e=e.slice();let t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=VS(e[r],t[e[r].ref]));return e}function GS(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!GS(e[r],t[r]))return!1;return!0}if("object"==typeof e&&e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!GS(e[r],t[r]))return!1;return!0}return e===t}function qS(e,t){e.push(t)}function ZS(e,t,r){qS(r,{command:"addSource",args:[e,t[e]]})}function WS(e,t,r){qS(t,{command:"removeSource",args:[e]}),r[e]=!0}function HS(e,t,r,i){WS(e,r,i),ZS(e,t,r)}function XS(e,t,r){let i;for(i in e[r])if(Object.prototype.hasOwnProperty.call(e[r],i)&&"data"!==i&&!GS(e[r][i],t[r][i]))return!1;for(i in t[r])if(Object.prototype.hasOwnProperty.call(t[r],i)&&"data"!==i&&!GS(e[r][i],t[r][i]))return!1;return!0}function KS(e,t,r,i,n,a){e||={},t||={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(GS(e[o],t[o])||r.push({command:a,args:[i,o,t[o],n]}));for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&!Object.prototype.hasOwnProperty.call(e,o)&&(GS(e[o],t[o])||r.push({command:a,args:[i,o,t[o],n]}))}function YS(e){return e.id}function JS(e,t){return e[t.id]=t,e}function QS(e){let t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){let r=[];for(let{id:i,url:n}of e){let e=`${i}${n}`;r.includes(e)||(r.push(e),t.push({id:i,url:n}))}}return t}function eT(e,t,r){try{let i=new URL(e);return i.pathname+=`${t}${r}`,i.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}var tT=class extends Js{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let e of Object.keys(this.images))this.removeImage(e);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let e=t.spriteData;t.data=new Nm({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t,this._imagesIds=null,t.isWebGLImage&&this.updateImage(e,t,!1))}_validate(e,t){let r=!0,i=t.data||t.spriteData;return this._validateStretch(t.stretchX,i?.width)||(this.fire(new Ys(Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(t.stretchY,i?.height)||(this.fire(new Ys(Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(t.content,t)||(this.fire(new Ys(Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let r=0;for(let i of e){if(i[0]<r||i[1]<i[0]||t<i[1])return!1;r=i[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;let r=t.spriteData,i=r?.width||t.data.width,n=r?.height||t.data.height;return!(e[0]<0||i<e[0]||e[1]<0||n<e[1]||e[2]<0||i<e[2]||e[3]<0||n<e[3]||e[2]<e[0])&&e[3]>=e[1]}updateImage(e,t,r=!0){let i=this.images[e];if(r){let e=i.data||i.spriteData;if(e.width!==t.data.width||e.height!==t.data.height)throw Error(`size mismatch between old image (${e.width}x${e.height}) and new image (${t.data.width}x${t.data.height}).`)}t.version=(i.version??0)+1,this.images[e]=t,this.updateVersion++}removeImage(e){let t=this.images[e];t&&(delete this.images[e],this._imagesIds=null,t.userImage?.onRemove&&t.userImage.onRemove())}listImages(){return this._imagesIds??=Object.keys(this.images),this._imagesIds}_getSpriteImageId(e,t){return"default"===e?t:`${e}:${t}`}setSpriteImages(e,t){let r=this._spriteImagesIds[e]??[],i=[];for(let r in t){let n=this._getSpriteImageId(e,r);i.push(n),n in this.images?this.updateImage(n,t[r],!1):this.addImage(n,t[r])}let n=new Set(i),a=r.filter(e=>!n.has(e));for(let e of a)this.removeImage(e);return this._spriteImagesIds[e]=i,{loaded:i,removed:a}}removeSpriteImages(e){let t=this._spriteImagesIds[e]??[];for(let e of t)this.removeImage(e);return delete this._spriteImagesIds[e],t}removeAllSpriteImages(){let e=Object.values(this._spriteImagesIds).flat();for(let t of e)this.removeImage(t);return this._spriteImagesIds={},e}setMissingImageResolver(e){this.missingImageResolver=e}getImages(e){return new Promise((t,r)=>{let i=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(i=!1);this.isLoaded()||i?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}async _getImagesForIds(e){let t=new Set(e.filter(e=>!this.getImage(e))),r=this.missingImageResolver;r&&await Promise.allSettled(Array.from(t,e=>r(e)));let i={};for(let r of e){let e=this.getImage(r);e&&(t.delete(r),i[r]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!e.userImage?.render,isWebGLImage:e.isWebGLImage})}for(let e of t)this.fire(new US({id:e})),_s(`Image "${e}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return i}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this._renderCallbacksDispatchedThisFrame[t])continue;this._renderCallbacksDispatchedThisFrame[t]=!0;let e=this.getImage(t);e||_s(`Image with ID: "${t}" was not found`),dv(e)&&this.updateImage(t,e)}}cloneImages(){let e={};for(let t in this.images){let r=this.images[t];e[t]={...r,data:r.data?r.data.clone():null}}return e}},rT=class{constructor(e){this._imageManager=e,this._entries={},this._image=new Nm({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&=(this._texture.destroy(),null),this._entries={},this._image=new Nm({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:e,height:t}=this._image;return{width:e,height:t}}getPattern(e){let t=this._imageManager.getImage(e);if(!t)return null;let r=this._entries[e];if(r?.image!==t){let r={w:t.data.width+2,h:t.data.height+2,x:0,y:0};this._entries[e]={bin:r,position:new fv(r,t),image:t}}else{if(r.position.version===t.version)return r.position;r.position.version=t.version}return this._update(),this._entries[e].position}bind(e){let t=e.gl;this._texture?this._dirty&&=(this._texture.update(this._image),!1):(this._texture=new Km(e,this._image,t.RGBA),this._dirty=!1),this._texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_update(){for(let e in this._entries)this._imageManager.getImage(e)||delete this._entries[e];let e=[];for(let t in this._entries)e.push(this._entries[t].bin);let{w:t,h:r}=pv(e),i=this._image;i.resize({width:t||1,height:r||1});for(let e in this._entries){let{bin:t}=this._entries[e],r=t.x+1,n=t.y+1,a=this._entries[e].image.data,o=a.width,s=a.height;Nm.copy(a,i,{x:0,y:0},{x:r,y:n},{width:o,height:s}),Nm.copy(a,i,{x:0,y:s-1},{x:r,y:n-1},{width:o,height:1}),Nm.copy(a,i,{x:0,y:0},{x:r,y:n+s},{width:o,height:1}),Nm.copy(a,i,{x:o-1,y:0},{x:r-1,y:n},{width:1,height:s}),Nm.copy(a,i,{x:0,y:0},{x:r+o,y:n},{width:1,height:s})}this._dirty=!0}};const iT=1114111,nT={start:0,end:iT};let aT=0;function oT(e){let t=/^u\+([0-9a-f]*)(\?+)$/i.exec(e);if(t){let[,e,r]=t;return e.length+r.length>6?null:sT(parseInt(`${e}${"0".repeat(r.length)}`,16),parseInt(`${e}${"f".repeat(r.length)}`,16))}let r=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(e);if(!r)return null;let i=parseInt(r[1],16);return sT(i,void 0===r[2]?i:parseInt(r[2],16))}function sT(e,t){return e>t||e>iT?null:{start:e,end:Math.min(t,iT)}}function lT(e,t){return e.ranges.some(({start:e,end:r})=>t>=e&&t<=r)}var uT=class{constructor(e){this.requestManager=e,this._faces={},this._registered=new Set}setFontFaces(e){this._unregisterAll(),this._faces={};for(let[t,r]of Object.entries(e??{})){let e=Array.isArray(r)?r:[r];this._faces[t]=e.map(e=>this._declareFontFace(t,e)).filter(e=>null!==e)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(e,t){for(let r of e.split(","))for(let e of this._faces[r.trim()]??[])if(lT(e,t)&&(e.loaded??=this._loadFontFace(e),await e.loaded))return e.family;return null}_declareFontFace(e,t){let r="string"==typeof t?{url:t}:t;if("string"!=typeof r?.url)return _s(`Ignoring the font face declared for "${e}": it has no URL.`),null;let i="maplibre-gl-font-face-"+aT++,n=r["unicode-range"];if(!n?.length)return{url:r.url,ranges:[nT],family:i};let a=[];for(let e of n){let t=oT(e);t?a.push(t):_s(`Ignoring the unicode range "${e}" of the font face at ${r.url}: it is not a valid range.`)}return a.length?{url:r.url,ranges:a,family:i}:null}async _loadFontFace(e){if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)return _s(`Ignoring the font face at ${e.url}: this environment has no CSS Font Loading API.`),!1;let t;try{return t=new FontFace(e.family,await this._downloadFontFile(e.url)),!!Object.values(this._faces).some(t=>t.includes(e))&&(document.fonts.add(t),this._registered.add(t),await t.load(),!0)}catch(r){return t&&this._unregister(t),_s(`Ignoring the font face at ${e.url}: ${jo(r).message}`),!1}}async _downloadFontFile(e){let t=await this.requestManager.transformRequest(e,"Glyphs"),r=await Zs(t,new AbortController);if(!r?.data)throw Error(`the response was empty for the font file at ${e}`);return r.data}_unregister(e){document.fonts?.delete(e),this._registered.delete(e)}_unregisterAll(){for(let e of this._registered)document.fonts?.delete(e);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}};const cT=1e20,hT=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**(1/2.2);hT[e]=t*Math.abs(t)}hT[255]=-1e20;var dT=class{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:i=.25,fontFamily:n="sans-serif",fontWeight:a="normal",fontStyle:o="normal",lang:s=null}={}){this.buffer=t,this.radius=r,this.cutoff=i,this.lang=s;let l=this.size=e+4*t,u=this._createCanvas(l),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${o} ${a} ${e}px ${n}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(e,e);let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:n,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(r),s=Math.floor(-n),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a)-s)),u=Math.max(0,Math.min(this.size-this.buffer,o+Math.ceil(i))),c=l+2*this.buffer,h=u+2*this.buffer,d=Math.max(c*h,0),p=new Uint8ClampedArray(d),f={data:p,width:c,height:h,glyphWidth:l,glyphHeight:u,glyphTop:o,glyphLeft:s,glyphAdvance:t};if(0===l||0===u)return f;let{ctx:m,buffer:g,gridInner:y,gridOuter:_}=this;this.lang&&(m.lang=this.lang),m.clearRect(g,g,l,u),m.fillText(e,g-s,g+o);let v=m.getImageData(g,g,l,u);_.fill(cT,0,d),y.fill(0,0,d);let b=3;for(let e=0;e<u;e++){let t=(e+g)*c+g;for(let e=0;e<l;e++,b+=4,t++){let e=v.data[b];if(0===e)continue;let r=hT[e];_[t]=Math.max(0,r),y[t]=Math.max(0,-r)}}pT(_,0,0,c,h,c,this.f,this.v,this.z);let x=Math.min(g,1);pT(y,g-x,g-x,l+2*x,u+2*x,c,this.f,this.v,this.z);let w=255/this.radius,S=255*(1-this.cutoff);for(let e=0;e<d;e++){let t=Math.sqrt(_[e])-Math.sqrt(y[e]);p[e]=Math.round(S-w*t)}return f}};function pT(e,t,r,i,n,a,o,s,l){for(let u=t;u<t+i;u++)fT(e,r*a+u,a,n,o,s,l);for(let u=r;u<r+n;u++)fT(e,u*a+t,1,i,o,s,l)}function fT(e,t,r,i,n,a,o){a[0]=0,o[0]=-1e20,o[1]=cT,n[0]=e[t];for(let s=1,l=0,u=0;s<i;s++){n[s]=e[t+s*r];let i=s*s;do{let e=a[l];u=(n[s]-n[e]+i-e*e)/(s-e)/2}while(u<=o[l]&&--l>-1);l++,a[l]=s,o[l]=u,o[l+1]=cT}for(let s=0,l=0;s<i;s++){for(;o[l+1]<s;)l++;let i=a[l],u=s-i;e[t+s*r]=n[i]+u*u}}const mT=el.layout_symbol["text-font"].default.join(","),gT=(e,t)=>{let r=new dT(e);return r.buffer=t,r};var yT=class{constructor(e,t,r,i=gT){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=r,this.fontFaceManager=new uT(e),this.createRasterizer=i}setURL(e){this.url=e}setFontFaces(e){this.fontFaceManager.setFontFaces(e),this.entries={}}async getGlyphs(e){let t=[];for(let r in e)for(let i of e[r])t.push(this._getAndCacheGlyphsPromise(r,i));let r=await Promise.all(t),i={};for(let{stack:e,id:t,glyph:n}of r)i[e]||={},i[e][t]=n&&{id:n.id,bitmap:n.bitmap.clone(),metrics:n.metrics};return i}async _getAndCacheGlyphsPromise(e,t){this.entries[e]??={glyphs:{},requests:{},ranges:{}};let r=this.entries[e],i=r.glyphs[t];if(void 0!==i)return{stack:e,id:t,glyph:i};let n=t.codePointAt(0),a=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(e,n):null;return a?(i=r.glyphs[t]=await this._drawGlyph(r,e,t,a),{stack:e,id:t,glyph:i}):!this.url||R_(t)||this._charUsesLocalIdeographFontFamily(n)?(i=r.glyphs[t]=await this._drawGlyph(r,e,t),{stack:e,id:t,glyph:i}):await this._downloadAndCacheRangePromise(e,t)}async _downloadAndCacheRangePromise(e,t){let r=t.codePointAt(0),i=this.entries[e],n=Math.floor(r/256);if(i.ranges[n])return{stack:e,id:t,glyph:null};i.requests[n]||=this._loadGlyphRange(e,n);try{let a=await i.requests[n];for(let e in a)i.glyphs[String.fromCodePoint(+e)]=a[+e];return i.ranges[n]=!0,{stack:e,id:t,glyph:a[r]||null}}catch(a){let o=i.glyphs[t]=await this._drawGlyph(i,e,t);return this._warnOnMissingGlyphRange(o,n,r,jo(a)),{stack:e,id:t,glyph:o}}}async _loadGlyphRange(e,t){let r=256*t,i=r+255,n=await this.requestManager.transformRequest(this.url.replace("{fontstack}",e).replace("{range}",`${r}-${i}`),"Glyphs"),a=await Zs(n,new AbortController);if(!a?.data)throw Error(`Could not load glyph range. range: ${t}, ${r}-${i}`);let o={};for(let e of function(e){return new sv(e).readFields(lv,[])}(a.data))o[e.id]=e;return o}_warnOnMissingGlyphRange(e,t,r,i){let n=256*t;_s(`Unable to load glyph range ${t}, ${n}-${n+255}. Rendering codepoint U+${r.toString(16).padStart(4,"0").toUpperCase()} locally instead. ${i}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&function(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}(e)}async _drawGlyph(e,t,r,i){let n=(await this._getTinySDF(e,t,r,i)).draw(r),a=/^\p{gc=Cf}+$/u.test(r);return{id:r.codePointAt(0),bitmap:new jm({width:n.width||60,height:n.height||60},n.data),metrics:{width:a?0:n.glyphWidth/2||24,height:n.glyphHeight/2||24,left:n.glyphLeft/2+.5||0,top:n.glyphTop/2-27.5||-8,advance:a?0:n.glyphAdvance/2||24,isDoubleResolution:!0}}}_getTinySDF(e,t,r,i){let n=R_(r);if(i){let t=n?"clusterTinySDFs":"fontFaceTinySDFs";return e[t]??={},e[t][i]||=this._createTinySDF(i,!1,n?3:1),e[t][i]}let a=t===mT&&""!==this.localIdeographFontFamily&&this._charUsesLocalIdeographFontFamily(r.codePointAt(0)),o=a?this.localIdeographFontFamily:t;if(n)return e.clusterTinySDFs??={},e.clusterTinySDFs[o]||=this._createTinySDF(o,!0,3),e.clusterTinySDFs[o];let s=a?"ideographTinySDF":"tinySDF";return e[s]||=this._createTinySDF(o),e[s]}async _createTinySDF(e,t=!0,r=1){let i=e?e.split(","):[];i.push("sans-serif");let n=i.map(e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`).join(","),a=t?this._fontWeight(i[0]):void 0,o=t?this._fontStyle(i[0]):"normal";if(typeof document<"u"&&document.fonts?.load)try{await document.fonts.load(`${o} ${a||"normal"} 48px ${n}`)}catch(e){_s(`Failed to load font "${n}": ${jo(e).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(r-1)/4)),radius:16,cutoff:.25,fontFamily:n,fontWeight:a,fontStyle:o,lang:this.lang},6)}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){let t,r={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950};for(let[i,n]of Object.entries(r))RegExp(`\\b${i}\\b`,"i").test(e)&&(t=`${n}`);return t}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.fontFaceTinySDFs={},t.glyphs={},t.requests={},t.ranges={}}this.entries={},this.fontFaceManager.destroy()}};let _T;var vT=class extends Js{constructor(e,t){super(),this._transitionable=new $d(_T||=new rp({anchor:new Yd(el.light.anchor,"anchor"),position:new Yd(el.light.position,"position"),color:new Yd(el.light.color,"color"),intensity:new Yd(el.light.intensity,"intensity")}),"light",t),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return function([e,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,[e*Math.cos(t)*Math.sin(r),e*Math.sin(t)*Math.sin(r),e*Math.cos(r)]}(this.properties.get("position"))}setLight(e,t={}){if(!this._validate(Ed.light,e,t))for(let t in e){let r=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),r):this._transitionable.setValue(t,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,r){return Cd(this,e,{value:t},r)}};let bT;var xT=class extends Js{constructor(e,t){super(),this._transitionable=new $d(bT||=new rp({"sky-color":new Yd(el.sky["sky-color"],"sky-color"),"horizon-color":new Yd(el.sky["horizon-color"],"horizon-color"),"fog-color":new Yd(el.sky["fog-color"],"fog-color"),"fog-ground-blend":new Yd(el.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new Yd(el.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new Yd(el.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new Yd(el.sky["atmosphere-blend"],"atmosphere-blend")}),"sky",t),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Nd(0))}setSky(e,t={}){if(!this._validate(Ed.sky,e,t)){e||={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0};for(let t in e){let r=e[t];t.endsWith("-transition")?this._transitionable.setTransition(t.slice(0,-11),r):this._transitionable.setValue(t,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,r={}){return Cd(this,e,{value:t},r)}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},wT=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let r=e.join(",")+String(t);return this.dashEntry[r]||=this.addDash(e,t),this.dashEntry[r]}getDashRanges(e,t,r){let i=[],n=e.length%2==1?-e[e.length-1]*r:0,a=e[0]*r,o=!0;i.push({left:n,right:a,isDash:o,zeroLength:0===e[0]});let s=e[0];for(let t=1;t<e.length;t++){o=!o;let l=e[t];n=s*r,s+=l,a=s*r,i.push({left:n,right:a,isDash:o,zeroLength:0===l})}return i}addRoundDash(e,t,r){let i=t/2;for(let t=-r;t<=r;t++){let n=this.nextRow+r+t,a=this.width*n,o=0,s=e[o];for(let n=0;n<this.width;n++){n/s.right>1&&(s=e[++o]);let l,u=Math.abs(n-s.left),c=Math.abs(n-s.right),h=Math.min(u,c),d=t/r*(i+1);if(s.isDash){let e=i-Math.abs(d);l=Math.sqrt(h*h+e*e)}else l=i-Math.sqrt(h*h+d*d);this.data[a+n]=Math.max(0,Math.min(255,l+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let r=e[t],i=e[t+1];r.zeroLength?e.splice(t,1):i?.isDash===r.isDash&&(i.left=r.left,e.splice(t,1))}let t=e[0],r=e[e.length-1];t.isDash===r.isDash&&(t.left=r.left-this.width,r.right=t.right+this.width);let i=this.width*this.nextRow,n=0,a=e[n];for(let t=0;t<this.width;t++){t/a.right>1&&(a=e[++n]);let r=Math.abs(t-a.left),o=Math.abs(t-a.right),s=Math.min(r,o),l=a.isDash?s:-s;this.data[i+t]=Math.max(0,Math.min(255,l+128))}}addDash(e,t){let r=t?7:0,i=2*r+1;if(this.nextRow+i>this.height)return _s("LineAtlas out of space"),null;let n=0;for(let t of e)n+=t;if(0!==n){let i=this.width/n,a=this.getDashRanges(e,this.width,i);t?this.addRoundDash(a,i,r):this.addRegularDash(a)}let a={y:this.nextRow+r,height:2*r,width:n};return this.nextRow+=i,this.dirty=!0,a}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};function ST(e,t){if(t)try{return new Worker(e,{type:"module"})}catch(e){console.warn("Module worker not supported, falling back to classic worker",e)}return new Worker(e)}async function TT(){let e=js.WORKER_URL||function(){let e="file:///home/runner/work/sdk-web/sdk-web/node_modules/.pnpm/maplibre-gl@6.9.0/node_modules/maplibre-gl/dist/maplibre-gl.mjs";if(!/^https?:/.test(e))return"";let t=e.endsWith("-dev.mjs")?"maplibre-gl-worker-dev.mjs":"maplibre-gl-worker.mjs";return new URL(`./${t}`,e).href}(),t=!e?.endsWith(".cjs");if(!function(e){if(!e)return!1;let t=globalThis.location;if(!t)return!1;try{return new URL(e,t.href).origin!==t.origin}catch{return!1}}(e))return ST(e,t);if(t){let i=function(e){let t=new Blob([`import ${JSON.stringify(r(586)(e).href)}`],{type:"text/javascript"});return URL.createObjectURL(t)}(e);try{return ST(i,t)}finally{URL.revokeObjectURL(i)}}let i=await async function(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch worker script (${t.status}): ${e}`);let r=await t.text(),i=new Blob([r],{type:"text/javascript"});return URL.createObjectURL(i)}(e);try{return ST(i,t)}finally{URL.revokeObjectURL(i)}}var PT=class e{constructor(){this.active={},this.workersPromise=null}async acquire(t){if(this.active[t]=!0,!this.workersPromise){let t=[];for(;t.length<e.workerCount;)t.push(TT());this.workersPromise=Promise.all(t)}return(await this.workersPromise).slice()}release(e){if(delete this.active[e],0===this.numActive()&&this.workersPromise){let e=this.workersPromise;this.workersPromise=null,e.then(e=>{for(let t of e)t.terminate()})}}isPreloaded(){return!!this.active.maplibre_preloaded_worker_pool}numActive(){return Object.keys(this.active).length}};const ET=Math.floor(SS.hardwareConcurrency/2);let DT;function AT(){return DT||=new PT,DT}PT.workerCount=function(e){if(null==xs){let t=e.navigator?e.navigator.userAgent:null;xs=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return xs}(globalThis)?Math.max(Math.min(ET,3),1):1;var IT=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t,this.removed=!1,this.actorsPromise=this.initActors(t)}async initActors(e){let t=await this.workerPool.acquire(e);if(this.removed)return[];if(this.actors=t.map((t,r)=>{let i=new Rb(t,e);return i.name=`Worker ${r}`,i}),!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(e,t){let r=await this.actorsPromise;return Promise.all(r.map(r=>r.sendAsync({type:e,data:t})))}async getActor(){let e=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%e.length,e[this.currentActor]}async waitForInitComplete(){0===this.actors.length&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.removed=!0;for(let e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}async registerMessageHandler(e,t){let r=await this.actorsPromise;for(let i of r)i.registerMessageHandler(e,t)}async unregisterMessageHandler(e){let t=await this.actorsPromise;for(let r of t)r.unregisterMessageHandler(e)}};let CT;function kT(e,t){let r=Ka();return to(r,r,[1,1,0]),ro(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?eo(r,r,e.calculatePosMatrix(t.toUnwrapped())):r}function MT(e,t,r,i,n,a,o){let s=function(e,t,r){if(e)for(let i of e){let e=t[i];if(e?.source===r&&"fill-extrusion"===e.type)return!0}else for(let e in t){let i=t[e];if(i.source===r&&"fill-extrusion"===i.type)return!0}return!1}(n?.layers??null,t,e.id),l=a.maxPitchScaleFactor(),u=e.tilesIn(i,l,s);u.sort(FT);let c=[];for(let i of u)c.push({wrappedTileID:i.tileID.wrapped().key,queryResults:i.tile.queryRenderedFeatures(t,r,e.getState(),i.queryGeometry,i.cameraQueryGeometry,i.scale,n,a,l,kT(a,i.tileID),o?(e,t)=>o(i.tileID,e,t):void 0)});return function(e,t){for(let r in e)for(let i of e[r])RT(i,t);return e}(function(e){let t={},r={};for(let{queryResults:i,wrappedTileID:n}of e){r[n]||={};let e=r[n];for(let r in i){let n=i[r];e[r]||={};let a=e[r];t[r]||=[];for(let e of n)a[e.featureIndex]||(a[e.featureIndex]=!0,t[r].push(e))}}return t}(c),e)}function FT(e,t){let r=e.tileID,i=t.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function RT(e,t){let r=e.feature,i=t.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=i}async function LT(e,t,r,i){let n=e;if(e.url?n=(await qs(await t.transformRequest(e.url,"Source"),r)).data:await SS.frameAsync(r,i),!n)return null;let a=ss(os(n,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(a.vectorLayerIds=n.vector_layers.map(e=>e.id)),a}var zT=class e{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?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 _y?new _y(e.lng,e.lat):_y.convert(e),this}setSouthWest(e){return this._sw=e instanceof _y?new _y(e.lng,e.lat):_y.convert(e),this}extend(t){let r,i,n=this._sw,a=this._ne;if(t instanceof _y)r=t,i=t;else{if(!(t instanceof e)){if(Array.isArray(t)){if(4===t.length||t.every(Array.isArray)){let r=t;return this.extend(e.convert(r))}{let e=t;return this.extend(_y.convert(e))}}return t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(_y.convert(t)):this}if(r=t._sw,i=t._ne,!r||!i)return this}return n||a?(n.lng=Math.min(r.lng,n.lng),n.lat=Math.min(r.lat,n.lat),a.lng=Math.max(i.lng,a.lng),a.lat=Math.max(i.lat,a.lat)):(this._sw=new _y(r.lng,r.lat),this._ne=new _y(i.lng,i.lat)),this}getCenter(){return new _y((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 _y(this.getWest(),this.getNorth())}getSouthEast(){return new _y(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){let{lng:t,lat:r}=_y.convert(e),i=this._sw.lat<=r&&r<=this._ne.lat,n=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=t&&t>=this._ne.lng),i&&n}intersects(t){if(!((t=e.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let r=Math.abs(this.getEast()-this.getWest()),i=Math.abs(t.getEast()-t.getWest());if(r>=360||i>=360)return!0;let n=as(this.getWest(),-180,180),a=as(this.getEast(),-180,180),o=as(t.getWest(),-180,180),s=as(t.getEast(),-180,180),l=n>a,u=o>s;return!(!l||!u)||(l?s>=n||o<=a:u?a>=o||n<=s:o<=a&&s>=n)}static convert(t){return t instanceof e||!t?t:new e(t)}static fromLngLat(t,r=0){let i=360*r/40075017,n=i/Math.cos(Math.PI/180*t.lat);return new e(new _y(t.lng-n,t.lat-i),new _y(t.lng+n,t.lat+i))}adjustAntiMeridian(){let t=new _y(this._sw.lng,this._sw.lat),r=new _y(this._ne.lng,this._ne.lat);return t.lng>r.lng?new e(t,new _y(r.lng+360,r.lat)):new e(t,r)}},OT=class{constructor(e,t,r){this.bounds=zT.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let t=2**e.z,r=Math.floor(xy(this.bounds.getWest())*t),i=Math.floor(wy(this.bounds.getNorth())*t),n=Math.ceil(xy(this.bounds.getEast())*t),a=Math.ceil(wy(this.bounds.getSouth())*t);return e.x>=r&&e.x<n&&e.y>=i&&e.y<a}},BT=class extends Js{constructor(e,t,r,i){if(super(),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,os(this,ss(t,["url","scheme","tileSize","promoteId","encoding"])),this._options=os({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(i)}async load(e=!1){this._loaded=!1,this.fire(new FS("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await LT(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(os(this,t),t.bounds&&(this.tileBounds=new OT(t.bounds,this.minzoom,this.maxzoom)),this.fire(new FS("data",{sourceDataType:"metadata"})),this.fire(new FS("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,Os(e)||this.fire(new Ys(jo(e)))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return os({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:await this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(e),etag:e.etag};r.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete();let i="RT";if(e.actor&&"expired"!==e.state){if("loading"===e.state)return new Promise((t,r)=>{e.reloadPromise={resolve:t,reject:r}})}else e.actor=this.dispatcher.getReadyActor(),i="LT";e.abortController=new AbortController;try{let t=await e.actor.sendAsync({type:i,data:r},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t);let n={};return t?.etagUnmodified&&(n.unmodified=!0),n}catch(t){if(delete e.abortController,e.aborted||Os(t))return;if(t&&404!==t.status)throw t;this._afterTileLoadWorkerResponse(e,null)}}async _getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||void 0===this.map._zoomLevelsToOverscale)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,r=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:await this.map._requestManager.transformRequest(r,"Tile")}}_afterTileLoadWorkerResponse(e,t){if(t?.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},jT=class extends Js{constructor(e,t,r,i){super(),this.id=e,this.dispatcher=r,this.setEventedParent(i),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=os({type:"raster"},t),os(this,ss(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new FS("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await LT(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(os(this,t),t.bounds&&(this.tileBounds=new OT(t.bounds,this.minzoom,this.maxzoom)),this.fire(new FS("data",{sourceDataType:"metadata"})),this.fire(new FS("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,Os(e)||this.fire(new Ys(jo(e)))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return os({},this._options)}setPremultiplyAlpha(e){return this._premultiplyAlpha===e||this.setSourceProperty(()=>{this._premultiplyAlpha=e}),this}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this._premultiplyAlpha,i=r?void 0:{premultiplyAlpha:"none"};e.abortController=new AbortController;try{let n=await DS.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,i);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(n){this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let t=this.map.painter.context,i=t.gl,a=n.data??new Nm({width:1,height:1},new Uint8Array(4));e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0,premultiply:r}):(e.texture=new Km(t,a,i.RGBA,{useMipmap:!0,premultiply:r}),e.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}},NT=class extends jT{constructor(e,t,r,i){super(e,t,r,i),this.type="raster-dem",this.maxzoom=22,this._options=os({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let r=await DS.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(r){if(this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires}),!r.data)return void(e.state="loaded");let t=r.data,i=ws(t)&&Za()?t:await this.readImageNow(t),n={type:this.type,uid:e.uid,source:this.id,rawImageData:i,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&"expired"!==e.state&&"reloading"!==e.state)return;await this.dispatcher.waitForInitComplete(),(!e.actor||"expired"===e.state)&&(e.actor=this.dispatcher.getReadyActor()),e.dem=await e.actor.sendAsync({type:"LDT",data:n}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0,e.state="loaded"}}catch(t){if(delete e.abortController,e.aborted)e.state="unloaded";else if(t)throw e.state="errored",t}}async readImageNow(e){if(typeof VideoFrame<"u"&&Wa()){let t=e.width+4,r=e.height+4;try{return new Nm({width:t,height:r},await async function(e,t,r,i,n){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let a=new VideoFrame(e,{timestamp:0});try{let o=a?.format;if(!o||!o.startsWith("BGR")&&!o.startsWith("RGB"))throw Error(`Unrecognized format ${o}`);let s=o.startsWith("BGR"),l=new Uint8ClampedArray(i*n*4);if(await a.copyTo(l,function(e,t,r,i,n){let a=4*Math.max(-t,0),o=(Math.max(0,r)-r)*i*4+a,s=4*i,l=Math.max(0,t),u=Math.max(0,r);return{rect:{x:l,y:u,width:Math.min(e.width,t+i)-l,height:Math.min(e.height,r+n)-u},layout:[{offset:o,stride:s}]}}(e,t,r,i,n)),s)for(let e=0;e<l.length;e+=4){let t=l[e];l[e]=l[e+2],l[e+2]=t}return l}finally{a.close()}}(e,-2,-2,t,r))}catch{}}return SS.getImageData(e,2)}_getNeighboringTiles(e){let t=e.canonical,r=2**t.z,i=(t.x-1+r)%r,n=0===t.x?e.wrap-1:e.wrap,a=(t.x+1+r)%r,o=t.x+1===r?e.wrap+1:e.wrap,s={};return s[new Bb(e.overscaledZ,n,t.z,i,t.y).key]={backfilled:!1},s[new Bb(e.overscaledZ,o,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(s[new Bb(e.overscaledZ,n,t.z,i,t.y-1).key]={backfilled:!1},s[new Bb(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},s[new Bb(e.overscaledZ,o,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<r&&(s[new Bb(e.overscaledZ,n,t.z,i,t.y+1).key]={backfilled:!1},s[new Bb(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},s[new Bb(e.overscaledZ,o,t.z,a,t.y+1).key]={backfilled:!1}),s}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}};function UT(e,t){return t?e.properties[t]:e.id}function VT(e,t){let r={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties&&e.addOrUpdateProperties){let r=new Set(t.removeProperties);e.addOrUpdateProperties=e.addOrUpdateProperties.filter(e=>!r.has(e.key))}return(e.removeAllProperties||t.removeAllProperties)&&(r.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(r.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(r.newGeometry=t.newGeometry||e.newGeometry),r}function $T(e,t){if(e)for(let r of e){let e=UT(r,t);null!=e&&(r.id=e)}}function GT(e){if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map(e.add?.map(e=>[e.id,e])),t.update=new Map(e.update?.map(e=>[e.id,e])),t}function qT(e){return e&&0!==e.length?"number"==typeof e[0]?[e]:e.flatMap(e=>qT(e)):[]}function ZT(e){return"GeometryCollection"===e.type?e.geometries.flatMap(e=>ZT(e)):qT(e.coordinates)}function WT(e){let t,r=new zT;switch(e.type){case"FeatureCollection":t=e.features.flatMap(e=>ZT(e.geometry));break;case"Feature":t=ZT(e.geometry);break;default:t=ZT(e)}if(0===t.length)return r;for(let e of t){let[t,i]=e;r.extend([t,i])}return r}var HT=class extends Js{constructor(e,t,r,i){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:t.data},this.actorPromise=r.getActor(),this.setEventedParent(i),this._data="string"==typeof t.data?{url:t.data}:{geojson:t.data},this._options=os({},t),this._collectResourceTiming=t.collectResourceTiming,void 0!==t.maxzoom&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,void 0!==t.clusterMaxZoom&&this.maxzoom<=t.clusterMaxZoom&&_s(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t.clusterMaxZoom}".`),this.workerOptions=os({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(void 0===t.buffer?128:t.buffer),tolerance:this._pixelsToTileUnits(void 0===t.tolerance?.375:t.tolerance),extent:8192,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1,promoteId:"string"==typeof t.promoteId?t.promoteId:void 0,cluster:t.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:8192,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1}},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions)}_hasPendingWorkerUpdate(){return void 0!==this._pendingWorkerUpdate.data||void 0!==this._pendingWorkerUpdate.diff||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(8192/this.tileSize)}_tileUnitsToPixels(e){return e/(8192/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||void 0===e||_s(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${t}"`),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data="string"==typeof e?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e},this._updateWorkerData()}updateData(e){return this._pendingWorkerUpdate.diff=function(e,t,r){if(!e)return t||{};if(!t)return e||{};r&&($T(e.add,r),$T(t.add,r));let i=GT(e),n=GT(t);!function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let r of t.remove)e.add.delete(r),e.update.delete(r);for(let[r,i]of t.update){let n=e.update.get(r);n&&(t.update.set(r,VT(n,i)),e.update.delete(r))}}(i,n);let a={};if((i.removeAll||n.removeAll)&&(a.removeAll=!0),a.remove=new Set([...i.remove,...n.remove]),a.add=new Map([...i.add,...n.add]),a.update=new Map([...i.update,...n.update]),a.remove.size&&a.add.size)for(let e of a.add.keys())a.remove.delete(e);let o=function(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}(a);return r&&function(e,t){if(e)for(let r of e)null!=UT(r,t)&&delete r.id}(o.add,r),o}(this._pendingWorkerUpdate.diff,e),this._updateWorkerData()}async getData(){return this._data.url&&await this.once("data"),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}async getBounds(){return WT(await this.getData())}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,void 0!==e.clusterRadius&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),void 0!==e.clusterMaxZoom&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:e,clusterOptions:t}=this.workerOptions.geojsonVtOptions;return{cluster:e,clusterMaxZoom:t.maxZoom,clusterRadius:this._tileUnitsToPixels(t.radius)}}async getClusterExpansionZoom(e){return(await this.actorPromise).sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterChildren(e){return(await this.actorPromise).sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterLeaves(e,t,r){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:r}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate())return void _s(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:e,diff:t,updateCluster:r}=this._pendingWorkerUpdate,i=this._getLoadGeoJSONParameters(e,t,r);void 0===e?t?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(i),await this._updatePromise}async _getLoadGeoJSONParameters(e,t,r){let i=os({type:this.type,source:this.id},this.workerOptions);return"string"==typeof e?(i.request=await this.map._requestManager.transformRequest(SS.resolveURL(e),"Source"),i.request.collectResourceTiming=this._collectResourceTiming,i):void 0!==e?(i.data=e,i):t?(i.dataDiff=t,i):r?(i.updateCluster=!0,i):void 0}async _dispatchWorkerUpdate(e){this._isUpdatingWorker=!0,this.fire(new FS("dataloading"));try{let t=await e,r=await(await this.actorPromise).sendAsync({type:"LD",data:t});if(this._isUpdatingWorker=!1,this._removed||r.abandoned)return void this.fire(new FS("dataabort"));r.data&&(this._data={geojson:r.data});let i=this._applyDiffToSource(t.dataDiff),n=this._getShouldReloadTileOptions(i),a={};this._applyResourceTiming(a,r),this.fire(new FS("data",{...a,sourceDataType:"metadata"})),this.fire(new FS("data",{...a,sourceDataType:"content",shouldReloadTileOptions:n}))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new FS("dataabort"));this.fire(new Ys(jo(e)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(e,t){if(!this._collectResourceTiming)return;let r=t.resourceTiming?.[this.id];if(!r)return;let i=r.slice(0);i?.length&&os(e,{resourceTiming:i})}_applyDiffToSource(e){if(!e)return;let t="string"==typeof this.promoteId?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let e=function(e,t){let r=new Map;if(null==e||null==e.type)return r;if("Feature"===e.type){let i=UT(e,t);return null==i?void 0:(r.set(i,e),r)}if("FeatureCollection"===e.type){let i=new Set;for(let n of e.features){let e=UT(n,t);if(null==e||i.has(e))return;i.add(e),r.set(e,n)}return r}}(this._data.geojson,t);if(!e)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;let r=function(e,t,r){let i=[];if(t.removeAll)e.clear();else if(t.remove)for(let r of t.remove){let t=e.get(r);t&&(i.push(t.geometry),e.delete(r))}if(t.add)for(let n of t.add){let t=UT(n,r);if(null==t)continue;let a=e.get(t);a&&i.push(a.geometry),i.push(n.geometry),e.set(t,n)}if(t.update)for(let r of t.update){let t=e.get(r.id);if(!t)continue;let n=!!r.newGeometry,a=r.removeAllProperties||r.removeProperties?.length>0||r.addOrUpdateProperties?.length>0;if(!n&&!a)continue;i.push(t.geometry);let o={...t};if(e.set(r.id,o),n&&(i.push(r.newGeometry),o.geometry=r.newGeometry),a){if(o.properties=r.removeAllProperties?{}:{...o.properties||{}},r.removeProperties)for(let e of r.removeProperties)delete o.properties[e];if(r.addOrUpdateProperties)for(let{key:e,value:t}of r.addOrUpdateProperties)o.properties[e]=t}}return i}(this._data.updateable,e,t);return e.removeAll||this._options.cluster?void 0:r}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(e=>WT(e))}}shouldReloadTile(e,{affectedBounds:t}){if("loading"===e.state)return!0;if("unloaded"===e.state)return!1;let{buffer:r,extent:i}=this.workerOptions.geojsonVtOptions,n=function({x:e,y:t,z:r},i=0){let n=Ty((e-i)/2**r),a=Py((t+1+i)/2**r),o=Ty((e+1+i)/2**r),s=Py((t-i)/2**r);return new zT([n,a],[o,s])}(e.tileID.canonical,r/i);for(let e of t)if(n.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=await this.actorPromise;let r={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;try{let i=await(await this.actorPromise).sendAsync({type:t,data:r},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(i,this.map.painter,"RT"===t)}catch(t){if(delete e.abortController,e.aborted||Os(t))return;throw t}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await(await this.actorPromise).sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then(e=>e.sendAsync({type:"RS",data:{type:this.type,source:this.id}}))}serialize(){return os({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}};const XT=[0,0,1],KT=(e,t,r,i,n,a)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_image_warp:a,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:QT(i.paint.get("raster-saturation")),u_contrast_factor:JT(i.paint.get("raster-contrast")),u_spin_weights:YT(i.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]});function YT(e){e*=Math.PI/180;let t=Math.sin(e),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}function JT(e){return e>0?1/(1-e):1+e}function QT(e){return e>0?1-1/(1.001-e):-e}var eP=class{constructor(e,t,r){this.vertexBuffer=e,this.indexBuffer=t,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};const tP=pp([{name:"a_pos",type:"Int16",components:2}]);function rP(e,t){let r=function(e){let t=void 0===e.granularity?1:Math.max(e.granularity,1),r=t+(e.generateBorders?2:0),i=t+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),n=r+1,a=i+1,o=e.generateBorders?-1:0,s=e.generateBorders||e.extendToNorthPole?-1:0,l=t+ +!!e.generateBorders,u=t+(e.generateBorders||e.extendToSouthPole?1:0),c=n*a,h=r*i*6,d=n*a>65536;if(d)throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let p=d||!1,f=new Int16Array(2*c),m=0;for(let r=s;r<=u;r++)for(let i=o;i<=l;i++){let n=i/t*8192;-1===i&&(n=-64),i===t+1&&(n=8256);let a=r/t*8192;-1===r&&(a=e.extendToNorthPole?-32768:-64),r===t+1&&(a=e.extendToSouthPole?32767:8256),f[m++]=n,f[m++]=a}let g=p?new Uint32Array(h):new Uint16Array(h),y=0;for(let e=0;e<i;e++)for(let t=0;t<r;t++){let r=t+e*n,i=t+1+e*n,a=t+(e+1)*n,o=t+1+(e+1)*n;g[y++]=r,g[y++]=a,g[y++]=i,g[y++]=i,g[y++]=a,g[y++]=o}return{vertices:f.buffer.slice(0),indices:g.buffer.slice(0),uses32bitIndices:p}}(t),i=Yp.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),n=mf.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new eP(e.createVertexBuffer(i,tP.members),e.createIndexBuffer(n),bf.simpleSegment(0,0,i.length,n.length))}var iP=class extends Js{constructor(e,t,r,i){super(),this.imageWarp=XT,this.flippedWindingOrder=!1,this._warp="auto",this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=e,this.dispatcher=r,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=t}async load(e){if(void 0===this.options.url)return this._loaded=!0,void this._finishLoading();this._loaded=!1,this.fire(new FS("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let t=await DS.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=!0,t?.data?(this._setImage(t.data),e&&(this.coordinates=e),this._finishLoading()):this.fire(new Ys(Error(`Could not load image ${this.url}: the response is empty`)))}catch(e){if(Os(e))return;this._abortController=null,this._loaded=!0,this.fire(new Ys(jo(e)))}}loaded(){return this._loaded}updateImage(e){return this._abortController&&=(this._abortController.abort(),null),"image"in e?(this._loaded=!0,this._setImage(e.image),e.coordinates&&(this.coordinates=e.coordinates),this._finishLoading(),this):e.url?(this.options.url=e.url,this.load(e.coordinates),this):this}_setImage(e){this.image=e,this._imageDirty=!0}getMesh(e,t){return!this._subdividedQuad||t?null:(this._subdividedMesh??=rP(e,{granularity:16}),this._subdividedMesh)}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new FS("data",{sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._abortController&&=(this._abortController.abort(),null),this._disposeTexture(),this._subdividedMesh?.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(e){return this._warp===e||(this._warp=e,this.tileCoords&&this.setCoordinates(this.coordinates)),this}getWarp(){return this._warp}setCoordinates(e){this.coordinates=e;let t=e.map(Dy.fromLngLat);return this.tileID=function(e){let t=sy.fromPoints(e),r=t.width(),i=t.height(),n=Math.max(0,Math.floor(-Math.log(Math.max(r,i))/Math.LN2)),a=2**n;return new zb(n,Math.floor((t.minX+t.maxX)/2*a),Math.floor((t.minY+t.maxY)/2*a))}(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(e=>this.tileID.getTilePoint(e)._round()),this.imageWarp=function(e,t){if("flat"===t||nP(e))return XT;let[r,i,n,a]=e,o=r.x-i.x+n.x-a.x,s=r.y-i.y+n.y-a.y,l=[i.x-n.x,i.y-n.y,a.x-n.x,a.y-n.y],[u,c,h,d]=l,p=function(e){return e[0]*e[3]-e[2]*e[1]}(l),f=(o*d-h*s)/p,m=(u*s-o*c)/p,g=[1,1+f,1+f+m,1+m],y=Math.max(...g)/Math.min(...g),_="perspective"===t?0:function(e){let t=(1-4/e)/(1-4/512);return Math.max(0,t)}(y);return!(y>=1&&y<=512)||_>=1?XT:[f,m,_]}(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!nP(this.tileCoords),this.flippedWindingOrder=function(e){let t=e[1].x-e[0].x,r=e[1].y-e[0].y,i=e[2].x-e[0].x;return t*(e[2].y-e[0].y)-r*i<0}(this.tileCoords),this.fire(new FS("data",{sourceDataType:"content"})),this}prepare(){if(0===Object.keys(this.tiles).length||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)):(this.texture=new Km(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)),this._imageDirty=!1;let r=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new FS("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){this.tileID?.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){let e={type:"image",coordinates:this.coordinates};return void 0!==this.options.url&&(e.url=this.options.url),e}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:r,maxX:i,maxY:n}=sy.fromPoints(e),a={};for(let e=0;e<=25;e++){let o=2**e,s=Math.floor(t*o),l=Math.floor(r*o),u=Math.floor(i*o),c=Math.floor(n*o),h=(s%o+o)%o,d=u%o,p=Math.floor(s/o),f=Math.floor(u/o);a[e]={minWrap:p,maxWrap:f,minTileXWrapped:h,maxTileXWrapped:d,minTileY:l,maxTileY:c}}return a}};function nP(e){let[t,r,i,n]=e;return t.x+i.x===r.x+n.x&&t.y+i.y===r.y+n.y}var aP=class extends iP{constructor(e,t,r,i){super(e,t,r,i),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((await this.map._requestManager.transformRequest(t,"Source")).url);try{let e=await(e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(let r of e){let e=window.document.createElement("source");Ws(r)||(t.crossOrigin="Anonymous"),e.src=r,t.appendChild(e)}})})(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new Ys(jo(e)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new Ys(new rl(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new Km(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new FS("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},oP=class extends iP{constructor(e,t,r,i){super(e,t,r,i),t.coordinates?(!Array.isArray(t.coordinates)||4!==t.coordinates.length||t.coordinates.some(e=>!Array.isArray(e)||2!==e.length||e.some(e=>"number"!=typeof e)))&&this.fire(new Ys(new rl(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new Ys(new rl(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&"boolean"!=typeof t.animate&&this.fire(new Ys(new rl(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?"string"!=typeof t.canvas&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new Ys(new rl(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new Ys(new rl(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t,this.animate=void 0===t.animate||t.animate}async load(){this._loaded=!0,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 Ys(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(),!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let t=this.map.painter.context,r=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new Km(t,this.canvas,r.RGBA,{premultiply:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,i=!0)}i&&this.fire(new FS("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};const sP={},lP="RTLPluginLoaded";var uP=class extends Js{constructor(...e){super(...e),this.status="unavailable",this.url=null,this.dispatcher=(CT||(CT=new IT(AT(),Us),CT.registerMessageHandler("GR",(e,t,r)=>Gs(t,r))),CT)}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(e=>{throw this.status="error",e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=SS.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if("unavailable"===this.status){if(!t)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if("requested"===this.status)return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new Ks(lP))}lazyLoad(){"unavailable"===this.status?this.status="requested":"deferred"===this.status&&this._requestImport()}};let cP=null;function hP(){return cP||=new uP,cP}var dP=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=us(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading",this.featureStateRevision=-1}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:r,fadeEndTime:i}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=r,this.fadeEndTime=i}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=PS(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(e){return this.rttObjects[e]}acquireRTT(e,t,r){return this.rttObjects[t]=e.acquireRTT(r)}releaseRTT(e){if(0!==this.rttObjects.length){for(let t of this.rttObjects)t&&e.releaseRTT(t);this.rttObjects.length=0}}loadVectorData(e,t,r){if(!0!==e?.etagUnmodified)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){let r={};if(!t)return r;for(let i of e){let e=i.layerIds.map(e=>t.getLayer(e)).filter(Boolean);if(0!==e.length){i.layers=e,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(t=>e.filter(e=>e.id===t)[0]));for(let t of e)r[t.id]=i}}return r}(e.buckets,t?.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let t=this.buckets[e];if(t instanceof bb){if(this.hasSymbolBuckets=!0,!r)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let t=this.buckets[e];if(t instanceof bb&&t.hasRTLText){this.hasRTLText=!0,hP().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let r=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(r))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new Np;else this.state="loaded"}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let r=this.buckets[t];r.uploadPending()&&r.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Km(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new Km(e,this.glyphAtlasImage,t.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,r,i,n,a,o,s,l,u,c){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:n,scale:a,tileSize:this.tileSize,pixelPosMatrix:u,transform:s,params:o,queryPadding:this.queryPadding*l,getElevation:c},e,t,r):{}}querySourceFeatures(e,t){let r=this.latestFeatureIndex;if(!r?.rawTileData)return;let i=r.loadVTLayers(),n=t?.sourceLayer?t.sourceLayer:"",a=i._geojsonTileLayer||i[n];if(!a)return;let o=Mh(t?.filter,`querySourceFeatures[${n}].filter`,t?.globalState),{z:s,x:l,y:u}=this.tileID.canonical,c={z:s,x:l,y:u};for(let t=0;t<a.length;t++){let i=a.feature(t);if(o.needGeometry){let e=nm(i,!0);if(!o.filter(new Nd(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!o.filter(new Nd(this.tileID.overscaledZ),i))continue;let h=r.getId(i,n),d=new qb(i,s,l,u,h);d.tile=c,e.push(d)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let t=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,r,i,n)=>{let a=i||n;return t[r]=!a||a.toLowerCase(),""}),t["max-age"]){let e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}(e.cacheControl);t["max-age"]&&(this.expirationTime=Date.now()+1e3*t["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),r=!1;if(this.expirationTime>e)r=!1;else if(t)if(this.expirationTime<t)r=!0;else{let i=this.expirationTime-t;i?this.expirationTime=e+Math.max(i,3e4):r=!0}else r=!0;r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),2**31-1)}setFeatureState(e,t,r){if(!this.latestFeatureIndex?.rawTileData||0===Object.keys(e).length||this.featureStateRevision===r)return;this.featureStateRevision=r;let i=this.latestFeatureIndex.loadVTLayers();for(let r in this.buckets){if(!t.style.hasLayer(r))continue;let n=this.buckets[r],a=n.layers[0].sourceLayer||"_geojsonTileLayer",o=i[a],s=e[a];if(!o||!s||0===s.length)continue;n.update(s,o,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let l=t?.style?.getLayer(r);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(n)))}}holdingForSymbolFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<PS()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=PS()+e}setDependencies(e,t){let r={};for(let e of t)r[e]=!0;this.dependencies[e]=r}hasDependency(e,t){for(let r of e){let e=this.dependencies[r];if(e)for(let r of t)if(e[r])return!0}return!1}};function pP(e){let t=[];for(let r in e)t.push({id:r,state:e[r]});return t}var fP=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,t,r){let i=String(t);if(this.stateChanges[e]||={},this.stateChanges[e][i]||={},os(this.stateChanges[e][i],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(let t in this.state[e])if(t===i){this.deletedStates[e][i]={};for(let n in this.state[e][t])void 0===r[n]&&(this.deletedStates[e][i][n]=null)}else this.deletedStates[e][t]=null}else if(null===this.deletedStates[e]?.[i]){this.deletedStates[e][i]={};for(let t in this.state[e][i])void 0===r[t]&&(this.deletedStates[e][i][t]=null)}else for(let t in r)null===this.deletedStates[e]?.[i]?.[t]&&delete this.deletedStates[e][i][t]}removeFeatureState(e,t,r){if(null===this.deletedStates[e])return;let i=String(t);if(this.deletedStates[e]||={},r&&void 0!==t)null!==this.deletedStates[e][i]&&(this.deletedStates[e][i]||={},this.deletedStates[e][i][r]=null);else if(void 0!==t)if(this.stateChanges[e]?.[i])for(r in this.deletedStates[e][i]={},this.stateChanges[e][i])this.deletedStates[e][i][r]=null;else this.deletedStates[e][i]=null;else this.deletedStates[e]=null}getState(e,t){let r=String(t),i=this.state[e]||{},n=this.stateChanges[e]||{},a=os({},i[r],n[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){let r=this.deletedStates[e][t];if(null===r)return{};for(let e in r)delete a[e]}return a}initializeTileState(e,t){let r={};for(let e in this.state)r[e]=pP(this.state[e]);e.setFeatureState(r,t,this.revision)}coalesceChanges(e,t){let r={};for(let e in this.stateChanges){this.state[e]||={},r[e]||={};for(let t in this.stateChanges[e])this.state[e][t]||={},os(this.state[e][t],this.stateChanges[e][t]),r[e][t]=this.state[e][t]}for(let e in this.deletedStates)if(this.state[e]||={},r[e]||={},null===this.deletedStates[e])for(let t in this.state[e])this.state[e][t]={},r[e][t]={};else for(let t in this.deletedStates[e]){if(null===this.deletedStates[e][t])this.state[e][t]={};else for(let r of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][r];r[e][t]=this.state[e][t]}if(this.stateChanges={},this.deletedStates={},0===Object.keys(r).length)return;this.revision++;let i={};for(let e in r)i[e]=pP(r[e]);e.setFeatureState(i,t,this.revision)}},mP=class e{constructor(e,t){this.min=e,this.max=t,this.center=mo([],po([],this.min,this.max),.5)}quadrant(t){let r=[t%2==0,t<2],i=uo(this.min),n=uo(this.max);for(let e=0;e<r.length;e++)i[e]=r[e]?this.min[e]:this.center[e],n[e]=r[e]?this.center[e]:this.max[e];return n[2]=this.max[2],new e(i,n)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let r of e.planes){let e=this.intersectsPlane(r);if(0===e)return 0;1===e&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],r=e[3];for(let i=0;i<3;i++)e[i]>0?(t+=e[i]*this.min[i],r+=e[i]*this.max[i]):(r+=e[i]*this.min[i],t+=e[i]*this.max[i]);return t>=0?2:r<0?0:1}},gP=class e{constructor(e,t,r){this.points=e,this.planes=t,this.aabb=r}static fromInvProjectionMatrix(t,r=1,i=0,n,a){let o=a?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],s=2**i,l=[[-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(e=>function(e,t,r,i){let n=Eo([],e,t),a=1/n[3]/r*i;return function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}(n,n,[a,a,1/n[3],a])}(e,t,r,s));n&&function(e,t,r,i){let n=i?4:0,a=i?0:4,o=0,s=[],l=[];for(let t=0;t<4;t++){let r=To([],e[t+a],e[t+n]),i=co(r);mo(r,r,1/i),s.push(i),l.push(r)}for(let t=0;t<4;t++){let i=Ho(e[t+n],l[t],r);o=null!==i&&i>=0?Math.max(o,i):Math.max(o,s[t])}let u=function(e,t){let r=[0,0,0,0];return yo(r,vo([],To([],e[t[0]],e[t[1]]),To([],e[t[2]],e[t[1]]))),r[3]=-_o(r,e[t[0]]),r}(e,t),c=function(e,t){let r=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}([],e,1/Po(e)),i=To([],t,mo([],r,_o(t,r))),n=Po(i);if(n>0){let e=Math.sqrt(1-r[3]*r[3]);return Zo(t,po([],mo([],r,-r[3]),mo([],i,e/n)))}return null}(r,u);if(null!==c){let e=c/_o(l[0],u);o=Math.min(o,e)}for(let t=0;t<4;t++){let r=Math.min(o,s[t]);e[t+a]=[e[t+n][0]+l[t][0]*r,e[t+n][1]+l[t][1]*r,e[t+n][2]+l[t][2]*r,1]}}(l,o[0],n,a);let u=o.map(e=>{let t=yo([],vo([],To([],l[e[0]],l[e[1]]),To([],l[e[2]],l[e[1]]))),r=-_o(t,l[e[1]]);return t.concat(r)}),c=[1/0,1/0,1/0],h=[-1/0,-1/0,-1/0];for(let e of l)for(let t=0;t<3;t++)c[t]=Math.min(c[t],e[t]),h[t]=Math.max(h[t],e[t]);return new e(l,u,new mP(c,h))}};function yP(e,t,r){let i=t.intersectsFrustum(e);if(!r||0===i)return i;let n=t.intersectsPlane(r);return 0===n?0:2===i&&2===n?2:1}function _P(e,t,r){let i=0,n=(r-t)/10;for(let a=0;a<10;a++){let o=t+(a+.5)/10*(r-t);i+=n*Math.cos(o)**+e}return i}function vP(e,t){return function(r,i,n,a,o){let s=2*((e-1)/hs(Math.cos(Ts(89.25-o))/Math.cos(Ts(89.25)))-1),l=Math.acos(n/a),u=2*_P(s-1,0,Ts(o/2)),c=Math.min(Ts(89.25),l+Ts(o/2)),h=_P(s-1,Math.min(c,l-Ts(o/2)),c),d=Math.atan(i/n),p=r;return p+=hs(a/Math.hypot(i,n)/Math.max(.5,Math.cos(Ts(o/2)))),p+=s*hs(Math.cos(d))/2,p-=hs(Math.max(1,h/u/t))/2,p}}const bP=vP(9.314,3);function xP(e,t){let r=(t.roundZoom?Math.round:Math.floor)(e.zoom+hs(e.tileSize/t.tileSize));return Math.max(0,r)}function wP(e,t){let r=e.getCameraFrustum(),i=e.getClippingPlane();if(i&&t.maxContentElevation>0){let n=Math.hypot(i[0],i[1],i[2]);if(n>0){let a=1+t.maxContentElevation/yy,o=ns(-i[3]/n,-1,1),s=Math.cos(Math.acos(o)+Math.acos(1/a));i=[i[0],i[1],i[2],-s*n],r=function(e,t,r){let i=e.planes[1],n=e.points.map(e=>{let n=i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3];if(Math.abs(n)>1e-6)return e;let a=[e[0]-r[0],e[1]-r[1],e[2]-r[2]],o=i[0]*a[0]+i[1]*a[1]+i[2]*a[2];if(o>=-1e-9)return e;let s=t/-o;return[e[0]+a[0]*s,e[1]+a[1]*s,e[2]+a[2]*s,e[3]]}),a=e.planes.map((e,r)=>1===r?[e[0],e[1],e[2],e[3]+t]:e),o=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0];for(let e of n)for(let t=0;t<3;t++)o[t]=Math.min(o[t],e[t]),s[t]=Math.max(s[t],e[t]);return new gP(n,a,new mP(o,s))}(r,Math.sqrt(a*a-1),e.cameraPosition)}}let n=function(e){let t=Sy(1,e.center.lat)*e.worldSize;return Fy(e.center,e.elevation,e.pitch,e.bearing,e.cameraToCenterDistance/t)}(e),a=Dy.fromLngLat(e.center,e.elevation),o=function(e,t){let r=ns((15-(89.25-e.pitch-e.fov/2))/15,0,1),i=Math.max(500,t??0);return e.elevation+r*i}(e,t.maxContentElevation),s=e.getCoveringTilesDetailsProvider(),l=s.allowVariableZoom(e,t),u=xP(e,t),c=t.minzoom||0,h=void 0===t.maxzoom?e.maxZoom:t.maxzoom,d=Math.min(Math.max(0,u),h),p=2**d,f=[p*n.x,p*n.y,0],m=[p*a.x,p*a.y,0],g=Math.hypot(a.x-n.x,a.y-n.y),y=Math.abs(a.z-n.z),_=Math.hypot(g,y),v=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),b=[],x=[];if(e.renderWorldCopies&&s.allowWorldCopies())for(let e=1;e<=3;e++)b.push(v(-e)),b.push(v(e));for(b.push(v(0));b.length>0;){let p=b.pop(),g=p.x,v=p.y,w=p.fullyVisible,S={x:g,y:v,z:p.zoom},T=s.getTileBoundingVolume(S,p.wrap,o,t);if(!w){let e=yP(r,T,i);if(0===e)continue;w=2===e}let P=s.distanceToTile2d(n.x,n.y,S,T),E=u;l&&(E=(t.calculateTileZoom||bP)(e.zoom+hs(e.tileSize/t.tileSize),P,y,_,e.fov)),E=(t.roundZoom?Math.round:Math.floor)(E),E=Math.max(0,E);let D=Math.min(E,h);if(p.wrap=s.getWrap(a,S,p.wrap),p.zoom>=D){if(p.zoom<c)continue;let e=d-p.zoom,r=f[0]-.5-(g<<e),i=f[1]-.5-(v<<e),n=t.reparseOverscaled?Math.max(p.zoom,E):p.zoom;x.push({tileID:new Bb(p.zoom===h?n:p.zoom,p.wrap,p.zoom,g,v),distanceSq:zo([m[0]-.5-g,m[1]-.5-v]),tileDistanceToCamera:Math.sqrt(r*r+i*i)});continue}for(let e=0;e<4;e++){let t=(g<<1)+e%2,r=(v<<1)+(e>>1),i=p.zoom+1;b.push({zoom:i,x:t,y:r,wrap:p.wrap,fullyVisible:w})}}return x.sort((e,t)=>e.distanceSq-t.distanceSq).map(e=>e.tileID)}function SP(e){return"raster"===e||"image"===e||"video"===e}function TP(e,t,r,i,n,a,o){if(!t.hasData())return!1;let{tileID:s,fadingRole:l,fadingDirection:u,fadingParentID:c}=t;if(0===l&&1===u&&c)return r[c.key]=c,!0;let h=Math.max(s.overscaledZ-n,a);for(let n=s.overscaledZ-1;n>=h;n--){let a=s.scaledTo(n),l=e.getLoadedTile(a);if(l)return t.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:l.tileID,fadeEndTime:i+o}),l.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:i+o}),r[a.key]=a,!0}return!1}function PP(e,t,r,i,n,a){if(!t.hasData())return!1;let o=t.tileID.children(n),s=EP(e,t,o,r,i,n,a);if(s)return!0;for(let l of o)EP(e,t,l.children(n),r,i,n,a)&&(s=!0);return s}function EP(e,t,r,i,n,a,o){if(r[0].overscaledZ>=a)return!1;let s=!1;for(let a of r){let r=e.getLoadedTile(a);if(!r)continue;let{fadingRole:l,fadingDirection:u,fadingParentID:c}=r;(0!==l||0!==u||!c)&&(r.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:t.tileID,fadeEndTime:n+o}),t.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:n+o})),i[a.key]=a,s=!0}return s}function DP(e,t,r,i){let n=e.tileID;if(e.selfFading)return!0;if(e.hasData())return!1;if(t.has(n)){let t=r+i;return e.setSelfFadeLogic(t),!0}return!1}function AP(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x,i=t.tileID.canonical.y-e.tileID.canonical.y,n=2**e.tileID.canonical.z,a=t.tileID.key;(0!==r||0!==i)&&(Math.abs(i)>1||(Math.abs(r)>1&&(1===Math.abs(r+n)?r+=n:1===Math.abs(r-n)&&(r-=n)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,i),e.neighboringTiles?.[a]&&(e.neighboringTiles[a].backfilled=!0))))}var IP=class{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let r in this._tiles){let i=this._tiles[r];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),t[i.tileID.key]=i}this._tiles=t}setFeatureState(e,t,r){for(let i in this._tiles)this._tiles[i].setFeatureState(e,t,r)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(e=>e.tileID).sort(Vb).map(e=>e.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){return this.getTileById(e)?.isRenderable(t)}getRenderableIds(e=0,t){let r=[];for(let e of this.getAllIds())this.isIdRenderable(e,t)&&r.push(this.getTileById(e));return t?r.sort((t,r)=>{let i=t.tileID,n=r.tileID,a=new $a(i.canonical.x,i.canonical.y)._rotate(-e),o=new $a(n.canonical.x,n.canonical.y)._rotate(-e);return i.overscaledZ-n.overscaledZ||o.y-a.y||o.x-a.x}).map(e=>e.tileID.key):r.map(e=>e.tileID).sort(Vb).map(e=>e.key)}},CP=class e extends Js{static{this.maxUnderzooming=10}static{this.maxOverzooming=3}constructor(e,t,r){super(),this._maxContentElevationSeen=0,this.id=e,this.dispatcher=r,this.on("data",e=>{this._dataHandler(e)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((e,t,r,i)=>{let n=new((e=>{switch(e){case"geojson":return HT;case"image":return iP;case"raster":return jT;case"raster-dem":return NT;case"vector":return BT;case"video":return aP;case"canvas":return oP}return sP[e]})(t.type))(e,t,r,i);if(n.id!==e)throw Error(`Expected Source id to be ${e} instead of ${n.id}`);return n})(e,t,r,this),this._inViewTiles=new IP,this._outOfViewCache=new _S(0,e=>this._unloadTile(e)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new fP,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(e)}onRemove(e){for(let e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(e),this._inViewTiles=new IP}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(e,t,r,i){try{let n=await this._source.loadTile(e);this._tileLoaded(e,t,r,i,n)}catch(t){e.state="errored",404===t.status?this.update(this.transform,this.terrain):this._source.fire(new Ys(jo(t),{tile:e}))}}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new FS("dataabort",{tile:e,coord:e.tileID}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,e)}hasRenderableParent(e){let t=e.overscaledZ-1;if(t>=this._source.minzoom){let r=this.getLoadedTile(e.scaledTo(t));if(r)return this._inViewTiles.isIdRenderable(r.tileID.key)}return!1}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let r of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(r);(!t||this._source.shouldReloadTile(i,t))&&(e?this._reloadTile(r,"errored"===i.state?"loading":"expired"):"errored"!==i.state&&this._reloadTile(r,"reloading"))}}}async _reloadTile(e,t){let r=this._inViewTiles.getTileById(e);if(!r)return;let i=r.hasData();"loading"!==r.state&&(r.state=t),await this._loadTile(r,e,t,i)}_tileLoaded(e,t,r,i,n){i||(e.timeAdded=PS(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration)),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),!n?.unmodified&&("raster-dem"===this.getSource().type&&e.dem&&function(e,t){let r=t.getRenderableIds();for(let i of r){if(!e.neighboringTiles?.[i])continue;let r=t.getTileById(i);e.neighboringTiles[i].backfilled||AP(e,r),!r.neighboringTiles?.[e.tileID.key]?.backfilled&&AP(r,e)}}(e,this._inViewTiles),e.featureStateRevision=-1,this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new FS("data",{tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(t,r){let i=this._getLoadedDescendents(r),n=new Set;for(let a of r){let r=i[a.key];if(!r?.length){n.add(a);continue}let o=a.overscaledZ+e.maxOverzooming,s=r.filter(e=>e.tileID.overscaledZ<=o);if(!s.length){n.add(a);continue}let l=Math.min(...s.map(e=>e.tileID.overscaledZ)),u=s.filter(e=>e.tileID.overscaledZ===l).map(e=>e.tileID);for(let e of u)t[e.key]=e;this._areDescendentsComplete(u,l,a.overscaledZ)||n.add(a)}return n}_getLoadedDescendents(e){let t={};for(let r of this._inViewTiles.getAllTiles().filter(e=>e.hasData()))for(let i of e)r.tileID.isChildOf(i)&&(t[i.key]||=[],t[i.key].push(r));return t}_areDescendentsComplete(e,t,r){return 1===e.length&&e[0].isOverscaled()?e[0].overscaledZ===t:4**(t-r)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){let t=(Math.ceil(e.width/this._source.tileSize)+1)*(Math.ceil(e.height/this._source.tileSize)+1),r=null===this._maxTileCacheZoomLevels?js.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,i=Math.floor(t*r),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._outOfViewCache.setMaxSize(n)}handleWrapJump(e){let t=(e-(void 0===this._prevLng?e:this._prevLng))/360,r=Math.round(t);this._prevLng=e,r&&(this._inViewTiles.handleWrapJump(r),this._resetTileReloadTimers())}_updateMaxContentElevation(){let e=this._maxContentElevationSeen,t=this.map?.style?._layers;if(!t)return e;let r=this._inViewTiles.getAllTiles();for(let i in t){let n=t[i];if("symbol"!==n.type||n.source!==this.id||n.isHidden(this.transform.zoom))continue;let a=n;if(a.layout){e=Math.max(e,a.layout.get("symbol-height-offset").constantOr(0));for(let t of r){let r=t.getBucket(n);r&&r.maxHeightOffset>e&&(e=r.maxHeightOffset)}}}return this._maxContentElevationSeen=e,e}update(e,t){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=t,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(e=>new Bb(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)):(r=wP(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:"vector"===this._source.type&&void 0!==this.map._zoomLevelsToOverscale?Math.max(this._source.maxzoom,e.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:t,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(r=r.filter(e=>this._source.hasTile(e)))):r=[],this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));let i=0===r.length&&!this._updated&&this._didEmitContent;this._updated=!0,i&&this.fire(new FS("data",{sourceDataType:"idle",sourceId:this.id}));let n=xP(e,this._source),a=this._updateRetainedTiles(r,n),o=SP(this._source.type);o&&this._rasterFadeDuration>0&&!t&&function(e,t,r,i,n,a,o){let s=PS(),l=function(e){if(!e.length)return new Set;let t=Math.max(...e.map(e=>e.canonical.z)),r=1/0,i=-1/0,n=1/0,a=-1/0,o=[];for(let s of e){let{x:e,y:l,z:u}=s.canonical,c=2**(t-u),h=e*c,d=l*c;o.push({id:s,x:h,y:d}),h<r&&(r=h),h>i&&(i=h),d<n&&(n=d),d>a&&(a=d)}let s=new Set;for(let e of o)(e.x===r||e.x===i||e.y===n||e.y===a)&&s.add(e.id);return s}(t);for(let u of t){let t=e.getTileById(u.key);(0===t.fadingDirection||0===t.fadeOpacity)&&t.resetFadeLogic(),!TP(e,t,r,s,i,n,o)&&(PP(e,t,r,s,a,o)||DP(t,l,s,o)||t.resetFadeLogic())}}(this._inViewTiles,r,a,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),o?this._cleanUpRasterTiles(a):this._cleanUpVectorTiles(a)}_cleanUpRasterTiles(e){for(let t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(let t of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(t);e[t]?r.clearSymbolFadeHold():r.hasSymbolBuckets?r.holdingForSymbolFade()?r.symbolFadeFinished()&&this._removeTile(t):r.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){let t=[];for(let r of e)if(r.canonical.z>this._source.minzoom){let e=r.scaledTo(r.canonical.z-1);t.push(e);let i=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));t.push(i)}return e.concat(t)}releaseSymbolFadeTiles(){for(let e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(t,r){let i=new Set;for(let e of t)this._addTile(e).hasData()||i.add(e);let n=t.reduce((e,t)=>(e[t.key]=t,e),{}),a=this._retainLoadedChildren(n,i),o={},s=Math.max(r-e.maxUnderzooming,this._source.minzoom);for(let e of a){let t=this._inViewTiles.getTileById(e.key),r=t?.wasRequested();for(let i=e.overscaledZ-1;i>=s;--i){let a=e.scaledTo(i);if(o[a.key])break;if(o[a.key]=!0,t=this.getTile(a),!t&&r&&(t=this._addTile(a)),t){let e=t.hasData();if((e||!this.map?.cancelPendingTileRequestsWhileZooming||r)&&(n[a.key]=a),r=t.wasRequested(),e)break}}}return n}_addTile(e){let t=this._inViewTiles.getTileById(e.key);if(t)return t;t=this._outOfViewCache.getAndRemove(e),t&&(t.resetFadeLogic(),this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null));let r=t;return t||(t=new dP(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,e.key,t.state,!1)),t.uses++,this._inViewTiles.setTile(e.key,t),r||this._source.fire(new FS("dataloading",{tile:t,coord:t.tileID})),t}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);let r=t.getExpiryTimeout();if(r){let t=()=>{this._reloadTile(e,"expired"),delete this._timers[e]};this._timers[e]=setTimeout(t,r)}}_clearTileReloadTimer(e){let t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e of this._inViewTiles.getAllIds()){let t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(let t of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||"errored"==r.state)&&e.some(e=>e.equals(r.tileID.canonical))&&this._reloadTile(t,"expired")}}_removeTile(e){let t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),!(t.uses>0)&&(t.hasData()&&"reloading"!==t.state?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){if("source"===e.dataType){if("metadata"===e.sourceDataType)return void(this._sourceLoaded=!0);"content"===e.sourceDataType&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}}resetMaxContentElevation(){this._maxContentElevationSeen=0}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1,this.resetMaxContentElevation();for(let e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,t,r){let i=[],n=this.transform;if(!n)return i;let a=n.getCoveringTilesDetailsProvider().allowWorldCopies(),o=r?n.getCameraQueryGeometry(e):e,s=e=>n.screenPointToMercatorCoordinate(e,this.terrain),l=this.transformBbox(e,s,!a),u=this.transformBbox(o,s,!a),c=this.getIds(),h=sy.fromPoints(u);for(let e of c){let r=this._inViewTiles.getTileById(e);if(r.holdingForSymbolFade())continue;let o=a?[r.tileID]:[r.tileID.unwrapTo(-1),r.tileID.unwrapTo(0)],s=2**(n.zoom-r.tileID.overscaledZ),c=t*r.queryPadding*8192/r.tileSize/s;for(let e of o){let t=h.map(t=>e.getTilePoint(new Dy(t.x,t.y)));if(t.expandBy(c),t.intersects(ly)){let t=l.map(t=>e.getTilePoint(t)),n=u.map(t=>e.getTilePoint(t));i.push({tile:r,tileID:a?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:n,scale:s})}}}return i}transformBbox(e,t,r){let i=e.map(t);if(r){let r=sy.fromPoints(e);r.shrinkBy(.001*Math.min(r.width(),r.height()));let n=r.map(t);sy.fromPoints(i).covers(n)||(i=i.map(e=>e.x>.5?new Dy(e.x-1,e.y,e.z):e))}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(e=>this._inViewTiles.getTileById(e).tileID);return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||SP(this._source.type)&&function(e,t){if(t<=0)return!1;let r=PS();for(let t of e.getAllTiles())if(t.fadeEndTime>=r)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,t,r){e||=$b,this._state.updateState(e,t,r)}removeFeatureState(e,t,r){e||=$b,this._state.removeFeatureState(e,t,r)}getFeatureState(e,t){return e||=$b,this._state.getState(e,t)}setDependencies(e,t,r){let i=this._inViewTiles.getTileById(e);i&&i.setDependencies(t,r)}reloadTilesForDependencies(e,t){for(let r of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(r).hasDependency(e,t)&&this._reloadTile(r,"reloading");this._outOfViewCache.filter(r=>!r.hasDependency(e,t))}areTilesLoaded(){for(let e of this._inViewTiles.getAllTiles())if("loaded"!==e.state&&"errored"!==e.state)return!1;return!0}},kP=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=ns(e,0,1);let t=1,r=this._distances[t],i=e*this.paddedLength+this.padding;for(;r<i&&t<this._distances.length;)r=this._distances[++t];let n=t-1,a=this._distances[n],o=r-a,s=o>0?(i-a)/o:0;return this.points[n].mult(1-s).add(this.points[t].mult(s))}};function MP(e,t,r,i,n){return n?e?e(t,r)+i:0===i?void 0:i:i}function FP(e,t){let r=!0;return"always"===e||("never"===e||"never"===t)&&(r=!1),r}var RP=class{constructor(e,t,r){let i=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(t/r);for(let e=0;e<this.xCellCount*this.yCellCount;e++)i.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,r,i,n){this._forEachCell(t,r,i,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n)}insertCircle(e,t,r,i){this._forEachCell(t-i,r-i,t+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(r),this.circles.push(i)}_insertBoxCell(e,t,r,i,n,a){this.boxCells[n].push(a)}_insertCircleCell(e,t,r,i,n,a){this.circleCells[n].push(a)}_query(e,t,r,i,n,a,o){if(r<0||e>this.width||i<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=r&&this.height<=i){if(n)return[{key:null,x1:e,y1:t,x2:r,y2:i}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],r=this.circles[3*e+1],i=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-i,y1:r-i,x2:t+i,y2:r+i})}}else{let l={hitTest:n,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,r,i,this._queryCell,s,l,o)}return s}query(e,t,r,i){return this._query(e,t,r,i,!1,null)}hitTest(e,t,r,i,n,a){return this._query(e,t,r,i,!0,n,a).length>0}hitTestCircle(e,t,r,i,n){let a=e-r,o=e+r,s=t-r,l=t+r;if(o<0||a>this.width||l<0||s>this.height)return!1;let u=[],c={hitTest:!0,overlapMode:i,circle:{x:e,y:t,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(a,s,o,l,this._queryCellCircle,u,c,n),u.length>0}_queryCell(e,t,r,i,n,a,o,s){let{seenUids:l,hitTest:u,overlapMode:c}=o,h=this.boxCells[n],d=1e-6;if(null!==h){let n=this.bboxes;for(let o of h)if(!l.box[o]){l.box[o]=!0;let h=4*o,p=this.boxKeys[o];if(e<=n[h+2]+d&&t<=n[h+3]+d&&r>=n[h+0]-d&&i>=n[h+1]-d&&(!s||s(p))&&(!u||!FP(c,p.overlapMode))&&(a.push({key:p,x1:n[h],y1:n[h+1],x2:n[h+2],y2:n[h+3]}),u))return!0}}let p=this.circleCells[n];if(null!==p){let n=this.circles;for(let o of p)if(!l.circle[o]){l.circle[o]=!0;let h=3*o,d=this.circleKeys[o];if(this._circleAndRectCollide(n[h],n[h+1],n[h+2],e,t,r,i)&&(!s||s(d))&&(!u||!FP(c,d.overlapMode))){let e=n[h],t=n[h+1],r=n[h+2];if(a.push({key:d,x1:e-r,y1:t-r,x2:e+r,y2:t+r}),u)return!0}}}return!1}_queryCellCircle(e,t,r,i,n,a,o,s){let{circle:l,seenUids:u,overlapMode:c}=o,h=this.boxCells[n];if(null!==h){let e=this.bboxes;for(let t of h)if(!u.box[t]){u.box[t]=!0;let r=4*t,i=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[r+0],e[r+1],e[r+2],e[r+3])&&(!s||s(i))&&!FP(c,i.overlapMode))return a.push(!0),!0}}let d=this.circleCells[n];if(null!==d){let e=this.circles;for(let t of d)if(!u.circle[t]){u.circle[t]=!0;let r=3*t,i=this.circleKeys[t];if(this._circlesCollide(e[r],e[r+1],e[r+2],l.x,l.y,l.radius)&&(!s||s(i))&&!FP(c,i.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,r,i,n,a,o,s){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),c=this._convertToXCellCoord(r),h=this._convertToYCellCoord(i);for(let d=l;d<=c;d++)for(let l=u;l<=h;l++){let u=this.xCellCount*l+d;if(n.call(this,e,t,r,i,u,a,o,s))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,r,i,n,a){let o=i-e,s=n-t,l=r+a;return l*l>o*o+s*s}_circleAndRectCollide(e,t,r,i,n,a,o){let s=(a-i)/2,l=Math.abs(e-(i+s));if(l>s+r)return!1;let u=(o-n)/2,c=Math.abs(t-(n+u));if(c>u+r)return!1;if(l<=s||c<=u)return!0;let h=l-s,d=c-u;return h*h+d*d<=r*r}};function LP(e,t){let r=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),i=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),n=t[0]*r,a=t[4]*r,o=t[8]*i,s=t[1]*r,l=t[5]*r,u=t[9]*i,c=t[2]*r,h=t[6]*r,d=t[10]*i;e[0]=n,e[1]=a,e[2]=o,e[4]=s,e[5]=l,e[6]=u,e[8]=c,e[9]=h,e[10]=d;let p=t[12],f=t[13],m=t[14];return e[12]=-n*p-s*f-c*m,e[13]=-a*p-l*f-h*m,e[14]=-o*p-u*f-d*m,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}const zP=Ka();function OP(e,t,r){let i=Ka();if(!e){let{vecSouth:e,vecEast:r}=jP(t),n=vS();n[0]=r[0],n[1]=r[1],n[2]=e[0],n[3]=e[1],function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*a-n*i;o&&(o=1/o,e[0]=a*o,e[1]=-i*o,e[2]=-n*o,e[3]=r*o)}(n,n),i[0]=n[0],i[1]=n[1],i[4]=n[2],i[5]=n[3]}return ro(i,i,[1/r,1/r,1]),i}function BP(e,t,r,i){if(e){let e=Ka();if(!t){let{vecSouth:t,vecEast:i}=jP(r);e[0]=i[0],e[1]=i[1],e[4]=t[0],e[5]=t[1]}return ro(e,e,[i,i,1]),e}return r.pixelsToClipSpaceMatrix}function jP(e){let t=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),i=Math.cos(e.pitchInRadians),n=Math.cos(e.bearingInRadians),a=Math.sin(e.bearingInRadians),o=ko();o[0]=-n*i*r-a*t,o[1]=-a*i*r+n*t;let s=Ro(o);s<1e-9?Lo(o):Fo(o,o,1/s);let l=ko();l[0]=n*i*t-a*r,l[1]=a*i*t+n*r;let u=Ro(l);return u<1e-9?Lo(l):Fo(l,l,1/u),{vecEast:l,vecSouth:o}}function NP(e,t,r){return MP(e.getElevation,t,r,e.heightOffset??0,e.heightAnchorGround??!0)}function UP(e,t,r,i){let n;null==i?(n=[e,t,0,1],nE(n,n,r)):(n=[e,t,i,1],Eo(n,n,r));let a=n[3];return{point:new $a(n[0]/a,n[1]/a),signedDistanceFromCamera:a,isOccluded:!1}}function VP(e,t){return.5+e/t*.5}function $P(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function GP(e,t,r,i,n,a,o,s,l,u,c,h,d){let p=r?e.textSizeData:e.iconSizeData,f=Bv(p,t.transform.zoom),m=[256/t.width*2+1,256/t.height*2+1],g=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;g.clear();let y=e.lineVertexArray,_=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=t.transform.width/t.transform.height,b=!1;for(let r=0;r<_.length;r++){let x=_.get(r);if(x.hidden||2===x.writingMode&&!b){iE(x.numGlyphs,g);continue}b=!1;let w=new $a(x.anchorX,x.anchorY),S={getElevation:d,pitchedLabelPlaneMatrix:i,lineVertexArray:y,pitchWithMap:a,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:w,unwrappedTileID:l,width:u,height:c,translation:h},T=JP(x.anchorX,x.anchorY,S);if(!$P(T.point,m)){iE(x.numGlyphs,g);continue}let P=T.signedDistanceFromCamera,E=VP(t.transform.cameraToCenterDistance,P),D=Ov(p,f,x),A=a?D*t.transform.getPitchedTextCorrection(x.anchorX,x.anchorY,l)/E:D*E,I=WP({projectionContext:S,pitchedLabelPlaneMatrixInverse:n,symbol:x,fontSize:A,flip:!1,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:s});b=I.useVertical,(I.notEnoughRoom||b||I.needsFlipping&&WP({projectionContext:S,pitchedLabelPlaneMatrixInverse:n,symbol:x,fontSize:A,flip:!0,keepUpright:o,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:g,aspectRatio:v,rotateToLine:s}).notEnoughRoom)&&iE(x.numGlyphs,g)}r?e.text.dynamicLayoutVertexBuffer.updateData(g):e.icon.dynamicLayoutVertexBuffer.updateData(g)}function qP(e,t,r,i,n,a,o,s){let l=a.glyphStartIndex+a.numGlyphs,u=a.lineStartIndex,c=a.lineStartIndex+a.lineLength,h=t.getoffsetX(a.glyphStartIndex),d=t.getoffsetX(l-1),p=tE(e*h,r,i,n,a.segment,u,c,s,o);if(!p)return null;let f=tE(e*d,r,i,n,a.segment,u,c,s,o);return!f||s.projectionCache.anyProjectionOccluded?null:{first:p,last:f}}function ZP(e,t,r,i){return 1===e&&Math.abs(r.y-t.y)>Math.abs(r.x-t.x)*i?{useVertical:!0}:(2===e?t.y<r.y:t.x>r.x)?{needsFlipping:!0}:null}function WP(e){let t,{projectionContext:r,pitchedLabelPlaneMatrixInverse:i,symbol:n,fontSize:a,flip:o,keepUpright:s,glyphOffsetArray:l,dynamicLayoutVertexArray:u,aspectRatio:c,rotateToLine:h}=e,d=a/24,p=n.lineOffsetX*d,f=n.lineOffsetY*d;if(n.numGlyphs>1){let e=n.glyphStartIndex+n.numGlyphs,a=n.lineStartIndex,u=n.lineStartIndex+n.lineLength,m=qP(d,l,p,f,o,n,h,r);if(!m)return{notEnoughRoom:!0};let g=YP(m.first.point.x,m.first.point.y,r,i),y=YP(m.last.point.x,m.last.point.y,r,i);if(s&&!o){let e=ZP(n.writingMode,g,y,c);if(e)return e}t=[m.first];for(let i=n.glyphStartIndex+1;i<e-1;i++){let e=tE(d*l.getoffsetX(i),p,f,o,n.segment,a,u,r,h);if(!e)return{notEnoughRoom:!0};t.push(e)}t.push(m.last)}else{if(s&&!o){let e=KP(r.tileAnchorPoint.x,r.tileAnchorPoint.y,r).point,t=n.lineStartIndex+n.segment+1,a=new $a(r.lineVertexArray.getx(t),r.lineVertexArray.gety(t)),o=KP(a.x,a.y,r),s=o.signedDistanceFromCamera>0?o.point:HP(r.tileAnchorPoint,a,e,1,r),l=YP(e.x,e.y,r,i),u=YP(s.x,s.y,r,i),h=ZP(n.writingMode,l,u,c);if(h)return h}let e=tE(d*l.getoffsetX(n.glyphStartIndex),p,f,o,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,r,h);if(!e||r.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};t=[e]}for(let e of t)gb(u,e.point,e.angle);return{}}function HP(e,t,r,i,n){let a=e.add(e.sub(t)._unit()),o=KP(a.x,a.y,n).point,s=r.sub(o);return r.add(s._mult(i/s.mag()))}function XP(e,t,r){let i=t.projectionCache;if(i.projections[e])return i.projections[e];let n=new $a(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),a=KP(n.x,n.y,t);if(a.signedDistanceFromCamera>0)return i.projections[e]=a.point,i.anyProjectionOccluded||=a.isOccluded,a.point;let o=e-r.direction,s=0===r.distanceFromAnchor?t.tileAnchorPoint:new $a(t.lineVertexArray.getx(o),t.lineVertexArray.gety(o)),l=r.absOffsetX-r.distanceFromAnchor+1;return HP(s,n,r.previousVertex,l,t)}function KP(e,t,r){let i,n=e+r.translation[0],a=t+r.translation[1];return r.pitchWithMap?(i=UP(n,a,r.pitchedLabelPlaneMatrix,NP(r,n,a)),i.isOccluded=!1):(i=r.transform.projectTileCoordinates(n,a,r.unwrappedTileID,NP(r,n,a)),i.point.x=(.5*i.point.x+.5)*r.width,i.point.y=(.5*-i.point.y+.5)*r.height),i}function YP(e,t,r,i){if(r.pitchWithMap){let n=[e,t,0,1];Eo(n,n,i);let a=n[0]/n[3],o=n[1]/n[3];return r.transform.projectTileCoordinates(a,o,r.unwrappedTileID,NP(r,a,o)).point}return{x:e/r.width*2-1,y:1-t/r.height*2}}function JP(e,t,r){return r.transform.projectTileCoordinates(e,t,r.unwrappedTileID,NP(r,e,t))}function QP(e,t,r){return e._unit()._perp()._mult(t*r)}function eE(e,t,r,i,n,a,o,s,l){if(s.projectionCache.offsets[e])return s.projectionCache.offsets[e];let u=r.add(t);if(e+l.direction<i||e+l.direction>=n)return s.projectionCache.offsets[e]=u,u;let c=XP(e+l.direction,s,l),h=QP(c.sub(r),o,l.direction),d=r.add(h),p=c.add(h);return s.projectionCache.offsets[e]=function(e,t,r,i){let n=t.y-e.y,a=t.x-e.x,o=i.y-r.y,s=i.x-r.x,l=o*a-s*n;if(0===l)return null;let u=(s*(e.y-r.y)-o*(e.x-r.x))/l;return new $a(e.x+u*a,e.y+u*n)}(a,u,d,p)||u,s.projectionCache.offsets[e]}function tE(e,t,r,i,n,a,o,s,l){let u=i?e-t:e+t,c=u>0?1:-1,h=0;i&&(c*=-1,h=Math.PI),c<0&&(h+=Math.PI);let d,p=c>0?a+n:a+n+1;s.projectionCache.cachedAnchorPoint?d=s.projectionCache.cachedAnchorPoint:(d=KP(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=d);let f,m,g,y=d,_=d,v=0,b=0,x=Math.abs(u),w=[];for(;v+b<=x;){if(p+=c,p<a||p>=o)return null;v+=b,_=y,m=f;let e={absOffsetX:x,direction:c,distanceFromAnchor:v,previousVertex:_};if(y=XP(p,s,e),0===r)w.push(_),g=y.sub(_);else{let t,i=y.sub(_);t=0===i.mag()?QP(XP(p+c,s,e).sub(y),r,c):QP(i,r,c),m||=_.add(t),f=eE(p,t,y,a,o,m,r,s,e),w.push(m),g=f.sub(m)}b=g.mag()}let S=(x-v)/b,T=g._mult(S)._add(m||_),P=h+Math.atan2(y.y-_.y,y.x-_.x);return w.push(T),{point:T,angle:l?P:0,path:w}}const rE=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function iE(e,t){for(let r=0;r<e;r++){let e=t.length;t.resize(e+4),t.float32.set(rE,3*e)}}function nE(e,t,r){let i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e[3]=r[3]*i+r[7]*n+r[15],e}var aE=class{constructor(e,t=new RP(e.width+200,e.height+200,25),r=new RP(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=r,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,r,i,n,a,o,s,l,u,c,h,d=0,p=!0){let f,m=e.anchorPointX+s[0],g=e.anchorPointY+s[1],y=this.projectAndGetPerspectiveRatio(m,g,n,MP(u,m,g,d,p),h),_=r*y.perspectiveRatio;if(a||o)f=this._projectCollisionBox(e,_,i,n,a,o,s,y,u,c,h,d,p);else{let t=y.x+(c?c.x*_:0),r=y.y+(c?c.y*_:0);f={allPointsOccluded:!1,box:[t+e.x1*_,r+e.y1*_,t+e.x2*_,r+e.y2*_]}}let[v,b,x,w]=f.box,S=a?f.allPointsOccluded:y.isOccluded,T=S;return T||=y.perspectiveRatio<this.perspectiveRatioCutoff,T||=!this.isInsideGrid(v,b,x,w),T||"always"!==t&&this.grid.hitTest(v,b,x,w,t,l)?{box:[v,b,x,w],placeable:!1,offscreen:!1,occluded:S}:{box:[v,b,x,w],placeable:!0,offscreen:this.isOffscreen(v,b,x,w),occluded:S}}placeCollisionCircles(e,t,r,i,n,a,o,s,l,u,c,h,d,p){let f=[],m=new $a(t.anchorX,t.anchorY),g=this.getPerspectiveRatio(m.x,m.y,a,p?.(m.x,m.y)),y=(l?n*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,a)/g:n*g)/24,_=t.lineOffsetX*y,v=t.lineOffsetY*y,b={getElevation:p,pitchedLabelPlaneMatrix:o,lineVertexArray:r,pitchWithMap:l,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:m,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:d},x=qP(y,i,_,v,!1,t,!1,b),w=!1,S=!1,T=!0;if(x){let t=.5*c*g+h,r=new $a(-100,-100),i=new $a(this.screenRightBoundary,this.screenBottomBoundary),n=new kP,a=x.first,o=x.last,d=[];for(let e=a.path.length-1;e>=1;e--)d.push(a.path[e]);for(let e=1;e<o.path.length;e++)d.push(o.path[e]);let p=2.5*t;if(l){let e=this.projectPathToScreenSpace(d,b);d=e.some(e=>e.signedDistanceFromCamera<=0)?[]:e.map(e=>e.point)}let m=[];if(d.length>0){let e=d[0].clone(),t=d[0].clone();for(let r=1;r<d.length;r++)e.x=Math.min(e.x,d[r].x),e.y=Math.min(e.y,d[r].y),t.x=Math.max(t.x,d[r].x),t.y=Math.max(t.y,d[r].y);m=e.x>=r.x&&t.x<=i.x&&e.y>=r.y&&t.y<=i.y?[d]:t.x<r.x||e.x>i.x||t.y<r.y||e.y>i.y?[]:Wv([d],r.x,r.y,i.x,i.y)}for(let r of m){n.reset(r,.25*t);let i=0;i=n.length<=.5*t?1:Math.ceil(n.paddedLength/p)+1;for(let r=0;r<i;r++){let a=r/Math.max(i-1,1),o=n.lerp(a),l=o.x+100,c=o.y+100;f.push(l,c,t,0);let h=l-t,d=c-t,p=l+t,m=c+t;if(T&&=this.isOffscreen(h,d,p,m),S||=this.isInsideGrid(h,d,p,m),"always"!==e&&this.grid.hitTestCircle(l,c,t,e,u)&&(w=!0,!s))return{circles:[],offscreen:!1,collisionDetected:w}}}}return{circles:!s&&w||!S||g<this.perspectiveRatioCutoff?[]:f,offscreen:T,collisionDetected:w}}projectPathToScreenSpace(e,t){return function(e){let t=0,r=0,i=0,n=0;for(let a=0;a<e.length;a++)e[a].isOccluded?(i=a+1,n=0):(n++,n>r&&(r=n,t=i));return e.slice(t,t+r)}(function(e,t){let r=zP;return function(e,t){let r=1/(t[0]*t[5]-t[1]*t[4]);e[0]=t[5]*r,e[1]=-t[1]*r,e[2]=0,e[3]=0,e[4]=-t[4]*r,e[5]=t[0]*r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15]}(r,t.pitchedLabelPlaneMatrix),e.map(e=>{let i=UP(e.x,e.y,r,NP(t,e.x,e.y)),n=t.transform.projectTileCoordinates(i.point.x,i.point.y,t.unwrappedTileID,NP(t,i.point.x,i.point.y));return n.point.x=(.5*n.point.x+.5)*t.width,n.point.y=(.5*-n.point.y+.5)*t.height,n})}(e,t))}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let t=[],r=new sy;for(let i of e){let e=new $a(i.x+100,i.y+100);r.extend(e),t.push(e)}let{minX:i,minY:n,maxX:a,maxY:o}=r,s=this.grid.query(i,n,a,o).concat(this.ignoredGrid.query(i,n,a,o)),l={},u={};for(let e of s){let r=e.key;void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex]||lm(t,[new $a(e.x1,e.y1),new $a(e.x2,e.y1),new $a(e.x2,e.y2),new $a(e.x1,e.y2)])&&(l[r.bucketInstanceId][r.featureIndex]=!0,void 0===u[r.bucketInstanceId]&&(u[r.bucketInstanceId]=[]),u[r.bucketInstanceId].push(r.featureIndex))}return u}insertCollisionBox(e,t,r,i,n,a){let o={bucketInstanceId:i,featureIndex:n,collisionGroupID:a,overlapMode:t};(r?this.ignoredGrid:this.grid).insert(o,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,r,i,n,a){let o=r?this.ignoredGrid:this.grid,s={bucketInstanceId:i,featureIndex:n,collisionGroupID:a,overlapMode:t};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,t,r,i,n){if(n){let r;null==i?(r=[e,t,0,1],nE(r,r,n)):(r=[e,t,i,1],Eo(r,r,n));let a=r[3];return{x:(r[0]/a+1)/2*this.transform.width+100,y:(-r[1]/a+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/a*.5,isOccluded:!1,signedDistanceFromCamera:a}}{let n=this.transform.projectTileCoordinates(e,t,r,i);return{x:(n.point.x+1)/2*this.transform.width+100,y:(1-n.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5,isOccluded:n.isOccluded,signedDistanceFromCamera:n.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,r,i){let n=this.transform.projectTileCoordinates(e,t,r,i);return.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*.5}isOffscreen(e,t,r,i){return r<100||e>=this.screenRightBoundary||i<100||t>this.screenBottomBoundary}isInsideGrid(e,t,r,i){return r>=0&&e<this.gridRightBoundary&&i>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=Ja([]);return to(e,e,[-100,-100,0]),e}_projectCollisionBox(e,t,r,i,n,a,o,s,l,u,c,h=0,d=!0){let p=1,f=0,m=0,g=1,y=e.anchorPointX+o[0],_=e.anchorPointY+o[1];if(a&&!n){let e=this.projectAndGetPerspectiveRatio(y+1,_,i,MP(l,y+1,_,h,d),c),t=e.x-s.x,r=e.y-s.y,n=Math.atan(r/t)+(t<0?Math.PI:0),a=Math.sin(n),o=Math.cos(n);p=o,f=a,m=-a,g=o}else if(!a&&n){let e=jP(this.transform);p=e.vecEast[0],f=e.vecEast[1],m=e.vecSouth[0],g=e.vecSouth[1]}let v=s.x,b=s.y,x=t;n&&(v=y,b=_,x=2**-(this.transform.zoom-r.overscaledZ),x*=this.transform.getPitchedTextCorrection(y,_,i),!u)&&(x*=ns(.5+s.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4)),u&&(v+=p*u.x*x+m*u.y*x,b+=f*u.x*x+g*u.y*x);let w=e.x1*x,S=e.x2*x,T=(w+S)/2,P=e.y1*x,E=e.y2*x,D=(P+E)/2,A=[{offsetX:w,offsetY:P},{offsetX:T,offsetY:P},{offsetX:S,offsetY:P},{offsetX:S,offsetY:D},{offsetX:S,offsetY:E},{offsetX:T,offsetY:E},{offsetX:w,offsetY:E},{offsetX:w,offsetY:D}],I=[];for(let{offsetX:e,offsetY:t}of A)I.push(new $a(v+p*e+m*t,b+f*e+g*t));let C=!1;if(n){let e=I.map(e=>this.projectAndGetPerspectiveRatio(e.x,e.y,i,MP(l,e.x,e.y,h,d),c));C=e.some(e=>!e.isOccluded),I=e.map(e=>new $a(e.x,e.y))}else C=!0;return{box:ts(I),allPointsOccluded:!C}}},oE=class{constructor(e,t,r,i){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):i&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}},sE=class{constructor(e,t,r,i,n){this.text=new oE(e?e.text:null,t,r,n),this.icon=new oE(e?e.icon:null,t,i,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},lE=class{constructor(e,t,r){this.text=e,this.icon=t,this.skipFade=r}},uE=class{constructor(e,t,r,i,n){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=n}},cE=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}};function hE(e,t,r,i,n){let{horizontalAlign:a,verticalAlign:o}=xv(e),s=-(o-.5)*r;return new $a(-(a-.5)*t+i[0]*n,s+i[1]*n)}var dE=class{constructor(e,t,r,i,n){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new aE(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new cE(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;if(t)return(r,i)=>t.getElevation(e,r,i)}getBucketParts(e,t,r,i){let n=r.getBucket(t),a=r.latestFeatureIndex;if(!n||!a||t.id!==n.layerIds[0])return;let o=r.collisionBoxArray,s=n.layers[0].layout,l=n.layers[0].paint,u=2**(this.transform.zoom-r.tileID.overscaledZ),c=r.tileSize/8192,h=r.tileID.toUnwrapped(),d="map"===s.get("text-rotation-alignment"),p=Bo(r,1,this.transform.zoom),f=qo(this.collisionIndex.transform,r,l.get("text-translate"),l.get("text-translate-anchor")),m=qo(this.collisionIndex.transform,r,l.get("icon-translate"),l.get("icon-translate-anchor")),g=OP(d,this.transform,p);this.retainedQueryData[n.bucketInstanceId]=new uE(n.bucketInstanceId,a,n.sourceLayerIndex,n.index,r.tileID);let y={bucket:n,layout:s,translationText:f,translationIcon:m,unwrappedTileID:h,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:c,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:o,partiallyEvaluatedTextSize:Bv(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(i)for(let t of n.sortKeyRanges){let{sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n}=t;e.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:n,parameters:y})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:y})}attemptAnchorPlacement(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_,v,b,x){let w=nb[e.textAnchor],S=[e.textOffset0,e.textOffset1],T=hE(w,r,i,S,n),P=this.collisionIndex.placeCollisionBox(t,h,s,l,u,o,a,m,c.predicate,_,T,v,b,x);if((!y||this.collisionIndex.placeCollisionBox(y,h,s,l,u,o,a,g,c.predicate,_,T,v,b,x).placeable)&&P.placeable){let e;if(this.prevPlacement?.variableOffsets[d.crossTileID]&&this.prevPlacement?.placements[d.crossTileID]?.text&&(e=this.prevPlacement.variableOffsets[d.crossTileID].anchor),0===d.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:S,width:r,height:i,anchor:w,textBoxScale:n,prevAnchor:e},this.markUsedJustification(p,w,d,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,d),this.placedOrientations[d.crossTileID]=f),{shift:T,placedGlyphBoxes:P}}}placeLayerBucketPart(e,t,r){let{bucket:i,layout:n,translationText:a,translationIcon:o,unwrappedTileID:s,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:c,collisionBoxArray:h,partiallyEvaluatedTextSize:d,collisionGroup:p}=e.parameters,f=n.get("text-optional"),m=n.get("icon-optional"),g=pb(n,"text-overlap","text-allow-overlap"),y="always"===g,_=pb(n,"icon-overlap","icon-allow-overlap"),v="always"===_,b="map"===n.get("text-rotation-alignment"),x="map"===n.get("text-pitch-alignment"),w="none"!==n.get("icon-text-fit"),S="viewport-y"===n.get("symbol-z-order"),T="ground"===n.get("symbol-height-anchor"),P=y&&(v||!i.hasIconData()||m),E=v&&(y||!i.hasTextData()||f);!i.collisionArrays&&h&&i.deserializeCollisionBoxes(h);let D=this.retainedQueryData[i.bucketInstanceId].tileID,A=this._getTerrainElevationFunc(D),I=this.transform.getFastPathSimpleProjectionMatrix(D),C=(e,h,v)=>{if(t[e.crossTileID])return;if(c)return void(this.placements[e.crossTileID]=new lE(!1,!1,!1));let S=e.heightOffset,C=!1,k=!1,M=!0,F=null,R={box:null,placeable:!1,offscreen:null,occluded:!1},L={box:null,placeable:!1,offscreen:null},z=null,O=null,B=null,j=0,N=0,U=0;h.textFeatureIndex?j=h.textFeatureIndex:e.useRuntimeCollisionCircles&&(j=e.featureIndex),h.verticalTextFeatureIndex&&(N=h.verticalTextFeatureIndex);let V=h.textBox;if(V){let t=t=>{let r=1;if(i.allowVerticalPlacement&&!t&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(i,r,e))}return r},n=(t,r)=>{if(i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&h.verticalTextBox){for(let e of i.writingModes)if(2===e?(R=r(),L=R):R=t(),R?.placeable)break}else R=t()},l=e.textAnchorOffsetStartIndex,c=e.textAnchorOffsetEndIndex;if(c===l){let r=(t,r)=>{let n=this.collisionIndex.placeCollisionBox(t,g,u,D,s,x,b,a,p.predicate,A,void 0,I,S,T);return n?.placeable&&(this.markUsedOrientation(i,r,e),this.placedOrientations[e.crossTileID]=r),n};n(()=>r(V,1),()=>{let t=h.verticalTextBox;return i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&t?r(t,2):{box:null,offscreen:null}}),t(R?.placeable)}else{let d=nb[this.prevPlacement?.variableOffsets[e.crossTileID]?.anchor],f=(t,n,h)=>{let f=t.x2-t.x1,m=t.y2-t.y1,y=e.textBoxScale,v=w&&"never"===_?n:null,P=null,E="never"===g?1:2,k="never";d&&E++;for(let r=0;r<E;r++){for(let r=l;r<c;r++){let n=i.textAnchorOffsets.get(r);if(d&&n.textAnchor!==d)continue;let l=this.attemptAnchorPlacement(n,t,f,m,y,b,x,u,D,s,p,k,e,i,h,a,o,v,A,I,S,T);if(l&&(P=l.placedGlyphBoxes,P?.placeable))return C=!0,F=l.shift,P}d?d=null:k=g}return r&&!P&&(P={box:this.collisionIndex.placeCollisionBox(V,"always",u,D,s,x,b,a,p.predicate,A,void 0,I,S,T).box,offscreen:!1,placeable:!1,occluded:!1}),P};n(()=>f(V,h.iconBox,1),()=>{let t=h.verticalTextBox,r=R?.placeable;return i.allowVerticalPlacement&&!r&&e.numVerticalGlyphVertices>0&&t?f(t,h.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),R&&(C=R.placeable,M=R.offscreen);let m=t(R?.placeable);if(!C&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(i,t.anchor,e,m))}}}if(z=R,C=z?.placeable,M=z?.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){let t=i.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),o=Ov(i.textSizeData,d,t),u=n.get("text-padding"),c=e.collisionCircleDiameter;O=this.collisionIndex.placeCollisionCircles(g,t,i.lineVertexArray,i.glyphOffsetArray,o,s,l,r,x,p.predicate,c,u,a,A),O.circles.length&&O.collisionDetected&&!r&&_s("Collisions detected, but collision boxes are not shown"),C=y||O.circles.length>0&&!O.collisionDetected,M&&=O.offscreen}if(h.iconFeatureIndex&&(U=h.iconFeatureIndex),h.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,_,u,D,s,x,b,o,p.predicate,A,w&&F?F:void 0,I,S,T);L&&L.placeable&&h.verticalIconBox?(B=e(h.verticalIconBox),k=B.placeable):(B=e(h.iconBox),k=B.placeable),M&&=B.offscreen}let $=f||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,G=m||0===e.numIconVertices;$||G?G?$||(k&&=C):C=k&&C:k=C=k&&C;let q=C&&z.placeable,Z=k&&B.placeable;if(q&&(L&&L.placeable&&N?this.collisionIndex.insertCollisionBox(z.box,g,n.get("text-ignore-placement"),i.bucketInstanceId,N,p.ID):this.collisionIndex.insertCollisionBox(z.box,g,n.get("text-ignore-placement"),i.bucketInstanceId,j,p.ID)),Z&&this.collisionIndex.insertCollisionBox(B.box,_,n.get("icon-ignore-placement"),i.bucketInstanceId,U,p.ID),O&&C&&this.collisionIndex.insertCollisionCircles(O.circles,g,n.get("text-ignore-placement"),i.bucketInstanceId,j,p.ID),r&&this.storeCollisionData(i.bucketInstanceId,v,h,z,B,O),0===e.crossTileID)throw Error("symbolInstance.crossTileID can't be 0");if(0===i.bucketInstanceId)throw Error("bucket.bucketInstanceId can't be 0");let W=(C||P)&&!z?.occluded,H=(k||E)&&!B?.occluded;this.placements[e.crossTileID]=new lE(W,H,M||i.justReloaded),t[e.crossTileID]=!0};if(S){if(0!==e.symbolInstanceStart)throw Error("bucket.bucketInstanceId should be 0");let t=i.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){let r=t[e];C(i.symbolInstances.get(r),i.collisionArrays[r],r)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)C(i.symbolInstances.get(t),i.collisionArrays[t],t);i.justReloaded=!1}storeCollisionData(e,t,r,i,n,a){if(r.textBox||r.iconBox){let a,o;this.collisionBoxArrays.has(e)?a=this.collisionBoxArrays.get(e):(a=new Map,this.collisionBoxArrays.set(e,a)),a.has(t)?o=a.get(t):(o={text:null,icon:null},a.set(t,o)),r.textBox&&(o.text=i.box),r.iconBox&&(o.icon=n.box)}if(a){let t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<a.circles.length;e+=4)t.push(a.circles[e+0]-100),t.push(a.circles[e+1]-100),t.push(a.circles[e+2]),t.push(+!!a.collisionDetected)}}markUsedJustification(e,t,r,i){let n,a={left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex};n=2===i?r.verticalPlacedTextSymbolIndex:a[lb(t)];let o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let t of o)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=n>=0&&t!==n?0:r.crossTileID)}markUsedOrientation(e,t,r){let i=1===t||3===t?t:0,n=2===t?t:0,a=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let t of a)e.text.placedSymbolArray.get(t).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,r=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let i=t?t.symbolFadeChange(e):1,n=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],a=n[e];a?(this.opacities[e]=new sE(a,i,t.text,t.icon),r||=t.text!==a.text.placed,r||=t.icon!==a.icon.placed):(this.opacities[e]=new sE(null,i,t.text,t.icon,t.skipFade),r||=t.text||t.icon)}for(let e in n){let t=n[e];if(!this.opacities[e]){let n=new sE(t,i,!1,!1);n.isHidden()||(this.opacities[e]=n,r||=t.text.placed,r||=t.icon.placed)}}for(let e in a)!this.variableOffsets[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.variableOffsets[e]=a[e]);for(let e in o)!this.placedOrientations[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.placedOrientations[e]=o[e]);if(t&&void 0===t.lastPlacementChangeTime)throw Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let r={};for(let i of t){let t=i.getBucket(e);t&&i.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,i.tileID,r,i.collisionBoxArray)}}updateBucketOpacities(e,t,r,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let n=e.layers[0],a=n.layout,o=new sE(null,0,!1,!1,!0),s=a.get("text-allow-overlap"),l=a.get("icon-allow-overlap"),u=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),c="map"===a.get("text-rotation-alignment"),h="map"===a.get("text-pitch-alignment"),d="none"!==a.get("icon-text-fit"),p=new sE(null,0,s&&(l||!e.hasIconData()||a.get("icon-optional")),l&&(s||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let f=(e,t,r)=>{for(let i=0;i<t/4;i++)e.opacityVertexArray.emplaceBack(r);e.hasVisibleVertices||=r!==vE},m=this.collisionBoxArrays.get(e.bucketInstanceId);for(let t=0;t<e.symbolInstances.length;t++){let i=e.symbolInstances.get(t),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:a,crossTileID:s}=i,l=r[s],g=this.opacities[s];l?g=o:g||(g=p,this.opacities[s]=g),r[s]=!0;let y=n>0||a>0,_=i.numIconVertices>0,v=this.placedOrientations[i.crossTileID],b=2===v,x=1===v||3===v;if(y){let t=_E(g.text),r=b?vE:t;f(e.text,n,r);let o=x?vE:t;f(e.text,a,o);let s=g.text.isHidden(),l=[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex];for(let t of l)t>=0&&(e.text.placedSymbolArray.get(t).hidden=s||b?1:0);i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=s||x?1:0);let u=this.variableOffsets[i.crossTileID];u&&this.markUsedJustification(e,u.anchor,i,v);let c=this.placedOrientations[i.crossTileID];c&&(this.markUsedJustification(e,"left",i,c),this.markUsedOrientation(e,c,i))}if(_){let t=_E(g.icon),r=!(d&&i.verticalPlacedIconSymbolIndex&&b);if(i.placedIconSymbolIndex>=0){let n=r?t:vE;f(e.icon,i.numIconVertices,n),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=g.icon.isHidden()}if(i.verticalPlacedIconSymbolIndex>=0){let n=r?vE:t;f(e.icon,i.numVerticalIconVertices,n),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=g.icon.isHidden()}}let w=m?.has(t)?m.get(t):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let r=e.collisionArrays[t];if(r){let t=new $a(0,0);if(r.textBox||r.verticalTextBox){let i=!0;if(u){let e=this.variableOffsets[s];e?(t=hE(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),c&&t._rotate(h?-this.transform.bearingInRadians:this.transform.bearingInRadians)):i=!1}if(r.textBox||r.verticalTextBox){let n;r.textBox&&(n=b),r.verticalTextBox&&(n=x),pE(e.textCollisionBox.collisionVertexArray,g.text.placed,!i||n,w.text,t.x,t.y)}}if(r.iconBox||r.verticalIconBox){let i,n=!(x||!r.verticalIconBox);r.iconBox&&(i=n),r.verticalIconBox&&(i=!n),pE(e.iconCollisionBox.collisionVertexArray,g.icon.placed,i,w.icon,d?t.x:0,d?t.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let r=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}};function pE(e,t,r,i,n,a){(!i||0===i.length)&&(i=[0,0,0,0]);let o=i[0]-100,s=i[1]-100,l=i[2]-100,u=i[3]-100;e.emplaceBack(+!!t,+!!r,n||0,a||0,o,s),e.emplaceBack(+!!t,+!!r,n||0,a||0,l,s),e.emplaceBack(+!!t,+!!r,n||0,a||0,l,u),e.emplaceBack(+!!t,+!!r,n||0,a||0,o,u)}const fE=2**25,mE=2**24,gE=2**17,yE=65536;function _E(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;let t=+!!e.placed,r=Math.floor(127*e.opacity);return r*fE+t*mE+r*gE+t*yE+512*r+256*t+2*r+t}const vE=0;var bE=class{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,r,i,n){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let r=e[this._currentTileIndex];if(t.getBucketParts(a,i,r,this._sortAcrossTiles),this._currentTileIndex++,n())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((e,t)=>e.sortKey-t.sortKey));this._currentPartIndex<a.length;){let e=a[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,r),this._currentPartIndex++,n())return!0}return!1}},xE=class{constructor(e,t,r,i,n,a,o,s){this.placement=new dE(e,t,a,o,s),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(e,t,r){let i=PS(),n=()=>!this._forceFullPlacement&&PS()-i>2;for(;this._currentPlacementIndex>=0;){let i=t[e[this._currentPlacementIndex]],a=this.placement.collisionIndex.transform.zoom;if(Pb(i)&&i.layout&&(!i.minzoom||i.minzoom<=a)&&(!i.maxzoom||i.maxzoom>a)){if(this._inProgressLayer||=new bE(i),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};const wE=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],SE=new Uint32Array(96);var TE=class e{static from(t){if(!t||void 0===t.byteLength||t.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,i]=new Uint8Array(t,0,2);if(219!==r)throw Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(1!==n)throw Error(`Got v${n} data when expected v1.`);let a=wE[15&i];if(!a)throw Error("Unrecognized array type.");let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,o,a,void 0,t)}constructor(e,t=64,r=Float64Array,i=ArrayBuffer,n){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=wE.indexOf(this.ArrayType),o=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(a<0)throw Error(`Unexpected typed array class: ${r}.`);if(n)this.data=n,this.ids=new this.IndexArrayType(n,8,e),this.coords=new r(n,8+s+l,2*e),this._pos=2*e,this._finished=!0;else{let n=this.data=new i(8+o+s+l);this.ids=new this.IndexArrayType(n,8,e),this.coords=new r(n,8+s+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(n,0,2).set([219,16+a]),new Uint16Array(n,2,1)[0]=t,new Uint32Array(n,4,1)[0]=e}}add(e,t){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=t,r}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return PE(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,r,i){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:a,nodeSize:o}=this;SE[0]=0,SE[1]=n.length-1,SE[2]=0;let s=3,l=[];for(;s>0;){let u=SE[--s],c=SE[--s],h=SE[--s];if(c-h<=o){for(let o=h;o<=c;o++){let s=a[2*o],u=a[2*o+1];s>=e&&s<=r&&u>=t&&u<=i&&l.push(n[o])}continue}let d=h+c>>1,p=a[2*d],f=a[2*d+1];p>=e&&p<=r&&f>=t&&f<=i&&l.push(n[d]),(0===u?e<=p:t<=f)&&(SE[s++]=h,SE[s++]=d-1,SE[s++]=1-u),(0===u?r>=p:i>=f)&&(SE[s++]=d+1,SE[s++]=c,SE[s++]=1-u)}return l}within(e,t,r){let i=[];return this.withinInto(e,t,r,i),i}withinInto(e,t,r,i){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:a,nodeSize:o}=this;SE[0]=0,SE[1]=n.length-1,SE[2]=0;let s=3,l=0,u=r*r;for(;s>0;){let c=SE[--s],h=SE[--s],d=SE[--s];if(h-d<=o){for(let r=d;r<=h;r++)IE(a[2*r],a[2*r+1],e,t)<=u&&(i[l++]=n[r]);continue}let p=d+h>>1,f=a[2*p],m=a[2*p+1];IE(f,m,e,t)<=u&&(i[l++]=n[p]),(0===c?e-r<=f:t-r<=m)&&(SE[s++]=d,SE[s++]=p-1,SE[s++]=1-c),(0===c?e+r>=f:t+r>=m)&&(SE[s++]=p+1,SE[s++]=h,SE[s++]=1-c)}return l}};function PE(e,t,r,i,n,a){if(n-i<=r)return;let o=i+n>>1;EE(e,t,o,i,n,a),PE(e,t,r,i,o-1,1-a),PE(e,t,r,o+1,n,1-a)}function EE(e,t,r,i,n,a){for(;n>i;){if(n-i>600){let o=n-i+1,s=r-i+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(s-o/2<0?-1:1);EE(e,t,r,Math.max(i,Math.floor(r-s*u/o+c)),Math.min(n,Math.floor(r+(o-s)*u/o+c)),a)}let o=t[2*r+a],s=i,l=n;for(DE(e,t,i,r),t[2*n+a]>o&&DE(e,t,i,n);s<l;){for(DE(e,t,s,l),s++,l--;t[2*s+a]<o;)s++;for(;t[2*l+a]>o;)l--}t[2*i+a]===o?DE(e,t,i,l):(l++,DE(e,t,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function DE(e,t,r,i){AE(e,r,i),AE(t,2*r,2*i),AE(t,2*r+1,2*i+1)}function AE(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function IE(e,t,r,i){let n=e-r,a=t-i;return n*n+a*a}const CE=.03125;var kE=class{constructor(e,t,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let i=new Map;for(let e=0;e<t.length;e++){let r=t.get(e),n=r.key,a=i.get(n);a?a.push(r):i.set(n,[r])}for(let[e,t]of i){let r={positions:t.map(e=>({x:Math.floor(e.anchorX*CE),y:Math.floor(e.anchorY*CE)})),crossTileIDs:t.map(e=>e.crossTileID)};if(r.positions.length>128){let e=new TE(r.positions.length,16,Uint16Array);for(let{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,t){let{x:r,y:i,z:n}=this.tileID.canonical,{x:a,y:o,z:s}=t.canonical,l=CE/2**(s-n),u=(8192*a+e.anchorX)*l,c=(8192*o+e.anchorY)*l,h=8192*r*CE,d=8192*i*CE;return{x:Math.floor(u-h),y:Math.floor(c-d)}}findMatches(e,t,r){let i=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let n=0;n<e.length;n++){let a=e.get(n);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);o.index?this.findMatchesForIndexedEntry(o,a,s,i,r):o.positions&&this.findMatchesForNonIndexedEntry(o,a,s,i,r)}}findMatchesForIndexedEntry(e,t,r,i,n){let a=e.index.range(r.x-i,r.y-i,r.x+i,r.y+i),o=1/0;for(let t of a)t<o&&!n[e.crossTileIDs[t]]&&(o=t);if(o!==1/0){let r=e.crossTileIDs[o];n[r]=!0,t.crossTileID=r}}findMatchesForNonIndexedEntry(e,t,r,i,n){for(let a=0;a<e.positions.length;a++){let o=e.positions[a],s=e.crossTileIDs[a];if(Math.abs(o.x-r.x)<=i&&Math.abs(o.y-r.y)<=i&&!n[s]){n[s]=!0,t.crossTileID=s;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},ME=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},FE=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(0!==t)for(let e in this.indexes){let r=this.indexes[e],i={};for(let e in r){let n=r[e];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),i[n.tileID.key]=n}this.indexes[e]=i}this.lng=e}addBucket(e,t,r){if(this.indexes[e.overscaledZ]?.[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||={};let i=this.usedCrossTileIDs[e.overscaledZ];for(let r in this.indexes){let n=this.indexes[r];if(Number(r)>e.overscaledZ)for(let r in n){let a=n[r];a.tileID.isChildOf(e)&&a.findMatches(t.symbolInstances,e,i)}else{let a=n[e.scaledTo(Number(r)).key];a&&a.findMatches(t.symbolInstances,e,i)}}for(let e=0;e<t.symbolInstances.length;e++){let n=t.symbolInstances.get(e);n.crossTileID||(n.crossTileID=r.generate(),i[n.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new kE(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let r of t.getCrossTileIDsLists())for(let t of r)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let r in this.indexes){let i=this.indexes[r];for(let n in i)e[i[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[n]),delete i[n],t=!0)}return t}},RE=class{constructor(){this.layerIndexes={},this.crossTileIDs=new ME,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,r){let i=this.layerIndexes[e.id];void 0===i&&(i=this.layerIndexes[e.id]=new FE);let n=!1,a={};i.handleWrapJump(r);for(let r of t){let t=r.getBucket(e);e.id===t?.layerIds[0]&&(t.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),i.addBucket(r.tileID,t,this.crossTileIDs)&&(n=!0),a[t.bucketInstanceId]=!0)}return i.removeStaleBuckets(a)&&(n=!0),n}pruneUnusedLayers(e){let t={};for(let r of e)t[r]=!0;for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}},LE="void main() {fragColor=vec4(1.0);}";const zE={prelude:OE("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform highp sampler2D u_depth;layout(std140) uniform TerrainUBO {highp mat4 u_terrain_matrix;highp vec4 u_terrain_unpack;highp float u_terrain_dim;highp float u_terrain_exaggeration;};\n#endif\nconst 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) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 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;\n#else\nreturn 1.0;\n#endif\n}float ele(ivec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texelFetch(u_terrain,pos,0)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+2.0;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;\n#define PROJECTION_UBO\nlayout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};"),projectionMercator:OE("\nvoid clipAntimeridian() {}","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:OE("in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian !=0 && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}","#define GLOBE_RADIUS 6371008.8\n#ifndef PROJECTION_UBO\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;\n#endif\nout highp float v_projection_tile_x;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}"),background:OE("uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:OE("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:OE("in vec3 v_data;flat in float v_visibility;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define mediump float radius\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 stroke_color\n#pragma maplibre: define mediump float stroke_width\n#pragma maplibre: define lowp float stroke_opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump float radius\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 stroke_color\n#pragma maplibre: initialize mediump float stroke_width\n#pragma maplibre: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;flat out float v_visibility;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define mediump float radius\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 stroke_color\n#pragma maplibre: define mediump float stroke_width\n#pragma maplibre: define lowp float stroke_opacity\nvoid main(void) {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump float radius\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 stroke_color\n#pragma maplibre: initialize mediump float stroke_width\n#pragma maplibre: initialize lowp float stroke_opacity\nivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),clippingMask:OE(LE,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:OE("uniform highp float u_intensity;in vec2 v_extrude;\n#pragma maplibre: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma maplibre: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in ivec2 a_pos;out vec2 v_extrude;\n#pragma maplibre: define highp float weight\n#pragma maplibre: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma maplibre: initialize highp float weight\n#pragma maplibre: initialize mediump float radius\nivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=vec2(pos_raw >> 3);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}"),heatmapTexture:OE("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world_size,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:OE("flat in float v_placed;flat in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;flat out float v_placed;flat out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:OE("flat in float v_radius;in vec2 v_extrude;flat in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;flat out float v_radius;out vec2 v_extrude;flat out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:OE("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=2.0/u_dimension;float scale=(u_dimension.x-4.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:OE("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:OE(LE,"layout(location=0) in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}"),fill:OE("#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float opacity\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}"),fillOutline:OE("in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 outline_color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 outline_color\n#pragma maplibre: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 outline_color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 outline_color\n#pragma maplibre: initialize lowp float opacity\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillOutlinePattern:OE("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;uniform bool u_sdf_pattern;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*alpha*opacity;} else {fragColor=mix(color1,color2,u_fade)*alpha*opacity;}\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}"),fillPattern:OE("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform bool u_sdf_pattern;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*opacity;} else {fragColor=mix(color1,color2,u_fade)*opacity;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),fillExtrusion:OE("in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;\n#ifdef TERRAIN3D\nlayout(location=2) in vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma maplibre: define highp float base\n#pragma maplibre: define highp float height\n#pragma maplibre: define highp vec4 color\nvoid main() {\n#pragma maplibre: initialize highp float base\n#pragma maplibre: initialize highp float height\n#pragma maplibre: initialize highp vec4 color\nvec3 normal=vec3(a_normal_ed.xyz);\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=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:OE("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma maplibre: define lowp float base\n#pragma maplibre: define lowp float height\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float base\n#pragma maplibre: initialize lowp float height\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;\n#ifdef TERRAIN3D\nlayout(location=2) in vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma maplibre: define lowp float base\n#pragma maplibre: define lowp float height\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float base\n#pragma maplibre: initialize lowp float height\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=vec3(a_normal_ed.xyz);float edgedistance=float(a_normal_ed.w);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+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:OE("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-4.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:OE("uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec2 size=vec2(textureSize(u_image,0));vec2 texturePos=(v_pos*(size-2.0)+1.0)/size;vec4 pixel=texture(u_image,texturePos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:OE("flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),lineGradient:OE("uniform sampler2D u_image;flat in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}"),linePattern:OE("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;flat in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;flat in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;flat out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;flat out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),lineSDF:OE("uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),lineGradientSDF:OE("uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;flat in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;flat out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}"),layerOpacity:OE("uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}","layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),raster:OE("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;}\n#endif\nfloat perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}"),symbolIcon:OE("uniform sampler2D u_texture;in vec2 v_tex;flat in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform bool u_rotate_symbol;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;flat out float v_total_opacity;\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}"),symbolSDF:OE("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}"),symbolTextAndIcon:OE("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;in vec4 v_data0;in vec3 v_data1;flat in float v_is_sdf;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nfloat total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}","layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;flat out float v_is_sdf;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_symbol_fade_change :-u_symbol_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}"),terrain:OE("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:OE("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),atmosphere:OE("#ifdef GL_ES\nprecision highp float;\n#endif\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:OE("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;uniform vec3 u_globe_position;uniform float u_globe_radius;in vec3 v_view_direction;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,(angle_to_globe_center-horizon_angle)*u_camera_to_center_distance*u_device_pixel_ratio,u_sky_blend);}if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")};function OE(e,t){let r=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=t.match(/in ([\w]+) ([\w]+)/g),n=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=a?a.concat(n):n,s=i?i.length:0,l={};return e=e.replace(r,(e,t,r,i,n)=>(l[n]=!0,"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nin ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = u_${n};\n#endif\n`)),t=t.replace(r,(e,t,r,i,n)=>{let a="float"===i?"vec2":"vec4",o=n.match(/color/)?"color":a;return l[n]?"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nlayout(location = ${s++}) in ${r} ${a} a_${n};\nout ${r} ${i} ${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:"define"===t?`\n#ifndef HAS_UNIFORM_u_${n}\nuniform lowp float u_${n}_t;\nlayout(location = ${s++}) in ${r} ${a} a_${n};\n#else\nuniform ${r} ${i} u_${n};\n#endif\n`:"vec4"===o?`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = a_${n};\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${n}\n ${r} ${i} ${n} = unpack_mix_${o}(a_${n}, u_${n}_t);\n#else\n ${r} ${i} ${n} = u_${n};\n#endif\n`}),{fragmentSource:e,vertexSource:t,staticAttributes:i,staticUniforms:o}}const BE="#define PROJECTION_MERCATOR",jE="mercator";var NE=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return jE}get shaderDefine(){return BE}get shaderPreludeCode(){return zE.projectionMercator}get vertexShaderPreludeCode(){return zE.projectionMercator.vertexSource}get subdivisionGranularity(){return Gg.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(e,t,r,i,n){if(this._cachedMesh)return this._cachedMesh;let a=new Yp;a.emplaceBack(0,0),a.emplaceBack(8192,0),a.emplaceBack(0,8192),a.emplaceBack(8192,8192);let o=e.createVertexBuffer(a,tP.members),s=bf.simpleSegment(0,0,4,2),l=new mf;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new eP(o,u,s),this._cachedMesh}recalculate(){}hasTransition(){return!1}},UE=class e{constructor(e=0,t=0,r=0,i=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(r)||r<0||isNaN(i)||i<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=r,this.right=i}interpolate(e,t,r){return null!=t.top&&null!=e.top&&(this.top=_u.number(e.top,t.top,r)),null!=t.bottom&&null!=e.bottom&&(this.bottom=_u.number(e.bottom,t.bottom,r)),null!=t.left&&null!=e.left&&(this.left=_u.number(e.left,t.left,r)),null!=t.right&&null!=e.right&&(this.right=_u.number(e.right,t.right,r)),this}getCenter(e,t){return new $a(ns((this.left+e-this.right)/2,0,e),ns((this.top+t-this.bottom)/2,0,t))}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new e(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function VE(e,t){if(!e.renderWorldCopies||e.lngRange)return;let r=t.lng-e.center.lng;t.lng+=r>180?-360:r<-180?360:0}function $E(e){return Math.max(0,Math.floor(e))}var GE=class{constructor(e,t){this.applyConstrain=(e,t)=>null===this._constrainOverride?this._callbacks.defaultConstrain(e,t):this._constrainOverride(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=void 0===t?.renderWorldCopies||!!t?.renderWorldCopies,this._minZoom=t?.minZoom||0,this._maxZoom=t?.maxZoom||22,this._minPitch=t?.minPitch??0,this._maxPitch=t?.maxPitch??60,this._constrainOverride=t?.constrainOverride??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new _y(0,0),this._elevation=0,this._zoom=0,this._tileZoom=$E(this._zoom),this._scale=cs(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new UE,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,r){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=$E(this._zoom),this._scale=cs(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new UE(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!r&&e.autoCalculateNearFarZ,t&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){if(this._minZoom===e)return;this._minZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get maxZoom(){return this._maxZoom}setMaxZoom(e){if(this._maxZoom===e)return;this._maxZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get minPitch(){return this._minPitch}setMinPitch(e){if(this._minPitch===e)return;this._minPitch=e;let t=this._unmodified;this.setPitch(Math.max(this.pitch,e)),this._unmodified=t}get maxPitch(){return this._maxPitch}setMaxPitch(e){if(this._maxPitch===e)return;this._maxPitch=e;let t=this._unmodified;this.setPitch(Math.min(this.pitch,e)),this._unmodified=t}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){void 0===e?e=!0:null===e&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){void 0===e&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new $a(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=as(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=vS(),function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);e[0]=i*l+a*s,e[1]=n*l+o*s,e[2]=i*-s+a*l,e[3]=n*-s+o*l}(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=ns(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Ps(this._fovInRadians)}setFov(e){e=ns(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Ts(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.applyConstrain(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=cs(t),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){(e.lat!==this._center.lat||e.lng!==this._center.lng)&&(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,r){this._unmodified=!1,this._edgeInsets.interpolate(e,t,r),this.constrainInternal(),this._calcMatrices()}resize(e,t,r=!0){this._width=e,this._height=t,r&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return 2!==this._latRange?.length||2!==this._lngRange?.length?null:new zT([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-85.051129,Is])}getCameraQueryGeometry(e,t){if(1===t.length)return[t[0],e];{let{minX:r,minY:i,maxX:n,maxY:a}=sy.fromPoints(t).extend(e);return[new $a(r,i),new $a(n,i),new $a(n,a),new $a(r,a),new $a(r,i)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:r}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(r),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._pixelPerMeter=Sy(1,this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=Ja(new Float64Array(16));ro(e,e,[this._width/2,-this._height/2,1]),to(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=Ja(new Float64Array(16)),ro(e,e,[1,-1,1]),to(e,e,[-1,-1,0]),ro(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height,this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,r,i){let n,a,o=void 0===r?this.bearing:r,s=i=void 0===i?this.pitch:i,{distanceToCenter:l,clampedElevation:u}=this._distanceToCenterFromAltElevationPitch(t,this.elevation,s),{x:c,y:h}=Ry(s,o),d=Dy.fromLngLat(e,t),p=Ey(1,d.y),f=0;do{if(f+=1,f>10)break;a=l/p;let e=c*a,t=h*a;n=new Dy(d.x+e,d.y+t),p=1/n.meterInMercatorCoordinateUnits()}while(Math.abs(l-a*p)>1e-12);return{center:n.toLngLat(),elevation:u,zoom:hs(this.height/2/Math.tan(this.fovInRadians/2)/a/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=1/this.worldSize,r=Sy(1,this.center.lat)*this.worldSize,i=Dy.fromLngLat(this.center,this.elevation),n=i.x/t,a=i.y/t,o=i.z/t,s=this.pitch,l=this.bearing,{x:u,y:c,z:h}=Ry(s,l),d=this.cameraToCenterDistance,p=n+d*-u,f=a+d*-c,m=o+d*h,{distanceToCenter:g,clampedElevation:y}=this._distanceToCenterFromAltElevationPitch(m/r,e,s),_=g*r,v=new Dy((p+u*_)*t,(f+c*_)*t,0).toLngLat(),b=Sy(1,v.lat),x=hs(this.height/2/Math.tan(this.fovInRadians/2)/g/b/this.tileSize);this._elevation=y,this._center=v,this.setZoom(x)}_distanceToCenterFromAltElevationPitch(e,t,r){let i,n=-Math.cos(Ts(r)),a=e-t,o=t;return n*a>=0||Math.abs(n)<.1?(i=1e4,o=e+i*n):i=-a/n,{distanceToCenter:i,clampedElevation:o}}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new $a(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:2**e.canonical.z;return[e.canonical.x/t,e.canonical.y/t,1/t/8192,1/t/8192]}},qE=class{distanceToTile2d(e,t,r,i){let n=i,a=n.distanceX([e,t]),o=n.distanceY([e,t]);return Math.hypot(a,o)}getWrap(e,t,r){return r}getTileBoundingVolume(e,t,r,i){let n=Math.min(0,r),a=Math.max(0,r);if(i?.terrain){let r=new Bb(e.z,t,e.z,e.x,e.y),o=i.terrain.getMinMaxElevation(r);n=o.minElevation??n,a=o.maxElevation??a}let o=1<<e.z;return new mP([t+e.x/o,e.y/o,n],[t+(e.x+1)/o,(e.y+1)/o,a])}allowVariableZoom(e,t){let r=ns(78.5-e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height/2,0,60);return!!t.terrain||e.pitch>r}allowWorldCopies(){return!0}prepareNextFrame(){}};const ZE=pp([{name:"a_pos3d",type:"Int16",components:3}]);var WE=class extends Js{constructor(e){super(),this._lastTilesetChange=PS(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(e,t){this.tileManager.update(e,t),this._renderableTilesKeys=[];let r={},i=!1;for(let n of wP(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.tileManager._source.calculateTileZoom}))r[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.terrainRttPosMatrix32f=new Float32Array(16),so(n.terrainRttPosMatrix32f,0,8192,8192,0,0,1),this._tiles[n.key]=new dP(n,this.tileSize),this._lastTilesetChange=PS(),i=!0);for(let e in this._tiles)r[e]||(this._tiles[e].releaseRTT(this.tileManager.map.painter),delete this._tiles[e],i=!0);return i}releaseRTT(e){for(let t in this._tiles){let r=this._tiles[t];(r.tileID.equals(e)||r.tileID.isChildOf(e)||e.isChildOf(r.tileID))&&r.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let e in this._tiles)this._tiles[e].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let r of this._renderableTilesKeys){let i=this._tiles[r].tileID,n=e.clone(),a=Vo();if(i.canonical.equals(e.canonical))so(a,0,8192,8192,0,0,1);else if(i.canonical.isChildOf(e.canonical)){let t=i.canonical.z-e.canonical.z,r=i.canonical.x-(i.canonical.x>>t<<t),n=i.canonical.y-(i.canonical.y>>t<<t),o=8192>>t;so(a,0,o,o,0,0,1),to(a,a,[-r*o,-n*o,0])}else{if(!e.canonical.isChildOf(i.canonical))continue;{let t=e.canonical.z-i.canonical.z,r=e.canonical.x-(e.canonical.x>>t<<t),n=e.canonical.y-(e.canonical.y>>t<<t),o=8192>>t;so(a,0,8192,8192,0,0,1),to(a,a,[r*o,n*o,0]),ro(a,a,[1/2**t,1/2**t,0])}}n.terrainRttPosMatrix32f=new Float32Array(a),t[r]=n}return t}_getTerrainCoordsForTileRanges(e,t){let r={};for(let i of this._renderableTilesKeys){let n=this._tiles[i].tileID;if(!this._isWithinTileRanges(n,t))continue;let a=e.clone(),o=Vo();if(n.canonical.z===e.canonical.z){let t=e.canonical.x-n.canonical.x+e.wrap*(1<<e.canonical.z),r=e.canonical.y-n.canonical.y;so(o,0,8192,8192,0,0,1),to(o,o,[8192*t,8192*r,0])}else if(n.canonical.z>e.canonical.z){let t=n.canonical.z-e.canonical.z,r=n.canonical.x-(n.canonical.x>>t<<t)+e.wrap*(1<<n.canonical.z),i=n.canonical.y-(n.canonical.y>>t<<t),a=e.canonical.x-(n.canonical.x>>t),s=e.canonical.y-(n.canonical.y>>t),l=8192>>t;so(o,0,l,l,0,0,1),to(o,o,[-r*l+8192*a,-i*l+8192*s,0])}else{let t=e.canonical.z-n.canonical.z,r=e.canonical.x-(e.canonical.x>>t<<t)+e.wrap*(1<<e.canonical.z),i=e.canonical.y-(e.canonical.y>>t<<t),a=(e.canonical.x>>t)-n.canonical.x,s=(e.canonical.y>>t)-n.canonical.y,l=8192<<t;so(o,0,l,l,0,0,1),to(o,o,[8192*r+a*l,8192*i+s*l,0])}a.terrainRttPosMatrix32f=new Float32Array(o),r[i]=a}return r}getSourceTile(e,t){let r=this.tileManager._source,i=e.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return;this._sourceTileCache[e.key]||=e.scaledTo(i).key;let n=this.findTileInCaches(this._sourceTileCache[e.key]);if(!n?.dem&&t)for(;i>=r.minzoom&&!n?.dem;)n=this.findTileInCaches(e.scaledTo(i--).key);return n}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=PS()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let r=t[e.canonical.z];return!!r&&(e.wrap>r.minWrap||e.wrap<r.maxWrap||e.canonical.x>=r.minTileXWrapped&&e.canonical.x<=r.maxTileXWrapped&&e.canonical.y>=r.minTileY&&e.canonical.y<=r.maxTileY)}};const HE=8192*(1-1e-12);var XE=class{constructor(e,t,r,i="auto"){this._meshCache={},this.painter=e,this.tileManager=new WE(t),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this._terrainSkirtLength=i,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){this._fbo&&=(this._fbo.destroy(),null),this._fboDepthTexture&&=(this._fboDepthTexture.destroy(),null),this._emptyDemTexture&&=(this._emptyDemTexture.destroy(),null),this._emptyDepthTexture&&=(this._emptyDepthTexture.destroy(),null);for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,t,r,i=8192){let n=e.normalizeCoordinates(t,r,i);if(!n)return 0;let a=this.getElevationSampler(n.tileID);return a?a(n.x,n.y,i):0}getElevationForLngLatZoom(e,t){if(!Lb(t,e.wrap()))return 0;let{tileID:r,mercatorX:i,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(r,i%8192,n%8192,8192)}getElevationForLngLat(e,t){let r=this.getCoverageIndex();if(r){let t=Dy.fromLngLat(e),i=YE(r,this.exaggeration,t.x,t.y);if(i.demLoaded)return i.elevation}let i=wP(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),n=0;for(let e of i)e.canonical.z>n&&(n=Math.min(e.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,n)}getElevation(e,t,r,i=8192){return this.getDEMElevation(e,t,r,i)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return void 0===this._coverageIndex&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let e=[],t=new Map,r=0,i=0;for(let n of this.tileManager.getRenderableTiles()){if(!n)continue;let{canonical:a,wrap:o}=n.tileID;e.includes(a.z)||e.push(a.z);let s=this.getElevationSampler(n.tileID);t.set(`${o}/${a.z}/${a.x}/${a.y}`,s);let{minElevation:l,maxElevation:u}=this.getMinMaxElevation(n.tileID);r=Math.min(r,l??0),i=Math.max(i,u??0)}return 0===t.size?null:(e.sort((e,t)=>t-e),{zooms:e,samplerPerTile:t,minElevation:r-10,maxElevation:i+10})}getElevationSampler(e){let t=e.key,r=this._elevationSamplerCache.get(t);if(r)return r;let i=this.tileManager.getSourceTile(e,!0),n=i?.dem;if(!i||!n)return null;let a=this._getDEMTileMatrix(e,i),o=a[0]*n.dim,s=a[5]*n.dim,l=a[12]*n.dim,u=a[13]*n.dim,c=(e,t,r)=>{let i=8192===r?1:8192/r;return n.sampleBilinear(e*i*o+l,t*i*s+u)};return this._elevationSamplerCache.set(t,c),c}_getDEMTileMatrix(e,t){let r=`${t.tileID.key}/${e.key}`,i=this._demMatrixCache.get(r);if(i)return i;let n=this.tileManager.getSource().maxzoom,a=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=n?a=e.canonical.z-n:_s("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let o=e.canonical.x-(e.canonical.x>>a<<a),s=e.canonical.y-(e.canonical.y>>a<<a),l=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(new Float64Array(16),[1/(8192<<a),1/(8192<<a),0]);return to(l,l,[8192*o,8192*s,0]),this._demMatrixCache.set(r,l),l}getTerrainData(e){if(!this._emptyDemTexture){let e=this.painter.context,t=new Nm({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Km(e,t,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Km(e,new Nm({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=Ja([])}let t=this.tileManager.getSourceTile(e,!0);if(t?.dem&&(!t.demTexture||t.needsTerrainPrepare)){let e=this.painter.context;t.demTexture||=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new Km(e,t.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),t.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let r=t?this._getDEMTileMatrix(e,t):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:t?.dem?.dim||1,u_terrain_matrix:r,u_terrain_unpack:t?.dem?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(){let e=this.painter,t=e.width/devicePixelRatio,r=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==t||this._fbo.height!==r)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new Km(e.context,{width:t,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(t,r,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t,r))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}depthAtPoint(e){let t=new Uint8Array(4),r=this.painter.context,i=r.gl;return r.bindFramebuffer.set(this.getFramebuffer().framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),r.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){let t=this.painter.style.projection?.transitionState>0,r=t&&0===e.canonical.y,i=t&&e.canonical.y===(1<<e.canonical.z)-1,n=`m_${r?"n":""}_${i?"s":""}`;if(this._meshCache[n])return this._meshCache[n];let a=this.painter.context,o=new Jp,s=new mf,l=this.meshSize,u=8192/l,c=l*l;for(let e=0;e<=l;e++)for(let t=0;t<=l;t++)o.emplaceBack(t*u,e*u,0);for(let e=0;e<c;e+=l+1)for(let t=0;t<l;t++)s.emplaceBack(t+e,l+t+e+1,l+t+e+2),s.emplaceBack(t+e,l+t+e+2,t+e+1);"none"!==this._terrainSkirtLength&&this._buildSkirts(o,s,l,u,r,i);let h=new eP(a.createVertexBuffer(o,ZE.members),a.createIndexBuffer(s),bf.simpleSegment(0,0,o.length,s.length));return this._meshCache[n]=h,h}getSkirtLength(e){return 2*Math.PI*yy/2**Math.max(e,0)/5}getMinTileElevationForLngLatZoom(e,t){if(!Lb(t,e.wrap()))return 0;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getMinMaxElevation(r).minElevation??0}getMinMaxElevation(e){let t=this.tileManager.getSourceTile(e,!0),r={minElevation:null,maxElevation:null};return t?.dem&&(r.minElevation=t.dem.min*this.exaggeration,r.maxElevation=t.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(e,t){let r=Dy.fromLngLat(e.wrap()),i=8192*(1<<t),n=r.x*i,a=r.y*i,o=Math.floor(n/8192),s=Math.floor(a/8192);return{tileID:new Bb(t,0,t,o,s),mercatorX:n,mercatorY:a}}_buildSkirts(e,t,r,i,n,a){let o=e.length,s=o+(r+1),l=(r+1)*r,u=n?-32768:0,c=+!n,h=a?32767:8192,d=+!a;for(let t=0;t<=r;t++)e.emplaceBack(t*i,u,c);for(let t=0;t<=r;t++)e.emplaceBack(t*i,h,d);for(let e=0;e<r;e++)t.emplaceBack(l+e,s+e,s+e+1),t.emplaceBack(l+e,s+e+1,l+e+1),t.emplaceBack(0+e,o+e+1,o+e),t.emplaceBack(0+e,0+e+1,o+e+1);let p=e.length,f=p+2*(r+1);for(let t of[0,1])for(let n=0;n<=r;n++)for(let r of[0,1])e.emplaceBack(8192*t,n*i,r);for(let e=0;e<2*r;e+=2)t.emplaceBack(p+e,p+e+1,p+e+3),t.emplaceBack(p+e,p+e+3,p+e+2),t.emplaceBack(f+e,f+e+3,f+e+1),t.emplaceBack(f+e,f+e+2,f+e+3)}};const KE={covered:!1,demLoaded:!1,elevation:0};function YE(e,t,r,i){if(i<0||i>=1)return KE;let n=Math.floor(r),a=r-n;for(let r of e.zooms){let o=1<<r,s=a*o,l=i*o,u=Math.floor(s),c=Math.floor(l),h=`${n}/${r}/${u}/${c}`;if(!e.samplerPerTile.has(h))continue;let d=e.samplerPerTile.get(h);return d?{covered:!0,demLoaded:!0,elevation:d(Math.min(8192*(s-u),HE),Math.min(8192*(l-c),HE),8192)*t}:{covered:!0,demLoaded:!1,elevation:0}}return KE}function JE(e,t){return e.covered&&t<=e.elevation+1e-6}function QE(e,t,r,i,n){for(let a=0;a<40&&i-r>n;a++){let n=(r+i)/2;t(e,n)?i=n:r=n}return{lo:r,hi:i}}var eD=class e{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,r){this._helper.interpolatePadding(e,t,r)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,r=!0){this._helper.resize(e,t,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,t)=>{t=ns(+t,this.minZoom,this.maxZoom);let r={center:new _y(e.lng,e.lat),zoom:t},i=this._helper._lngRange;!this._helper._renderWorldCopies&&null===i&&(i=[-179.9999999999,180-1e-10]);let n=this.tileSize*cs(r.zoom),a=0,o=n,s=0,l=n,u=0,c=0,{x:h,y:d}=this.size;if(this._helper._latRange){let e=this._helper._latRange;a=wy(e[1])*n,o=wy(e[0])*n,o-a<d&&(u=d/(o-a))}i&&(s=as(xy(i[0])*n,0,n),l=as(xy(i[1])*n,0,n),l<s&&(l+=n),l-s<h&&(c=h/(l-s)));let p,f,{x:m,y:g}=Iy(n,e),y=Math.max(c||0,u||0);if(y){let e=new $a(c?(l+s)/2:m,u?(o+a)/2:g);return r.center=Cy(n,e).wrap(),r.zoom+=hs(y),r}if(this._helper._latRange){let e=d/2;g-e<a&&(f=a+e),g+e>o&&(f=o-e)}if(i){let e=(s+l)/2,t=m;this._helper._renderWorldCopies&&(t=as(m,e-n/2,e+n/2));let r=h/2;t-r<s&&(p=s+r),t+r>l&&(p=l-r)}if(void 0!==p||void 0!==f){let e=new $a(p??m,f??g);r.center=Cy(n,e).wrap()}return r},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new GE({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new qE}clone(){let t=new e;return t.apply(this,!1),t}apply(e,t,r){this._helper.apply(e,t,r)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){let t=[new Ob(0,e)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new $a(0,0)),i=this.screenPointToMercatorCoordinate(new $a(this._helper._width,0)),n=this.screenPointToMercatorCoordinate(new $a(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new $a(0,this._helper._height)),o=Math.floor(Math.min(r.x,i.x,n.x,a.x)),s=Math.floor(Math.max(r.x,i.x,n.x,a.x));for(let r=o-1;r<=s+1;r++)0!==r&&t.push(new Ob(r,e))}return t}getCameraFrustum(){return gP.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){let t=this.screenPointToLocation(this.centerPoint,e),r=e?e.getElevationForLngLat(t,this):0;this._helper.recalculateZoomAndCenter(r)}setLocationAtPoint(e,t,r=this.elevation){let i=r-this.elevation,n=this.screenPointToMercatorCoordinateAtZ(t,i),a=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),o=Dy.fromLngLat(e),s=new Dy(o.x-(n.x-a.x),o.y-(n.y-a.y));this.setCenter(s?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,t){return t?this.coordinatePoint(Dy.fromLngLat(e),t.getElevationForLngLat(e,this),this._pixelMatrix3D):this.coordinatePoint(Dy.fromLngLat(e))}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}screenPointToLocationAtElevation(e,t){return this.screenPointToMercatorCoordinateAtZ(e,t-this.elevation)?.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){let r=this.screenTerrainPointToMercatorCoordinate(e,t);if(null!=r)return r}return this.screenPointToMercatorCoordinateAtZ(e)}screenTerrainPointToMercatorCoordinate(e,t){let r=t.getCoverageIndex();if(!r)return null;let{near:i,far:n}=this.getRaySegmentFromPixel(e),a=this.worldSize,o=n[0]-i[0],s=n[1]-i[1],l=n[2]-i[2],u={index:r,exaggeration:t.exaggeration,near:i,dx:o,dy:s,dz:l,worldSize:a},c=0,h=1;if(0===l){if(i[2]>r.maxElevation||i[2]<r.minElevation)return null}else{let e=(r.maxElevation-i[2])/l,t=(r.minElevation-i[2])/l;if(c=Math.max(c,Math.min(e,t)),h=Math.min(h,Math.max(e,t)),c>h)return null}let d=Math.hypot(o,s),p=ns(Math.ceil(d*(h-c)/4),1,512),f=0,m=!rD(u,0);for(let e=0;e<=p;e++){let t=c+(h-c)*e/p;if(m){if(rD(u,t)){let{lo:e,hi:r}=QE(u,rD,f,t,.001/d),n=tD(u,e),c=tD(u,r),h=i[2]+e*l-n.elevation,p=i[2]+r*l-c.elevation,m=n.covered&&h>p?ns(e+h*(r-e)/(h-p),e,r):r;return new Dy((i[0]+m*o)/a,(i[1]+m*s)/a,tD(u,m).elevation)}}else m=!rD(u,t);f=t}return null}getRaySegmentFromPixel(e){let t=[e.x,e.y,0,1],r=[e.x,e.y,1,1];Eo(t,t,this._pixelMatrixInverse),Eo(r,r,this._pixelMatrixInverse);let i=t[3],n=r[3],a=this.elevation;return{near:[t[0]/i,t[1]/i,t[2]/i+a],far:[r[0]/n,r[1]/n,r[2]/n+a]}}screenPointToMercatorCoordinateAtZ(e,t){let r=t||0,{near:i,far:n}=this.getRaySegmentFromPixel(e),a=i[2]===n[2]?0:(r+this.elevation-i[2])/(n[2]-i[2]);return new Dy(_u.number(i[0],n[0],a)/this.worldSize,_u.number(i[1],n[1],a)/this.worldSize,r)}coordinatePoint(e,t=0,r=this._pixelMatrix){let i=[e.x*this.worldSize,e.y*this.worldSize,t,1];return Eo(i,i,r),new $a(i[0]/i[3],i[1]/i[3])}getBounds(){let e=Math.max(0,this._helper._height/2-ky(this));return(new zT).extend(this.screenPointToLocation(new $a(0,e))).extend(this.screenPointToLocation(new $a(this._helper._width,e))).extend(this.screenPointToLocation(new $a(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new $a(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?null!=this.screenTerrainPointToMercatorCoordinate(e,t):e.y>this.height/2-ky(this)}calculatePosMatrix(e,t=!1,r=!1){let i=e.key??jb(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),n=t?this._alignedPosMatrixCache:this._posMatrixCache;if(n.has(i)){let e=n.get(i);return r?e.f32:e.f64}let a=My(e,this.worldSize);eo(a,t?this._alignedProjMatrix:this._viewProjMatrix,a);let o={f64:a,f32:new Float32Array(a)};return n.set(i,o),r?o.f32:o.f64}calculateFogMatrix(e){let t=e.key,r=this._fogMatrixCacheF32;if(r.has(t))return r.get(t);let i=My(e,this.worldSize);return eo(i,this._fogMatrix,i),r.set(t,new Float32Array(i)),r.get(t)}calculateCenterFromCameraLngLatAlt(e,t,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,r,i)}calculateCameraOptionsFromTo(e,t,r,i){let n=Dy.fromLngLat(e,t),a=Dy.fromLngLat(r,i),o=a.x-n.x,s=a.y-n.y,l=a.z-n.z,u=Math.hypot(o,s,l);if(0===u)throw Error("Can't calculate camera options with same From and To");let c=Math.hypot(o,s),h=hs(this.cameraToCenterDistance/u/this.tileSize),d=Ps(Math.atan2(o,-s)),p=Ps(Math.acos(c/u));return p=l<0?90-p:90+p,{center:a.toLngLat(),elevation:i,zoom:h,pitch:p,bearing:d}}_calculateNearFarZIfNeeded(e,t,r){if(!this._helper.autoCalculateNearFarZ)return;let i=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),n=e-i*this._helper._pixelPerMeter/Math.cos(t),a=i<0?n:e,o=Math.PI/2+this.pitchInRadians,s=Ts(this.fov)*(Math.abs(Math.cos(Ts(this.roll)))*this.height+Math.abs(Math.sin(Ts(this.roll)))*this.width)/this.height*(.5+r.y/this.height),l=Math.sin(s)*a/Math.sin(ns(Math.PI-o-s,.01,Math.PI-.01)),u=ky(this),c=Math.atan(u/this._helper.cameraToCenterDistance),h=Ts(.75),d=c>h?2*c*(.5+r.y/(2*u)):h,p=Math.sin(d)*a/Math.sin(ns(Math.PI-o-d,.01,Math.PI-.01)),f=Math.min(l,p);this._helper._farZ=1.01*(Math.cos(Math.PI/2-t)*f+a),this._helper._nearZ=this._helper._height/50}_calcMatrices(){let e,t=this.centerOffset,r=Iy(this.worldSize,this.center),i=r.x,n=r.y,a=Ts(Math.min(this.pitch,89.25)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(a));this._calculateNearFarZIfNeeded(o,a,t),e=new Float64Array(16),oo(e,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),function(e,t){e[0]=1/t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1/t[5],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=1/t[14],e[12]=0,e[13]=0,e[14]=-1,e[15]=t[10]/t[14]}(this._invProjMatrix,e),e[8]=2*-t.x/this._helper._width,e[9]=2*t.y/this._helper._height,this._projectionMatrix=Ya(e),ro(e,e,[1,-1,1]),to(e,e,[0,0,-this._helper.cameraToCenterDistance]),ao(e,e,-this.rollInRadians),io(e,e,this.pitchInRadians),ao(e,e,-this.bearingInRadians),to(e,e,[-i,-n,0]),this._mercatorMatrix=ro([],e,[this.worldSize,this.worldSize,this.worldSize]),ro(e,e,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=eo(new Float64Array(16),this.clipSpaceToPixelsMatrix,e),to(e,e,[0,0,-this.elevation]),this._viewProjMatrix=e,this._invViewProjMatrix=Qa([],e);let s=[0,0,-1,1];Eo(s,s,this._invViewProjMatrix),this._cameraPosition=[s[0]/s[3],s[1]/s[3],s[2]/s[3]],this._fogMatrix=new Float64Array(16),oo(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,ro(this._fogMatrix,this._fogMatrix,[1,-1,1]),to(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),ao(this._fogMatrix,this._fogMatrix,-this.rollInRadians),io(this._fogMatrix,this._fogMatrix,this.pitchInRadians),ao(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),to(this._fogMatrix,this._fogMatrix,[-i,-n,0]),ro(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),to(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=eo(new Float64Array(16),this.clipSpaceToPixelsMatrix,e);let l=this._helper._width%2/2,u=this._helper._height%2/2,c=Math.cos(this.bearingInRadians),h=Math.sin(-this.bearingInRadians),d=i-Math.round(i)+c*l+h*u,p=n-Math.round(n)+c*u+h*l,f=new Float64Array(e);if(to(f,f,[d>.5?d-1:d,p>.5?p-1:p,0]),this._alignedProjMatrix=f,e=Qa(new Float64Array(16),this._pixelMatrix),!e)throw Error("failed to invert matrix");this._pixelMatrixInverse=e,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let e=this.screenPointToMercatorCoordinate(new $a(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return Eo(t,t,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this.cameraToCenterDistance/this.pixelsPerMeter+this.elevation}getCameraLngLat(){let e=Sy(1,this.center.lat)*this.worldSize,t=this._helper.cameraToCenterDistance/e;return Fy(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}lngLatToCameraDepth(e,t){let r=Dy.fromLngLat(e),i=[r.x*this.worldSize,r.y*this.worldSize,t,1];return Eo(i,i,this._viewProjMatrix),i[2]/i[3]}getProjectionData(e){let t,{overscaledTileID:r,aligned:i,applyTerrainMatrix:n}=e,a=this._helper.getMercatorTileCoordinates(r),o=r?this.calculatePosMatrix(r,i,!0):null;return t=r?.terrainRttPosMatrix32f&&n?r.terrainRttPosMatrix32f:o||Go(),{mainMatrix:t,tileMercatorCoords:a,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:t,clipAntimeridian:!1}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,r){return 1}transformLightDirection(e){return uo(e)}getRayDirectionFromPixel(e){throw Error("Not implemented.")}projectTileCoordinates(e,t,r,i){let n,a=this.calculatePosMatrix(r);null==i?(n=[e,t,0,1],nE(n,n,a)):(n=[e,t,i,1],Eo(n,n,a));let o=n[3];return{point:new $a(n[0]/o,n[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}populateCache(e){for(let t of e)this.calculatePosMatrix(t)}getProjectionDataForCustomLayer(e=!0){let t=new Bb(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:t,applyGlobeMatrix:e}),i=My(t,this.worldSize);eo(i,this._viewProjMatrix,i);let n=[8192,8192,this.worldSize/this._helper.pixelsPerMeter],a=Vo();return ro(a,i,n),{...r,tileMercatorCoords:[0,0,1,1],fallbackMatrix:a,mainMatrix:a}}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}};function tD(e,t){return YE(e.index,e.exaggeration,(e.near[0]+t*e.dx)/e.worldSize,(e.near[1]+t*e.dy)/e.worldSize)}function rD(e,t){return JE(tD(e,t),e.near[2]+t*e.dz)}function iD(){_s("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function nD(e){if(e.useSlerp)if(e.k<1){let t=As(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=As(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),i=new Float64Array(4);!function(e,t,r,i){var n,a,o,s,l=t[0],u=t[1],c=t[2],h=t[3],d=r[0],p=r[1],f=r[2],m=r[3],g=l*d+u*p+c*f+h*m;g<0&&(g=-g,d=-d,p=-p,f=-f,m=-m),1-g>1e-6?(n=Math.acos(g),a=Math.sin(n),o=Math.sin((1-i)*n)/a,s=Math.sin(i*n)/a):(o=1-i,s=i),e[0]=o*l+s*d,e[1]=o*u+s*p,e[2]=o*c+s*f,e[3]=o*h+s*m}(i,t,r,e.k);let n=function(e){let t=new Float64Array(9);!function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r+r,s=i+i,l=n+n,u=r*o,c=i*o,h=i*s,d=n*o,p=n*s,f=n*l,m=a*o,g=a*s,y=a*l;e[0]=1-h-f,e[3]=c-y,e[6]=d+g,e[1]=c+y,e[4]=1-u-f,e[7]=p-m,e[2]=d-g,e[5]=p+m,e[8]=1-u-h}(t,e);let r,i,n=Ps(-Math.asin(ns(t[2],-1,1)));return Math.hypot(t[5],t[8])<.001?(r=0,i=-Ps(Math.atan2(t[3],t[4]))):(r=Ps(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),i=Ps(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:r,pitch:n+90,bearing:i}}(i);e.tr.setRoll(n.roll),e.tr.setPitch(n.pitch),e.tr.setBearing(n.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(_u.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(_u.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(_u.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function aD(e,t,r,i,n){let a=n.padding,o=Iy(n.worldSize,r.getNorthWest()),s=Iy(n.worldSize,r.getNorthEast()),l=Iy(n.worldSize,r.getSouthEast()),u=Iy(n.worldSize,r.getSouthWest()),c=Ts(-i),h=o.rotate(c),d=s.rotate(c),p=l.rotate(c),f=u.rotate(c),m=new $a(Math.max(h.x,d.x,f.x,p.x),Math.max(h.y,d.y,f.y,p.y)),g=new $a(Math.min(h.x,d.x,f.x,p.x),Math.min(h.y,d.y,f.y,p.y)),y=m.sub(g),_=n.width-(a.left+a.right+t.left+t.right),v=n.height-(a.top+a.bottom+t.top+t.bottom),b=_/y.x,x=v/y.y;if(x<0||b<0)return void iD();let w=Math.min(hs(n.scale*Math.min(b,x)),e.maxZoom),S=$a.convert(e.offset),T=new $a((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(Ts(i)),P=S.add(T).mult(n.scale/cs(w));return{center:Cy(n.worldSize,o.add(l).div(2).sub(P)),zoom:w,bearing:i}}var oD=class{get useGlobeControls(){return!1}handlePanInertia(e,t){let r=e.mag(),i=Math.abs(ky(t));return{easingOffset:e.mult(Math.min(.75*i/r,1)),easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,r){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(r,e.around,e.aroundElevation)}cameraForBoxAndBearing(e,t,r,i,n){return aD(e,t,r,i,n)}handleJumpToCenterZoom(e,t){let r=void 0===t.zoom?e.zoom:+t.zoom;e.zoom!==r&&e.setZoom(+t.zoom),void 0!==t.center&&e.setCenter(_y.convert(t.center))}handleEaseTo(e,t){let r=e.zoom,i=e.padding,n={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a={roll:void 0===t.roll?e.roll:t.roll,pitch:void 0===t.pitch?e.pitch:t.pitch,bearing:void 0===t.bearing?e.bearing:t.bearing},o=void 0!==t.zoom,s=!e.isPaddingEqual(t.padding),l=!1,u=o?+t.zoom:e.zoom,c=e.centerPoint.add(t.offsetAsPoint),h=e.screenPointToLocation(c),{center:d,zoom:p}=e.applyConstrain(_y.convert(t.center||h),u??r);VE(e,d);let f=Iy(e.worldSize,h),m=Iy(e.worldSize,d).sub(f),g=cs(p-r);return l=p!==r,{easeFunc:o=>{if(l&&e.setZoom(_u.number(r,p,o)),Es(n,a)||nD({startEulerAngles:n,endEulerAngles:a,tr:e,k:o,useSlerp:n.roll!=a.roll}),s&&(e.interpolatePadding(i,t.padding,o),c=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let t=cs(e.zoom-r),i=(p>r?Math.min(2,g):Math.max(.5,g))**(1-o),n=Cy(e.worldSize,f.add(m.mult(o*i)).mult(t));e.setLocationAtPoint(e.renderWorldCopies?n.wrap():n,c)}},isZooming:l,elevationCenter:d}}handleFlyTo(e,t){let r=void 0!==t.zoom,i=e.zoom,n=e.applyConstrain(_y.convert(t.center||t.locationAtOffset),r?+t.zoom:i),a=n.center,o=n.zoom;VE(e,a);let s=e.worldSize,l=Iy(s,t.locationAtOffset),u=Iy(s,a).sub(l),c=u.mag(),h=cs(o-i),d=void 0===t.minZoom?e.minZoom:+t.minZoom,p=Math.max(d,e.minZoom),f=Math.min(p,i,o),m=e.applyConstrain(a,f).zoom;return{easeFunc:(t,r,n,c)=>{e.setZoom(1===t?o:i+hs(r));let h=1===t?a:Cy(s,l.add(u.mult(n)));e.setLocationAtPoint(e.renderWorldCopies?h.wrap():h,c)},scaleOfZoom:h,targetCenter:a,scaleOfMinZoom:cs(m-i),pixelPathLength:c}}};let sD;const lD=new Gg({fill:new $g(128,2),line:new $g(512,0),tile:new $g(128,32),stencil:new $g(128,1),circle:3});var uD=class{constructor(){this._tileMeshCache={}}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return zE.projectionGlobe}get vertexShaderPreludeCode(){return zE.projectionMercator.vertexSource}get subdivisionGranularity(){return lD}get useGlobeControls(){return!0}destroy(){}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,r,i,n){let a=("stencil"===n?lD.stencil:lD.tile).getGranularityForZoomLevel(t.z),o=0===t.y&&i,s=t.y===(1<<t.z)-1&&i;return this._getMesh(e,{granularity:a,generateBorders:r,extendToNorthPole:o,extendToSouthPole:s})}_getMesh(e,t){let r=this._getMeshKey(t);if(r in this._tileMeshCache)return this._tileMeshCache[r];let i=rP(e,t);return this._tileMeshCache[r]=i,i}recalculate(e){}hasTransition(){return!1}},cD=class extends Js{constructor(e,t){super(),this._transitionable=new $d(sD||=new rp({type:new Yd(el.projection.type,"type")}),"projection",t),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Nd(0)),this._mercatorProjection=new NE,this._verticalPerspectiveProjection=new uD}get transitionState(){let e=this.properties.get("type");if("string"==typeof e&&"mercator"===e)return 0;if("string"==typeof e&&"vertical-perspective"===e)return 1;if(e instanceof au){if(e.from===e.to)return"mercator"===e.from?0:1;if("vertical-perspective"===e.from&&"mercator"===e.to)return 1-e.transition;if("mercator"===e.from&&"vertical-perspective"===e.to)return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(e,t,r,i,n){return this.currentProjection.getMeshFromTileID(e,t,r,i,n)}setProjection(e){this._transitionable.setValue("type",e?.type||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}};function hD(e){let t=fD(e.worldSize,e.center.lat);return 2*Math.PI*t}function dD(e,t,r,i,n){let a=1/(1<<n),o=t/8192*a+i*a,s=Jo((e/8192*a+r*a)*Math.PI*2+Math.PI,2*Math.PI),l=2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-.5*Math.PI,u=Math.cos(l),c=new Float64Array(3);return c[0]=Math.sin(s)*u,c[1]=Math.sin(l),c[2]=Math.cos(s)*u,c}function pD(e){return function(e,t){let r=Math.cos(t),i=new Float64Array(3);return i[0]=Math.sin(e)*r,i[1]=Math.sin(t),i[2]=Math.cos(e)*r,i}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function fD(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function mD(e){let t=Eo(No(),[0,0,0,1],e.modelViewProjectionMatrix);return Eo(t,t,e.inverseProjectionMatrix),[t[0]/t[3],t[1]/t[3],t[2]/t[3]]}function gD(e){let t=Math.asin(e[1])/Math.PI*180,r=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(r>1e-6){let i=e[0]/r,n=e[2]/r,a=Math.acos(n),o=(i>0?a:-a)/Math.PI*180;return new _y(as(o,-180,180),t)}return new _y(0,t)}const yD=.98*Math.PI;function _D(e,t){let r=e.cameraPosition,i=co(r);if(i<=1)return e.screenPointToLocation(t);let n=Uo();yo(n,r);let a=e.getRayDirectionFromPixel(t),o=-_o(a,n),s=Uo();go(s,a,n,o);let l=co(s);if(l<1e-9)return e.screenPointToLocation(t);let u=Math.atan2(l,o),c=.9*Math.asin(1/i);if(u<c)return e.screenPointToLocation(t);let h=i*Math.sin(c),d=Math.asin(ns(h,-1,1))-c,p=i*Math.cos(c)/Math.sqrt(Math.max(1-h*h,1e-12))-1,f=yD-d,m=u-c,g=d+p*m*f/(f+p*m),y=Uo();mo(y,s,1/l);let _=Uo();return mo(_,n,Math.cos(ns(g,0,yD))),go(_,_,y,Math.sin(ns(g,0,yD))),yo(_,_),gD(_)}function vD(e){return Math.cos(e*Math.PI/180)}function bD(e,t){let r=vD(e);return hs(vD(t)/r)}function xD(e){let t=.5*e,r=Math.sin(t),i=Math.cos(t);return Math.log(r+i)-Math.log(i-r)}function wD(e,t,r,i){let n=e.lat+r*i;if(Math.abs(r)>1){let a=e.lat+r,o=(Math.sign(a)===Math.sign(e.lat)?Math.abs(e.lat):-Math.abs(e.lat))*Math.PI/180,s=Math.abs(e.lat+r)*Math.PI/180,l=xD(o+i*(s-o)),u=xD(o),c=(l-u)/(xD(s)-u),h=e.lng+t*c;return new _y(h,n)}{let r=e.lng+t*i;return new _y(r,n)}}function SD(e,t,r=1){let i=_o(e,t),n=r*r,a=Uo(),o=Uo();mo(o,t,i),To(a,e,o);let s=n-_o(a,a);if(s<0)return null;let l=_o(e,e)-n,u=-i+(i<0?1:-1)*Math.sqrt(s),c=l/u,h=u;return{tMin:Math.min(c,h),tMax:Math.max(c,h)}}var TD=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,r,i){let n=`${e.z}_${e.x}_${e.y}_${i?.terrain?"t":""}_${Math.round(r)}`,a=this._cache.get(n);if(a)return a;let o=this._cachePrevious.get(n);if(o)return this._cache.set(n,o),o;let s=this._boundingVolumeFactory(e,t,r,i);return this._cache.set(n,s),this._hadAnyChanges=!0,s}},PD=class e{constructor(e,t,r,i){this.min=r,this.max=i,this.points=e,this.planes=t}static fromAabb(t,r){let i=[];for(let e=0;e<8;e++)i.push([1&~e?t[0]:r[0],1==(e>>1&1)?r[1]:t[1],1==(e>>2&1)?r[2]:t[2]]);return new e(i,[[-1,0,0,r[0]],[1,0,0,-t[0]],[0,-1,0,r[1]],[0,1,0,-t[1]],[0,0,-1,r[2]],[0,0,1,-t[2]]],t,r)}static fromCenterSizeAngles(t,r,i){let n=Io([],i[0],i[1],i[2]),a=bo([],[r[0],0,0],n),o=bo([],[0,r[1],0],n),s=bo([],[0,0,r[2]],n),l=[...t],u=[...t];for(let e=0;e<8;e++)for(let r=0;r<3;r++){let i=t[r]+a[r]*(1&~e?-1:1)+o[r]*(1==(e>>1&1)?1:-1)+s[r]*(1==(e>>2&1)?1:-1);l[r]=Math.min(l[r],i),u[r]=Math.max(u[r],i)}let c=[];for(let e=0;e<8;e++){let r=[...t];po(r,r,mo([],a,1&~e?-1:1)),po(r,r,mo([],o,1==(e>>1&1)?1:-1)),po(r,r,mo([],s,1==(e>>2&1)?1:-1)),c.push(r)}return new e(c,[[...a,-_o(a,c[0])],[...o,-_o(o,c[0])],[...s,-_o(s,c[0])],[-a[0],-a[1],-a[2],-_o(a,c[7])],[-o[0],-o[1],-o[2],-_o(o,c[7])],[-s[0],-s[1],-s[2],-_o(s,c[7])]],l,u)}intersectsFrustum(e){let t=!0,r=this.points.length,i=this.planes.length,n=e.planes.length,a=e.points.length;for(let i=0;i<n;i++){let n=e.planes[i],a=0;for(let e=0;e<r;e++){let t=this.points[e];n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]>=0&&a++}if(0===a)return 0;a<r&&(t=!1)}if(t)return 2;for(let t=0;t<i;t++){let r=this.planes[t],i=0;for(let t=0;t<a;t++){let n=e.points[t];r[0]*n[0]+r[1]*n[1]+r[2]*n[2]+r[3]>=0&&i++}if(0===i)return 0}return 1}intersectsPlane(e){let t=this.points.length,r=0;for(let i=0;i<t;i++){let t=this.points[i];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&r++}return r===t?2:0===r?0:1}};function ED(e,t,r){let i=e-t;return i<0?-i:Math.max(0,i-r)}function DD(e,t,r,i,n){let a,o=e-r;return a=o<0?Math.min(-o,1+o-n):o>n?Math.min(Math.max(o-n,0),1-o):0,Math.max(a,ED(t,i,n))}var AD=class{constructor(){this._boundingVolumeCache=new TD(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,r,i){let n=1<<r.z,a=1/n,o=r.x/n,s=r.y/n,l=2;return l=Math.min(l,DD(e,t,o,s,a)),l=Math.min(l,DD(e,t,o+.5,-s-a,a)),l=Math.min(l,DD(e,t,o+.5,2-s-a,a)),l}getWrap(e,t,r){let i=1<<t.z,n=1/i,a=t.x/i,o=ED(e.x,a,n),s=ED(e.x,a-1,n),l=ED(e.x,a+1,n),u=Math.min(o,s,l);return u===l?1:u===s?-1:0}allowVariableZoom(e,t){return xP(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,r,i){return this._boundingVolumeCache.getTileBoundingVolume(e,t,r,i)}_computeTileBoundingVolume(e,t,r,i){let n=Math.min(0,r),a=Math.max(0,r);if(i?.terrain){let r=new Bb(e.z,t,e.z,e.x,e.y),o=i.terrain.getMinMaxElevation(r);n=o.minElevation??n,a=Math.max(o.maxElevation??a,a)}if(n/=yy,a/=yy,n+=1,a+=1,e.z<=0)return PD.fromAabb([-a,-a,-a],[a,a,a]);if(1===e.z)return PD.fromAabb([0===e.x?-a:0,0===e.y?0:-a,-a],[0===e.x?0:a,0===e.y?a:0,a]);{let t=[dD(0,0,e.x,e.y,e.z),dD(8192,0,e.x,e.y,e.z),dD(8192,8192,e.x,e.y,e.z),dD(0,8192,e.x,e.y,e.z)],r=[];for(let e of t)r.push(mo([],e,a));if(a!==n)for(let e of t)r.push(mo([],e,n));0===e.y&&r.push([0,1,0]),e.y===(1<<e.z)-1&&r.push([0,-1,0]);let i=[1,1,1],o=[-1,-1,-1];for(let e of r)for(let t=0;t<3;t++)i[t]=Math.min(i[t],e[t]),o[t]=Math.max(o[t],e[t]);let s=dD(4096,4096,e.x,e.y,e.z),l=vo([],[0,1,0],s);yo(l,l);let u=vo([],s,l);yo(u,u);let c=vo([],t[2],t[1]);yo(c,c);let h=vo([],t[0],t[3]);yo(h,h),r.push(mo([],s,a)),e.y>=(1<<e.z)/2&&r.push(mo([],dD(4096,0,e.x,e.y,e.z),a)),e.y<(1<<e.z)/2&&r.push(mo([],dD(4096,8192,e.x,e.y,e.z),a));let d=ID(s,r),p=ID(u,r),f=[-s[0],-s[1],-s[2],d.max],m=[s[0],s[1],s[2],-d.min],g=[-u[0],-u[1],-u[2],p.max],y=[u[0],u[1],u[2],-p.min],_=[...c,0],v=[...h,0],b=[];return 0===e.y?b.push(Wo(v,_,f),Wo(v,_,m)):b.push(Wo(g,_,f),Wo(g,_,m),Wo(g,v,f),Wo(g,v,m)),e.y===(1<<e.z)-1?b.push(Wo(v,_,f),Wo(v,_,m)):b.push(Wo(y,_,f),Wo(y,_,m),Wo(y,v,f),Wo(y,v,m)),new PD(b,[f,m,g,y,_,v],i,o)}}};function ID(e,t){let r=1/0,i=-1/0;for(let n of t){let t=_o(e,n);r=Math.min(r,t),i=Math.max(i,t)}return{min:r,max:i}}var CD=class e{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,r){this._helper.interpolatePadding(e,t,r)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=No(),this._projectionMatrix=$o(),this._globeViewProjMatrix32f=Go(),this._globeViewProjMatrixF64=$o(),this._globeViewProjMatrixF64Inverted=$o(),this._globeProjMatrixInverted=$o(),this._cameraPosition=Uo(),this.defaultConstrain=(e,t)=>{let r=ns(e.lat,-85.051129,Is),i=ns(+t,this.minZoom+bD(0,r),this.maxZoom);return{center:new _y(e.lng,r),zoom:i}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new GE({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new AD}clone(){let t=new e;return t.apply(this,!1),t}apply(e,t){this._helper.apply(e,t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=Uo();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){let{overscaledTileID:t,applyGlobeMatrix:r}=e,i=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:i,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!r,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:0===t?.canonical.z}}_computeClippingPlane(e){let t=this.pitchInRadians,r=this.cameraToCenterDistance/e,i=Math.sin(t)*r,n=Math.cos(t)*r+1,a=1/Math.sqrt(i*i+n*n)*1,o=-i,s=n,l=Math.sqrt(o*o+s*s);o/=l,s/=l;let u=[0,o,s];So(u,u,[0,0,0],-this.bearingInRadians),xo(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),wo(u,u,[0,0,0],this.center.lng*Math.PI/180);let c=1/co(u);return mo(u,u,c),[...u,-a*c]}isLocationOccluded(e){return!this.isSurfacePointVisible(pD(e))}transformLightDirection(e){let t=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,i=Math.cos(r),n=[Math.sin(t)*i,Math.sin(r),Math.cos(t)*i],a=[n[2],0,-n[0]],o=[0,0,0];vo(o,a,n),yo(a,a),yo(o,o);let s=[0,0,0];return yo(s,[a[0]*e[0]+o[0]*e[1]+n[0]*e[2],a[1]*e[0]+o[1]*e[1]+n[1]*e[2],a[2]*e[0]+o[2]*e[1]+n[2]*e[2]]),s}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,t,r){let i=Ay(e,t,r.canonical),n=function(e,t){return[Jo(e*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-.5*Math.PI]}(i.x,i.y);return this.getCircleRadiusCorrection()/Math.cos(n[1])}projectTileCoordinates(e,t,r,i){let n,a=r.canonical,o=dD(e,t,a.x,a.y,a.z),s=1+(i??0)/yy,l=o[0]*s,u=o[1]*s,c=o[2]*s,h=[l,u,c,1];if(Eo(h,h,this._globeViewProjMatrixF64),s<=1){let e=this._cachedClippingPlane;n=e[0]*o[0]+e[1]*o[1]+e[2]*o[2]+e[3]<0}else n=this._isLineOfSightBlocked(l,u,c);return{point:new $a(h[0]/h[3],h[1]/h[3]),signedDistanceFromCamera:h[3],isOccluded:n}}_isLineOfSightBlocked(e,t,r){let i=this._cameraPosition,n=e-i[0],a=t-i[1],o=r-i[2],s=n*n+a*a+o*o;if(0===s)return!1;let l=ns(-(i[0]*n+i[1]*a+i[2]*o)/s,0,1),u=i[0]+l*n,c=i[1]+l*a,h=i[2]+l*o;return u*u+c*c+h*h<1}_calcMatrices(){let e=fD(this.worldSize,this.center.lat),t=Vo();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),oo(t,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let r=this.centerOffset;t[8]=2*-r.x/this._helper._width,t[9]=2*r.y/this._helper._height,this._projectionMatrix=Ya(t),this._globeProjMatrixInverted=Vo(),Qa(this._globeProjMatrixInverted,t),to(t,t,[0,0,-this.cameraToCenterDistance]),ao(t,t,this.rollInRadians),io(t,t,-this.pitchInRadians),ao(t,t,this.bearingInRadians),to(t,t,[0,0,-e]);let i=Uo();i[0]=e,i[1]=e,i[2]=e,io(t,t,this.center.lat*Math.PI/180),no(t,t,-this.center.lng*Math.PI/180),ro(t,t,i),this._globeViewProjMatrixF64=t,this._globeViewProjMatrix32f=new Float32Array(t),this._globeViewProjMatrixF64Inverted=Vo(),Qa(this._globeViewProjMatrixF64Inverted,t);let n=Uo();this._cameraPosition=Uo(),this._cameraPosition[2]=this.cameraToCenterDistance/e,So(this._cameraPosition,this._cameraPosition,n,-this.rollInRadians),xo(this._cameraPosition,this._cameraPosition,n,this.pitchInRadians),So(this._cameraPosition,this._cameraPosition,n,-this.bearingInRadians),po(this._cameraPosition,this._cameraPosition,[0,0,1]),xo(this._cameraPosition,this._cameraPosition,n,-this.center.lat*Math.PI/180),wo(this._cameraPosition,this._cameraPosition,n,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let a=Ya(this._globeViewProjMatrixF64Inverted);ro(a,a,[1,1,-1]),this._cachedFrustum=gP.fromInvProjectionMatrix(a,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){_s("calculateFogMatrix is not supported on globe projection.");let t=Vo();return Ja(t),t}getVisibleUnwrappedCoordinates(e){return[new Ob(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e?_s("terrain is not fully supported on vertical perspective projection."):this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return(co(this._cameraPosition)-1)*yy}getCameraLngLat(){let e=Uo();return yo(e,this._cameraPosition),gD(e)}lngLatToCameraDepth(e,t){let r=pD(e);mo(r,r,1+t/yy);let i=No();return Eo(i,[r[0],r[1],r[2],1],this._globeViewProjMatrixF64),i[2]/i[3]}populateCache(e){}getBounds(){let e=.5*this.width,t=.5*this.height,r=[new $a(0,0),new $a(e,0),new $a(this.width,0),new $a(this.width,t),new $a(this.width,this.height),new $a(e,this.height),new $a(0,this.height),new $a(0,t)],i=[];for(let e of r)i.push(this.unprojectScreenPoint(e));let n=0,a=0,o=0,s=0,l=this.center;for(let e of i){let t=Ko(l.lng,e.lng),r=Ko(l.lat,e.lat);t<a&&(a=t),t>n&&(n=t),r<s&&(s=r),r>o&&(o=r)}let u=[l.lng+a,l.lat+s,l.lng+n,l.lat+o];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new zT(u)}calculateCenterFromCameraLngLatAlt(e,t,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,r,i)}calculateCameraOptionsFromTo(e,t,r,i){let n=_y.convert(r),a=pD(_y.convert(e));mo(a,a,1+t/yy);let o=pD(n),s=mo(Uo(),o,1+i/yy),l=fo(Uo(),a,o),u=co(l);if(u<1e-12||function(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(r*r+i*i+n*n)}(a,s)<1e-12)throw Error("Can't calculate camera options with same From and To");let c=Uo();wo(l,l,c,-Ts(n.lng)),xo(l,l,c,Ts(n.lat));let h=Ps(Math.acos(ns(l[2]/u,-1,1))),d=Math.hypot(l[0],l[1])<1e-9*u?this.bearing:Ps(Math.atan2(-l[0],-l[1]));return{center:n,elevation:i,zoom:hs(this.cameraToCenterDistance/u/fD(this.tileSize,n.lat)),pitch:h,bearing:d}}setLocationAtPoint(e,t,r){let i=pD(this.unprojectScreenPoint(t)),n=pD(e),a=Uo();!function(e){e[0]=0,e[1]=0,e[2]=0}(a);let o=Uo();wo(o,i,a,-this.center.lng*Math.PI/180),xo(o,o,a,this.center.lat*Math.PI/180);let s=n[0]*n[0]+n[2]*n[2],l=o[0]*o[0];if(s<l)return;let u=Math.sqrt(s-l),c=-u,h=Xo(n[0],n[2],o[0],u),d=Xo(n[0],n[2],o[0],c),p=Uo();wo(p,n,a,-h);let f=Xo(p[1],p[2],o[1],o[2]),m=Uo();wo(m,n,a,-d);let g,y,_=Xo(m[1],m[2],o[1],o[2]),v=.5*Math.PI,b=f>=-v&&f<=v,x=_>=-v&&_<=v;if(b&&x){let e=this.center.lng*Math.PI/180,t=this.center.lat*Math.PI/180;Yo(h,e)+Yo(f,t)<Yo(d,e)+Yo(_,t)?(g=h,y=f):(g=d,y=_)}else if(b)g=h,y=f;else{if(!x)return;g=d,y=_}let w=g/Math.PI*180,S=y/Math.PI*180,T=this.center.lat;this.setCenter(new _y(w,ns(S,-90,90))),this.setZoom(this.zoom+bD(T,this.center.lat))}locationToScreenPoint(e,t){let r=pD(e);return t&&mo(r,r,1+t.getElevationForLngLatZoom(e,this._helper._tileZoom)/yy),this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(e){let t=No();return Eo(t,[...e,1],this._globeViewProjMatrixF64),t[0]/=t[3],t[1]/=t[3],new $a((.5*t[0]+.5)*this.width,(.5*-t[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,t){if(t){let r=this.screenTerrainPointToMercatorCoordinate(e,t);if(r)return r}return Dy.fromLngLat(this.unprojectScreenPoint(e))}screenTerrainPointToMercatorCoordinate(e,t){let r=t.getCoverageIndex();if(!r)return null;let i=this.cameraPosition,n=this.getRayDirectionFromPixel(e),a=SD(i,n,1+r.maxElevation/yy);if(!a)return null;let o=SD(i,n,1+r.minElevation/yy),s=Math.max(a.tMin,0),l=o?o.tMin:a.tMax;if(l<=s)return null;let u={index:r,exaggeration:t.exaggeration,origin:i,direction:n},c=0;for(let e=0;e<=256;e++){let t=s+(l-s)*e/256;if(MD(u,t)){let{hi:e}=QE(u,MD,c,t,1e-12),{sample:r,mercator:i}=kD(u,e);return new Dy(i.x,i.y,r.elevation)}c=t}return null}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}screenPointToLocationAtElevation(e,t){return this.screenPointToLocation(e)}isPointOnMapSurface(e,t){return!!SD(this._cameraPosition,this.getRayDirectionFromPixel(e))}getRayDirectionFromPixel(e){let t=No();t[0]=e.x/this.width*2-1,t[1]=-1*(e.y/this.height*2-1),t[2]=1,t[3]=1,Eo(t,t,this._globeViewProjMatrixF64Inverted),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3];let r=Uo();r[0]=t[0]-this._cameraPosition[0],r[1]=t[1]-this._cameraPosition[1],r[2]=t[2]-this._cameraPosition[2];let i=Uo();return yo(i,r),i}isSurfacePointVisible(e){let t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;let t=No();return Eo(t,[...e,1],this._globeViewProjMatrixF64),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3],t[0]>-1&&t[0]<1&&t[1]>-1&&t[1]<1&&t[2]>-1&&t[2]<1}unprojectScreenPoint(e){let t=this._cameraPosition,r=this.getRayDirectionFromPixel(e),i=SD(t,r);if(i){let e=Uo();po(e,t,[r[0]*i.tMin,r[1]*i.tMin,r[2]*i.tMin]);let n=Uo();return yo(n,e),gD(n)}let n=this._cachedClippingPlane,a=n[0]*r[0]+n[1]*r[1]+n[2]*r[2],o=-Zo(n,t)/a,s=Uo();if(o>0)po(s,t,[r[0]*o,r[1]*o,r[2]*o]);else{let e=Uo();po(e,t,[2*r[0],2*r[1],2*r[2]]);let i=Zo(this._cachedClippingPlane,e);To(s,e,[this._cachedClippingPlane[0]*i,this._cachedClippingPlane[1]*i,this._cachedClippingPlane[2]*i])}let l=function(e){let t=Uo();return t[0]=e[0]*-e[3],t[1]=e[1]*-e[3],t[2]=e[2]*-e[3],{center:t,radius:Math.sqrt(1-e[3]*e[3])}}(n);return gD(function(e,t,r){let i=Uo();To(i,r,e);let n=Uo();return go(n,e,i,t/Po(i)),n}(l.center,l.radius,s))}getProjectionDataForCustomLayer(e=!0){let t=this.getProjectionData({overscaledTileID:new Bb(0,0,0,0,0),applyGlobeMatrix:e});return t.tileMercatorCoords=[0,0,1,1],t}getFastPathSimpleProjectionMatrix(e){}};function kD(e,t){let r=Uo();go(r,e.origin,e.direction,t);let i=co(r),n=Uo();mo(n,r,1/i);let a=gD(n),o=Dy.fromLngLat(a),s=new Dy(o.x,ns(o.y,0,.999999999)),l=YE(e.index,e.exaggeration,s.x,s.y),u=Math.abs(a.lat)>85.051129?0:l.elevation;return{sample:{...l,elevation:u},radius:i,mercator:s}}function MD(e,t){let{sample:r,radius:i}=kD(e,t);return JE(r,(i-1)*yy)}var FD=class e{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,r){this._helper.interpolatePadding(e,t,r)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,r=!0){this._helper.resize(e,t,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e){this._globeness=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new GE({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new eD,this._verticalPerspectiveTransform=new CD}clone(){let t=new e;return t._globeness=this._globeness,t.apply(this,!1),t}apply(e,t){this._helper.apply(e,t),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){let t=this._mercatorTransform.getProjectionData(e),r=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?r.mainMatrix:t.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix,clipAntimeridian:r.clipAntimeridian}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return es(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return es(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,t,r){return es(this._mercatorTransform.getPitchedTextCorrection(e,t,r),this._verticalPerspectiveTransform.getPitchedTextCorrection(e,t,r),this._globeness)}projectTileCoordinates(e,t,r,i){return this.currentTransform.projectTileCoordinates(e,t,r,i)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this.currentTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,t,r,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,r,i)}calculateCameraOptionsFromTo(e,t,r,i){return this.currentTransform.calculateCameraOptionsFromTo(e,t,r,i)}setLocationAtPoint(e,t,r){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t,r),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(e,t,r),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenTerrainPointToMercatorCoordinate(e,t){return this.currentTransform.screenTerrainPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}screenPointToLocationAtElevation(e,t){return this.currentTransform.screenPointToLocationAtElevation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getProjectionDataForCustomLayer(e=!0){let t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;let r=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return r.fallbackMatrix=t.mainMatrix,r.projectionTransition=this._globeness,r}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}},RD=class e{get useGlobeControls(){return!0}handlePanInertia(e,t){let r=function(e,t){let r=e.rotate(t.bearingInRadians),i=t.zoom+bD(t.center.lat,0),n=es(1/vD(t.center.lat),1/vD(Math.min(Math.abs(t.center.lat),60)),Qo(i,7,3,0,1)),a=function(e,t){return 360/hD({worldSize:e,center:{lat:t}})}(t.worldSize,t.center.lat);return new _y(t.center.lng-r.x*a*n,ns(t.center.lat+r.y*a,-85.051129,Is))}(e,t);return Math.abs(r.lng-t.center.lng)>180&&(r.lng=t.center.lng+179.5*Math.sign(r.lng-t.center.lng)),{easingCenter:r,easingOffset:new $a(0,0)}}handleMapControlsRollPitchBearingZoom(e,t){let r=e.around,i=t.screenPointToLocation(r);e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta);let n=t.zoom;e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta);let a=t.zoom-n;if(0===a)return;let o=Ko(t.center.lng,i.lng),s=o/(Math.abs(o/180)+1),l=Ko(t.center.lat,i.lat),u=t.getRayDirectionFromPixel(r),c=t.cameraPosition,h=-1*_o(c,u),d=Uo();po(d,c,[u[0]*h,u[1]*h,u[2]*h]);let p=co(d),f=p-1,m=Math.exp(.5*-Math.max(f-.3,0)),g=Qo(p,.95,.999,0,1),y=Qo(fD(t.worldSize,t.center.lat)/Math.min(t.width,t.height),.9,.5,1,.25),_=Math.min(m,es(1,y,g)),v=(1-cs(-a))*_,b=t.center.lat,x=t.zoom,w=new _y(t.center.lng+s*v,ns(t.center.lat+l*v,-85.051129,Is));t.setLocationAtPoint(i,r);let S=t.center,T=Qo(Math.abs(o),45,85,0,1),P=Math.max(T,g)**.25,E=Ko(S.lng,w.lng),D=Ko(S.lat,w.lat);t.setCenter(new _y(S.lng+E*P,S.lat+D*P).wrap()),t.setZoom(x+bD(b,t.center.lat))}handleMapControlsPan(e,t,r){e.panDelta&&function(e,t,r,i,n=!0){let a=_D(e,r),o=t;if(i)o=_D(e,r.sub(i));else if(!e.isPointOnMapSurface(r))return;let s=pD(a),l=pD(o),u=function(e,t){return Io(No(),-e.lng,-e.lat,t)}(e.center,e.bearing),c=vo(Uo(),l,s),h=Math.sqrt(_o(c,c)),d=Math.acos(ns(_o(l,s),-1,1))/2,p=Math.sin(d),f=h?Co(c[1]/h*p,-c[0]/h*p,c[2]/h*p,Math.cos(d)):Co(0,0,0,1),{lng:m,lat:g,bearing:y}=function(e){let t=e[0],r=e[1],i=e[2],n=e[3];return{lng:180*-Math.atan2(2*(n*t+r*i),1-2*(t*t+r*r))/Math.PI,lat:180*-Math.asin(ns(2*(n*r-i*t),-1,1))/Math.PI,bearing:180*Math.atan2(2*(n*i+t*r),1-2*(r*r+i*i))/Math.PI}}(function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1],u=r[2],c=r[3];return e[0]=i*c+o*s+n*u-a*l,e[1]=n*c+o*l+a*s-i*u,e[2]=a*c+o*u+i*l-n*s,e[3]=o*c-i*s-n*l-a*u,e}(No(),u,f)),_=e.center.lat,v=e.zoom,b=ns(g,-90,90),x=n?function(e,t,r,i){let n=e.center.lng,a=e.center.lat,o=a>=0?90:-90,s=e.locationToScreenPoint(new _y(0,o)),l=t.x-s.x,u=t.y-s.y,c=l*l+u*u,h=ns(1-(Is-Math.abs(a))/12,0,1),d=h*h*(3-2*h),p=Jo(i-n+180,360)-180,f=0;return d>0&&r&&(f=(o>0?1:-1)*((l*r.y-u*r.x)/Math.max(c,400))*180/Math.PI),n+(1-d)*p+d*f}(e,r,i,m):m;e.setCenter(new _y(as(x,-180,180),b)),n||e.setBearing(y),e.setZoom(v+bD(_,e.center.lat))}(t,r,t.isPointOnMapSurface(e.around)?e.around:t.centerPoint,e.panDelta)}cameraForBoxAndBearing(t,r,i,n,a){let o=aD(t,r,i,n,a),s=r.left/a.width*2-1,l=(a.width-r.right)/a.width*2-1,u=r.top/a.height*-2+1,c=(a.height-r.bottom)/a.height*-2+1,h=Ko(i.getWest(),i.getEast())<0,d=h?i.getEast():i.getWest(),p=h?i.getWest():i.getEast(),f=Math.max(i.getNorth(),i.getSouth()),m=Math.min(i.getNorth(),i.getSouth()),g=d+.5*Ko(d,p),y=f+.5*Ko(f,m),_=a.clone();_.setCenter(o.center),_.setBearing(o.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(o.zoom);let v=_.modelViewProjectionMatrix,b=[pD(i.getNorthWest()),pD(i.getNorthEast()),pD(i.getSouthWest()),pD(i.getSouthEast()),pD(new _y(p,y)),pD(new _y(d,y)),pD(new _y(g,f)),pD(new _y(g,m))],x=pD(o.center),w=1/0;for(let t of b)s<0&&(w=e.getLesserNonNegativeNonNull(w,e.solveVectorScale(t,x,v,"x",s))),l>0&&(w=e.getLesserNonNegativeNonNull(w,e.solveVectorScale(t,x,v,"x",l))),u>0&&(w=e.getLesserNonNegativeNonNull(w,e.solveVectorScale(t,x,v,"y",u))),c<0&&(w=e.getLesserNonNegativeNonNull(w,e.solveVectorScale(t,x,v,"y",c)));if(Number.isFinite(w)&&0!==w)return o.zoom=Math.min(_.zoom+hs(w),t.maxZoom),o;iD()}handleJumpToCenterZoom(e,t){let r=e.center.lat,i=e.applyConstrain(t.center?_y.convert(t.center):e.center,e.zoom).center;e.setCenter(i.wrap());let n=void 0===t.zoom?e.zoom+bD(r,i.lat):+t.zoom;e.zoom!==n&&e.setZoom(n)}handleEaseTo(e,t){let r=e.zoom,i=e.center,n=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},o={roll:void 0===t.roll?e.roll:t.roll,pitch:void 0===t.pitch?e.pitch:t.pitch,bearing:void 0===t.bearing?e.bearing:t.bearing},s=void 0!==t.zoom,l=!e.isPaddingEqual(t.padding),u=!1,c=t.center?_y.convert(t.center):i,h=e.applyConstrain(c,r).center;VE(e,h);let d=e.clone();d.setCenter(h),d.setZoom(s?+t.zoom:r+bD(i.lat,c.lat)),d.setBearing(t.bearing);let p=new $a(ns(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),ns(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));d.setLocationAtPoint(h,p);let f=(t.offset&&t.offsetAsPoint.mag())>0?d.center:h,m=s?+t.zoom:r+bD(i.lat,f.lat),g=r+bD(i.lat,0),y=m+bD(f.lat,0),_=Ko(i.lng,f.lng),v=Ko(i.lat,f.lat),b=cs(y-g);return u=m!==r,{easeFunc:r=>{if(Es(a,o)||nD({startEulerAngles:a,endEulerAngles:o,tr:e,k:r,useSlerp:a.roll!=o.roll}),l&&e.interpolatePadding(n,t.padding,r),t.around)_s("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(t.around,t.aroundPoint);else{let t=r*(y>g?Math.min(2,b):Math.max(.5,b))**(1-r),n=wD(i,_,v,t);e.setCenter(n.wrap())}if(u){let t=_u.number(g,y,r)+bD(0,e.center.lat);e.setZoom(t)}},isZooming:u,elevationCenter:f}}handleFlyTo(e,t){let r=void 0!==t.zoom,i=e.center,n=e.zoom,a=e.padding,o=!e.isPaddingEqual(t.padding),s=e.applyConstrain(_y.convert(t.center||t.locationAtOffset),n).center,l=r?+t.zoom:e.zoom+bD(e.center.lat,s.lat),u=e.clone();u.setCenter(s),u.setZoom(l),u.setBearing(t.bearing);let c=new $a(ns(e.centerPoint.x+t.offsetAsPoint.x,0,e.width),ns(e.centerPoint.y+t.offsetAsPoint.y,0,e.height));u.setLocationAtPoint(s,c);let h=u.center;VE(e,h);let d=function(e,t,r){let i=_o(pD(t),pD(r)),n=Math.acos(i),a=hD(e);return n/(2*Math.PI)*a}(e,i,h),p=n+bD(i.lat,0),f=l+bD(h.lat,0),m=cs(f-p),g="number"==typeof t.minZoom?+t.minZoom:e.minZoom,y=Math.max(g,e.minZoom)+bD(h.lat,0),_=Math.min(y,p,f)+bD(0,h.lat),v=cs(e.applyConstrain(h,_).zoom+bD(h.lat,0)-p),b=Ko(i.lng,h.lng),x=Ko(i.lat,h.lat);return{easeFunc:(r,n,s,u)=>{let c=wD(i,b,x,s);o&&e.interpolatePadding(a,t.padding,r);let d=1===r?h:c;e.setCenter(d.wrap());let f=p+hs(n);e.setZoom(1===r?l:f+bD(0,d.lat))},scaleOfZoom:m,targetCenter:h,scaleOfMinZoom:v,pixelPathLength:d}}static solveVectorScale(e,t,r,i,n){let a=n,o="x"===i?[r[0],r[4],r[8],r[12]]:[r[1],r[5],r[9],r[13]],s=[r[3],r[7],r[11],r[15]],l=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],u=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],c=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],h=t[0]*s[0]+t[1]*s[1]+t[2]*s[2];return c+a*u===l+a*h||s[3]*(l-c)+o[3]*(h-u)+l*h===c*u?null:(c+o[3]-a*h-a*s[3])/(c-l-a*h+a*u)}static getLesserNonNegativeNonNull(e,t){return null!==t&&t>=0&&t<e?t:e}},LD=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new oD,this._verticalPerspectiveCameraHelper=new RD}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,r){this.currentHelper.handleMapControlsPan(e,t,r)}cameraForBoxAndBearing(e,t,r,i,n){return this.currentHelper.cameraForBoxAndBearing(e,t,r,i,n)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};const zD=function(){let e={},t=el.$version;for(let r in el.$root){let i=el.$root[r];if(i.required){let n=null;n="version"===r?t:"array"===i.type?[]:{},null!=n&&(e[r]=n)}}return e}();var OD=class extends Js{constructor(e,t={}){super(),this._rtlPluginLoaded=()=>{for(let e in this.tileManagers){let t=this.tileManagers[e].getSource().type;("vector"===t||"geojson"===t)&&this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new IT(AT(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(e,t)=>this.getGlyphs(e,t)),this.dispatcher.registerMessageHandler("GI",(e,t)=>this.getImages(e,t)),this.dispatcher.registerMessageHandler("GDA",(e,t)=>this.getDashes(e,t)),this.imageManager=new tT,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(e._missingStyleImageResolver),this.patternAtlas=new rT(this.imageManager);let r=e._container?.lang||typeof document<"u"&&document.documentElement?.lang||void 0;this.glyphManager=new yT(e._requestManager,t.localIdeographFontFamily,r),this.lineAtlas=new wT(256,512),this.crossTileSymbolIndex=new RE,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",$s()),hP().on(lP,this._rtlPluginLoaded),this.on("data",e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let t=this.tileManagers[e.sourceId];if(!t)return;let r=t.getSource();if(r?.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===r.id&&this._validateLayer(t)}})}_setInitialValues(){this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new jd,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new(this.crossTileSymbolIndex?.constructor||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,t){this._checkLoaded();let r=null===t?this.stylesheet.state?.[e]?.default??null:t;if(ms(r,this._globalState[e]))return this;this._globalState[e]=r,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let r in e)ms(this._globalState[r],e[r].default)||(t.push(r),this._globalState[r]=e[r].default);this._applyGlobalStateChanges(t)}_applyGlobalStateChanges(e){if(0===e.length)return;let t=new Set,r={};for(let i of e){r[i]=this._globalState[i];for(let e in this._layers){let r=this._layers[e],n=r.getLayoutAffectingGlobalStateRefs(),a=r.getPaintAffectingGlobalStateRefs(),o=r.getVisibilityAffectingGlobalStateRefs();if(n.has(i)&&t.add(r.source),a.has(i))for(let{name:e,value:t}of a.get(i))this._updatePaintProperty(r,e,t);o?.has(i)&&(r.recalculateVisibility(),this._updateLayer(r))}}this.dispatcher.broadcast("UGS",r);for(let e in this.tileManagers)t.has(e)&&(this._reloadSource(e),this._changed=!0)}async loadURL(e,t={},r){this.fire(new MS("dataloading")),t.validate="boolean"!=typeof t.validate||t.validate,this._loadStyleRequest=new AbortController;let i=this._loadStyleRequest;try{let n=await this.map._requestManager.transformRequest(e,"Style");Bs(i.signal);let a=await qs(n,i);this._loadStyleRequest===i&&(this._loadStyleRequest=null),this._load(a.data,t,r)}catch(e){this._loadStyleRequest===i&&(this._loadStyleRequest=null),e&&!i.signal.aborted&&this.fire(new Ys(jo(e)))}}loadJSON(e,t={},r){this.fire(new MS("dataloading")),this._frameRequest=new AbortController,SS.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,t.validate=!1!==t.validate,this._load(e,t,r)}).catch(()=>{})}loadEmpty(){this.fire(new MS("dataloading")),this._load(zD,{validate:!1})}_load(e,t,r){let i=t.transformStyle?t.transformStyle(r,e):e;if(!t.validate||!Ad(this,i)){i={...i},this._loaded=!0,this.stylesheet=i;for(let e in i.sources)this.addSource(e,i.sources[e],{validate:!1});i.sprite?this._loadSprite(i.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(i.glyphs),this.glyphManager.setFontFaces(i["font-faces"]),this._createLayers(),this.light=new vT(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(this.stylesheet.projection?.type||"mercator"),this.sky=new xT(this.stylesheet.sky,this._globalState),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new MS("data")),this.fire(new kS)}}_createLayers(){let e=$S(this.stylesheet.layers);this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast("SL",e),this._order=e.map(e=>e.id),this._layers={},this._serializedLayers=null;for(let t of e){let e=kb(t,this._globalState);if(e.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=e,lp(e)&&this.tileManagers[e.source]){let r=t.paint?.["raster-fade-duration"]??e.paint.get("raster-fade-duration");this.tileManagers[e.source].setRasterFadeDuration(r)}}}async _loadSprite(e,t=!1,r=void 0){this.imageManager.setLoaded(!1);let i,n=new AbortController;this._spriteRequest=n;try{let r=await async function(e,t,r,i){let n=QS(e),a=r>1?"@2x":"",o={},s={};for(let{id:e,url:r}of n){let n=await t.transformRequest(eT(r,a,".json"),"SpriteJSON");o[e]=qs(n,i);let l=await t.transformRequest(eT(r,a,".png"),"SpriteImage");s[e]=DS.getImage(l,i)}return await Promise.all([...Object.values(o),...Object.values(s)]),async function(e,t){let r={};for(let i in e){r[i]={};let n=(await t[i]).data;if(!n)throw Error(`Could not load sprite image for ${i}: the response is empty`);let a=SS.getImageCanvasContext(n),o=(await e[i]).data;for(let e in o){let{width:t,height:n,x:s,y:l,sdf:u,pixelRatio:c,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:m}=o[e],g={width:t,height:n,x:s,y:l,context:a};r[i][e]={data:null,pixelRatio:c,sdf:u,stretchX:h,stretchY:d,content:p,textFitWidth:f,textFitHeight:m,spriteData:g}}}return r}(o,s)}(e,this.map._requestManager,this.map.getPixelRatio(),n);if(!r)return;for(let e in r){let{loaded:i,removed:n}=this.imageManager.setSpriteImages(e,r[e]);this._markImagesChanged(n),t&&this._markImagesChanged(i)}}catch(e){i=e,n.signal.aborted||this.fire(new Ys(i))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),t&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new MS("data")),r?.(i)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new MS("data"))}_validateLayer(e){let t=this.tileManagers[e.source];if(!t)return;let r=e.sourceLayer;if(!r)return;let i=t.getSource();("geojson"===i.type||i.vectorLayerIds&&!i.vectorLayerIds.includes(r))&&this.fire(new Ys(Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let r=this._serializedAllLayers();if(!e||0===e.length)return Object.values(t?gs(r):r);let i=[];for(let n of e)if(r[n]){let e=t?gs(r[n]):r[n];i.push(e)}return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let r of t){let t=this._layers[r];"custom"!==t.type&&(e[r]=t.serialize())}return e}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let e in this.tileManagers)if(this.tileManagers[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(t){this._imagesListDirty&&=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1);let t=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);(t.length||r.length)&&this._updateWorkerLayers(t,r);for(let e in this._updatedSources){let t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this._resetUpdates()}let r={};for(let e in this.tileManagers){let t=this.tileManagers[e];r[e]=t.used,t.used=!1}let i=this.imageManager.listImages();for(let t of this._order){let r=this._layers[t];r.recalculate(e,i),!r.isHidden(e.zoom)&&r.source&&(this.tileManagers[r.source].used=!0)}for(let e in r){let t=this.tileManagers[e];!!r[e]!=!!t.used&&t.fire(new FS("data",{sourceDataType:"visibility",sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new MS("data"))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){this._checkLoaded();let r=this.serialize();if(e=t.transformStyle?t.transformStyle(r,e):e,(t.validate??!0)&&Ad(this,e))return!1;(e=gs(e)).layers=$S(e.layers);let i=function(e,t){if(!e)return[{command:"setStyle",args:[t]}];let r=[];try{if(!GS(e.version,t.version))return[{command:"setStyle",args:[t]}];GS(e.center,t.center)||r.push({command:"setCenter",args:[t.center]}),GS(e.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),GS(e.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),GS(e.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),GS(e.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),GS(e.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),GS(e.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}),GS(e.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),GS(e.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),GS(e["font-faces"],t["font-faces"])||r.push({command:"setFontFaces",args:[t["font-faces"]]}),GS(e.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),GS(e.light,t.light)||r.push({command:"setLight",args:[t.light]}),GS(e.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),GS(e.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),GS(e.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});let i={},n=[];!function(e,t,r,i){let n;for(n in e||={},t||={},e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(t,n)||WS(n,r,i));for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?GS(e[n],t[n])||("geojson"===e[n].type&&"geojson"===t[n].type&&XS(e,t,n)?qS(r,{command:"setGeoJSONSourceData",args:[n,t[n].data]}):HS(n,t,r,i)):ZS(n,t,r))}(e.sources,t.sources,n,i);let a=[];e.layers&&e.layers.forEach(e=>{"source"in e&&i[e.source]?r.push({command:"removeLayer",args:[e.id]}):a.push(e)}),r=r.concat(n),function(e,t,r){e||=[],t||=[];let i,n,a,o,s,l=e.map(YS),u=t.map(YS),c=e.reduce(JS,{}),h=t.reduce(JS,{}),d=l.slice(),p=Object.create(null);for(let e=0,t=0;e<l.length;e++)i=l[e],Object.prototype.hasOwnProperty.call(h,i)?t++:(qS(r,{command:"removeLayer",args:[i]}),d.splice(d.indexOf(i,t),1));for(let e=0,t=0;e<u.length;e++)i=u[u.length-1-e],d[d.length-1-e]!==i&&(Object.prototype.hasOwnProperty.call(c,i)?(qS(r,{command:"removeLayer",args:[i]}),d.splice(d.lastIndexOf(i,d.length-t),1)):t++,o=d[d.length-e],qS(r,{command:"addLayer",args:[h[i],o]}),d.splice(d.length-e,0,i),p[i]=!0);for(let e=0;e<u.length;e++)if(i=u[e],n=c[i],a=h[i],!p[i]&&!GS(n,a)){if(!GS(n.source,a.source)||!GS(n["source-layer"],a["source-layer"])||!GS(n.type,a.type)){qS(r,{command:"removeLayer",args:[i]}),o=d[d.lastIndexOf(i)+1],qS(r,{command:"addLayer",args:[a,o]});continue}for(s in KS(n.layout,a.layout,r,i,null,"setLayoutProperty"),KS(n.paint,a.paint,r,i,null,"setPaintProperty"),GS(n.filter,a.filter)||qS(r,{command:"setFilter",args:[i,a.filter]}),(!GS(n.minzoom,a.minzoom)||!GS(n.maxzoom,a.maxzoom))&&qS(r,{command:"setLayerZoomRange",args:[i,a.minzoom,a.maxzoom]}),n)Object.prototype.hasOwnProperty.call(n,s)&&"layout"!==s&&"paint"!==s&&"filter"!==s&&"metadata"!==s&&"minzoom"!==s&&"maxzoom"!==s&&(0===s.indexOf("paint.")?KS(n[s],a[s],r,i,s.slice(6),"setPaintProperty"):GS(n[s],a[s])||qS(r,{command:"setLayerProperty",args:[i,s,a[s]]}));for(s in a)Object.prototype.hasOwnProperty.call(a,s)&&!Object.prototype.hasOwnProperty.call(n,s)&&"layout"!==s&&"paint"!==s&&"filter"!==s&&"metadata"!==s&&"minzoom"!==s&&"maxzoom"!==s&&(0===s.indexOf("paint.")?KS(n[s],a[s],r,i,s.slice(6),"setPaintProperty"):GS(n[s],a[s])||qS(r,{command:"setLayerProperty",args:[i,s,a[s]]}))}}(a,t.layers,r)}catch(e){console.warn("Unable to compute style diff:",e),r=[{command:"setStyle",args:[t]}]}return r}(r,e),n=this._getOperationsToPerform(i);if(n.unimplemented.length>0)throw Error(`Unimplemented: ${n.unimplemented.join(", ")}.`);if(0===n.operations.length)return!1;for(let e of n.operations)e();return this.stylesheet=e,this._serializedLayers=null,this.fire(new kS({style:this})),!0}_getOperationsToPerform(e){let t=[],r=[];for(let i of e)switch(i.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":t.push(()=>this.addLayer.apply(this,i.args));break;case"removeLayer":t.push(()=>this.removeLayer.apply(this,i.args));break;case"setPaintProperty":t.push(()=>this.setPaintProperty.apply(this,i.args));break;case"setLayoutProperty":t.push(()=>this.setLayoutProperty.apply(this,i.args));break;case"setFilter":t.push(()=>this.setFilter.apply(this,i.args));break;case"addSource":t.push(()=>this.addSource.apply(this,i.args));break;case"removeSource":t.push(()=>this.removeSource.apply(this,i.args));break;case"setLayerZoomRange":t.push(()=>this.setLayerZoomRange.apply(this,i.args));break;case"setLight":t.push(()=>this.setLight.apply(this,i.args));break;case"setGeoJSONSourceData":t.push(()=>this.setGeoJSONSourceData.apply(this,i.args));break;case"setGlyphs":t.push(()=>this.setGlyphs.apply(this,i.args));break;case"setFontFaces":t.push(()=>this.setFontFaces.apply(this,i.args));break;case"setSprite":t.push(()=>this.setSprite.apply(this,i.args));break;case"setTerrain":t.push(()=>this.map.setTerrain.apply(this,i.args));break;case"setSky":t.push(()=>this.setSky.apply(this,i.args));break;case"setProjection":this.setProjection.apply(this,i.args);break;case"setGlobalState":t.push(()=>this.setGlobalState.apply(this,i.args));break;case"setTransition":t.push(()=>{});break;default:r.push(i.command)}return{operations:t,unimplemented:r}}addImage(e,t){this.getImage(e)?this.fire(new Ys(Error(`An image named "${e}" already exists.`))):(this.imageManager.addImage(e,t),this._afterImageUpdated(e))}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}setMissingImageResolver(e){this.imageManager.setMissingImageResolver(e)}removeImage(e){this.getImage(e)?(this.imageManager.removeImage(e),this._afterImageUpdated(e)):this.fire(new Ys(Error(`An image named "${e}" does not exist.`)))}_markImagesChanged(e){for(let t of e)this._changedImages[t]=!0}_afterImageUpdated(e){this._changedImages[e]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new MS("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,r={}){if(this._checkLoaded(),void 0!==this.tileManagers[e])throw Error(`Source "${e}" already exists.`);if(!t.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(t).join(", ")}.`);if(Dd.has(t.type)&&this._validate(Ed.source,`sources.${e}`,t,null,r))return;this.map?._collectResourceTiming&&(t.collectResourceTiming=!0);let i=this.tileManagers[e]=new CP(e,t,this.dispatcher);i.style=this,i.setEventedParent(this,()=>({isSourceLoaded:i.loaded(),source:i.serialize(),sourceId:e})),i.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.tileManagers[e])throw Error(`There is no source with this ID=${e}`);for(let t in this._layers)if(this._layers[t].source===e)return this.fire(new Ys(Error(`Source "${e}" cannot be removed while layer "${t}" is using it.`)));let t=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],t.fire(new FS("data",{sourceDataType:"metadata",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.tileManagers[e])throw Error(`There is no source with this ID=${e}`);let r=this.tileManagers[e].getSource();if("geojson"!==r.type)throw Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(t),this._changed=!0}getSource(e){return this.tileManagers[e]?.getSource()}addLayer(e,t,r={}){this._checkLoaded();let i,n=e.id;if(this.getLayer(n))return void this.fire(new Ys(Error(`Layer "${n}" already exists on this map.`)));if("custom"===e.type){if(Id(this,function(e){let t=[],r=e.id;return void 0===r&&t.push(new rl(`layers.${r}`,null,'missing required property "id"')),void 0===e.render&&t.push(new rl(`layers.${r}`,null,'missing required method "render"')),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push(new rl(`layers.${r}`,null,'property "renderingMode" must be either "2d" or "3d"')),t}(e)))return;i=kb(e,this._globalState)}else{if("source"in e&&"object"==typeof e.source&&(this.addSource(n,e.source),e=os(e=gs(e),{source:n})),this._validate(Ed.layer,`layers.${n}`,e,{arrayIndex:-1},r))return;i=kb(e,this._globalState),this._validateLayer(i),i.setEventedParent(this,{layer:{id:n}})}let a=t?this._order.indexOf(t):this._order.length;if(t&&-1===a)this.fire(new Ys(Error(`Cannot add layer "${n}" before non-existing layer "${t}".`)));else{if(this._order.splice(a,0,n),this._layerOrderChanged=!0,this._layers[n]=i,this._removedLayers[n]&&i.source&&"custom"!==i.type){let e=this._removedLayers[n];delete this._removedLayers[n],e.type===i.type?(this._updatedSources[i.source]="reload",this.tileManagers[i.source].pause()):this._updatedSources[i.source]="clear"}this._updateLayer(i),i.onAdd&&i.onAdd(this.map)}}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new Ys(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===t)return;if(t&&!this._order.includes(t))return void this.fire(new Ys(Error(`Cannot move layer "${e}" before non-existing layer "${t}".`)));let r=this._order.indexOf(e);this._order.splice(r,1);let i=t?this._order.indexOf(t):this._order.length;this._order.splice(i,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t)return void this.fire(new Ys(Error(`Cannot remove non-existing layer "${e}".`)));t.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],"symbol"===t.type&&t.source&&this.tileManagers[t.source]?.resetMaxContentElevation(),t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,r){this._checkLoaded();let i=this.getLayer(e);i?(i.minzoom!==t||i.maxzoom!==r)&&(null!=t&&(i.minzoom=t),null!=r&&(i.maxzoom=r),this._updateLayer(i)):this.fire(new Ys(Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,t,r={}){this._checkLoaded();let i=this.getLayer(e);if(i){if(!ms(i.filter,t)){if(null==t)return i.setFilter(void 0),void this._updateLayer(i);this._validate(Ed.filter,`layers.${i.id}.filter`,t,null,r)||(i.setFilter(gs(t)),this._updateLayer(i))}}else this.fire(new Ys(Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return gs(this.getLayer(e).filter)}setLayoutProperty(e,t,r,i={}){this._checkLoaded();let n=this.getLayer(e);n?ms(n.getLayoutProperty(t),r)||(n.setLayoutProperty(t,r,i),this._updateLayer(n)):this.fire(new Ys(Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,t){let r=this.getLayer(e);if(r)return r.getLayoutProperty(t);this.fire(new Ys(Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,t,r,i={}){this._checkLoaded();let n=this.getLayer(e);n?ms(n.getPaintProperty(t),r)||this._updatePaintProperty(n,t,r,i):this.fire(new Ys(Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,t,r,i={}){e.setPaintProperty(t,r,i)&&this._updateLayer(e),lp(e)&&"raster-fade-duration"===t&&this.tileManagers[e.source].setRasterFadeDuration(r),this._changed=!0,this._updatedPaintProps[e.id]=!0,"symbol"===e.type&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let r=e.source,i=e.sourceLayer,n=this.tileManagers[r];if(void 0===n)return void this.fire(new Ys(Error(`The source '${r}' does not exist in the map's style.`)));let a=n.getSource().type;if("geojson"===a&&i)return void this.fire(new Ys(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===a&&!i)return void this.fire(new Ys(Error("The sourceLayer parameter must be provided for vector source types.")));if(void 0===e.id)return void this.fire(new Ys(Error("The feature id parameter must be provided.")));let o=["__proto__","constructor","prototype"];t&&Object.keys(t).some(e=>o.includes(e))?this.fire(new Ys(Error(`The feature state should not include one of the following keys: ${o}`))):n.setFeatureState(i,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let r=e.source,i=this.tileManagers[r];if(void 0===i)return void this.fire(new Ys(Error(`The source '${r}' does not exist in the map's style.`)));let n=i.getSource().type,a="vector"===n?e.sourceLayer:void 0;"vector"!==n||a?t&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new Ys(Error("A feature id is required to remove its specific state property."))):i.removeFeatureState(a,e.id,t):this.fire(new Ys(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let t=e.source,r=e.sourceLayer,i=this.tileManagers[t];if(void 0!==i){if("vector"!==i.getSource().type||r)return void 0===e.id&&this.fire(new Ys(Error("The feature id parameter must be provided."))),i.getFeatureState(r,e.id);this.fire(new Ys(Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new Ys(Error(`The source '${t}' does not exist in the map's style.`)))}getTransition(){return os({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let e=ps(this.tileManagers,e=>e.serialize()),t=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,i=this.stylesheet;return fs({version:i.version,name:i.name,metadata:i.metadata,light:i.light,sky:i.sky,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,"font-faces":i["font-faces"],transition:i.transition,projection:i.projection,state:i.state,sources:e,layers:t,terrain:r},e=>void 0!==e)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.tileManagers[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=e=>"fill-extrusion"===this._layers[e].type,r={},i=[];for(let n=this._order.length-1;n>=0;n--){let a=this._order[n];if(t(a)){r[a]=n;for(let t of e){let e=t[a];if(e)for(let t of e)i.push(t)}}}i.sort((e,t)=>t.intersectionZ-e.intersectionZ);let n=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o))for(let e=i.length-1;e>=0;e--){let t=i[e].feature;if(r[t.layer.id]<a)break;n.push(t),i.pop()}else for(let t of e){let e=t[o];if(e)for(let t of e)n.push(t.feature)}}return n}queryRenderedFeatures(e,t,r){t?.filter&&this._validate(Ed.filter,"queryRenderedFeatures.filter",t.filter,null,t);let i={};if(t?.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new Ys(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let e of t.layers){let t=this._layers[e];if(!t)return this.fire(new Ys(Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];i[t.source]=!0}}let n=[];t.availableImages=this.imageManager.listImages();let a=this._serializedAllLayers(),o=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,s={...t,layers:o,globalState:this._globalState};for(let o in this.tileManagers)(!t.layers||i[o])&&n.push(MT(this.tileManagers[o],this._layers,a,e,s,r,this.map.terrain?(e,t,r)=>this.map.terrain.getElevation(e,t,r):void 0));return this.placement&&n.push(function(e,t,r,i,n,a,o){let s={},l=a.queryRenderedSymbols(i),u=[];for(let e of Object.keys(l).map(Number))u.push(o[e]);u.sort(FT);for(let r of u){let i=r.featureIndex.lookupSymbolFeatures(l[r.bucketInstanceId],t,r.bucketIndex,r.sourceLayerIndex,{filterSpec:n.filter,globalState:n.globalState},n.layers,n.availableImages,e);for(let e in i){s[e]||=[];let t=i[e];t.sort((e,t)=>{let i=r.featureSortOrder;if(i){let r=i.indexOf(e.featureIndex);return i.indexOf(t.featureIndex)-r}return t.featureIndex-e.featureIndex});for(let r of t)s[e].push(r)}}return function(e,t,r){for(let i in e)for(let n of e[i])RT(n,r[t[i].source]);return e}(s,e,r)}(this._layers,a,this.tileManagers,e,s,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(e,t){t?.filter&&this._validate(Ed.filter,"querySourceFeatures.filter",t.filter,null,t);let r=this.tileManagers[e];return r?function(e,t){let r=e.getRenderableIds().map(t=>e.getTileByID(t)),i=[],n={};for(let e of r){let r=e.tileID.canonical.key;n[r]||(n[r]=!0,e.querySourceFeatures(i,t))}return i}(r,t?{...t,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let r=this.light.getLight(),i=!1;for(let t in e)if(!ms(e[t],r[t])){i=!0;break}if(!i)return;let n={now:PS(),transition:os({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(n)}getProjection(){return this.stylesheet?.projection}setProjection(e){this._checkLoaded();let t=e??{type:"mercator"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){return this.stylesheet?.sky}setSky(e,t={}){this._checkLoaded();let r=this.getSky(),i=!1;if(!e&&!r)return;if(e&&!r)i=!0;else if(!e&&r)i=!0;else for(let t in e)if(!ms(e[t],r[t])){i=!0;break}if(!i)return;let n={now:PS(),transition:os({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(n)}_setProjectionInternal(e){let t=function(e,t,r){let i={constrainOverride:t};if(Array.isArray(e)){let t=new cD({type:e},r);return{projection:t,transform:new FD(i),cameraHelper:new LD(t)}}switch(e){case"mercator":return{projection:new NE,transform:new eD(i),cameraHelper:new oD};case"globe":{let e=new cD({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:e,transform:new FD(i),cameraHelper:new LD(e)}}case"vertical-perspective":return{projection:new uD,transform:new CD(i),cameraHelper:new RD};default:return _s(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new NE,transform:new eD(i),cameraHelper:new oD}}}(e,this.map._camera?.transform.constrainOverride,this._globalState);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let e in this.tileManagers)this.tileManagers[e].reload()}_validate(e,t,r,i,n={}){return!1!==n.validate&&Cd(this,e,{key:t,style:this.serialize(),value:r,...i},n)}_remove(e=!0){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),hP().off(lP,this._rtlPluginLoaded);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(let t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(e,t,r){let i=this.pauseablePlacement;return!i||this._symbolPlacementTriggered||this._placedProjectionTransition!==this.projection?.transitionState||i._showCollisionBoxes!==t||i.placement.collisionGroups.crossSourceCollisions!==r||i.placement.transform.renderWorldCopies!==e.renderWorldCopies||!function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}(i.placement.transform.modelViewProjectionMatrix,e.modelViewProjectionMatrix)}_updatePlacement(e,t,r,i,n=!1){let a=!1,o=!1,s={};for(let t of this._order){let r=this._layers[t];if("symbol"!==r.type)continue;if(!s[r.source]){let e=this.tileManagers[r.source];s[r.source]=e.getRenderableIds(!0).map(t=>e.getTileByID(t)).sort((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1))}let i=this.crossTileSymbolIndex.addLayer(r,s[r.source],e.center.lng);a||=i}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n||=this._layerOrderChanged||0===r;let l=a||this._placementInputsChanged(e,t,i),u=this.pauseablePlacement?.isDone()&&!this.placement.stillRecent(PS(),e.zoom);if((n||!this.pauseablePlacement||u&&(l||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=this.projection?.transitionState,this.pauseablePlacement=new xE(e,this.map.terrain,this._order,n,t,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?l&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(PS()),o=!0),a&&this.pauseablePlacement.placement.setStale()),o||a)for(let e of this._order){let t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,s[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(PS())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}async getImages(e,t){let r=await this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let i=this.tileManagers[t.source];return i&&i.setDependencies(t.tileID.key,t.type,t.icons),r}async getGlyphs(e,t){let r=await this.glyphManager.getGlyphs(t.stacks),i=this.tileManagers[t.source];return i&&i.setDependencies(t.tileID.key,t.type,[""]),r}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),(!e||!this._validate(Ed.glyphs,"glyphs",e,null,t))&&(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(e){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet["font-faces"]=e,this.glyphManager.setFontFaces(e)}async getDashes(e,t){let r={};for(let[e,i]of Object.entries(t.dashes))r[e]=this.lineAtlas.getDash(i.dasharray,i.round);return r}addSprite(e,t,r={},i){this._checkLoaded();let n=[{id:e,url:t}],a=[...QS(this.stylesheet.sprite),...n];this._validate(Ed.sprite,"sprite",a,null,r)||(this.stylesheet.sprite=a,this._loadSprite(n,!0,i))}removeSprite(e){this._checkLoaded();let t=QS(this.stylesheet.sprite);if(!t.find(t=>t.id===e))return void this.fire(new Ys(Error(`Sprite "${e}" doesn't exists on this map.`)));let r=this.imageManager.removeSpriteImages(e);this._markImagesChanged(r),t.splice(t.findIndex(t=>t.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new MS("data"))}getSprite(){return QS(this.stylesheet.sprite)}setSprite(e,t={},r){this._checkLoaded(),(!e||!this._validate(Ed.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}destroy(){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}};const BD=pp([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var jD=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,r,i,n,a,o,s,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==i.length;for(let e=0;!u&&e<i.length;e++)this.boundPaintVertexBuffers[e]!==i[e]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==r||u||this.boundIndexBuffer!==n||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,r,i,n,a,o,s,l):e.bindVertexArray.set(this.vao)}freshBind(e,t,r,i,n,a,o,s){let l=e.numAttributes,u=this.context,c=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=s,t.enableAttributes(c,e);for(let t of r)t.enableAttributes(c,e);a&&a.enableAttributes(c,e),o&&o.enableAttributes(c,e),s&&s.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,n);for(let t of r)t.bind(),t.setVertexAttribPointers(c,e,n);a&&(a.bind(),a.setVertexAttribPointers(c,e,n)),i&&i.bind(),o&&(o.bind(),o.setVertexAttribPointers(c,e,n)),s&&(s.bind(),s.setVertexAttribPointers(c,e,n)),u.currentNumAttributes=l}destroy(){this.vao&&=(this.context.deleteVertexArray(this.vao),null)}};const ND=(e,t,r,i,n)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:r?r.properties.get("fog-color"):Hl.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:n?0:r?r.calculateFogBlendOpacity(i):0,u_horizon_color:r?r.properties.get("horizon-color"):Hl.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!n}),UD=e=>({u_ele_delta:e}),VD={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2},$D={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]};function GD(e){let t={},r=0;for(let{name:i,type:n}of e){let[e,a]=$D[n];r=Math.ceil(r/a)*a,t[i]=r,r+=e}return{offsets:t,contentWords:r,sizeWords:4*Math.ceil(r/4)}}var qD=class{constructor(e,t,r){this.context=e,this.binding=t,this.contentWords=r.contentWords;let i=e.gl;this.buffer=i.createBuffer(),i.bindBuffer(i.UNIFORM_BUFFER,this.buffer),i.bufferData(i.UNIFORM_BUFFER,4*r.sizeWords,i.DYNAMIC_DRAW),i.bindBufferBase(i.UNIFORM_BUFFER,t,this.buffer),this.uploaded=new Float32Array(r.sizeWords),this.pending=new Float32Array(r.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=!1,this.bindingDirty=!1}upload(){let e=this.context.gl,t=!this.hasData;if(!t){let e=this.pendingWords,r=this.uploadedWords;for(let i=0;i<this.contentWords;i++)if(e[i]!==r[i]){t=!0;break}}this.bindingDirty&&=(e.bindBufferBase(e.UNIFORM_BUFFER,this.binding,this.buffer),!1),t&&(e.bindBuffer(e.UNIFORM_BUFFER,this.buffer),e.bufferSubData(e.UNIFORM_BUFFER,0,this.pending),this.uploaded.set(this.pending),this.hasData=!0)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const ZD=GD([{name:"u_projection_matrix",type:"mat4"},{name:"u_projection_fallback_matrix",type:"mat4"},{name:"u_projection_tile_mercator_coords",type:"vec4"},{name:"u_projection_clipping_plane",type:"vec4"},{name:"u_projection_transition",type:"float"},{name:"u_projection_clip_antimeridian",type:"int"}]),WD=ZD.offsets,HD=GD([{name:"u_terrain_matrix",type:"mat4"},{name:"u_terrain_unpack",type:"vec4"},{name:"u_terrain_dim",type:"float"},{name:"u_terrain_exaggeration",type:"float"}]),XD=HD.offsets;function KD(e){let t=[];for(let r of e){if(null===r)continue;let e=r.split(" ");t.push(e.pop())}return t}var YD=class{constructor(e,t,r,i,n,a,o,s,l=[]){let u=e.gl;this.program=u.createProgram();let c=KD(t.staticAttributes),h=r?r.getBinderAttributes():[],d=c.concat(h),p=zE.prelude.staticUniforms?KD(zE.prelude.staticUniforms):[],f=t.staticUniforms?KD(t.staticUniforms):[],m=r?r.getBinderUniforms():[],g=p.concat(f).concat(m),y=[];for(let e of g)y.includes(e)||y.push(e);let _=r?r.defines():[];_.unshift("#version 300 es"),n&&_.push("#define OVERDRAW_INSPECTOR;"),a&&_.push("#define TERRAIN3D;"),s&&_.push(s),l&&_.push(...l);let v=_.concat(zE.prelude.fragmentSource,o.fragmentSource,t.fragmentSource).join("\n"),b=_.concat(zE.prelude.vertexSource,o.vertexSource,t.vertexSource).join("\n"),x=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);u.shaderSource(x,v),u.compileShader(x),u.attachShader(this.program,x);let w=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);u.shaderSource(w,b),u.compileShader(w),u.attachShader(this.program,w),this.attributes={};let S={};if(this.numAttributes=d.length,u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS)){if(u.isContextLost())return void(this.failedToCreate=!0);throw u.getShaderParameter(x,u.COMPILE_STATUS)?u.getShaderParameter(w,u.COMPILE_STATUS)?Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${u.getShaderInfoLog(w)}`):Error(`Could not compile fragment shader: ${u.getShaderInfoLog(x)}`)}!function(e,t){for(let[r,i]of Object.entries(VD)){let n=e.getUniformBlockIndex(t,r);n!==e.INVALID_INDEX&&e.uniformBlockBinding(t,n,i)}}(u,this.program);let T=function(e,t){let r=new Set([e.INT,e.INT_VEC2,e.INT_VEC3,e.INT_VEC4,e.UNSIGNED_INT,e.UNSIGNED_INT_VEC2,e.UNSIGNED_INT_VEC3,e.UNSIGNED_INT_VEC4]),i=new Set,n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let a=0;a<n;a++){let n=e.getActiveAttrib(t,a);n&&r.has(n.type)&&i.add(n.name)}return i}(u,this.program);for(let e of d){if(!e)continue;let t=u.getAttribLocation(this.program,e);t>=0&&(this.attributes[e]={location:t,isInteger:T.has(e)})}u.deleteShader(w),u.deleteShader(x);for(let e of y)if(e&&!S[e]){let t=u.getUniformLocation(this.program,e);t&&(S[e]=t)}this.fixedUniforms=i(e,S),this.terrainUniforms=((e,t)=>({u_depth:new Rf(e,t.u_depth),u_terrain:new Rf(e,t.u_terrain)}))(e,S),this.binderUniforms=r?r.getUniforms(e,S):[]}draw(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_){let v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(r),e.setStencilMode(i),e.setColorMode(n),e.setCullFace(a),s){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(let e in this.terrainUniforms)this.terrainUniforms[e].set(s[e]);!function(e,t){let r=e.pending;r.set(t.u_terrain_matrix,XD.u_terrain_matrix),r.set(t.u_terrain_unpack,XD.u_terrain_unpack),r[XD.u_terrain_dim]=t.u_terrain_dim,r[XD.u_terrain_exaggeration]=t.u_terrain_exaggeration,e.upload()}(e.terrainUniformBuffer,s)}if(l&&function(e,t){let r=e.pending;r.set(t.mainMatrix,WD.u_projection_matrix),r.set(t.fallbackMatrix,WD.u_projection_fallback_matrix),r.set(t.tileMercatorCoords,WD.u_projection_tile_mercator_coords),r.set(t.clippingPlane,WD.u_projection_clipping_plane),r[WD.u_projection_transition]=t.projectionTransition,e.pendingWords[WD.u_projection_clip_antimeridian]=+!!t.clipAntimeridian,e.upload()}(e.projectionUniformBuffer,l),o)for(let e in this.fixedUniforms)this.fixedUniforms[e].set(o[e]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let b=0;switch(t){case v.LINES:b=2;break;case v.TRIANGLES:b=3;break;case v.LINE_STRIP:b=1}for(let r of d.get())r.vaos||={},r.vaos[u]||=new jD,r.vaos[u].bind(e,this,c,m?m.getPaintVertexBuffers():[],h,r.vertexOffset,g,y,_),v.drawElements(t,r.primitiveLength*b,v.UNSIGNED_SHORT,r.primitiveOffset*b*2)}};function JD(e,t,r){let i=1/Bo(r,1,t.transform.tileZoom),n=2**r.tileID.overscaledZ,a=r.tileSize*2**t.transform.tileZoom/n,o=a*(r.tileID.canonical.x+r.tileID.wrap*n),s=a*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[i,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[o>>16,s>>16],u_pixel_coord_lower:[65535&o,65535&s]}}const QD=(e,t,r,i)=>{let n=e.style.light,a=n.getCartesianPosition(),o=Xa();"viewport"===n.properties.get("anchor")&&function(e,t){var r=Math.sin(t),i=Math.cos(t);e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1}(o,e.transform.bearingInRadians),function(e,t,r){var i=t[0],n=t[1],a=t[2];e[0]=i*r[0]+n*r[3]+a*r[6],e[1]=i*r[1]+n*r[4]+a*r[7],e[2]=i*r[2]+n*r[5]+a*r[8]}(a,a,o);let s=e.transform.transformLightDirection(a),l=n.properties.get("color");return{u_lightpos:a,u_lightpos_globe:s,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+t,u_opacity:r,u_fill_translate:i}},eA=(e,t,r,i,n,a,o)=>os(QD(e,t,r,i),JD(a,e,o),{u_height_factor:-(2**n.overscaledZ)/o.tileSize/8}),tA=(e,t,r,i,n)=>os(JD(t,e,r),{u_fill_translate:i,u_sdf_pattern:+!!n}),rA=e=>({u_fill_translate:e}),iA=e=>({u_fill_translate:e}),nA=(e,t,r,i,n)=>tA(e,t,r,i,n),aA=(e,t,r,i,n)=>{let a,o,s=e.transform,l=0;if("map"===r.paint.get("circle-pitch-alignment")){let e=Bo(t,1,s.zoom);a=!0,o=[e,e],l=e/(8192*2**t.tileID.overscaledZ)*2*Math.PI*n}else a=!1,o=s.pixelsToGLUnits;return{u_scale_with_map:+("map"===r.paint.get("circle-pitch-scale")),u_pitch_with_map:+a,u_extrude_scale:o,u_globe_extrude_scale:l,u_translate:i}},oA=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),sA=(e,t,r,i)=>{let n=Bo(e,1,t)/(8192*2**e.tileID.overscaledZ)*2*Math.PI*i;return{u_extrude_scale:Bo(e,1,t),u_intensity:r,u_globe_extrude_scale:n}},lA=(e,t,r,i)=>{let n=Ka();return so(n,0,e.width,e.height,0,0,1),{u_matrix:n,u_image:r,u_color_ramp:i,u_opacity:t.paint.get("heatmap-opacity")}},uA=(e,t,r)=>{let i,n=r.paint.get("hillshade-accent-color");switch(r.paint.get("hillshade-method")){case"basic":i=4;break;case"combined":i=1;break;case"igor":i=2;break;case"multidirectional":i=3;break;default:i=0}let a=r.getIlluminationProperties();for(let t=0;t<a.directionRadians.length;t++)"viewport"===r.paint.get("hillshade-illumination-anchor")&&(a.directionRadians[t]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:hA(0,t.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:a.altitudeRadians,u_azimuths:a.directionRadians,u_accent:n,u_method:i,u_highlights:a.highlightColor,u_shadows:a.shadowColor}},cA=(e,t)=>{let r=t.stride,i=Ka();return so(i,0,8192,-8192,0,0,1),to(i,i,[0,-8192,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function hA(e,t){let r=2**t.canonical.z,i=t.canonical.y;return[new Dy(0,i/r).toLngLat().lat,new Dy(0,(i+1)/r).toLngLat().lat]}const dA=(e,t,r=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:e.paint.get("color-relief-opacity")}),pA=(e,t,r,i)=>{let n=e.transform;return{u_translation:vA(e,t,r),u_ratio:i/Bo(t,1,n.zoom)}},fA=(e,t,r,i,n)=>os(pA(e,t,r,i),{u_image:0,u_image_height:n}),mA=(e,t,r,i,n)=>{let a=e.transform,o=_A(t,a);return{u_translation:vA(e,t,r),u_texsize:t.imageAtlasTexture.size,u_ratio:i/Bo(t,1,a.zoom),u_image:0,u_scale:[o,n.fromScale,n.toScale],u_fade:n.t}},gA=(e,t,r,i,n)=>{let a=_A(t,e.transform);return os(pA(e,t,r,i),{u_tileratio:a,u_crossfade_from:n.fromScale,u_crossfade_to:n.toScale,u_image:0,u_mix:n.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},yA=(e,t,r,i,n,a)=>{let o=_A(t,e.transform);return os(pA(e,t,r,i),{u_image:0,u_image_height:a,u_tileratio:o,u_crossfade_from:n.fromScale,u_crossfade_to:n.toScale,u_image_dash:1,u_mix:n.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function _A(e,t){return 1/Bo(e,1,t.tileZoom)}function vA(e,t,r){return qo(e.transform,t,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const bA=(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f)=>({u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_rotate_symbol:+r,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+i,u_is_along_line:n,u_is_variable_anchor:a,u_texsize:h,u_texture:0,u_translation:u,u_pitched_scale:d,u_is_offset:p,u_height_anchor_ground:+f}),xA=(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m)=>{let g=o.transform;return os(bA(e,t,r,i,n,a,0,s,l,u,c,h,p,f,m),{u_gamma_scale:i?Math.cos(g.pitch*Math.PI/180)*g.cameraToCenterDistance:1,u_is_halo:+!!d,u_is_plain:1})},wA=(e,t,r,i,n,a,o,s,l,u,c,h,d,p,f)=>os(xA(e,t,r,i,n,a,o,s,l,u,!0,c,!0,d,p,f),{u_texsize_icon:h,u_texture_icon:1}),SA=(e,t)=>({u_opacity:e,u_color:t}),TA=(e,t,r,i,n)=>os(function(e,t,r,i){let n=r.patternAtlas.getPattern(e.from.toString()),a=r.patternAtlas.getPattern(e.to.toString()),{width:o,height:s}=r.patternAtlas.getPixelSize(),l=2**i.tileID.overscaledZ,u=i.tileSize*2**r.transform.tileZoom/l,c=u*(i.tileID.canonical.x+i.tileID.wrap*l),h=u*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:a.tl,u_pattern_br_b:a.br,u_texsize:[o,s],u_mix:t.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:a.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/Bo(i,1,r.transform.tileZoom),u_pixel_coord_upper:[c>>16,h>>16],u_pixel_coord_lower:[65535&c,65535&h]}}(r,n,t,i),{u_opacity:e}),PA=(e,t)=>({}),EA={fillExtrusion:(e,t)=>({u_lightpos:new Of(e,t.u_lightpos),u_lightpos_globe:new Of(e,t.u_lightpos_globe),u_lightintensity:new Lf(e,t.u_lightintensity),u_lightcolor:new Of(e,t.u_lightcolor),u_vertical_gradient:new Lf(e,t.u_vertical_gradient),u_opacity:new Lf(e,t.u_opacity),u_fill_translate:new zf(e,t.u_fill_translate)}),fillExtrusionPattern:(e,t)=>({u_lightpos:new Of(e,t.u_lightpos),u_lightpos_globe:new Of(e,t.u_lightpos_globe),u_lightintensity:new Lf(e,t.u_lightintensity),u_lightcolor:new Of(e,t.u_lightcolor),u_vertical_gradient:new Lf(e,t.u_vertical_gradient),u_height_factor:new Lf(e,t.u_height_factor),u_opacity:new Lf(e,t.u_opacity),u_fill_translate:new zf(e,t.u_fill_translate),u_image:new Rf(e,t.u_image),u_texsize:new zf(e,t.u_texsize),u_pixel_coord_upper:new zf(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new zf(e,t.u_pixel_coord_lower),u_scale:new Of(e,t.u_scale),u_fade:new Lf(e,t.u_fade)}),fill:(e,t)=>({u_fill_translate:new zf(e,t.u_fill_translate)}),fillPattern:(e,t)=>({u_image:new Rf(e,t.u_image),u_texsize:new zf(e,t.u_texsize),u_pixel_coord_upper:new zf(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new zf(e,t.u_pixel_coord_lower),u_scale:new Of(e,t.u_scale),u_fade:new Lf(e,t.u_fade),u_sdf_pattern:new Rf(e,t.u_sdf_pattern),u_fill_translate:new zf(e,t.u_fill_translate)}),fillOutline:(e,t)=>({u_fill_translate:new zf(e,t.u_fill_translate)}),fillOutlinePattern:(e,t)=>({u_image:new Rf(e,t.u_image),u_texsize:new zf(e,t.u_texsize),u_pixel_coord_upper:new zf(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new zf(e,t.u_pixel_coord_lower),u_scale:new Of(e,t.u_scale),u_fade:new Lf(e,t.u_fade),u_sdf_pattern:new Rf(e,t.u_sdf_pattern),u_fill_translate:new zf(e,t.u_fill_translate)}),circle:(e,t)=>({u_scale_with_map:new Rf(e,t.u_scale_with_map),u_pitch_with_map:new Rf(e,t.u_pitch_with_map),u_extrude_scale:new zf(e,t.u_extrude_scale),u_globe_extrude_scale:new Lf(e,t.u_globe_extrude_scale),u_translate:new zf(e,t.u_translate)}),collisionBox:PA,collisionCircle:PA,debug:(e,t)=>({u_color:new jf(e,t.u_color),u_overlay:new Rf(e,t.u_overlay),u_overlay_scale:new Lf(e,t.u_overlay_scale)}),depth:PA,clippingMask:PA,heatmap:(e,t)=>({u_extrude_scale:new Lf(e,t.u_extrude_scale),u_intensity:new Lf(e,t.u_intensity),u_globe_extrude_scale:new Lf(e,t.u_globe_extrude_scale)}),heatmapTexture:(e,t)=>({u_matrix:new $f(e,t.u_matrix),u_image:new Rf(e,t.u_image),u_color_ramp:new Rf(e,t.u_color_ramp),u_opacity:new Lf(e,t.u_opacity)}),hillshade:(e,t)=>({u_image:new Rf(e,t.u_image),u_latrange:new zf(e,t.u_latrange),u_exaggeration:new Lf(e,t.u_exaggeration),u_altitudes:new Uf(e,t.u_altitudes),u_azimuths:new Uf(e,t.u_azimuths),u_accent:new jf(e,t.u_accent),u_method:new Rf(e,t.u_method),u_shadows:new Nf(e,t.u_shadows),u_highlights:new Nf(e,t.u_highlights)}),hillshadePrepare:(e,t)=>({u_matrix:new $f(e,t.u_matrix),u_image:new Rf(e,t.u_image),u_dimension:new zf(e,t.u_dimension),u_zoom:new Lf(e,t.u_zoom),u_unpack:new Bf(e,t.u_unpack)}),colorRelief:(e,t)=>({u_image:new Rf(e,t.u_image),u_unpack:new Bf(e,t.u_unpack),u_dimension:new zf(e,t.u_dimension),u_elevation_stops:new Rf(e,t.u_elevation_stops),u_color_stops:new Rf(e,t.u_color_stops),u_color_ramp_size:new Rf(e,t.u_color_ramp_size),u_opacity:new Lf(e,t.u_opacity)}),line:(e,t)=>({u_translation:new zf(e,t.u_translation),u_ratio:new Lf(e,t.u_ratio)}),lineGradient:(e,t)=>({u_translation:new zf(e,t.u_translation),u_ratio:new Lf(e,t.u_ratio),u_image:new Rf(e,t.u_image),u_image_height:new Lf(e,t.u_image_height)}),linePattern:(e,t)=>({u_translation:new zf(e,t.u_translation),u_texsize:new zf(e,t.u_texsize),u_ratio:new Lf(e,t.u_ratio),u_image:new Rf(e,t.u_image),u_scale:new Of(e,t.u_scale),u_fade:new Lf(e,t.u_fade)}),lineSDF:(e,t)=>({u_translation:new zf(e,t.u_translation),u_ratio:new Lf(e,t.u_ratio),u_image:new Rf(e,t.u_image),u_mix:new Lf(e,t.u_mix),u_tileratio:new Lf(e,t.u_tileratio),u_crossfade_from:new Lf(e,t.u_crossfade_from),u_crossfade_to:new Lf(e,t.u_crossfade_to),u_lineatlas_width:new Lf(e,t.u_lineatlas_width),u_lineatlas_height:new Lf(e,t.u_lineatlas_height)}),lineGradientSDF:(e,t)=>({u_translation:new zf(e,t.u_translation),u_ratio:new Lf(e,t.u_ratio),u_image:new Rf(e,t.u_image),u_image_height:new Lf(e,t.u_image_height),u_tileratio:new Lf(e,t.u_tileratio),u_crossfade_from:new Lf(e,t.u_crossfade_from),u_crossfade_to:new Lf(e,t.u_crossfade_to),u_image_dash:new Rf(e,t.u_image_dash),u_mix:new Lf(e,t.u_mix),u_lineatlas_width:new Lf(e,t.u_lineatlas_width),u_lineatlas_height:new Lf(e,t.u_lineatlas_height)}),layerOpacity:(e,t)=>({u_image:new Rf(e,t.u_image),u_opacity:new Lf(e,t.u_opacity)}),raster:(e,t)=>({u_tl_parent:new zf(e,t.u_tl_parent),u_scale_parent:new Lf(e,t.u_scale_parent),u_buffer_scale:new Lf(e,t.u_buffer_scale),u_image_warp:new Of(e,t.u_image_warp),u_fade_t:new Lf(e,t.u_fade_t),u_opacity:new Lf(e,t.u_opacity),u_image0:new Rf(e,t.u_image0),u_image1:new Rf(e,t.u_image1),u_brightness_low:new Lf(e,t.u_brightness_low),u_brightness_high:new Lf(e,t.u_brightness_high),u_saturation_factor:new Lf(e,t.u_saturation_factor),u_contrast_factor:new Lf(e,t.u_contrast_factor),u_spin_weights:new Of(e,t.u_spin_weights),u_coords_top:new Bf(e,t.u_coords_top),u_coords_bottom:new Bf(e,t.u_coords_bottom)}),symbolIcon:(e,t)=>({u_is_size_zoom_constant:new Rf(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Rf(e,t.u_is_size_feature_constant),u_size_t:new Lf(e,t.u_size_t),u_size:new Lf(e,t.u_size),u_rotate_symbol:new Rf(e,t.u_rotate_symbol),u_label_plane_matrix:new $f(e,t.u_label_plane_matrix),u_coord_matrix:new $f(e,t.u_coord_matrix),u_is_text:new Rf(e,t.u_is_text),u_pitch_with_map:new Rf(e,t.u_pitch_with_map),u_is_along_line:new Rf(e,t.u_is_along_line),u_is_variable_anchor:new Rf(e,t.u_is_variable_anchor),u_texsize:new zf(e,t.u_texsize),u_texture:new Rf(e,t.u_texture),u_translation:new zf(e,t.u_translation),u_pitched_scale:new Lf(e,t.u_pitched_scale),u_is_offset:new Rf(e,t.u_is_offset),u_height_anchor_ground:new Rf(e,t.u_height_anchor_ground)}),symbolSDF:(e,t)=>({u_is_size_zoom_constant:new Rf(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Rf(e,t.u_is_size_feature_constant),u_size_t:new Lf(e,t.u_size_t),u_size:new Lf(e,t.u_size),u_rotate_symbol:new Rf(e,t.u_rotate_symbol),u_label_plane_matrix:new $f(e,t.u_label_plane_matrix),u_coord_matrix:new $f(e,t.u_coord_matrix),u_is_text:new Rf(e,t.u_is_text),u_pitch_with_map:new Rf(e,t.u_pitch_with_map),u_is_along_line:new Rf(e,t.u_is_along_line),u_is_variable_anchor:new Rf(e,t.u_is_variable_anchor),u_texsize:new zf(e,t.u_texsize),u_texture:new Rf(e,t.u_texture),u_gamma_scale:new Lf(e,t.u_gamma_scale),u_is_halo:new Rf(e,t.u_is_halo),u_is_plain:new Rf(e,t.u_is_plain),u_translation:new zf(e,t.u_translation),u_pitched_scale:new Lf(e,t.u_pitched_scale),u_is_offset:new Rf(e,t.u_is_offset),u_height_anchor_ground:new Rf(e,t.u_height_anchor_ground)}),symbolTextAndIcon:(e,t)=>({u_is_size_zoom_constant:new Rf(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Rf(e,t.u_is_size_feature_constant),u_size_t:new Lf(e,t.u_size_t),u_size:new Lf(e,t.u_size),u_rotate_symbol:new Rf(e,t.u_rotate_symbol),u_label_plane_matrix:new $f(e,t.u_label_plane_matrix),u_coord_matrix:new $f(e,t.u_coord_matrix),u_is_text:new Rf(e,t.u_is_text),u_pitch_with_map:new Rf(e,t.u_pitch_with_map),u_is_along_line:new Rf(e,t.u_is_along_line),u_is_variable_anchor:new Rf(e,t.u_is_variable_anchor),u_texsize:new zf(e,t.u_texsize),u_texsize_icon:new zf(e,t.u_texsize_icon),u_texture:new Rf(e,t.u_texture),u_texture_icon:new Rf(e,t.u_texture_icon),u_gamma_scale:new Lf(e,t.u_gamma_scale),u_is_halo:new Rf(e,t.u_is_halo),u_translation:new zf(e,t.u_translation),u_pitched_scale:new Lf(e,t.u_pitched_scale),u_is_offset:new Rf(e,t.u_is_offset),u_height_anchor_ground:new Rf(e,t.u_height_anchor_ground)}),background:(e,t)=>({u_opacity:new Lf(e,t.u_opacity),u_color:new jf(e,t.u_color)}),backgroundPattern:(e,t)=>({u_opacity:new Lf(e,t.u_opacity),u_image:new Rf(e,t.u_image),u_pattern_tl_a:new zf(e,t.u_pattern_tl_a),u_pattern_br_a:new zf(e,t.u_pattern_br_a),u_pattern_tl_b:new zf(e,t.u_pattern_tl_b),u_pattern_br_b:new zf(e,t.u_pattern_br_b),u_texsize:new zf(e,t.u_texsize),u_mix:new Lf(e,t.u_mix),u_pattern_size_a:new zf(e,t.u_pattern_size_a),u_pattern_size_b:new zf(e,t.u_pattern_size_b),u_scale_a:new Lf(e,t.u_scale_a),u_scale_b:new Lf(e,t.u_scale_b),u_pixel_coord_upper:new zf(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new zf(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new Lf(e,t.u_tile_units_to_pixels)}),terrain:(e,t)=>({u_texture:new Rf(e,t.u_texture),u_ele_delta:new Lf(e,t.u_ele_delta),u_fog_matrix:new $f(e,t.u_fog_matrix),u_fog_color:new jf(e,t.u_fog_color),u_fog_ground_blend:new Lf(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new Lf(e,t.u_fog_ground_blend_opacity),u_horizon_color:new jf(e,t.u_horizon_color),u_horizon_fog_blend:new Lf(e,t.u_horizon_fog_blend),u_is_globe_mode:new Lf(e,t.u_is_globe_mode)}),terrainDepth:(e,t)=>({u_ele_delta:new Lf(e,t.u_ele_delta)}),atmosphere:(e,t)=>({u_sun_pos:new Of(e,t.u_sun_pos),u_atmosphere_blend:new Lf(e,t.u_atmosphere_blend),u_globe_position:new Of(e,t.u_globe_position),u_globe_radius:new Lf(e,t.u_globe_radius),u_inv_proj_matrix:new $f(e,t.u_inv_proj_matrix)}),sky:(e,t)=>({u_sky_color:new jf(e,t.u_sky_color),u_horizon_color:new jf(e,t.u_horizon_color),u_horizon:new zf(e,t.u_horizon),u_horizon_normal:new zf(e,t.u_horizon_normal),u_sky_horizon_blend:new Lf(e,t.u_sky_horizon_blend),u_sky_blend:new Lf(e,t.u_sky_blend),u_inv_proj_matrix:new $f(e,t.u_inv_proj_matrix),u_globe_position:new Of(e,t.u_globe_position),u_globe_radius:new Lf(e,t.u_globe_radius)})};var DA=class{constructor(e,t,r){this.context=e;let i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};const AA={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};var IA=class{constructor(e,t,r,i){this.length=t.length,this.attributes=r,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,this.context=e;let n=e.gl;this.buffer=n.createBuffer(),e.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let r of this.attributes){let i=t.attributes[r.name];void 0!==i&&e.enableVertexAttribArray(i.location)}}setVertexAttribPointers(e,t,r){for(let i of this.attributes){let n=t.attributes[i.name];if(void 0!==n){let t=i.offset+this.itemSize*(r||0);n.isInteger?e.vertexAttribIPointer(n.location,i.components,e[AA[i.type]],this.itemSize,t):e.vertexAttribPointer(n.location,i.components,e[AA[i.type]],!1,this.itemSize,t)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},CA=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},kA=class extends CA{getDefault(){return Hl.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},MA=class extends CA{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},FA=class extends CA{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},RA=class extends CA{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},LA=class extends CA{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},zA=class extends CA{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},OA=class extends CA{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},BA=class extends CA{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},jA=class extends CA{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},NA=class extends CA{getDefault(){return[0,1]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},UA=class extends CA{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},VA=class extends CA{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},$A=class extends CA{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},GA=class extends CA{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},qA=class extends CA{getDefault(){return Hl.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},ZA=class extends CA{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},WA=class extends CA{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},HA=class extends CA{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},XA=class extends CA{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},KA=class extends CA{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},YA=class extends CA{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},JA=class extends CA{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},QA=class extends CA{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},eI=class extends CA{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},tI=class extends CA{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},rI=class extends CA{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},iI=class extends CA{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},nI=class extends CA{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},aI=class extends CA{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},oI=class extends CA{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},sI=class extends CA{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},lI=class extends CA{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},uI=class extends lI{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},cI=class extends lI{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},hI=class extends lI{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},dI=class{constructor(e,t,r,i,n){this.context=e,this.width=t,this.height=r;let a=e.gl,o=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new uI(e,o),i)this.depthAttachment=n?new hI(e,o):new cI(e,o);else if(n)throw Error("Stencil cannot be set without depth")}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}};const pI=GD([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),fI=pI.offsets;var mI=class{constructor(e,t,r){this.blendFunction=e,this.blendColor=t,this.mask=r}};mI.Replace=[1,0],mI.disabled=new mI(mI.Replace,Hl.transparent,[!1,!1,!1,!1]),mI.unblended=new mI(mI.Replace,Hl.transparent,[!0,!0,!0,!0]),mI.alphaBlended=new mI([1,771],Hl.transparent,[!0,!0,!0,!0]);var gI=class{constructor(e){this.gl=e,this.clearColor=new kA(this),this.clearDepth=new MA(this),this.clearStencil=new FA(this),this.colorMask=new RA(this),this.depthMask=new LA(this),this.stencilMask=new zA(this),this.stencilFunc=new OA(this),this.stencilOp=new BA(this),this.stencilTest=new jA(this),this.depthRange=new NA(this),this.depthTest=new UA(this),this.depthFunc=new VA(this),this.blend=new $A(this),this.blendFunc=new GA(this),this.blendColor=new qA(this),this.blendEquation=new ZA(this),this.cullFace=new WA(this),this.cullFaceSide=new HA(this),this.frontFace=new XA(this),this.program=new KA(this),this.activeTexture=new YA(this),this.viewport=new JA(this),this.bindFramebuffer=new QA(this),this.bindRenderbuffer=new eI(this),this.bindTexture=new tI(this),this.bindVertexBuffer=new rI(this),this.bindElementBuffer=new iI(this),this.bindVertexArray=new nI(this),this.pixelStoreUnpack=new aI(this),this.pixelStoreUnpackPremultiplyAlpha=new oI(this),this.pixelStoreUnpackFlipY=new sI(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),e.getExtension("EXT_color_buffer_half_float"),e.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=function(e){return new qD(e,VD.ProjectionUBO,ZD)}(this),this.terrainUniformBuffer=function(e){return new qD(e,VD.TerrainUBO,HD)}(this),this.frameUniformBuffer=function(e){return new qD(e,VD.FrameUBO,pI)}(this)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!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.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,t){return new DA(this,e,t)}createVertexBuffer(e,t,r){return new IA(this,e,t,r)}createRenderbuffer(e,t,r){let i=this.gl,n=i.createRenderbuffer();return this.bindRenderbuffer.set(n),i.renderbufferStorage(i.RENDERBUFFER,e,t,r),this.bindRenderbuffer.set(null),n}createFramebuffer(e,t,r,i){return new dI(this,e,t,r,i)}clear({color:e,depth:t,stencil:r}){let i=this.gl,n=0;e&&(n|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==t&&(n|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),void 0!==r&&(n|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(n)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){ms(e.blendFunction,mI.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},yI=class{constructor(e,t,r){this.func=e,this.mask=t,this.range=r}};yI.ReadOnly=!1,yI.ReadWrite=!0,yI.disabled=new yI(519,yI.ReadOnly,[0,1]);const _I=7680;var vI=class{constructor(e,t,r,i,n,a){this.test=e,this.ref=t,this.mask=r,this.fail=i,this.depthFail=n,this.pass=a}};vI.disabled=new vI({func:519,mask:0},0,0,_I,_I,_I);const bI=2305;var xI=class{constructor(e,t,r){this.enable=e,this.mode=t,this.frontFace=r}};let wI;function SI(e,t,r,i,n){let a=e.context,o=e.transform,s=a.gl,l=e.useProgram("collisionBox"),u=[],c=0,h=0;for(let d of i){let i=t.getTile(d).getBucket(r);if(!i)continue;let p=n?i.textCollisionBox:i.iconCollisionBox,f=i.collisionCircleArray;f.length>0&&(u.push({circleArray:f,circleOffset:h,coord:d}),c+=f.length/4,h=c),p&&l.draw(a,s.LINES,yI.disabled,vI.disabled,e.colorModeForRenderPass(),xI.disabled,null,e.style.map.terrain?.getTerrainData(d),o.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,null,e.transform.zoom,null,null,p.collisionVertexBuffer)}if(!n||!u.length)return;let d=e.useProgram("collisionCircle"),p=new df;p.resize(4*c),p._trim();let f=0;for(let e of u)for(let t=0;t<e.circleArray.length/4;t++){let r=4*t,i=e.circleArray[r+0],n=e.circleArray[r+1],a=e.circleArray[r+2],o=e.circleArray[r+3];p.emplace(f++,i,n,a,o,0),p.emplace(f++,i,n,a,o,1),p.emplace(f++,i,n,a,o,2),p.emplace(f++,i,n,a,o,3)}(!wI||wI.length<2*c)&&(wI=function(e){let t=2*e,r=new ff;r.resize(t),r._trim();for(let e=0;e<t;e++){let t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(c));let m=a.createIndexBuffer(wI,!0),g=a.createVertexBuffer(p,c_.members,!0);for(let t of u)d.draw(a,s.TRIANGLES,yI.disabled,vI.disabled,e.colorModeForRenderPass(),xI.disabled,null,e.style.map.terrain?.getTerrainData(t.coord),null,r.id,g,m,bf.simpleSegment(0,2*t.circleOffset,t.circleArray.length,t.circleArray.length/2),null,e.transform.zoom,null,null,null);g.destroy(),m.destroy()}xI.disabled=new xI(!1,1029,bI),xI.backCCW=new xI(!0,1029,bI),xI.frontCCW=new xI(!0,1028,bI);const TI=Ja(new Float32Array(16));function PI(e,t,r,i,n,a){let{horizontalAlign:o,verticalAlign:s}=xv(e),l=-(s-.5)*r;return new $a((-(o-.5)*t/n+i[0])*a,(l/n+i[1])*a)}function EI(e,t,r,i,n,a){let o=t.tileAnchorPoint.add(new $a(t.translation[0],t.translation[1]));if(t.pitchWithMap){let e=i.mult(a);r||(e=e.rotate(-n));let s=o.add(e);return UP(s.x,s.y,t.pitchedLabelPlaneMatrix,NP(t,s.x,s.y)).point}if(r){let r=KP(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),n=Math.atan(r.y/r.x)+(r.x<0?Math.PI:0);return e.add(i.rotate(n))}return e.add(i)}function DI(e,t,r,i,n,a,o,s,l,u,c,h,d){let p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let m=0;m<p.length;m++){let y=p.get(m),_=e.allowVerticalPlacement&&!y.placedOrientation,v=y.hidden||!y.crossTileID||_?null:i[y.crossTileID];if(v){let i=new $a(y.anchorX,y.anchorY),p={getElevation:h,heightOffset:y.heightOffset,heightAnchorGround:d,width:n.width,height:n.height,pitchedLabelPlaneMatrix:a,lineVertexArray:null,pitchWithMap:r,transform:n,projectionCache:null,tileAnchorPoint:i,translation:u,unwrappedTileID:c},m=r?JP(i.x,i.y,p):KP(i.x,i.y,p),_=VP(n.cameraToCenterDistance,m.signedDistanceFromCamera),b=Ov(e.textSizeData,s,y)*_/24;r&&(b*=e.tilePixelRatio/o);let{width:x,height:w,anchor:S,textOffset:T,textBoxScale:P}=v,E=PI(S,x,w,T,P,b),D=n.getPitchedTextCorrection(i.x+u[0],i.y+u[1],c),A=EI(m.point,p,t,E,-n.bearingInRadians,D),I=e.allowVerticalPlacement&&2===y.placedOrientation?Math.PI/2:0;for(let e=0;e<y.numGlyphs;e++)gb(f,A,I);l&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:A,angle:I})}else iE(y.numGlyphs,f)}if(l){m.clear();let t=e.icon.placedSymbolArray;for(let e=0;e<t.length;e++){let r=t.get(e);if(r.hidden)iE(r.numGlyphs,m);else{let t=g[e];if(t)for(let e=0;e<r.numGlyphs;e++)gb(m,t.shiftedAnchor,t.angle);else iE(r.numGlyphs,m)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function AI(e,t,r){return r.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function II(e,t,r,i,n,a,o,s,l,u,c,h,d){let p=e.context,f=p.gl,m=e.transform,g="map"===s,y="map"===l,_="viewport"!==s&&"point"!==r.layout.get("symbol-placement"),v=g&&!y&&!_,b=!r.layout.get("symbol-sort-key").isConstant(),x=!1,w=e.getDepthModeForSublayer(0,yI.ReadOnly),S=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),T=[],P=m.getCircleRadiusCorrection();for(let s of i){let i=t.getTile(s),l=i.getBucket(r);if(!l)continue;let c=n?l.text:l.icon;if(!c?.segments.get().length||!c.hasVisibleVertices)continue;let h,p,w,E,D=c.programConfigurations.get(r.id),A=n||l.sdfIcons,I=n?l.textSizeData:l.iconSizeData,C=y||0!==m.pitch,k=e.useProgram(AI(A,n,l),D),M=Bv(I,m.zoom),F=e.style.map.terrain?.getTerrainData(s),R=[0,0],L=null;if(n){if(p=i.glyphAtlasTexture,w=f.LINEAR,h=i.glyphAtlasTexture.size,l.iconsInText){R=i.imageAtlasTexture.size,L=i.imageAtlasTexture;let t="composite"===I.kind||"camera"===I.kind;E=C||e.options.rotating||e.options.zooming||t?f.LINEAR:f.NEAREST}}else{let t=1!==r.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;p=i.imageAtlasTexture,w=A||e.options.rotating||e.options.zooming||t||C?f.LINEAR:f.NEAREST,h=i.imageAtlasTexture.size}let z=Bo(i,1,e.transform.zoom),O=OP(g,e.transform,z),B=BP(y,g,e.transform,z),j=qo(m,i,a,o),N=m.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!d,applyTerrainMatrix:!0}),U=S&&l.hasTextData(),V="none"!==r.layout.get("icon-text-fit")&&U&&l.hasIconData(),$=r._unevaluatedLayout.hasValue("icon-offset"),G="ground"===r.layout.get("symbol-height-anchor");if(_){let t=Ka();LP(t,O);let i=e.style.map.terrain?(t,r)=>e.style.map.terrain.getElevation(s,t,r):void 0;GP(l,e,n,O,t,y,u,"map"===r.layout.get("text-rotation-alignment"),s.toUnwrapped(),m.width,m.height,j,i)}let q,Z=n&&S||V,W=y?O:e.transform.clipSpaceToPixelsMatrix,H=_||Z?TI:W,X=A&&0!==r.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1);q=A?l.iconsInText?wA(I.kind,M,v,y,_,Z,e,H,B,j,h,R,P,$,G):xA(I.kind,M,v,y,_,Z,e,H,B,j,n,h,X,P,$,G):bA(I.kind,M,v,y,_,Z,0,H,B,j,n,h,P,$,G);let K={program:k,buffers:c,uniformValues:q,projectionData:N,atlasTexture:p,atlasTextureIcon:L,atlasInterpolation:w,atlasInterpolationIcon:E,isSDF:A,hasHalo:X};if(b&&l.canOverlap){x=!0;let e=c.segments.get();for(let t of e)T.push({segments:new bf([t]),sortKey:t.sortKey,state:K,terrainData:F})}else T.push({segments:c.segments,sortKey:0,state:K,terrainData:F})}x&&T.sort((e,t)=>e.sortKey-t.sortKey);let E=r.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,D=24*r.layout.get("text-letter-spacing").constantOr(0)<0||E>1;for(let t of T){let i=t.state;p.activeTexture.set(f.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,f.CLAMP_TO_EDGE),i.atlasTextureIcon&&(p.activeTexture.set(f.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,f.CLAMP_TO_EDGE));let n=i.isSDF&&i.hasHalo;if(n){let n=i.uniformValues;n.u_is_halo=1,D&&(n.u_is_plain=0,CI(i.buffers,t.segments,r,e,i.program,w,c,h,n,i.projectionData,t.terrainData),n.u_is_halo=0,n.u_is_plain=1)}CI(i.buffers,t.segments,r,e,i.program,w,c,h,i.uniformValues,i.projectionData,t.terrainData),n&&!D&&(i.uniformValues.u_is_halo=0)}}function CI(e,t,r,i,n,a,o,s,l,u,c){let h=i.context,d=h.gl;n.draw(h,d.TRIANGLES,a,o,s,xI.backCCW,l,c,u,r.id,e.layoutVertexBuffer,e.indexBuffer,t,r.paint,i.transform.zoom,e.programConfigurations.get(r.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function kI(e,t,r,i,n){let a=e.context,o=a.gl,s=vI.disabled,l=new mI([o.ONE,o.ONE],Hl.transparent,[!0,!0,!0,!0]),u=t.getBucket(r);if(!u)return;let c=i.key,h=r.heatmapFbos.get(c);h||(h=FI(a,t.tileSize,t.tileSize),r.heatmapFbos.set(c,h)),a.bindFramebuffer.set(h.framebuffer),a.viewport.set([0,0,t.tileSize,t.tileSize]),a.clear({color:Hl.transparent});let d=u.programConfigurations.get(r.id),p=e.useProgram("heatmap",d,!n),f=e.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),m=e.style.map.terrain.getTerrainData(i);p.draw(a,o.TRIANGLES,yI.disabled,s,l,xI.disabled,sA(t,e.transform.zoom,r.paint.get("heatmap-intensity"),1),m,f,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,d)}function MI(e,t,r,i,n){let a=e.context,o=a.gl,s=e.transform;a.setColorMode(e.colorModeForRenderPass());let l=RI(a,t),u=r.key,c=t.heatmapFbos.get(u);if(!c)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,c.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),l.bind(o.LINEAR,o.CLAMP_TO_EDGE);let h=s.getProjectionData({overscaledTileID:r,applyTerrainMatrix:n,applyGlobeMatrix:!i});e.useProgram("heatmapTexture").draw(a,o.TRIANGLES,yI.disabled,vI.disabled,e.colorModeForRenderPass(),xI.disabled,lA(e,t,0,1),null,h,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),c.destroy(),t.heatmapFbos.delete(u)}function FI(e,t,r){let i=e.gl,n=i.createTexture();i.bindTexture(i.TEXTURE_2D,n),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),i.texStorage2D(i.TEXTURE_2D,1,i.RGBA16F,t,r);let a=e.createFramebuffer(t,r,!1,!1);return a.colorAttachment.set(n),a}function RI(e,t){return t.colorRampTexture||=new Km(e,t.colorRamp,e.gl.RGBA),t.colorRampTexture}function LI(e,t,r,i){let n=e.context,a=n.bindFramebuffer.get(),o=n.viewport.get(),[,,s,l]=o;return function(e,t,r){let i=e.context.gl;if(!e.layerOpacityFbo){let n=e.context.createFramebuffer(t,r,!0,!0),a=i.createTexture();return i.bindTexture(i.TEXTURE_2D,a),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),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,t,r,0,i.RGBA,i.UNSIGNED_BYTE,null),n.colorAttachment.set(a),n.depthAttachment.set(e.context.createRenderbuffer(i.DEPTH_STENCIL,t,r)),e.layerOpacityFbo=n,void e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer)}if(e.layerOpacityFbo.width===t&&e.layerOpacityFbo.height===r)return void e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);let n=e.layerOpacityFbo;i.bindTexture(i.TEXTURE_2D,n.colorAttachment.get()),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,t,r,0,i.RGBA,i.UNSIGNED_BYTE,null),e.context.bindRenderbuffer.set(n.depthAttachment.get()),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,t,r),e.context.bindRenderbuffer.set(null),n.width=t,n.height=r,e.context.bindFramebuffer.set(n.framebuffer)}(e,s,l),n.viewport.set([0,0,s,l]),n.clear({color:Hl.transparent,depth:1,stencil:0}),e.currentStencilSource=void 0,e.renderTileClippingMasks(t,r,i),{compositeTarget:a,compositeViewport:o}}function zI(e,t,r,i){let n=e.context,a=n.gl;n.bindFramebuffer.set(r.compositeTarget),n.viewport.set(r.compositeViewport),n.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,e.layerOpacityFbo.colorAttachment.get()),e.useProgram("layerOpacity").draw(n,a.TRIANGLES,yI.disabled,vI.disabled,e.colorModeForRenderPass(),xI.disabled,(e=>({u_image:0,u_opacity:e}))(t),null,null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom),e.currentStencilSource=void 0}function OI(e,t,r,i,n,a,o,s){let l=256;if(n.stepInterpolant){let i=t.getSource().maxzoom,n=o.canonical.z===i?Math.ceil(1<<e.transform.maxZoom-o.canonical.z):1;l=ns(function(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)}(a.maxLineLength/8192*1024*n),256,r.maxTextureSize)}return s.gradient=Vm({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:s.gradient||void 0,clips:a.lineClipsArray}),s.texture?s.texture.update(s.gradient):s.texture=new Km(r,s.gradient,i.RGBA),s.version=n.gradientVersion,s.texture}function BI(e,t,r,i,n){e.activeTexture.set(t.TEXTURE0),r.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),i.updatePaintBuffers(n)}function jI(e,t,r,i,n,a){(n||e.lineAtlas.dirty)&&(t.activeTexture.set(r.TEXTURE0),e.lineAtlas.bind(t)),i.updatePaintBuffers(a)}function NI(e,t,r,i,n,a,o){let s=a.gradients[n.id],l=s.texture;n.gradientVersion!==s.version&&(l=OI(e,t,r,i,n,a,o,s)),r.activeTexture.set(i.TEXTURE0),l.bind(n.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE)}function UI(e,t,r,i,n,a,o,s,l){let u=a.gradients[n.id],c=u.texture;n.gradientVersion!==u.version&&(c=OI(e,t,r,i,n,a,o,u)),r.activeTexture.set(i.TEXTURE0),c.bind(n.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE),r.activeTexture.set(i.TEXTURE1),e.lineAtlas.bind(r),s.updatePaintBuffers(l)}function VI(e,t,r,i,n,a){let o,{isRenderingToTexture:s}=n,l=e.getDepthModeForSublayer(0,yI.ReadOnly),u=e.colorModeForRenderPass(),c=r.paint.get("line-dasharray"),h=c.constantOr(1),d=r.paint.get("line-pattern"),p=d.constantOr(1),f=r.paint.get("line-gradient"),m=r.getCrossfadeParameters();o=p?"linePattern":h&&f?"lineGradientSDF":h?"lineSDF":f?"lineGradient":"line";let g=e.context,y=g.gl,_=e.transform,v=!0;for(let n of i){let i=t.getTile(n);if(p&&!i.patternsLoaded())continue;let b=i.getBucket(r);if(!b)continue;let x=b.programConfigurations.get(r.id),w=e.context.program.get(),S=e.useProgram(o,x),T=v||S.program!==w,P=a?e.getTerrainDataForTile(n,s):null,E=d.constantOr(null),D=c?.constantOr(null);if(E&&i.imageAtlas){let e=i.imageAtlas,t=e.patternPositions[E.to.toString()],r=e.patternPositions[E.from.toString()];t&&r&&x.setConstantPatternPositions(t,r)}else if(D){let t="round"===r.layout.get("line-cap").constantOr(null),i=e.lineAtlas.getDash(D.to,t),n=e.lineAtlas.getDash(D.from,t);x.setConstantDashPositions(i,n)}let A,I=_.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),C=_.getPixelScale();p?(A=mA(e,i,r,C,m),BI(g,y,i,x,m)):h&&f?(A=yA(e,i,r,C,m,b.lineClipsArray.length),UI(e,t,g,y,r,b,n,x,m)):h?(A=gA(e,i,r,C,m),jI(e,g,y,x,T,m)):f?(A=fA(e,i,r,C,b.lineClipsArray.length),NI(e,t,g,y,r,b,n)):A=pA(e,i,r,C);let k=e.stencilModeForClipping(n);S.draw(g,y.TRIANGLES,l,k,u,xI.disabled,A,P,I,r.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,r.paint,e.transform.zoom,x,b.layoutVertexBuffer2),v=!1}}function $I(e,t,r,i,n){if(!r||!i?.imageAtlas)return;let a=i.imageAtlas.patternPositions,o=a[r.to.toString()],s=a[r.from.toString()];if(!o&&s&&(o=s),!s&&o&&(s=o),!o||!s){let e=n.getPaintProperty(t);o=a[e],s=a[e]}o&&s&&e.setConstantPatternPositions(o,s)}function GI(e,t,r,i,n){let{isRenderingToTexture:a}=n,o=e.colorModeForRenderPass();ZI(e,t,r,i,e.getDepthModeForSublayer(1,yI.ReadOnly),o,!1,a),qI(e,t,r,i,n)}function qI(e,t,r,i,n){if(!r.paint.get("fill-antialias"))return;let{isRenderingToTexture:a}=n,o=e.colorModeForRenderPass();ZI(e,t,r,i,e.getDepthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,yI.ReadOnly),o,!0,a)}function ZI(e,t,r,i,n,a,o,s){let l,u,c,h,d,p=e.context.gl,f="fill-pattern",m=r.paint.get(f),g=m?.constantOr(1),y=r.getCrossfadeParameters(),_=e.transform,v=r.paint.get("fill-translate"),b=r.paint.get("fill-translate-anchor");o?(u=g&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",l=p.LINES):(u=g?"fillPattern":"fill",l=p.TRIANGLES);let x=m.constantOr(null);for(let m of i){let i=t.getTile(m);if(g&&!i.patternsLoaded())continue;let w=i.getBucket(r);if(!w)continue;let S=w.sdfPatterns[r.id]??!1,T=w.programConfigurations.get(r.id),P=e.useProgram(u,T),E=e.getTerrainDataForTile(m,s);g&&(e.context.activeTexture.set(p.TEXTURE0),i.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),T.updatePaintBuffers(y)),$I(T,f,x,i,r);let D=_.getProjectionData({overscaledTileID:m,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),A=qo(_,i,v,b);o?(h=w.indexBuffer2,d=w.segments2,c="fillOutlinePattern"===u&&g?nA(e,y,i,A,S):iA(A)):(h=w.indexBuffer,d=w.segments,c=g?tA(e,y,i,A,S):rA(A));let I=e.stencilModeForClipping(m);P.draw(e.context,l,n,I,a,xI.backCCW,c,E,D,r.id,w.layoutVertexBuffer,h,d,r.paint,e.transform.zoom,T)}}function WI(e,t,r,i,n,a,o,s){let l=e.context,u=l.gl,c="fill-extrusion-pattern",h=r.paint.get(c),d=h.constantOr(1),p=r.getCrossfadeParameters(),f=r.paint.get("fill-extrusion-opacity"),m=h.constantOr(null),g=e.transform;for(let h of i){let i=t.getTile(h),y=i.getBucket(r);if(!y)continue;let _=e.style.map.terrain?.getTerrainData(h),v=y.programConfigurations.get(r.id),b=e.useProgram(d?"fillExtrusionPattern":"fillExtrusion",v);d&&(e.context.activeTexture.set(u.TEXTURE0),i.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),v.updatePaintBuffers(p));let x=g.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!s,applyTerrainMatrix:!0});$I(v,c,m,i,r);let w=qo(g,i,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),S=r.paint.get("fill-extrusion-vertical-gradient"),T=d?eA(e,S,f,w,h,p,i):QD(e,S,f,w);b.draw(l,l.gl.TRIANGLES,n,a,o,xI.backCCW,T,_,x,r.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,r.paint,e.transform.zoom,v,e.style.map.terrain&&y.centroidVertexBuffer)}}function HI(e,t,r,i,n,a,o,s,l){let u=e.style.projection,c=e.context,h=e.transform,d=c.gl,p=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],f=e.useProgram("hillshade",null,!1,p),m=!e.options.moving;for(let p of i){let i=t.getTile(p),g=i.fbo;if(!g)continue;let y=u.getMeshFromTileID(c,p.canonical,s,!0,"raster"),_=e.getTerrainDataForTile(p,l);c.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,g.colorAttachment.get());let v=h.getProjectionData({overscaledTileID:p,aligned:m,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(c,d.TRIANGLES,a,n[p.overscaledZ],o,xI.backCCW,uA(e,i,r),_,v,r.id,y.vertexBuffer,y.indexBuffer,y.segments)}}let XI=0;function KI(e,t,r,i,n,a,o,s,l){let u=e.style.projection,c=e.context,h=e.transform,d=c.gl,p=e.useProgram("colorRelief"),f=!e.options.moving,m="nearest"===r.paint.get("resampling")?d.NEAREST:d.LINEAR,g=!0,y=0;for(let _ of i){let i=t.getTile(_),v=i.dem;if(!v?.data)continue;if(g){XI||=d.getParameter(d.MAX_TEXTURE_SIZE);let e=XI,{elevationTexture:t,colorTexture:i}=r.getColorRampTextures(c,e,v.getUnpackVector());c.activeTexture.set(d.TEXTURE1),t.bind(d.NEAREST,d.CLAMP_TO_EDGE),c.activeTexture.set(d.TEXTURE4),i.bind(d.LINEAR,d.CLAMP_TO_EDGE),g=!1,y=t.size[0]}let b=v.stride;c.activeTexture.set(d.TEXTURE0),(!i.demTexture||i.needsColorReliefPrepare)&&(c.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture||=e.getTileTexture(b)??new Km(c,{width:b,height:b,data:null},d.RGBA),i.demTexture.update(v.getPixels(),{premultiply:!1}),i.needsColorReliefPrepare=!1),i.demTexture.bind(m,d.CLAMP_TO_EDGE);let x=u.getMeshFromTileID(c,_.canonical,s,!0,"raster"),w=e.getTerrainDataForTile(_,l),S=h.getProjectionData({overscaledTileID:_,aligned:f,applyGlobeMatrix:!l,applyTerrainMatrix:!0});p.draw(c,d.TRIANGLES,a,n[_.overscaledZ],o,xI.backCCW,dA(r,i.dem,y),w,S,r.id,x.vertexBuffer,x.indexBuffer,x.segments)}}const YI=[new $a(0,0),new $a(8192,0),new $a(8192,8192),new $a(0,8192)];function JI(e,t,r,i,n,a,o,s,l,u=!1,c=!1,h=null){let d=i[i.length-1].overscaledZ,p=e.context,f=p.gl,m=e.useProgram("raster"),g=e.transform,y=e.style.projection,_=e.colorModeForRenderPass(),v=!e.options.moving,b=r.paint.get("raster-opacity"),x="nearest"===r.paint.get("resampling")||"nearest"===r.paint.get("raster-resampling")?f.NEAREST:f.LINEAR,w=r.paint.get("raster-fade-duration"),S=!!e.style.map.terrain;for(let T of i){let i=e.getDepthModeForSublayer(T.overscaledZ-d,1===b?yI.ReadWrite:yI.ReadOnly,f.LESS),P=t.getTile(T);p.activeTexture.set(f.TEXTURE0),P.texture.bind(x,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(f.TEXTURE1);let{parentTile:E,parentScaleBy:D,parentTopLeft:A,fadeValues:I}=QI(P,t,w,S);P.fadeOpacity=I.tileOpacity,E?(E.fadeOpacity=I.parentTileOpacity,E.texture.bind(x,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)):P.texture.bind(x,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),P.texture.useMipmap&&p.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&f.texParameterf(f.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let C=e.getTerrainDataForTile(T,c),k=g.getProjectionData({overscaledTileID:T,aligned:v,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),M=KT(A,D,I.fadeMix,r,s,l),F=h??y.getMeshFromTileID(p,T.canonical,a,o,"raster"),R=n?n[T.overscaledZ]:vI.disabled;m.draw(p,f.TRIANGLES,i,R,_,u?xI.frontCCW:xI.backCCW,M,C,k,r.id,F.vertexBuffer,F.indexBuffer,F.segments)}}function QI(e,t,r,i){let n={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(0===r||i)return n;if(e.fadingParentID){let i=t.getLoadedTile(e.fadingParentID);if(!i)return n;let a=2**(i.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:i,parentScaleBy:a,parentTopLeft:[e.tileID.canonical.x*a%1,e.tileID.canonical.y*a%1],fadeValues:eC(e,i,r)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:tC(e,r)}:n}function eC(e,t,r){let i=PS(),n=(i-e.timeAdded)/r,a=(i-t.timeAdded)/r,o=1===e.fadingDirection,s=ns(n,0,1),l=ns(1-a,0,1),u=o?s:l;return{tileOpacity:u,parentTileOpacity:o?l:s,fadeMix:{opacity:1,mix:1-u}}}function tC(e,t){let r=ns((PS()-e.timeAdded)/t,0,1);return{tileOpacity:r,fadeMix:{opacity:r,mix:0}}}const rC=new Hl(1,0,0,1),iC=new Hl(0,1,0,1),nC=new Hl(0,0,1,1),aC=new Hl(1,0,1,1),oC=new Hl(0,1,1,1);function sC(e,t,r,i){uC(e,0,t+r/2,e.transform.width,r,i)}function lC(e,t,r,i){uC(e,t-r/2,0,r,e.transform.height,i)}function uC(e,t,r,i,n,a){let o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio,n*e.pixelRatio),o.clear({color:a}),s.disable(s.SCISSOR_TEST)}function cC(e,t,r){let i=e.context,n=i.gl,a=e.useProgram("debug"),o=yI.disabled,s=vI.disabled,l=e.colorModeForRenderPass(),u="$debug",c=e.style.map.terrain?.getTerrainData(r);i.activeTexture.set(n.TEXTURE0);let h=t.getTileByID(r.key).latestRawTileData?.byteLength||0,d=Math.floor(h/1024),p=t.getTile(r).tileSize,f=512/Math.min(p,512)*(r.overscaledZ/e.transform.zoom)*.5,m=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(m+=` => ${r.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();let r=e.debugOverlayCanvas,i=e.context.gl,n=e.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,r.width,r.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(t,5,5),n.strokeText(t,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}(e,`${m} ${d}kB`);let g=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});a.draw(i,n.TRIANGLES,o,s,mI.alphaBlended,xI.disabled,oA(Hl.transparent,f),null,g,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),a.draw(i,n.LINE_STRIP,o,s,l,xI.disabled,oA(Hl.red),c,g,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function hC(e,t){if(!t.mesh){let r=new Yp;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let i=new mf;i.emplaceBack(0,1,2),i.emplaceBack(0,2,3),t.mesh=new eP(e.createVertexBuffer(r,tP.members),e.createIndexBuffer(i),bf.simpleSegment(0,0,r.length,i.length))}return t.mesh}const dC={symbol:function(e,t,r,i,n,a){if("translucent"!==a.currentPass)return;let{isRenderingToTexture:o}=a,s=vI.disabled,l=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(e,t,r,i,n,a,o,s,l){let u=t.transform,c=t.style.map.terrain,h="map"===n,d="map"===a;for(let n of e){let e=i.getTile(n),a=e.getBucket(r);if(!a?.text?.segments.get().length)continue;let p=Bv(a.textSizeData,u.zoom),f=Bo(e,1,t.transform.zoom),m=OP(h,t.transform,f),g="none"!==r.layout.get("icon-text-fit")&&a.hasIconData();if(p){let t=2**(u.zoom-e.tileID.overscaledZ),i=c?(e,t)=>c.getElevation(n,e,t):void 0;DI(a,h,d,l,u,m,t,p,g,qo(u,e,o,s),n.toUnwrapped(),i,"ground"===r.layout.get("symbol-height-anchor"))}}}(i,e,r,t,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),n),0!==r.paint.get("icon-opacity").constantOr(1)&&II(e,t,r,i,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment").constantOr("viewport"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),s,l,o),0!==r.paint.get("text-opacity").constantOr(1)&&II(e,t,r,i,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),s,l,o),t.map.showCollisionBoxes&&(SI(e,t,r,i,!0),SI(e,t,r,i,!1))},circle:function(e,t,r,i,n){if("translucent"!==n.currentPass)return;let{isRenderingToTexture:a}=n,o=r.paint.get("circle-opacity"),s=r.paint.get("circle-stroke-width"),l=r.paint.get("circle-stroke-opacity"),u=!r.layout.get("circle-sort-key").isConstant();if(0===o.constantOr(1)&&(0===s.constantOr(1)||0===l.constantOr(1)))return;let c=e.context,h=c.gl,d=e.transform,p=e.getDepthModeForSublayer(0,yI.ReadOnly),f=vI.disabled,m=e.colorModeForRenderPass(),g=[],y=d.getCircleRadiusCorrection();for(let n of i){let i=t.getTile(n),o=i.getBucket(r);if(!o)continue;let s=qo(d,i,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),l=o.programConfigurations.get(r.id),c=e.useProgram("circle",l),h=o.layoutVertexBuffer,p=o.indexBuffer,f=e.style.map.terrain?.getTerrainData(n),m={programConfiguration:l,program:c,layoutVertexBuffer:h,indexBuffer:p,uniformValues:aA(e,i,r,s,y),terrainData:f,projectionData:d.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!a,applyTerrainMatrix:!0})};if(u){let e=o.segments.get();for(let t of e)g.push({segments:new bf([t]),sortKey:t.sortKey,state:m})}else g.push({segments:o.segments,sortKey:0,state:m})}u&&g.sort((e,t)=>e.sortKey-t.sortKey);for(let t of g){let{programConfiguration:i,program:n,layoutVertexBuffer:a,indexBuffer:o,uniformValues:s,terrainData:l,projectionData:u}=t.state,d=t.segments;n.draw(c,h.TRIANGLES,p,f,m,xI.backCCW,s,l,u,r.id,a,o,d,r.paint,e.transform.zoom,i)}},heatmap:function(e,t,r,i,n){if(0===r.paint.get("heatmap-opacity"))return;let a=e.context,{isRenderingToTexture:o,isRenderingGlobe:s}=n;if(e.style.map.terrain){for(let a of i){let i=t.getTile(a);t.hasRenderableParent(a)||("offscreen"===n.currentPass?kI(e,i,r,a,s):"translucent"===n.currentPass&&MI(e,r,a,o,s))}a.viewport.set([0,0,e.width,e.height])}else"offscreen"===n.currentPass?function(e,t,r,i){let n=e.context,a=n.gl,o=e.transform,s=vI.disabled,l=new mI([a.ONE,a.ONE],Hl.transparent,[!0,!0,!0,!0]);(function(e,t,r){let i=e.gl;e.activeTexture.set(i.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let n=r.heatmapFbos.get("big-fb");n?(i.bindTexture(i.TEXTURE_2D,n.colorAttachment.get()),e.bindFramebuffer.set(n.framebuffer)):(n=FI(e,t.width/4,t.height/4),r.heatmapFbos.set("big-fb",n))})(n,e,r),n.clear({color:Hl.transparent});for(let u of i){if(t.hasRenderableParent(u))continue;let i=t.getTile(u),c=i.getBucket(r);if(!c)continue;let h=c.programConfigurations.get(r.id),d=e.useProgram("heatmap",h),p=o.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),f=o.getCircleRadiusCorrection();d.draw(n,a.TRIANGLES,yI.disabled,s,l,xI.backCCW,sA(i,o.zoom,r.paint.get("heatmap-intensity"),f),null,p,r.id,c.layoutVertexBuffer,c.indexBuffer,c.segments,r.paint,o.zoom,h)}n.viewport.set([0,0,e.width,e.height])}(e,t,r,i):"translucent"===n.currentPass&&function(e,t){let r=e.context,i=r.gl;r.setColorMode(e.colorModeForRenderPass());let n=t.heatmapFbos.get("big-fb");n&&(r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,n.colorAttachment.get()),r.activeTexture.set(i.TEXTURE1),RI(r,t).bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,i.TRIANGLES,yI.disabled,vI.disabled,e.colorModeForRenderPass(),xI.disabled,lA(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}(e,r)},line:function(e,t,r,i,n){if("translucent"!==n.currentPass)return;let a=r.paint.get("line-opacity"),o=r.paint.get("line-width"),s=r.paint.get("line-layer-opacity");if(0===a.constantOr(1)||0===o.constantOr(1)||0===s)return;let l=!!e.style.map.terrain;if(s<1){let a=LI(e,r,i,l);return VI(e,t,r,i,n,l),void zI(e,s,a,r)}VI(e,t,r,i,n,l)},fill:function(e,t,r,i,n){let a=r.paint.get("fill-color"),o=r.paint.get("fill-opacity"),s=r.paint.get("fill-layer-opacity");if(0===o.constantOr(1)||0===s)return;if(s<1){if("translucent"!==n.currentPass)return;let a=LI(e,r,i,!!e.style.map.terrain);return GI(e,t,r,i,n),void zI(e,s,a,r)}let l=r.paint.get("fill-pattern"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&1===a.constantOr(Hl.transparent).a&&1===o.constantOr(0);if(u&&"opaque"===n.currentPass){let{isRenderingToTexture:a}=n,o=e.colorModeForRenderPass();return void ZI(e,t,r,i,e.getDepthModeForSublayer(1,yI.ReadWrite),o,!1,a)}u&&"translucent"===n.currentPass?qI(e,t,r,i,n):"translucent"===n.currentPass&&GI(e,t,r,i,n)},fillExtrusion:function(e,t,r,i,n){let a=r.paint.get("fill-extrusion-opacity");if(0===a)return;let{isRenderingToTexture:o}=n;if("translucent"===n.currentPass){let s=new yI(e.context.gl.LEQUAL,yI.ReadWrite,n.depthRangeFor3D);if(1!==a||r.paint.get("fill-extrusion-pattern").constantOr(1))WI(e,t,r,i,s,vI.disabled,mI.disabled,o),WI(e,t,r,i,s,e.stencilModeFor3D(),e.colorModeForRenderPass(),o);else{let n=e.colorModeForRenderPass();WI(e,t,r,i,s,vI.disabled,n,o)}}},hillshade:function(e,t,r,i,n){if("offscreen"!==n.currentPass&&"translucent"!==n.currentPass)return;let{isRenderingToTexture:a}=n,o=e.context,s=e.style.projection.useSubdivision,l=e.getDepthModeForSublayer(0,yI.ReadOnly),u=e.colorModeForRenderPass();if("offscreen"===n.currentPass)(function(e,t,r,i,n,a,o){let s=e.context,l=s.gl,u="nearest"===i.paint.get("resampling")?l.NEAREST:l.LINEAR;for(let c of r){let r=t.getTile(c),h=r.dem;if(!h?.data||!r.needsHillshadePrepare)continue;let d=h.dim+2,p=h.stride,f=h.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture||=e.getTileTexture(p),r.demTexture){let e=r.demTexture;e.update(f,{premultiply:!1}),e.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else r.demTexture=new Km(s,f,l.RGBA,{premultiply:!1}),r.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let m=r.fbo;if(!m){let e=new Km(s,{width:d,height:d,data:null},l.RGBA);e.bind(u,l.CLAMP_TO_EDGE),m=r.fbo=s.createFramebuffer(d,d,!0,!1),m.colorAttachment.set(e.texture)}s.bindFramebuffer.set(m.framebuffer),s.viewport.set([0,0,d,d]),e.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,n,a,o,xI.disabled,cA(r.tileID,h),null,null,i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),r.needsHillshadePrepare=!1}})(e,t,i,r,l,vI.disabled,u),o.viewport.set([0,0,e.width,e.height]);else if("translucent"===n.currentPass)if(s){let[n,o,s]=e.stencilConfigForOverlapTwoPass(i);HI(e,t,r,s,n,l,u,!1,a),HI(e,t,r,s,o,l,u,!0,a)}else{let[n,o]=e.getStencilConfigForOverlapAndUpdateStencilID(i);HI(e,t,r,o,n,l,u,!1,a)}},colorRelief:function(e,t,r,i,n){if("translucent"!==n.currentPass||!i.length)return;let{isRenderingToTexture:a}=n,o=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,yI.ReadOnly),l=e.colorModeForRenderPass();if(o){let[n,o,u]=e.stencilConfigForOverlapTwoPass(i);KI(e,t,r,u,n,s,l,!1,a),KI(e,t,r,u,o,s,l,!0,a)}else{let[n,o]=e.getStencilConfigForOverlapAndUpdateStencilID(i);KI(e,t,r,o,n,s,l,!1,a)}},raster:function(e,t,r,i,n){if("translucent"!==n.currentPass||0===r.paint.get("raster-opacity")||!i.length)return;let{isRenderingToTexture:a}=n,o=t.getSource(),s=e.style.projection.useSubdivision;if(o instanceof iP)JI(e,t,r,i,null,!1,!1,o.tileCoords,o.imageWarp,o.flippedWindingOrder,a,o.getMesh(e.context,s));else if(s){let[n,o,s]=e.stencilConfigForOverlapTwoPass(i);JI(e,t,r,s,n,!1,!0,YI,XT,!1,a),JI(e,t,r,s,o,!0,!0,YI,XT,!1,a)}else{let[n,o]=e.getStencilConfigForOverlapAndUpdateStencilID(i);JI(e,t,r,o,n,!1,!0,YI,XT,!1,a)}},background:function(e,t,r,i,n){let a=r.paint.get("background-color"),o=r.paint.get("background-opacity");if(0===o)return;let{isRenderingToTexture:s}=n,l=e.context,u=l.gl,c=e.style.projection,h=e.transform,d=h.tileSize,p=r.paint.get("background-pattern");if(e.isPatternMissing(p))return;let f=!p&&1===a.a&&1===o&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(n.currentPass!==f)return;let m=vI.disabled,g=e.getDepthModeForSublayer(0,"opaque"===f?yI.ReadWrite:yI.ReadOnly),y=e.colorModeForRenderPass(),_=e.useProgram(p?"backgroundPattern":"background"),v=i||wP(h,{tileSize:d,terrain:e.style.map.terrain});p&&(l.activeTexture.set(u.TEXTURE0),e.patternAtlas.bind(e.context));let b=r.getCrossfadeParameters();for(let t of v){let i=h.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),n=p?TA(o,e,p,{tileID:t,tileSize:d},b):SA(o,a),f=e.getTerrainDataForTile(t,s),v=c.getMeshFromTileID(l,t.canonical,!1,!0,"raster");_.draw(l,u.TRIANGLES,g,m,y,xI.backCCW,n,f,i,r.id,v.vertexBuffer,v.indexBuffer,v.segments)}},sky:function(e,t){let r=e.context,i=r.gl,n=((e,t,r)=>{let i=Math.cos(t.rollInRadians),n=Math.sin(t.rollInRadians),a=ky(t),o=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(t.width/2-a*n)*r,(t.height/2+a*i)*r],u_horizon_normal:[-n,i],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*t.height/2*r,u_sky_blend:o,u_inv_proj_matrix:t.inverseProjectionMatrix,u_globe_position:mD(t),u_globe_radius:fD(t.worldSize,t.center.lat)}})(t,e.transform,e.pixelRatio),a=new yI(i.LEQUAL,yI.ReadWrite,[0,1]),o=vI.disabled,s=e.colorModeForRenderPass(),l=e.useProgram("sky"),u=hC(r,t);l.draw(r,i.TRIANGLES,a,o,s,xI.disabled,n,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)},atmosphere:function(e,t,r){let i=e.context,n=i.gl,a=e.useProgram("atmosphere"),o=new yI(n.LEQUAL,yI.ReadOnly,[0,1]),s=e.transform,l=function(e,t){let r=e.getCartesianPosition();!function(e,t){e[0]=-t[0],e[1]=-t[1],e[2]=-t[2]}(r,r);let i=Ja(new Float64Array(16));return"map"===e.properties.get("anchor")&&(ao(i,i,t.rollInRadians),io(i,i,-t.pitchInRadians),ao(i,i,t.bearingInRadians),io(i,i,t.center.lat*Math.PI/180),no(i,i,-t.center.lng*Math.PI/180)),function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[3]*i+r[7]*n+r[11]*a+r[15];o||=1,e[0]=(r[0]*i+r[4]*n+r[8]*a+r[12])/o,e[1]=(r[1]*i+r[5]*n+r[9]*a+r[13])/o,e[2]=(r[2]*i+r[6]*n+r[10]*a+r[14])/o}(r,r,i),r}(r,e.transform),u=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),c=t.properties.get("atmosphere-blend")*u.projectionTransition;if(0===c)return;let h=fD(s.worldSize,s.center.lat),d=((e,t,r,i,n)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:r,u_globe_radius:i,u_inv_proj_matrix:n}))(l,c,mD(s),h,s.inverseProjectionMatrix),p=hC(i,t);a.draw(i,n.TRIANGLES,o,vI.disabled,mI.alphaBlended,xI.disabled,d,null,null,"atmosphere",p.vertexBuffer,p.indexBuffer,p.segments)},custom:function(e,t,r,i){let{isRenderingGlobe:n}=i,a=e.context,o=r.implementation,s=e.style.projection,l=e.transform,u=l.getProjectionDataForCustomLayer(n),c={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:u,getProjectionData:e=>l.getProjectionData({overscaledTileID:new Bb(e.tileID.canonical.z,e.tileID.wrap??0,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),aligned:e.aligned,applyGlobeMatrix:e.applyGlobeMatrix,applyTerrainMatrix:e.applyTerrainMatrix})},h=o.renderingMode?o.renderingMode:"2d";if("offscreen"===i.currentPass){let t=o.prerender;t&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),t.call(o,a.gl,c),a.setDirty(),e.setBaseState())}else if("translucent"===i.currentPass){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(vI.disabled);let t="3d"===h?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,yI.ReadOnly);a.setDepthMode(t),o.render(a.gl,c),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}},debug:function(e,t,r){for(let i of r)cC(e,t,i)},debugPadding:function(e){let t=e.transform.padding;sC(e,e.transform.height-(t.top||0),3,rC),sC(e,t.bottom||0,3,iC),lC(e,t.left||0,3,nC),lC(e,e.transform.width-(t.right||0),3,aC);let r=e.transform.centerPoint;!function(e,t,r,i){uC(e,t-1,r-10,2,20,i),uC(e,t-10,r-1,20,2,i)}(e,r.x,e.transform.height-r.y,oC)},terrainDepth:function(e,t){let r=e.context,i=r.gl,n=e.transform,a=mI.unblended,o=new yI(i.LEQUAL,yI.ReadWrite,[0,1]),s=t.tileManager.getRenderableTiles(),l=e.useProgram("terrainDepth");r.bindFramebuffer.set(t.getFramebuffer().framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:Hl.white,depth:1});for(let e of s){let s=t.getTerrainMesh(e.tileID),u=t.getTerrainData(e.tileID),c=n.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),h=UD(t.getSkirtLength(n.zoom));l.draw(r,i.TRIANGLES,o,vI.disabled,a,xI.backCCW,h,u,c,"terrain",s.vertexBuffer,s.indexBuffer,s.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}};var pC=class e{constructor(e,t){this.drawFunctions=dC,this.context=new gI(e),this.transform=t,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:Ja(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=CP.maxOverzooming+CP.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new RE}resize(e,t,r){if(this.width=Math.floor(e*r),this.height=Math.floor(t*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style._order)this.style._layers[e].resize()}setup(){let e=this.context,t=new Yp;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,tP.members),this.tileExtentSegments=bf.simpleSegment(0,0,4,2);let r=new Yp;r.emplaceBack(0,0),r.emplaceBack(8192,0),r.emplaceBack(0,8192),r.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(r,tP.members),this.debugSegments=bf.simpleSegment(0,0,4,5);let i=new Qp;i.emplaceBack(0,0,0,0),i.emplaceBack(8192,0,8192,0),i.emplaceBack(0,8192,0,8192),i.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=e.createVertexBuffer(i,BD.members),this.rasterBoundsSegments=bf.simpleSegment(0,0,4,2);let n=new Yp;n.emplaceBack(0,0),n.emplaceBack(8192,0),n.emplaceBack(0,8192),n.emplaceBack(8192,8192),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(n,tP.members),this.rasterBoundsSegmentsPosOnly=bf.simpleSegment(0,0,4,5);let a=new Yp;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,tP.members),this.viewportSegments=bf.simpleSegment(0,0,4,2);let o=new yf;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(o);let s=new mf;s.emplaceBack(1,0,2),s.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let l=this.context.gl;this.stencilClearMode=new vI({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.tileExtentMesh=new eP(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=Ka();so(r,0,this.width,this.height,0,0,1),ro(r,r,[t.drawingBufferWidth,t.drawingBufferHeight,0]);let i={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r,clipAntimeridian:!1};this.useProgram("clippingMask",null,!0).draw(e,t.TRIANGLES,yI.disabled,this.stencilClearMode,mI.disabled,xI.disabled,null,null,i,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(e,t,r){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t?.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let i=this.context;i.setColorMode(mI.disabled),i.setDepthMode(yI.disabled);let n={};for(let e of t)n[e.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(n,t,r,!0),this._renderTileMasks(n,t,r,!1),this._tileClippingMaskIDs=n}_renderTileMasks(e,t,r,i){let n=this.context,a=n.gl,o=this.style.projection,s=this.transform,l=this.useProgram("clippingMask");for(let u of t){let t=e[u.key],c=this.getTerrainDataForTile(u,r),h=o.getMeshFromTileID(this.context,u.canonical,i,!0,"stencil"),d=s.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!r,applyTerrainMatrix:!0});l.draw(n,a.TRIANGLES,yI.disabled,new vI({func:a.ALWAYS,mask:0},t,255,a.KEEP,a.KEEP,a.REPLACE),mI.disabled,r?xI.disabled:xI.backCCW,null,c,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}getTerrainDataForTile(e,t){return t&&"mercator"===this.style.projection?.name?null:this.style.map.terrain?.getTerrainData(e)||null}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,r=this.style.projection,i=this.transform,n=this.useProgram("depth"),a=this.getDepthModeFor3D(),o=wP(i,{tileSize:i.tileSize});for(let s of o){let o=this.style.map.terrain?.getTerrainData(s),l=r.getMeshFromTileID(this.context,s.canonical,!0,!0,"raster"),u=i.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(e,t.TRIANGLES,a,vI.disabled,mI.disabled,xI.backCCW,null,o,u,"$clipping",l.vertexBuffer,l.indexBuffer,l.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new vI({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new vI({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,r=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let e={};for(let r=0;r<n;r++)e[r+i]=new vI({func:t.GEQUAL,mask:255},r+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=n,[e,r]}return[{[i]:vI.disabled},r]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,r=e.sort((e,t)=>t.overscaledZ-e.overscaledZ),i=r[r.length-1].overscaledZ,n=r[0].overscaledZ-i+1;if(this.clearStencil(),n>1){let e={},a={};for(let r=0;r<n;r++)e[r+i]=new vI({func:t.GREATER,mask:255},n+1+r,255,t.KEEP,t.KEEP,t.REPLACE),a[r+i]=new vI({func:t.GREATER,mask:255},1+r,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*n+1,[e,a,r]}return this.nextStencilID=3,[{[i]:new vI({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[i]:new vI({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},r]}colorModeForRenderPass(){let e=this.context.gl;if(this._showOverdrawInspector){let t=1/8;return new mI([e.CONSTANT_COLOR,e.ONE],new Hl(t,t,t,0),[!0,!0,!0,!0])}return"opaque"===this.renderOptions.currentPass?mI.unblended:mI.alphaBlended}getDepthModeForSublayer(e,t,r){if(!this.opaquePassEnabledForLayer())return yI.disabled;let i=1-((1+this.renderOptions.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new yI(r||this.context.gl.LEQUAL,t,[i,i])}getDepthModeFor3D(){return new yI(this.context.gl.LEQUAL,yI.ReadWrite,this.renderOptions.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.renderOptions.currentLayer<this.renderOptions.opaquePassCutoff}render(e,t){this.style=e,this.options=t;let r=this.renderOptions=function(e,t,r){let i=t?.transitionState??0;return{currentPass:"offscreen",currentLayer:0,opaquePassCutoff:1/0,depthRangeFor3D:[0,1],isRenderingToTexture:!1,transform:e,terrain:r,projectionTransition:i,isRenderingGlobe:i>0}}(this.transform,e.projection,e.map.terrain??null);this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.patternAtlas=e.patternAtlas,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(PS()),function(e,t){let r=e.pending,{transform:i}=t,n=t.context.gl;r[fI.u_units_to_pixels]=1/i.pixelsToGLUnits[0],r[fI.u_units_to_pixels+1]=1/i.pixelsToGLUnits[1],r[fI.u_world_size]=n.drawingBufferWidth,r[fI.u_world_size+1]=n.drawingBufferHeight,r[fI.u_camera_to_center_distance]=i.cameraToCenterDistance,r[fI.u_symbol_fade_change]=t.options.fadeDuration?t.symbolFadeChange:1,r[fI.u_aspect_ratio]=i.width/i.height,r[fI.u_device_pixel_ratio]=t.pixelRatio,r[fI.u_viewport_size]=i.width,r[fI.u_viewport_size+1]=i.height,r[fI.u_pixel_extrude_scale]=1/i.width,r[fI.u_pixel_extrude_scale+1]=1/i.height,r[fI.u_pitch]=i.pitch/360*2*Math.PI,e.upload()}(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let i=this.style._order,n=this.style.tileManagers,a={},o={},s={};for(let e in n){let t=n[e];t.used&&t.prepare(this.context),a[e]=t.getVisibleCoordinates(!1),o[e]=a[e].slice().reverse(),s[e]=t.getVisibleCoordinates(!0).reverse()}r.opaquePassCutoff=1/0;for(let e=0;e<i.length;e++){let t=i[e];if(this.style._layers[t].is3D()){r.opaquePassCutoff=e;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),r.opaquePassCutoff=0),r.currentPass="offscreen";for(let e of i){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let i=o[t.source];("custom"===t.type||i.length)&&this.renderLayer(this,n[t.source],t,i,r)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?Hl.black:Hl.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=t.showOverdrawInspector,r.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(r.currentPass="opaque",r.currentLayer=i.length-1;r.currentLayer>=0;r.currentLayer--){let e=this.style._layers[i[r.currentLayer]];if(e.isHidden(this.transform.zoom))continue;let t=n[e.source],o=a[e.source];this.renderTileClippingMasks(e,o,!1),this.renderLayer(this,t,e,o,r)}r.currentPass="translucent";let l=!1;for(r.currentLayer=0;r.currentLayer<i.length;r.currentLayer++){let e=this.style._layers[i[r.currentLayer]];if(e.isHidden(this.transform.zoom))continue;let t=n[e.source];if(this.renderToTexture?.renderLayer(e,r))continue;!this.opaquePassEnabledForLayer()&&!l&&(l=!0,r.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let u=("symbol"===e.type?s:o)[e.source];this.renderTileClippingMasks(e,a[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,u,r)}if(r.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let e=function(e,t){let r=null,i=Object.values(e._layers).flatMap(r=>r.source&&!r.isHidden(t)?[e.tileManagers[r.source]]:[]),n=i.filter(e=>"vector"===e.getSource().type),a=i.filter(e=>"vector"!==e.getSource().type),o=e=>{(!r||r.getSource().maxzoom<e.getSource().maxzoom)&&(r=e)};for(let e of n)o(e);if(!r)for(let e of a)o(e);return r}(this.style,this.transform.zoom);e&&this.drawFunctions.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(){if(!this.style?.projection||!this.style.map?.terrain)return;let e=this.terrainFacilitator.matrix,t=this.transform.modelViewProjectionMatrix,r=this.terrainFacilitator.depthDirty;r||=!function(e,t){var r=e[0],i=e[1],n=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],y=e[15],_=t[0],v=t[1],b=t[2],x=t[3],w=t[4],S=t[5],T=t[6],P=t[7],E=t[8],D=t[9],A=t[10],I=t[11],C=t[12],k=t[13],M=t[14],F=t[15];return Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(i-v)<=1e-6*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(n-b)<=1e-6*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(a-x)<=1e-6*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(o-w)<=1e-6*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-S)<=1e-6*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(l-T)<=1e-6*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-P)<=1e-6*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(c-E)<=1e-6*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(h-D)<=1e-6*Math.max(1,Math.abs(h),Math.abs(D))&&Math.abs(d-A)<=1e-6*Math.max(1,Math.abs(d),Math.abs(A))&&Math.abs(p-I)<=1e-6*Math.max(1,Math.abs(p),Math.abs(I))&&Math.abs(f-C)<=1e-6*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(m-k)<=1e-6*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(g-M)<=1e-6*Math.max(1,Math.abs(g),Math.abs(M))&&Math.abs(y-F)<=1e-6*Math.max(1,Math.abs(y),Math.abs(F))}(e,t),r||=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime),r&&(function(e,t){e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]}(e,t),this.terrainFacilitator.renderTime=PS(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(e,t,r,i,n){if(r.isHidden(this.transform.zoom)||"background"!==r.type&&"custom"!==r.type&&!(i||[]).length)return;this.id=r.id;let a=this.drawFunctions;Pb(r)?a.symbol(e,t,r,i,this.style.placement.variableOffsets,n):(e=>"circle"===e.type)(r)?a.circle(e,t,r,i,n):(e=>"heatmap"===e.type)(r)?a.heatmap(e,t,r,i,n):(e=>"line"===e.type)(r)?a.line(e,t,r,i,n):(e=>"fill"===e.type)(r)?a.fill(e,t,r,i,n):(e=>"fill-extrusion"===e.type)(r)?a.fillExtrusion(e,t,r,i,n):(e=>"hillshade"===e.type)(r)?a.hillshade(e,t,r,i,n):(e=>"color-relief"===e.type)(r)?a.colorRelief(e,t,r,i,n):lp(r)?a.raster(e,t,r,i,n):(e=>"background"===e.type)(r)?a.background(e,t,r,i,n):(e=>"custom"===e.type)(r)&&a.custom(e,t,r,n)}static{this.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50}saveTileTexture(t){let r=this._tileTextures[t.size[0]];r?r.length<e.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?r.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}acquireRTT(e){let t=this.context.gl,r=this._rttObjectRecyclePool.pop();if(r)return r.size!==e&&(r.texture.update({width:e,height:e,data:null},{premultiply:!1,useMipmap:!0}),r.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE,t.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),r.size=e),r;let i=new Km(this.context,{width:e,height:e,data:null},t.RGBA,{premultiply:!1,useMipmap:!0});return i.bind(t.LINEAR,t.CLAMP_TO_EDGE,t.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&t.texParameterf(t.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:i,size:e}}bindRTT(e){let t=this.context.gl,r=e.size;if(!this._rttSharedFbo){let e=this.context.createFramebuffer(r,r,!0,!0),i=this.context.createRenderbuffer(t.DEPTH_STENCIL,r,r);e.depthAttachment.set(i),this._rttSharedFbo={fbo:e,depthRenderbuffer:i,size:r}}this._rttSharedFbo.size!==r&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,r,r),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=r,this._rttSharedFbo.fbo.height=r,this._rttSharedFbo.size=r),this._rttSharedFbo.fbo.colorAttachment.set(e.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(e){this._rttObjectRecyclePool.push(e)}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.patternAtlas.getPattern(e.from.toString()),r=this.patternAtlas.getPattern(e.to.toString());return!t||!r}useProgram(e,t,r=!1,i=[]){this.cache||={};let n=!!this.style.map.terrain,a=this.style.projection,o=r?zE.projectionMercator:a.shaderPreludeCode,s=r?BE:a.shaderDefine,l=`/${r?jE:a.shaderVariantName}`,u=e+(t?t.cacheKey:"")+l+(this._showOverdrawInspector?"/overdraw":"")+(n?"/terrain":"")+(i?`/${i.join("/")}`:"");return this.cache[u]||=new YD(this.context,zE[e],t,EA[e],this._showOverdrawInspector,n,o,s,i),this.cache[u]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(null==this.debugOverlayCanvas){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new Km(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){if(this._tileTextures){for(let e in this._tileTextures){let t=this._tileTextures[e];if(t)for(let e of t)e.destroy()}this._tileTextures={}}for(let e of this._rttObjectRecyclePool)e.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let e=this.context.gl;e.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),e.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if(this.layerOpacityFbo?.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let e in this.cache){let t=this.cache[e];t?.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}},fC=class extends Error{constructor(e,t){super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=e,this.statusMessage=t?.statusMessage??null}};function mC(e,t){let r,i=!1,n=null,a=()=>{n=null,i&&=(e(...r),n=setTimeout(a,t),!1)};return(...e)=>(i=!0,r=e,n||a(),n)}var gC=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let e=this._getHashParams();return this._hashName?(e.get(this._hashName)||"").split("/"):([...e.keys()][0]??"").split("/")},this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{let e=this._getHashParams();if(this._hashName)e.delete(this._hashName);else{let t=Array.from(e.keys());t.length>0&&e.delete(t[0])}let t=decodeURIComponent(e.toString()).replace(/=&/g,"&").replace(/=$/g,""),r=t?`#${t}`:"",i=window.location.href.replace(/(#.+)?$/,r);i=i.replace("&&","&"),window.history.replaceState(window.history.state,null,i)},this._updateHash=mC(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,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()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,i=10**Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),n=Math.round(t.lng*i)/i,a=Math.round(t.lat*i)/i,o=this._map.getBearing(),s=this._map.getPitch(),l="";if(l+=e?`/${n}/${a}/${r}`:`${r}/${a}/${n}`,(o||s)&&(l+="/"+Math.round(10*o)/10),s&&(l+=`/${Math.round(s)}`),this._hashName){let e=this._getHashParams();return e.set(this._hashName,l),`#${decodeURIComponent(e.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${l}`}_isValidHash(e){if(e.length<3||e.some(e=>isNaN(+e)))return!1;try{new _y(+e[2],+e[1])}catch{return!1}let t=+e[0],r=+(e[3]||0),i=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&r>=-180&&r<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}};const yC={linearity:.3,easing:rs(0,0,.3,1)},_C=os({deceleration:2500,maxSpeed:1400},yC),vC=os({deceleration:20,maxSpeed:1400},yC),bC=os({deceleration:1e3,maxSpeed:360},yC),xC=os({deceleration:1e3,maxSpeed:90},yC),wC=os({deceleration:1e3,maxSpeed:360},yC);var SC=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:PS(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=PS();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=PS()-60,r=Math.max(0,e.length-2);for(;r>0&&e[r-1].time>=t;)r--;return e.slice(r)}_onMoveEnd(e){this._drainInertiaBuffer();let t=this._getVelocityEntries();if(t.length<2)return void this.clear();let r={zoom:0,bearing:0,pitch:0,roll:0,pan:new $a(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of t)e.around&&(r.around=e.around),e.pinchAround&&(r.pinchAround=e.pinchAround);for(let{settings:e}of t.slice(1))r.zoom+=e.zoomDelta||0,r.bearing+=e.bearingDelta||0,r.pitch+=e.pitchDelta||0,r.roll+=e.rollDelta||0,e.panDelta&&r.pan._add(e.panDelta);if(!(r.pan.mag()||r.zoom||r.bearing||r.pitch||r.roll))return void this.clear();let i=PS()-t[0].time,n={};if(r.pan.mag()){let t=PC(r.pan.mag(),i,os({},_C,e||{})),a=r.pan.mult(t.amount/r.pan.mag()),o=this._map._camera.cameraHelper.handlePanInertia(a,this._map._camera.transform);n.center=o.easingCenter,n.offset=o.easingOffset,TC(n,t)}if(r.zoom){let e=PC(r.zoom,i,vC);n.zoom=ds(this._map.getZoom()+e.amount,this._map.getZoomSnap(),e.amount),TC(n,e)}if(r.bearing){let e=PC(r.bearing,i,bC);n.bearing=this._map.getBearing()+ns(e.amount,-179,179),TC(n,e)}if(r.pitch){let e=PC(r.pitch,i,xC);n.pitch=this._map.getPitch()+e.amount,TC(n,e)}if(r.roll){let e=PC(r.roll,i,wC);n.roll=this._map.getRoll()+ns(e.amount,-179,179),TC(n,e)}if(n.zoom||n.bearing){let e=void 0===r.pinchAround?r.around:r.pinchAround;n.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),os(n,{noMoveStart:!0})}};function TC(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function PC(e,t,r){let{maxSpeed:i,linearity:n,deceleration:a}=r,o=ns(e*n/(t/1e3),-i,i),s=Math.abs(o)/(a*n);return{easing:r.easing,duration:1e3*s,amount:s/2*o}}var EC=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new zS(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new RS(e.type,this._map,e))}mouseup(e){this._map.fire(new RS(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new RS(e.type,this._map,e))}dblclick(e){return this._firePreventable(new RS(e.type,this._map,e))}mouseover(e){this._map.fire(new RS(e.type,this._map,e))}mouseout(e){this._map.fire(new RS(e.type,this._map,e))}touchstart(e){return this._firePreventable(new LS(e.type,this._map,e))}touchmove(e){this._map.fire(new LS(e.type,this._map,e))}touchend(e){this._map.fire(new LS(e.type,this._map,e))}touchcancel(e){this._map.fire(new LS(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},DC=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new RS(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new RS("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new RS(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},AC=class{constructor(e,t,r){this._map=e,this._tr=r,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&"object"==typeof t.boxZoom&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&0===e.button&&(ES.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let r=t;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;let i=this._startPos;this._lastPos=r,this._box||(this._box=ES.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let n=Math.min(i.x,r.x),a=Math.max(i.x,r.x),o=Math.min(i.y,r.y),s=Math.max(i.y,r.y);this._box.style.transform=`translate(${n}px,${o}px)`,this._box.style.width=a-n+"px",this._box.style.height=s-o+"px"}mouseupWindow(e,t){if(!this._active||0!==e.button)return;let r=this._startPos,i=t;if(this.reset(),ES.suppressClick(),r.x!==i.x||r.y!==i.y)return this._map.fire(new OS("boxzoomend",{originalEvent:e})),this._boxZoomEnd?void this._boxZoomEnd(this._map,r,i,e):{cameraAnimation:e=>e.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&27===e.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&=(this._box.remove(),null),ES.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new OS(e,{originalEvent:t}))}};function IC(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let r={};for(let i=0;i<e.length;i++)r[e[i].identifier]=t[i];return r}var CC=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(void 0===this.startTime&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){let t=new $a(0,0);for(let r of e)t._add(r);return t.div(e.length)}(t),this.touches=IC(r,t)))}touchmove(e,t,r){if(this.aborted||!this.centroid)return;let i=IC(r,t);for(let e in this.touches){let t=this.touches[e],r=i[e];(!r||r.dist(t)>30)&&(this.aborted=!0)}}touchend(e,t,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}},kC=class{constructor(e){this.singleTap=new CC(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,r){this.singleTap.touchstart(e,t,r)}touchmove(e,t,r){this.singleTap.touchmove(e,t,r)}touchend(e,t,r){let i=this.singleTap.touchend(e,t,r);if(i){let t=e.timeStamp-this.lastTime<500,r=!this.lastTap||this.lastTap.dist(i)<30;if((!t||!r)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}},MC=class{constructor(e,t){this._tr=t,this._zoomIn=new kC({numTouches:1,numTaps:2}),this._zoomOut=new kC({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,r){this._zoomIn.touchstart(e,t,r),this._zoomOut.touchstart(e,t,r)}touchmove(e,t,r){this._zoomIn.touchmove(e,t,r),this._zoomOut.touchmove(e,t,r)}touchend(e,t,r){let i=this._zoomIn.touchend(e,t,r),n=this._zoomOut.touchend(e,t,r),a=this._tr;return i?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:ds(a.zoom+1,t.getZoomSnap()),around:a.unproject(i)},{originalEvent:e})}):n?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:t=>t.easeTo({duration:300,zoom:ds(a.zoom-1,t.getZoomSnap()),around:a.unproject(n)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},FC=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let i=Array.isArray(t)?t[0]:t;return!this._moved&&i.dist(r)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=i,this._move(r,i))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&ES.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};const RC={0:1,2:2};var LC=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){let r=RC[t];return void 0===e.buttons||(e.buttons&r)!==r}(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}},zC=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}},OC=class{constructor(e=new LC({checkCorrectEvent:()=>!0}),t=new zC){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,r){return e instanceof MouseEvent?t(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?r(e):void 0}startMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.startMove(e)},e=>{this.oneFingerTouchMoveStateManager.startMove(e)})}endMove(e){this._executeRelevantHandler(e,e=>{this.mouseMoveStateManager.endMove(e)},e=>{this.oneFingerTouchMoveStateManager.endMove(e)})}isValidStartEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidStartEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e))}isValidMoveEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidMoveEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e))}isValidEndEvent(e){return!!this._executeRelevantHandler(e,e=>this.mouseMoveStateManager.isValidEndEvent(e),e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e))}};const BC=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};var jC=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new $a(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,r){return this._calculateTransform(e,t,r)}touchmove(e,t,r){if(this._active)return this._shouldBePrevented(r.length)?void this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e):(e.preventDefault(),this._calculateTransform(e,t,r))}touchend(e,t,r){this._calculateTransform(e,t,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,r){r.length>0&&(this._active=!0);let i=IC(r,t),n=new $a(0,0),a=new $a(0,0),o=0;for(let e in i){let t=i[e],r=this._touches[e];r&&(n._add(t),a._add(t.sub(r)),o++,i[e]=t)}if(this._touches=i,this._shouldBePrevented(o)||!a.mag())return;let s=a.div(o);return this._sum._add(s),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(o),panDelta:s}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},NC=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,r){if(!this._firstTwoTouches)return;e.preventDefault();let[i,n]=this._firstTwoTouches,a=UC(r,t,i),o=UC(r,t,n);if(!a||!o)return;let s=this._aroundCenter?null:a.add(o).div(2);return this._move([a,o],s,e)}touchend(e,t,r){if(!this._firstTwoTouches)return;let[i,n]=this._firstTwoTouches,a=UC(r,t,i),o=UC(r,t,n);a&&o||(this._active&&ES.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function UC(e,t,r){for(let i=0;i<e.length;i++)if(e[i].identifier===r)return t[i]}function VC(e,t){return Math.log(e/t)/Math.LN2}var $C=class extends NC{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let r=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(VC(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:VC(this._distance,r)*this._zoomRate,pinchAround:t}}};function GC(e,t){return 180*e.angleWith(t)/Math.PI}var qC=class extends NC{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,r){let i=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:GC(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,r=GC(e,this._startVector);return Math.abs(r)<t}};function ZC(e){return Math.abs(e.y)>Math.abs(e.x)}var WC=class extends NC{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,r){super.touchstart(e,t,r),this._currentTouchCount=r.length}_start(e){this._lastPoints=e,ZC(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let i=e[0].sub(this._lastPoints[0]),n=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(i,n,r.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(i.y+n.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,r){if(void 0!==this._valid)return this._valid;let i=e.mag()>=2,n=t.mag()>=2;if(!i&&!n)return;if(!i||!n)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;let a=e.y>0==t.y>0;return ZC(e)&&ZC(t)&&a}};const HC={panStep:100,bearingStep:15,pitchStep:10};var XC=class{constructor(e,t){this._tr=t;let r=HC;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,r=0,i=0,n=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),n=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),n=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:o=>{let s=this._tr;o.easeTo({duration:300,easeId:"keyboardHandler",easing:KC,zoom:t?ds(s.zoom+t*(e.shiftKey?2:1),o.getZoomSnap()):s.zoom,bearing:s.bearing+r*this._bearingStep,pitch:s.pitch+i*this._pitchStep,offset:[-n*this._panStep,-a*this._panStep],center:s.center},{originalEvent:e})}}}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 KC(e){return e*(2-e)}const YC=4.000244140625;var JC=class{constructor(e,t,r){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=r,this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&"center"===e.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,r=PS(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==t&&t%YC==0?this._type="wheel":0!==t&&Math.abs(t)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=ES.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(_y.convert(r.center)):t,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let t=e.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=t),"number"==typeof this._targetZoom&&(this._targetZoom+=t)}if(0!==this._delta){let t="wheel"===this._type&&Math.abs(this._delta)>YC?this._wheelZoomRate:this._defaultZoomRate,r=2/(1+Math.exp(-Math.abs(this._delta*t)));this._delta<0&&0!==r&&(r=1/r);let i="number"==typeof this._targetZoom?cs(this._targetZoom):e.scale,n=e.applyConstrain(e.getCameraLngLat(),hs(i*r)).zoom,a=this._map.getZoomSnap();if("wheel"===this._type&&a>0){let t=ds(e.zoom,a);this._targetZoom=ds(n,a,n-t)}else this._targetZoom=n;"wheel"===this._type&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t,r="number"==typeof this._targetZoom?this._targetZoom:e.zoom,i=this._startZoom,n=this._easing,a=!1;if("wheel"===this._type&&i&&n){let e=PS()-this._lastWheelEventTime,o=Math.min((e+5)/200,1),s=n(o);t=_u.number(i,r,s),o<1?this._needsRerender=!0:a=!0}else t=r,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=t,{noInertia:!0,needsRenderFrame:!a,zoomDelta:t-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=is;if(this._prevEase){let e=this._prevEase,r=(PS()-e.start)/e.duration,i=e.easing(r+.01)-e.easing(r),n=.27/Math.sqrt(i*i+1e-4)*.01;t=rs(n,Math.sqrt(.0729-n*n),.25,1)}return this._prevEase={start:PS(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},QC=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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()}},ek=class{constructor(e,t){this._tr=t,this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:ds(this._tr.zoom+(e.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},tk=class{constructor(){this._tap=new kC({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,r){if(!this._swipePoint)if(this._tapTime){let i=t[0],n=e.timeStamp-this._tapTime<500,a=this._tapPoint.dist(i)<30;n&&a?r.length>0&&(this._swipePoint=i,this._swipeTouch=r[0].identifier):this.reset()}else this._tap.touchstart(e,t,r)}touchmove(e,t,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let i=t[0],n=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:n/128*this._zoomRate}}}else this._tap.touchmove(e,t,r)}touchend(e,t,r){if(this._tapTime)this._swipePoint&&0===r.length&&this.reset();else{let i=this._tap.touchend(e,t,r);i&&(this._tapTime=e.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},rk=class{constructor(e,t,r){this._el=e,this._mousePan=t,this._touchPan=r}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},ik=class{constructor(e,t,r,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=r,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},nk=class{constructor(e,t,r,i){this._el=e,this._touchZoom=t,this._touchRotate=r,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},ak=class{constructor(e,t){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=ES.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let r=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=t,this._container.appendChild(i);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=r,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new IS("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},ok=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation($a.convert(e),this._camera.terrain)}};const sk=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;var lk=class extends Ks{};function uk(e){return e.panDelta?.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var ck=class{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(e,t,r){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,t)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;let r="renderFrame"===e.type?void 0:e,i={needsRenderFrame:!1},n={},a={};for(let{handlerName:o,handler:s,allowed:l}of this._handlers){if(!s.isEnabled())continue;let u;if(this._blockedByActive(a,l,o))s.reset();else if(s[t||e.type]){if(Fs(e,t||e.type)){let r=ES.mousePos(this._map.getCanvas(),e);u=s[t||e.type](e,r)}else if(Ms(e,t||e.type)){let r=e.touches,i=this._getMapTouches(r),n=ES.touchPos(this._map.getCanvas(),i);u=s[t||e.type](e,n,i)}else Rs(t||e.type)||(u=s[t||e.type](e));this.mergeHandlerResult(i,n,u,o,r),u?.needsRenderFrame&&this._triggerRenderFrame()}(u||s.isActive())&&(a[o]=s)}let o={};for(let e in this._previousActiveHandlers)a[e]||(o[e]=r);this._previousActiveHandlers=a,(Object.keys(o).length||uk(i))&&(this._changes.push([i,n,o]),this._triggerRenderFrame()),(Object.keys(a).length||uk(i))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:s}=i;s&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],s(this._map))},this._map=e,this._camera=t,this._transformProvider=new ok(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new SC(e),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);let i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[e,t,r]of this._listeners)e.addEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}destroy(){for(let[e,t,r]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(e){let t=this._map,r=t.getCanvasContainer();this._add("mapEvent",new EC(t,e));let i=t.boxZoom=new AC(t,e,this._transformProvider);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let n=t.cooperativeGestures=new ak(t,e.cooperativeGestures);this._add("cooperativeGestures",n),e.cooperativeGestures&&n.enable();let a=new MC(t,this._transformProvider),o=new ek(t,this._transformProvider);t.doubleClickZoom=new QC(o,a),this._add("tapZoom",a),this._add("clickZoom",o),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let s=new tk;this._add("tapDragZoom",s);let l=t.touchPitch=new WC(t);this._add("touchPitch",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let u=()=>t.project(t.getCenter()),c=function({enable:e,clickTolerance:t,aroundCenter:r=!0,minPixelCenterThreshold:i=100,rotateSpeed:n=.8},a){return new FC({clickTolerance:t,move:(e,t)=>{let o=a();if(r&&Math.abs(o.y-e.y)>i)return{bearingDelta:Ds(new $a(e.x,t.y),t,o)};let s=(t.x-e.x)*n;return r&&t.y<o.y&&(s=-s),{bearingDelta:s}},moveStateManager:new LC({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button&&!e.ctrlKey}),enable:e,assignEvents:BC})}(e,u),h=function({enable:e,clickTolerance:t,pitchSpeed:r=-.5}){return new FC({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*r}),moveStateManager:new LC({checkCorrectEvent:e=>0===e.button&&e.ctrlKey||2===e.button}),enable:e,assignEvents:BC})}(e),d=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:r=.3},i){return new FC({clickTolerance:t,move:(e,t)=>{let n=i(),a=(t.x-e.x)*r;return t.y<n.y&&(a=-a),{rollDelta:a}},moveStateManager:new LC({checkCorrectEvent:e=>2===e.button&&e.ctrlKey}),enable:e,assignEvents:BC})}(e,u);t.dragRotate=new ik(e,c,h,d),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",h,["mouseRotate","mouseRoll"]),this._add("mouseRoll",d,["mousePitch"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let p=function({enable:e,clickTolerance:t}){return new FC({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:new LC({checkCorrectEvent:e=>0===e.button&&!e.ctrlKey}),enable:e,assignEvents:BC})}(e),f=new jC(e,t);t.dragPan=new rk(r,p,f),this._add("mousePan",p),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let m=new qC,g=new $C;t.touchZoomRotate=new nk(r,g,m,s),this._add("touchRotate",m,["touchPan","touchZoom"]),this._add("touchZoom",g,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new DC(t));let y=t.scrollZoom=new JC(t,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",y,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let _=t.keyboard=new XC(t,this._transformProvider);this._add("keyboard",_),e.interactive&&e.keyboard&&t.keyboard.enable()}_add(e,t,r){this._handlers.push({handlerName:e,handler:t,allowed:r}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!sk(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,r){for(let i in e)if(i!==r&&!t?.includes(i))return!0;return!1}_getMapTouches(e){let t=[];for(let r of e){let e=r.target;this._el.contains(e)&&t.push(r)}return t}mergeHandlerResult(e,t,r,i,n){if(!r)return;os(e,r);let a={handlerName:i,originalEvent:r.originalEvent||n};void 0!==r.zoomDelta&&(t.zoom=a),void 0!==r.panDelta&&(t.drag=a),void 0!==r.rollDelta&&(t.roll=a),void 0!==r.pitchDelta&&(t.pitch=a),void 0!==r.bearingDelta&&(t.rotate=a)}_applyChanges(){let e={},t={},r={};for(let[i,n,a]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new $a(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),i.rollDelta&&(e.rollDelta=(e.rollDelta||0)+i.rollDelta),void 0!==i.around&&(e.around=i.around),void 0!==i.pinchAround&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),os(t,n),os(r,a);this._updateMapTransform(e,t,r),this._changes=[]}_updateMapTransform(e,t,r){let i=this._map,n=this._camera.getTransformForUpdate(),a=i.terrain;if(!(uk(e)||a&&this._terrainMovement))return void this._fireEvents(t,r,!0);this._camera.stop(!0);let{panDelta:o,zoomDelta:s,bearingDelta:l,pitchDelta:u,rollDelta:c}=e,{around:h,aroundOnSurface:d}=this._resolveAround(e,a,n),p=a?this._terrainGestureElevation(a,h,d,n,t):void 0,f={panDelta:o,zoomDelta:s,rollDelta:c,pitchDelta:u,bearingDelta:l,around:h,aroundElevation:p};this._camera.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);let m=this._computePreZoomAroundLoc(n,h,o,p);this._handleMapControls({terrain:a,tr:n,deltasForHelper:f,preZoomAroundLoc:m,combinedEventsInProgress:t,panDelta:o}),this._camera.applyUpdatedTransform(n),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,r,!0)}_resolveAround(e,t,r){let i=void 0===e.pinchAround?e.around:e.pinchAround;return i||=this._camera.transform.centerPoint,t&&!r.isPointOnMapSurface(i)?{around:r.centerPoint,aroundOnSurface:!1}:{around:i,aroundOnSurface:!0}}_terrainGestureElevation(e,t,r,i,n){if(!r)return;if(!this._terrainMovement&&(n.drag||n.zoom)){let r=i.screenTerrainPointToMercatorCoordinate(t,e);this._terrainGestureAnchorElevation=r?r.z:null}if(null===this._terrainGestureAnchorElevation)return;let a=this._terrainGestureAnchorElevation;return t.distSqr(i.centerPoint)<.01||a-i.elevation>=.9*(i.getCameraAltitude()-i.elevation)?void 0:a}_computePreZoomAroundLoc(e,t,r,i){if(t.distSqr(e.centerPoint)<.01)return e.center;let n=r?t.sub(r):t;return void 0===i?e.screenPointToLocation(n):e.screenPointToLocationAtElevation(n,i)}_handleMapControls({terrain:e,tr:t,deltasForHelper:r,preZoomAroundLoc:i,combinedEventsInProgress:n,panDelta:a}){let o=this._camera.cameraHelper;if(o.handleMapControlsRollPitchBearingZoom(r,t),e)return o.useGlobeControls?(!this._terrainMovement&&(n.drag||n.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),void o.handleMapControlsPan(r,t,i)):this._terrainMovement||!n.drag&&!n.zoom?void(void 0===r.aroundElevation&&n.drag&&this._terrainMovement&&a?t.setCenter(t.screenPointToLocation(t.centerPoint.sub(a))):o.handleMapControlsPan(r,t,i)):(this._terrainMovement=!0,this._camera.elevationFreeze=!0,void o.handleMapControlsPan(r,t,i));o.handleMapControlsPan(r,t,i)}_fireEvents(e,t,r){let i=sk(this._eventsInProgress),n=sk(e),a={};for(let t in e){let{originalEvent:r}=e[t];this._eventsInProgress[t]||(a[`${t}start`]=r),this._eventsInProgress[t]=e[t]}!i&&n&&this._fireEvent("movestart",n.originalEvent);for(let e in a)this._fireEvent(e,a[e]);n&&this._fireEvent("move",n.originalEvent);for(let t in e){let{originalEvent:r}=e[t];this._fireEvent(t,r)}let o,s={};for(let e in this._eventsInProgress){let{handlerName:r,originalEvent:i}=this._eventsInProgress[e];this._handlersById[r].isActive()||(delete this._eventsInProgress[e],o=t[r]||i,s[`${e}end`]=o)}for(let e in s)this._fireEvent(e,s[e]);let l=sk(this._eventsInProgress),u=(i||n)&&!l;if(u&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let e=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(e)}if(r&&u){this._updatingCamera=!0;let e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),t=e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap;!e||!e.essential&&SS.prefersReducedMotion?(this._map.fire(new CS("moveend",{originalEvent:o})),t(this._map.getBearing())&&this._map.resetNorth()):(t(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:o})),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new CS(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new lk("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}},hk=class extends Js{constructor(e){super(),this._renderFrameCallback=()=>{let e=Math.min((PS()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new eD,this.cameraHelper=new oD,void 0!==e.minZoom&&this.transform.setMinZoom(e.minZoom),void 0!==e.maxZoom&&this.transform.setMaxZoom(e.maxZoom),void 0!==e.minPitch&&this.transform.setMinPitch(e.minPitch),void 0!==e.maxPitch&&this.transform.setMaxPitch(e.maxPitch),void 0!==e.renderWorldCopies&&this.transform.setRenderWorldCopies(e.renderWorldCopies),null!==e.transformConstrain&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=e.centerClampedToGround??!0,this.transformCameraUpdate=e.transformCameraUpdate??null,this._stopHandlers=e.stopHandlers??(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,t){if(e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t,this._requestedCameraState){let t=e.clone();t.apply(this._requestedCameraState,!0),this._requestedCameraState=t}}getCenter(){return new _y(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,r){return e=$a.convert(e).mult(-1),this.panTo(this.transform.center,os({offset:e},t),r)}panTo(e,t,r){return this.easeTo(os({center:e},t),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,r){return this.easeTo(os({zoom:e},t),r)}zoomIn(e,t){return this.zoomTo(ds(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(ds(this.getZoom()-1,this._zoomSnap),e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new CS("movestart",t)).fire(new CS("move",t)).fire(new CS("moveend",t))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,r){return this.easeTo(os({bearing:e},t),r)}resetNorth(e,t){return this.rotateTo(0,os({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(os({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=zT.convert(e).adjustAntiMeridian();let r=t?.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,t)}_cameraForBoxAndBearing(e,t,r,i){let n={top:0,bottom:0,right:0,left:0};if("number"==typeof(i=os({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding){let e=i.padding;i.padding={top:e,bottom:e,right:e,left:e}}let a=os(n,i.padding);i.padding=a;let o=this.transform,s=new zT(e,t),l=this.cameraHelper.cameraForBoxAndBearing(i,a,s,r,o);return l&&this._zoomSnap&&(l.zoom=ds(l.zoom,this._zoomSnap,-1)),l}fitBounds(e,t,r){return this._fitInternal(this.cameraForBounds(e,t),t,r)}fitScreenCoordinates(e,t,r,i,n){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation($a.convert(e)),this.transform.screenPointToLocation($a.convert(t)),r,i),i,n)}_fitInternal(e,t,r){return e?(delete(t=os(e,t)).padding,t.linear?this.easeTo(t,r):this.flyTo(t,r)):this}jumpTo(e,t){this.stop(),void 0!==e.zoom&&this._zoomSnap&&(e.zoom=ds(e.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),i=!1,n=!1,a=!1,o=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLat(e.center?_y.convert(e.center):r.center,r)),this.cameraHelper.handleJumpToCenterZoom(r,e);let s=r.zoom!==o;return void 0!==e.elevation&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),void 0!==e.bearing&&r.bearing!==+e.bearing&&(i=!0,r.setBearing(+e.bearing)),void 0!==e.pitch&&r.pitch!==+e.pitch&&(n=!0,r.setPitch(+e.pitch)),void 0!==e.roll&&r.roll!==+e.roll&&(a=!0,r.setRoll(+e.roll)),null!=e.padding&&!r.isPaddingEqual(e.padding)&&r.setPadding(e.padding),this.applyUpdatedTransform(r),this.fire(new CS("movestart",t)).fire(new CS("move",t)),s&&this.fire(new CS("zoomstart",t)).fire(new CS("zoom",t)).fire(new CS("zoomend",t)),i&&this.fire(new CS("rotatestart",t)).fire(new CS("rotate",t)).fire(new CS("rotateend",t)),n&&this.fire(new CS("pitchstart",t)).fire(new CS("pitch",t)).fire(new CS("pitchend",t)),a&&this.fire(new CS("rollstart",t)).fire(new CS("roll",t)).fire(new CS("rollend",t)),this.fire(new CS("moveend",t))}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,n){let a=this.transform.calculateCenterFromCameraLngLatAlt(e,t,r,i);return{center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:r,pitch:i,roll:n}}easeTo(e,t){this._stop(!1,e.easeId),void 0!==(e=os({offset:[0,0],duration:500,easing:is},e)).zoom&&this._zoomSnap&&(e.zoom=ds(e.zoom,this._zoomSnap)),(!1===e.animate||!e.essential&&SS.prefersReducedMotion)&&(e.duration=0);let r,i,n=this.getTransformForUpdate(),a=this.getBearing(),o=n.pitch,s=n.roll,l=void 0===e.bearing?a:this._normalizeBearing(e.bearing,a),u=void 0===e.pitch?o:+e.pitch,c=void 0===e.roll?s:this._normalizeBearing(e.roll,s),h=void 0===e.padding?n.padding:e.padding,d=$a.convert(e.offset);e.around&&(r=_y.convert(e.around),i=n.locationToScreenPoint(r));let p={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(n,{bearing:l,pitch:u,roll:c,padding:h,around:r,aroundPoint:i,offsetAsPoint:d,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||=a!==l,this._pitching||=u!==o,this._rolling||=c!==s,this._padding=!n.isPaddingEqual(h),this._zooming||=f.isZooming,this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,p),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease(r=>{f.easeFunc(r),this.terrain&&!e.freezeElevation&&this._updateElevation(r),this.applyUpdatedTransform(n),this._fireMoveEvents(t)},r=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,r)},e),this}_prepareEase(e,t,r={}){this._moving=!0,!t&&!r.moving&&this.fire(new CS("movestart",e)),this._zooming&&!r.zooming&&this.fire(new CS("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new CS("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new CS("pitchstart",e)),this._rolling&&!r.rolling&&this.fire(new CS("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,this.transform),this.elevationFreeze=!0}_updateElevation(e){(void 0===this._elevationStart||void 0===this._elevationCenter)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(e<1&&t!==this._elevationTarget){let r=this._elevationTarget-this._elevationStart,i=(t-(r*e+this._elevationStart))/(1-e);this._elevationStart+=e*(r-i),this._elevationTarget=t}this.transform.setElevation(_u.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||=this.transform.clone(),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),r=e.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(r<i){let r=e.calculateCameraOptionsFromTo(t,i,e.center,e.elevation);return{pitch:r.pitch,zoom:r.zoom}}return{}}applyUpdatedTransform(e){let t=[];if(t.push(e=>this._elevateCameraIfInsideTerrain(e)),this.transformCameraUpdate&&t.push(e=>this.transformCameraUpdate(e)),!t.length)return;let r=e.clone();for(let e of t){let t=r.clone(),{center:i,zoom:n,roll:a,pitch:o,bearing:s,elevation:l}=e(t);i&&t.setCenter(i),void 0!==l&&t.setElevation(l),void 0!==n&&t.setZoom(n),void 0!==a&&t.setRoll(a),void 0!==o&&t.setPitch(o),void 0!==s&&t.setBearing(s),r.apply(t,!1)}this.transform.apply(r,!1)}_fireMoveEvents(e){this.fire(new CS("move",e)),this._zooming&&this.fire(new CS("zoom",e)),this._rotating&&this.fire(new CS("rotate",e)),this._pitching&&this.fire(new CS("pitch",e)),this._rolling&&this.fire(new CS("roll",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let r=this._zooming,i=this._rotating,n=this._pitching,a=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new CS("zoomend",e)),i&&this.fire(new CS("rotateend",e)),n&&this.fire(new CS("pitchend",e)),a&&this.fire(new CS("rollend",e)),this.fire(new CS("moveend",e))}flyTo(e,t){if(!e.essential&&SS.prefersReducedMotion){let r=ss(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(r,t)}this.stop(),void 0!==(e=os({offset:[0,0],speed:1.2,curve:1.42,easing:is},e)).zoom&&this._zoomSnap&&(e.zoom=ds(e.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),i=r.bearing,n=r.pitch,a=r.roll,o=r.padding,s=void 0===e.bearing?i:this._normalizeBearing(e.bearing,i),l=void 0===e.pitch?n:+e.pitch,u=void 0===e.roll?a:this._normalizeBearing(e.roll,a),c=void 0===e.padding?r.padding:e.padding,h=$a.convert(e.offset),d=r.centerPoint.add(h),p=r.screenPointToLocation(d),f=this.cameraHelper.handleFlyTo(r,{bearing:s,pitch:l,roll:u,padding:c,locationAtOffset:p,offsetAsPoint:h,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),m=e.curve,g=Math.max(r.width,r.height),y=g/f.scaleOfZoom,_=f.pixelPathLength,v=g/f.scaleOfMinZoom;m=Math.min(m,Math.sqrt(v/_*2));let b=m*m;function x(e){let t=(y*y-g*g+(e?-1:1)*b*b*_*_)/(2*(e?y:g)*b*_);return Math.log(Math.sqrt(t*t+1)-t)}function w(e){return(Math.exp(e)-Math.exp(-e))/2}function S(e){return(Math.exp(e)+Math.exp(-e))/2}let T=x(!1),P=function(e){return S(T)/S(T+m*e)},E=function(e){return g*((S(T)*function(e){return w(e)/S(e)}(T+m*e)-w(T))/b)/_},D=(x(!0)-T)/m;if(Math.abs(_)<2e-6||!isFinite(D)){if(Math.abs(g-y)<1e-6)return this.easeTo(e,t);let r=y<g?-1:1;D=Math.abs(Math.log(y/g))/m,E=()=>0,P=e=>Math.exp(r*m*e)}if(void 0!==e.duration)e.duration=+e.duration;else{let t=void 0===e.screenSpeed?+e.speed:+e.screenSpeed/m;e.duration=1e3*D/t}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=i!==s,this._pitching=l!==n,this._rolling=u!==a,this._padding=!r.isPaddingEqual(c),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(f.targetCenter),this._ease(p=>{let m=p*D,g=1/P(m),y=E(m);this._rotating&&r.setBearing(_u.number(i,s,p)),this._pitching&&r.setPitch(_u.number(n,l,p)),this._rolling&&r.setRoll(_u.number(a,u,p)),this._padding&&(r.interpolatePadding(o,c,p),d=r.centerPoint.add(h)),f.easeFunc(p,g,y,d),this.terrain&&!e.freezeElevation&&this._updateElevation(p),this.applyUpdatedTransform(r),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||this._stopHandlers(),this}_ease(e,t,r){!1===r.animate||0===r.duration?(e(1),t()):(this._easeStart=PS(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=as(e,-180,180);let r=Math.abs(e-t);return Math.abs(e-360-t)<r&&(e-=360),Math.abs(e+360-t)<r&&(e+=360),e}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}};const dk={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};var pk=class{constructor(e=dk){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=e=>{e&&("terrain"===e.type||"style"===e.dataType||"source"===e.dataType&&("metadata"===e.sourceDataType||"visibility"===e.sourceDataType))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ES.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ES.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ES.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let r=this._map._getUIString(`AttributionControl.${t}`);e.title=r,e.setAttribute("aria-label",r)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(e=>"string"==typeof e?e:"")):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.tileManagers;for(let r in t){let i=t[r];if(i.used||i.usedForTerrain){let t=i.getSource();t.attribution&&!e.includes(t.attribution)&&e.push(t.attribution)}}e=e.filter(e=>String(e).trim()),e.sort((e,t)=>e.length-t.length),e=e.filter((t,r)=>{for(let i=r+1;i<e.length;i++)if(e[i].includes(t))return!1;return!0});let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=ES.sanitize(r),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}},fk=class{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options?.compact,this._container=ES.create("div","maplibregl-ctrl");let t=ES.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},mk=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,r=t?this._queue.concat(t):this._queue;for(let t of r)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];let r,i=!1;for(let n of t)if(!n.cancelled){try{n.callback(e)}catch(e){i||(i=!0,r=e)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,i)throw r}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};const gk=["none","zoom","sourceTiles","visibleLayers","revision"];var yk=class{constructor(e,t,r,i){this._tileKeys=e.map(e=>e.key).sort().join(),this._revision=t,this._zoom=r,this._visibleLayerIds=i}difference(e){return this._revision===e?._revision?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}};const _k={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};var vk=class{constructor(e,t){this.needsFollowUpFrame=!1,this.painter=e,this.terrain=t,this.rttSize=t.tileManager.tileSize*t.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,t){let r=t!==this._lastPrepareZoom;this._lastPrepareZoom=t,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(r=>!e._layers[r].isHidden(t));let i=this._renderableLayerIds.join(),n=new Set;for(let t of this._renderableLayerIds){let r=e._layers[t],i=r.source;i&&_k[r.type]&&n.add(i)}this._coordsAscending={},this._rttFingerprints={};for(let r of n){let n=e.tileManagers[r];if(!n)continue;this._coordsAscending[r]={};let a=this._coordsAscending[r],o=n.getSource(),s=o instanceof iP?o.terrainTileRanges:null;for(let e of n.getVisibleCoordinates()){let t=this.terrain.tileManager.getTerrainCoords(e,s);for(let e in t)a[e]||=[],a[e].push(t[e])}this._rttFingerprints[r]={};let l=this._rttFingerprints[r],u=n.getState().revision;for(let e in a)l[e]=new yk(a[e],u,t,i)}this.needsFollowUpFrame=!1;let a=r||this.painter.options.moving,o=!1;for(let e of this._renderableTiles){let t=this._textureDifference(e);"none"!==t&&("zoom"===t&&a||"visibleLayers"===t&&r?this.needsFollowUpFrame=!0:"zoom"===t||"sourceTiles"===t?(o?this.needsFollowUpFrame=!0:e.releaseRTT(this.painter),o=!0):e.releaseRTT(this.painter))}}_textureDifference(e){let t="none";for(let r in this._rttFingerprints){let i=this._rttFingerprints[r][e.tileID.key];if(!i)continue;let n=i.difference(e.rttFingerprint[r]);gk.indexOf(n)>gk.indexOf(t)&&(t=n)}return t}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let r={...t,isRenderingToTexture:!0},i=e.type,n=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(_k[i]&&((!this._prevType||!_k[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(_k[this._prevType]||_k[i]&&a){this._prevType=i;let e=this._stacks.length-1,t=this._stacks[e]||[];for(let i of this._renderableTiles){if(this._rttTiles.push(i),i.getRTT(e))continue;let a=i.acquireRTT(n,e,this.rttSize);n.bindRTT(a),n.context.clear({color:Hl.transparent,stencil:0}),n.currentStencilSource=void 0;for(let e of t){let t=n.style._layers[e],a=t.source?this._coordsAscending[t.source][i.tileID.key]:[i.tileID];n.context.viewport.set([0,0,this.rttSize,this.rttSize]),n.renderTileClippingMasks(t,a,!0),n.renderLayer(n,n.style.tileManagers[t.source],t,a,r),t.source&&(i.rttFingerprint[t.source]=this._rttFingerprints[t.source][i.tileID.key])}a.texture.generateMipmap()}return function(e,t,r,i){let{isRenderingGlobe:n}=i,a=e.context,o=a.gl,s=e.transform,l=e.colorModeForRenderPass(),u=e.getDepthModeFor3D(),c=e.useProgram("terrain");a.bindFramebuffer.set(null),a.viewport.set([0,0,e.width,e.height]);for(let i of r){let r=t.getTerrainMesh(i.tileID),h=e.renderToTexture.getTexture(i),d=t.getTerrainData(i.tileID);a.activeTexture.set(o.TEXTURE0),h.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_LINEAR);let p=t.getSkirtLength(s.zoom),f=s.calculateFogMatrix(i.tileID.toUnwrapped()),m=ND(p,f,e.style.sky,s.pitch,n),g=s.getProjectionData({overscaledTileID:i.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(a,o.TRIANGLES,u,vI.disabled,l,xI.backCCW,m,d,g,"terrain",r.vertexBuffer,r.indexBuffer,r.segments)}}(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],_k[i]}return!1}};const bk={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},xk={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:dk,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:js.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20};var wk=class extends Js{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(e){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new mk,this._controls=[],this._mapId=us(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=e=>{if(e.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let e of Object.values(this.style._layers))if("custom"===e.type&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(let[t]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new NS("webglcontextlost",{originalEvent:e}))}else this.fire(new NS("webglcontextlost",{originalEvent:e}))},this._contextRestored=e=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let e in this._lostContextStyle.images){let t=this._lostContextStyle.images[e];t.isWebGLImage&&this.style.imageManager.updateImage(e,t,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(e){return void this.fire(new Ys(e))}this.resize(),this._update(),this._resizeInternal(),this.fire(new NS("webglcontextrestored",{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let t={...xk,...e,canvasContextAttributes:{...xk.canvasContextAttributes,...e.canvasContextAttributes}};if(null!=t.minZoom&&null!=t.maxZoom&&t.minZoom>t.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=t.minPitch&&null!=t.maxPitch&&t.minPitch>t.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=t.minPitch&&t.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=t.maxPitch&&t.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new hk({minZoom:t.minZoom,maxZoom:t.maxZoom,minPitch:t.minPitch,maxPitch:t.maxPitch,bearingSnap:t.bearingSnap,zoomSnap:t.zoomSnap,renderWorldCopies:t.renderWorldCopies,centerClampedToGround:t.centerClampedToGround,terrain:this.terrain,transformConstrain:t.transformConstrain,requestRenderFrame:e=>this._requestRenderFrame(e),cancelRenderFrame:e=>this._cancelRenderFrame(e),transformCameraUpdate:t.transformCameraUpdate,stopHandlers:()=>this._handlers?.stop(!1)}),this._camera.setEventedParent(this),this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes={...t.canvasContextAttributes},this._trackResize=!0===t.trackResize,this._terrainSkirtLength=t.terrainSkirtLength,this._refreshExpiredTiles=!0===t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=!0===t.crossSourceCollisions,this._collectResourceTiming=!0===t.collectResourceTiming,this._locale={...bk,...t.locale},this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this._zoomLevelsToOverscale=t.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=!0===t.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(t.anisotropicFilterPitch),void 0!==t.reduceMotion&&(SS.prefersReducedMotion=t.reduceMotion),this._requestManager=new AS(t.transformRequest),this._container=this._resolveContainer(t.container),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer();try{this._setupPainter()}catch(e){throw this._cleanupContainer(),e}this._imageQueueHandle=DS.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new ck(this,this._camera,t),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let r="string"==typeof t.hash&&t.hash||void 0;this._hash=t.hash?new gC(r).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,os({},t.fitBoundsOptions,{duration:0}))));let i="string"==typeof t.style||"globe"!==t.style?.projection?.type;this.resize(null,i),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new pk("boolean"==typeof t.attributionControl?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new fk,t.logoPosition),this.on("style.load",()=>{if(i||this._resizeTransform(),this._camera.transform.unmodified){let e=ss(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(e)}}),this.on("data",e=>{this._update("style"===e.dataType),this.fire("style"===e.dataType?new MS("styledata",e):new FS("sourcedata",e))}),this.on("dataloading",e=>{this.fire("style"===e.dataType?new MS("styledataloading",e):new FS("sourcedataloading",e))}),this.on("dataabort",e=>{this.fire(new FS("sourcedataabort",e))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(void 0===t&&(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e?.onAdd)return this.fire(new Ys(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let r=e.onAdd(this);this._controls.push(e);let i=this._controlPositions[t];return t.includes("bottom")?i.insertBefore(r,i.firstChild):i.appendChild(r),this}removeControl(e){if(!e?.onRemove)return this.fire(new Ys(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return wP(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new _y(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,t){return this._camera.setCenter(e,t),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,t){return this._camera.setCenterElevation(e,t),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,t,r){return this._camera.panBy(e,t,r),this}panTo(e,t,r){return this._camera.panTo(e,t,r),this}getZoom(){return this._camera.transform.zoom}setZoom(e,t){return this._camera.setZoom(e,t),this}zoomTo(e,t,r){return this._camera.zoomTo(e,t,r),this}zoomIn(e,t){return this._camera.zoomIn(e,t),this}zoomOut(e,t){return this._camera.zoomOut(e,t),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,t){return this._camera.setVerticalFieldOfView(e,t),this}getBearing(){return this._camera.transform.bearing}setBearing(e,t){return this._camera.setBearing(e,t),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,t){return this._camera.setPadding(e,t),this}rotateTo(e,t,r){return this._camera.rotateTo(e,t,r),this}resetNorth(e,t){return this._camera.resetNorth(e,t),this}resetNorthPitch(e,t){return this._camera.resetNorthPitch(e,t),this}snapToNorth(e,t){return this._camera.snapToNorth(e,t),this}getPitch(){return this._camera.transform.pitch}setPitch(e,t){return this._camera.setPitch(e,t),this}getRoll(){return this._camera.transform.roll}setRoll(e,t){return this._camera.setRoll(e,t),this}cameraForBounds(e,t){return this._camera.cameraForBounds(e,t)}fitBounds(e,t,r){return this._camera.fitBounds(e,t,r),this}fitScreenCoordinates(e,t,r,i,n){return this._camera.fitScreenCoordinates(e,t,r,i,n),this}jumpTo(e,t){return this._camera.jumpTo(e,t),this}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,n){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,n)}easeTo(e,t){return this._camera.easeTo(e,t),this}flyTo(e,t){return this._camera.flyTo(e,t),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(_y.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t,r,i){return null==i&&this.terrain&&(i=this.terrain.getElevationForLngLat(r,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,t,r,i??0)}resize(e,t=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(t);let r=!this._camera._moving;return r&&(this.stop(),this.fire(new CS("movestart",e)).fire(new CS("move",e))),this.fire(new IS("resize",e)),r&&this.fire(new CS("moveend",e)),this}_resizeInternal(e=!0){let[t,r]=this._containerDimensions(),i=this._getClampedPixelRatio(t,r);if(this._resizeCanvas(t,r,i),this.painter.resize(t,r,i),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let i=this._getClampedPixelRatio(t,r);this._resizeCanvas(t,r,i),this.painter.resize(t,r,i)}this._resizeTransform(e)}_resizeTransform(e=!0){let[t,r]=this._containerDimensions();this._camera.transform.resize(t,r,e),this._camera._requestedCameraState?.resize(t,r,e)}_getClampedPixelRatio(e,t){let{0:r,1:i}=this._maxCanvasSize,n=this.getPixelRatio(),a=e*n,o=t*n,s=a>r?r/a:1,l=o>i?i/o:1,u=Math.min(s,l);return u<1&&_s("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),u*n}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.transform.setMaxBounds(zT.convert(e)),this._update()}setMinZoom(e){if(e??=-2,e>=-2&&e<=this._camera.transform.maxZoom){let t=this._camera.transform.zoom,r=this._camera.getTransformForUpdate();return r.setMinZoom(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.zoom&&this.fire(new CS("zoomstart")).fire(new CS("zoom")).fire(new CS("zoomend")).fire(new CS("movestart")).fire(new CS("move")).fire(new CS("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(e=!1){let t=this._camera.transform;return e?t.applyConstrain(t.center,t.minZoom).zoom:t.minZoom}setMaxZoom(e){if(e??=22,e>=this._camera.transform.minZoom){let t=this._camera.transform.zoom,r=this._camera.getTransformForUpdate();return r.setMaxZoom(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.zoom&&this.fire(new CS("zoomstart")).fire(new CS("zoom")).fire(new CS("zoomend")).fire(new CS("movestart")).fire(new CS("move")).fire(new CS("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??=0,e<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this._camera.transform.maxPitch){let t=this._camera.transform.pitch,r=this._camera.getTransformForUpdate();return r.setMinPitch(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.pitch&&this.fire(new CS("pitchstart")).fire(new CS("pitch")).fire(new CS("pitchend")).fire(new CS("movestart")).fire(new CS("move")).fire(new CS("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??=60,e>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this._camera.transform.minPitch){let t=this._camera.transform.pitch,r=this._camera.getTransformForUpdate();return r.setMaxPitch(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.pitch&&this.fire(new CS("pitchstart")).fire(new CS("pitch")).fire(new CS("pitchend")).fire(new CS("movestart")).fire(new CS("move")).fire(new CS("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??=20,e>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this._camera.transform.setConstrainOverride(e),this._update()}project(e){return this._camera.transform.locationToScreenPoint(_y.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation($a.convert(e),this.terrain)}isMoving(){return this._camera.isMoving()||this._handlers?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlers?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlers?.isRotating()||!1}_createDelegatedListener(e,t,r){if("mouseenter"===e||"mouseover"===e){let i=!1;return{layers:t,listener:r,delegates:{mousemove:n=>{let a=t.filter(e=>this.getLayer(e)),o=0===a.length?[]:this.queryRenderedFeatures(n.point,{layers:a});o.length?i||(i=!0,r.call(this,new RS(e,this,n.originalEvent,{features:o}))):i=!1},mouseout:()=>{i=!1}}}}if("mouseleave"===e||"mouseout"===e){let i=!1;return{layers:t,listener:r,delegates:{mousemove:n=>{let a=t.filter(e=>this.getLayer(e));(0===a.length?[]:this.queryRenderedFeatures(n.point,{layers:a})).length?i=!0:i&&(i=!1,r.call(this,new RS(e,this,n.originalEvent)))},mouseout:t=>{i&&(i=!1,r.call(this,new RS(e,this,t.originalEvent)))}}}}{let i=e=>{let i=t.filter(e=>this.getLayer(e)),n=0===i.length?[]:this.queryRenderedFeatures(e.point,{layers:i});n.length&&(e.features=n,r.call(this,e),delete e.features)};return{layers:t,listener:r,delegates:{[e]:i}}}}_saveDelegatedListener(e,t){this._delegatedListeners||={},this._delegatedListeners[e]||=[],this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,r){if(!this._delegatedListeners?.[e])return;let i=this._delegatedListeners[e];for(let e=0;e<i.length;e++){let n=i[e];if(n.listener===r&&n.layers.length===t.length&&n.layers.every(e=>t.includes(e))){for(let e in n.delegates)this.off(e,n.delegates[e]);return void i.splice(e,1)}}}on(e,t,r){if(void 0===r)return super.on(e,t);let i="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,i,r);this._saveDelegatedListener(e,n);for(let e in n.delegates)this.on(e,n.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,i,r)}}}once(e,t,r){if(void 0===r)return super.once(e,t);let i="string"==typeof t?[t]:t,n=this._createDelegatedListener(e,i,r);for(let t in n.delegates){let a=n.delegates[t];n.delegates[t]=(...t)=>{this._removeDelegatedListener(e,i,r),a(...t)}}this._saveDelegatedListener(e,n);for(let e in n.delegates)this.once(e,n.delegates[e]);return this}off(e,t,r){if(void 0===r)return super.off(e,t);let i="string"==typeof t?[t]:t;return this._removeDelegatedListener(e,i,r),this}queryRenderedFeatures(e,t){if(!this.style)return[];let r,i=e instanceof $a||Array.isArray(e),n=i?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(t||=(i?{}:e)||{},n instanceof $a||"number"==typeof n[0])r=[$a.convert(n)];else{let e=$a.convert(n[0]),t=$a.convert(n[1]);r=[e,new $a(t.x,e.y),t,new $a(e.x,t.y),e]}return this.style.queryRenderedFeatures(r,t,this._camera.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=os({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),this._styleUrl="string"==typeof e?e:null,!1!==t.diff&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(null==t)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(e,t));let r=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new OD(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,r):this.style.loadJSON(e,t,r),this):(this._frameRequest&&=(this._frameRequest.abort(),null),this.style?.projection?.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new OD(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(e,t){if(this._diffStyleRequest?.abort(),"string"==typeof e){let r=e;this._diffStyleRequest=new AbortController;let i=this._diffStyleRequest;try{let e=await this._requestManager.transformRequest(r,"Style");if(i.signal.aborted)return void(this._diffStyleRequest=null);let n=await qs(e,i);this._diffStyleRequest=null,this._updateDiff(n.data,t)}catch(e){this._diffStyleRequest=null,Os(e)||this.fire(new Ys(jo(e)))}}else"object"==typeof e&&(this._diffStyleRequest=null,this._updateDiff(e,t))}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(r){_s(`Unable to perform style diff: ${jo(r).message}. Rebuilding the style from scratch.`),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();_s("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style?.tileManagers[e];if(void 0!==t)return t.loaded();this.fire(new Ys(Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e,t={}){if(this.style._checkLoaded(),e&&Cd(this,Ed.terrain,{value:e},t))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){let t=this.style.tileManagers[e.source];if(!t)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);null===this.terrain&&t.reload();for(let t in this.style._layers){let r=this.style._layers[t];"hillshade"===r.type&&r.source===e.source&&_s("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===r.type&&r.source===e.source&&_s("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new XE(this.painter,t,e,this._terrainSkirtLength),this.painter.renderToTexture=new vk(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=t=>this._handleTerrainDataEvent(t,e.source),this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);return this.style.triggerSymbolPlacement(),this.fire(new BS({terrain:e})),this}_handleTerrainDataEvent(e,t){if("style"===e.dataType)return void this.terrain.tileManager.releaseAllRTT();let r=e.sourceId===t;if(r&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),r&&e.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),e.tile){if("image"===e.source?.type)return void this.terrain.tileManager.releaseAllRTT();this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let e=this.style?.tileManagers;for(let t of Object.values(e))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style?.getSource(e)}setSourceTileLodParams(e,t,r){if(r){let i=this.getSource(r);if(!i)throw Error(`There is no source with ID "${r}", cannot set LOD parameters`);i.calculateTileZoom=vP(Math.max(1,e),Math.max(1,t))}else for(let r in this.style.tileManagers)this.style.tileManagers[r].getSource().calculateTileZoom=vP(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let r=this.style.tileManagers[e];if(!r)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);void 0===t?r.reload(!0):r.refreshTiles(t.map(e=>new zb(e.z,e.x,e.y)))}addImage(e,t,r={}){this._lazyInitEmptyStyle();let i=this._createStyleImage(t,r);return i?(this.style.addImage(e,i),i.userImage?.onAdd&&i.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){return this._missingStyleImageResolver=e,this.style?.setMissingImageResolver(e),this}_createStyleImage(e,t={}){let{pixelRatio:r=1,sdf:i=!1,stretchX:n,stretchY:a,content:o,textFitWidth:s,textFitHeight:l}=t;if(e instanceof HTMLImageElement||ws(e)){let{width:t,height:u,data:c}=SS.getImageData(e);return{data:new Nm({width:t,height:u},c),pixelRatio:r,stretchX:n,stretchY:a,content:o,textFitWidth:s,textFitHeight:l,sdf:i,version:0}}if(void 0===e.width||void 0===e.height)return this.fire(new Ys(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))),null;{let{width:t,height:u,data:c}=e,h=e,d=hv(h.data);return{data:d?new Nm({width:t,height:u}):new Nm({width:t,height:u},new Uint8Array(c)),pixelRatio:r,stretchX:n,stretchY:a,content:o,textFitWidth:s,textFitHeight:l,sdf:i,version:0,isWebGLImage:d,userImage:h}}}updateImage(e,t){let r=this.style.getImage(e);if(!r)return this.fire(new Ys(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:i,height:n,data:a}=t instanceof HTMLImageElement||ws(t)?SS.getImageData(t):t;if(void 0===i||void 0===n)return this.fire(new Ys(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(i!==r.data.width||n!==r.data.height)return this.fire(new Ys(Error("The width and height of the updated image must be that same as the previous version of the image")));if(r.isWebGLImage=hv(a),r.isWebGLImage)r.userImage=t;else{let e=!(t instanceof HTMLImageElement||ws(t));r.data.replace(a,e)}return this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new Ys(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){let t=await DS.getImage(await this._requestManager.transformRequest(e,"Image"),new AbortController);if(!t.data)throw Error(`Could not load image ${e}: the response is empty`);return t}listImages(){return this.style?.listImages()??[]}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style?.getLayer(e)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(e,t,r){return this.style.setLayerZoomRange(e,t,r),this._update(!0)}setFilter(e,t,r={}){return this.style?.setFilter(e,t,r),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,r,i={}){return this.style?.setPaintProperty(e,t,r,i),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,r,i={}){return this.style.setLayoutProperty(e,t,r,i),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,t,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,r,e=>{e||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,e=>{e||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_shouldHandleInitialResize(){if(!this._container?.clientWidth||!this._container.clientHeight)return!1;let[e,t]=this._containerDimensions();return e!==this._camera.transform.width||t!==this._camera.transform.height}_setupResizeObserver(){let e=!1,t=mC(e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())},50),r=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new r(r=>{!e&&(e=!0,!this._shouldHandleInitialResize())||t(r)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if("string"==typeof e){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&"object"==typeof e&&1===e.nodeType)return e;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let t=this._canvasContainer=ES.create("div","maplibregl-canvas-container",e);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=ES.create("canvas","maplibregl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i);let n=this._controlContainer=ES.create("div","maplibregl-control-container",e),a=this._controlPositions={};for(let e of["top-left","top-right","bottom-left","bottom-right"])a[e]=ES.create("div",`maplibregl-ctrl-${e} `,n);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(e,t,r){this._canvas.width=Math.floor(r*e),this._canvas.height=Math.floor(r*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let e={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},t=null;this._canvas.addEventListener("webglcontextcreationerror",e=>{t=e},{once:!0});let r=this._canvas.getContext("webgl2",e);if(!r)throw new fC(e,t);this.painter=new pC(r,this._camera.transform)}migrateProjection(e,t){this._camera.migrateProjection(e,t),this.painter.transform=e,this.fire(new jS({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?._loaded?(this._styleDirty||=e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let t=this._idleTriggered?this._fadeDuration:0,r=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let i=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this._camera.transform.zoom,r=PS();this.style.zoomHistory.update(e,r);let n=new Nd(e,{now:r,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),a=n.crossFadingFactor();(1!==a||a!==this._crossFadingFactor)&&(i=!0,this._crossFadingFactor=a),this.style.update(n)}let n=this.style.projection?.transitionState>0!==r;this._camera.transform.setTransitionState(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||n)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=this.style?._updatePlacement(this._camera.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,n),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new IS("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new IS("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let a=this._sourcesDirty||this._styleDirty||this._placementDirty||this.painter.renderToTexture?.needsFollowUpFrame;return a||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new IS("idle")),this._loaded&&!this._fullyLoaded&&!a&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),DS.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new IS("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,SS.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(e){if(!Os(e))throw e}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return"6.9.0"}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};const Sk={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};var Tk=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),r=e===this._map.getMinZoom(!0);this._zoomInButton.disabled=t,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},this._rotateCompassArrow=()=>{let e=this._map.getPitch(),t=this._map.getRoll(),r=this._map.getBearing(),i=1/Math.cos(Ts(e))**.5;this.options.visualizePitch&&this.options.visualizeRoll?this._compassIcon.style.transform=`scale(${i}) rotateZ(${-t}deg) rotateX(${e}deg) rotateZ(${-r}deg)`:this.options.visualizePitch?this._compassIcon.style.transform=`scale(${i}) rotateX(${e}deg) rotateZ(${-r}deg)`:this.options.visualizeRoll?this._compassIcon.style.transform=`rotate(${-r-t}deg)`:this._compassIcon.style.transform=`rotate(${-r}deg)`},this._setButtonTitle=(e,t)=>{let r=this._map._getUIString(`NavigationControl.${t}`);e.title=r,e.setAttribute("aria-label",r)},this.options=os({},Sk,e),this._container=ES.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),ES.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),ES.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=ES.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("move",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Pk(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("move",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let r=ES.create("button",e,this._container);return r.type="button",r.addEventListener("click",t),r}},Pk=class{constructor(e,t,r=!1){this.mousedown=e=>{this.startMove(e,ES.mousePos(this.element,e)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=e=>{this.move(e,ES.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{1===e.targetTouches.length?(this._startPos=this._lastPos=ES.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=e=>{1===e.targetTouches.length?(this._lastPos=ES.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos)):this.reset()},this.touchend=e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=t;let i=new OC;this._rotatePitchHandler=new FC({clickTolerance:3,move:(e,i)=>{let n=t.getBoundingClientRect(),a=new $a((n.bottom-n.top)/2,(n.right-n.left)/2);return{bearingDelta:Ds(new $a(e.x,i.y),i,a),pitchDelta:r?-.5*(i.y-e.y):void 0}},moveStateManager:i,enable:!0,assignEvents:()=>{}}),this.map=e,t.addEventListener("mousedown",this.mousedown),t.addEventListener("touchstart",this.touchstart,{passive:!1}),t.addEventListener("touchcancel",this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),ES.disableDrag()}move(e,t){let r=this.map,{bearingDelta:i,pitchDelta:n}=this._rotatePitchHandler.dragMove(e,t)||{};i&&r.setBearing(r.getBearing()+i),n&&r.setPitch(r.getPitch()+n)}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){ES.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}};function Ek(e,t,r,i=!1){if(i||!r.getCoveringTilesDetailsProvider().allowWorldCopies())return e?.wrap();let n=new _y(e.lng,e.lat);if(e=new _y(e.lng,e.lat),t){let i=new _y(e.lng-360,e.lat),n=new _y(e.lng+360,e.lat),a=r.locationToScreenPoint(e).distSqr(t);r.locationToScreenPoint(i).distSqr(t)<a?e=i:r.locationToScreenPoint(n).distSqr(t)<a&&(e=n)}for(;Math.abs(e.lng-r.center.lng)>180;){let t=r.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e.lng!==n.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(e))?e:n}const Dk={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 Ak(e,t,r){let i=e.classList;for(let e in Dk)i.remove(`maplibregl-${r}-anchor-${e}`);i.add(`maplibregl-${r}-anchor-${t}`)}const Ik={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},Ck="#3FB1CE";function kk(e,t,r=[]){let i=ES.createNS("http://www.w3.org/2000/svg",e);for(let e in t)i.setAttributeNS(null,e,t[e]);for(let e of r)i.appendChild(e);return i}let Mk;var Fk=class extends Ks{},Rk=class extends Ks{},Lk=class extends Js{constructor(e){if(super(),this._onClick=e=>{this.fire(new Rk("click",{originalEvent:e}))},this._onKeyPress=e=>{("Space"===e.code||"Enter"===e.code)&&this.togglePopup()},this._onKeyDown=e=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||e.composedPath()[0]!==this._element||e.altKey||e.ctrlKey||e.metaKey)return;let t=Ik[e.key];if(!t)return;e.preventDefault(),e.stopPropagation();let r=e.shiftKey?10:1,i=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new $a(i.x+t[0]*r,i.y+t[1]*r))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new Fk("dragstart"))),this.fire(new Fk("drag"))},this._onKeyUp=e=>{Ik[e.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=e=>{let t=e.originalEvent.target,r=this._element;this._popup&&(t===r||r.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;let t=this._map.loaded()&&!this._map.isMoving();("terrain"===e?.type||"render"===e?.type&&!t)&&this._map.once("render",this._update),this._lngLat=Ek(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let r="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?r=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let i="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?i="rotateX(0deg)":"map"===this._pitchAlignment&&(i=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&(!e||"moveend"===e.type)&&(this._pos=this._pos.round()),this._element.style.transform=`${Dk[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${i} ${r}`,SS.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity("moveend"===e?.type)}).catch(()=>{})},this._onMove=e=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new Fk("dragstart"))),this.fire(new Fk("drag")))},this._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),"active"===this._state&&this.fire(new Fk("dragend")),this._state="inactive"},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e?.anchor||"center",this._color=e?.color||Ck,this._scale=e?.scale||1,this._draggable=e?.draggable||!1,this._clickTolerance=e?.clickTolerance||0,this._subpixelPositioning=e?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=e?.rotation||0,this._rotationAlignment=e?.rotationAlignment||"auto",this._pitchAlignment=e?.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e?.element)this._element=e.element,this._offset=$a.convert(e?.offset||[0,0]);else{this._defaultMarker=!0,this._element=ES.create("div");let t=(Mk||(Mk=kk("svg",{display:"block",height:"41px",width:"27px",viewBox:"0 0 27 41"},[kk("g",{"fill-rule":"nonzero"},[kk("g",{transform:"translate(3.0, 29.0)",fill:"#000000"},[["10.5","5.25002273"],["10.5","5.25002273"],["9.5","4.77275007"],["8.5","4.29549936"],["7.5","3.81822308"],["6.5","3.34094679"],["5.5","2.86367051"],["4.5","2.38636864"]].map(([e,t])=>kk("ellipse",{opacity:"0.04",cx:"10.5",cy:"5.80029008",rx:e,ry:t}))),kk("g",{fill:Ck},[kk("path",{d:"M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"})]),kk("g",{opacity:"0.25",fill:"#000000"},[kk("path",{d:"M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"})]),kk("g",{transform:"translate(6.0, 7.0)",fill:"#FFFFFF"}),kk("g",{transform:"translate(8.0, 8.0)"},[kk("circle",{fill:"#000000",opacity:"0.25",cx:"5.5",cy:"5.5",r:"5.4999962"}),kk("circle",{fill:"#FFFFFF",cx:"5.5",cy:"5.5",r:"5.4999962"})])])]),Mk)).cloneNode(!0);t.setAttributeNS(null,"height",41*this._scale+"px"),t.setAttributeNS(null,"width",27*this._scale+"px"),function(e){return e.firstElementChild.children[1]}(t).setAttributeNS(null,"fill",this._color),this._element.appendChild(t),this._offset=$a.convert(e?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",e=>{e.preventDefault()}),this._element.addEventListener("mousedown",e=>{e.preventDefault()}),Ak(this._element,this._anchor,"marker"),e?.className)for(let t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._updateAccessibilityRole(),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),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("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=_y.convert(e),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),e){if(!("offset"in e.options)){let t=13.5/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[t,-1*(24.6+t)],"bottom-right":[-t,-1*(24.6+t)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new Fk("dragend")))}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){let t=this._map?.terrain,r=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!t||r){let e=r?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==e&&(this._element.style.opacity=e,this._element.classList.toggle("maplibregl-marker-covered",r)))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let i=this._map,n=i.terrain.depthAtPoint(this._pos),a=i.terrain.getElevationForLngLat(this._lngLat,i._camera.transform);if(i._camera.transform.lngLatToCameraDepth(this._lngLat,a)-n<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");let o=-this._offset.y/i._camera.transform.pixelsPerMeter,s=Math.sin(i.getPitch()*Math.PI/180)*o,l=i.terrain.depthAtPoint(new $a(this._pos.x,this._pos.y-this._offset.y)),u=i._camera.transform.lngLatToCameraDepth(this._lngLat,a+s)-l>.006;this._popup?.isOpen()&&u&&this._popup.remove(),this._element.style.opacity=u?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",u)}getOffset(){return this._offset}setOffset(e){return this._offset=$a.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=!0):this._tabIndexManaged&&=("0"===this._element.getAttribute("tabindex")&&this._element.removeAttribute("tabindex"),!1)}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let e=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",e),this._roleManaged=!0}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(void 0===this._opacity||void 0===e&&void 0===t)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==e&&(this._opacity=String(e)),void 0!==t&&(this._opacityWhenCovered=String(t)),this._map&&this._updateOpacity(!0),this}};const zk={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},Ok=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");var Bk=class extends Ks{},jk=class extends Js{constructor(e){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity="")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new Bk("close"))),this),this._update=e=>{let t,r=this._lngLat||this._trackPointer;if(!this._map||!r||!this._content)return;if(!this._container){if(this._container=ES.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ES.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let e of this.options.className.split(" "))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Ek(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer),e&&"point"in e&&e.point&&(t=e.point),this._trackPointer&&!t)return;let i=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map._camera.transform.locationToScreenPoint(this._lngLat));let n=this.options.anchor,a=Nk(this.options.offset);if(!n){let e,t=this._container.offsetWidth,r=this._container.offsetHeight,o=function(e){return e?{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}:{top:0,right:0,bottom:0,left:0}}(this.options.padding);e=i.y+a.bottom.y<r+o.top?["top"]:i.y>this._map._camera.transform.height-r-o.bottom?["bottom"]:[],i.x<t/2+o.left?e.push("left"):i.x>this._map._camera.transform.width-t/2-o.right&&e.push("right"),n=0===e.length?"bottom":e.join("-")}let o=i.add(a[n]);this.options.subpixelPositioning||(o=o.round()),this._container.style.transform=`${Dk[n]} translate(${o.x}px,${o.y}px)`,Ak(this._container,n,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=os(Object.create(zk),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new Bk("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=_y.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t,r=document.createDocumentFragment(),i=document.createElement("body");for(i.innerHTML=e;t=i.firstChild,t;)r.appendChild(t);return this.setDOMContent(r)}getMaxWidth(){return this._container?.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=ES.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=ES.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(Ok);e&&e.focus()}};function Nk(e){if(!e)return Nk(new $a(0,0));if("number"==typeof e){let t=Math.round(Math.abs(e)/Math.SQRT2);return{center:new $a(0,0),top:new $a(0,e),"top-left":new $a(t,t),"top-right":new $a(-t,t),bottom:new $a(0,-e),"bottom-left":new $a(t,-t),"bottom-right":new $a(-t,-t),left:new $a(e,0),right:new $a(-e,0)}}if(e instanceof $a||Array.isArray(e)){let t=$a.convert(e);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:$a.convert(e.center||[0,0]),top:$a.convert(e.top||[0,0]),"top-left":$a.convert(e["top-left"]||[0,0]),"top-right":$a.convert(e["top-right"]||[0,0]),bottom:$a.convert(e.bottom||[0,0]),"bottom-left":$a.convert(e["bottom-left"]||[0,0]),"bottom-right":$a.convert(e["bottom-right"]||[0,0]),left:$a.convert(e.left||[0,0]),right:$a.convert(e.right||[0,0])}}function Uk(e){return Uk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uk(e)}function Vk(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Gk(i.key),i)}}function $k(e,t,r){return(t=Gk(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gk(e){var t=function(e){if("object"!=Uk(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Uk(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Uk(t)?t:t+""}var qk=function(){return function(e,t){return t&&Vk(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(function e(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),$k(this,"waiters",[]),$k(this,"slotsInUse",0),this.slotLimit=null!==(t=function(e){if(!Number.isFinite(e))return null;var t=Math.floor(e);return t<1||t>64?null:t}(r))&&void 0!==t?t:1},[{key:"limit",get:function(){return this.slotLimit}},{key:"inUse",get:function(){return this.slotsInUse}},{key:"waiting",get:function(){return this.waiters.length}},{key:"acquire",value:function(e){var t=this;return null!=e&&e.aborted?Promise.reject(new DOMException("Aborted","AbortError")):this.slotsInUse<this.slotLimit?(this.slotsInUse++,Promise.resolve()):new Promise(function(r,i){var n=function(){t.slotsInUse++,r()};t.waiters.push(n),e&&e.addEventListener("abort",function(){var e=t.waiters.indexOf(n);-1!==e&&(t.waiters.splice(e,1),i(new DOMException("Aborted","AbortError")))},{once:!0})})}},{key:"release",value:function(){if(this.slotsInUse>0){this.slotsInUse--;var e=this.waiters.shift();e&&e()}}}])}();function Zk(e){var t,r,i,n,a,o,s=null!==(t=null==e?void 0:e.backgroundColor)&&void 0!==t?t:"#276EF1",l=null!==(r=null==e?void 0:e.arrowColor)&&void 0!==r?r:"#FFFFFF",u=null!==(i=null==e?void 0:e.arrowWidth)&&void 0!==i?i:0,c=null!==(n=null==e?void 0:e.borderWidth)&&void 0!==n?n:0,h=null!==(a=null==e?void 0:e.borderColor)&&void 0!==a?a:"#000000",d=null!==(o=null==e?void 0:e.blur)&&void 0!==o?o:0,p="fill:".concat(s,";"),f=c>0?"stroke:".concat(h,";stroke-width:").concat(c,";"):"",m="fill:".concat(l,";"),g=u>0?"stroke:".concat(l,";stroke-width:").concat(u,";"):"",y=d>0?"blurFilter":"",_=d>0?'<defs><filter id="'.concat(y,'"><feGaussianBlur in="SourceGraphic" stdDeviation="').concat(d,'"/></filter></defs>'):"",v=d>0?'filter="url(#'.concat(y,')"'):"",b='<?xml version="1.0" encoding="utf-8"?>\n<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 30 30" style="enable-background:new 0 0 30 30;" xml:space="preserve">\n'.concat(_,"\n<g ").concat(v,'>\n\t<circle cx="15" cy="15" r="15" style="').concat(p).concat(f,'"/>\n\t<path style="').concat(m).concat(g,'" d="M16.4471 7.26386C16.2568 6.80696 15.808 6.51052 15.3131 6.51052C14.8181 6.51052 14.3693 6.80696 14.179 7.26386L8.52211 20.7533C8.29366 21.2972 8.48404 21.9227 8.97085 22.2518C9.45767 22.5809 10.1104 22.5156 10.5265 22.0995L15.3131 17.3129L20.0996 22.0995C20.5157 22.5156 21.1657 22.5782 21.6553 22.2518C22.1448 21.9254 22.3325 21.2972 22.104 20.7533L16.4471 7.26386Z"/>\n</g>\n</svg>'),x=encodeURIComponent(b);return"data:image/svg+xml,".concat(x)}var Wk=Zk();function Hk(){for(var e="",t=0;t<10;t++)e+="0123456789ABCDEF".charAt(Math.floor(16*Math.random()));return e}function Xk(e){var t={lat:-1/0,lng:-1/0},r={lat:1/0,lng:1/0};return e.forEach(function(e){e.lat>t.lat&&(t.lat=e.lat),e.lng>t.lng&&(t.lng=e.lng),e.lat<r.lat&&(r.lat=e.lat),e.lng<r.lng&&(r.lng=e.lng)}),[r,t]}function Kk(e){return Kk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kk(e)}function Yk(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Jk(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yk(Object(r),!0).forEach(function(t){iM(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yk(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Qk(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Qk=function(){return!!e})()}function eM(){return eM="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var i=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=tM(e)););return e}(e,t);if(i){var n=Object.getOwnPropertyDescriptor(i,t);return n.get?n.get.call(arguments.length<3?e:r):n.value}},eM.apply(null,arguments)}function tM(e){return tM=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tM(e)}function rM(e,t){return rM=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},rM(e,t)}function iM(e,t,r){return(t=sM(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function aM(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,sM(i.key),i)}}function oM(e,t,r){return t&&aM(e.prototype,t),r&&aM(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function sM(e){var t=function(e){if("object"!=Kk(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=Kk(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Kk(t)?t:t+""}var lM=function(e){return e[e.left=0]="left",e[e.right=1]="right",e[e.top=2]="top",e[e.bottom=3]="bottom",e}({}),uM=40,cM=function(){return oM(function e(){nM(this,e)},null,[{key:"createMarkerElement",value:function(e){var t,r,i,n,a=document.createElement("div"),o=null!==(t=null===(r=e.iconProperties)||void 0===r?void 0:r.width)&&void 0!==t?t:uM,s=null!==(i=null===(n=e.iconProperties)||void 0===n?void 0:n.height)&&void 0!==i?i:uM;if(a.className="mapvx-marker",a.addEventListener("click",function(){var t;null===(t=e.onClick)||void 0===t||t.call(e)}),e.element)return e.iconProperties&&(a.style.width="".concat(o,"px"),a.style.height="".concat(s,"px")),a.appendChild(e.element),this.setAndCreateText(e,a);a.style.width="".concat(o,"px"),a.style.height="".concat(s,"px");var l=this.createIconElement(e,o,s);return a.appendChild(l),this.setAndCreateText(e,a)}},{key:"setAndCreateText",value:function(e,t){if(e.text){var r="string"==typeof e.text?this.createTextElement(e.text,e.textProperties):e.text,i=this.createTextContainer(r,e.textPosition,e.maxLabelWidthPx);t.appendChild(i)}return t}},{key:"createIconElement",value:function(e,t,r){if("string"==typeof e.icon)return this.createIcon(e);if(e.icon instanceof HTMLImageElement)return e.icon.style.width="".concat(t,"px"),e.icon.style.height="".concat(r,"px"),e.icon;if(e.icon)return e.icon;var i=document.createElement("div");return i.className="icon-default",i.style.width="".concat(t,"px"),i.style.height="".concat(r,"px"),i}},{key:"createTextContainer",value:function(e,t,r){var i=document.createElement("div");return i.className="text-container",i.style.maxWidth="".concat(null!=r?r:200,"px"),this.setTextPositionClass(i,this.resolveTextPosition(t)),e.style.display="block",e.style.margin="0",i.appendChild(e),i}},{key:"resolveTextPosition",value:function(e){return null!=e?e:lM.right}},{key:"setTextPositionClass",value:function(e,t){e.classList.remove("top","bottom","left","right"),e.classList.add(lM[t])}},{key:"applyTextPosition",value:function(e,t,r){this.setTextPositionClass(e,t),e.style.visibility=r?"hidden":""}},{key:"createIcon",value:function(e){var t,r,i,n,a=document.createElement("img");return a.src="string"==typeof e.icon?e.icon:"",a.width=null!==(t=null===(r=e.iconProperties)||void 0===r?void 0:r.width)&&void 0!==t?t:uM,a.height=null!==(i=null===(n=e.iconProperties)||void 0===n?void 0:n.height)&&void 0!==i?i:uM,a.style.objectFit="contain",a.style.filter="drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25))",a}},{key:"createTextElement",value:function(e,t){var r,i,n,a,o,s,l,u=document.createElement("p");return u.textContent=e,u.style.fontSize=null!==(r=null==t?void 0:t.fontSize)&&void 0!==r?r:"14px",u.style.padding=null!==(i=null==t?void 0:t.padding)&&void 0!==i?i:"0px",u.style.margin=null!==(n=null==t?void 0:t.margin)&&void 0!==n?n:"0px",u.style.fontWeight=null!==(a=null==t?void 0:t.fontWeight)&&void 0!==a?a:"600",u.style.fontFamily=null!==(o=null==t?void 0:t.fontFamily)&&void 0!==o?o:"'Open Sans', sans-serif",u.style.color=null!==(s=null==t?void 0:t.color)&&void 0!==s?s:"#000000",u.style.textShadow=null!==(l=null==t?void 0:t.textShadow)&&void 0!==l?l:"-1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff",u}}])}(),hM=function(e){function t(e){var r,i,n,a,o,s;return nM(this,t),iM(s=function(e,t,r){return t=tM(t),function(e,t){if(t&&("object"==Kk(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Qk()?Reflect.construct(t,r||[],tM(e).constructor):t.apply(e,r))}(this,t,[{element:cM.createMarkerElement(e),draggable:!1,anchor:null!==(r=e.anchor)&&void 0!==r?r:"center",offset:[0,0]}]),"hiddenOnPurpose",!1),s.setLngLat([e.coordinate.lng,e.coordinate.lat]),s.setRotationAlignment(null!==(i=e.rotationAlignment)&&void 0!==i?i:"viewport"),s.setPitchAlignment("viewport"),"number"==typeof e.rotation&&s.setRotation(e.rotation),s.id=null!==(n=e.id)&&void 0!==n?n:Hk(),s.coordinate=e.coordinate,s.floorId=null!==(a=e.floorId)&&void 0!==a?a:"",s.anchorType=null!==(o=e.anchor)&&void 0!==o?o:"center",s.currentConfig=e,s.applyLayoutState(e),s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&rM(e,t)}(t,e),oM(t,[{key:"applyLayoutState",value:function(e){var t,r,i,n,a;this.iconSize={width:null!==(t=null===(r=e.iconProperties)||void 0===r?void 0:r.width)&&void 0!==t?t:uM,height:null!==(i=null===(n=e.iconProperties)||void 0===n?void 0:n.height)&&void 0!==i?i:uM},this.preferredTextPosition=cM.resolveTextPosition(e.textPosition),this.labelPriority=null!==(a=e.labelPriority)&&void 0!==a?a:0,this.measureIconFromDom=null!=e.element&&null==e.iconProperties,this.textContainerEl=this.findTextContainerEl()}},{key:"mergeConfig",value:function(e){return Jk(Jk(Jk({},this.currentConfig),e),{},{element:e.element})}},{key:"findTextContainerEl",value:function(){return Array.from(this._element.children).find(function(e){return e instanceof HTMLElement&&e.classList.contains("text-container")})}},{key:"addToMap",value:function(e){e&&this.addTo(e)}},{key:"updateIcon",value:function(e){var t,r=this.mergeConfig(e);if(r.element)this._element.innerHTML="",this._element.appendChild(r.element);else{var i,n=cM.createMarkerElement(r),a=this._element.querySelector("div"),o=n.querySelector("div");o&&(null==a||null===(i=a.parentElement)||void 0===i||i.replaceChild(o,a))}this.setRotationAlignment(null!==(t=r.rotationAlignment)&&void 0!==t?t:"viewport"),this.setPitchAlignment("viewport"),"number"==typeof r.rotation&&this.setRotation(r.rotation),this.currentConfig=r,this.applyLayoutState(r)}},{key:"setFloor",value:function(e){this.floorId=e}},{key:"hide",value:function(){this.hiddenOnPurpose=!0,this.remove()}},{key:"show",value:function(e){e&&this.addTo(e)}},{key:"addTo",value:function(e){return this.hiddenOnPurpose=!1,function(e,t,r){var i=eM(tM(e.prototype),"addTo",r);return"function"==typeof i?function(e){return i.apply(r,e)}:i}(t,0,this)([e])}},{key:"changeFloor",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e==this.floorId||r&&!this.floorId?this.show(t):this.hide()}}])}(Lk);function dM(e){return dM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dM(e)}function pM(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=fM(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function fM(e,t){if(e){if("string"==typeof e)return mM(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mM(e,t):void 0}}function mM(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function gM(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,_M(i.key),i)}}function yM(e,t,r){return(t=_M(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _M(e){var t=function(e){if("object"!=dM(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=dM(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==dM(t)?t:t+""}var vM={center:{fx:.5,fy:.5},top:{fx:.5,fy:0},bottom:{fx:.5,fy:1},left:{fx:0,fy:.5},right:{fx:1,fy:.5},"top-left":{fx:0,fy:0},"top-right":{fx:1,fy:0},"bottom-left":{fx:0,fy:1},"bottom-right":{fx:1,fy:1}},bM=[lM.right,lM.top,lM.left,lM.bottom];function xM(e,t,r){var i,n=null!==(i=vM[r])&&void 0!==i?i:vM.center,a=n.fx,o=n.fy;return{left:e.x-a*t.width,top:e.y-o*t.height,width:t.width,height:t.height}}function wM(e,t,r,i,n){switch(r){case lM.left:return{left:e.left-i-t.width,top:e.top+e.height/2-t.height/2,width:t.width,height:t.height};case lM.top:return{left:e.left+e.width/2-t.width/2,top:e.top-n-t.height,width:t.width,height:t.height};case lM.bottom:return{left:e.left+e.width/2-t.width/2,top:e.top+e.height+n,width:t.width,height:t.height};case lM.right:default:return{left:e.left+e.width+i,top:e.top+e.height/2-t.height/2,width:t.width,height:t.height}}}function SM(e,t){return e.left<t.left+t.width&&e.left+e.width>t.left&&e.top<t.top+t.height&&e.top+e.height>t.top}var TM=function(){return function(e,t){return t&&gM(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(function e(t,r){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),yM(this,"labelSizeCache",new WeakMap),yM(this,"iconSizeCache",new WeakMap),yM(this,"lastAppliedState",new WeakMap),yM(this,"attached",!1),this.mapvxMap=t,this.config=r,this.boundOnMove=function(){return i.scheduleRelayout()}},[{key:"map",get:function(){return this.mapvxMap.map}},{key:"attach",value:function(){this.attached||(this.attached=!0,this.map.on("move",this.boundOnMove),this.remeasureWhenFontsLoad(),this.scheduleRelayout())}},{key:"applyLayoutVariables",value:function(e){e.style.setProperty("--mapvx-label-gap","".concat(this.config.gapPx,"px")),e.style.setProperty("--mapvx-label-vertical-gap","".concat(this.config.verticalGapPx,"px")),e.style.setProperty("--mapvx-label-max-width","".concat(this.config.maxLabelWidthPx,"px"))}},{key:"remeasureWhenFontsLoad",value:function(){var e=this,t=document.fonts;t&&t.ready.then(function(){e.attached&&(e.labelSizeCache=new WeakMap,e.iconSizeCache=new WeakMap,e.scheduleRelayout())}).catch(function(){})}},{key:"destroy",value:function(){this.attached&&(this.map.off("move",this.boundOnMove),this.attached=!1),void 0!==this.rafHandle&&(cancelAnimationFrame(this.rafHandle),this.rafHandle=void 0)}},{key:"invalidateMarker",value:function(e){this.labelSizeCache.delete(e),this.iconSizeCache.delete(e),this.lastAppliedState.delete(e)}},{key:"scheduleRelayout",value:function(){var e=this;this.config.enabled&&void 0===this.rafHandle&&(this.rafHandle=requestAnimationFrame(function(){e.rafHandle=void 0,e.performLayout()}))}},{key:"performLayout",value:function(){if(this.attached){var e=this.mapvxMap.getMarkers();if(0!==e.length){var t=this.map.getContainer(),r=t.clientWidth,i=t.clientHeight,n=this.config.maxLabelWidthPx+Math.max(this.config.gapPx,this.config.verticalGapPx),a=this.map.getZoom()>=this.config.minZoomForLabels,o=this.readMarkers(e,r,i,n),s=this.decidePlacements(o,a);this.applyDecisions(s)}}}},{key:"readMarkers",value:function(e,t,r,i){var n,a=[],o=pM(e);try{for(o.s();!(n=o.n()).done;){var s=n.value;if(s.getElement().isConnected){var l=xM(this.map.project(s.getLngLat()),this.resolveIconSize(s),s.anchorType);l.left+l.width<-i||l.left>t+i||l.top+l.height<-i||l.top>r+i||a.push({marker:s,iconRect:l,labelSize:this.resolveLabelSize(s)})}}}catch(e){o.e(e)}finally{o.f()}return a}},{key:"resolveLabelSize",value:function(e){var t=e.textContainerEl;if(t)return this.measureCached(this.labelSizeCache,e,t)}},{key:"resolveIconSize",value:function(e){var t;return e.measureIconFromDom&&null!==(t=this.measureCached(this.iconSizeCache,e,e.getElement()))&&void 0!==t?t:e.iconSize}},{key:"measureCached",value:function(e,t,r){var i=e.get(t);if(i)return i;var n={width:r.offsetWidth,height:r.offsetHeight};return n.width<=0||n.height<=0?void 0:(e.set(t,n),n)}},{key:"decidePlacements",value:function(e,t){var r=this,i=[],n=e.filter(PM),a=new Map;if(!t){var o,s=pM(n);try{for(s.s();!(o=s.n()).done;){var l=o.value;a.set(l.marker,{position:l.marker.preferredTextPosition,hidden:!0})}}catch(e){s.e(e)}finally{s.f()}return a}n.sort(function(e,t){return t.marker.labelPriority-e.marker.labelPriority});var u,c=pM(n);try{var h=function(){var t,n=u.value,o=[n.marker.preferredTextPosition].concat((t=bM.filter(function(e){return e!==n.marker.preferredTextPosition}),function(e){if(Array.isArray(e))return mM(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||fM(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())).map(function(e){return{position:e,rect:wM(n.iconRect,n.labelSize,e,r.config.gapPx,r.config.verticalGapPx)}}).find(function(t){var a=t.rect;return!r.collides(a,n.marker,e,i)});o?(i.push(o.rect),a.set(n.marker,{position:o.position,hidden:!1})):a.set(n.marker,{position:n.marker.preferredTextPosition,hidden:!0})};for(c.s();!(u=c.n()).done;)h()}catch(e){c.e(e)}finally{c.f()}return a}},{key:"collides",value:function(e,t,r,i){var n=function(e,t){return{left:e.left-t,top:e.top-t,width:e.width+2*t,height:e.height+2*t}}(e,this.config.paddingPx);return r.some(function(e){return e.marker!==t&&SM(n,e.iconRect)})||i.some(function(e){return SM(n,e)})}},{key:"applyDecisions",value:function(e){var t=this;e.forEach(function(e,r){var i=t.lastAppliedState.get(r);i&&i.position===e.position&&i.hidden===e.hidden||(r.textContainerEl&&cM.applyTextPosition(r.textContainerEl,e.position,e.hidden),t.lastAppliedState.set(r,e))})}}])}();function PM(e){return void 0!==e.labelSize}function EM(e){return{id:e.id,route:e,aheadId:"AHEAD_".concat(e.id),behindId:"BEHIND_".concat(e.id),currentId:"CURRENT_".concat(e.id),aheadSourceData:{type:"FeatureCollection",features:[]},behindSourceData:{type:"FeatureCollection",features:[]},currentSourceData:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}},animationStatus:"NO_ROUTE",stepAnimationStatus:"NO_ROUTE",layerDrawConfigs:{}}}function DM(e){return DM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},DM(e)}function AM(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,IM(i.key),i)}}function IM(e){var t=function(e){if("object"!=DM(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=DM(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==DM(t)?t:t+""}var CM=Math.asin,kM=Math.atan2,MM=Math.cos,FM=Math.sin,RM=Math.pow,LM=Math.sqrt,zM=Math.PI;function OM(e){return FM(e/2)*FM(e/2)}function BM(e){return e*(zM/180)}function jM(e){return e*(180/zM)}function NM(e,t){return e.lat===t.lat&&e.lng===t.lng}var UM=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){return r&&AM(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,0,[{key:"distance",value:function(t,r){var i=BM(t.lat),n=BM(r.lat),a=BM(t.lng),o=BM(r.lng)-a,s=OM(n-i)+MM(i)*MM(n)*OM(o);return 2*e.EARTH_RADIUS*CM(LM(s))}},{key:"intermediatePointBetween",value:function(t,r,i){var n=BM(t.lat),a=BM(r.lat),o=BM(t.lng),s=BM(r.lng),l=e.distance(t,r)/e.EARTH_RADIUS,u=FM((1-i)*l)/FM(l),c=FM(i*l)/FM(l),h=u*MM(n)*MM(o)+c*MM(a)*MM(s),d=u*MM(n)*FM(o)+c*MM(a)*FM(s),p=u*FM(n)+c*FM(a),f=kM(p,LM(RM(h,2)+RM(d,2))),m=kM(d,h);return{lat:jM(f),lng:jM(m)}}},{key:"bearingInDegBetween",value:function(t,r){return jM(e.bearingInRadBetween(t,r))}},{key:"bearingInRadBetween",value:function(e,t){var r=t.lng-e.lng,i=t.lat-e.lat;return(zM/2-kM(i,r)+2*zM)%(2*zM)}},{key:"intermediateAngleBetween",value:function(e,t,r){var i=(t-e+180)%360-180;return i<-180&&(i+=360),(e+360+i*r)%360}}])}();function VM(e){return VM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},VM(e)}function $M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function GM(e){return function(e){if(Array.isArray(e))return HM(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||WM(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qM(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||WM(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ZM(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=WM(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function WM(e,t){if(e){if("string"==typeof e)return HM(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?HM(e,t):void 0}}function HM(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function XM(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,YM(i.key),i)}}function KM(e,t,r){return(t=YM(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function YM(e){var t=function(e){if("object"!=VM(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=VM(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==VM(t)?t:t+""}!function(e,t,r){(t=IM(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(UM,"EARTH_RADIUS",6378e3);var JM={top:150,right:150,bottom:150,left:150},QM="rgba(0, 0, 0, 0)",eF=1/256,tF=function(e){return["interpolate",["linear"],["line-progress"],0,e,1,e]},rF=function(){return function(e,t){return t&&XM(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),KM(this,"routes",new Map),this.mapvxMap=t},[{key:"map",get:function(){return this.mapvxMap.map}},{key:"resolveInstance",value:function(e){var t=null!=e?e:this.lastAddedRouteId;return t?this.routes.get(t):void 0}},{key:"addSourcesAndLayersForRoute",value:function(e){this.map.addSource(e.aheadId,{type:"geojson",lineMetrics:!0,data:e.aheadSourceData}),this.map.addLayer({id:e.aheadId,type:"line",source:e.aheadId,layout:{"line-join":"round","line-cap":"round"}}),this.map.addSource(e.behindId,{type:"geojson",lineMetrics:!0,data:e.behindSourceData}),this.map.addLayer({id:e.behindId,type:"line",source:e.behindId,layout:{"line-join":"round","line-cap":"round"}}),this.map.addSource(e.currentId,{type:"geojson",lineMetrics:!0,data:e.currentSourceData}),this.map.addLayer({id:e.currentId,type:"line",source:e.currentId,layout:{"line-join":"round","line-cap":"round"}})}},{key:"removeSourcesAndLayersForRoute",value:function(e){for(var t=0,r=[e.aheadId,e.behindId,e.currentId];t<r.length;t++){var i=r[t];try{this.map.removeLayer(i)}catch(e){}try{this.map.removeSource(i)}catch(e){}}}},{key:"addSourcesAndLayers",value:function(){var e,t=ZM(this.routes.values());try{for(t.s();!(e=t.n()).done;){var r=e.value;this.addSourcesAndLayersForRoute(r),this.restoreLayerPaint(r)}}catch(e){t.e(e)}finally{t.f()}this.syncRouteCollision()}},{key:"restoreLayerPaint",value:function(e){for(var t,r=0,i=Object.entries(e.layerDrawConfigs);r<i.length;r++){var n=qM(i[r],2),a=n[0],o=n[1];this.setLayerPaint(e,a,o)}var s=null!==(t=e.revealFraction)&&void 0!==t?t:0;e.revealFraction=void 0,this.applyReveal(e,s)}},{key:"syncRouteCollision",value:function(){var e,t=[],r=ZM(this.routes.values());try{for(r.s();!(e=r.n()).done;){var i,n=ZM(e.value.route.steps);try{for(n.s();!(i=n.n()).done;){var a,o=i.value,s=this.getFloorKeyForStep(o),l=ZM(o.coordinates);try{for(l.s();!(a=l.n()).done;){var u=a.value;t.push({lng:u.lng,lat:u.lat,floorKey:s})}}catch(e){l.e(e)}finally{l.f()}}}catch(e){n.e(e)}finally{n.f()}}}catch(e){r.e(e)}finally{r.f()}this.mapvxMap.setRouteCollisionPath(t)}},{key:"addRoute",value:function(e,t){var r=EM(e);this.routes.set(r.id,r),this.lastAddedRouteId=r.id,this.addSourcesAndLayersForRoute(r),this.setSourceData(r,r.aheadId,e.steps),this.setLayerPaint(r,r.aheadId,t),this.updateLayerFilter(r.aheadId),this.syncRouteCollision()}},{key:"updateRouteProgress",value:function(e,t,r){var i=this.routes.get(e);if(i){for(var n=i.route.steps,a=1/0,o=0,s=0,l=0,u=0;u<n.length;u++)for(var c=n[u].coordinates,h=0;h<c.length-1;h++){var d=c[h],p=c[h+1],f=this.projectPointToSegment(t,d,p),m=f.fraction,g=f.dist;g<a&&(a=g,o=u,s=h,l=m)}for(var y=[],_=0;_<o;_++)y.push({type:"Feature",properties:{floor_key:this.getFloorKeyForStep(n[_])},geometry:{type:"LineString",coordinates:n[_].geoJsonCoordinates}});for(var v=n[o],b=v.coordinates,x=[],w=0;w<=s;w++)x.push([b[w].lng,b[w].lat]);var S=b[s],T=b[Math.min(s+1,b.length-1)],P=S.lat+l*(T.lat-S.lat),E=S.lng+l*(T.lng-S.lng);x.push([E,P]),x.length>=2&&y.push({type:"Feature",properties:{floor_key:this.getFloorKeyForStep(v)},geometry:{type:"LineString",coordinates:x}});for(var D=[],A=[[E,P]],I=s+1;I<b.length;I++)A.push([b[I].lng,b[I].lat]);A.length>=2&&D.push({type:"Feature",properties:{floor_key:this.getFloorKeyForStep(v)},geometry:{type:"LineString",coordinates:A}});for(var C=o+1;C<n.length;C++)D.push({type:"Feature",properties:{floor_key:this.getFloorKeyForStep(n[C])},geometry:{type:"LineString",coordinates:n[C].geoJsonCoordinates}});i.behindSourceData.features=y;var k=this.map.getSource(i.behindId);null==k||k.setData(i.behindSourceData),i.aheadSourceData.features=D;var M=this.map.getSource(i.aheadId);null==M||M.setData(i.aheadSourceData),this.setLayerPaint(i,i.behindId,r),this.updateLayerFilter(i.behindId),this.updateLayerFilter(i.aheadId)}}},{key:"projectPointToSegment",value:function(e,t,r){var i=r.lng-t.lng,n=r.lat-t.lat,a=i*i+n*n;if(0===a){var o=e.lng-t.lng,s=e.lat-t.lat;return{fraction:0,dist:o*o+s*s}}var l=((e.lng-t.lng)*i+(e.lat-t.lat)*n)/a;l=Math.max(0,Math.min(1,l));var u=t.lng+l*i,c=t.lat+l*n,h=e.lng-u,d=e.lat-c;return{fraction:l,dist:h*h+d*d}}},{key:"setSourceData",value:function(e,t,r){var i=this.createFeaturesFrom(r),n=this.map.getSource(t);t===e.aheadId?(e.aheadSourceData.features=i,null==n||n.setData(e.aheadSourceData)):t===e.behindId&&(e.behindSourceData.features=i,null==n||n.setData(e.behindSourceData))}},{key:"loadStepGeometry",value:function(e,t){var r;e.currentSourceData.properties={floor_key:this.getFloorKeyForStep(t)};var i=null!==(r=null==t?void 0:t.coordinates)&&void 0!==r?r:[];e.currentSourceData.geometry.coordinates=i.length>=2?i.map(function(e){return[e.lng,e.lat]}):[];for(var n=[0],a=1;a<i.length;a++)n.push(n[a-1]+UM.distance(i[a-1],i[a]));e.stepMetrics={cumulative:n,total:n[n.length-1]},e.revealFraction=void 0,this.applyReveal(e,0);var o=this.map.getSource(e.currentId);null==o||o.setData(e.currentSourceData)}},{key:"fractionAlongStep",value:function(e,t,r){var i,n=e.stepMetrics;if(!n||n.total<=0)return 1;var a=Math.min(t,n.cumulative.length-1);return((null!==(i=n.cumulative[a])&&void 0!==i?i:0)+r)/n.total}},{key:"applyReveal",value:function(e,t){var r=e.currentLineColor;if(void 0!==r){var i=Math.max(0,Math.min(1,t));e.revealFraction!==i&&this.hasSource(e.currentId)&&(e.revealFraction=i,this.map.setPaintProperty(e.currentId,"line-gradient",this.revealGradient(r,i),{validate:!1}))}}},{key:"revealGradient",value:function(e,t){return t<=0?tF(QM):t>=1?tF(e):["interpolate",["linear"],["line-progress"],t,e,Math.min(t+eF,1),QM]}},{key:"stepSourcesReady",value:function(e){try{return!!this.map.getSource(e.currentId)&&!1!==this.map.isSourceLoaded(e.currentId)}catch(e){return!1}}},{key:"hasSource",value:function(e){try{return null!=this.map.getSource(e)}catch(e){return!1}}},{key:"applyPendingFloor",value:function(e){var t,r=null===(t=e.conditions)||void 0===t?void 0:t.pendingFloor;r&&e.conditions&&(e.conditions.pendingFloor=void 0,this.updatePlaceFloorForRouting(e,r.placeId,r.floorKey),this.setMarkerLngLat(e,r.location))}},{key:"setLayerPaint",value:function(e,t,r){e.layerDrawConfigs[t]=r;for(var i=this.preparePaintForLayer(r),n=0,a=Object.entries(i);n<a.length;n++){var o=qM(a[n],2),s=o[0],l=o[1];this.map.setPaintProperty(t,s,l)}}},{key:"setCurrentDrawConfig",value:function(e,t){e.currentDrawConfig=t,e.currentLineColor=this.lineColorExpression(t)}},{key:"lineColorExpression",value:function(e){if("color"in e.routeStyle)return e.routeStyle.color;var t=e.routeStyle,r=t.colors,i=t.positions,n=null!=i?i:function(e){if(0===e)return[];if(1===e)return[0];var t=1/(e-1);return Array.from({length:e},function(e,r){return r*t})}(r.length);if(n.length!==r.length)throw new Error("Error: position array has different length than colors array");var a,o=(a=r,n.flatMap(function(e,t){return[e,a[t]]}));return["interpolate",["linear"],["line-progress"]].concat(GM(o))}},{key:"preparePaintForLayer",value:function(e){var t=this.lineColorExpression(e);return"string"==typeof t?{"line-color":t,"line-gradient":null,"line-width":e.polylineWidth}:{"line-color":null,"line-gradient":t,"line-width":e.polylineWidth}}},{key:"updateLayerFilter",value:function(e,t){var r=null!=t?t:this.mapvxMap.getCurrentFloor();void 0!==r&&null!=this.map.getLayer(e)&&this.map.setFilter(e,["==",["get","floor_key"],r])}},{key:"getFloorKeyForStep",value:function(e){var t,r,i,n,a,o,s;if(!e)return this.mapvxMap.getCurrentFloor();if((null!==(t=null===(r=e.startInsideFloor)||void 0===r?void 0:r.length)&&void 0!==t?t:0)>0)return(null!==(o=null===(s=e.endInsideFloor)||void 0===s?void 0:s.length)&&void 0!==o?o:0)>0&&e.startInsideFloor!==e.endInsideFloor&&!e.elevatorStep?e.endInsideFloor:e.startInsideFloor;if((null!==(i=null===(n=e.endInsideFloor)||void 0===n?void 0:n.length)&&void 0!==i?i:0)>0)return e.endInsideFloor;var l=this.mapvxMap.getInnerFloors().find(function(e){return!0===e.reachableFromGPS});return null!==(a=null==l?void 0:l.key)&&void 0!==a?a:""}},{key:"createFeaturesFrom",value:function(e){var t=this;return e.map(function(e){return{type:"Feature",properties:{floor_key:t.getFloorKeyForStep(e)},geometry:{type:"LineString",coordinates:e.geoJsonCoordinates}}})}},{key:"updateRouteLayers",value:function(e){var t,r=ZM(this.routes.values());try{for(r.s();!(t=r.n()).done;){var i=t.value;this.updateLayerFilter(i.aheadId,e),this.updateLayerFilter(i.behindId,e),this.updateLayerFilter(i.currentId,e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"getRouteMarkers",value:function(){var e,t=[],r=ZM(this.routes.values());try{for(r.s();!(e=r.n()).done;){var i=e.value;i.routeMarker&&t.push(i.routeMarker)}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"updateRouteMarkerVisibility",value:function(e){var t,r=this.mapvxMap.isOutdoorFloor(e),i=ZM(this.routes.values());try{for(i.s();!(t=i.n()).done;){var n,a,o,s,l=t.value,u=null!==(n=null===(a=l.routeMarker)||void 0===a?void 0:a.floorId)&&void 0!==n?n:"";u===e||r&&""===u?null===(o=l.routeMarker)||void 0===o||o.show(this.map):null===(s=l.routeMarker)||void 0===s||s.hide()}}catch(e){i.e(e)}finally{i.f()}}},{key:"updatePlaceFloorForRouting",value:function(e,t,r){var i;t&&r&&(this.mapvxMap.updatePlaceAndFloorForRouting(t,r),this.updateRouteLayers(r),null===(i=e.routeMarker)||void 0===i||i.setFloor(r),this.updateRouteMarkerVisibility(r))}},{key:"startAnimating",value:function(e,t,r){var i,n,a=this,o=EM(e);this.routes.set(o.id,o),this.lastAddedRouteId=o.id,o.animationStatus="STARTED",o.route=e;var s=e.steps[0];if(this.addSourcesAndLayersForRoute(o),this.updatePlaceFloorForRouting(o,s.startInsidePlace,s.startInsideFloor),this.setSourceData(o,o.aheadId,e.steps),this.setSourceData(o,o.behindId,[]),this.setLayerPaint(o,o.aheadId,t.aheadConfig),this.setLayerPaint(o,o.behindId,t.behindConfig),this.setLayerPaint(o,o.currentId,t.behindConfig),this.setCurrentDrawConfig(o,t.behindConfig),this.loadStepGeometry(o,s),o.animationConfig=r,o.routeMarker=new hM({coordinate:s.startLocation,floorId:s.startInsideFloor,icon:t.routeIcon,rotationAlignment:"map"}),o.routeMarker.addToMap(this.map),null!==(i=r.autoFitByPlace)&&void 0!==i&&i.enabled&&e.steps.length>0&&s.startInsidePlace){var l;o.currentPlaceId=s.startInsidePlace;var u={padding:null!==(l=r.autoFitByPlace.padding)&&void 0!==l?l:JM};this.mapvxMap.fitRouteByPlace(e,s.startInsidePlace,u)}o.conditions={index:0,coordinatesIndex:0,iconRotation:0,rotatingIcon:!0,startTime:void 0,progress:0,resetTime:!1,waitStartTime:void 0,awaitingSources:!0,animationId:requestAnimationFrame(function(e){return a.animateStep(e,o)}),onFinish:function(e){return a.prepareForNextStep(e,o)}},null===(n=r.callBack)||void 0===n||n.call(r,{isFinished:!1,step:s}),this.syncRouteCollision()}},{key:"clearRouteInstance",value:function(e){var t;arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?e.conditions&&(e.conditions.pendingFloor=void 0):this.applyPendingFloor(e),null===(t=e.routeMarker)||void 0===t||t.remove(),e.routeMarker=void 0,this.setSourceData(e,e.aheadId,[]),this.setSourceData(e,e.behindId,[]),e.currentSourceData.geometry.coordinates=[];var r=this.map.getSource(e.currentId);null==r||r.setData(e.currentSourceData),"STARTED"!==e.animationStatus&&"ANIMATING"!==e.stepAnimationStatus||null==e.conditions||cancelAnimationFrame(e.conditions.animationId),e.animationStatus="NO_ROUTE",e.stepAnimationStatus="NO_ROUTE",e.conditions=void 0,e.animationConfig=void 0,e.currentPlaceId=void 0}},{key:"removeRoute",value:function(e){var t=this.resolveInstance(e);if(t){if(this.clearRouteInstance(t),this.removeSourcesAndLayersForRoute(t),this.routes.delete(t.id),this.lastAddedRouteId===t.id){var r=GM(this.routes.keys());this.lastAddedRouteId=r.length>0?r[r.length-1]:void 0}this.syncRouteCollision()}}},{key:"removeAllRoutes",value:function(){var e,t=ZM(this.routes.values());try{for(t.s();!(e=t.n()).done;){var r=e.value;this.clearRouteInstance(r,!1),this.removeSourcesAndLayersForRoute(r)}}catch(e){t.e(e)}finally{t.f()}this.routes.clear(),this.lastAddedRouteId=void 0,this.syncRouteCollision()}},{key:"getRouteIds",value:function(){return GM(this.routes.keys())}},{key:"internalPause",value:function(e){"STARTED"==e.animationStatus&&null!=e.conditions&&(cancelAnimationFrame(e.conditions.animationId),e.animationStatus="PAUSED")}},{key:"pauseAnimation",value:function(e){var t=this.resolveInstance(e);t&&this.internalPause(t)}},{key:"internalResume",value:function(e){var t=this;"PAUSED"==e.animationStatus&&null!=e.conditions&&(e.conditions.resetTime=!0,e.conditions.animationId=requestAnimationFrame(function(r){return t.animateStep(r,e)}),e.animationStatus="STARTED")}},{key:"resumeAnimation",value:function(e){var t=this.resolveInstance(e);t&&this.internalResume(t)}},{key:"restartAnimation",value:function(e){var t,r,i,n,a=this,o=this.resolveInstance(e);if(!o)throw new Error("Does not exist animated route to restart");if("NO_ROUTE"===o.animationStatus)throw new Error("Does not exist animated route to restart");if(null==o.conditions||null==o.animationConfig||null==o.route||null==o.routeMarker)throw new Error("Error: conditions and animationConfig should not be null at this point");"STARTED"===o.animationStatus&&cancelAnimationFrame(o.conditions.animationId),o.animationStatus="STARTED";var s=o.route.steps[0];if(this.updatePlaceFloorForRouting(o,s.startInsidePlace,s.startInsideFloor),this.setSourceData(o,o.aheadId,o.route.steps),this.setSourceData(o,o.behindId,[]),this.loadStepGeometry(o,s),null===(t=this.setMarkerRotation(o,0))||void 0===t||t.setLngLat(s.startLocation).addTo(this.map),null!==(r=o.animationConfig.autoFitByPlace)&&void 0!==r&&r.enabled&&o.route.steps.length>0&&s.startInsidePlace){var l;o.currentPlaceId=s.startInsidePlace;var u={padding:null!==(l=o.animationConfig.autoFitByPlace.padding)&&void 0!==l?l:JM};this.mapvxMap.fitRouteByPlace(o.route,s.startInsidePlace,u)}o.conditions={index:0,coordinatesIndex:0,iconRotation:0,rotatingIcon:!0,startTime:void 0,progress:0,resetTime:!1,waitStartTime:void 0,awaitingSources:!0,animationId:requestAnimationFrame(function(e){return a.animateStep(e,o)}),onFinish:function(e){return a.prepareForNextStep(e,o)}},null===(i=(n=o.animationConfig).callBack)||void 0===i||i.call(n,{isFinished:!1,step:s})}},{key:"stopAnimation",value:function(e){var t=this.resolveInstance(e);t&&"FINISHED"!=t.animationStatus&&(t.animationStatus="FINISHED")}},{key:"addStepAnimation",value:function(e,t,r){var i,n,a=this,o=EM(e);this.routes.set(o.id,o),this.lastAddedRouteId=o.id,o.stepAnimationStatus="WAITING",o.route=e;var s=e.steps[0];if(this.addSourcesAndLayersForRoute(o),this.updatePlaceFloorForRouting(o,s.startInsidePlace,s.startInsideFloor),this.setSourceData(o,o.aheadId,e.steps),this.setSourceData(o,o.behindId,[]),this.setLayerPaint(o,o.aheadId,t.aheadConfig),this.setLayerPaint(o,o.behindId,t.behindConfig),this.setLayerPaint(o,o.currentId,t.behindConfig),this.setCurrentDrawConfig(o,t.behindConfig),this.loadStepGeometry(o,s),o.animationConfig=r,o.routeMarker=new hM({coordinate:s.startLocation,floorId:s.startInsideFloor,icon:t.routeIcon,rotationAlignment:"map"}),o.routeMarker.addToMap(this.map),this.cameraFollow(o,s.startLocation),null!==(i=r.autoFitByPlace)&&void 0!==i&&i.enabled&&e.steps.length>0&&s.startInsidePlace){var l;o.currentPlaceId=s.startInsidePlace;var u={padding:null!==(l=r.autoFitByPlace.padding)&&void 0!==l?l:JM};this.mapvxMap.fitRouteByPlace(e,s.startInsidePlace,u)}o.conditions={index:0,coordinatesIndex:0,iconRotation:0,rotatingIcon:!0,startTime:void 0,progress:0,resetTime:!1,waitStartTime:void 0,animationId:0,isStepByStep:!0,onFinish:function(){if(null==o.conditions||null==o.animationConfig||null==o.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");var t=o.conditions.index;t++;var i=o.route.steps.slice(0,t),n=o.route.steps.slice(t),s=o.route.steps[t];if(a.setSourceData(o,o.behindId,i),a.setSourceData(o,o.aheadId,n),a.loadStepGeometry(o,s),o.conditions.index=t,o.stepAnimationStatus="WAITING",t<e.steps.length){var l,u,c=e.steps[t];if(null!==(l=r.autoFitByPlace)&&void 0!==l&&l.enabled&&c&&null!=o.route){var h=c.startInsidePlace||c.endInsidePlace;if(h&&h!==o.currentPlaceId){var d;o.currentPlaceId=h;var p={padding:null!==(d=r.autoFitByPlace.padding)&&void 0!==d?d:JM};a.mapvxMap.fitRouteByPlace(o.route,h,p)}}null===(u=r.callBack)||void 0===u||u.call(r,{isFinished:!1,step:c})}else{var f;null===(f=r.callBack)||void 0===f||f.call(r,{isFinished:!0,step:null})}}},null===(n=r.callBack)||void 0===n||n.call(r,{isFinished:!1,step:s}),this.syncRouteCollision()}},{key:"nextStepAnimation",value:function(e){var t=this,r=this.resolveInstance(e);if(!r)throw new Error("Error: Does not exist step animation");if("NO_ROUTE"===r.stepAnimationStatus)throw new Error("Error: Does not exist step animation");if(null==r.conditions||null==r.animationConfig||null==r.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");if("ANIMATING"===r.stepAnimationStatus&&cancelAnimationFrame(r.conditions.animationId),r.stepAnimationStatus="ANIMATING",!(r.conditions.index<r.route.steps.length))throw new Error("Error: Does not exist next step to animate");r.conditions.coordinatesIndex=0,r.conditions.startTime=void 0,r.conditions.progress=0,r.conditions.rotatingIcon=!0,r.conditions.waitStartTime=void 0,r.conditions.animationId=requestAnimationFrame(function(e){return t.animateStep(e,r)})}},{key:"previousStepAnimation",value:function(e){var t=this.resolveInstance(e);if(!t)throw new Error("Error: Does not exist step animation");if("NO_ROUTE"===t.stepAnimationStatus)throw new Error("Error: Does not exist step animation");if(null==t.conditions||null==t.animationConfig||null==t.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");"ANIMATING"===t.stepAnimationStatus&&cancelAnimationFrame(t.conditions.animationId),t.stepAnimationStatus="WAITING";var r,i,n,a=t.conditions.index;if(!(a>0))throw new Error("previous step doesn't exists to animate");a--;var o=t.route.steps.slice(0,a),s=t.route.steps.slice(a),l=t.route.steps[a];this.setSourceData(t,t.behindId,o),this.setSourceData(t,t.aheadId,s),this.loadStepGeometry(t,l),l.startInsideFloor!=l.endInsideFloor&&l.startInsideFloor&&this.updatePlaceFloorForRouting(t,l.startInsidePlace,l.startInsideFloor),t.conditions.index=a,t.conditions.coordinatesIndex=0,t.conditions.startTime=void 0,t.conditions.progress=0,t.conditions.rotatingIcon=!0,t.conditions.waitStartTime=void 0,this.setMarkerLngLat(t,l.startLocation);var u=o[o.length-1];if(null!=u){var c=u.coordinates.slice(-2),h=UM.bearingInDegBetween(c[0],c[1]);this.setMarkerRotation(t,h)}else this.setMarkerRotation(t,0);if(null!==(r=t.animationConfig.autoFitByPlace)&&void 0!==r&&r.enabled&&l&&null!=t.route){var d=l.startInsidePlace||l.endInsidePlace;if(d&&d!==t.currentPlaceId){var p;t.currentPlaceId=d;var f={padding:null!==(p=t.animationConfig.autoFitByPlace.padding)&&void 0!==p?p:JM};this.mapvxMap.fitRouteByPlace(t.route,d,f)}}null===(i=(n=t.animationConfig).callBack)||void 0===i||i.call(n,{isFinished:!1,step:l})}},{key:"centerOnCurrentStep",value:function(e){var t,r=this.resolveInstance(e);if(!r)throw new Error("Error: Does not exist step animation");if("NO_ROUTE"===r.stepAnimationStatus)throw new Error("Error: Does not exist step animation");if(null==r.conditions||null==r.animationConfig||null==r.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");var i=null===(t=r.routeMarker)||void 0===t?void 0:t.getLngLat();if(!i)throw new Error("Error: marker has no position set");this.map.panTo(i)}},{key:"prepareForNextStep",value:function(e,t){var r=this;if(null==t.conditions||null==t.animationConfig||null==t.route)throw new Error("Error: conditions, animationConfig or route should not be null at this point");var i=t.conditions.index,n=t.route.steps.slice(0,i+1),a=t.route.steps.slice(i+1);if(this.setSourceData(t,t.behindId,n),this.setSourceData(t,t.aheadId,a),i+1<t.route.steps.length){var o,s=t.route.steps[i+1];this.loadStepGeometry(t,s),t.conditions.startTime=e,t.conditions.index++,t.conditions.coordinatesIndex=0,t.conditions.progress=0,t.conditions.rotatingIcon=!0,t.conditions.awaitingSources=!0,t.conditions.awaitDeadline=void 0;var l,u,c=t.route.steps[i],h=this.getFloorKeyForStep(c);if(!t.conditions.pendingFloor&&s.startInsideFloor&&s.startInsideFloor!==h&&(t.conditions.pendingFloor={placeId:s.startInsidePlace,floorKey:s.startInsideFloor,location:s.startLocation}),NM(t.route.steps[i].endLocation,s.startLocation)||(t.conditions.nextFloorFirstStepIndex=i+2),t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)}),null!==(o=t.animationConfig.autoFitByPlace)&&void 0!==o&&o.enabled&&s&&null!=t.route){var d=s.startInsidePlace||s.endInsidePlace;if(d&&d!==t.currentPlaceId){var p;t.currentPlaceId=d;var f={padding:null!==(p=t.animationConfig.autoFitByPlace.padding)&&void 0!==p?p:JM};this.mapvxMap.fitRouteByPlace(t.route,d,f)}}t.conditions.pendingFloor?t.conditions.pendingStepCallback=s:null===(l=(u=t.animationConfig).callBack)||void 0===l||l.call(u,{isFinished:!1,step:s})}else{var m,g;if(this.applyPendingFloor(t),null==t.conditions||null==t.animationConfig)return;t.animationStatus="FINISHED",null===(m=(g=t.animationConfig).callBack)||void 0===m||m.call(g,{isFinished:!0,step:null})}}},{key:"animateStep",value:function(e,t){var r=this;if(null==t.conditions||null==t.animationConfig||null==t.route)throw new Error("Error: conditions and animationConfig should not be null at this point");var i=t.conditions,n=i.startTime,a=i.resetTime,o=i.progress,s=i.waitStartTime,l=t.conditions,u=l.coordinatesIndex,c=l.iconRotation,h=l.index,d=l.onFinish,p=l.rotatingIcon,f=t.animationConfig,m=f.stepTime,g=f.minimumSpeed,y=f.iconRotationTime,_=f.changeFloorTime,v=t.conditions.lastFrameTime;if(t.conditions.lastFrameTime=e,null==n)return t.conditions.startTime=e,void(t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)}));if(t.conditions.awaitingSources){var b,x=null!==(b=t.conditions.awaitDeadline)&&void 0!==b?b:e+1500;if(null!=v&&e-v>500&&(x+=e-v),t.conditions.awaitDeadline=x,!this.stepSourcesReady(t)&&e<x)return t.conditions.startTime=e,void(t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)}));t.conditions.awaitingSources=!1,t.conditions.awaitDeadline=void 0,t.conditions.startTime=e;var w,S,T=t.conditions.pendingStepCallback;if(t.conditions.pendingStepCallback=void 0,t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)}),this.applyPendingFloor(t),null==t.conditions||null==t.animationConfig)return;T&&(null===(w=(S=t.animationConfig).callBack)||void 0===w||w.call(S,{isFinished:!1,step:T}))}else{if(a)n=e-o,t.conditions.startTime=n,a=!1,t.conditions.resetTime=a;else if(null!=v&&e-v>500){var P=e-v;o=v-n,t.conditions.progress=o,n=e-o,t.conditions.startTime=n,null!=s&&(s+=P,t.conditions.waitStartTime=s)}else o=e-n,t.conditions.progress=o;var E=o/1e3,D=t.route.steps[h];if(D.coordinates.length<=0)null==d||d(e);else{var A=D.coordinates[u],I=D.coordinates[u+1];if(null!=A&&null!=I){if(p){var C=UM.bearingInDegBetween(A,I);if(0===y||t.conditions.nextFloorFirstStepIndex===h||Math.abs(C-t.conditions.iconRotation)<15)return t.conditions.nextFloorFirstStepIndex=void 0,this.setMarkerRotation(t,C),t.conditions.startTime=e,t.conditions.rotatingIcon=!1,t.conditions.iconRotation=C,void(t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)}));if(E<y){var k=UM.intermediateAngleBetween(c,C,E/y);return this.setMarkerRotation(t,k),void(t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)}))}return this.setMarkerRotation(t,C),t.conditions.startTime=e,t.conditions.rotatingIcon=!1,t.conditions.iconRotation=C,void(t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)}))}if(D.endInsideFloor&&D.startInsideFloor!==D.endInsideFloor)return null==s?(t.conditions.waitStartTime=e,void(t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)}))):e-s<1e3*_?void(t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)})):(t.conditions.waitStartTime=void 0,t.conditions.isStepByStep?(this.updatePlaceFloorForRouting(t,D.endInsidePlace,D.endInsideFloor),this.setMarkerLngLat(t,D.endLocation)):t.conditions.pendingFloor={placeId:D.endInsidePlace,floorKey:D.endInsideFloor,location:D.endLocation},void(null==d||d(e)));for(var M=Math.max(D.distance/m,null!=g?g:0),F=A,R=I,L=UM.distance(F,R);M*E>L;){if(t.conditions.coordinatesIndex+2>=D.coordinates.length)return this.applyReveal(t,this.fractionAlongStep(t,t.conditions.coordinatesIndex+1,0)),void(null==d||d(e));var z=L/M*1e3;n+=z,o-=z,t.conditions.startTime=n,t.conditions.progress=o,E=o/1e3,t.conditions.coordinatesIndex++;var O=D.coordinates[t.conditions.coordinatesIndex+1];if(!NM(R,O)){var B;if(t.conditions.isStepByStep)return t.conditions.rotatingIcon=!0,t.conditions.startTime=e,t.conditions.progress=0,this.applyReveal(t,this.fractionAlongStep(t,t.conditions.coordinatesIndex,0)),void(t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)}));var j=UM.bearingInDegBetween(R,O);t.conditions.iconRotation=j,null===(B=t.routeMarker)||void 0===B||B.setRotation(j)}F=R,R=O,L=UM.distance(F,R)}var N=Math.min(M*E,L),U=0===L?R:UM.intermediatePointBetween(F,R,N/L);return this.applyReveal(t,this.fractionAlongStep(t,t.conditions.coordinatesIndex,N)),this.setMarkerLngLat(t,U),null==t.routeMarker||t.routeMarker.hiddenOnPurpose||t.routeMarker.getElement().isConnected||t.routeMarker.addTo(this.map),void(t.conditions.animationId=requestAnimationFrame(function(e){return r.animateStep(e,t)}))}null==d||d(e)}}}},{key:"setMarkerLngLat",value:function(e,t){var r,i;null!==(r=e.conditions)&&void 0!==r&&r.isStepByStep&&this.cameraFollow(e,t),null===(i=e.routeMarker)||void 0===i||i.setLngLat(t)}},{key:"setMarkerRotation",value:function(e,t){var r,i,n,a,o;return null===(r=e.conditions)||void 0===r||!r.isStepByStep||null!==(i=e.animationConfig)&&void 0!==i&&i.keepFixedBearing||this.mapvxMap.updateCamera({duration:null===(a=e.animationConfig)||void 0===a?void 0:a.iconRotationTime,animate:!0,bearing:t,center:null===(o=e.routeMarker)||void 0===o?void 0:o.getLngLat()}),null===(n=e.routeMarker)||void 0===n?void 0:n.setRotation(t)}},{key:"setMarkerFloor",value:function(e,t){var r,i=this.resolveInstance(t);null==i||null===(r=i.routeMarker)||void 0===r||r.setFloor(e)}},{key:"cameraFollow",value:function(e,t){var r,i,n,a,o=null!==(r=null===(i=e.animationConfig)||void 0===i?void 0:i.keepFixedBearing)&&void 0!==r&&r;this.mapvxMap.updateCamera(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$M(Object(r),!0).forEach(function(t){KM(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({center:t,animate:!0,duration:null===(n=e.animationConfig)||void 0===n?void 0:n.iconRotationTime},o?{}:{bearing:null===(a=e.routeMarker)||void 0===a?void 0:a.getRotation()}))}}])}();function iF(e){return iF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},iF(e)}function nF(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,oF(i.key),i)}}function aF(e,t,r){return t&&nF(e.prototype,t),r&&nF(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function oF(e){var t=function(e){if("object"!=iF(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=iF(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==iF(t)?t:t+""}function sF(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var lF=function(e){return e.cardinal="CARDINAL",e.clock="CLOCK",e.relative="RELATIVE",e}({}),uF=function(e){return e.metric="METRIC",e.imperial="IMPERIAL",e.steps="STEPS",e}({}),cF=function(e){return e.walking="WALKING",e.driving="DRIVING",e.bicycling="BICYCLING",e.transit="TRANSIT",e}({}),hF=aF(function e(t){var r,i,n,a,o;sF(this,e),this.initialLocation=t.initialLocation,this.finalLocation=t.finalLocation,this.preferAccessibleRoute=null!==(r=t.preferAccessibleRoute)&&void 0!==r&&r,this.language=null!==(i=t.language)&&void 0!==i?i:"en",this.unitSystem=null!==(n=t.unitSystem)&&void 0!==n?n:uF.metric,this.announceFormat=null!==(a=t.announceFormat)&&void 0!==a?a:lF.relative,this.userBearing=null!==(o=t.userBearing)&&void 0!==o?o:0}),dF=aF(function e(t){var r,i;sF(this,e),this.polylineWidth=null!==(r=t.polylineWidth)&&void 0!==r?r:10,this.routeStyle=null!==(i=t.routeStyle)&&void 0!==i?i:{type:"Solid",color:"#1257ED"}});function pF(e){return pF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pF(e)}function fF(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,gF(i.key),i)}}function mF(e,t,r){return t&&fF(e.prototype,t),r&&fF(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function gF(e){var t=function(e){if("object"!=pF(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=pF(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pF(t)?t:t+""}function yF(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _F=mF(function e(t){var r,i,n,a,o;yF(this,e),this.stepTime=null!==(r=t.stepTime)&&void 0!==r?r:3,this.minimumSpeed=null!==(i=t.minimumSpeed)&&void 0!==i?i:40,this.changeFloorTime=null!==(n=t.changeFloorTime)&&void 0!==n?n:0,this.iconRotationTime=null!==(a=t.iconRotationTime)&&void 0!==a?a:0,this.keepFixedBearing=null!==(o=t.keepFixedBearing)&&void 0!==o&&o,this.callBack=t.callBack,this.autoFitByPlace=t.autoFitByPlace}),vF=function(){return mF(function e(t){var r,i,n;if(yF(this,e),this.aheadPathStyle=null!==(r=t.aheadPathStyle)&&void 0!==r?r:{type:"Solid",color:"#0C0C0C"},this.behindPathStyle=null!==(i=t.behindPathStyle)&&void 0!==i?i:{type:"Solid",color:"#276EF1"},this.polylineWidth=null!==(n=t.polylineWidth)&&void 0!==n?n:10,null!=t.routeIcon)this.routeIcon=t.routeIcon;else{var a=new Image(40,40);null!=t.routeIconConfig?a.src=Zk(t.routeIconConfig):a.src=Wk,this.routeIcon=a}},[{key:"aheadConfig",get:function(){return new dF({polylineWidth:this.polylineWidth,routeStyle:this.aheadPathStyle})}},{key:"behindConfig",get:function(){return new dF({polylineWidth:this.polylineWidth,routeStyle:this.behindPathStyle})}}])}();function bF(e){return bF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bF(e)}function xF(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function wF(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xF(Object(r),!0).forEach(function(t){SF(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xF(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function SF(e,t,r){return(t=function(e){var t=function(e){if("object"!=bF(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=bF(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bF(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var TF="#276EF1",PF=["belowLabels","aboveBasemap","top"],EF={fillColor:TF,fillOpacity:.14,strokeColor:TF,strokeWidth:2,strokeOpacity:.65,renderOrder:"aboveBasemap"};function DF(e){return wF(wF({},e),{},{coordinate:wF({},e.coordinate)})}function AF(e,t){return Number.isFinite(e)?Math.max(0,Math.min(1,e)):t}function IF(e){if(null==e||"object"!==bF(e))return!1;var t=e;if("object"!==bF(t.coordinate)||null===t.coordinate)return!1;var r=t.coordinate;return!("number"!=typeof r.lat||"number"!=typeof r.lng||!Number.isFinite(r.lat)||!Number.isFinite(r.lng)||r.lat<-90||r.lat>90||r.lng<-180||r.lng>180||"number"!=typeof t.radiusMeters||!Number.isFinite(t.radiusMeters)||t.radiusMeters<=0||void 0!==t.id&&"string"!=typeof t.id||void 0!==t.fillColor&&"string"!=typeof t.fillColor||!(void 0===t.fillOpacity||"number"==typeof t.fillOpacity&&Number.isFinite(t.fillOpacity))||void 0!==t.strokeColor&&"string"!=typeof t.strokeColor||!(void 0===t.strokeWidth||"number"==typeof t.strokeWidth&&Number.isFinite(t.strokeWidth))||!(void 0===t.strokeOpacity||"number"==typeof t.strokeOpacity&&Number.isFinite(t.strokeOpacity))||void 0!==t.floorId&&"string"!=typeof t.floorId||void 0!==t.renderOrder&&!PF.includes(t.renderOrder))}function CF(e){var t,r,i,n,a,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(function(e){if(!Number.isFinite(e)||e<=0)throw new Error("Invalid radiusMeters: ".concat(e,". Must be a positive finite number."))}(e.radiusMeters),function(e){if(null==e||"object"!==bF(e))throw new Error("Invalid coordinate: expected an object with lat and lng properties.");if(!Number.isFinite(e.lat)||!Number.isFinite(e.lng)||e.lat<-90||e.lat>90||e.lng<-180||e.lng>180)throw new Error("Invalid coordinate: lat=".concat(e.lat,", lng=").concat(e.lng,". ")+"latitude must be in [-90, 90], longitude in [-180, 180], and both finite.")}(e.coordinate),void 0!==e.renderOrder&&!PF.includes(e.renderOrder))throw new Error("Invalid renderOrder: ".concat(String(e.renderOrder),". ")+"Must be one of: ".concat(PF.join(", "),"."));return{id:null!==(t=e.id)&&void 0!==t?t:Hk(),coordinate:{lat:e.coordinate.lat,lng:e.coordinate.lng},radiusMeters:e.radiusMeters,fillColor:null!==(r=e.fillColor)&&void 0!==r?r:EF.fillColor,fillOpacity:AF(e.fillOpacity,EF.fillOpacity),strokeColor:null!==(i=e.strokeColor)&&void 0!==i?i:EF.strokeColor,strokeWidth:null!==(n=e.strokeWidth)&&void 0!==n?n:EF.strokeWidth,strokeOpacity:AF(e.strokeOpacity,EF.strokeOpacity),floorId:e.floorId,renderOrder:null!==(a=e.renderOrder)&&void 0!==a?a:EF.renderOrder,hidden:o}}function kF(e,t,r){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,n=Number.isFinite(i)?Math.max(3,Math.floor(i)):64,a=[],o=t*Math.PI/180,s=r/110574,l=r/(111320*Math.cos(o||1e-6)||1),u=0;u<n;u+=1){var c=u/n*Math.PI*2;a.push([e+l*Math.cos(c),t+s*Math.sin(c)])}return a.push([a[0][0],a[0][1]]),a}function MF(e){if(e instanceof Error)return e;var t=String(e);return new Error(t)}function FF(e){return FF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},FF(e)}function RF(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,LF(i.key),i)}}function LF(e){var t=function(e){if("object"!=FF(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=FF(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==FF(t)?t:t+""}var zF=function(){return function(e,t){return t&&RF(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.logger=Aa.getInstance()},[{key:"logEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.logger.logEvent(e,this.prepareSegmentation(t))}},{key:"logError",value:function(e){for(var t,r=MF(e),i=arguments.length,n=new Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];(t=this.logger).logError.apply(t,[r].concat(n))}},{key:"logWarning",value:function(e){for(var t,r=MF(e),i=arguments.length,n=new Array(i>1?i-1:0),a=1;a<i;a++)n[a-1]=arguments[a];(t=this.logger).logWarning.apply(t,[r].concat(n))}},{key:"logDebug",value:function(){var e;(e=this.logger).logDebug.apply(e,arguments)}},{key:"debugLog",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.debugLog(t)}}])}(),OF={enabled:!0,maxTiles:400,ttlMs:18e5,persistToServiceWorker:!0,preloadAdjacentZooms:!1,maxConcurrentTileFetches:6},BF=1e5,jF={enabled:!0,minZoomForLabels:Number.NEGATIVE_INFINITY,gapPx:8,verticalGapPx:4,paddingPx:4,maxLabelWidthPx:200};const NF=require("crypto"),UF={randomUUID:NF.randomUUID},VF=new Uint8Array(256);let $F=VF.length;const GF=[];for(let e=0;e<256;++e)GF.push((e+256).toString(16).slice(1));const qF=function(e,t,r){if(UF.randomUUID&&!t&&!e)return UF.randomUUID();const i=(e=e||{}).random??e.rng?.()??($F>VF.length-16&&((0,NF.randomFillSync)(VF),$F=0),VF.slice($F,$F+=16));if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[r+e]=i[e];return t}return function(e,t=0){return(GF[e[t+0]]+GF[e[t+1]]+GF[e[t+2]]+GF[e[t+3]]+"-"+GF[e[t+4]]+GF[e[t+5]]+"-"+GF[e[t+6]]+GF[e[t+7]]+"-"+GF[e[t+8]]+GF[e[t+9]]+"-"+GF[e[t+10]]+GF[e[t+11]]+GF[e[t+12]]+GF[e[t+13]]+GF[e[t+14]]+GF[e[t+15]]).toLowerCase()}(i)};function ZF(e){return ZF="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ZF(e)}function WF(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HF(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,KF(i.key),i)}}function XF(e,t,r){return t&&HF(e.prototype,t),r&&HF(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function KF(e){var t=function(e){if("object"!=ZF(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=ZF(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ZF(t)?t:t+""}var YF=function(){return XF(function e(t){var r=this;WF(this,e),this.id=qF(),this.legs=[],t.legs.forEach(function(e){var t=new JF(e);r.legs.push(t)})},[{key:"steps",get:function(){return this.legs.flatMap(function(e){return e.steps})}},{key:"duration",get:function(){return this.legs.map(function(e){return e.duration}).reduce(function(e,t){return e+t},0)}},{key:"length",get:function(){return this.legs.map(function(e){return e.distance}).reduce(function(e,t){return e+t},0)}}])}(),JF=XF(function e(t){var r=this;WF(this,e),this.distance=t.distance.value,this.duration=t.duration.value,this.startLocation=t.start_location,this.endLocation=t.end_location,this.steps=[],t.steps.forEach(function(e){var t=new QF(e);r.steps.push(t)})}),QF=function(){return XF(function e(t){WF(this,e),this.distance=t.distance.value,this.duration=t.duration.value,this.startLocation=t.start_location,this.startInsideFloor=t.start_inside_floor,this.startInsidePlace=t.start_inside_place,this.endLocation=t.end_location,this.endInsideFloor=t.end_inside_floor,this.endInsidePlace=t.end_inside_place,this.htmlInstruction=t.html_instructions,this.plainInstruction=t.plain_instructions,this.maneuver=t.maneuver,this.elevatorStep=t.elevator_step,this.showPopup=t.show_popup,this.iconPrefix=t.icon_prefix,this.polyline=new eR(t.polyline)},[{key:"geoJsonCoordinates",get:function(){return this.polyline.geoJsonCoordinates}},{key:"coordinates",get:function(){return this.polyline.coordinates}}])}(),eR=function(){return XF(function e(t){WF(this,e),this.points=t.points,this.pointsLatLng=t.points_lat_lng,this.overviewPoints=t.overview_points,this.decodedPoints=function(e,t){void 0===t&&(t=5);for(var r=Math.pow(10,t),i=e.length,n=new Array(Math.floor(e.length/2)),a=0,o=0,s=0,l=0;a<i;++l){var u=1,c=0,h=void 0;do{u+=(h=e.charCodeAt(a++)-63-1)<<c,c+=5}while(h>=31);o+=1&u?~(u>>1):u>>1,u=1,c=0;do{u+=(h=e.charCodeAt(a++)-63-1)<<c,c+=5}while(h>=31);s+=1&u?~(u>>1):u>>1,n[l]=[o/r,s/r]}return n.length=l,n}(t.points).map(function(e){return{lat:e[0],lng:e[1]}})},[{key:"geoJsonCoordinates",get:function(){return null!=this.overviewPoints?this.overviewPoints.map(function(e){return[e.lng,e.lat]}):this.decodedPoints.map(function(e){return[e.lng,e.lat]})}},{key:"coordinates",get:function(){return null!=this.overviewPoints?this.overviewPoints:this.decodedPoints}}])}();function tR(e){return tR="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tR(e)}function rR(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,nR(i.key),i)}}function iR(e,t,r){return t&&rR(e.prototype,t),r&&rR(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function nR(e){var t=function(e){if("object"!=tR(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=tR(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==tR(t)?t:t+""}var aR=iR(function e(t){var r,i,n,a,o,s;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=t.id,this.name=t.name,this.status=t.status,this.startDate=t.startDate,this.endDate=null!==(r=t.endDate)&&void 0!==r?r:null,this.startTime=t.startTime,this.endTime=null!==(i=t.endTime)&&void 0!==i?i:null;var l=null!==(n=null!==(a=t.sortOrder)&&void 0!==a?a:t.order)&&void 0!==n?n:0;this.sortOrder=l,this.order=l,this.images=(null!==(o=t.images)&&void 0!==o?o:[]).map(function(e){var t,r,i,n,a;return{orientation:e.orientation,order:e.order,mediaType:(i=e.mediaType,n=e.type,a=null==i?void 0:i.trim().toLowerCase(),"video"===a||null!=a&&a.startsWith("video/")?"video":"image"===a||null!=a&&a.startsWith("image/")?"image":null!=n&&n.trim().toLowerCase().startsWith("video/")?"video":"image"),durationSeconds:null!==(t=e.durationSeconds)&&void 0!==t?t:null,url:e.url,type:e.type,alt:null!==(r=e.alt)&&void 0!==r?r:[]}}),this.schedules=(null!==(s=t.schedules)&&void 0!==s?s:[]).map(function(e){return{dayOfWeek:e.dayOfWeek,startTime:e.startTime,endTime:e.endTime}})});function oR(e){return oR="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},oR(e)}function sR(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,uR(i.key),i)}}function lR(e,t,r){return t&&sR(e.prototype,t),r&&sR(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function uR(e){var t=function(e){if("object"!=oR(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=oR(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==oR(t)?t:t+""}var cR=lR(function e(t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mapvxId=t.id,this.country=t.country,this.city=t.city,this.title=t.title,this.category=t.category,this.icon=t.icon,this.description=t.description,this.hasPlaces=t.hasPlaces,this.properties=k.parseProperties(null!==(r=t.properties)&&void 0!==r?r:[])});function hR(e){return hR="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hR(e)}function dR(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,fR(i.key),i)}}function pR(e,t,r){return t&&dR(e.prototype,t),r&&dR(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function fR(e){var t=function(e){if("object"!=hR(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=hR(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==hR(t)?t:t+""}var mR=pR(function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.schedule=t.schedules,this.routes=t.realtimeSchedules});function gR(e){var t=e.trim().toLowerCase();return!!t&&/^(?:[a-z0-9-]+\.)*mapvx\.(?:com|dev)$/.test(t)}function yR(e){return function(e){if(Array.isArray(e))return _R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return _R(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_R(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function vR(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var l=i&&i.prototype instanceof s?i:s,u=Object.create(l.prototype);return bR(u,"_invoke",function(r,i,n){var a,s,l,u=0,c=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,s=0,l=e,d.n=r,o}};function p(r,i){for(s=r,l=i,t=0;!h&&u&&!n&&t<c.length;t++){var n,a=c[t],p=d.p,f=a[2];r>3?(n=f===i)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((n=r<2&&p<a[1])?(s=0,d.v=i,d.n=a[1]):p<f&&(n=r<3||a[0]>i||i>f)&&(a[4]=r,a[5]=i,d.n=f,s=0))}if(n||r>1)return o;throw h=!0,i}return function(n,c,f){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,f),s=c,l=f;(t=s<2?e:l)||!h;){a||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(u=2,a){if(s||(n="next"),t=a[n]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);a=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==o)break}catch(t){a=e,s=1,l=t}finally{u=1}}return{value:t,done:h}}}(r,n,a),!0),u}var o={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):(bR(t={},i,function(){return this}),t),h=u.prototype=s.prototype=Object.create(c);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,bR(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,bR(h,"constructor",u),bR(u,"constructor",l),l.displayName="GeneratorFunction",bR(u,n,"GeneratorFunction"),bR(h),bR(h,n,"Generator"),bR(h,i,function(){return this}),bR(h,"toString",function(){return"[object Generator]"}),(vR=function(){return{w:a,m:d}})()}function bR(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}bR=function(e,t,r,i){function a(t,r){bR(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},bR(e,t,r,i)}function xR(e){return xR="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xR(e)}function wR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function SR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wR(Object(r),!0).forEach(function(t){TR(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wR(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function TR(e,t,r){return(t=AR(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function PR(e,t,r,i,n,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function ER(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(e){PR(a,i,n,o,s,"next",e)}function s(e){PR(a,i,n,o,s,"throw",e)}o(void 0)})}}function DR(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,AR(i.key),i)}}function AR(e){var t=function(e){if("object"!=xR(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=xR(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==xR(t)?t:t+""}var IR="https://api.mapvx.com";function CR(e){var t=e.startsWith("http://")||e.startsWith("https://")?e:"https://".concat(e);return t.endsWith("/")?t.slice(0,-1):t}var kR=function(){return function(e,t){return t&&DR(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(function e(t){var r,i,n,a,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"https://public-api.mapvx.com",s=arguments.length>2?arguments[2]:void 0,l=arguments.length>3?arguments[3]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.lang=t,this.mapvxRequestContext=s;var u=CR(o),c=null==l||null===(r=l.portalApiUrl)||void 0===r?void 0:r.trim(),h=c?CR(c):u;this.baseUrl="".concat(u,"/api/sdk/v2/"),this.baseUrlPortal="".concat(h,"/api/portal/");var d=CR((null==l||null===(i=l.routeApiUrl)||void 0===i?void 0:i.trim())||IR),p=CR((null==l||null===(n=l.healthApiUrl)||void 0===n?void 0:n.trim())||IR),f=CR((null==l||null===(a=l.legacyApiUrl)||void 0===a?void 0:a.trim())||IR);this.baseUrlHealth="".concat(p,"/api/sdk/v2/health"),this.oldBaseUrl="".concat(f,"/api/sdk/"),this.routeBaseUrl="".concat(d,"/sdk/")},[{key:"setLang",value:function(e){this.lang=e}},{key:"getMapVxContextHeaders",value:function(e){var t,r,i,n,a,o,s,l;if(!gR(e)||!this.mapvxRequestContext)return{};var u=this.mapvxRequestContext,c={};return null!==(t=u.baseUrl)&&void 0!==t&&t.trim()&&(c["X-MapVx-Base-Url"]=u.baseUrl.trim()),null!==(r=u.totemId)&&void 0!==r&&r.trim()&&(c["X-MapVx-Totem-Id"]=u.totemId.trim()),null!==(i=u.originId)&&void 0!==i&&i.trim()&&(c["X-MapVx-Origin-Id"]=u.originId.trim()),null!==(n=u.institutionId)&&void 0!==n&&n.trim()&&(c["X-MapVx-Institution-Id"]=u.institutionId.trim()),null!==(a=u.parentPlace)&&void 0!==a&&a.trim()&&(c["X-MapVx-Parent-Place"]=u.parentPlace.trim()),null!==(o=u.institutionName)&&void 0!==o&&o.trim()&&(c["X-MapVx-Institution-Name"]=u.institutionName.trim()),null!==(s=u.fullUrl)&&void 0!==s&&s.trim()&&(c["X-MapVx-Full-Url"]=u.fullUrl.trim()),null!==(l=u.mvxProduct)&&void 0!==l&&l.trim()&&(c["mvx-product"]=u.mvxProduct.trim()),c}},{key:"fetchFromUrl",value:(T=ER(vR().m(function e(t,r,i){var n,a,o,s;return vR().w(function(e){for(;;)if(0===e.n)return(n=new URL(t)).search=new URLSearchParams(r).toString(),a=n.hostname,o=this.getMapVxContextHeaders(a),s=SR({},i),Object.keys(o).length>0&&(s.headers=SR(SR({},i.headers&&"object"===xR(i.headers)&&!Array.isArray(i.headers)?i.headers:{}),o)),e.a(2,fetch(n.toString(),s))},e,this)})),function(e,t,r){return T.apply(this,arguments)})},{key:"fetchTransport",value:(S=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},n={stopId:r,lang:this.lang},e.a(2,this.fetchFromUrl(this.oldBaseUrl+"vehiclesWithSchedules",n,i))},e,this)})),function(e,t){return S.apply(this,arguments)})},{key:"fetchStops",value:(w=ER(vR().m(function e(t,r,i){var n,a;return vR().w(function(e){for(;;)if(0===e.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},a={stopId:r,vehicleId:i,lang:this.lang},e.a(2,this.fetchFromUrl(this.oldBaseUrl+"stops",a,n))},e,this)})),function(e,t,r){return w.apply(this,arguments)})},{key:"applyMapStyleParams",value:function(e,t,r,i){null!=t&&(e.place_id=t),null!=r&&(e.style_ref=r),null!=i&&(e.styleTheme=i)}},{key:"fetchMapStyle",value:(x=ER(vR().m(function e(t,r,i,n){var a,o;return vR().w(function(e){for(;;)if(0===e.n)return a={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},o={lang:this.lang},this.applyMapStyleParams(o,r,i,n),e.a(2,this.fetchFromUrl(this.baseUrl+"mapStyleJson",o,a))},e,this)})),function(e,t,r,i){return x.apply(this,arguments)})},{key:"fetchMapStyleByBearer",value:(b=ER(vR().m(function e(t,r,i,n){var a,o;return vR().w(function(e){for(;;)if(0===e.n)return a={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},o={lang:this.lang},this.applyMapStyleParams(o,r,i,n),e.a(2,this.fetchFromUrl(this.baseUrlPortal+"mapStyleJson",o,a))},e,this)})),function(e,t,r,i){return b.apply(this,arguments)})},{key:"fetchAnyMapStyle",value:(v=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},n={lang:this.lang,institution_id:r},e.a(2,this.fetchFromUrl(this.baseUrlPortal+"mapStyle",n,i))},e,this)})),function(e,t){return v.apply(this,arguments)})},{key:"fetchAllowedPlaces",value:(_=ER(vR().m(function e(t){var r,i;return vR().w(function(e){for(;;)if(0===e.n)return r={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},i={lang:this.lang},e.a(2,this.fetchFromUrl(this.baseUrl+"availablePlaces",i,r))},e,this)})),function(e){return _.apply(this,arguments)})},{key:"fetchPlacesFromAnyInstitution",value:(y=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(r)}},n={institution_id:t,lang:this.lang},e.a(2,this.fetchFromUrl(this.baseUrlPortal+"availablePlaces",n,i))},e,this)})),function(e,t){return y.apply(this,arguments)})},{key:"fetchPlaceDetail",value:(g=ER(vR().m(function e(t,r,i,n,a){var o,s;return vR().w(function(e){for(;;)if(0===e.n)return o={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},s={place_id:r,lang:this.lang},void 0!==i&&(s.building=i),void 0!==n?s.floor=n:void 0!==a&&(s.floor=a),e.a(2,this.fetchFromUrl(this.baseUrl+"place",s,o))},e,this)})),function(e,t,r,i,n){return g.apply(this,arguments)})},{key:"fetchAnyPlaceDetail",value:(m=ER(vR().m(function e(t,r,i,n,a){var o,s;return vR().w(function(e){for(;;)if(0===e.n)return o={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},s={place_id:r,lang:this.lang},void 0!==i&&(s.building=i),void 0!==n?s.floor=n:void 0!==a&&(s.floor=a),e.a(2,this.fetchFromUrl(this.baseUrlPortal+"place",s,o))},e,this)})),function(e,t,r,i,n){return m.apply(this,arguments)})},{key:"fetchSubPlaces",value:(f=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(r)}},n={targetPlace:t,lang:this.lang},e.a(2,this.fetchFromUrl(this.baseUrl+"subPlaces",n,i))},e,this)})),function(e,t){return f.apply(this,arguments)})},{key:"fetchAnySubPlaces",value:(p=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(r)}},n={place_id:t,lang:this.lang},e.a(2,this.fetchFromUrl(this.baseUrlPortal+"subPlaces",n,i))},e,this)})),function(e,t){return p.apply(this,arguments)})},{key:"buildRouteParams",value:function(e){var t={fromLatLng:void 0,fromBuilding:void 0,fromFloor:void 0,toLatLng:void 0,toBuilding:void 0,toFloor:void 0,fromPlaceId:void 0,toPlaceId:void 0,travelMode:cF.walking,reducedMobility:e.preferAccessibleRoute?1:0,announceFormat:e.announceFormat,userBearing:e.userBearing,lang:this.lang,unitSystem:e.unitSystem};if("id"in e.initialLocation){var r=e.initialLocation,i=r.id,n=r.buildingId,a=r.floorId,o=r.level;t.fromPlaceId=i,void 0!==n&&(t.fromBuilding=n),void 0!==a?t.fromFloor=a:void 0!==o&&(t.fromFloor=o)}else{var s=e.initialLocation,l=s.lat,u=s.lng,c=s.floorId,h=s.placeId;t.fromLatLng="".concat(l,",").concat(u),t.fromFloor=c,t.fromBuilding=h}if("id"in e.finalLocation){var d=e.finalLocation,p=d.id,f=d.buildingId,m=d.floorId,g=d.level;t.toPlaceId=p,void 0!==f&&(t.toBuilding=f),void 0!==m?t.toFloor=m:void 0!==g&&(t.toFloor=g)}else{var y=e.finalLocation,_=y.lat,v=y.lng,b=y.floorId,x=y.placeId;t.toLatLng="".concat(_,",").concat(v),t.toFloor=b,t.toBuilding=x}var w={};for(var S in t){var T=t[S];null!=T&&(w[S]=T)}return w}},{key:"fetchRoute",value:(d=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(r)}},n=this.buildRouteParams(t),e.a(2,this.fetchFromUrl(this.routeBaseUrl+"route",n,i))},e,this)})),function(e,t){return d.apply(this,arguments)})},{key:"fetchRouteV2",value:(h=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(r)}},n=this.buildRouteParams(t),e.a(2,this.fetchFromUrl(this.routeBaseUrl+"v2/route",n,i))},e,this)})),function(e,t){return h.apply(this,arguments)})},{key:"fetchLiveRoute",value:(c=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(r)}},n=this.buildRouteParams(t),e.a(2,this.fetchFromUrl(this.routeBaseUrl+"liveroute",n,i))},e,this)})),function(e,t){return c.apply(this,arguments)})},{key:"fetchInstitutions",value:(u=ER(vR().m(function e(t){var r,i;return vR().w(function(e){for(;;)if(0===e.n)return r={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},i={lang:this.lang},e.a(2,this.fetchFromUrl(this.baseUrl+"institution",i,r))},e,this)})),function(e){return u.apply(this,arguments)})},{key:"fetchSearchResults",value:(l=ER(vR().m(function e(t,r,i,n,a,o,s,l){var u,c;return vR().w(function(e){for(;;)if(0===e.n)return u={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(i)}},c={institution_id:t,input:r,lang:this.lang},n&&(c.parentPlaces=yR(n)),a&&(c.origin=a),o&&(c.lat=o),s&&(c.lng=s),l&&(c.floor=l),e.a(2,this.fetchFromUrl(this.baseUrl+"searchPlacesWithFilters",c,u))},e,this)})),function(e,t,r,i,n,a,o,s){return l.apply(this,arguments)})},{key:"fetchSearchPlacesByTags",value:(s=ER(vR().m(function e(t,r,i,n,a,o,s,l,u){var c,h;return vR().w(function(e){for(;;)if(0===e.n)return c={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(i)}},h={institution_id:t,tags:yR(r),lang:this.lang},n&&n.length>0&&(h.parentPlaces=yR(n)),a&&(h.sort=a),o&&(h.origin=o),s&&(h.lat=s),l&&(h.lng=l),u&&(h.floor=u),e.a(2,this.fetchFromUrl(this.baseUrl+"searchPlacesByTags",h,c))},e,this)})),function(e,t,r,i,n,a,o,l,u){return s.apply(this,arguments)})},{key:"fetchConfiguration",value:(o=ER(vR().m(function e(t,r,i){var n,a;return vR().w(function(e){for(;;)if(0===e.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},a={lang:this.lang},r&&(a.place_id=r),i&&(a.product=i),e.a(2,this.fetchFromUrl(this.baseUrl+"configuration",a,n))},e,this)})),function(e,t,r){return o.apply(this,arguments)})},{key:"fetchCampaigns",value:(a=ER(vR().m(function e(t,r,i){var n,a;return vR().w(function(e){for(;;)if(0===e.n)return n={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},a={placeId:r},i&&(a.kioskId=i),e.a(2,this.fetchFromUrl(this.baseUrl+"campaigns",a,n))},e,this)})),function(e,t,r){return a.apply(this,arguments)})},{key:"fetchCategories",value:(n=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},n={lang:this.lang},r&&(n.id=r),e.a(2,this.fetchFromUrl(this.baseUrl+"category",n,i))},e,this)})),function(e,t){return n.apply(this,arguments)})},{key:"fetchRoutesForOrigin",value:(i=ER(vR().m(function e(t,r,i,n,a,o){var s,l;return vR().w(function(e){for(;;)if(0===e.n)return s={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},l={placeId:r,fromPlace:i,announceFormat:n,unitSystem:a,mode:o,lang:this.lang},e.a(2,this.fetchFromUrl(this.routeBaseUrl+"routes_for_origin",l,s))},e,this)})),function(e,t,r,n,a,o){return i.apply(this,arguments)})},{key:"fetchCacheTimestamp",value:(r=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},n={placeId:r},e.a(2,this.fetchFromUrl(this.routeBaseUrl+"cache_timestamp",n,i))},e,this)})),function(e,t){return r.apply(this,arguments)})},{key:"fetchCssCustomization",value:(t=ER(vR().m(function e(t,r){var i,n;return vR().w(function(e){for(;;)if(0===e.n)return i={method:"GET",headers:{"content-type":"application/json",Authorization:"Bearer ".concat(t)}},n={type:r},e.a(2,this.fetchFromUrl(this.baseUrl+"styles/customStyles",n,i))},e,this)})),function(e,r){return t.apply(this,arguments)})},{key:"postHealth",value:(e=ER(vR().m(function e(t,r,i,n,a){var o,s,l;return vR().w(function(e){for(;;)if(0===e.n)return o=JSON.stringify({healthPingId:r,placeId:i,totemId:n,status:a}),s={},l={method:"POST",headers:{accept:"application/json","Content-Type":"application/json",Authorization:"Bearer ".concat(t)},body:o},e.a(2,this.fetchFromUrl(this.baseUrlHealth,s,l))},e,this)})),function(t,r,i,n,a){return e.apply(this,arguments)})}]);var e,t,r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_,v,b,x,w,S,T}();function MR(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||RR(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function FR(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=RR(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function RR(e,t){if(e){if("string"==typeof e)return LR(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?LR(e,t):void 0}}function LR(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function zR(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var l=i&&i.prototype instanceof s?i:s,u=Object.create(l.prototype);return OR(u,"_invoke",function(r,i,n){var a,s,l,u=0,c=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,s=0,l=e,d.n=r,o}};function p(r,i){for(s=r,l=i,t=0;!h&&u&&!n&&t<c.length;t++){var n,a=c[t],p=d.p,f=a[2];r>3?(n=f===i)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((n=r<2&&p<a[1])?(s=0,d.v=i,d.n=a[1]):p<f&&(n=r<3||a[0]>i||i>f)&&(a[4]=r,a[5]=i,d.n=f,s=0))}if(n||r>1)return o;throw h=!0,i}return function(n,c,f){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,f),s=c,l=f;(t=s<2?e:l)||!h;){a||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(u=2,a){if(s||(n="next"),t=a[n]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);a=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==o)break}catch(t){a=e,s=1,l=t}finally{u=1}}return{value:t,done:h}}}(r,n,a),!0),u}var o={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):(OR(t={},i,function(){return this}),t),h=u.prototype=s.prototype=Object.create(c);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,OR(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,OR(h,"constructor",u),OR(u,"constructor",l),l.displayName="GeneratorFunction",OR(u,n,"GeneratorFunction"),OR(h),OR(h,n,"Generator"),OR(h,i,function(){return this}),OR(h,"toString",function(){return"[object Generator]"}),(zR=function(){return{w:a,m:d}})()}function OR(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}OR=function(e,t,r,i){function a(t,r){OR(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},OR(e,t,r,i)}function BR(e,t,r,i,n,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function jR(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(e){BR(a,i,n,o,s,"next",e)}function s(e){BR(a,i,n,o,s,"throw",e)}o(void 0)})}}function NR(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function UR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?NR(Object(r),!0).forEach(function(t){ZR(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NR(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function VR(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,WR(i.key),i)}}function $R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return($R=function(){return!!e})()}function GR(e){return GR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},GR(e)}function qR(e,t){return qR=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},qR(e,t)}function ZR(e,t,r){return(t=WR(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function WR(e){var t=function(e){if("object"!=HR(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=HR(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==HR(t)?t:t+""}function HR(e){return HR="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},HR(e)}function XR(e){if("string"==typeof e)return e;if(e&&"object"===HR(e)){var t=e;if("string"==typeof t.message)return t.message;if("string"==typeof t.error)return t.error}return JSON.stringify(e)}var KR=function(e){function t(e,r,i,n,a,o){var s;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ZR(s=function(e,t,r){return t=GR(t),function(e,t){if(t&&("object"==HR(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,$R()?Reflect.construct(t,r||[],GR(e).constructor):t.apply(e,r))}(this,t),"currentLang","en"),s.token=e,s.currentLang=r,s.requester=new kR(r,i,a,o),s.cache=null!=n?n:new K,s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&qR(e,t)}(t,e),function(e,t){return t&&VR(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"setLang",value:function(e){this.currentLang=e,this.requester.setLang(e)}},{key:"prepareSegmentation",value:function(e){return UR(UR({},e),{},{token:this.token})}},{key:"fetchAndParseMapStyle",value:(P=jR(zR().m(function e(t,r,i){var n,a,o,s,l,u;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!(n=void 0===t&&void 0===r&&void 0===i)||!this.baseStyle){e.n=1;break}return e.a(2,this.baseStyle);case 1:return e.p=1,e.n=2,this.requester.fetchMapStyle(this.token,t,r,i);case 2:if((a=e.v).ok){e.n=4;break}return e.n=3,a.json();case 3:throw o=e.v,new Error("Fetch failed with status ".concat(a.status,": ").concat(XR(o)));case 4:return e.n=5,a.json();case 5:return s=e.v,l=s.style,n&&(this.baseStyle=l),this.logEvent("fetchAndParseMapStyle"),e.a(2,l);case 6:throw e.p=6,u=e.v,this.logError(u,{functionName:"fetchAndParseMapStyle"}),new Error("Failed to fetch and parse map style",{cause:u});case 7:return e.a(2)}},e,this,[[1,6]])})),function(e,t,r){return P.apply(this,arguments)})},{key:"fetchAndParseMapStyleByBearer",value:(T=jR(zR().m(function e(t,r,i,n){var a,o,s,l,u;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchMapStyleByBearer(r,t,i,n);case 1:if((a=e.v).ok){e.n=3;break}return e.n=2,a.json();case 2:throw o=e.v,new Error("Fetch failed with status ".concat(a.status,": ").concat(XR(o)));case 3:return e.n=4,a.json();case 4:return s=e.v,l=s.style,this.logEvent("fetchAndParseMapStyleByBearer"),e.a(2,l);case 5:throw e.p=5,u=e.v,this.logError(u,{functionName:"fetchAndParseMapStyleByBearer"}),new Error("Failed to fetch and parse map style with bearer token",{cause:u});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t,r,i){return T.apply(this,arguments)})},{key:"fetchAndParseAnyMapStyle",value:(S=jR(zR().m(function e(t,r){var i,n,a,o,s;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchAnyMapStyle(r,t);case 1:if((i=e.v).ok){e.n=3;break}return e.n=2,i.json();case 2:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(XR(n)));case 3:return e.n=4,i.json();case 4:return a=e.v,o=a.style,this.logEvent("fetchAndParseAnyMapStyle"),e.a(2,o);case 5:throw e.p=5,s=e.v,this.logError(s,{functionName:"fetchAndParseAnyMapStyle"}),new Error("Failed to fetch and parse map style with bearer token",{cause:s});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t){return S.apply(this,arguments)})},{key:"fetchAndParseInstitutions",value:(w=jR(zR().m(function e(){var t,r,i,n,a,o,s,l,u,c;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchInstitutions(this.token);case 1:if((t=e.v).ok){e.n=3;break}return e.n=2,t.json();case 2:throw r=e.v,new Error("Fetch failed with status ".concat(t.status,": ").concat(XR(r)));case 3:return e.n=4,t.json();case 4:i=e.v,n=[],a=FR(i);try{for(a.s();!(o=a.n()).done;)s=o.value,l=new cR(s),n.push(l)}catch(e){a.e(e)}finally{a.f()}if(n.sort(function(e,t){return e.title.localeCompare(t.title)}),!(u=n)){e.n=5;break}return this.logEvent("fetchAndParseInstitutionsV2"),e.a(2,u);case 5:throw new Error("No institutions associated to this apiKey");case 6:e.n=8;break;case 7:throw e.p=7,c=e.v,this.logError(c,{functionName:"fetchAndParseInstitutionsV2"}),new Error("Failed to fetch and parse institution",{cause:c});case 8:return e.a(2)}},e,this,[[0,7]])})),function(){return w.apply(this,arguments)})},{key:"fetchAndParsePlaceDetail",value:(x=jR(zR().m(function e(t){var r,i,n,a,o,s,l,u,c,h,d;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,r=t.id,i=t.buildingId,n=t.floorId,a=t.level,o=this.placeCacheKey(r,i),null==(s=this.cache.getPlace(o,this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParsePlaceDetail",{cached:"true"}),e.a(2,s);case 1:return e.n=2,this.requester.fetchPlaceDetail(this.token,r,i,n,a);case 2:if((l=e.v).ok){e.n=4;break}return e.n=3,l.json();case 3:throw u=e.v,new Error("Fetch failed with status ".concat(l.status,": ").concat(XR(u)));case 4:return e.n=5,l.json();case 5:return c=e.v,h=new B(c),this.cachePlace(h,i),this.logEvent("fetchAndParsePlaceDetail",{cached:"false"}),e.a(2,h);case 6:throw e.p=6,d=e.v,new Error("Failed to fetch and parse place detail",{cause:d});case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return x.apply(this,arguments)})},{key:"fetchAndParseAnyPlaceDetail",value:(b=jR(zR().m(function e(t,r){var i,n,a,o,s,l,u,c,h,d,p;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,i=t.id,n=t.buildingId,a=t.floorId,o=t.level,s=this.placeCacheKey(i,n),null==(l=this.cache.getPlace(s,this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParseAnyPlaceDetail",{cached:"true"}),e.a(2,l);case 1:return e.n=2,this.requester.fetchAnyPlaceDetail(r,i,n,a,o);case 2:if((u=e.v).ok){e.n=4;break}return e.n=3,u.json();case 3:throw c=e.v,new Error("Fetch failed with status ".concat(u.status,": ").concat(XR(c)));case 4:return e.n=5,u.json();case 5:return h=e.v,d=new B(h),this.cachePlace(d,n),this.logEvent("fetchAndParseAnyPlaceDetail",{cached:"false"}),e.a(2,d);case 6:throw e.p=6,p=e.v,new Error("Failed to fetch and parse place detail with bearer token",{cause:p});case 7:return e.a(2)}},e,this,[[0,6]])})),function(e,t){return b.apply(this,arguments)})},{key:"placeCacheKey",value:function(e,t){return null!=t?"".concat(e,"_").concat(t):e}},{key:"cachePlace",value:function(e,t){this.cache.setPlace(e.mapvxId,e,this.currentLang),null!=e.clientId&&this.cache.setPlace(this.placeCacheKey(e.clientId,t),e,this.currentLang)}},{key:"fetchAndParseSubPlaces",value:(v=jR(zR().m(function e(t){var r,i,n,a,o,s,l=this;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getSubPlaces(t,this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParseSubPlaces",{cached:"true"}),e.a(2,r.data);case 1:return e.n=2,this.requester.fetchSubPlaces(t,this.token);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(XR(n)));case 4:return e.n=5,i.json();case 5:return a=e.v,o=a.map(function(e){return new B(e)}),this.cache.setSubPlaces(t,this.currentLang,{timestamp:Date.now(),data:o}),this.logEvent("fetchAndParseSubPlaces",{cached:"false"}),o.forEach(function(e){l.cache.hasPlace(e.mapvxId,l.currentLang)||l.cache.setPlace(e.mapvxId,e,l.currentLang),null==e.clientId||l.cache.hasPlace(e.clientId,l.currentLang)||l.cache.setPlace(e.clientId,e,l.currentLang)}),e.a(2,o);case 6:throw e.p=6,s=e.v,new Error("Failed to fetch and parse subplaces",{cause:s});case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return v.apply(this,arguments)})},{key:"fetchAndParseAnySubPlaces",value:(_=jR(zR().m(function e(t,r){var i,n,a,o,s,l=this;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchAnySubPlaces(t,r);case 1:if((i=e.v).ok){e.n=3;break}return e.n=2,i.json();case 2:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(XR(n)));case 3:return e.n=4,i.json();case 4:return a=e.v,o=a.map(function(e){return new B(e)}),this.logEvent("fetchAndParseAnySubPlaces"),o.forEach(function(e){l.cache.hasPlace(e.mapvxId,l.currentLang)||l.cache.setPlace(e.mapvxId,e,l.currentLang),null==e.clientId||l.cache.hasPlace(e.clientId,l.currentLang)||l.cache.setPlace(e.clientId,e,l.currentLang)}),e.a(2,o);case 5:throw e.p=5,s=e.v,new Error("Failed to fetch and parse any subplaces",{cause:s});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t){return _.apply(this,arguments)})},{key:"fetchAndParseAvailablePlaces",value:(y=jR(zR().m(function e(){var t,r,i,n,a,o=this;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchAllowedPlaces(this.token);case 1:if((t=e.v).ok){e.n=3;break}return e.n=2,t.json();case 2:throw r=e.v,new Error("Fetch failed with status ".concat(t.status,": ").concat(XR(r)));case 3:return e.n=4,t.json();case 4:return i=e.v,n=i.map(function(e){return new B(e)}),this.logEvent("fetchAndParseAvailablePlaces"),n.forEach(function(e){o.cache.hasPlace(e.mapvxId,o.currentLang)||o.cache.setPlace(e.mapvxId,e,o.currentLang),null==e.clientId||o.cache.hasPlace(e.clientId,o.currentLang)||o.cache.setPlace(e.clientId,e,o.currentLang)}),e.a(2,n);case 5:throw e.p=5,a=e.v,this.logError(a,{functionName:"fetchAndParseAvailablePlaces"}),new Error("Failed to fetch and parse parent places",{cause:a});case 6:return e.a(2)}},e,this,[[0,5]])})),function(){return y.apply(this,arguments)})},{key:"fetchAndParsePlacesFromInstitution",value:(g=jR(zR().m(function e(t,r){var i,n,a,o,s,l=this;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchPlacesFromAnyInstitution(t,r);case 1:if((i=e.v).ok){e.n=3;break}return e.n=2,i.json();case 2:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(XR(n)));case 3:return e.n=4,i.json();case 4:return a=e.v,o=a.map(function(e){return new B(e)}),this.logEvent("fetchAndParsePlacesFromInstitution"),o.forEach(function(e){l.cache.hasPlace(e.mapvxId,l.currentLang)||l.cache.setPlace(e.mapvxId,e,l.currentLang),null==e.clientId||l.cache.hasPlace(e.clientId,l.currentLang)||l.cache.setPlace(e.clientId,e,l.currentLang)}),e.a(2,o);case 5:throw e.p=5,s=e.v,this.logError(s,{functionName:"fetchAndParsePlacesFromInstitution"}),new Error("Failed to fetch and parse parent places from institution",{cause:s});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t){return g.apply(this,arguments)})},{key:"getCachedPlaces",value:function(e){var t=this,r=[];return e.forEach(function(e){var i=t.cache.getPlace(e,t.currentLang);null!=i&&r.push(i)}),r}},{key:"getCachedSubPlaces",value:function(e){var t=this.cache.getSubPlaces(e,this.currentLang);return null==t?void 0:t.data}},{key:"fetchAndParseRoute",value:(m=jR(zR().m(function e(t){var r,i,n,a,o,s,l;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,r="","id"in t.finalLocation&&(r=t.finalLocation.id),null==(i=this.cache.getRoute(r))){e.n=1;break}return this.logEvent("fetchAndParseRoute",{cached:"true"}),this.debugLog("Route cache testing. Found in caché."),e.a(2,i.data);case 1:return e.n=2,this.requester.fetchRoute(t,this.token);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw a=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(XR(a)));case 4:return e.n=5,n.json();case 5:return o=e.v,s=new YF(o[0]),this.logEvent("fetchAndParseRoute"),this.debugLog("Route cache testing. Fetched."),e.a(2,s);case 6:throw e.p=6,l=e.v,new Error("Failed to fetch and parse route",{cause:l});case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return m.apply(this,arguments)})},{key:"fetchAndParseRouteV2",value:(f=jR(zR().m(function e(t){var r,i,n,a,o,s,l;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,r="","id"in t.finalLocation&&(r=t.finalLocation.id),null==(i=this.cache.getRoute(r))){e.n=1;break}return this.logEvent("fetchAndParseRouteV2",{cached:"true"}),this.debugLog("Route cache testing. Found in caché."),e.a(2,i.data);case 1:return e.n=2,this.requester.fetchRouteV2(t,this.token);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw a=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(XR(a)));case 4:return e.n=5,n.json();case 5:return o=e.v,s=new YF(o[0]),this.logEvent("fetchAndParseRouteV2"),this.debugLog("Route cache testing. Fetched."),e.a(2,s);case 6:throw e.p=6,l=e.v,new Error("Failed to fetch and parse route",{cause:l});case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return f.apply(this,arguments)})},{key:"fetchAndParseLiveRoute",value:(p=jR(zR().m(function e(t){var r,i,n,a,o;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchLiveRoute(t,this.token);case 1:if((r=e.v).ok){e.n=3;break}return e.n=2,r.json();case 2:throw i=e.v,new Error("Fetch failed with status ".concat(r.status,": ").concat(XR(i)));case 3:return e.n=4,r.json();case 4:return n=e.v,a=new YF(n[0]),this.logEvent("fetchAndParseLiveRoute"),this.debugLog("Live route fetched."),e.a(2,a);case 5:throw e.p=5,o=e.v,new Error("Failed to fetch and parse route",{cause:o});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e){return p.apply(this,arguments)})},{key:"fetchAndParseTransport",value:(d=jR(zR().m(function e(t){var r,i,n,a,o,s,l,u,c,h,d=this;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getVehicle(t,this.currentLang))||!(Date.now()-r.timestamp<6e4||0===r.data.routes.length)){e.n=1;break}return this.logEvent("fetchAndParseTransport",{cached:"true"}),e.a(2,r.data);case 1:return e.n=2,this.requester.fetchTransport(this.token,t);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(XR(n)));case 4:return e.n=5,i.json();case 5:if(!((a=e.v).realtimeSchedules.length>0)){e.n=7;break}return o=a.realtimeSchedules.map(function(e){return d.fetchAndParseStops(t,e.vehicleId)}),e.n=6,Promise.all(o);case 6:(s=e.v).length>0&&a.realtimeSchedules.forEach(function(e){var t,r;e.stops=null!==(t=null===(r=s.find(function(t){return t.id==e.vehicleId}))||void 0===r?void 0:r.places)&&void 0!==t?t:[]});case 7:return l=new mR(a),this.cache.setVehicle(t,{timestamp:Date.now(),data:l},this.currentLang),this.logEvent("fetchAndParseTransport",{cached:"false"}),e.a(2,l);case 8:if(e.p=8,h=e.v,null==(u=this.cache.getVehicle(t,this.currentLang))){e.n=9;break}return c=new mR({realtimeSchedules:[],schedules:u.data.schedule}),this.logEvent("fetchAndParseTransport",{cached:"true"}),e.a(2,c);case 9:throw new Error("Failed to fetch and parse transport",{cause:h});case 10:return e.a(2)}},e,this,[[0,8]])})),function(e){return d.apply(this,arguments)})},{key:"fetchAndParseStops",value:(h=jR(zR().m(function e(t,r){var i,n,a,o,s,l;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,!(null!=(i=this.cache.getStops(t+r,this.currentLang))&&Date.now()-i.timestamp<6e4)){e.n=1;break}return this.logEvent("fetchAndParseStops",{cached:"true"}),e.a(2,{id:r,places:i.data});case 1:return e.n=2,this.requester.fetchStops(this.token,t,r);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw a=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(XR(a)));case 4:return e.n=5,n.json();case 5:return o=e.v,s=o.map(function(e){return new B(e)}),this.cache.setStops(t+r,{timestamp:Date.now(),data:s},this.currentLang),this.logEvent("fetchAndParseStops",{cached:"false"}),e.a(2,{id:r,places:s});case 6:throw e.p=6,l=e.v,new Error("Failed to fetch and parse stops",{cause:l});case 7:return e.a(2)}},e,this,[[0,6]])})),function(e,t){return h.apply(this,arguments)})},{key:"fetchAndParseSearchResults",value:(c=jR(zR().m(function e(t,r,i,n,a,o,s){var l,u,c,h,d;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchSearchResults(t,r,this.token,i,n,a,o,s);case 1:if((l=e.v).ok){e.n=3;break}return e.n=2,l.json();case 2:throw u=e.v,new Error("Fetch failed with status ".concat(l.status,": ").concat(XR(u)));case 3:return e.n=4,l.json();case 4:return c=e.v,h=c.map(function(e){return new B(e)}),e.a(2,h);case 5:throw e.p=5,d=e.v,new Error("Failed to fetch and parse search results",{cause:d});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t,r,i,n,a,o){return c.apply(this,arguments)})},{key:"fetchAndParseSearchPlacesByTags",value:(u=jR(zR().m(function e(t,r,i,n,a,o,s,l){var u,c,h,d,p,f=this;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchSearchPlacesByTags(t,r,this.token,i,n,a,o,s,l);case 1:if((u=e.v).ok){e.n=3;break}return e.n=2,u.json();case 2:throw c=e.v,new Error("Fetch failed with status ".concat(u.status,": ").concat(XR(c)));case 3:return e.n=4,u.json();case 4:return h=e.v,d=h.map(function(e){return new B(e)}),this.logEvent("fetchAndParseSearchPlacesByTags"),d.forEach(function(e){f.cache.hasPlace(e.mapvxId,f.currentLang)||f.cache.setPlace(e.mapvxId,e,f.currentLang),null==e.clientId||f.cache.hasPlace(e.clientId,f.currentLang)||f.cache.setPlace(e.clientId,e,f.currentLang)}),e.a(2,d);case 5:throw e.p=5,p=e.v,new Error("Failed to fetch and parse search places by tags",{cause:p});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t,r,i,n,a,o,s){return u.apply(this,arguments)})},{key:"fetchAndParseRoutesFromOrigin",value:(l=jR(zR().m(function e(t,r,i,n,a){var o,s,l,u,c,h,d=this;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchRoutesForOrigin(this.token,t,r,i,n,a);case 1:if((o=e.v).ok){e.n=3;break}return e.n=2,o.json();case 2:throw s=e.v,new Error("Fetch failed with status ".concat(o.status,": ").concat(XR(s)));case 3:return e.n=4,o.json();case 4:l=e.v,u=l.routes,c=l.accessibleRoutes,Object.entries(u).forEach(function(e){var t=MR(e,2),r=t[0],i=t[1],n=new YF(i[0]);d.cache.setRoute(r,{timestamp:Date.now(),data:n})}),Object.entries(c).forEach(function(e){var t=MR(e,2),r=t[0],i=t[1],n=new YF(i[0]);d.cache.setAccessibleRoute(r,{timestamp:Date.now(),data:n})}),this.debugLog("Route cache testing. Cache populated!"),e.n=6;break;case 5:throw e.p=5,h=e.v,new Error("Failed to fetch and parse routes from origin results",{cause:h});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t,r,i,n){return l.apply(this,arguments)})},{key:"fetchAndParseCacheTimestamp",value:(s=jR(zR().m(function e(t){var r,i,n,a,o;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchCacheTimestamp(this.token,t);case 1:if((r=e.v).ok){e.n=3;break}return e.n=2,r.json();case 2:throw i=e.v,new Error("Fetch failed with status ".concat(r.status,": ").concat(XR(i)));case 3:return e.n=4,r.json();case 4:return n=e.v,a=n.lastUpdate,e.a(2,a);case 5:throw e.p=5,o=e.v,new Error("Failed to fetch and parse cache timestamp",{cause:o});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e){return s.apply(this,arguments)})},{key:"cleanRoutesCache",value:function(){this.cache.cleanRoutesCache(),this.cache.cleanAccessibleRoutesCache()}},{key:"fetchAndParseConfiguration",value:(o=jR(zR().m(function e(t,r){var i,n,a,o,s;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(i=this.cache.getConfiguration(t||"default",r||"default",this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParseConfiguration",{cached:"true"}),e.a(2,i.data);case 1:return e.n=2,this.requester.fetchConfiguration(this.token,t,r);case 2:if((n=e.v).ok){e.n=4;break}return e.n=3,n.json();case 3:throw a=e.v,new Error("Fetch failed with status ".concat(n.status,": ").concat(XR(a)));case 4:return e.n=5,n.json();case 5:return o=e.v,this.cache.setConfiguration(t||"default",r||"default",this.currentLang,{timestamp:Date.now(),data:o}),this.logEvent("fetchAndParseConfiguration",{cached:"false"}),e.a(2,o);case 6:throw e.p=6,s=e.v,this.logError(s,{functionName:"fetchAndParseConfiguration"}),new Error("Failed to fetch and parse configuration",{cause:s});case 7:return e.a(2)}},e,this,[[0,6]])})),function(e,t){return o.apply(this,arguments)})},{key:"fetchAndParseCampaigns",value:(a=jR(zR().m(function e(t,r){var i,n,a,o,s;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchCampaigns(this.token,t,r);case 1:if((i=e.v).ok){e.n=3;break}return e.n=2,i.json();case 2:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(XR(n)));case 3:return e.n=4,i.json();case 4:return a=e.v,Array.isArray(a)||this.logWarning(new Error("Campaigns response body was not an array"),{functionName:"fetchAndParseCampaigns",receivedType:null===a?"null":HR(a)}),o=(Array.isArray(a)?a:[]).map(function(e){return new aR(e)}),this.logEvent("fetchAndParseCampaigns",{count:String(o.length)}),e.a(2,o);case 5:throw e.p=5,s=e.v,this.logError(s,{functionName:"fetchAndParseCampaigns"}),new Error("Failed to fetch and parse campaigns",{cause:s});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e,t){return a.apply(this,arguments)})},{key:"fetchAndParseCategories",value:(n=jR(zR().m(function e(t){var r,i,n,a,o;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,null==(r=this.cache.getCategories(t||"default",this.currentLang))){e.n=1;break}return this.logEvent("fetchAndParseCategories",{cached:"true"}),e.a(2,r.data);case 1:return e.n=2,this.requester.fetchCategories(this.token,t);case 2:if((i=e.v).ok){e.n=4;break}return e.n=3,i.json();case 3:throw n=e.v,new Error("Fetch failed with status ".concat(i.status,": ").concat(XR(n)));case 4:return e.n=5,i.json();case 5:return a=e.v,this.cache.setCategories(t||"default",this.currentLang,{timestamp:Date.now(),data:a}),this.logEvent("fetchAndParseCategories",{cached:"false"}),e.a(2,a);case 6:throw e.p=6,o=e.v,new Error("Failed to fetch and parse categories",{cause:o});case 7:return e.a(2)}},e,this,[[0,6]])})),function(e){return n.apply(this,arguments)})},{key:"fetchAndParseCssCustomization",value:(i=jR(zR().m(function e(t){var r,i,n,a;return zR().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.requester.fetchCssCustomization(this.token,t);case 1:if((r=e.v).ok){e.n=3;break}return e.n=2,r.json();case 2:throw i=e.v,new Error("Fetch failed with status ".concat(r.status,": ").concat(XR(i)));case 3:return e.n=4,r.json();case 4:return n=e.v,e.a(2,n);case 5:throw e.p=5,a=e.v,new Error("Failed to fetch and parse css customization",{cause:a});case 6:return e.a(2)}},e,this,[[0,5]])})),function(e){return i.apply(this,arguments)})},{key:"postAndParseHealthPing",value:(r=jR(zR().m(function e(t,r,i,n){var a,o,s;return zR().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.requester.postHealth(this.token,t,r,i,n);case 1:if((a=e.v).ok){e.n=3;break}return e.n=2,a.json();case 2:throw o=e.v,new Error("Post failed with status ".concat(a.status,": ").concat(XR(o)));case 3:return e.n=4,a.json();case 4:return s=e.v,e.a(2,s)}},e,this)})),function(e,t,i,n){return r.apply(this,arguments)})}]);var r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_,v,b,x,w,S,T,P}(zF);function YR(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}var JR=64,QR=6,eL="no-overlap",tL=void 0,rL=[{type:"directional",color:16777215,intensity:2,position:{x:50,y:100,z:80}},{type:"directional",color:16777215,intensity:1.5,position:{x:-50,y:80,z:-60}},{type:"ambient",color:16777215,intensity:1.5}],iL=function(e){var t=e.match(/\w\w/g);if(!t||t.length<3)throw new Error("Invalid hex color: ".concat(e));return[Number.parseInt(t[0],16),Number.parseInt(t[1],16),Number.parseInt(t[2],16)]};function nL(e,t){return void 0===e?[t,t,t]:"number"==typeof e?[e,e,e]:[e[0],e[1],e[2]]}function aL(e){return function(e){if(Array.isArray(e))return uL(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||lL(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oL(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||lL(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sL(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=lL(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function lL(e,t){if(e){if("string"==typeof e)return uL(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?uL(e,t):void 0}}function uL(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function cL(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hL(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?hL(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function hL(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function dL(e){var t;return function(){return null!=t||(t=e().catch(function(e){throw t=void 0,e})),t}}var pL=dL(function(){return Promise.all([Promise.resolve().then(()=>r.t(912,23)),Promise.resolve().then(()=>r.t(833,23)),Promise.resolve().then(()=>r.t(303,23)),Promise.resolve().then(()=>r.t(373,23))]).then(function(e){var t=cL(e,4),r=t[0],i=t[1],n=t[2],a=t[3];return{THREE:r,GLTFLoader:i.GLTFLoader,DRACOLoader:n.DRACOLoader,KTX2Loader:a.KTX2Loader}})}),fL=dL(function(){return Promise.resolve().then(()=>r.t(502,23)).then(function(e){return e.MeshoptDecoder})}),mL=dL(function(){return Promise.all([Promise.resolve().then(()=>r.t(452,23)),Promise.resolve().then(()=>r.t(741,23)),Promise.resolve().then(()=>r.t(589,23))]).then(function(e){var t=cL(e,3),r=t[0],i=t[1],n=t[2];return{MapboxOverlay:r.MapboxOverlay,MVTLayer:i.MVTLayer,IconLayer:n.IconLayer,PathLayer:n.PathLayer,TextLayer:n.TextLayer}})});function gL(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return yL(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?yL(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yL(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function _L(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var l=i&&i.prototype instanceof s?i:s,u=Object.create(l.prototype);return vL(u,"_invoke",function(r,i,n){var a,s,l,u=0,c=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,s=0,l=e,d.n=r,o}};function p(r,i){for(s=r,l=i,t=0;!h&&u&&!n&&t<c.length;t++){var n,a=c[t],p=d.p,f=a[2];r>3?(n=f===i)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((n=r<2&&p<a[1])?(s=0,d.v=i,d.n=a[1]):p<f&&(n=r<3||a[0]>i||i>f)&&(a[4]=r,a[5]=i,d.n=f,s=0))}if(n||r>1)return o;throw h=!0,i}return function(n,c,f){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,f),s=c,l=f;(t=s<2?e:l)||!h;){a||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(u=2,a){if(s||(n="next"),t=a[n]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);a=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==o)break}catch(t){a=e,s=1,l=t}finally{u=1}}return{value:t,done:h}}}(r,n,a),!0),u}var o={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):(vL(t={},i,function(){return this}),t),h=u.prototype=s.prototype=Object.create(c);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,vL(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,vL(h,"constructor",u),vL(u,"constructor",l),l.displayName="GeneratorFunction",vL(u,n,"GeneratorFunction"),vL(h),vL(h,n,"Generator"),vL(h,i,function(){return this}),vL(h,"toString",function(){return"[object Generator]"}),(_L=function(){return{w:a,m:d}})()}function vL(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}vL=function(e,t,r,i){function a(t,r){vL(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},vL(e,t,r,i)}function bL(e,t,r,i,n,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function xL(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(e){bL(a,i,n,o,s,"next",e)}function s(e){bL(a,i,n,o,s,"throw",e)}o(void 0)})}}function wL(e){return wL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wL(e)}var SL=dL(function(){return pL().then(function(e){var t=new e.DRACOLoader;t.setDecoderPath("https://mapvx-glb-assets.s3.us-east-1.amazonaws.com/decoders/draco/");var r=new e.GLTFLoader;r.setDRACOLoader(t);var i=new e.KTX2Loader;return i.setTranscoderPath("https://mapvx-glb-assets.s3.us-east-1.amazonaws.com/decoders/transcoder/"),r.setKTX2Loader(i),i.detectSupport(new e.THREE.WebGLRenderer({antialias:!0})),r.setMeshoptDecoder(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fL;return{supported:"object"===("undefined"==typeof WebAssembly?"undefined":wL(WebAssembly)),decodeGltfBufferAsync:(e=xL(_L().m(function e(r,i,n,a,o){var s;return _L().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t();case 1:return s=e.v,e.n=2,s.ready;case 2:return e.a(2,s.decodeGltfBufferAsync(r,i,n,a,o))}},e)})),function(t,r,i,n,a){return e.apply(this,arguments)})}}()),r})});function TL(e,t){if(!(e.byteLength<12)){var r=new DataView(e,0,12);if(1179937895===r.getUint32(0,!0)){var i=r.getUint32(8,!0);if(i!==e.byteLength)throw new Error("GLB download is truncated or corrupt: header declares ".concat(i," bytes, received ").concat(e.byteLength,": ").concat(t))}}}function PL(e){return EL.apply(this,arguments)}function EL(){return EL=xL(_L().m(function e(t){var r,i,n,a,o,s,l,u,c,h,d,p,f,m=arguments;return _L().w(function(e){for(;;)switch(e.p=e.n){case 0:return i=(r=m.length>1&&void 0!==m[1]?m[1]:{}).timeoutMs,n=void 0===i?5e5:i,a=r.onProgress,e.n=1,Promise.all([SL(),pL()]);case 1:if(o=e.v,s=gL(o,2),l=s[0],u=s[1].THREE,c=!1,(h=new u.FileLoader).setResponseType("arraybuffer"),d=new Promise(function(e,r){var i=function(e){c||r(e instanceof Error?e:new Error(String(e)))};h.load(t,function(r){if(!c){var n=r;try{TL(n,t)}catch(e){return void i(e)}l.parse(n,u.LoaderUtils.extractUrlBase(t),function(t){c||e(t.scene)},i)}},function(e){c||null==a||a(e)},i)}),Number.isFinite(n)&&!(n<=0)){e.n=5;break}return e.p=2,e.n=3,d;case 3:case 7:return e.a(2,e.v);case 4:return e.p=4,c=!0,e.f(4);case 5:return f=new Promise(function(e,r){p=setTimeout(function(){return r(new Error("Timed out loading GLB after ".concat(n,"ms: ").concat(t)))},n)}),e.p=6,e.n=7,Promise.race([d,f]);case 8:return e.p=8,c=!0,clearTimeout(p),h.abort(),e.f(8);case 9:return e.a(2)}},e,null,[[6,,8,9],[2,,4,5]])})),EL.apply(this,arguments)}function DL(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return AL(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?AL(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function AL(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function IL(e,t){var r=(new e.Box3).setFromObject(t),i=r.getCenter(new e.Vector3);return i.y=r.min.y,i}var CL=["map","alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","metalnessMap","normalMap","roughnessMap","specularMap","gradientMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenColorMap","sheenRoughnessMap","transmissionMap","thicknessMap","iridescenceMap","iridescenceThicknessMap","anisotropyMap"];function kL(e,t,r){if(r){var i,n=t,a=DL(CL);try{for(a.s();!(i=a.n()).done;){var o=n[i.value];o instanceof e.Texture&&o.dispose()}}catch(e){a.e(e)}finally{a.f()}}t.dispose()}function ML(e,t){t.traverse(function(t){var r=t;if(r.isMesh){var i,n=DL(Array.isArray(r.material)?r.material:[r.material]);try{for(n.s();!(i=n.n()).done;){var a=i.value;kL(e,a,!1)}}catch(e){n.e(e)}finally{n.f()}}})}function FL(e,t){t.traverse(function(t){var r,i=t;if(i.isMesh){null===(r=i.geometry)||void 0===r||r.dispose();var n,a=DL(Array.isArray(i.material)?i.material:[i.material]);try{for(a.s();!(n=a.n()).done;){var o=n.value;kL(e,o,!0)}}catch(e){a.e(e)}finally{a.f()}}})}function RL(e){return RL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},RL(e)}function LL(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function zL(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?LL(Object(r),!0).forEach(function(t){WL(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LL(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function OL(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||NL(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function BL(e){return function(e){if(Array.isArray(e))return UL(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||NL(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jL(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=NL(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function NL(e,t){if(e){if("string"==typeof e)return UL(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?UL(e,t):void 0}}function UL(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function VL(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var l=i&&i.prototype instanceof s?i:s,u=Object.create(l.prototype);return $L(u,"_invoke",function(r,i,n){var a,s,l,u=0,c=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,s=0,l=e,d.n=r,o}};function p(r,i){for(s=r,l=i,t=0;!h&&u&&!n&&t<c.length;t++){var n,a=c[t],p=d.p,f=a[2];r>3?(n=f===i)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((n=r<2&&p<a[1])?(s=0,d.v=i,d.n=a[1]):p<f&&(n=r<3||a[0]>i||i>f)&&(a[4]=r,a[5]=i,d.n=f,s=0))}if(n||r>1)return o;throw h=!0,i}return function(n,c,f){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,f),s=c,l=f;(t=s<2?e:l)||!h;){a||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(u=2,a){if(s||(n="next"),t=a[n]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);a=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==o)break}catch(t){a=e,s=1,l=t}finally{u=1}}return{value:t,done:h}}}(r,n,a),!0),u}var o={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):($L(t={},i,function(){return this}),t),h=u.prototype=s.prototype=Object.create(c);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,$L(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,$L(h,"constructor",u),$L(u,"constructor",l),l.displayName="GeneratorFunction",$L(u,n,"GeneratorFunction"),$L(h),$L(h,n,"Generator"),$L(h,i,function(){return this}),$L(h,"toString",function(){return"[object Generator]"}),(VL=function(){return{w:a,m:d}})()}function $L(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}$L=function(e,t,r,i){function a(t,r){$L(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},$L(e,t,r,i)}function GL(e,t,r,i,n,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function qL(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(e){GL(a,i,n,o,s,"next",e)}function s(e){GL(a,i,n,o,s,"throw",e)}o(void 0)})}}function ZL(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,HL(i.key),i)}}function WL(e,t,r){return(t=HL(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function HL(e){var t=function(e){if("object"!=RL(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=RL(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==RL(t)?t:t+""}var XL=function(){function e(t,r,i,n){var a,o,s,l,u,c,h;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),WL(this,"currentFloor",""),WL(this,"threeMod",void 0),WL(this,"deckMod",void 0),WL(this,"deckOverlay",void 0),WL(this,"scene3DGlbScene",void 0),WL(this,"scene3DGlbRootByUrl",new globalThis.Map),WL(this,"scene3DGlbTemplateById",new globalThis.Map),WL(this,"scene3DGlbLightCount",0),WL(this,"scene3DModelsGroup",void 0),WL(this,"glbRenderer",void 0),WL(this,"scene3DRouteCollisionPoints",[]),WL(this,"spriteIconMapping",{}),WL(this,"spriteAtlasImage",new Image),WL(this,"modelsUnloadedByLod",!1),WL(this,"glbTemplatesLoadInFlight",!1),this.map=t,this.scene3DConfig=r,this.initialCenter=i,this.onModelsProgress=n,this.deckTileCache=(c=function(e,t){return"number"==typeof e&&Number.isFinite(e)&&e>=1?Math.floor(e):t},h="number"==typeof(null==(l=null===(a=r.customLayers)||void 0===a?void 0:a.tileCache)?void 0:l.maxCacheByteSize)&&Number.isFinite(l.maxCacheByteSize)&&l.maxCacheByteSize>=1?Math.floor(l.maxCacheByteSize):tL,{maxCacheSize:c(null==l?void 0:l.maxCacheSize,JR),maxRequests:c(null==l?void 0:l.maxRequests,QR),refinementStrategy:null!==(u=null==l?void 0:l.refinementStrategy)&&void 0!==u?u:eL,maxCacheByteSize:h}),this.useTileWorker=null!==(o=null===(s=r.customLayers)||void 0===s?void 0:s.useTileWorker)&&void 0!==o&&o,this.lodThresholds=function(e){var t=null==e?void 0:e.lod;if(!e||!1===e.enabled||!t||"number"!=typeof t.minZoom||!Number.isFinite(t.minZoom))return null;var r="number"==typeof t.hysteresis&&Number.isFinite(t.hysteresis)&&t.hysteresis>=0?t.hysteresis:.5;return{reloadAtOrAbove:t.minZoom,unloadBelow:t.minZoom-r}}(r.models)}return function(e,t){return t&&ZL(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,[{key:"onMapLoad",value:(a=qL(VL().m(function e(){var t,r,i,n;return VL().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.ensure3DLibs();case 1:e.n=3;break;case 2:return e.p=2,n=e.v,console.error("Failed to load 3D libraries (three/deck.gl)",n),e.a(2);case 3:if(this.deckMod){e.n=4;break}return e.a(2);case 4:if(!(r=null===(t=this.scene3DConfig.customLayers)||void 0===t||null===(t=t.iconLayers)||void 0===t?void 0:t.spriteUrl)){e.n=5;break}return e.n=5,this.loadSpriteAtlas(r).catch(function(e){return console.error("Failed to load sprite atlas",e)});case 5:this.deckOverlay=new this.deckMod.MapboxOverlay({layers:[]}),this.map.addControl(this.deckOverlay),this.hideLayers(this.scene3DConfig.hideLayers),this.installDebugStatsHook(),void 0!==(i=this.scene3DConfig.models)&&!1!==i.enabled&&i.assets.length>0&&this.map.addLayer(this.createGlbCustomLayer()),this.updateDeckOverlay();case 6:return e.a(2)}},e,this,[[0,2]])})),function(){return a.apply(this,arguments)})},{key:"reattachToStyle",value:function(){if(this.deckMod){this.hideLayers(this.scene3DConfig.hideLayers),this.installDebugStatsHook();var e=this.scene3DConfig.models;void 0!==e&&!1!==e.enabled&&e.assets.length>0&&this.map.addLayer(this.createGlbCustomLayer()),this.updateDeckOverlay()}}},{key:"onZoom",value:function(){this.applyModelOpacity(),this.updateLodForZoom()}},{key:"updateLodForZoom",value:function(){if(this.lodThresholds){var e,t,r,i=(e=this.map.getZoom(),t=this.lodThresholds,!(r=this.modelsUnloadedByLod)&&e<t.unloadBelow?"unload":r&&e>=t.reloadAtOrAbove?"reload":"none");if("unload"===i){if(this.glbTemplatesLoadInFlight)return;this.unloadScene3DModelsForLod()}else"reload"===i&&this.reloadScene3DModelsForLod()}}},{key:"unloadScene3DModelsForLod",value:function(){var e,t=null===(e=this.threeMod)||void 0===e?void 0:e.THREE;if(t){var r;this.scene3DModelsGroup&&(ML(t,this.scene3DModelsGroup),null===(r=this.scene3DGlbScene)||void 0===r||r.remove(this.scene3DModelsGroup),this.scene3DModelsGroup=void 0);var i,n=jL(this.scene3DGlbRootByUrl.values());try{for(n.s();!(i=n.n()).done;)FL(t,i.value)}catch(e){n.e(e)}finally{n.f()}this.scene3DGlbRootByUrl.clear(),this.scene3DGlbTemplateById.clear(),this.modelsUnloadedByLod=!0,this.map.triggerRepaint()}}},{key:"reloadScene3DModelsForLod",value:(n=qL(VL().m(function e(){var t;return VL().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!this.glbTemplatesLoadInFlight){e.n=1;break}return e.a(2);case 1:return this.glbTemplatesLoadInFlight=!0,e.p=2,e.n=3,this.loadScene3DGlbTemplates();case 3:this.placeScene3DModels(),this.modelsUnloadedByLod=!1,e.n=5;break;case 4:e.p=4,t=e.v,console.error("Failed to reload declarative GLB models after LOD unload",t);case 5:return e.p=5,this.glbTemplatesLoadInFlight=!1,e.f(5);case 6:this.updateLodForZoom();case 7:return e.a(2)}},e,this,[[2,4,5,6]])})),function(){return n.apply(this,arguments)})},{key:"setRouteCollisionPath",value:function(e){this.scene3DRouteCollisionPoints=e,this.recomputeRouteAffectedModels(),this.applyModelOpacity()}},{key:"onFloorChange",value:function(e){var t=null!=e?e:"";t!==this.currentFloor&&(this.currentFloor=t,this.updateDeckOverlay(),this.placeScene3DModels())}},{key:"refreshOverlay",value:function(e){this.currentFloor=null!=e?e:"",this.updateDeckOverlay()}},{key:"getDebugStats",value:function(){var e,t,r,i,n,a=null===(e=this.glbRenderer)||void 0===e?void 0:e.info,o=a?{geometries:a.memory.geometries,textures:a.memory.textures,programs:null!==(t=null===(r=a.programs)||void 0===r?void 0:r.length)&&void 0!==t?t:0,renderCalls:a.render.calls,triangles:a.render.triangles}:null,s=null;try{var l,u=this.deckOverlay,c=null==u||null===(l=u._deck)||void 0===l||null===(l=l.layerManager)||void 0===l?void 0:l.layers;if(Array.isArray(c)){for(var h={},d=0,p=c;d<p.length;d++){var f,m=p[d],g=null==m||null===(f=m.state)||void 0===f||null===(f=f.tileset)||void 0===f||null===(f=f._cache)||void 0===f?void 0:f.size;if("number"==typeof g&&m.id){var y,_=m.id.split("-sublayer")[0];h[_]=Math.max(null!==(y=h[_])&&void 0!==y?y:0,g)}}s=h}}catch(e){s=null}return{zoom:this.map.getZoom(),currentFloor:this.currentFloor,modelsUnloadedByLod:this.modelsUnloadedByLod,glbRoots:this.scene3DGlbRootByUrl.size,glbTemplates:this.scene3DGlbTemplateById.size,placedModels:null!==(i=null===(n=this.scene3DModelsGroup)||void 0===n?void 0:n.children.length)&&void 0!==i?i:0,three:o,deckTiles:s,deckTileCache:this.deckTileCache,lodThresholds:this.lodThresholds}}},{key:"installDebugStatsHook",value:function(){var e=this,t=globalThis;t.__MVX_SCENE3D_DEBUG__&&(t.__mvxScene3DStats=function(){return e.getDebugStats()})}},{key:"uninstallDebugStatsHook",value:function(){var e=globalThis;e.__mvxScene3DStats&&delete e.__mvxScene3DStats}},{key:"dispose",value:function(){var e,t,r=null===(e=this.threeMod)||void 0===e?void 0:e.THREE;if(r){this.scene3DModelsGroup&&(ML(r,this.scene3DModelsGroup),this.scene3DModelsGroup=void 0);var i,n=jL(this.scene3DGlbRootByUrl.values());try{for(n.s();!(i=n.n()).done;)FL(r,i.value)}catch(e){n.e(e)}finally{n.f()}}this.scene3DGlbRootByUrl.clear(),this.scene3DGlbTemplateById.clear(),this.scene3DGlbScene=void 0,null===(t=this.glbRenderer)||void 0===t||t.dispose(),this.glbRenderer=void 0,this.uninstallDebugStatsHook()}},{key:"ensure3DLibs",value:(i=qL(VL().m(function e(){var t,r;return VL().w(function(e){for(;;)switch(e.n){case 0:if(null===(t=this.threeMod)||void 0===t){e.n=1;break}e.n=3;break;case 1:return e.n=2,pL();case 2:this.threeMod=e.v;case 3:if(null===(r=this.deckMod)||void 0===r){e.n=4;break}e.n=6;break;case 4:return e.n=5,mL();case 5:this.deckMod=e.v;case 6:return e.a(2)}},e,this)})),function(){return i.apply(this,arguments)})},{key:"createGlbCustomLayer",value:function(){var e=this,t=this.threeMod.THREE,r=Dy.fromLngLat(this.initialCenter,0),i=r.meterInMercatorCoordinateUnits(),n=(new t.Matrix4).makeTranslation(r.x,r.y,r.z).scale(new t.Vector3(i,-i,i)).multiply((new t.Matrix4).makeRotationX(Math.PI/2));this.scene3DGlbScene=new t.Scene;var a=this.scene3DConfig.models;if(a&&!1!==a.enabled&&a.assets.length>0){var o=function(e){return e.lights&&e.lights.length>0?function(e){if(Array.isArray(e))return YR(e)}(t=e.lights)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return YR(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?YR(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}():[].concat(rL);var t}(a);this.scene3DGlbLightCount=function(e,t,r){var i,n=0,a=DL(r);try{for(a.s();!(i=a.n()).done;){var o=i.value;if("ambient"!==o.type){var s=new e.DirectionalLight(o.color,o.intensity);s.position.set(o.position.x,o.position.y,o.position.z),t.add(s),n++}else t.add(new e.AmbientLight(o.color,o.intensity)),n++}}catch(e){a.e(e)}finally{a.f()}return n}(t,this.scene3DGlbScene,o)}else this.scene3DGlbLightCount=0;this.glbTemplatesLoadInFlight=!0,this.loadScene3DGlbTemplates().then(function(){e.placeScene3DModels()}).catch(function(e){console.error("Failed to initialize declarative GLB models",e)}).finally(function(){e.glbTemplatesLoadInFlight=!1,e.updateLodForZoom()});var s=void 0,l=void 0,u=new t.Matrix4;return{id:"3d-glb-models",type:"custom",renderingMode:"3d",onAdd:function(r,i){l=new t.Camera,(s=new t.WebGLRenderer({canvas:r.getCanvas(),context:i,antialias:!0})).autoClear=!1,s.setSize=function(e,t){this.setViewport(0,0,e,t)},e.glbRenderer=s},onRemove:function(){e.dispose()},render:function(t,r){var i;if(l&&s&&e.scene3DGlbScene&&e.scene3DModelsGroup&&0!==e.scene3DModelsGroup.children.length){var a=e.map.getCanvas(),o=a.width,c=a.height;if(0!==o&&0!==c){var h=null===(i=r.defaultProjectionData)||void 0===i?void 0:i.mainMatrix;h&&(s.setSize(o,c),u.fromArray(h).multiply(n),l.projectionMatrix.copy(u),s.resetState(),s.render(e.scene3DGlbScene,l))}}}}}},{key:"loadScene3DGlbTemplates",value:(r=qL(VL().m(function t(){var r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_,v=this;return VL().w(function(t){for(;;)switch(t.p=t.n){case 0:if(i=null===(r=this.threeMod)||void 0===r?void 0:r.THREE,n=this.scene3DConfig.models,i&&n&&!1!==n.enabled&&0!==n.assets.length){t.n=1;break}return t.a(2);case 1:return this.scene3DGlbRootByUrl.clear(),this.scene3DGlbTemplateById.clear(),a=BL(new Set(n.assets.map(function(e){return e.url}))),o=new globalThis.Map,s=new qk(e.GLB_LOAD_CONCURRENCY),l=new globalThis.Map,u=new globalThis.Map,c=0,h=a.length,d=function(e){if(v.onModelsProgress){var t,r=0,i=0,n=jL(a);try{for(n.s();!(t=n.n()).done;){var o,s=t.value;r+=null!==(o=l.get(s))&&void 0!==o?o:0;var d=u.get(s);i=null==d||null===i?null:i+d}}catch(e){n.e(e)}finally{n.f()}try{v.onModelsProgress({loadedAssets:c,totalAssets:h,loadedBytes:r,totalBytes:i,done:e})}catch(e){console.error("onScene3DModelsProgress callback threw",e)}}},t.n=2,Promise.all(a.map(function(){var e=qL(VL().m(function e(t){var r,i,n,a,h;return VL().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.n=1,s.acquire();case 1:return e.p=1,n=v.scene3DGlbRootByUrl,a=t,e.n=2,PL(t,{onProgress:function(e){l.set(t,e.loaded),u.set(t,e.lengthComputable?e.total:null),d(!1)}});case 2:n.set.call(n,a,e.v),e.n=4;break;case 3:e.p=3,h=e.v,o.set(t,h);case 4:return e.p=4,c++,u.set(t,null!==(r=null!==(i=u.get(t))&&void 0!==i?i:l.get(t))&&void 0!==r?r:0),s.release(),d(!1),e.f(4);case 5:return e.a(2)}},e,null,[[1,3,4,5]])}));return function(t){return e.apply(this,arguments)}}()));case 2:d(!0),p=jL(n.assets),t.p=3,p.s();case 4:if((f=p.n()).done){t.n=7;break}if(m=f.value,g=this.scene3DGlbRootByUrl.get(m.url)){t.n=5;break}return console.error('Failed to load GLB asset "'.concat(m.id,'" from ').concat(m.url),o.get(m.url)),t.a(3,6);case 5:y=IL(i,g),this.scene3DGlbTemplateById.set(m.id,{root:g,center:y});case 6:t.n=4;break;case 7:t.n=9;break;case 8:t.p=8,_=t.v,p.e(_);case 9:return t.p=9,p.f(),t.f(9);case 10:return t.a(2)}},t,this,[[3,8,9,10]])})),function(){return r.apply(this,arguments)})},{key:"placeScene3DModels",value:function(){var e,t,r,i,n,a,o,s=this,l=null===(e=this.threeMod)||void 0===e?void 0:e.THREE;if(l&&this.scene3DGlbScene){var u=this.scene3DConfig.models;if(u&&!1!==u.enabled&&(this.scene3DModelsGroup&&(ML(l,this.scene3DModelsGroup),this.scene3DGlbScene.remove(this.scene3DModelsGroup),this.scene3DModelsGroup=void 0),0!==this.scene3DGlbTemplateById.size)){var c=Dy.fromLngLat(this.initialCenter,0),h=c.meterInMercatorCoordinateUnits(),d=this.currentFloor,p=new l.Group;p.position.set(null!==(t=null===(r=u.globalOffset)||void 0===r?void 0:r.x)&&void 0!==t?t:0,null!==(i=null===(n=u.globalOffset)||void 0===n?void 0:n.y)&&void 0!==i?i:0,null!==(a=null===(o=u.globalOffset)||void 0===o?void 0:o.z)&&void 0!==a?a:0);var f,m=jL(u.placements);try{var g=function(){var e,t=f.value;if(!function(e,t){return"allFloors"===e.visibility.mode||e.visibility.floorKey===t}(t,d))return 0;var r=s.scene3DGlbTemplateById.get(t.assetId);if(!r)return 0;var i=u.assets.find(function(e){return e.id===t.assetId});if(!i)return 0;var n=function(e,t,r,i,n){var a,o,s,l,u,c,h=(e.x-t.x)/r,d=(e.y-t.y)/r,p=null!==(a=null==i?void 0:i.x)&&void 0!==a?a:0,f=null!==(o=null==i?void 0:i.y)&&void 0!==o?o:0,m=null!==(s=null==i?void 0:i.z)&&void 0!==s?s:0;return[h+p+(null!==(l=null==n?void 0:n.x)&&void 0!==l?l:0),f+(null!==(u=null==n?void 0:n.y)&&void 0!==u?u:0),d+m+(null!==(c=null==n?void 0:n.z)&&void 0!==c?c:0)]}(Dy.fromLngLat([t.position.lng,t.position.lat],null!==(e=t.position.altitude)&&void 0!==e?e:0),c,h,i.defaultModelOffset,t.offset),a=OL(n,3),o=a[0],m=a[1],g=a[2],y=new l.Group;y.position.set(o,m,g);var _,v,b,x,w,S,T,P,E=(_=i.defaultRotation,v=t.rotation,{yaw:(null!==(b=null==_?void 0:_.yaw)&&void 0!==b?b:0)+(null!==(x=null==v?void 0:v.yaw)&&void 0!==x?x:0),pitch:(null!==(w=null==_?void 0:_.pitch)&&void 0!==w?w:0)+(null!==(S=null==v?void 0:v.pitch)&&void 0!==S?S:0),roll:(null!==(T=null==_?void 0:_.roll)&&void 0!==T?T:0)+(null!==(P=null==v?void 0:v.roll)&&void 0!==P?P:0)});y.rotation.set(l.MathUtils.degToRad(E.pitch),l.MathUtils.degToRad(-E.yaw),l.MathUtils.degToRad(E.roll),"YXZ");var D,A,I,C=OL((D=i.defaultScale,A=t.scale,I=nL(D,1),void 0===A?I:nL(A,1)),3),k=C[0],M=C[1],F=C[2];y.scale.set(k,M,F);var R=r.root.clone(!0);R.traverse(function(e){var t=e;t.isMesh&&(t.material=Array.isArray(t.material)?t.material.map(function(e){return e.clone()}):t.material.clone())}),R.position.set(-r.center.x,-r.center.y,-r.center.z),y.userData.zoomTransparency=function(e,t,r){var i,n;return null!==(i=null!==(n=r.zoomTransparency)&&void 0!==n?n:null==t?void 0:t.zoomTransparency)&&void 0!==i?i:e.zoomTransparency}(u,i,t),y.userData.routeTransparency=function(e,t,r){var i,n;return null!==(i=null!==(n=r.routeTransparency)&&void 0!==n?n:null==t?void 0:t.routeTransparency)&&void 0!==i?i:e.routeTransparency}(u,i,t);var L=(new l.Box3).setFromObject(R);y.userData.footprint={minX:L.min.x,maxX:L.max.x,minZ:L.min.z,maxZ:L.max.z},y.add(R),p.add(y)};for(m.s();!(f=m.n()).done;)g()}catch(e){m.e(e)}finally{m.f()}this.scene3DModelsGroup=p,this.scene3DGlbScene.add(p),this.recomputeRouteAffectedModels(),this.applyModelOpacity(),this.map.triggerRepaint()}}}},{key:"recomputeRouteAffectedModels",value:function(){var e,t=this,r=null===(e=this.threeMod)||void 0===e?void 0:e.THREE,i=this.scene3DModelsGroup;if(r&&i){var n=this.scene3DRouteCollisionPoints.filter(function(e){return e.floorKey===t.currentFloor}),a=Dy.fromLngLat(this.initialCenter,0),o=a.meterInMercatorCoordinateUnits(),s=n.map(function(e){var t=Dy.fromLngLat([e.lng,e.lat],0),i=(t.x-a.x)/o,n=(t.y-a.y)/o;return new r.Vector3(i,0,n)});i.updateMatrixWorld(!0);var l,u=new r.Vector3,c=jL(i.children);try{var h=function(){var e=l.value,t=e.userData.routeTransparency,r=e.userData.footprint;if(!t||!r||0===s.length)return e.userData.routeAffected=!1,1;e.userData.routeAffected=s.some(function(t){return u.copy(t),i.localToWorld(u),e.worldToLocal(u),function(e,t,r){return t>=e.minX&&t<=e.maxX&&r>=e.minZ&&r<=e.maxZ}(r,u.x,u.z)})};for(c.s();!(l=c.n()).done;)h()}catch(e){c.e(e)}finally{c.f()}}}},{key:"applyModelOpacity",value:function(){if(this.scene3DModelsGroup){var e,t=this.map.getZoom(),r=!1,i=jL(this.scene3DModelsGroup.children);try{var n=function(){var i=e.value,n=i.userData.zoomTransparency,a=i.userData.routeTransparency,o=!0===i.userData.routeAffected,s=function(e,t,r,i){var n=function(e,t){return e&&t>=e.zoom?e.opacity:1}(e,r),a=i&&t?t.opacity:1;return Math.min(n,a)}(n,a,t,o);i.traverse(function(e){var t=e;if(t.isMesh){var i,n=jL(Array.isArray(t.material)?t.material:[t.material]);try{for(n.s();!(i=n.n()).done;){var a=i.value;a.opacity!==s&&(a.transparent=s<1,a.opacity=s,a.depthWrite=s>=1,r=!0)}}catch(e){n.e(e)}finally{n.f()}}})};for(i.s();!(e=i.n()).done;)n()}catch(e){i.e(e)}finally{i.f()}r&&this.map.triggerRepaint()}}},{key:"loadSpriteAtlas",value:(t=qL(VL().m(function e(t){var r,i,n,a;return VL().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Promise.all([fetch("".concat(t,".json")).then(function(e){return e.json()}),new Promise(function(e,r){var i=new Image;i.crossOrigin="anonymous",i.onload=function(){return e(i)},i.onerror=r,i.src="".concat(t,".png")})]);case 1:r=e.v,i=OL(r,2),n=i[0],a=i[1],this.spriteIconMapping=n,this.spriteAtlasImage=a;case 2:return e.a(2)}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"deckTileLayerProps",get:function(){var e=this.deckTileCache,t=e.maxCacheSize,r=e.maxRequests,i=e.refinementStrategy,n=e.maxCacheByteSize,a={maxCacheSize:t,maxRequests:r,refinementStrategy:i,loadOptions:{worker:this.useTileWorker}};return void 0!==n&&(a.maxCacheByteSize=n),a}},{key:"makeElevatedLinesLayer",value:function(e,t){var r,i=this.deckMod;return i?new i.MVTLayer(zL(zL({},this.deckTileLayerProps),{},{id:"indoor-lines-elevated",data:t.dataUrl,binary:null!==(r=t.binaryData)&&void 0!==r&&r,renderSubLayers:function(r){var n,a,o,s,l=function(e,t,r){var i,n=e.filter(function(e){var r,i,n;return"room"===(null===(r=e.properties)||void 0===r?void 0:r.class)&&"empty"!==(null===(i=e.properties)||void 0===i?void 0:i.subclass)&&(null===(n=e.properties)||void 0===n?void 0:n.floor_key)===t}),a=[],o=sL(n);try{var s=function(){var e,t,n,o=i.value,s=null!==(e=o.properties)&&void 0!==e&&e.height?Number(o.properties.height):r,l=sL("Polygon"===(n=o.geometry).type?[n.coordinates]:"MultiPolygon"===n.type?n.coordinates:[]);try{for(l.s();!(t=l.n()).done;){var u,c=sL(t.value);try{for(c.s();!(u=c.n()).done;){var h=u.value;a.push({path:h.map(function(e){var t=oL(e,2);return[t[0],t[1],s]})})}}catch(e){c.e(e)}finally{c.f()}}}catch(e){l.e(e)}finally{l.f()}};for(o.s();!(i=o.n()).done;)s()}catch(e){o.e(e)}finally{o.f()}return a}(r.data||[],e,null!==(n=t.defaultHeight)&&void 0!==n?n:5);return l.length?new i.PathLayer(zL(zL({},r),{},{id:"".concat(r.id,"-paths"),data:l,getPath:function(e){return e.path},getColor:iL(null!==(a=t.lineColor)&&void 0!==a?a:"#cbcbcb"),getWidth:null!==(o=t.lineWidth)&&void 0!==o?o:1.5,widthUnits:null!==(s=t.widthUnits)&&void 0!==s?s:"pixels",pickable:!1})):null},updateTriggers:{renderSubLayers:[e]}})):null}},{key:"makeLabelLayer",value:function(e,t){var r,i,n,a=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=this.deckMod;return s?new s.MVTLayer(zL(zL({},this.deckTileLayerProps),{},{id:"indoor-labels",data:t.dataUrl,binary:null!==(r=t.binaryData)&&void 0!==r&&r,minZoom:null!==(i=t.minZoom)&&void 0!==i?i:19.5,maxZoom:null!==(n=t.maxZoom)&&void 0!==n?n:24,renderSubLayers:function(r){var i,n,l,u,c,h,d=function(e,t,r,i){return e.filter(function(e){var r,i,n,o,s,l;if("area_name"!==(null===(r=e.properties)||void 0===r?void 0:r.layerName)&&"poi"!==(null===(i=e.properties)||void 0===i?void 0:i.layerName))return!1;if("Point"!==(null===(n=e.geometry)||void 0===n?void 0:n.type))return!1;var u,c=(null===(o=e.properties)||void 0===o?void 0:o["name:latin"])||(null===(s=e.properties)||void 0===s?void 0:s.name);return!(!c||null!==(l=e.properties)&&void 0!==l&&l.floor_key&&e.properties.floor_key!==t||(u="logo-"+c,a.map.hasImage(u)))}).map(function(e){var t,r,n;return{position:[].concat(aL(e.geometry.coordinates.slice(0,2)),[null!==(t=e.properties)&&void 0!==t&&t.height?Number(e.properties.height):i]),text:(null===(r=e.properties)||void 0===r?void 0:r["name:latin"])||(null===(n=e.properties)||void 0===n?void 0:n.name)||""}})}(r.data||[],e,0,null!==(i=t.defaultHeight)&&void 0!==i?i:5);return d.length?new s.TextLayer(zL(zL({},r),{},{id:"".concat(r.id,"-labels"),data:d,getPosition:function(e){return e.position},getText:function(e){return e.text},getSize:null!==(n=t.size)&&void 0!==n?n:16,getColor:iL(null!==(l=t.color)&&void 0!==l?l:"#91969b"),outlineColor:o?[255,255,255,255]:[0,0,0,0],outlineWidth:o?4:0,fontSettings:{sdf:o},fontFamily:null!==(u=t.fontFamily)&&void 0!==u?u:"Open Sans, sans-serif",fontWeight:null!==(c=t.fontWeight)&&void 0!==c?c:600,billboard:!0,pickable:!1,characterSet:"auto",wordBreak:"break-word",maxWidth:null!==(h=t.maxWidth)&&void 0!==h?h:150})):null},updateTriggers:{renderSubLayers:[e]}})):null}},{key:"makePoiIconLayer",value:function(e,t){var r,i,n,a=this,o=this.deckMod;return o&&this.spriteIconMapping&&this.spriteAtlasImage?new o.MVTLayer(zL(zL({},this.deckTileLayerProps),{},{id:"indoor-poi-icons",data:t.dataUrl,binary:null!==(r=t.binaryData)&&void 0!==r&&r,minZoom:null!==(i=t.minZoom)&&void 0!==i?i:17,maxZoom:null!==(n=t.maxZoom)&&void 0!==n?n:24,renderSubLayers:function(r){var i,n,s,l,u,c=function(e,t,r){return e.filter(function(e){var r,i,n;if("Point"!==(null===(r=e.geometry)||void 0===r?void 0:r.type))return!1;if(null!==(i=e.properties)&&void 0!==i&&i.floor_key&&e.properties.floor_key!==t)return!1;var a=null===(n=e.properties)||void 0===n?void 0:n.subclass;return"elevator"===a||"toilets"===a}).map(function(e){var t,i,n,a,o;return{position:[].concat(aL(e.geometry.coordinates.slice(0,2)),[null!==(t=e.properties)&&void 0!==t&&t.height?Number(e.properties.height):r]),icon:(a=(null===(i=e.properties)||void 0===i?void 0:i.tags)||"",o=(null===(n=e.properties)||void 0===n?void 0:n.subclass)||"",a.includes("wheelchair")?"accessible_toilets":a.includes("changing_table")?"changing_table":o)}})}(r.data||[],e,null!==(i=t.defaultHeight)&&void 0!==i?i:5);return c.length?new o.IconLayer(zL(zL({},r),{},{id:"".concat(r.id,"-poi-icons"),data:c,iconAtlas:a.spriteAtlasImage,iconMapping:a.spriteIconMapping,getIcon:function(e){return e.icon},getPosition:function(e){return e.position},getSize:null!==(n=t.size)&&void 0!==n?n:2,sizeUnits:null!==(s=t.sizeUnits)&&void 0!==s?s:"meters",sizeScale:null!==(l=t.sizeScale)&&void 0!==l?l:1,billboard:null===(u=t.billboard)||void 0===u||u,pickable:!1})):null},updateTriggers:{renderSubLayers:[e]}})):null}},{key:"makeStoreLogoLayer",value:function(e,t){var r,i,n,a=this,o=this.deckMod;return o&&this.spriteIconMapping&&this.spriteAtlasImage?new o.MVTLayer(zL(zL({},this.deckTileLayerProps),{},{id:"indoor-store-logos",data:t.dataUrl,binary:null!==(r=t.binaryData)&&void 0!==r&&r,minZoom:null!==(i=t.minZoom)&&void 0!==i?i:13,maxZoom:null!==(n=t.maxZoom)&&void 0!==n?n:24,renderSubLayers:function(r){var i,n,s,l,u=function(e,t,r,i){return e.filter(function(e){var i,n,a;if("Point"!==(null===(i=e.geometry)||void 0===i?void 0:i.type))return!1;if(null!==(n=e.properties)&&void 0!==n&&n.floor_key&&e.properties.floor_key!==t)return!1;var o=null===(a=e.properties)||void 0===a?void 0:a.name;return!!o&&!!r["logo-"+o]}).map(function(e){var t,r,n,a=null===(t=e.properties)||void 0===t?void 0:t.name;return{position:[].concat(aL(e.geometry.coordinates.slice(0,2)),[null!==(r=e.properties)&&void 0!==r&&r.height?Number(e.properties.height):i]),icon:"logo-"+a,rotation:null!==(n=e.properties)&&void 0!==n&&n.rotation_icon?Number(e.properties.rotation_icon):0}})}(r.data||[],e,a.spriteIconMapping,null!==(i=t.defaultHeight)&&void 0!==i?i:5);return u.length?new o.IconLayer(zL(zL({},r),{},{id:"".concat(r.id,"-store-logos"),data:u,iconAtlas:a.spriteAtlasImage,iconMapping:a.spriteIconMapping,getIcon:function(e){return e.icon},getPosition:function(e){return e.position},getAngle:function(e){return-e.rotation},getSize:function(e){var r;return function(e,t,r){var i=e[t];if(!i)return 10;var n=i.pixelRatio,a=i.width/n,o=i.height/n;return o/Math.max(a,o)*10*(r[t]||1)}(a.spriteIconMapping,e.icon,null!==(r=t.logoScale)&&void 0!==r?r:{})},sizeUnits:null!==(n=t.sizeUnits)&&void 0!==n?n:"meters",sizeScale:null!==(s=t.sizeScale)&&void 0!==s?s:1,billboard:null!==(l=t.billboard)&&void 0!==l&&l,pickable:!1})):null},updateTriggers:{renderSubLayers:[e]}})):null}},{key:"updateDeckOverlay",value:function(){if(this.deckOverlay&&this.currentFloor&&this.scene3DConfig.customLayers){var e=this.scene3DConfig.customLayers,t=[];if(e.elevatedLinesLayer&&t.push(this.makeElevatedLinesLayer(this.currentFloor,e.elevatedLinesLayer)),e.labelsLayer&&t.push(this.makeLabelLayer(this.currentFloor,e.labelsLayer,!1)),e.iconLayers){var r=e.iconLayers,i=r.storeLogosLayer,n=r.poiIconsLayer;i&&t.push(this.makeStoreLogoLayer(this.currentFloor,i)),n&&t.push(this.makePoiIconLayer(this.currentFloor,n))}this.deckOverlay.setProps({layers:t})}}},{key:"hideLayers",value:function(e){if(e){var t,r=jL(e);try{for(r.s();!(t=r.n()).done;){var i=t.value,n=this.map.getLayer(i);n&&this.map.setLayoutProperty(n.id,"visibility","none")}}catch(e){r.e(e)}finally{r.f()}}}}]);var t,r,i,n,a}();function KL(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return YL(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?YL(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function YL(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}WL(XL,"GLB_LOAD_CONCURRENCY",4);var JL=function(e,t,r){return Math.min(Math.max(e,t),r)};function QL(e){return QL="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},QL(e)}function ez(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function tz(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ez(Object(r),!0).forEach(function(t){iz(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ez(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function rz(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,nz(i.key),i)}}function iz(e,t,r){return(t=nz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nz(e){var t=function(e){if("object"!=QL(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=QL(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==QL(t)?t:t+""}var az=Math.PI/180,oz=function(){return function(e,t){return t&&rz(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(function e(t){var r,i,n,a,o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),iz(this,"dirty",!1),iz(this,"moved",!1),iz(this,"setCenter",function(e){o.pending.center=e,o.dirty=!0}),iz(this,"setZoom",function(e){o.pending.zoom=e,o.dirty=!0}),iz(this,"setBearing",function(e){o.pending.bearing=e,o.dirty=!0}),iz(this,"setPitch",function(e){o.pending.pitch=e,o.dirty=!0}),iz(this,"setPadding",function(e){o.pending.padding=e,o.dirty=!0}),iz(this,"locationToScreenPoint",function(e){return o.sync(),o.map.project(e)}),iz(this,"screenPointToLocation",function(e){return o.sync(),o.map.unproject(e)}),iz(this,"isPointOnMapSurface",function(e){o.sync();var t=o.map.getPitch()*az;if(t<=0)return!0;var r=o.map.getCanvas().clientHeight;if(!r)return!0;var i=o.map.getVerticalFieldOfView()*az,n=r/2/Math.tan(i/2),a=o.pending.padding,s=r/2+(a.top-a.bottom)/2-n/Math.tan(t);return e.y>s}),iz(this,"restore",function(){o.moved&&(o.map.jumpTo({center:o.snapshot.center,zoom:o.snapshot.zoom,bearing:o.snapshot.bearing,pitch:o.snapshot.pitch,padding:o.snapshot.padding}),o.pending=tz({},o.snapshot),o.dirty=!1,o.moved=!1)}),this.map=t;var s=t.getPadding();this.snapshot={center:t.getCenter(),zoom:t.getZoom(),bearing:t.getBearing(),pitch:t.getPitch(),padding:{top:null!==(r=s.top)&&void 0!==r?r:0,bottom:null!==(i=s.bottom)&&void 0!==i?i:0,left:null!==(n=s.left)&&void 0!==n?n:0,right:null!==(a=s.right)&&void 0!==a?a:0}},this.pending=tz({},this.snapshot)},[{key:"center",get:function(){return this.pending.center}},{key:"zoom",get:function(){return this.pending.zoom}},{key:"sync",value:function(){this.dirty&&(this.map.jumpTo({center:this.pending.center,zoom:this.pending.zoom,bearing:this.pending.bearing,pitch:this.pending.pitch,padding:this.pending.padding}),this.dirty=!1,this.moved=!0)}}])}();function sz(e){return sz="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sz(e)}function lz(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var l=i&&i.prototype instanceof s?i:s,u=Object.create(l.prototype);return uz(u,"_invoke",function(r,i,n){var a,s,l,u=0,c=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,s=0,l=e,d.n=r,o}};function p(r,i){for(s=r,l=i,t=0;!h&&u&&!n&&t<c.length;t++){var n,a=c[t],p=d.p,f=a[2];r>3?(n=f===i)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((n=r<2&&p<a[1])?(s=0,d.v=i,d.n=a[1]):p<f&&(n=r<3||a[0]>i||i>f)&&(a[4]=r,a[5]=i,d.n=f,s=0))}if(n||r>1)return o;throw h=!0,i}return function(n,c,f){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,f),s=c,l=f;(t=s<2?e:l)||!h;){a||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(u=2,a){if(s||(n="next"),t=a[n]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);a=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==o)break}catch(t){a=e,s=1,l=t}finally{u=1}}return{value:t,done:h}}}(r,n,a),!0),u}var o={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):(uz(t={},i,function(){return this}),t),h=u.prototype=s.prototype=Object.create(c);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,uz(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,uz(h,"constructor",u),uz(u,"constructor",l),l.displayName="GeneratorFunction",uz(u,n,"GeneratorFunction"),uz(h),uz(h,n,"Generator"),uz(h,i,function(){return this}),uz(h,"toString",function(){return"[object Generator]"}),(lz=function(){return{w:a,m:d}})()}function uz(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}uz=function(e,t,r,i){function a(t,r){uz(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},uz(e,t,r,i)}function cz(e,t,r,i,n,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function hz(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(e){cz(a,i,n,o,s,"next",e)}function s(e){cz(a,i,n,o,s,"throw",e)}o(void 0)})}}function dz(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||mz(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pz(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=mz(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function fz(e){return function(e){if(Array.isArray(e))return gz(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||mz(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mz(e,t){if(e){if("string"==typeof e)return gz(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gz(e,t):void 0}}function gz(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function yz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function _z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yz(Object(r),!0).forEach(function(t){Sz(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yz(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function vz(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Tz(i.key),i)}}function bz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(bz=function(){return!!e})()}function xz(e){return xz=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},xz(e)}function wz(e,t){return wz=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},wz(e,t)}function Sz(e,t,r){return(t=Tz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tz(e){var t=function(e){if("object"!=sz(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=sz(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==sz(t)?t:t+""}var Pz="mapvx-circles",Ez="mapvx-circles-fill",Dz="mapvx-circles-line",Az={aboveBasemap:"",belowLabels:"-below-labels",top:"-top"};function Iz(e){var t=Az[e];return{fill:Ez+t,line:Dz+t}}var Cz=!1;function kz(e){return null==e?e:"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e))}function Mz(e){if(!Cz){var t=new qk(e);js.REGISTERED_PROTOCOLS["cached-tile"]=function(e,r){var i=e.url.replace("cached-tile://","https://");return t.acquire(r.signal).then(function(){return fetch(i,{signal:r.signal}).then(function(e){if(!e.ok)throw new Error("HTTP error! status: ".concat(e.status));return e.arrayBuffer()}).then(function(e){return{data:e}}).finally(function(){t.release()})})},Cz=!0}}function Fz(e,t){if(void 0===e)return 0;if("number"==typeof e)return e;var r=e.match(/^(-?\d*\.?\d+)(px|%|vh|vw)?$/);if(!r)return 0;var i=Number.parseFloat(r[1]);switch(r[2]||"px"){case"px":default:return i;case"%":return i/100*t;case"vh":return i/100*window.innerHeight;case"vw":return i/100*window.innerWidth}}function Rz(e,t,r){return e?{top:Fz(e.top,r),bottom:Fz(e.bottom,r),left:Fz(e.left,t),right:Fz(e.right,t)}:{top:0,bottom:0,left:0,right:0}}var Lz=function(e){function t(e,r,i){var n,a,o,s,l;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Sz(s=function(e,t,r){return t=xz(t),function(e,t){if(t&&("object"==sz(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,bz()?Reflect.construct(t,r||[],xz(e).constructor):t.apply(e,r))}(this,t),"liveRouteTicket",0),Sz(s,"potentialParentPlaces",[]),Sz(s,"innerFloors",[]),Sz(s,"subPlaces",[]),Sz(s,"currentFloor",""),Sz(s,"baseFilters",{}),Sz(s,"capturedBaseFilters",new Set),Sz(s,"styleSwapGeneration",0),Sz(s,"markers",[]),Sz(s,"circles",[]),Sz(s,"enableHover",!1),Sz(s,"hoveredId","unselected"),Sz(s,"failedTiles",new Set),Sz(s,"tileRetryState",new WeakMap),Sz(s,"geoLocation",navigator.geolocation),Sz(s,"floorSettleToken",0),Sz(s,"floorSettleDeadline",null),Sz(s,"scene3D",void 0),s.repository=new KR(i,null!==(n=e.lang)&&void 0!==n?n:"en",e.apiUrl,void 0,e.mapvxRequestContext,{routeApiUrl:e.routeApiUrl,healthApiUrl:e.healthApiUrl,legacyApiUrl:e.legacyApiUrl,portalApiUrl:e.portalApiUrl}),s.token=i,s.authToken=e.authToken,s.currentLang=null!==(a=e.lang)&&void 0!==a?a:"en",s.parentPlaceId=e.parentPlaceId,s.routeController=new rF(s),s.userLocationMarker=void 0,s.watchPositionID=void 0,s.onFloorChange=e.onFloorChange,s.onParentPlaceChange=e.onParentPlaceChange,s.mode=null!==(o=e.mode)&&void 0!==o?o:"2D",s.styleRef=e.styleRef,s.styleTheme=e.styleTheme,s.scene3DConfig=e.scene3D,s.initialCenter=e.center,s.tileCacheConfig=((l=_z(_z({},OF),e.tileCache)).maxTiles=Math.min(l.maxTiles,BF),l),s.markerLayoutConfig=_z(_z({},jF),e.markerLayout),s.markerLayoutController=new TM(s,s.markerLayoutConfig),s.markerLayoutController.applyLayoutVariables(r),null!=e.parentPlaceId&&s.initialPlaceDetailSetUp(e.parentPlaceId,e.authToken),e.otherPotentialParentPlacesIds&&e.otherPotentialParentPlacesIds.length>0&&s.loadOtherPotentialParentPlaces(e.otherPotentialParentPlacesIds),s.enableHover=e.enableHover||!1,s.initialMapStyleSetUp(e,r),s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&wz(e,t)}(t,e),function(e,t){return t&&vz(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"floorSettlePending",get:function(){return null!=this.floorSettleDeadline&&this.now()<this.floorSettleDeadline}},{key:"now",value:function(){return"undefined"!=typeof performance?performance.now():Date.now()}},{key:"transformStyleForCaching",value:function(e){if(!e)return e;var t=kz(e);if(null!=t&&t.sources)for(var r=0,i=Object.keys(t.sources);r<i.length;r++){var n=i[r],a=t.sources[n];a.tiles&&Array.isArray(a.tiles)&&(a.tiles=a.tiles.map(function(e){return e.startsWith("https://")?e.replace("https://","cached-tile://"):e}))}return t}},{key:"initialPlaceDetailSetUp",value:function(e,t){var r=this;t?this.repository.fetchAndParseAnyPlaceDetail({id:e},t).then(function(e){r.changeParentPlaceTo(e),r.potentialParentPlaces.push(e)}).catch(console.error):this.repository.fetchAndParsePlaceDetail({id:e}).then(function(e){r.changeParentPlaceTo(e),r.potentialParentPlaces.push(e)}).catch(console.error)}},{key:"loadOtherPotentialParentPlaces",value:function(e){var t=this;Promise.all(e.map(function(e){return t.repository.fetchAndParsePlaceDetail({id:e})})).then(function(e){var r;(r=t.potentialParentPlaces).push.apply(r,fz(e))}).catch(console.error)}},{key:"subPlacesLoad",value:function(e){var t=this;this.repository.fetchAndParseSubPlaces(e).then(function(e){t.subPlaces=e}).catch(console.error)}},{key:"initialMapStyleSetUp",value:function(e,t){var r=this;e.institutionId&&e.authToken?this.repository.fetchAndParseAnyMapStyle(e.institutionId,e.authToken).then(function(i){return r.onMapStyleLoaded(e,t,i)}).catch(console.error):this.fetchVenueStyle(e.parentPlaceId,e.styleRef,e.styleTheme).then(function(i){return r.onMapStyleLoaded(e,t,i)}).catch(function(e){r.logError(e,{functionName:"initialMapStyleSetUp"})})}},{key:"onMapStyleLoaded",value:function(e,t,r){var i,n,a,o,s,l=this,u=this.tileCacheConfig.enabled&&this.tileCacheConfig.persistToServiceWorker;u&&Mz(this.tileCacheConfig.maxConcurrentTileFetches);var c,h,d=_z({container:t,style:u?this.transformStyleForCaching(r):r,center:e.center,zoom:e.zoom,pitch:null!==(i=e.pitch)&&void 0!==i?i:0,attributionControl:!1,maplibreLogo:!1,bearingSnap:null!==(n=e.bearingSnap)&&void 0!==n?n:0,cancelPendingTileRequestsWhileZooming:!0,maxTileCacheSize:this.tileCacheConfig.maxTiles},function(e){var t={};if(void 0!==e.bearing&&(t.bearing=e.bearing),void 0!==e.interactive&&(t.interactive=e.interactive),void 0!==e.dragPan&&(t.dragPan=e.dragPan),void 0!==e.scrollZoom&&(t.scrollZoom=e.scrollZoom),void 0!==e.doubleClickZoom&&(t.doubleClickZoom=e.doubleClickZoom),void 0!==e.touchZoomRotate&&(t.touchZoomRotate=e.touchZoomRotate),void 0!==e.keyboard&&(t.keyboard=e.keyboard),!1===e.rotateEnabled&&(t.dragRotate=!1,t.pitchWithRotate=!1),!1===e.pitchEnabled){var r,i=Math.min(Math.max(null!==(r=e.pitch)&&void 0!==r?r:0,0),180);t.touchPitch=!1,t.pitchWithRotate=!1,t.minPitch=i,t.maxPitch=i}return t}(e));if(e.maxZoom&&(d.maxZoom=e.maxZoom),e.minZoom&&(d.minZoom=e.minZoom),void 0!==e.pixelRatio&&(d.pixelRatio=e.pixelRatio),void 0!==e.fadeDuration&&(d.fadeDuration=e.fadeDuration),e.maxBounds&&e.maxBounds.length>1){var p=Xk(e.maxBounds);d.maxBounds=new zT([p[0].lng,p[0].lat],[p[1].lng,p[1].lat])}this.map=new wk(d),this.is3DSceneActive()&&this.scene3DConfig&&(this.scene3D=new XL(this.map,this.scene3DConfig,this.initialCenter,e.onScene3DModelsProgress)),function(e){return!1===e.rotateEnabled}(e)&&(null===(c=this.map.touchZoomRotate)||void 0===c||null===(h=c.disableRotation)||void 0===h||h.call(c)),this.map.addControl(new Tk({showCompass:null===(a=e.showCompass)||void 0===a||a,showZoom:null===(o=e.showZoom)||void 0===o||o}),null!==(s=e.navigationPosition)&&void 0!==s?s:"top-right"),this.map.on("load",function(){var t,i;null===(t=l.scene3D)||void 0===t||t.onMapLoad(),l.whenStyleUpdates(r),e.lang&&l.setLayersForLanguage(e.lang),null===(i=e.onMapReady)||void 0===i||i.call(e),l.onHover(),l.subscribeToFailedTiles(),l.markerLayoutController.attach()}),this.map.on("styledata",function(){l.circles.length>0&&l.ensureCircleLayers()}),this.map.on("zoom",function(){var e;null===(e=l.scene3D)||void 0===e||e.onZoom()}),this.map.on("zoomend",function(){var t;null===(t=e.onZoomEnd)||void 0===t||t.call(e,l.getZoomLevel())}),this.map.on("rotate",function(){var t;null===(t=e.onRotate)||void 0===t||t.call(e,l.map.getBearing())}),this.defaultClickListener()}},{key:"setBaseFilters",value:function(e){var t=this;if(e){var r=["==",["get","public_place"],!0];e.layers.filter(function(e){return e.id.startsWith("indoor-")}).forEach(function(e){var i=e.filter;t.captureDeclaredBaseFilter(e.id,i);var n=t.baseFilters[e.id];if(null!=n){var a=["all",n,r];t.map.setFilter(e.id,a)}else t.map.setFilter(e.id,r)})}}},{key:"captureDeclaredBaseFilter",value:function(e,t){if(!this.capturedBaseFilters.has(e)){this.capturedBaseFilters.add(e);var r=null!=t?t:this.safeGetFilter(e);null!=r&&(this.baseFilters[e]=r)}}},{key:"setLayersForLanguage",value:function(e){var t,r,i=this,n=["aerodrome_label","mountain_peak","park","place","poi","transportation_name","water_name","waterway"],a=null!==(t=null===(r=this.map.getStyle())||void 0===r?void 0:r.layers)&&void 0!==t?t:[];a.filter(function(e){var t;return"symbol"===e.type&&"openmaptiles"===e.source&&n.includes(null!==(t=e["source-layer"])&&void 0!==t?t:"")}).map(function(e){return e.id}).forEach(function(t){try{var r=i.map.getLayoutProperty(t,"symbol-placement");i.map.setLayoutProperty(t,"text-field",["case",["has","name:".concat(e)],["get","name:".concat(e)],["format",["get","name:latin"],"line"===r?" ":"\n",["get","name:nonlatin"]]])}catch(e){i.debugLog("Layer language update failed (layer may not exist)",e)}}),a.filter(function(e){var t;return"symbol"===e.type&&"indoorequal"===e.source&&void 0!==(null===(t=e.layout)||void 0===t?void 0:t["text-field"])}).map(function(e){return e.id}).forEach(function(t){try{i.map.setLayoutProperty(t,"text-field",["case",["has","name:".concat(e)],["get","name:".concat(e)],["get","name"]])}catch(e){i.debugLog("Layer language update failed (layer may not exist)",e)}})}},{key:"prepareSegmentation",value:function(e){var t;return _z(_z({},e),{},{token:this.token,parentPlaceId:null!==(t=this.parentPlaceId)&&void 0!==t?t:"None"})}},{key:"destroyMap",value:function(){var e;this.circles=[],this.markerLayoutController.destroy(),this.clearPendingStyleSwapListener(),this.styleReadyTimer&&(clearTimeout(this.styleReadyTimer),this.styleReadyTimer=void 0),this.floorSettleToken++,this.floorSettleDeadline=null,null===(e=this.scene3D)||void 0===e||e.dispose(),this.map.remove(),this.unsubscribeFromFailedTiles()}},{key:"clearTileCache",value:function(){try{this.failedTiles.clear(),this.map&&this.map.triggerRepaint(),this.logEvent("clearTileCache")}catch(e){this.debugLog("Tile cache clear failed (cache may not exist)",e)}}},{key:"is3DSceneActive",value:function(){var e;return"3D"===this.mode&&!1!==(null===(e=this.scene3DConfig)||void 0===e?void 0:e.enabled)}},{key:"getCurrentFloor",value:function(){var e;return null!==(e=this.currentFloor)&&void 0!==e?e:""}},{key:"setRouteCollisionPath",value:function(e){var t;this.is3DSceneActive()&&(null===(t=this.scene3D)||void 0===t||t.setRouteCollisionPath(e))}},{key:"changeParentPlaceTo",value:function(e){var t,r,i,n,a,o,s,l=this,u=arguments.length>1&&void 0!==arguments[1]&&arguments[1],c=arguments.length>2?arguments[2]:void 0;this.parentPlace=e,this.parentPlaceId=null==e?void 0:e.mapvxId,this.innerFloors=null!==(t=null==e||null===(r=e.innerFloors)||void 0===r?void 0:r.sort(function(e,t){return e.index-t.index}))&&void 0!==t?t:[],this.currentFloor=null!==(i=null!==(n=null===(a=this.innerFloors.find(function(e){return e.defaultFloor}))||void 0===a?void 0:a.key)&&void 0!==n?n:null===(o=this.innerFloors[0])||void 0===o?void 0:o.key)&&void 0!==i?i:"",e&&this.subPlacesLoad(e.mapvxId),null===(s=this.scene3D)||void 0===s||s.onFloorChange(this.currentFloor),u&&this.fetchVenueStyle(null==e?void 0:e.mapvxId,this.styleRef,this.styleTheme).then(function(e){var t=l.tileCacheConfig.enabled&&l.tileCacheConfig.persistToServiceWorker?l.transformStyleForCaching(e):e;l.map.setStyle(t),l.resetBaseFilters(),l.whenStyleUpdates(t),null==c||c()}).catch(function(e){l.logError(e,{functionName:"changeParentPlaceTo"}),null==c||c()})}},{key:"fetchVenueStyle",value:function(e,t,r){return this.authToken?this.repository.fetchAndParseMapStyleByBearer(e,this.authToken,t,r):this.repository.fetchAndParseMapStyle(e,t,r)}},{key:"updatePlaceAndFloor",value:function(e,t){var r,i,n,a,o,s,l=this.potentialParentPlaces.find(function(t){return t.mapvxId===e});this.parentPlace=l,this.parentPlaceId=null==l?void 0:l.mapvxId,this.innerFloors=null!==(r=null==l?void 0:l.innerFloors.sort(function(e,t){return e.index-t.index}))&&void 0!==r?r:[],this.currentFloor=null!==(i=null!==(n=null!=t?t:null===(a=this.innerFloors.find(function(e){return e.defaultFloor}))||void 0===a?void 0:a.key)&&void 0!==n?n:null===(o=this.innerFloors[0])||void 0===o?void 0:o.key)&&void 0!==i?i:"",null===(s=this.scene3D)||void 0===s||s.onFloorChange(this.currentFloor)}},{key:"updateParentPlaceAndFloor",value:function(e,t,r){try{var i,n,a,o;this.updatePlaceAndFloor(e,t),this.filterByFloorKey(this.currentFloor),null===(i=this.onParentPlaceChange)||void 0===i||i.call(this,e),null===(n=this.onFloorChange)||void 0===n||n.call(this,null!==(a=this.currentFloor)&&void 0!==a?a:""),this.logEvent("updateParentPlaceAndFloor"),null==r||null===(o=r.onComplete)||void 0===o||o.call(r)}catch(e){this.debugLog("Parent place/floor update failed",e)}}},{key:"setLang",value:function(e){var t=this;this.repository.setLang(e),this.currentLang=e,this.map.isStyleLoaded()?this.setLayersForLanguage(e):this.map.once("load",function(){return t.setLayersForLanguage(e)})}},{key:"setParentPlace",value:function(e,t,r){this.changeParentPlaceTo(e,t,r)}},{key:"setStyle",value:function(e,t,r){var i=this,n=++this.styleSwapGeneration,a=function(){return i.styleSwapGeneration===n},o=!1,s=function(e){o||(o=!0,a()&&i.styleReadyTimer&&(clearTimeout(i.styleReadyTimer),i.styleReadyTimer=void 0),null==r||r(e))};if(this.styleReadyTimer&&clearTimeout(this.styleReadyTimer),this.styleReadyTimer=setTimeout(s,4e3),this.clearPendingStyleSwapListener(),!this.map){var l=new Error("setStyle called before the map finished initializing; wait for the map's load event");return this.logError(l,{functionName:"setStyle"}),void s(l)}this.fetchVenueStyle(this.parentPlaceId,e,t).then(function(r){if(a()){i.styleRef=e,i.styleTheme=t;var n=i.tileCacheConfig.enabled&&i.tileCacheConfig.persistToServiceWorker?i.transformStyleForCaching(r):r;i.map.setStyle(n,{diff:!1}),i.resetBaseFilters();var o=function(){a()?i.hasLoadedStyle()&&(i.map.off("styledata",o),i.pendingStyleSwapListener===o&&(i.pendingStyleSwapListener=void 0),i.whenStyleUpdates(n),i.restoreStyleOverlays(),i.logEvent("setStyle")):i.map.off("styledata",o)};i.pendingStyleSwapListener=o,i.map.on("styledata",o),o(),i.map.once("idle",function(){a()&&(i.filterByFloorKey(i.currentFloor),s())})}}).catch(function(e){a()&&i.clearPendingStyleSwapListener(),i.logError(e,{functionName:"setStyle"}),s(e instanceof Error?e:new Error(String(e)))})}},{key:"resetBaseFilters",value:function(){this.baseFilters={},this.capturedBaseFilters.clear()}},{key:"restoreStyleOverlays",value:function(){var e=this,t=function(t,r){try{r()}catch(r){e.logError(r,{functionName:"restoreStyleOverlays",step:t})}};if(t("language",function(){return e.setLayersForLanguage(e.currentLang)}),this.coloredPlacesRequest){var r=this.coloredPlacesRequest,i=r.placeIds,n=r.color;t("coloredPlaces",function(){return e.setPlacesAsSelected(i,n)})}if(this.borderedPlacesRequest){var a=this.borderedPlacesRequest,o=a.placeIds,s=a.color,l=a.width;t("borderedPlaces",function(){return e.addBorderToPlaces(o,s,l)})}t("scene3D",function(){var t;return null===(t=e.scene3D)||void 0===t?void 0:t.reattachToStyle()})}},{key:"clearPendingStyleSwapListener",value:function(){var e;this.pendingStyleSwapListener&&(null===(e=this.map)||void 0===e||e.off("styledata",this.pendingStyleSwapListener),this.pendingStyleSwapListener=void 0)}},{key:"removeParentPlace",value:function(){this.changeParentPlaceTo(void 0,!0)}},{key:"whenStyleUpdates",value:function(e){var t;e&&this.setBaseFilters(e),this.routeController.addSourcesAndLayers(),this.refreshCircles(),this.filterByFloorKey(this.currentFloor),null===(t=this.scene3D)||void 0===t||t.refreshOverlay(this.currentFloor)}},{key:"getMarkers",value:function(){var e=this.routeController.getRouteMarkers();return this.userLocationMarker&&e.push(this.userLocationMarker),e.length>0?[].concat(fz(this.markers),fz(e)):this.markers}},{key:"addMarker",value:function(e){try{var t;if(e.id){var r=this.markers.findIndex(function(t){return t.id===e.id});-1!==r&&(this.markers[r].remove(),this.markers.splice(r,1),this.logEvent("removeMarker",{markerId:e.id,reason:"duplicate"}))}var i=new hM(_z(_z({},e),{},{maxLabelWidthPx:null!==(t=e.maxLabelWidthPx)&&void 0!==t?t:this.markerLayoutConfig.maxLabelWidthPx}));return this.floorSettlePending||i.changeFloor(this.currentFloor,this.map,this.isOutdoorFloor(this.currentFloor)),this.markers.push(i),this.markerLayoutController.scheduleRelayout(),this.logEvent("addMarker"),i.id}catch(e){throw new Error("Failed to add marker",{cause:e})}}},{key:"updateMarker",value:function(e){try{var t,r=this.markers.find(function(t){return t.id===e.id});return void 0!==r&&(r.updateIcon(e),this.markerLayoutController.invalidateMarker(r),this.markerLayoutController.scheduleRelayout()),this.logEvent("updateMarker"),null!==(t=null==r?void 0:r.id)&&void 0!==t?t:""}catch(e){throw new Error("Failed to update marker",{cause:e})}}},{key:"updateMarkerPosition",value:function(e,t){try{var r=this.markers.find(function(t){return t.id===e});void 0!==r&&(r.setLngLat(t),this.markerLayoutController.scheduleRelayout()),this.logEvent("updateMarkerPosition")}catch(e){throw new Error("Failed to update marker position",{cause:e})}}},{key:"showMarker",value:function(e){try{var t=this.markers.find(function(t){return t.id===e});null!==t&&this.map&&(null==t||t.show(this.map),this.markerLayoutController.scheduleRelayout()),this.logEvent("showMarker")}catch(e){this.debugLog("Show marker failed (marker may not exist)",e)}}},{key:"hideMarker",value:function(e){try{var t=this.markers.find(function(t){return t.id===e});null!==t&&(null==t||t.hide(),this.markerLayoutController.scheduleRelayout()),this.logEvent("hideMarker")}catch(e){this.debugLog("Hide marker failed (marker may not exist)",e)}}},{key:"removeMarker",value:function(e){try{var t=this.markers.find(function(t){return t.id===e});null!==t&&(null==t||t.remove(),this.markers=this.markers.filter(function(t){return t.id!==e}),this.markerLayoutController.scheduleRelayout()),this.logEvent("removeMarker")}catch(e){throw new Error("Failed to remove marker",{cause:e})}}},{key:"removeAllMarkers",value:function(){try{this.markers.forEach(function(e){e.remove()}),this.markers=[],this.markerLayoutController.scheduleRelayout(),this.logEvent("removeAllMarkers")}catch(e){throw new Error("Failed to remove all markers",{cause:e})}}},{key:"addCircle",value:function(e){try{e.id&&(this.circles=this.circles.filter(function(t){return t.id!==e.id}));var t=CF(e);return this.circles.push(t),this.refreshCircles(),this.logEvent("addCircle"),t.id}catch(e){throw new Error("Failed to add circle: ".concat(e instanceof Error?e.message:String(e)))}}},{key:"updateCircle",value:function(e){try{var t=this.circles.findIndex(function(t){return t.id===e.id});return-1===t?null:(this.circles[t]=CF(e,this.circles[t].hidden),this.refreshCircles(),this.logEvent("updateCircle"),this.circles[t].id)}catch(e){throw new Error("Failed to update circle: ".concat(e instanceof Error?e.message:String(e)))}}},{key:"getCircle",value:function(e){var t=this.circles.find(function(t){return t.id===e});return t?DF(t):void 0}},{key:"getCircles",value:function(){return this.circles.map(DF)}},{key:"hasCircle",value:function(e){return this.circles.some(function(t){return t.id===e})}},{key:"updateCirclePosition",value:function(e,t,r){try{var i=this.circles.find(function(t){return t.id===e});if(void 0===i)return!1;if(!t)throw new Error("Circle center is required");var n=t.lat,a=t.lng;if(!Number.isFinite(n)||n<-90||n>90)throw new Error("Invalid latitude: ".concat(n,". Must be between -90 and 90."));if(!Number.isFinite(a)||a<-180||a>180)throw new Error("Invalid longitude: ".concat(a,". Must be between -180 and 180."));if(void 0!==r&&(!Number.isFinite(r)||r<=0))throw new Error("Invalid radiusMeters: ".concat(r,". Must be a positive finite number."));return i.coordinate={lat:t.lat,lng:t.lng},void 0!==r&&(i.radiusMeters=r),this.refreshCircles(),this.logEvent("updateCirclePosition"),!0}catch(e){throw new Error("Failed to update circle position: ".concat(e instanceof Error?e.message:String(e)))}}},{key:"updateCircleStyle",value:function(e,t){try{var r=this.circles.find(function(t){return t.id===e});return void 0!==r&&(void 0!==t.fillColor&&(r.fillColor=t.fillColor),void 0!==t.fillOpacity&&(r.fillOpacity=Math.max(0,Math.min(1,t.fillOpacity))),void 0!==t.strokeColor&&(r.strokeColor=t.strokeColor),void 0!==t.strokeWidth&&(r.strokeWidth=t.strokeWidth),void 0!==t.strokeOpacity&&(r.strokeOpacity=Math.max(0,Math.min(1,t.strokeOpacity))),this.refreshCircles(),this.logEvent("updateCircleStyle"),!0)}catch(e){throw new Error("Failed to update circle style: ".concat(e instanceof Error?e.message:String(e)))}}},{key:"removeCircle",value:function(e){try{this.circles=this.circles.filter(function(t){return t.id!==e}),this.refreshCircles(),this.logEvent("removeCircle")}catch(e){throw new Error("Failed to remove circle",{cause:e})}}},{key:"removeAllCircles",value:function(){try{this.circles=[],this.refreshCircles(),this.logEvent("removeAllCircles")}catch(e){throw new Error("Failed to remove all circles",{cause:e})}}},{key:"showCircle",value:function(e){try{var t=this.circles.find(function(t){return t.id===e});return void 0!==t&&(t.hidden=!1,this.refreshCircles(),this.logEvent("showCircle"),!0)}catch(e){return this.debugLog("Show circle failed",e),!1}}},{key:"hideCircle",value:function(e){try{var t=this.circles.find(function(t){return t.id===e});return void 0!==t&&(t.hidden=!0,this.refreshCircles(),this.logEvent("hideCircle"),!0)}catch(e){return this.debugLog("Hide circle failed",e),!1}}},{key:"circleFeatureCollection",value:function(){var e,t=null!==(e=this.currentFloor)&&void 0!==e?e:"",r=this.isOutdoorFloor(t);return{type:"FeatureCollection",features:this.circles.filter(function(e){var i;if(e.hidden)return!1;var n=null!==(i=e.floorId)&&void 0!==i?i:"";return n===t||r&&""===n}).map(function(e){return{type:"Feature",properties:{id:e.id,fillColor:e.fillColor,fillOpacity:e.fillOpacity,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth,strokeOpacity:e.strokeOpacity,renderOrder:e.renderOrder},geometry:{type:"Polygon",coordinates:[kF(e.coordinate.lng,e.coordinate.lat,e.radiusMeters)]}}})}}},{key:"circleBeforeIdFor",value:function(e){var t,r,i;if("top"!==e){var n,a=(null!==(t=null===(r=this.map.getStyle())||void 0===r?void 0:r.layers)&&void 0!==t?t:[]).filter(function(e){return!function(e){return e.startsWith(Ez)||e.startsWith(Dz)}(e.id)});if("belowLabels"===e)return null===(n=a.find(function(e){return"symbol"===e.type}))||void 0===n?void 0:n.id;var o=-1;return a.forEach(function(e,t){"symbol"!==e.type&&(o=t)}),null===(i=a.slice(o+1).find(function(e){return"symbol"===e.type}))||void 0===i?void 0:i.id}}},{key:"ensureCircleLayers",value:function(){if(this.map)try{this.map.getSource(Pz)||this.map.addSource(Pz,{type:"geojson",data:this.circleFeatureCollection()});var e=new Set(this.circles.map(function(e){return e.renderOrder}));e.add("aboveBasemap");var t,r=pz(PF);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(e.has(i)){var n=Iz(i),a=this.circleBeforeIdFor(i),o=["==",["get","renderOrder"],i];if(this.map.getLayer(n.fill))this.map.moveLayer(n.fill,a);else{var s={id:n.fill,type:"fill",source:Pz,filter:o,paint:{"fill-color":["get","fillColor"],"fill-opacity":["get","fillOpacity"]}};this.map.addLayer(s,a)}if(this.map.getLayer(n.line))this.map.moveLayer(n.line,a);else{var l={id:n.line,type:"line",source:Pz,filter:o,paint:{"line-color":["get","strokeColor"],"line-width":["get","strokeWidth"],"line-opacity":["get","strokeOpacity"]}};this.map.addLayer(l,a)}}}}catch(e){r.e(e)}finally{r.f()}}catch(e){this.debugLog("Layers not added: style not loaded yet, the styledata listener will re-add them",e)}}},{key:"refreshCircles",value:function(){if(this.map&&(0!==this.circles.length||this.map.getSource(Pz))){this.ensureCircleLayers();try{var e=this.map.getSource(Pz);null==e||e.setData(this.circleFeatureCollection())}catch(e){this.debugLog("Source not found (a new style may still be loading)",e)}}}},{key:"filterByFloorKey",value:function(e){this.currentFloor=e;var t=null!=e?e:"";this.innerFloors.every(function(t){return t.key!==e})&&""!==e&&this.logEvent("invalidFloorKey",{floorKey:t});var r=this.safeStyleLayers();this.updateFiltersTo(t,r),this.updateMarkersWhenFloorSettles(t,r),this.refreshCircles(),this.routeController.updateRouteLayers(t),this.routeController.updateRouteMarkerVisibility(t)}},{key:"updateMarkersWhenFloorSettles",value:function(e,t){var r=this,i=++this.floorSettleToken,n=void 0===t?this.safeStyleLayers():t;if("function"!=typeof requestAnimationFrame||null===n)return this.floorSettleDeadline=null,void this.updateMarkersTo(e);var a=this.floorSettleSourceIds(e,n),o=this.now()+1e3;this.floorSettleDeadline=o;var s=!1,l=0,u=function(){if(i===r.floorSettleToken){l++;var t=a.every(function(e){return r.isSourceSettled(e)});if(t||(s=!0),t&&(s||l>=3)||r.now()>=o)return r.floorSettleDeadline=null,void r.updateMarkersTo(e);requestAnimationFrame(u)}};requestAnimationFrame(u)}},{key:"floorSettleSourceIds",value:function(e,t){var r=new Set,i=t.find(function(t){return t.id==="raster-floor-".concat(e)});return i&&"source"in i&&"string"==typeof i.source&&r.add(i.source),r.add(this.indoorSourceId(t)),fz(r)}},{key:"indoorSourceId",value:function(e){var t,r=pz(e);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(i.id.startsWith("indoor-")&&"source"in i&&"string"==typeof i.source)return i.source}}catch(e){r.e(e)}finally{r.f()}return"indoorequal"}},{key:"isSourceSettled",value:function(e){try{return!this.map.getSource(e)||!1!==this.map.isSourceLoaded(e)}catch(e){return!0}}},{key:"getContainer",value:function(){return this.map.getContainer()}},{key:"resize",value:function(){try{this.map&&(this.map.resize(),this.logEvent("resize"))}catch(e){this.debugLog("Resize failed (map/container may not be ready)",e)}}},{key:"updateMarkersTo",value:function(e){var t=this,r=this.isOutdoorFloor(e);this.markers.forEach(function(i){i.changeFloor(e,t.map,r)}),this.markerLayoutController.scheduleRelayout()}},{key:"updateFiltersTo",value:function(e,t){var r,i,n=this;if(this.map){var a=null!==(r=void 0===t?this.safeStyleLayers():t)&&void 0!==r?r:[],o="raster-floor-",s=a.filter(function(e){return e.id.startsWith(o)}).map(function(e){return e.id}),l=o+e;e&&s.includes(l)&&s.forEach(function(e){n.map.setLayoutProperty(e,"visibility",e===l?"visible":"none")}),a.filter(function(e){return e.id.startsWith("base-indoor-")}).forEach(function(e){n.map.removeLayer(e.id)});var u=null===(i=this.innerFloors.find(function(t){return t.key===e}))||void 0===i?void 0:i.baseFloor,c=a.filter(function(e){return e.id.startsWith("indoor-")});if(c.forEach(function(e){return n.captureDeclaredBaseFilter(e.id)}),null!=u){var h,d=null===(h=c[0])||void 0===h?void 0:h.id;c.filter(function(e){return"fill-extrusion"!==e.type}).forEach(function(e){var t=kz(e);t.id="base-"+e.id,n.baseFilters[t.id]=n.baseFilters[e.id],n.map.addLayer(t,d),n.applyLayerFilters(t,u)})}c.forEach(function(t){n.applyLayerFilters(t,e)})}}},{key:"safeGetFilter",value:function(e){try{return this.map.getFilter(e)}catch(e){return}}},{key:"applyLayerFilters",value:function(e,t){var r;e.id.startsWith("base-indoor-")||this.captureDeclaredBaseFilter(e.id);var i=this.baseFilters[e.id],n=null!=t?t:"",a=["any",["in",n,["get","floor_key"]]],o=["==",["get","public_place"],!0],s=["!",["in",null!==(r=this.parentPlaceId)&&void 0!==r?r:"noRef",["get","is_subplace"]]],l=["in",n,["get","show_in_floor"]],u=o;null!=this.parentPlaceId&&(u=["any",a,o]);var c=["all",u,["any",s,l]];if(e.id.includes("hover")?i=["in",this.hoveredId,["get","ref"]]:e.id.includes("colored")||"fill"!=e.type&&"fill-extrusion"!==e.type||c.push(["!",["in",this.hoveredId,["get","ref"]]]),this.capturedBaseFilters.add(e.id),null!=i){var h=["all",i,c];this.map.setFilter(e.id,h)}else this.map.setFilter(e.id,c)}},{key:"getInnerFloors",value:function(){return this.innerFloors}},{key:"isOutdoorFloor",value:function(e){var t,r;return!this.parentPlace||null!==(t=null===(r=this.innerFloors.find(function(t){return t.key===e}))||void 0===r?void 0:r.reachableFromGPS)&&void 0!==t&&t}},{key:"updateCamera",value:function(e,t){this.map.once("moveend",t),this.map.easeTo(_z({},e))}},{key:"setMaxZoom",value:function(e,t){var r;this.map.setMaxZoom(e),null==t||null===(r=t.onComplete)||void 0===r||r.call(t)}},{key:"setMinZoom",value:function(e,t){var r;this.map.setMinZoom(e),null==t||null===(r=t.onComplete)||void 0===r||r.call(t)}},{key:"setBearing",value:function(e,t){var r;if(Number.isFinite(e)){if(null!=t&&t.animate)return t.onComplete&&this.map.once("moveend",t.onComplete),void this.map.rotateTo(e,{duration:600});this.map.setBearing(e),null==t||null===(r=t.onComplete)||void 0===r||r.call(t)}}},{key:"setRotationEnabled",value:function(e){var t,r,i,n,a,o,s,l,u,c;e?(null===(t=this.map.dragRotate)||void 0===t||null===(r=t.enable)||void 0===r||r.call(t),null===(i=this.map.touchZoomRotate)||void 0===i||null===(n=i.enableRotation)||void 0===n||n.call(i),null===(a=this.map.keyboard)||void 0===a||null===(o=a.enable)||void 0===o||o.call(a)):(null===(s=this.map.dragRotate)||void 0===s||null===(l=s.disable)||void 0===l||l.call(s),null===(u=this.map.touchZoomRotate)||void 0===u||null===(c=u.disableRotation)||void 0===c||c.call(u))}},{key:"setPanEnabled",value:function(e){var t,r,i,n;e?null===(t=this.map.dragPan)||void 0===t||null===(r=t.enable)||void 0===r||r.call(t):null===(i=this.map.dragPan)||void 0===i||null===(n=i.disable)||void 0===n||n.call(i)}},{key:"setScrollZoomEnabled",value:function(e){var t,r,i,n;e?null===(t=this.map.scrollZoom)||void 0===t||null===(r=t.enable)||void 0===r||r.call(t):null===(i=this.map.scrollZoom)||void 0===i||null===(n=i.disable)||void 0===n||n.call(i)}},{key:"isInsideBounds",value:function(e){var t=this.map.getMaxBounds();return null==t||t.contains(e)}},{key:"setMaxBounds",value:function(e,t){var r;if(e.length>1){var i=Xk(e);this.map.setMaxBounds(new zT([i[0].lng,i[0].lat],[i[1].lng,i[1].lat]))}null==t||null===(r=t.onComplete)||void 0===r||r.call(t)}},{key:"fitCoordinates",value:function(e,t){if(0!==e.length){var r=null==t?void 0:t.onComplete;if(1===e.length){var i=dz(e,1)[0];r&&this.map.once("moveend",r),this.map.setCenter({lat:i.lat,lng:i.lng})}else{var n,a,o,s,l,u,c,h=pz(e);try{for(h.s();!(c=h.n()).done;){var d=c.value,p=d.lat,f=d.lng;o=void 0===o?p:Math.min(o,p),s=void 0===s?f:Math.min(s,f),l=void 0===l?p:Math.max(l,p),u=void 0===u?f:Math.max(u,f)}}catch(e){h.e(e)}finally{h.f()}var m=[null!=s?s:0,null!=o?o:0,null!=u?u:0,null!=l?l:0],g=this.map.getContainer(),y=g.clientWidth,_=g.clientHeight,v=Rz(null==t?void 0:t.padding,y,_),b=_z(_z({},t),{},{padding:v}),x=this.map.getBearing(),w=this.map.getPitch();null!==(n=b.bearing)&&void 0!==n||(b.bearing=x),null!==(a=b.pitch)&&void 0!==a||(b.pitch=w),r&&this.map.once("moveend",r),this.map.fitBounds(m,b)}}}},{key:"easeToCoordinates",value:function(e,t){var r,i,n;if(0!==e.length){var a=null==t?void 0:t.onComplete,o=this.map.getContainer(),s=o.clientWidth,l=o.clientHeight,u=Rz(null==t?void 0:t.padding,s,l);if(1===e.length){var c=dz(e,1)[0];return a&&this.map.once("moveend",a),void this.map.easeTo(_z(_z({},t),{},{center:{lat:c.lat,lng:c.lng},padding:u}))}var h=null!==(r=null==t?void 0:t.bearing)&&void 0!==r?r:this.map.getBearing(),d=null!==(i=null==t?void 0:t.pitch)&&void 0!==i?i:this.map.getPitch(),p={bearing:h,padding:u,containerWidth:s,containerHeight:l,maxZoom:null!==(n=null==t?void 0:t.maxZoom)&&void 0!==n?n:this.map.getMaxZoom(),minZoom:this.map.getMinZoom()},f=function(e,t){var r,i=t.padding,n=t.containerWidth,a=t.containerHeight,o=t.maxZoom,s=t.minZoom,l=-t.bearing*Math.PI/180,u=Math.cos(l),c=Math.sin(l),h=1/0,d=1/0,p=-1/0,f=-1/0,m=KL(e);try{for(m.s();!(r=m.n()).done;){var g=r.value,y=Dy.fromLngLat({lat:g.lat,lng:g.lng}),_=y.x*u-y.y*c,v=y.x*c+y.y*u;h=Math.min(h,_),d=Math.min(d,v),p=Math.max(p,_),f=Math.max(f,v)}}catch(e){m.e(e)}finally{m.f()}var b=p-h||Number.EPSILON,x=f-d||Number.EPSILON,w=Math.max(1,n-i.left-i.right),S=Math.max(1,a-i.top-i.bottom),T=Math.min(w/b,S/x),P=JL(Math.log2(T/512),s,o),E=(h+p)/2,D=(d+f)/2;return{center:new Dy(E*u+D*c,-E*c+D*u,0).toLngLat(),zoom:P}}(e,p);if(d>0){var m=new oz(this.map);try{f=function(e,t,r,i){var n=i.bearing,a=i.pitch,o=i.padding,s=i.containerWidth,l=i.containerHeight,u=i.maxZoom,c=i.minZoom;e.setBearing(n),e.setPitch(a),e.setPadding(o),e.setCenter(r.center),e.setZoom(r.zoom);for(var h=Math.max(1,s-o.left-o.right),d=Math.max(1,l-o.top-o.bottom),p={center:r.center,zoom:r.zoom},f=0;f<4;f++){var m,g=1/0,y=1/0,_=-1/0,v=-1/0,b=!0,x=KL(t);try{for(x.s();!(m=x.n()).done;){var w=m.value,S=e.locationToScreenPoint(new _y(w.lng,w.lat));if(!e.isPointOnMapSurface(S)){b=!1;break}g=Math.min(g,S.x),y=Math.min(y,S.y),_=Math.max(_,S.x),v=Math.max(v,S.y)}}catch(e){x.e(e)}finally{x.f()}if(!b)break;var T=new $a((g+_)/2,(y+v)/2);e.setCenter(e.screenPointToLocation(T));var P=Math.max(_-g,1e-6),E=Math.max(v-y,1e-6),D=Math.min(h/P,d/E),A=Math.log2(D);if(e.setZoom(JL(e.zoom+A,c,u)),p={center:e.center,zoom:e.zoom},Math.abs(A)<.01)break}return p}(m,e,f,_z(_z({},p),{},{pitch:d}))}finally{m.restore()}}a&&this.map.once("moveend",a),this.map.easeTo(_z(_z({},t),{},{center:f.center,zoom:f.zoom,bearing:h,pitch:d,padding:u}))}}},{key:"fitRouteByPlace",value:function(e,t,r){var i=e.steps.filter(function(e){return e.startInsidePlace===t||e.endInsidePlace===t});if(0!==i.length){var n=i.flatMap(function(e){return function(e){var t,r,i,n,a,o,s=[];null!==(t=e.startLocation)&&void 0!==t&&t.lat&&null!==(r=e.startLocation)&&void 0!==r&&r.lng&&s.push({lat:e.startLocation.lat,lng:e.startLocation.lng}),null!==(i=e.endLocation)&&void 0!==i&&i.lat&&null!==(n=e.endLocation)&&void 0!==n&&n.lng&&s.push({lat:e.endLocation.lat,lng:e.endLocation.lng});var l=null===(a=e.polyline)||void 0===a?void 0:a.overviewPoints;return Array.isArray(l)&&l.length>0?l.forEach(function(e){null!=e&&e.lat&&null!=e&&e.lng&&s.push({lat:e.lat,lng:e.lng})}):Array.isArray(null===(o=e.polyline)||void 0===o?void 0:o.pointsLatLng)&&e.polyline.pointsLatLng.length>0&&e.polyline.pointsLatLng.forEach(function(e){null!=e&&e.lat&&null!=e&&e.lng&&s.push({lat:e.lat,lng:e.lng})}),0===s.length&&e.coordinates?e.coordinates:s}(e)});n.length>0&&this.fitCoordinates(n,r)}}},{key:"getZoomLevel",value:function(){return this.map.getZoom()}},{key:"updateFloor",value:function(e,t){try{var r,i,n;this.filterByFloorKey(e),null===(r=this.scene3D)||void 0===r||r.onFloorChange(this.currentFloor),null===(i=this.onFloorChange)||void 0===i||i.call(this,e),this.logEvent("updateFloor",{floorId:e}),null==t||null===(n=t.onComplete)||void 0===n||n.call(t)}catch(e){this.debugLog("Floor update failed",e)}}},{key:"updatePlaceAndFloorForRouting",value:function(e,t){try{var r;this.updatePlaceAndFloor(e,t);var i=this.safeStyleLayers();this.updateFiltersTo(t,i),this.updateMarkersWhenFloorSettles(t,i),null===(r=this.onFloorChange)||void 0===r||r.call(this,t),this.logEvent("updatePlaceAndFloorForRouting",{floorId:t})}catch(e){this.debugLog("Place/floor update for routing failed",e)}}},{key:"addRoute",value:(s=hz(lz().m(function e(t){var r,i,n,a,o,s=arguments;return lz().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},e.p=1,this.logEvent("addRoute"),i=new hF(t),n=new dF(r),e.n=2,this.repository.fetchAndParseRoute(i);case 2:return a=e.v,this.routeController.addRoute(a,n),e.a(2,a);case 3:throw e.p=3,o=e.v,new Error("Error: Failed to add route",{cause:o});case 4:return e.a(2)}},e,this,[[1,3]])})),function(e){return s.apply(this,arguments)})},{key:"addLiveRoute",value:(o=hz(lz().m(function e(t){var r,i,n,a,o,s,l,u=arguments;return lz().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},e.p=1,this.logEvent("addLiveRoute"),i=new hF(t),n=new dF(r),a=++this.liveRouteTicket,e.n=2,this.repository.fetchAndParseLiveRoute(i);case 2:if(o=e.v,a===this.liveRouteTicket){e.n=3;break}return e.a(2,o);case 3:return void 0!==this.liveRouteId&&this.liveRouteId!==o.id&&this.routeController.removeRoute(this.liveRouteId),this.routeController.getRouteIds().includes(o.id)&&this.routeController.removeRoute(o.id),this.routeController.addRoute(o,n),this.liveRouteId=o.id,e.a(2,o);case 4:throw e.p=4,l=e.v,s=l instanceof Error?l.message:String(l),new Error("Error: Failed to add route: ".concat(s),{cause:l});case 5:return e.a(2)}},e,this,[[1,4]])})),function(e){return o.apply(this,arguments)})},{key:"updateRouteProgress",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{type:"Solid",color:"#276EF1"};try{var i=new dF({routeStyle:r});this.routeController.updateRouteProgress(e,t,i)}catch(e){this.debugLog("Route update failed (route may not exist)",e)}}},{key:"removeRoute",value:function(e){try{this.logEvent("removeRoute"),this.routeController.removeRoute(e)}catch(e){this.debugLog("Remove route failed (no route may exist)",e)}this.syncLiveRouteId()}},{key:"removeRouteById",value:function(e){try{this.logEvent("removeRouteById"),this.routeController.removeRoute(e)}catch(e){this.debugLog("Remove route failed (route may not exist)",e)}this.syncLiveRouteId()}},{key:"removeAllRoutes",value:function(){try{this.logEvent("removeAllRoutes"),this.routeController.removeAllRoutes()}catch(e){this.debugLog("Remove all routes failed",e)}this.syncLiveRouteId()}},{key:"syncLiveRouteId",value:function(){void 0===this.liveRouteId||this.routeController.getRouteIds().includes(this.liveRouteId)||(this.liveRouteId=void 0)}},{key:"getActiveRouteIds",value:function(){return this.routeController.getRouteIds()}},{key:"addPopOver",value:function(e){var t=e.placeId;if(void 0!==t){var r=this.subPlaces.find(function(e){return e.clientId===t||e.mapvxId===t});void 0!==r&&(new jk).setLngLat(r.position).setText(r.title).addTo(this.map)}return""}},{key:"removePopOver",value:function(e){throw Error("Not implemented")}},{key:"startClickListener",value:function(e){this.clickCallback=e}},{key:"stopClickListener",value:function(){this.clickCallback=void 0}},{key:"defaultClickListener",value:function(){var e=this;this.map.on("click",function(){var t=hz(lz().m(function t(r){var i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_,v;return lz().w(function(t){for(;;)switch(t.p=t.n){case 0:if(i=e.map.queryRenderedFeatures(r.point),n=i.filter(function(t){var r;return"room"===t.properties.class&&(null===(r=t.properties)||void 0===r?void 0:r.floor_key)===e.currentFloor}),a=n[0],!(null!=(o=null==a?void 0:a.properties.ref)&&"string"==typeof o&&o.length>0)){t.n=11;break}if(console.log("touchedFeature",o),void 0!==(d=e.subPlaces.find(function(e){return e.mapvxId===o}))){t.n=7;break}p=pz(e.potentialParentPlaces),t.p=1,p.s();case 2:if((f=p.n()).done){t.n=4;break}if(m=f.value,!(g=e.repository.getCachedSubPlaces(m.mapvxId))){t.n=3;break}if(void 0===(d=g.find(function(e){return e.mapvxId===o}))){t.n=3;break}return t.a(3,4);case 3:t.n=2;break;case 4:t.n=6;break;case 5:t.p=5,v=t.v,p.e(v);case 6:return t.p=6,p.f(),t.f(6);case 7:if(void 0!==d){t.n=10;break}if(0!==(y=e.repository.getCachedPlaces([o])).length){t.n=9;break}return console.log("fetching place detail from server",o),t.n=8,e.repository.fetchAndParsePlaceDetail({id:o});case 8:d=t.v,t.n=10;break;case 9:console.log("using cached place detail",o),d=null==y?void 0:y[0];case 10:console.log("clickedPlace",null===(s=d)||void 0===s?void 0:s.title),_=null!==(l=null!==(u=null===(c=d)||void 0===c?void 0:c.mapvxId)&&void 0!==u?u:null===(h=d)||void 0===h?void 0:h.clientId)&&void 0!==l?l:"",void 0!==d&&e.clickCallback&&e.clickCallback(_);case 11:return t.a(2)}},t,null,[[1,5,6,7]])}));return function(e){return t.apply(this,arguments)}}())}},{key:"onHover",value:function(){var e=this;this.enableHover&&(this.map.on("mousemove","hoverable",function(t){var r,i=null===(r=t.features)||void 0===r?void 0:r.find(function(t){var r,i;return(null===(r=t.properties.ref)||void 0===r?void 0:r.length)>0&&(null===(i=t.properties)||void 0===i?void 0:i.floor_key)===e.currentFloor}),n=null==i?void 0:i.properties.ref;null!=n&&"string"==typeof n&&n.length>0?(e.hoveredId=n,e.updateFiltersTo(e.currentFloor)):void 0===n&&"unselected"!==e.hoveredId&&(e.hoveredId="unselected",e.updateFiltersTo(e.currentFloor))}),this.map.on("mouseleave","hoverable",function(){e.hoveredId="unselected",e.updateFiltersTo(e.currentFloor)}))}},{key:"setPlacesAsSelected",value:function(e,t){try{this.coloredPlacesRequest={placeIds:fz(e),color:t},this.hasLayer("indoor-colored-places")||this.createColoredPlacesLayer();var r=this.createBasicFilters(),i=e.map(function(e){return["==",["get","ref"],e]}),n=["any"].concat(fz(i)),a=["all",n,r];if(this.map.setFilter("indoor-colored-places",a),this.capturedBaseFilters.add("indoor-colored-places"),this.baseFilters["indoor-colored-places"]=n,void 0!==t){var o=this.map.getLayer("indoor-colored-places");switch(null==o?void 0:o.type){case"fill":this.map.setPaintProperty("indoor-colored-places","fill-color",t);break;case"fill-extrusion":this.map.setPaintProperty("indoor-colored-places","fill-extrusion-color",t)}}}catch(e){this.debugLog("Place selection failed (layer may not exist)",e)}}},{key:"is3DStyle",value:function(){return this.map.getStyle().layers.some(function(e){return"fill-extrusion"===e.type})}},{key:"createColoredPlacesLayer",value:function(){if(this.is3DStyle()){var e={id:"indoor-colored-places",type:"fill-extrusion",source:"indoorequal","source-layer":"area",filter:["all",["has","ref"],["==",["get","ref"],"unselected"]],paint:{"fill-extrusion-height":2.5,"fill-extrusion-color":TF,"fill-extrusion-opacity":.8}};this.map.addLayer(e)}else{var t={id:"indoor-colored-places",type:"fill",source:"indoorequal","source-layer":"area",filter:["all",["has","ref"],["==",["get","ref"],"unselected"]],paint:{"fill-color":TF}};this.map.addLayer(t)}}},{key:"createBasicFilters",value:function(){var e,t,r=["==",["get","public_place"],!0],i=["!",["in",null!==(e=this.parentPlaceId)&&void 0!==e?e:"noRef",["get","is_subplace"]]],n=null!==(t=this.currentFloor)&&void 0!==t?t:"noRef",a=["in",n,["get","floor_key"]],o=["in",n,["get","show_in_floor"]],s=r;return null!=this.parentPlaceId&&(s=["any",a,r]),["all",s,["any",i,o]]}},{key:"hasLayer",value:function(e){return void 0!==this.map.getLayer(e)}},{key:"clearColoredPlaces",value:function(){if(this.coloredPlacesRequest=void 0,this.hasLayer("indoor-colored-places")){var e=["==",["get","ref"],"unselected"];this.capturedBaseFilters.add("indoor-colored-places"),this.baseFilters["indoor-colored-places"]=e,this.map.setFilter("indoor-colored-places",e)}}},{key:"startAnimateRoute",value:(a=hz(lz().m(function e(t){var r,i,n,a,o,s,l,u=arguments;return lz().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},i=u.length>2&&void 0!==u[2]?u[2]:{},e.p=1,!(t instanceof YF)){e.n=2;break}n=t,e.n=4;break;case 2:return a=new hF(t),e.n=3,this.repository.fetchAndParseRoute(a);case 3:n=e.v;case 4:return o=new vF(r),s=new _F(i),this.routeController.startAnimating(n,o,s),e.a(2,n);case 5:throw e.p=5,l=e.v,new Error("Error: Failed to start animating route",{cause:l});case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return a.apply(this,arguments)})},{key:"startAnimateRouteV2",value:(n=hz(lz().m(function e(t){var r,i,n,a,o,s,l,u=arguments;return lz().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},i=u.length>2&&void 0!==u[2]?u[2]:{},e.p=1,!(t instanceof YF)){e.n=2;break}n=t,e.n=4;break;case 2:return a=new hF(t),e.n=3,this.repository.fetchAndParseRouteV2(a);case 3:n=e.v;case 4:return o=new vF(r),s=new _F(i),this.routeController.startAnimating(n,o,s),e.a(2,n);case 5:throw e.p=5,l=e.v,new Error("Error: Failed to start animating route",{cause:l});case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return n.apply(this,arguments)})},{key:"pauseAnimateRoute",value:function(e){try{this.routeController.pauseAnimation(e),this.logEvent("pauseAnimateRoute")}catch(e){this.debugLog("Pause animation failed (no animation may be running)",e)}}},{key:"resumeAnimateRoute",value:function(e){try{this.routeController.resumeAnimation(e),this.logEvent("resumeAnimateRoute")}catch(e){this.debugLog("Resume animation failed (no animation may be paused)",e)}}},{key:"restartAnimateRoute",value:function(e){try{this.routeController.restartAnimation(e),this.logEvent("restartAnimateRoute")}catch(e){this.debugLog("Restart animation failed (no animation may exist)",e)}}},{key:"stopAnimateRoute",value:function(){this.logWarning(new Error("Not implemented"),{functionName:"stopAnimateRoute"})}},{key:"addStepAnimation",value:(i=hz(lz().m(function e(t){var r,i,n,a,o,s,l,u=arguments;return lz().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},i=u.length>2&&void 0!==u[2]?u[2]:{},e.p=1,!(t instanceof YF)){e.n=2;break}n=t,e.n=4;break;case 2:return a=new hF(t),e.n=3,this.repository.fetchAndParseRoute(a);case 3:n=e.v;case 4:return o=new vF(r),s=new _F(i),this.routeController.addStepAnimation(n,o,s),this.logEvent("addStepAnimation"),e.a(2,n);case 5:throw e.p=5,l=e.v,new Error("Error: Failed to add step animation",{cause:l});case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return i.apply(this,arguments)})},{key:"addStepAnimationV2",value:(r=hz(lz().m(function e(t){var r,i,n,a,o,s,l,u=arguments;return lz().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},i=u.length>2&&void 0!==u[2]?u[2]:{},e.p=1,!(t instanceof YF)){e.n=2;break}n=t,e.n=4;break;case 2:return a=new hF(t),e.n=3,this.repository.fetchAndParseRouteV2(a);case 3:n=e.v;case 4:return o=new vF(r),s=new _F(i),this.routeController.addStepAnimation(n,o,s),this.logEvent("addStepAnimationV2"),e.a(2,n);case 5:throw e.p=5,l=e.v,new Error("Error: Failed to add step animation",{cause:l});case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return r.apply(this,arguments)})},{key:"nextStepAnimation",value:function(e){try{this.routeController.nextStepAnimation(e),this.logEvent("nextStepAnimation")}catch(e){throw new Error("Error: Failed to animate step",{cause:e})}}},{key:"previousStepAnimation",value:function(e){try{this.routeController.previousStepAnimation(e),this.logEvent("previousStepAnimation")}catch(e){var t=e instanceof Error?e.message:String(e);throw new Error("Error: Failed to prepare to animate previous step, "+t)}}},{key:"centerOnCurrentStepAnimation",value:function(e){try{this.routeController.centerOnCurrentStep(e),this.logEvent("centerOnCurrentStepAnimation")}catch(e){var t=e instanceof Error?e.message:String(e);throw new Error("Error: Failed to center on current step animation, "+t)}}},{key:"addUserLocationTracking",value:function(e,t,r){var i,n=this;if(null!=r)i=r;else{var a=new Image(40,40);a.src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20aria-hidden%3D%22false%22%20role%3D%22img%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%226%22%20fill%3D%22var(--icon-fill%2C%20%23007aff)%22%20stroke%3D%22var(--icon-stroke%2C%20%23ffffff)%22%20stroke-width%3D%222%22/%3E%3C/svg%3E",i=a}var o=new hM({coordinate:{lat:0,lng:0},icon:i,text:""});o.addToMap(this.map),this.userLocationMarker=o,this.markerLayoutController.scheduleRelayout(),this.geoLocation=null!=t?t:navigator.geolocation,this.watchPositionID=this.geoLocation.watchPosition(function(e){o.setLngLat([e.coords.longitude,e.coords.latitude]),n.markerLayoutController.scheduleRelayout()},function(e){console.error("Error getting user location:",e)},{enableHighAccuracy:e})}},{key:"removeUserLocationTracking",value:function(){void 0!==this.userLocationMarker&&(this.userLocationMarker.remove(),this.userLocationMarker=void 0,this.markerLayoutController.scheduleRelayout(),this.watchPositionID&&(this.geoLocation.clearWatch(this.watchPositionID),this.watchPositionID=void 0))}},{key:"getBearing",value:function(){return this.map.getBearing()}},{key:"addBorderToPlaces",value:function(e,t,r){try{this.borderedPlacesRequest={placeIds:fz(e),color:t,width:r},this.hasLayer("indoor-bordered-places")||this.createBorderedPlacesLayer();var i=this.createBasicFilters(),n=e.map(function(e){return["==",["get","ref"],e]}),a=["any"].concat(fz(n)),o=["all",a,i];this.map.setFilter("indoor-bordered-places",o),this.capturedBaseFilters.add("indoor-bordered-places"),this.baseFilters["indoor-bordered-places"]=a,void 0!==t&&void 0!==r&&(this.map.setPaintProperty("indoor-bordered-places","line-color",t),this.map.setPaintProperty("indoor-bordered-places","line-width",r))}catch(e){throw new Error("Failed to add border to places",{cause:e})}}},{key:"createBorderedPlacesLayer",value:function(){var e={id:"indoor-bordered-places",type:"line",source:"indoorequal","source-layer":"area",filter:["all",["has","ref"],["==",["get","ref"],"unselected"]],paint:{"line-color":TF,"line-width":4}};this.map.addLayer(e)}},{key:"clearBorderedPlaces",value:function(){if(this.borderedPlacesRequest=void 0,this.hasLayer("indoor-bordered-places")){var e=["==",["get","ref"],"unselected"];this.capturedBaseFilters.add("indoor-bordered-places"),this.baseFilters["indoor-bordered-places"]=e,this.map.setFilter("indoor-bordered-places",e)}}},{key:"onWebGLContextLost",value:function(e){var t,r=this;e.originalEvent.preventDefault(),console.warn("Contexto WebGL perdido 😢");var i=null==this||null===(t=this.map)||void 0===t?void 0:t.getCanvas(),n=(null==i?void 0:i.getContext("webgl"))||(null==i?void 0:i.getContext("webgl2"));if(n&&n.isContextLost()){var a;i.addEventListener("webglcontextrestored",function(){console.debug("Contexto WebGL restaurado, forzando re-render"),r.map.triggerRepaint(),r.failedTiles.clear()},{once:!0});var o=n.getExtension("WEBGL_lose_context");null==o||null===(a=o.restoreContext)||void 0===a||a.call(o)}}},{key:"onWebGLContextRestored",value:function(){console.debug("Evento webglcontextrestored recibido, haciendo map.redraw()"),this.map.redraw(),this.failedTiles.clear()}},{key:"onSourceData",value:function(e){if("vector"===e.source.type&&"indoorequal"===e.sourceId&&e.tile&&!e.isSourceLoaded){var t,r=null===(t=e.tile)||void 0===t?void 0:t.state;"errored"!==r&&"expired"!==r||this.failedTiles.add(e.tile)}}},{key:"onSourceDataAbort",value:function(e){"vector"===e.source.type&&"indoorequal"===e.sourceId&&e.tile&&this.failedTiles.delete(e.tile)}},{key:"safeStyleLayers",value:function(){try{var e,t;return null!==(e=null===(t=this.map)||void 0===t||null===(t=t.getStyle())||void 0===t?void 0:t.layers)&&void 0!==e?e:null}catch(e){return null}}},{key:"hasStyle",value:function(){try{var e;return null!=(null===(e=this.map)||void 0===e?void 0:e.getStyle())}catch(e){return!1}}},{key:"hasLoadedStyle",value:function(){return!!this.hasStyle()&&!0===this.map.isStyleLoaded()}},{key:"subscribeToFailedTiles",value:function(){var e=this;this.retryTimer||(this.boundOnSourceData=this.onSourceData.bind(this),this.boundOnSourceDataAbort=this.onSourceDataAbort.bind(this),this.boundOnWebGLContextLost=this.onWebGLContextLost.bind(this),this.boundOnWebGLContextRestored=this.onWebGLContextRestored.bind(this),this.retryTimer=setInterval(function(){if(e.hasStyle())if(e.map.getSource("indoorequal")){var t=e.map.getSource("indoorequal");if(t&&"vector"===t.type){var r=[],i=[];e.failedTiles.forEach(function(e){!e||"unloaded"===e.state||"loading"===e.state||"errored"!==e.state&&"expired"!==e.state?i.push(e):r.push(e)}),i.forEach(function(t){return e.failedTiles.delete(t)});var n=Date.now();r.forEach(function(r){var i,a=null!==(i=e.tileRetryState.get(r))&&void 0!==i?i:{attempts:0,nextAttemptAt:0,pending:!1};if(!(a.pending||n<a.nextAttemptAt)){var o=function(t){var i=a.attempts+1;if(i>=5)return e.debugLog("Tile reload failed ".concat(i," times, dropping it from the retry queue"),t),e.failedTiles.delete(r),void e.tileRetryState.delete(r);var n=1e3*Math.pow(2,i-1);e.debugLog("Tile reload failed (attempt ".concat(i,"/").concat(5,"), retrying in ").concat(n,"ms"),t),e.tileRetryState.set(r,{attempts:i,nextAttemptAt:Date.now()+n,pending:!1})};try{!r||"errored"!==r.state&&"expired"!==r.state||(e.tileRetryState.set(r,_z(_z({},a),{},{pending:!0})),t.loadTile(r).then(function(){e.tileRetryState.delete(r)}).catch(o))}catch(e){o(e)}}})}else e.failedTiles.clear()}else e.failedTiles.clear()},1e3),this.map.on("sourcedata",this.boundOnSourceData),this.map.on("sourcedataabort",this.boundOnSourceDataAbort),this.map.on("webglcontextlost",this.boundOnWebGLContextLost),this.map.on("webglcontextrestored",this.boundOnWebGLContextRestored))}},{key:"unsubscribeFromFailedTiles",value:function(){this.retryTimer&&(clearInterval(this.retryTimer),this.retryTimer=void 0),this.boundOnSourceData&&(this.map.off("sourcedata",this.boundOnSourceData),this.boundOnSourceData=void 0),this.boundOnSourceDataAbort&&(this.map.off("sourcedataabort",this.boundOnSourceDataAbort),this.boundOnSourceDataAbort=void 0),this.boundOnWebGLContextLost&&(this.map.off("webglcontextlost",this.boundOnWebGLContextLost),this.boundOnWebGLContextLost=void 0),this.boundOnWebGLContextRestored&&(this.map.off("webglcontextrestored",this.boundOnWebGLContextRestored),this.boundOnWebGLContextRestored=void 0),this.failedTiles.clear()}}]);var r,i,n,a,o,s}(zF);function zz(e){return zz="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zz(e)}function Oz(e){return function(e){if(Array.isArray(e))return Bz(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return Bz(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Bz(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bz(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function jz(){var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var l=i&&i.prototype instanceof s?i:s,u=Object.create(l.prototype);return Nz(u,"_invoke",function(r,i,n){var a,s,l,u=0,c=n||[],h=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,s=0,l=e,d.n=r,o}};function p(r,i){for(s=r,l=i,t=0;!h&&u&&!n&&t<c.length;t++){var n,a=c[t],p=d.p,f=a[2];r>3?(n=f===i)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((n=r<2&&p<a[1])?(s=0,d.v=i,d.n=a[1]):p<f&&(n=r<3||a[0]>i||i>f)&&(a[4]=r,a[5]=i,d.n=f,s=0))}if(n||r>1)return o;throw h=!0,i}return function(n,c,f){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,f),s=c,l=f;(t=s<2?e:l)||!h;){a||(s?s<3?(s>1&&(d.n=-1),p(s,l)):d.n=l:d.v=l);try{if(u=2,a){if(s||(n="next"),t=a[n]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),s=1);a=e}else if((t=(h=d.n<0)?l:r.call(i,d))!==o)break}catch(t){a=e,s=1,l=t}finally{u=1}}return{value:t,done:h}}}(r,n,a),!0),u}var o={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):(Nz(t={},i,function(){return this}),t),h=u.prototype=s.prototype=Object.create(c);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,Nz(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,Nz(h,"constructor",u),Nz(u,"constructor",l),l.displayName="GeneratorFunction",Nz(u,n,"GeneratorFunction"),Nz(h),Nz(h,n,"Generator"),Nz(h,i,function(){return this}),Nz(h,"toString",function(){return"[object Generator]"}),(jz=function(){return{w:a,m:d}})()}function Nz(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}Nz=function(e,t,r,i){function a(t,r){Nz(e,t,function(e){return this._invoke(t,r,e)})}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},Nz(e,t,r,i)}function Uz(e,t,r,i,n,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(i,n)}function Vz(e){return function(){var t=this,r=arguments;return new Promise(function(i,n){var a=e.apply(t,r);function o(e){Uz(a,i,n,o,s,"next",e)}function s(e){Uz(a,i,n,o,s,"throw",e)}o(void 0)})}}function $z(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Kz(i.key),i)}}function Gz(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Gz=function(){return!!e})()}function qz(e){return qz=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},qz(e)}function Zz(e,t){return Zz=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Zz(e,t)}function Wz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,i)}return r}function Hz(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wz(Object(r),!0).forEach(function(t){Xz(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wz(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Xz(e,t,r){return(t=Kz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Kz(e){var t=function(e){if("object"!=zz(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=zz(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==zz(t)?t:t+""}function Yz(e){return"string"==typeof e?{id:e}:e}function Jz(e,t){var r=Hz(Hz({},{lang:"en",apiUrl:"https://public-api.mapvx.com",routeApiUrl:"https://api.mapvx.com",healthApiUrl:"https://api.mapvx.com",legacyApiUrl:"https://api.mapvx.com",cache:{persistent:!1}}),t);return new Qz(e,r)}var Qz=function(e){function t(e,r){var i,n,a,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Xz(o=function(e,t,r){return t=qz(t),function(e,t){if(t&&("object"==zz(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,Gz()?Reflect.construct(t,r||[],qz(e).constructor):t.apply(e,r))}(this,t),"maps",[]),Xz(o,"geoLocation",navigator.geolocation),Xz(o,"headingListeners",[]),o.token=e,o.config=r;var s=new K({persistent:null===(i=r.cache)||void 0===i?void 0:i.persistent,maxStorageBytes:null===(n=r.cache)||void 0===n?void 0:n.maxStorageBytes,configs:null===(a=r.cache)||void 0===a?void 0:a.configs});return o.repository=new KR(e,o.config.lang,o.config.apiUrl,s,o.config.mapvxRequestContext,{routeApiUrl:o.config.routeApiUrl,healthApiUrl:o.config.healthApiUrl,legacyApiUrl:o.config.legacyApiUrl,portalApiUrl:o.config.portalApiUrl}),o.cachePlaces(),o.logEvent("initSDK"),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Zz(e,t)}(t,e),function(e,t,r){return t&&$z(e.prototype,t),r&&$z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(t,[{key:"cachePlaces",value:function(){this.repository.fetchAndParseAvailablePlaces().catch(function(){})}},{key:"setSdkLang",value:function(e){this.config.lang=e,this.repository.setLang(e),this.maps.forEach(function(t){return t.setLang(e)})}},{key:"unregisterMap",value:function(e){var t=this.maps.indexOf(e);t>=0&&this.maps.splice(t,1)}},{key:"getPlaceDetail",value:(w=Vz(jz().m(function e(t){var r,i,n;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=Yz(t),e.n=1,this.repository.fetchAndParsePlaceDetail(r);case 1:return i=e.v,this.logEvent("getPlaceDetail",{id:r.id}),e.a(2,i);case 2:throw e.p=2,n=e.v,new Error("Error getPlaceDetail",{cause:n});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return w.apply(this,arguments)})},{key:"getAnyPlaceDetail",value:(x=Vz(jz().m(function e(t,r){var i,n,a;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,i=Yz(t),e.n=1,this.repository.fetchAndParseAnyPlaceDetail(i,r);case 1:return n=e.v,this.logEvent("getAnyPlaceDetail",{id:i.id}),e.a(2,n);case 2:throw e.p=2,a=e.v,new Error("Error getAnyPlaceDetail",{cause:a});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return x.apply(this,arguments)})},{key:"prepareSegmentation",value:function(e){return Hz(Hz({},e),{},{token:this.token})}},{key:"createMap",value:function(e,t){var r=this;try{t.lang=this.config.lang,t.apiUrl=this.config.apiUrl,t.portalApiUrl=this.config.portalApiUrl,t.mapvxRequestContext=this.config.mapvxRequestContext,t.routeApiUrl=this.config.routeApiUrl,t.healthApiUrl=this.config.healthApiUrl,t.legacyApiUrl=this.config.legacyApiUrl;var i=new Lz(t,e,this.token),n=i.destroyMap.bind(i);return i.destroyMap=function(){try{n()}finally{r.unregisterMap(i)}},this.maps.push(i),this.logEvent("createMap"),i}catch(e){throw new Error("Failed to create map",{cause:e})}}},{key:"getConfiguration",value:(b=Vz(jz().m(function e(t,r){var i,n;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseConfiguration(t,r);case 1:return i=e.v,this.logEvent("configuration"),e.a(2,i);case 2:throw e.p=2,n=e.v,new Error("Failed to get configuration",{cause:n});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return b.apply(this,arguments)})},{key:"getCampaigns",value:(v=Vz(jz().m(function e(t,r){var i,n;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseCampaigns(t,r);case 1:return i=e.v,this.logEvent("campaigns"),e.a(2,i);case 2:throw e.p=2,n=e.v,new Error("Failed to get campaigns",{cause:n});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return v.apply(this,arguments)})},{key:"getCategories",value:(_=Vz(jz().m(function e(t){var r,i;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseCategories(t);case 1:return r=e.v,this.logEvent("categories"),e.a(2,r);case 2:throw e.p=2,i=e.v,new Error("Failed to get categories",{cause:i});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return _.apply(this,arguments)})},{key:"getTransport",value:(y=Vz(jz().m(function e(t){var r,i;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseTransport(t);case 1:return r=e.v,e.a(2,r);case 2:throw e.p=2,i=e.v,new Error("Failed to get transport",{cause:i});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return y.apply(this,arguments)})},{key:"getCachedPlaces",value:function(e){try{var t=this.repository.getCachedPlaces(e);return this.logEvent("getCachedPlaces"),t}catch(e){throw new Error("Failed to get cached places",{cause:e})}}},{key:"getAvailablePlaces",value:(g=Vz(jz().m(function e(){var t,r;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseAvailablePlaces();case 1:return t=e.v,this.logEvent("getAvailablePlaces"),e.a(2,t);case 2:throw e.p=2,r=e.v,new Error("Failed to get available places",{cause:r});case 3:return e.a(2)}},e,this,[[0,2]])})),function(){return g.apply(this,arguments)})},{key:"getSubPlaces",value:(m=Vz(jz().m(function e(t){var r,i;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseSubPlaces(t);case 1:return r=e.v,this.logEvent("getSubPlaces"),e.a(2,r);case 2:throw e.p=2,i=e.v,new Error("Failed to get subplaces",{cause:i});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return m.apply(this,arguments)})},{key:"getPlacesFromInstitution",value:(f=Vz(jz().m(function e(t,r){var i,n;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParsePlacesFromInstitution(t,r);case 1:return i=e.v,this.logEvent("getPlacesFromInstitution"),e.a(2,i);case 2:throw e.p=2,n=e.v,new Error("Failed to get places from institution",{cause:n});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return f.apply(this,arguments)})},{key:"getAnySubPlaces",value:(p=Vz(jz().m(function e(t,r){var i,n;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseAnySubPlaces(t,r);case 1:return i=e.v,this.logEvent("getAnySubPlaces"),e.a(2,i);case 2:throw e.p=2,n=e.v,new Error("Failed to get any sub-places",{cause:n});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t){return p.apply(this,arguments)})},{key:"getInstitutions",value:(d=Vz(jz().m(function e(){var t,r;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseInstitutions();case 1:return t=e.v,this.logEvent("getInstitutions"),e.a(2,t);case 2:throw e.p=2,r=e.v,new Error("Error getInstitution",{cause:r});case 3:return e.a(2)}},e,this,[[0,2]])})),function(){return d.apply(this,arguments)})},{key:"getRoute",value:(h=Vz(jz().m(function e(t){var r,i,n;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=new hF(t),e.n=1,this.repository.fetchAndParseRoute(r);case 1:return i=e.v,this.logEvent("getRoute"),e.a(2,i);case 2:throw e.p=2,n=e.v,new Error("Failed to get route",{cause:n});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return h.apply(this,arguments)})},{key:"getRouteV2",value:(c=Vz(jz().m(function e(t){var r,i,n;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=new hF(t),e.n=1,this.repository.fetchAndParseRouteV2(r);case 1:return i=e.v,this.logEvent("getRouteV2"),e.a(2,i);case 2:throw e.p=2,n=e.v,new Error("Failed to get route",{cause:n});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return c.apply(this,arguments)})},{key:"getLiveRoute",value:(u=Vz(jz().m(function e(t){var r,i,n;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,r=new hF(t),e.n=1,this.repository.fetchAndParseLiveRoute(r);case 1:return i=e.v,this.logEvent("getLiveRoute"),e.a(2,i);case 2:throw e.p=2,n=e.v,new Error("Failed to get route",{cause:n});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return u.apply(this,arguments)})},{key:"getPlacesByInput",value:(l=Vz(jz().m(function e(t,r,i,n,a,o,s,l){var u,c,h;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,u=i?n?[i].concat(Oz(n)):[i]:n,e.n=1,this.repository.fetchAndParseSearchResults(r,t,u,a,o,s,l);case 1:return c=e.v,this.logEvent("getPlacesByInput"),e.a(2,c);case 2:throw e.p=2,h=e.v,new Error("Failed to get places by input",{cause:h});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t,r,i,n,a,o,s){return l.apply(this,arguments)})},{key:"searchPlacesByTags",value:(s=Vz(jz().m(function e(t,r){var i,n,a,o,s,l,u,c,h,d,p=arguments;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:if(i=p.length>2&&void 0!==p[2]?p[2]:{},r&&0!==r.length){e.n=1;break}throw new Error("searchPlacesByTags requires at least one tag");case 1:if(n=i.parentPlaces,a=i.sort,o=i.origin,s=i.lat,l=i.lng,u=i.floor,"distance"!==a){e.n=2;break}if(c=null!=s&&null!=l&&null!=u&&null!=n&&n.length>0,o||c){e.n=2;break}throw new Error('searchPlacesByTags with sort "distance" requires "origin" or "lat" + "lng" + "floor" + "parentPlaces"');case 2:return e.p=2,e.n=3,this.repository.fetchAndParseSearchPlacesByTags(t,r,n,a,o,s,l,u);case 3:return h=e.v,this.logEvent("searchPlacesByTags"),e.a(2,h);case 4:throw e.p=4,d=e.v,new Error("Failed to search places by tags",{cause:d});case 5:return e.a(2)}},e,this,[[2,4]])})),function(e,t){return s.apply(this,arguments)})},{key:"getPlacesByCategory",value:(o=Vz(jz().m(function e(t){var r;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,this.logEvent("getPlacesByCategory"),e.a(2,[]);case 1:throw e.p=1,r=e.v,new Error("Failed to get places by category",{cause:r});case 2:return e.a(2)}},e,this,[[0,1]])})),function(e){return o.apply(this,arguments)})},{key:"setGeoLocation",value:function(e){this.geoLocation=e}},{key:"getUserLocation",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{enableHighAccuracy:!0,timeout:6e4,maximumAge:1e4};return new Promise(function(r,i){e.geoLocation.getCurrentPosition(function(e){r(e)},function(e){i(e)},t)})}},{key:"watchUserPosition",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{enableHighAccuracy:!0,timeout:6e4,maximumAge:1e3};return this.geoLocation.watchPosition(function(t){e(t)},function(e){t(e)},r)}},{key:"unWatchUserPosition",value:function(e){this.geoLocation.clearWatch(e)}},{key:"watchUserHeading",value:function(e,t){var r=function(r){if(function(e){return e instanceof DeviceOrientationEvent}(r)){var i=null;void 0!==r.webkitCompassHeading?i=r.webkitCompassHeading||null:r.absolute&&null!==r.alpha&&(i=360-r.alpha),null!==i?e(i):t("Could not retrieve heading information.")}};this.headingListeners.push(r),"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",r):"ondeviceorientation"in window&&window.addEventListener("deviceorientation",r)}},{key:"unwatchUserHeading",value:function(){this.headingListeners.forEach(function(e){window.removeEventListener("deviceorientationabsolute",e),window.removeEventListener("deviceorientation",e)}),this.headingListeners=[]}},{key:"loadRoutesForOriginCache",value:(a=Vz(jz().m(function e(t,r,i,n,a){return jz().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,this.repository.fetchAndParseRoutesFromOrigin(t,r,i,n,a);case 1:return e.a(2)}},e,this)})),function(e,t,r,i,n){return a.apply(this,arguments)})},{key:"getCacheTimestamp",value:(n=Vz(jz().m(function e(t){var r,i;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseCacheTimestamp(t);case 1:return r=e.v,this.logEvent("getCacheTimestamp"),e.a(2,r);case 2:throw e.p=2,i=e.v,new Error("Failed to get cache timestamp",{cause:i});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return n.apply(this,arguments)})},{key:"cleanRoutesCache",value:function(){this.repository.cleanRoutesCache()}},{key:"getCssCustomization",value:(i=Vz(jz().m(function e(t){var r,i;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.fetchAndParseCssCustomization(t);case 1:return r=e.v,this.logEvent("cssCustomization"),e.a(2,r);case 2:throw e.p=2,i=e.v,new Error("Failed to get css customization",{cause:i});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return i.apply(this,arguments)})},{key:"notifyHealth",value:(r=Vz(jz().m(function e(t,r,i,n){var a,o;return jz().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.repository.postAndParseHealthPing(t,r,i,n);case 1:return a=e.v,e.a(2,a);case 2:throw e.p=2,o=e.v,new Error("Failed to notify health",{cause:o});case 3:return e.a(2)}},e,this,[[0,2]])})),function(e,t,i,n){return r.apply(this,arguments)})}],[{key:"getLang",value:function(){return this.config.lang}}]);var r,i,n,a,o,s,l,u,c,h,d,p,f,m,g,y,_,v,b,x,w}(zF);function eO(e){var t=e;return null!=t.logo&&""!==t.logo}function tO(e){var t=e;return null!=t.icon&&""!==t.icon}function rO(e){var t=e;return null!=t.imageUrl&&""!==t.imageUrl}function iO(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nO(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?nO(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nO(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function aO(e){var t=document.createElement("style");t.textContent="";for(var r=0,i=Object.entries(e);r<i.length;r++){var n=iO(i[r],2),a=oO(n[0],n[1]);t.textContent+=a}document.head.appendChild(t);var o=Object.keys(e)[0];null!=o&&document.body.classList.add(o)}function oO(e,t){var r=".".concat(e," {\n"),i=t.definitions;null!=i&&(r=function(e,t){for(var r=0,i=Object.entries(null!==(n=e.colors)&&void 0!==n?n:{});r<i.length;r++)for(var n,a=iO(i[r],2),o=a[0],s=a[1],l=0,u=Object.entries(s);l<u.length;l++){var c=iO(u[l],2),h=c[0],d=c[1];t+=" --definitions-colors-".concat(o,"-").concat(h,": ").concat(d,";\n")}for(var p=0,f=Object.entries(null!==(m=e.shadows)&&void 0!==m?m:{});p<f.length;p++){var m,g=iO(f[p],2),y=g[0],_=g[1];t+=" --definitions-shadows-".concat(y,": ").concat(_,";\n")}for(var v=0,b=Object.entries(null!==(x=e.textFonts)&&void 0!==x?x:{});v<b.length;v++){var x,w=iO(b[v],2),S=w[0],T=w[1];t+=" --definitions-textFonts-".concat(S,": ").concat(T,";\n")}return t}(i,r));for(var n=0,a=Object.entries(null!==(o=t.screens)&&void 0!==o?o:{});n<a.length;n++)for(var o,s=iO(a[n],2),l=s[0],u=s[1],c=0,h=Object.entries(u);c<h.length;c++)for(var d=iO(h[c],2),p=d[0],f=d[1],m=0,g=Object.entries(f);m<g.length;m++)for(var y=iO(g[m],2),_=y[0],v=y[1],b=0,x=Object.entries(v);b<x.length;b++){var w=iO(x[b],2),S=w[0],T=w[1];r+=" --".concat(l,"-").concat(p,"-").concat(_,"-").concat(S,": ").concat(T,";\n")}return r+"}\n"}function sO(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=cO(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function lO(e){return lO="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lO(e)}function uO(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}(e,t)||cO(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cO(e,t){if(e){if("string"==typeof e)return hO(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?hO(e,t):void 0}}function hO(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function dO(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,pO(i.key),i)}}function pO(e){var t=function(e){if("object"!=lO(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=lO(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==lO(t)?t:t+""}var fO=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,r){return r&&dO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}(e,0,[{key:"getDay",value:function(e){try{switch(e.getDay()){case 0:return"su";case 1:return"mo";case 2:return"tu";case 3:return"we";case 4:return"th";case 5:return"fr";case 6:return"sa";default:return null}}catch(e){return null}}},{key:"convertSingleTimeTo12Hour",value:function(e){try{var t;if(!e||"string"!=typeof e)return"";var r=uO(null!==(t=e.split(":"))&&void 0!==t?t:[],2),i=r[0],n=r[1];if(!i||!n)return"";var a=Number.parseInt(i,10),o=Number.parseInt(n,10);if(Number.isNaN(a)||Number.isNaN(o)||a<0||a>23||o<0||o>59)return"";var s,l=a%24;return l<12?(s="a.m.",0===l&&(l=12)):(s="p.m.",12!==l&&(l-=12)),"".concat(l,":").concat(o<10?"0":"").concat(o," ").concat(s)}catch(e){return""}}},{key:"formatTimeSchedule",value:function(t){try{if(!t||!t.open||!t.close)return"";if(mO(t))return"24 hrs";var r=e.convertSingleTimeTo12Hour(t.open),i=e.convertSingleTimeTo12Hour(t.close);return""===r||""===i?"":"".concat(r," - ").concat(i)}catch(e){return""}}},{key:"getDayNumber",value:function(e){try{switch(e){case"mo":return 1;case"tu":return 2;case"we":return 3;case"th":return 4;case"fr":return 5;case"sa":return 6;case"su":return 7;default:return-1}}catch(e){return-1}}},{key:"getDayName",value:function(t){try{var r=e.getDayNumber(t);if(-1===r)return"";var i=new Date(2024,0,r);try{var n=Qz.getLang();return i.toLocaleDateString(n,{weekday:"long"})}catch(e){return i.toLocaleDateString("en",{weekday:"long"})}}catch(e){return""}}},{key:"sortDays",value:function(t){try{return Object.fromEntries(Object.entries(t).sort(function(t,r){var i=uO(t,1)[0],n=uO(r,1)[0];return e.getDayNumber(i)-e.getDayNumber(n)}))}catch(e){return t}}},{key:"isOpenFromPreviousDay",value:function(t,r){try{if(!t||"object"!==lO(t))return!1;var i=r||new Date,n=new Date(i);e.previousDate(n);var a=e.getDay(n);if(null==a)return!1;var o=t[a];if(!o||!Array.isArray(o)||0===o.length)return!1;var s,l=sO(o);try{for(l.s();!(s=l.n()).done;){var u=s.value;if(mO(u))return!0;if(null!=u&&u.open&&u.close&&e.isValidTime(u.open)&&e.isValidTime(u.close)){var c=e.parseTimeAsDate(u.open,n),h=e.parseTimeAsDate(u.close,n);if(c>h&&e.nextDate(h),i>=c&&i<=h)return!0}}}catch(e){l.e(e)}finally{l.f()}return!1}catch(e){return!1}}},{key:"previousDate",value:function(e){try{var t=e.getDate();e.setDate(t-1)}catch(e){}}},{key:"nextDate",value:function(e){try{var t=e.getDate();e.setDate(t+1)}catch(e){}}},{key:"isWithinOpeningHours",value:function(t,r){try{if(!t||"object"!==lO(t))return!1;var i=r||new Date,n=e.getDay(i);if(null==n)return!1;if(e.isOpenFromPreviousDay(t,i))return!0;var a=t[n];if(!a||!Array.isArray(a)||0===a.length)return!1;var o,s=sO(a);try{for(s.s();!(o=s.n()).done;){var l=o.value;if(mO(l))return!0;if(null!=l&&l.open&&l.close&&e.isValidTime(l.open)&&e.isValidTime(l.close)){var u=e.parseTimeAsDate(l.open,i),c=e.parseTimeAsDate(l.close,i);if(u>=c&&e.nextDate(c),i>=u&&i<=c)return!0}}}catch(e){s.e(e)}finally{s.f()}return!1}catch(e){return!1}}},{key:"hasOpeningHoursToday",value:function(t){try{if(!t||"object"!==lO(t))return!1;var r=new Date,i=e.getDay(r);if(null==i)return!1;var n=t[i];return!(null==n||!n.length)}catch(e){return!1}}},{key:"isValidTime",value:function(e){try{return!(!e||"string"!=typeof e)&&/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(e)}catch(e){return!1}}},{key:"parseTimeAsDate",value:function(e,t){try{var r=uO(e.split(":").map(Number),2),i=r[0],n=r[1],a=t?new Date(t):new Date;return new Date(a.getFullYear(),a.getMonth(),a.getDate(),i,n,0,0)}catch(e){return new Date}}},{key:"flattenOpeningTimes",value:function(t){try{if(!t||!Array.isArray(t)||0===t.length)return{open:"00:00",close:"00:00"};e.sortOpeningTimesByOpen(t);var r=t[0],i=t[t.length-1];return r&&i&&r.open&&i.close?{open:r.open,close:i.close}:{open:"00:00",close:"00:00"}}catch(e){return{open:"00:00",close:"00:00"}}}},{key:"sortOpeningTimesByOpen",value:function(e){try{return e.sort(function(e,t){return e.open.localeCompare(t.open)})}catch(t){return e}}},{key:"formatCurrentDaySchedule",value:function(t){try{var r=new Date,i=e.getDay(r);if(null==i)return"";var n=t[i];if(null!=n&&n.length){var a=e.flattenOpeningTimes(n);return e.formatTimeSchedule(a)}return""}catch(e){return""}}},{key:"formatPreviousDaySchedule",value:function(t){try{var r=new Date;e.previousDate(r);var i=e.getDay(r);if(null==i)return"";var n=t[i];if(null!=n&&n.length){var a=e.flattenOpeningTimes(n);return e.formatTimeSchedule(a)}return""}catch(e){return""}}},{key:"isValidSchedule",value:function(t,r,i){try{if(!e.isValidTime(t)||!e.isValidTime(r)||!e.isValidTime(i))return!1;var n=e.toMinutes(t),a=e.toMinutes(r),o=e.toMinutes(i);return o>=n&&o<=a}catch(e){return!1}}},{key:"parseTimeToDate",value:function(e,t){try{if(!e||"string"!=typeof e)return new Date;var r=uO(e.split(":"),2),i=r[0],n=r[1];if(!i||!n)return new Date;var a=Number.parseInt(i,10),o=Number.parseInt(n,10);if(Number.isNaN(a)||Number.isNaN(o))return new Date;var s=t?new Date(t):new Date;return s.setHours(a,o,0,0),s}catch(e){return new Date}}},{key:"getDaysRange",value:function(e){try{var t={Mo:"Monday",Tu:"Tuesday",We:"Wednesday",Th:"Thursday",Fr:"Friday",Sa:"Saturday",Su:"Sunday"};if(0===e.length)return"";var r=t[e[0]]||"Invalid day",i=t[e[e.length-1]]||"Invalid day";return 1===e.length?r:"".concat(r," - ").concat(i)}catch(e){return""}}},{key:"getNextClosestTime",value:function(t,r){try{var i=60*r.getHours()+r.getMinutes(),n=t.map(function(t){var r=e.toMinutes(t);return{time:t,diff:r-i+(r<i?1440:0)}});return n.sort(function(e,t){return e.diff-t.diff}),n.length>0?n[0].time:""}catch(e){return""}}},{key:"isPlaceOpen",value:function(t,r){try{if(!t||"object"!==lO(t))return!1;var i=r||new Date,n=e.getDay(i);if(null==n||!t[n]||!Array.isArray(t[n])||0===t[n].length)return!1;var a=t[n][0];if(!a||!a.open||!a.close)return!1;var o=a.open,s=a.close;if(!e.isValidTime(o)||!e.isValidTime(s))return!1;var l=e.parseTimeToDate(o,i),u=e.parseTimeToDate(s,i);u<l&&u.setDate(u.getDate()+1);var c=new Date(i);return c.setSeconds(0,0),c>=l&&c<=u}catch(e){return!1}}},{key:"getNextSchedule",value:function(t,r){try{if(!t||"object"!==lO(t))return"";var i=r||new Date,n=e.getDay(i);if(null==n||!t[n]||!Array.isArray(t[n])||0===t[n].length)return"";var a=t[n][0];if(!a||!a.open||!a.close)return"";var o=e.isPlaceOpen(t,i)?a.close:a.open;return o?e.convertSingleTimeTo12Hour(o):""}catch(e){return""}}},{key:"checkDayHasSchedule",value:function(t,r){try{var i=r||new Date,n=e.getDay(i);return null!=n&&!(null==t||!t[n])}catch(e){return!1}}},{key:"toMinutes",value:function(e){try{if(!e||"string"!=typeof e)return 0;var t=uO(e.split(":"),2),r=t[0],i=t[1];if(!r||!i)return 0;var n=Number.parseInt(r,10),a=Number.parseInt(i,10);return Number.isNaN(n)||Number.isNaN(a)?0:60*n+a}catch(e){return 0}}}])}();function mO(e){var t,r,i,n;if(null==e||!e.open||null==e||!e.close)return!1;var a=null!==(t=null==e||null===(r=e.open)||void 0===r?void 0:r.trim())&&void 0!==t?t:"",o=null!==(i=null==e||null===(n=e.close)||void 0===n?void 0:n.trim())&&void 0!==i?i:"";return"00:00"===a&&"24:00"===o||"00:00"===a&&"00:00"===o}function gO(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}var yO=["https://tiles.mapvx.com","https://api.maptiler.com","https://indoorequals.mapvx.com"];function _O(e){if("undefined"==typeof document||!document.head)return[];if(!Array.isArray(e)||0===e.length)return[];var t,r=[],i=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return gO(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gO(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}(e);try{for(i.s();!(t=i.n()).done;){var n=t.value;if("string"==typeof n&&0!==n.length){var a=bO(n);if(null!==a){var o=vO("preconnect",a),s=!1;if(o)o.hasAttribute("crossorigin")||(o.crossOrigin="anonymous",s=!0);else{var l=document.createElement("link");l.rel="preconnect",l.href=a,l.crossOrigin="anonymous",document.head.appendChild(l),s=!0}if(!vO("dns-prefetch",a)){var u=document.createElement("link");u.rel="dns-prefetch",u.href=a,document.head.appendChild(u)}s&&r.push(a)}}}}catch(e){i.e(e)}finally{i.f()}return r}function vO(e,t){for(var r=document.head.querySelectorAll('link[rel="'.concat(e,'"]')),i=0;i<r.length;i++){var n=r[i];try{if(new URL(n.href).origin===t)return n}catch(e){}}return null}function bO(e){try{var t=/^https?:\/\//i.test(e)?e:"https://".concat(e);return new URL(t).origin}catch(e){return null}}var xO=function(){if(!document.querySelector("link[data-mapvx-styles]")){var e=document.createElement("link");e.rel="stylesheet",e.href="./styles.css",e.setAttribute("data-mapvx-styles","true"),document.head.appendChild(e)}}})(),module.exports=i})();
96
3
  //# sourceMappingURL=index.js.map