@mapvx/web-js 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/LICENSE.md +19 -0
  2. package/README.md +257 -0
  3. package/dist/cjs/assets/icons.js +87 -0
  4. package/dist/cjs/assets/icons.js.map +1 -0
  5. package/dist/cjs/assets/route_animation_icon.svg +15 -0
  6. package/dist/cjs/assets/user-dot-icon.svg +3 -0
  7. package/dist/cjs/config/sdkConfig.js +3 -0
  8. package/dist/cjs/config/sdkConfig.js.map +1 -0
  9. package/dist/cjs/controllers/routeController.js +1054 -0
  10. package/dist/cjs/controllers/routeController.js.map +1 -0
  11. package/dist/cjs/domain/models/_internal.js +15 -0
  12. package/dist/cjs/domain/models/_internal.js.map +1 -0
  13. package/dist/cjs/domain/models/_rtl.js +10 -0
  14. package/dist/cjs/domain/models/_rtl.js.map +1 -0
  15. package/dist/cjs/domain/models/animation.js +63 -0
  16. package/dist/cjs/domain/models/animation.js.map +1 -0
  17. package/dist/cjs/domain/models/banner.js +24 -0
  18. package/dist/cjs/domain/models/banner.js.map +1 -0
  19. package/dist/cjs/domain/models/categories.js +25 -0
  20. package/dist/cjs/domain/models/categories.js.map +1 -0
  21. package/dist/cjs/domain/models/cityFilterOption.js +3 -0
  22. package/dist/cjs/domain/models/cityFilterOption.js.map +1 -0
  23. package/dist/cjs/domain/models/configuration.js +3 -0
  24. package/dist/cjs/domain/models/configuration.js.map +1 -0
  25. package/dist/cjs/domain/models/cssCustomization.js +3 -0
  26. package/dist/cjs/domain/models/cssCustomization.js.map +1 -0
  27. package/dist/cjs/domain/models/fitOptions.js +3 -0
  28. package/dist/cjs/domain/models/fitOptions.js.map +1 -0
  29. package/dist/cjs/domain/models/innerFloors.js +3 -0
  30. package/dist/cjs/domain/models/innerFloors.js.map +1 -0
  31. package/dist/cjs/domain/models/institution.js +44 -0
  32. package/dist/cjs/domain/models/institution.js.map +1 -0
  33. package/dist/cjs/domain/models/latLng.js +3 -0
  34. package/dist/cjs/domain/models/latLng.js.map +1 -0
  35. package/dist/cjs/domain/models/location.js +3 -0
  36. package/dist/cjs/domain/models/location.js.map +1 -0
  37. package/dist/cjs/domain/models/loggeable.js +52 -0
  38. package/dist/cjs/domain/models/loggeable.js.map +1 -0
  39. package/dist/cjs/domain/models/mapCamera.js +3 -0
  40. package/dist/cjs/domain/models/mapCamera.js.map +1 -0
  41. package/dist/cjs/domain/models/mapConfig.js +15 -0
  42. package/dist/cjs/domain/models/mapConfig.js.map +1 -0
  43. package/dist/cjs/domain/models/marker.js +400 -0
  44. package/dist/cjs/domain/models/marker.js.map +1 -0
  45. package/dist/cjs/domain/models/multilanguage.js +18 -0
  46. package/dist/cjs/domain/models/multilanguage.js.map +1 -0
  47. package/dist/cjs/domain/models/openingHours.js +3 -0
  48. package/dist/cjs/domain/models/openingHours.js.map +1 -0
  49. package/dist/cjs/domain/models/place.js +101 -0
  50. package/dist/cjs/domain/models/place.js.map +1 -0
  51. package/dist/cjs/domain/models/platform.js +3 -0
  52. package/dist/cjs/domain/models/platform.js.map +1 -0
  53. package/dist/cjs/domain/models/popover.js +3 -0
  54. package/dist/cjs/domain/models/popover.js.map +1 -0
  55. package/dist/cjs/domain/models/product.js +3 -0
  56. package/dist/cjs/domain/models/product.js.map +1 -0
  57. package/dist/cjs/domain/models/property.js +104 -0
  58. package/dist/cjs/domain/models/property.js.map +1 -0
  59. package/dist/cjs/domain/models/route.js +166 -0
  60. package/dist/cjs/domain/models/route.js.map +1 -0
  61. package/dist/cjs/domain/models/routeConfiguration.js +80 -0
  62. package/dist/cjs/domain/models/routeConfiguration.js.map +1 -0
  63. package/dist/cjs/domain/models/routeInstance.js +30 -0
  64. package/dist/cjs/domain/models/routeInstance.js.map +1 -0
  65. package/dist/cjs/domain/models/routeStyle.js +3 -0
  66. package/dist/cjs/domain/models/routeStyle.js.map +1 -0
  67. package/dist/cjs/domain/models/transport.js +22 -0
  68. package/dist/cjs/domain/models/transport.js.map +1 -0
  69. package/dist/cjs/domain/ports/ICache.js +3 -0
  70. package/dist/cjs/domain/ports/ICache.js.map +1 -0
  71. package/dist/cjs/domain/ports/IHttpClient.js +3 -0
  72. package/dist/cjs/domain/ports/IHttpClient.js.map +1 -0
  73. package/dist/cjs/domain/ports/ILogger.js +23 -0
  74. package/dist/cjs/domain/ports/ILogger.js.map +1 -0
  75. package/dist/cjs/domain/ports/index.js +10 -0
  76. package/dist/cjs/domain/ports/index.js.map +1 -0
  77. package/dist/cjs/index.js +76 -0
  78. package/dist/cjs/index.js.map +1 -0
  79. package/dist/cjs/infrastructure/cache/CacheManager.js +236 -0
  80. package/dist/cjs/infrastructure/cache/CacheManager.js.map +1 -0
  81. package/dist/cjs/infrastructure/cache/LRUCache.js +153 -0
  82. package/dist/cjs/infrastructure/cache/LRUCache.js.map +1 -0
  83. package/dist/cjs/infrastructure/cache/PersistentCache.js +160 -0
  84. package/dist/cjs/infrastructure/cache/PersistentCache.js.map +1 -0
  85. package/dist/cjs/infrastructure/cache/cacheConfig.js +70 -0
  86. package/dist/cjs/infrastructure/cache/cacheConfig.js.map +1 -0
  87. package/dist/cjs/infrastructure/http/FetchHttpClient.js +75 -0
  88. package/dist/cjs/infrastructure/http/FetchHttpClient.js.map +1 -0
  89. package/dist/cjs/infrastructure/logging/CountlyLogger.js +78 -0
  90. package/dist/cjs/infrastructure/logging/CountlyLogger.js.map +1 -0
  91. package/dist/cjs/interfaces/cache.js +3 -0
  92. package/dist/cjs/interfaces/cache.js.map +1 -0
  93. package/dist/cjs/interfaces/healthResponse.js +3 -0
  94. package/dist/cjs/interfaces/healthResponse.js.map +1 -0
  95. package/dist/cjs/interfaces/institutionResponse.js +3 -0
  96. package/dist/cjs/interfaces/institutionResponse.js.map +1 -0
  97. package/dist/cjs/interfaces/metadata.js +3 -0
  98. package/dist/cjs/interfaces/metadata.js.map +1 -0
  99. package/dist/cjs/interfaces/placeResponse.js +3 -0
  100. package/dist/cjs/interfaces/placeResponse.js.map +1 -0
  101. package/dist/cjs/interfaces/routeCacheResponse.js +3 -0
  102. package/dist/cjs/interfaces/routeCacheResponse.js.map +1 -0
  103. package/dist/cjs/interfaces/routeResponse.js +3 -0
  104. package/dist/cjs/interfaces/routeResponse.js.map +1 -0
  105. package/dist/cjs/interfaces/styleResponse.js +3 -0
  106. package/dist/cjs/interfaces/styleResponse.js.map +1 -0
  107. package/dist/cjs/logger/logger.js +91 -0
  108. package/dist/cjs/logger/logger.js.map +1 -0
  109. package/dist/cjs/logger/rollbar.js +24 -0
  110. package/dist/cjs/logger/rollbar.js.map +1 -0
  111. package/dist/cjs/map/map.js +1457 -0
  112. package/dist/cjs/map/map.js.map +1 -0
  113. package/dist/cjs/repository/repository.js +574 -0
  114. package/dist/cjs/repository/repository.js.map +1 -0
  115. package/dist/cjs/repository/requester.js +590 -0
  116. package/dist/cjs/repository/requester.js.map +1 -0
  117. package/dist/cjs/sdk.js +351 -0
  118. package/dist/cjs/sdk.js.map +1 -0
  119. package/dist/cjs/utils/error.js +20 -0
  120. package/dist/cjs/utils/error.js.map +1 -0
  121. package/dist/cjs/utils/images.js +26 -0
  122. package/dist/cjs/utils/images.js.map +1 -0
  123. package/dist/cjs/utils/nav-functions.js +150 -0
  124. package/dist/cjs/utils/nav-functions.js.map +1 -0
  125. package/dist/cjs/utils/opening-hours-helper.js +911 -0
  126. package/dist/cjs/utils/opening-hours-helper.js.map +1 -0
  127. package/dist/cjs/utils/route-utils.js +58 -0
  128. package/dist/cjs/utils/route-utils.js.map +1 -0
  129. package/dist/cjs/utils/update-css.js +77 -0
  130. package/dist/cjs/utils/update-css.js.map +1 -0
  131. package/dist/cjs/utils/utils.js +105 -0
  132. package/dist/cjs/utils/utils.js.map +1 -0
  133. package/dist/es/assets/icons.d.ts +86 -0
  134. package/dist/es/assets/icons.d.ts.map +1 -0
  135. package/dist/es/assets/icons.js +83 -0
  136. package/dist/es/assets/icons.js.map +1 -0
  137. package/dist/es/assets/route_animation_icon.svg +15 -0
  138. package/dist/es/assets/user-dot-icon.svg +3 -0
  139. package/dist/es/config/sdkConfig.d.ts +105 -0
  140. package/dist/es/config/sdkConfig.d.ts.map +1 -0
  141. package/dist/es/config/sdkConfig.js +2 -0
  142. package/dist/es/config/sdkConfig.js.map +1 -0
  143. package/dist/es/controllers/routeController.d.ts +161 -0
  144. package/dist/es/controllers/routeController.d.ts.map +1 -0
  145. package/dist/es/controllers/routeController.js +1050 -0
  146. package/dist/es/controllers/routeController.js.map +1 -0
  147. package/dist/es/domain/models/_internal.d.ts +21 -0
  148. package/dist/es/domain/models/_internal.d.ts.map +1 -0
  149. package/dist/es/domain/models/_internal.js +11 -0
  150. package/dist/es/domain/models/_internal.js.map +1 -0
  151. package/dist/es/domain/models/_rtl.d.ts +7 -0
  152. package/dist/es/domain/models/_rtl.d.ts.map +1 -0
  153. package/dist/es/domain/models/_rtl.js +7 -0
  154. package/dist/es/domain/models/_rtl.js.map +1 -0
  155. package/dist/es/domain/models/animation.d.ts +161 -0
  156. package/dist/es/domain/models/animation.d.ts.map +1 -0
  157. package/dist/es/domain/models/animation.js +58 -0
  158. package/dist/es/domain/models/animation.js.map +1 -0
  159. package/dist/es/domain/models/banner.d.ts +64 -0
  160. package/dist/es/domain/models/banner.d.ts.map +1 -0
  161. package/dist/es/domain/models/banner.js +20 -0
  162. package/dist/es/domain/models/banner.js.map +1 -0
  163. package/dist/es/domain/models/categories.d.ts +157 -0
  164. package/dist/es/domain/models/categories.d.ts.map +1 -0
  165. package/dist/es/domain/models/categories.js +20 -0
  166. package/dist/es/domain/models/categories.js.map +1 -0
  167. package/dist/es/domain/models/cityFilterOption.d.ts +15 -0
  168. package/dist/es/domain/models/cityFilterOption.d.ts.map +1 -0
  169. package/dist/es/domain/models/cityFilterOption.js +2 -0
  170. package/dist/es/domain/models/cityFilterOption.js.map +1 -0
  171. package/dist/es/domain/models/configuration.d.ts +523 -0
  172. package/dist/es/domain/models/configuration.d.ts.map +1 -0
  173. package/dist/es/domain/models/configuration.js +2 -0
  174. package/dist/es/domain/models/configuration.js.map +1 -0
  175. package/dist/es/domain/models/cssCustomization.d.ts +63 -0
  176. package/dist/es/domain/models/cssCustomization.d.ts.map +1 -0
  177. package/dist/es/domain/models/cssCustomization.js +2 -0
  178. package/dist/es/domain/models/cssCustomization.js.map +1 -0
  179. package/dist/es/domain/models/fitOptions.d.ts +175 -0
  180. package/dist/es/domain/models/fitOptions.d.ts.map +1 -0
  181. package/dist/es/domain/models/fitOptions.js +2 -0
  182. package/dist/es/domain/models/fitOptions.js.map +1 -0
  183. package/dist/es/domain/models/innerFloors.d.ts +42 -0
  184. package/dist/es/domain/models/innerFloors.d.ts.map +1 -0
  185. package/dist/es/domain/models/innerFloors.js +2 -0
  186. package/dist/es/domain/models/innerFloors.js.map +1 -0
  187. package/dist/es/domain/models/institution.d.ts +64 -0
  188. package/dist/es/domain/models/institution.d.ts.map +1 -0
  189. package/dist/es/domain/models/institution.js +40 -0
  190. package/dist/es/domain/models/institution.js.map +1 -0
  191. package/dist/es/domain/models/latLng.d.ts +14 -0
  192. package/dist/es/domain/models/latLng.d.ts.map +1 -0
  193. package/dist/es/domain/models/latLng.js +2 -0
  194. package/dist/es/domain/models/latLng.js.map +1 -0
  195. package/dist/es/domain/models/location.d.ts +10 -0
  196. package/dist/es/domain/models/location.d.ts.map +1 -0
  197. package/dist/es/domain/models/location.js +2 -0
  198. package/dist/es/domain/models/location.js.map +1 -0
  199. package/dist/es/domain/models/loggeable.d.ts +43 -0
  200. package/dist/es/domain/models/loggeable.d.ts.map +1 -0
  201. package/dist/es/domain/models/loggeable.js +48 -0
  202. package/dist/es/domain/models/loggeable.js.map +1 -0
  203. package/dist/es/domain/models/mapCamera.d.ts +109 -0
  204. package/dist/es/domain/models/mapCamera.d.ts.map +1 -0
  205. package/dist/es/domain/models/mapCamera.js +2 -0
  206. package/dist/es/domain/models/mapCamera.js.map +1 -0
  207. package/dist/es/domain/models/mapConfig.d.ts +238 -0
  208. package/dist/es/domain/models/mapConfig.d.ts.map +1 -0
  209. package/dist/es/domain/models/mapConfig.js +12 -0
  210. package/dist/es/domain/models/mapConfig.js.map +1 -0
  211. package/dist/es/domain/models/marker.d.ts +301 -0
  212. package/dist/es/domain/models/marker.d.ts.map +1 -0
  213. package/dist/es/domain/models/marker.js +396 -0
  214. package/dist/es/domain/models/marker.js.map +1 -0
  215. package/dist/es/domain/models/multilanguage.d.ts +27 -0
  216. package/dist/es/domain/models/multilanguage.d.ts.map +1 -0
  217. package/dist/es/domain/models/multilanguage.js +14 -0
  218. package/dist/es/domain/models/multilanguage.js.map +1 -0
  219. package/dist/es/domain/models/openingHours.d.ts +30 -0
  220. package/dist/es/domain/models/openingHours.d.ts.map +1 -0
  221. package/dist/es/domain/models/openingHours.js +2 -0
  222. package/dist/es/domain/models/openingHours.js.map +1 -0
  223. package/dist/es/domain/models/place.d.ts +167 -0
  224. package/dist/es/domain/models/place.d.ts.map +1 -0
  225. package/dist/es/domain/models/place.js +97 -0
  226. package/dist/es/domain/models/place.js.map +1 -0
  227. package/dist/es/domain/models/platform.d.ts +6 -0
  228. package/dist/es/domain/models/platform.d.ts.map +1 -0
  229. package/dist/es/domain/models/platform.js +2 -0
  230. package/dist/es/domain/models/platform.js.map +1 -0
  231. package/dist/es/domain/models/popover.d.ts +14 -0
  232. package/dist/es/domain/models/popover.d.ts.map +1 -0
  233. package/dist/es/domain/models/popover.js +2 -0
  234. package/dist/es/domain/models/popover.js.map +1 -0
  235. package/dist/es/domain/models/product.d.ts +36 -0
  236. package/dist/es/domain/models/product.d.ts.map +1 -0
  237. package/dist/es/domain/models/product.js +2 -0
  238. package/dist/es/domain/models/product.js.map +1 -0
  239. package/dist/es/domain/models/property.d.ts +172 -0
  240. package/dist/es/domain/models/property.d.ts.map +1 -0
  241. package/dist/es/domain/models/property.js +100 -0
  242. package/dist/es/domain/models/property.js.map +1 -0
  243. package/dist/es/domain/models/route.d.ts +199 -0
  244. package/dist/es/domain/models/route.d.ts.map +1 -0
  245. package/dist/es/domain/models/route.js +160 -0
  246. package/dist/es/domain/models/route.js.map +1 -0
  247. package/dist/es/domain/models/routeConfiguration.d.ts +140 -0
  248. package/dist/es/domain/models/routeConfiguration.d.ts.map +1 -0
  249. package/dist/es/domain/models/routeConfiguration.js +75 -0
  250. package/dist/es/domain/models/routeConfiguration.js.map +1 -0
  251. package/dist/es/domain/models/routeInstance.d.ts +52 -0
  252. package/dist/es/domain/models/routeInstance.d.ts.map +1 -0
  253. package/dist/es/domain/models/routeInstance.js +26 -0
  254. package/dist/es/domain/models/routeInstance.js.map +1 -0
  255. package/dist/es/domain/models/routeStyle.d.ts +47 -0
  256. package/dist/es/domain/models/routeStyle.d.ts.map +1 -0
  257. package/dist/es/domain/models/routeStyle.js +2 -0
  258. package/dist/es/domain/models/routeStyle.js.map +1 -0
  259. package/dist/es/domain/models/transport.d.ts +176 -0
  260. package/dist/es/domain/models/transport.d.ts.map +1 -0
  261. package/dist/es/domain/models/transport.js +18 -0
  262. package/dist/es/domain/models/transport.js.map +1 -0
  263. package/dist/es/domain/ports/ICache.d.ts +70 -0
  264. package/dist/es/domain/ports/ICache.d.ts.map +1 -0
  265. package/dist/es/domain/ports/ICache.js +2 -0
  266. package/dist/es/domain/ports/ICache.js.map +1 -0
  267. package/dist/es/domain/ports/IHttpClient.d.ts +77 -0
  268. package/dist/es/domain/ports/IHttpClient.d.ts.map +1 -0
  269. package/dist/es/domain/ports/IHttpClient.js +2 -0
  270. package/dist/es/domain/ports/IHttpClient.js.map +1 -0
  271. package/dist/es/domain/ports/ILogger.d.ts +61 -0
  272. package/dist/es/domain/ports/ILogger.d.ts.map +1 -0
  273. package/dist/es/domain/ports/ILogger.js +19 -0
  274. package/dist/es/domain/ports/ILogger.js.map +1 -0
  275. package/dist/es/domain/ports/index.d.ts +9 -0
  276. package/dist/es/domain/ports/index.d.ts.map +1 -0
  277. package/dist/es/domain/ports/index.js +6 -0
  278. package/dist/es/domain/ports/index.js.map +1 -0
  279. package/dist/es/index.d.ts +58 -0
  280. package/dist/es/index.d.ts.map +1 -0
  281. package/dist/es/index.js +48 -0
  282. package/dist/es/index.js.map +1 -0
  283. package/dist/es/infrastructure/cache/CacheManager.d.ts +106 -0
  284. package/dist/es/infrastructure/cache/CacheManager.d.ts.map +1 -0
  285. package/dist/es/infrastructure/cache/CacheManager.js +232 -0
  286. package/dist/es/infrastructure/cache/CacheManager.js.map +1 -0
  287. package/dist/es/infrastructure/cache/LRUCache.d.ts +70 -0
  288. package/dist/es/infrastructure/cache/LRUCache.d.ts.map +1 -0
  289. package/dist/es/infrastructure/cache/LRUCache.js +149 -0
  290. package/dist/es/infrastructure/cache/LRUCache.js.map +1 -0
  291. package/dist/es/infrastructure/cache/PersistentCache.d.ts +58 -0
  292. package/dist/es/infrastructure/cache/PersistentCache.d.ts.map +1 -0
  293. package/dist/es/infrastructure/cache/PersistentCache.js +156 -0
  294. package/dist/es/infrastructure/cache/PersistentCache.js.map +1 -0
  295. package/dist/es/infrastructure/cache/cacheConfig.d.ts +51 -0
  296. package/dist/es/infrastructure/cache/cacheConfig.d.ts.map +1 -0
  297. package/dist/es/infrastructure/cache/cacheConfig.js +66 -0
  298. package/dist/es/infrastructure/cache/cacheConfig.js.map +1 -0
  299. package/dist/es/infrastructure/http/FetchHttpClient.d.ts +41 -0
  300. package/dist/es/infrastructure/http/FetchHttpClient.d.ts.map +1 -0
  301. package/dist/es/infrastructure/http/FetchHttpClient.js +71 -0
  302. package/dist/es/infrastructure/http/FetchHttpClient.js.map +1 -0
  303. package/dist/es/infrastructure/logging/CountlyLogger.d.ts +47 -0
  304. package/dist/es/infrastructure/logging/CountlyLogger.d.ts.map +1 -0
  305. package/dist/es/infrastructure/logging/CountlyLogger.js +74 -0
  306. package/dist/es/infrastructure/logging/CountlyLogger.js.map +1 -0
  307. package/dist/es/interfaces/cache.d.ts +5 -0
  308. package/dist/es/interfaces/cache.d.ts.map +1 -0
  309. package/dist/es/interfaces/cache.js +2 -0
  310. package/dist/es/interfaces/cache.js.map +1 -0
  311. package/dist/es/interfaces/healthResponse.d.ts +17 -0
  312. package/dist/es/interfaces/healthResponse.d.ts.map +1 -0
  313. package/dist/es/interfaces/healthResponse.js +2 -0
  314. package/dist/es/interfaces/healthResponse.js.map +1 -0
  315. package/dist/es/interfaces/institutionResponse.d.ts +12 -0
  316. package/dist/es/interfaces/institutionResponse.d.ts.map +1 -0
  317. package/dist/es/interfaces/institutionResponse.js +2 -0
  318. package/dist/es/interfaces/institutionResponse.js.map +1 -0
  319. package/dist/es/interfaces/metadata.d.ts +7 -0
  320. package/dist/es/interfaces/metadata.d.ts.map +1 -0
  321. package/dist/es/interfaces/metadata.js +2 -0
  322. package/dist/es/interfaces/metadata.js.map +1 -0
  323. package/dist/es/interfaces/placeResponse.d.ts +50 -0
  324. package/dist/es/interfaces/placeResponse.d.ts.map +1 -0
  325. package/dist/es/interfaces/placeResponse.js +2 -0
  326. package/dist/es/interfaces/placeResponse.js.map +1 -0
  327. package/dist/es/interfaces/routeCacheResponse.d.ts +13 -0
  328. package/dist/es/interfaces/routeCacheResponse.d.ts.map +1 -0
  329. package/dist/es/interfaces/routeCacheResponse.js +2 -0
  330. package/dist/es/interfaces/routeCacheResponse.js.map +1 -0
  331. package/dist/es/interfaces/routeResponse.d.ts +42 -0
  332. package/dist/es/interfaces/routeResponse.d.ts.map +1 -0
  333. package/dist/es/interfaces/routeResponse.js +2 -0
  334. package/dist/es/interfaces/routeResponse.js.map +1 -0
  335. package/dist/es/interfaces/styleResponse.d.ts +5 -0
  336. package/dist/es/interfaces/styleResponse.d.ts.map +1 -0
  337. package/dist/es/interfaces/styleResponse.js +2 -0
  338. package/dist/es/interfaces/styleResponse.js.map +1 -0
  339. package/dist/es/logger/logger.d.ts +14 -0
  340. package/dist/es/logger/logger.d.ts.map +1 -0
  341. package/dist/es/logger/logger.js +84 -0
  342. package/dist/es/logger/logger.js.map +1 -0
  343. package/dist/es/logger/rollbar.d.ts +4 -0
  344. package/dist/es/logger/rollbar.d.ts.map +1 -0
  345. package/dist/es/logger/rollbar.js +20 -0
  346. package/dist/es/logger/rollbar.js.map +1 -0
  347. package/dist/es/map/map.d.ts +598 -0
  348. package/dist/es/map/map.d.ts.map +1 -0
  349. package/dist/es/map/map.js +1430 -0
  350. package/dist/es/map/map.js.map +1 -0
  351. package/dist/es/repository/repository.d.ts +65 -0
  352. package/dist/es/repository/repository.d.ts.map +1 -0
  353. package/dist/es/repository/repository.js +570 -0
  354. package/dist/es/repository/repository.js.map +1 -0
  355. package/dist/es/repository/requester.d.ts +169 -0
  356. package/dist/es/repository/requester.d.ts.map +1 -0
  357. package/dist/es/repository/requester.js +586 -0
  358. package/dist/es/repository/requester.js.map +1 -0
  359. package/dist/es/sdk.d.ts +279 -0
  360. package/dist/es/sdk.d.ts.map +1 -0
  361. package/dist/es/sdk.js +346 -0
  362. package/dist/es/sdk.js.map +1 -0
  363. package/dist/es/utils/error.d.ts +8 -0
  364. package/dist/es/utils/error.d.ts.map +1 -0
  365. package/dist/es/utils/error.js +16 -0
  366. package/dist/es/utils/error.js.map +1 -0
  367. package/dist/es/utils/images.d.ts +8 -0
  368. package/dist/es/utils/images.d.ts.map +1 -0
  369. package/dist/es/utils/images.js +22 -0
  370. package/dist/es/utils/images.js.map +1 -0
  371. package/dist/es/utils/nav-functions.d.ts +85 -0
  372. package/dist/es/utils/nav-functions.d.ts.map +1 -0
  373. package/dist/es/utils/nav-functions.js +143 -0
  374. package/dist/es/utils/nav-functions.js.map +1 -0
  375. package/dist/es/utils/opening-hours-helper.d.ts +395 -0
  376. package/dist/es/utils/opening-hours-helper.d.ts.map +1 -0
  377. package/dist/es/utils/opening-hours-helper.js +906 -0
  378. package/dist/es/utils/opening-hours-helper.js.map +1 -0
  379. package/dist/es/utils/route-utils.d.ts +28 -0
  380. package/dist/es/utils/route-utils.d.ts.map +1 -0
  381. package/dist/es/utils/route-utils.js +54 -0
  382. package/dist/es/utils/route-utils.js.map +1 -0
  383. package/dist/es/utils/update-css.d.ts +12 -0
  384. package/dist/es/utils/update-css.d.ts.map +1 -0
  385. package/dist/es/utils/update-css.js +73 -0
  386. package/dist/es/utils/update-css.js.map +1 -0
  387. package/dist/es/utils/utils.d.ts +39 -0
  388. package/dist/es/utils/utils.d.ts.map +1 -0
  389. package/dist/es/utils/utils.js +97 -0
  390. package/dist/es/utils/utils.js.map +1 -0
  391. package/dist/umd/index.js +16874 -0
  392. package/dist/umd/index.js.map +1 -0
  393. package/dist/umd/styles.css +107 -0
  394. package/dist/umd/styles.css.map +1 -0
  395. package/dist/umd/styles.js +37 -0
  396. package/dist/umd/styles.js.map +1 -0
  397. package/package.json +198 -0
@@ -0,0 +1,1054 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RouteController = void 0;
4
+ const marker_1 = require("../domain/models/marker");
5
+ const nav_functions_1 = require("../utils/nav-functions");
6
+ const utils_1 = require("../utils/utils");
7
+ const routeInstance_1 = require("../domain/models/routeInstance");
8
+ /**
9
+ * Default padding values for auto-fit by place feature.
10
+ * Used when padding is not explicitly provided in the animation configuration.
11
+ */
12
+ const DEFAULT_AUTO_FIT_PADDING = {
13
+ top: 150,
14
+ right: 150,
15
+ bottom: 150,
16
+ left: 150,
17
+ };
18
+ /**
19
+ * Represents the controller for routes on the map.
20
+ * Supports multiple simultaneous routes with independent customizations,
21
+ * animations, and lifecycle management.
22
+ * @group Routes
23
+ */
24
+ class RouteController {
25
+ constructor(map) {
26
+ this.routes = new Map();
27
+ this.mapvxMap = map;
28
+ }
29
+ get map() {
30
+ return this.mapvxMap.map;
31
+ }
32
+ /**
33
+ * Resolve a route instance by ID, or fall back to the last added route.
34
+ */
35
+ resolveInstance(routeId) {
36
+ const id = routeId !== null && routeId !== void 0 ? routeId : this.lastAddedRouteId;
37
+ return id ? this.routes.get(id) : undefined;
38
+ }
39
+ /**
40
+ * Add MapLibre sources and layers for a single route instance.
41
+ */
42
+ addSourcesAndLayersForRoute(instance) {
43
+ this.map.addSource(instance.aheadId, {
44
+ type: "geojson",
45
+ data: instance.aheadSourceData,
46
+ });
47
+ this.map.addLayer({
48
+ id: instance.aheadId,
49
+ type: "line",
50
+ source: instance.aheadId,
51
+ layout: {
52
+ "line-join": "round",
53
+ "line-cap": "round",
54
+ },
55
+ });
56
+ this.map.addSource(instance.behindId, {
57
+ type: "geojson",
58
+ data: instance.behindSourceData,
59
+ });
60
+ this.map.addLayer({
61
+ id: instance.behindId,
62
+ type: "line",
63
+ source: instance.behindId,
64
+ layout: {
65
+ "line-join": "round",
66
+ "line-cap": "round",
67
+ },
68
+ });
69
+ this.map.addSource(instance.currentId, {
70
+ type: "geojson",
71
+ data: instance.currentSourceData,
72
+ });
73
+ this.map.addLayer({
74
+ id: instance.currentId,
75
+ type: "line",
76
+ source: instance.currentId,
77
+ layout: {
78
+ "line-join": "round",
79
+ "line-cap": "round",
80
+ },
81
+ });
82
+ }
83
+ /**
84
+ * Remove MapLibre sources and layers for a single route instance.
85
+ */
86
+ removeSourcesAndLayersForRoute(instance) {
87
+ const ids = [instance.aheadId, instance.behindId, instance.currentId];
88
+ for (const id of ids) {
89
+ try {
90
+ this.map.removeLayer(id);
91
+ }
92
+ catch (_a) {
93
+ // Layer may not exist
94
+ }
95
+ try {
96
+ this.map.removeSource(id);
97
+ }
98
+ catch (_b) {
99
+ // Source may not exist
100
+ }
101
+ }
102
+ }
103
+ /**
104
+ * Re-add sources and layers for all active routes.
105
+ * Should be called when the map style is reloaded.
106
+ */
107
+ addSourcesAndLayers() {
108
+ for (const instance of this.routes.values()) {
109
+ this.addSourcesAndLayersForRoute(instance);
110
+ }
111
+ }
112
+ /**
113
+ * Add a route to the map.
114
+ * @param route The route to add.
115
+ * @param drawConfig The draw configuration for the route.
116
+ */
117
+ addRoute(route, drawConfig) {
118
+ const instance = (0, routeInstance_1.createRouteInstance)(route);
119
+ this.routes.set(instance.id, instance);
120
+ this.lastAddedRouteId = instance.id;
121
+ this.addSourcesAndLayersForRoute(instance);
122
+ this.setSourceData(instance, instance.aheadId, route.steps);
123
+ this.setLayerPaint(instance.aheadId, drawConfig);
124
+ this.updateLayerFilter(instance.aheadId);
125
+ }
126
+ /**
127
+ * Update the visual progress of a route based on an external user position.
128
+ * Splits the route into behind (already traveled) and ahead (remaining) sections
129
+ * at the point on the route closest to the given position.
130
+ *
131
+ * @param routeId The ID of the route to update.
132
+ * @param position The current user position (will be projected onto the route).
133
+ * @param behindDrawConfig The draw configuration for the behind (traveled) portion.
134
+ */
135
+ updateRouteProgress(routeId, position, behindDrawConfig) {
136
+ const instance = this.routes.get(routeId);
137
+ if (!instance)
138
+ return;
139
+ const route = instance.route;
140
+ const steps = route.steps;
141
+ // Find the closest point on the route to the position
142
+ let bestDist = Infinity;
143
+ let bestStepIndex = 0;
144
+ let bestCoordIndex = 0;
145
+ let bestFraction = 0;
146
+ for (let s = 0; s < steps.length; s++) {
147
+ const coords = steps[s].coordinates;
148
+ for (let c = 0; c < coords.length - 1; c++) {
149
+ const a = coords[c];
150
+ const b = coords[c + 1];
151
+ const { fraction, dist } = this.projectPointToSegment(position, a, b);
152
+ if (dist < bestDist) {
153
+ bestDist = dist;
154
+ bestStepIndex = s;
155
+ bestCoordIndex = c;
156
+ bestFraction = fraction;
157
+ }
158
+ }
159
+ }
160
+ // Build behind features: all complete steps before the best step,
161
+ // plus the partial segment of the current step up to the projected point
162
+ const behindFeatures = [];
163
+ for (let s = 0; s < bestStepIndex; s++) {
164
+ behindFeatures.push({
165
+ type: "Feature",
166
+ properties: { floor_key: this.getFloorKeyForStep(steps[s]) },
167
+ geometry: {
168
+ type: "LineString",
169
+ coordinates: steps[s].geoJsonCoordinates,
170
+ },
171
+ });
172
+ }
173
+ // Partial behind feature for the current step (up to projected point)
174
+ const currentStep = steps[bestStepIndex];
175
+ const currentCoords = currentStep.coordinates;
176
+ const partialBehindCoords = [];
177
+ for (let c = 0; c <= bestCoordIndex; c++) {
178
+ partialBehindCoords.push([currentCoords[c].lng, currentCoords[c].lat]);
179
+ }
180
+ // Add the projected point
181
+ const a = currentCoords[bestCoordIndex];
182
+ const b = currentCoords[Math.min(bestCoordIndex + 1, currentCoords.length - 1)];
183
+ const projLat = a.lat + bestFraction * (b.lat - a.lat);
184
+ const projLng = a.lng + bestFraction * (b.lng - a.lng);
185
+ partialBehindCoords.push([projLng, projLat]);
186
+ if (partialBehindCoords.length >= 2) {
187
+ behindFeatures.push({
188
+ type: "Feature",
189
+ properties: { floor_key: this.getFloorKeyForStep(currentStep) },
190
+ geometry: { type: "LineString", coordinates: partialBehindCoords },
191
+ });
192
+ }
193
+ // Build ahead features: partial remainder of current step + all remaining steps
194
+ const aheadFeatures = [];
195
+ const partialAheadCoords = [[projLng, projLat]];
196
+ for (let c = bestCoordIndex + 1; c < currentCoords.length; c++) {
197
+ partialAheadCoords.push([currentCoords[c].lng, currentCoords[c].lat]);
198
+ }
199
+ if (partialAheadCoords.length >= 2) {
200
+ aheadFeatures.push({
201
+ type: "Feature",
202
+ properties: { floor_key: this.getFloorKeyForStep(currentStep) },
203
+ geometry: { type: "LineString", coordinates: partialAheadCoords },
204
+ });
205
+ }
206
+ for (let s = bestStepIndex + 1; s < steps.length; s++) {
207
+ aheadFeatures.push({
208
+ type: "Feature",
209
+ properties: { floor_key: this.getFloorKeyForStep(steps[s]) },
210
+ geometry: {
211
+ type: "LineString",
212
+ coordinates: steps[s].geoJsonCoordinates,
213
+ },
214
+ });
215
+ }
216
+ // Update sources
217
+ instance.behindSourceData.features = behindFeatures;
218
+ const behindSource = this.map.getSource(instance.behindId);
219
+ behindSource === null || behindSource === void 0 ? void 0 : behindSource.setData(instance.behindSourceData);
220
+ instance.aheadSourceData.features = aheadFeatures;
221
+ const aheadSource = this.map.getSource(instance.aheadId);
222
+ aheadSource === null || aheadSource === void 0 ? void 0 : aheadSource.setData(instance.aheadSourceData);
223
+ // Ensure paint is set on the behind layer
224
+ this.setLayerPaint(instance.behindId, behindDrawConfig);
225
+ this.updateLayerFilter(instance.behindId);
226
+ this.updateLayerFilter(instance.aheadId);
227
+ }
228
+ /**
229
+ * Project a point onto a line segment and return the clamped fraction and squared distance.
230
+ */
231
+ projectPointToSegment(p, a, b) {
232
+ const dx = b.lng - a.lng;
233
+ const dy = b.lat - a.lat;
234
+ const lenSq = dx * dx + dy * dy;
235
+ if (lenSq === 0) {
236
+ const ddx = p.lng - a.lng;
237
+ const ddy = p.lat - a.lat;
238
+ return { fraction: 0, dist: ddx * ddx + ddy * ddy };
239
+ }
240
+ let t = ((p.lng - a.lng) * dx + (p.lat - a.lat) * dy) / lenSq;
241
+ t = Math.max(0, Math.min(1, t));
242
+ const projLng = a.lng + t * dx;
243
+ const projLat = a.lat + t * dy;
244
+ const ddx = p.lng - projLng;
245
+ const ddy = p.lat - projLat;
246
+ return { fraction: t, dist: ddx * ddx + ddy * ddy };
247
+ }
248
+ setSourceData(instance, id, steps) {
249
+ const features = this.createFeaturesFrom(steps);
250
+ const source = this.map.getSource(id);
251
+ if (id === instance.aheadId) {
252
+ instance.aheadSourceData.features = features;
253
+ source === null || source === void 0 ? void 0 : source.setData(instance.aheadSourceData);
254
+ }
255
+ else if (id === instance.behindId) {
256
+ instance.behindSourceData.features = features;
257
+ source === null || source === void 0 ? void 0 : source.setData(instance.behindSourceData);
258
+ }
259
+ }
260
+ setCurrentSourceData(instance, step) {
261
+ instance.currentSourceData.properties = {
262
+ floor_key: this.getFloorKeyForStep(step),
263
+ };
264
+ const coordinate = step === null || step === void 0 ? void 0 : step.coordinates[0];
265
+ if (coordinate != null) {
266
+ instance.currentSourceData.geometry.coordinates = [[coordinate.lng, coordinate.lat]];
267
+ }
268
+ else {
269
+ instance.currentSourceData.geometry.coordinates = [];
270
+ }
271
+ const source = this.map.getSource(instance.currentId);
272
+ source === null || source === void 0 ? void 0 : source.setData(instance.currentSourceData);
273
+ }
274
+ setLayerPaint(layerId, drawConfig) {
275
+ const paintConfig = this.preparePaintForLayer(drawConfig);
276
+ for (const property in paintConfig) {
277
+ this.map.setPaintProperty(layerId, property, paintConfig[property]);
278
+ }
279
+ }
280
+ preparePaintForLayer(drawConfig) {
281
+ if ("color" in drawConfig.routeStyle) {
282
+ // Check for propriety unique to SolidStyle
283
+ return {
284
+ "line-color": drawConfig.routeStyle.color,
285
+ "line-gradient": null,
286
+ "line-width": drawConfig.polylineWidth,
287
+ };
288
+ }
289
+ else {
290
+ // Is GradienteStyle
291
+ const { colors, positions } = drawConfig.routeStyle;
292
+ let positionsToUse = positions;
293
+ if (positionsToUse == null) {
294
+ positionsToUse = (0, utils_1.createPositionsForStops)(colors.length);
295
+ }
296
+ if (positionsToUse.length !== colors.length) {
297
+ throw new Error("Error: position array has different length than colors array");
298
+ }
299
+ const stops = (0, utils_1.createStops)(positionsToUse, colors);
300
+ const gradient = [
301
+ "interpolate",
302
+ ["linear"],
303
+ ["line-progress"],
304
+ ...stops,
305
+ ];
306
+ return {
307
+ "line-color": null,
308
+ "line-gradient": gradient,
309
+ "line-width": drawConfig.polylineWidth,
310
+ };
311
+ }
312
+ }
313
+ /**
314
+ * Update the filter of the layer referenced with a ID.
315
+ *
316
+ * @see {@link https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/#setfilter}
317
+ * @param layerId The ID for the layer.
318
+ */
319
+ updateLayerFilter(layerId, floorId) {
320
+ const newFloorId = floorId !== null && floorId !== void 0 ? floorId : this.mapvxMap.getCurrentFloor();
321
+ if (newFloorId === undefined)
322
+ return;
323
+ if (this.map.getStyle().layers.some((layer) => layer.id === layerId)) {
324
+ this.map.setFilter(layerId, ["==", ["get", "floor_key"], newFloorId]);
325
+ }
326
+ }
327
+ /**
328
+ * Determines the correct floor_key for a route step.
329
+ * Outdoor steps (without startInsideFloor) should use the outdoor floor key,
330
+ * not the current floor which might be indoor.
331
+ * Elevator steps are always drawn on startInsideFloor; floor is updated to endInsideFloor
332
+ * only when the step completes (see prepareForNextStep / animateStep).
333
+ * @param step The route step to determine the floor_key for
334
+ * @returns The floor_key string to use for the step
335
+ */
336
+ getFloorKeyForStep(step) {
337
+ var _a, _b, _c, _d, _e, _f, _g;
338
+ if (!step) {
339
+ return this.mapvxMap.getCurrentFloor();
340
+ }
341
+ // If step has startInsideFloor, use it (unless it's a non-elevator floor change step)
342
+ if (((_b = (_a = step.startInsideFloor) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
343
+ // If step changes floors (different start and end) and is not an elevator step,
344
+ // use endInsideFloor so the step is drawn on the destination floor.
345
+ // Elevator steps are drawn on startInsideFloor; floor updates on step completion.
346
+ if (((_d = (_c = step.endInsideFloor) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0 &&
347
+ step.startInsideFloor !== step.endInsideFloor &&
348
+ !step.elevatorStep) {
349
+ return step.endInsideFloor;
350
+ }
351
+ return step.startInsideFloor;
352
+ }
353
+ // If step has endInsideFloor but no startInsideFloor (entering building), use endInsideFloor
354
+ if (((_f = (_e = step.endInsideFloor) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0) > 0) {
355
+ return step.endInsideFloor;
356
+ }
357
+ // If step is outdoor (no startInsideFloor and no endInsideFloor), use outdoor floor key
358
+ const innerFloors = this.mapvxMap.getInnerFloors();
359
+ const outdoorFloor = innerFloors.find((floor) => floor.reachableFromGPS === true);
360
+ return (_g = outdoorFloor === null || outdoorFloor === void 0 ? void 0 : outdoorFloor.key) !== null && _g !== void 0 ? _g : "";
361
+ }
362
+ createFeaturesFrom(steps) {
363
+ const features = steps.map((step) => {
364
+ return {
365
+ type: "Feature",
366
+ properties: { floor_key: this.getFloorKeyForStep(step) },
367
+ geometry: {
368
+ type: "LineString",
369
+ coordinates: step.geoJsonCoordinates,
370
+ },
371
+ };
372
+ });
373
+ return features;
374
+ }
375
+ /**
376
+ * Update the layers for all active routes.
377
+ * @param floorId The floor ID to update the layers for.
378
+ */
379
+ updateRouteLayers(floorId) {
380
+ for (const instance of this.routes.values()) {
381
+ this.updateLayerFilter(instance.aheadId, floorId);
382
+ this.updateLayerFilter(instance.behindId, floorId);
383
+ this.updateLayerFilter(instance.currentId, floorId);
384
+ }
385
+ }
386
+ /**
387
+ * Update the visibility of route markers for all active routes.
388
+ * @param floorId The floor ID to update the visibility for.
389
+ */
390
+ updateRouteMarkerVisibility(floorId) {
391
+ var _a, _b, _c;
392
+ for (const instance of this.routes.values()) {
393
+ ((_a = instance.routeMarker) === null || _a === void 0 ? void 0 : _a.floorId) === floorId
394
+ ? (_b = instance.routeMarker) === null || _b === void 0 ? void 0 : _b.show(this.map)
395
+ : (_c = instance.routeMarker) === null || _c === void 0 ? void 0 : _c.hide();
396
+ }
397
+ }
398
+ updatePlaceFloorForRouting(instance, placeId, floorKey) {
399
+ var _a;
400
+ if (placeId && floorKey) {
401
+ this.mapvxMap.updatePlaceAndFloorForRouting(placeId, floorKey);
402
+ this.updateRouteLayers(floorKey);
403
+ (_a = instance.routeMarker) === null || _a === void 0 ? void 0 : _a.setFloor(floorKey);
404
+ this.updateRouteMarkerVisibility(floorKey);
405
+ }
406
+ }
407
+ /**
408
+ * Start the animation of a route.
409
+ * @param route The route to animate.
410
+ * @param drawConfig The draw configuration for the route.
411
+ * @param animationConfig The animation configuration for the route.
412
+ */
413
+ startAnimating(route, drawConfig, animationConfig) {
414
+ var _a, _b, _c;
415
+ const instance = (0, routeInstance_1.createRouteInstance)(route);
416
+ this.routes.set(instance.id, instance);
417
+ this.lastAddedRouteId = instance.id;
418
+ instance.animationStatus = "STARTED";
419
+ instance.route = route;
420
+ const firstStep = route.steps[0];
421
+ this.addSourcesAndLayersForRoute(instance);
422
+ this.updatePlaceFloorForRouting(instance, firstStep.startInsidePlace, firstStep.startInsideFloor);
423
+ this.setSourceData(instance, instance.aheadId, route.steps);
424
+ this.setSourceData(instance, instance.behindId, []);
425
+ instance.currentSourceData.properties = {
426
+ floor_key: this.getFloorKeyForStep(firstStep),
427
+ };
428
+ instance.currentSourceData.geometry.coordinates = [
429
+ [firstStep.coordinates[0].lng, firstStep.coordinates[0].lat],
430
+ ];
431
+ this.setLayerPaint(instance.aheadId, drawConfig.aheadConfig);
432
+ this.setLayerPaint(instance.behindId, drawConfig.behindConfig);
433
+ this.setLayerPaint(instance.currentId, drawConfig.behindConfig);
434
+ instance.animationConfig = animationConfig;
435
+ instance.routeMarker = new marker_1.MarkerAttribute({
436
+ coordinate: firstStep.startLocation,
437
+ floorId: firstStep.startInsideFloor,
438
+ icon: drawConfig.routeIcon,
439
+ rotationAlignment: "map",
440
+ });
441
+ instance.routeMarker.addToMap(this.map);
442
+ // Auto-fit by place if enabled
443
+ if (((_a = animationConfig.autoFitByPlace) === null || _a === void 0 ? void 0 : _a.enabled) && route.steps.length > 0) {
444
+ if (firstStep.startInsidePlace) {
445
+ instance.currentPlaceId = firstStep.startInsidePlace;
446
+ const fitOptions = {
447
+ padding: (_b = animationConfig.autoFitByPlace.padding) !== null && _b !== void 0 ? _b : DEFAULT_AUTO_FIT_PADDING,
448
+ };
449
+ this.mapvxMap.fitRouteByPlace(route, firstStep.startInsidePlace, fitOptions);
450
+ }
451
+ }
452
+ (_c = animationConfig.callBack) === null || _c === void 0 ? void 0 : _c.call(animationConfig, { isFinished: false, step: firstStep });
453
+ instance.conditions = {
454
+ index: 0,
455
+ coordinatesIndex: 0,
456
+ iconRotation: 0,
457
+ rotatingIcon: true,
458
+ startTime: undefined,
459
+ progress: 0,
460
+ resetTime: false,
461
+ waitStartTime: undefined,
462
+ animationId: requestAnimationFrame((time) => this.animateStep(time, instance)),
463
+ onFinish: (time) => this.prepareForNextStep(time, instance),
464
+ };
465
+ }
466
+ clearRouteInstance(instance) {
467
+ var _a;
468
+ (_a = instance.routeMarker) === null || _a === void 0 ? void 0 : _a.remove();
469
+ instance.routeMarker = undefined;
470
+ this.setSourceData(instance, instance.aheadId, []);
471
+ this.setSourceData(instance, instance.behindId, []);
472
+ instance.currentSourceData.geometry.coordinates = [];
473
+ const source = this.map.getSource(instance.currentId);
474
+ source === null || source === void 0 ? void 0 : source.setData(instance.currentSourceData);
475
+ if ((instance.animationStatus === "STARTED" || instance.stepAnimationStatus === "ANIMATING") &&
476
+ instance.conditions != null) {
477
+ cancelAnimationFrame(instance.conditions.animationId);
478
+ }
479
+ instance.animationStatus = "NO_ROUTE";
480
+ instance.stepAnimationStatus = "NO_ROUTE";
481
+ instance.conditions = undefined;
482
+ instance.animationConfig = undefined;
483
+ instance.currentPlaceId = undefined;
484
+ }
485
+ /**
486
+ * Remove a route from the map.
487
+ * @param routeId The ID of the route to remove. If not provided, removes the last added route.
488
+ */
489
+ removeRoute(routeId) {
490
+ const instance = this.resolveInstance(routeId);
491
+ if (!instance)
492
+ return;
493
+ this.clearRouteInstance(instance);
494
+ this.removeSourcesAndLayersForRoute(instance);
495
+ this.routes.delete(instance.id);
496
+ if (this.lastAddedRouteId === instance.id) {
497
+ const remaining = [...this.routes.keys()];
498
+ this.lastAddedRouteId = remaining.length > 0 ? remaining[remaining.length - 1] : undefined;
499
+ }
500
+ }
501
+ /**
502
+ * Remove all routes from the map.
503
+ */
504
+ removeAllRoutes() {
505
+ for (const instance of this.routes.values()) {
506
+ this.clearRouteInstance(instance);
507
+ this.removeSourcesAndLayersForRoute(instance);
508
+ }
509
+ this.routes.clear();
510
+ this.lastAddedRouteId = undefined;
511
+ }
512
+ /**
513
+ * Get the IDs of all active routes on the map.
514
+ * @returns Array of route IDs.
515
+ */
516
+ getRouteIds() {
517
+ return [...this.routes.keys()];
518
+ }
519
+ internalPause(instance) {
520
+ if (instance.animationStatus != "STARTED")
521
+ return;
522
+ if (instance.conditions == null)
523
+ return;
524
+ cancelAnimationFrame(instance.conditions.animationId);
525
+ instance.animationStatus = "PAUSED";
526
+ }
527
+ /**
528
+ * Pause the animation of a route.
529
+ * @param routeId The ID of the route. If not provided, pauses the last added route.
530
+ */
531
+ pauseAnimation(routeId) {
532
+ const instance = this.resolveInstance(routeId);
533
+ if (!instance)
534
+ return;
535
+ this.internalPause(instance);
536
+ }
537
+ internalResume(instance) {
538
+ if (instance.animationStatus != "PAUSED")
539
+ return;
540
+ if (instance.conditions == null)
541
+ return;
542
+ instance.conditions.resetTime = true;
543
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
544
+ instance.animationStatus = "STARTED";
545
+ }
546
+ /**
547
+ * Resume the animation of a route.
548
+ * @param routeId The ID of the route. If not provided, resumes the last added route.
549
+ */
550
+ resumeAnimation(routeId) {
551
+ const instance = this.resolveInstance(routeId);
552
+ if (!instance)
553
+ return;
554
+ this.internalResume(instance);
555
+ }
556
+ /**
557
+ * Restart the animation of a route.
558
+ * @param routeId The ID of the route. If not provided, restarts the last added route.
559
+ */
560
+ restartAnimation(routeId) {
561
+ var _a, _b, _c, _d, _e;
562
+ const instance = this.resolveInstance(routeId);
563
+ if (!instance) {
564
+ throw new Error("Does not exist animated route to restart");
565
+ }
566
+ if (instance.animationStatus === "NO_ROUTE") {
567
+ throw new Error("Does not exist animated route to restart");
568
+ }
569
+ if (instance.conditions == null ||
570
+ instance.animationConfig == null ||
571
+ instance.route == null ||
572
+ instance.routeMarker == null) {
573
+ throw new Error("Error: conditions and animationConfig should not be null at this point");
574
+ }
575
+ if (instance.animationStatus === "STARTED") {
576
+ cancelAnimationFrame(instance.conditions.animationId);
577
+ }
578
+ instance.animationStatus = "STARTED";
579
+ const firstStep = instance.route.steps[0];
580
+ this.updatePlaceFloorForRouting(instance, firstStep.startInsidePlace, firstStep.startInsideFloor);
581
+ this.setSourceData(instance, instance.aheadId, instance.route.steps);
582
+ this.setSourceData(instance, instance.behindId, []);
583
+ instance.currentSourceData.properties = {
584
+ floor_key: this.getFloorKeyForStep(firstStep),
585
+ };
586
+ instance.currentSourceData.geometry.coordinates = [
587
+ [firstStep.coordinates[0].lng, firstStep.coordinates[0].lat],
588
+ ];
589
+ const source = this.map.getSource(instance.currentId);
590
+ source === null || source === void 0 ? void 0 : source.setData(instance.currentSourceData);
591
+ (_a = this.setMarkerRotation(instance, 0)) === null || _a === void 0 ? void 0 : _a.setLngLat(firstStep.startLocation).addTo(this.map);
592
+ // Auto-fit by place if enabled
593
+ if (((_b = instance.animationConfig.autoFitByPlace) === null || _b === void 0 ? void 0 : _b.enabled) && instance.route.steps.length > 0) {
594
+ if (firstStep.startInsidePlace) {
595
+ instance.currentPlaceId = firstStep.startInsidePlace;
596
+ const fitOptions = {
597
+ padding: (_c = instance.animationConfig.autoFitByPlace.padding) !== null && _c !== void 0 ? _c : DEFAULT_AUTO_FIT_PADDING,
598
+ };
599
+ this.mapvxMap.fitRouteByPlace(instance.route, firstStep.startInsidePlace, fitOptions);
600
+ }
601
+ }
602
+ (_e = (_d = instance.animationConfig).callBack) === null || _e === void 0 ? void 0 : _e.call(_d, { isFinished: false, step: firstStep });
603
+ instance.conditions = {
604
+ index: 0,
605
+ coordinatesIndex: 0,
606
+ iconRotation: 0,
607
+ rotatingIcon: true,
608
+ startTime: undefined,
609
+ progress: 0,
610
+ resetTime: false,
611
+ waitStartTime: undefined,
612
+ animationId: requestAnimationFrame((time) => this.animateStep(time, instance)),
613
+ onFinish: (time) => this.prepareForNextStep(time, instance),
614
+ };
615
+ }
616
+ /**
617
+ * Stop the animation of a route.
618
+ * @param routeId The ID of the route. If not provided, stops the last added route.
619
+ */
620
+ stopAnimation(routeId) {
621
+ const instance = this.resolveInstance(routeId);
622
+ if (!instance)
623
+ return;
624
+ if (instance.animationStatus == "FINISHED") {
625
+ return;
626
+ }
627
+ // todo hacer cosas para detener animación
628
+ instance.animationStatus = "FINISHED";
629
+ }
630
+ /**
631
+ * Add a step animation to a route.
632
+ * @param route The route to animate.
633
+ * @param drawConfig The draw configuration for the route.
634
+ * @param animationConfig The animation configuration for the route.
635
+ */
636
+ addStepAnimation(route, drawConfig, animationConfig) {
637
+ var _a, _b, _c;
638
+ const instance = (0, routeInstance_1.createRouteInstance)(route);
639
+ this.routes.set(instance.id, instance);
640
+ this.lastAddedRouteId = instance.id;
641
+ instance.stepAnimationStatus = "WAITING";
642
+ instance.route = route;
643
+ const firstStep = route.steps[0];
644
+ this.addSourcesAndLayersForRoute(instance);
645
+ this.updatePlaceFloorForRouting(instance, firstStep.startInsidePlace, firstStep.startInsideFloor);
646
+ this.setSourceData(instance, instance.aheadId, route.steps);
647
+ this.setSourceData(instance, instance.behindId, []);
648
+ this.setCurrentSourceData(instance, firstStep);
649
+ this.setLayerPaint(instance.aheadId, drawConfig.aheadConfig);
650
+ this.setLayerPaint(instance.behindId, drawConfig.behindConfig);
651
+ this.setLayerPaint(instance.currentId, drawConfig.behindConfig);
652
+ instance.animationConfig = animationConfig;
653
+ instance.routeMarker = new marker_1.MarkerAttribute({
654
+ coordinate: firstStep.startLocation,
655
+ floorId: firstStep.startInsideFloor,
656
+ icon: drawConfig.routeIcon,
657
+ rotationAlignment: "map",
658
+ });
659
+ instance.routeMarker.addToMap(this.map);
660
+ this.cameraFollow(instance, firstStep.startLocation);
661
+ // Auto-fit by place if enabled
662
+ if (((_a = animationConfig.autoFitByPlace) === null || _a === void 0 ? void 0 : _a.enabled) && route.steps.length > 0) {
663
+ if (firstStep.startInsidePlace) {
664
+ instance.currentPlaceId = firstStep.startInsidePlace;
665
+ const fitOptions = {
666
+ padding: (_b = animationConfig.autoFitByPlace.padding) !== null && _b !== void 0 ? _b : DEFAULT_AUTO_FIT_PADDING,
667
+ };
668
+ this.mapvxMap.fitRouteByPlace(route, firstStep.startInsidePlace, fitOptions);
669
+ }
670
+ }
671
+ (_c = animationConfig.callBack) === null || _c === void 0 ? void 0 : _c.call(animationConfig, { isFinished: false, step: firstStep });
672
+ instance.conditions = {
673
+ index: 0,
674
+ coordinatesIndex: 0,
675
+ iconRotation: 0,
676
+ rotatingIcon: true,
677
+ startTime: undefined,
678
+ progress: 0,
679
+ resetTime: false,
680
+ waitStartTime: undefined,
681
+ animationId: 0,
682
+ isStepByStep: true,
683
+ onFinish: () => {
684
+ var _a, _b, _c, _d;
685
+ if (instance.conditions == null ||
686
+ instance.animationConfig == null ||
687
+ instance.route == null) {
688
+ throw new Error("Error: conditions, animationConfig or route should not be null at this point");
689
+ }
690
+ let { index } = instance.conditions;
691
+ index++;
692
+ const behindSteps = instance.route.steps.slice(0, index);
693
+ const aheadSteps = instance.route.steps.slice(index);
694
+ const step = instance.route.steps[index];
695
+ this.setSourceData(instance, instance.behindId, behindSteps);
696
+ this.setSourceData(instance, instance.aheadId, aheadSteps);
697
+ this.setCurrentSourceData(instance, step);
698
+ instance.conditions.index = index;
699
+ if (index < route.steps.length) {
700
+ const nextStep = route.steps[index];
701
+ // Auto-fit by place if enabled and place changed
702
+ if (((_a = animationConfig.autoFitByPlace) === null || _a === void 0 ? void 0 : _a.enabled) && nextStep && instance.route != null) {
703
+ const stepPlaceId = nextStep.startInsidePlace || nextStep.endInsidePlace;
704
+ if (stepPlaceId && stepPlaceId !== instance.currentPlaceId) {
705
+ instance.currentPlaceId = stepPlaceId;
706
+ const fitOptions = {
707
+ padding: (_b = animationConfig.autoFitByPlace.padding) !== null && _b !== void 0 ? _b : DEFAULT_AUTO_FIT_PADDING,
708
+ };
709
+ this.mapvxMap.fitRouteByPlace(instance.route, stepPlaceId, fitOptions);
710
+ }
711
+ }
712
+ (_c = animationConfig.callBack) === null || _c === void 0 ? void 0 : _c.call(animationConfig, { isFinished: false, step: nextStep });
713
+ }
714
+ else {
715
+ (_d = animationConfig.callBack) === null || _d === void 0 ? void 0 : _d.call(animationConfig, { isFinished: true, step: null });
716
+ }
717
+ instance.stepAnimationStatus = "WAITING";
718
+ },
719
+ };
720
+ }
721
+ /**
722
+ * Animate the next step of a route.
723
+ * @param routeId The ID of the route. If not provided, uses the last added route.
724
+ */
725
+ nextStepAnimation(routeId) {
726
+ const instance = this.resolveInstance(routeId);
727
+ if (!instance) {
728
+ throw new Error("Error: Does not exist step animation");
729
+ }
730
+ if (instance.stepAnimationStatus === "NO_ROUTE") {
731
+ throw new Error("Error: Does not exist step animation");
732
+ }
733
+ if (instance.conditions == null || instance.animationConfig == null || instance.route == null) {
734
+ throw new Error("Error: conditions, animationConfig or route should not be null at this point");
735
+ }
736
+ if (instance.stepAnimationStatus === "ANIMATING") {
737
+ cancelAnimationFrame(instance.conditions.animationId);
738
+ }
739
+ instance.stepAnimationStatus = "ANIMATING";
740
+ const { index } = instance.conditions;
741
+ if (index < instance.route.steps.length) {
742
+ instance.conditions.coordinatesIndex = 0;
743
+ instance.conditions.startTime = undefined;
744
+ instance.conditions.progress = 0;
745
+ instance.conditions.rotatingIcon = true;
746
+ instance.conditions.waitStartTime = undefined;
747
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
748
+ }
749
+ else {
750
+ throw new Error("Error: Does not exist next step to animate");
751
+ }
752
+ }
753
+ /**
754
+ * Go to the previous step of a route.
755
+ * @param routeId The ID of the route. If not provided, uses the last added route.
756
+ */
757
+ previousStepAnimation(routeId) {
758
+ var _a, _b, _c, _d;
759
+ const instance = this.resolveInstance(routeId);
760
+ if (!instance) {
761
+ throw new Error("Error: Does not exist step animation");
762
+ }
763
+ if (instance.stepAnimationStatus === "NO_ROUTE") {
764
+ throw new Error("Error: Does not exist step animation");
765
+ }
766
+ if (instance.conditions == null || instance.animationConfig == null || instance.route == null) {
767
+ throw new Error("Error: conditions, animationConfig or route should not be null at this point");
768
+ }
769
+ if (instance.stepAnimationStatus === "ANIMATING") {
770
+ cancelAnimationFrame(instance.conditions.animationId);
771
+ }
772
+ instance.stepAnimationStatus = "WAITING";
773
+ let { index } = instance.conditions;
774
+ if (index > 0) {
775
+ index--;
776
+ const behindSteps = instance.route.steps.slice(0, index);
777
+ const aheadSteps = instance.route.steps.slice(index);
778
+ const step = instance.route.steps[index];
779
+ this.setSourceData(instance, instance.behindId, behindSteps);
780
+ this.setSourceData(instance, instance.aheadId, aheadSteps);
781
+ this.setCurrentSourceData(instance, step);
782
+ if (step.startInsideFloor != step.endInsideFloor && step.startInsideFloor) {
783
+ this.updatePlaceFloorForRouting(instance, step.startInsidePlace, step.startInsideFloor);
784
+ }
785
+ instance.conditions.index = index;
786
+ instance.conditions.coordinatesIndex = 0;
787
+ instance.conditions.startTime = undefined;
788
+ instance.conditions.progress = 0;
789
+ instance.conditions.rotatingIcon = true;
790
+ instance.conditions.waitStartTime = undefined;
791
+ this.setMarkerLngLat(instance, step.startLocation);
792
+ const previous = behindSteps.at(-1);
793
+ if (previous != null) {
794
+ const coordinates = previous.coordinates.slice(-2);
795
+ const angle = nav_functions_1.NavFunctions.bearingInDegBetween(coordinates[0], coordinates[1]);
796
+ this.setMarkerRotation(instance, angle);
797
+ }
798
+ else {
799
+ this.setMarkerRotation(instance, 0);
800
+ }
801
+ // Auto-fit by place if enabled and place changed
802
+ if (((_a = instance.animationConfig.autoFitByPlace) === null || _a === void 0 ? void 0 : _a.enabled) && step && instance.route != null) {
803
+ const stepPlaceId = step.startInsidePlace || step.endInsidePlace;
804
+ if (stepPlaceId && stepPlaceId !== instance.currentPlaceId) {
805
+ instance.currentPlaceId = stepPlaceId;
806
+ const fitOptions = {
807
+ padding: (_b = instance.animationConfig.autoFitByPlace.padding) !== null && _b !== void 0 ? _b : DEFAULT_AUTO_FIT_PADDING,
808
+ };
809
+ this.mapvxMap.fitRouteByPlace(instance.route, stepPlaceId, fitOptions);
810
+ }
811
+ }
812
+ (_d = (_c = instance.animationConfig).callBack) === null || _d === void 0 ? void 0 : _d.call(_c, {
813
+ isFinished: false,
814
+ step,
815
+ });
816
+ }
817
+ else {
818
+ throw new Error("previous step doesn't exists to animate");
819
+ }
820
+ }
821
+ /**
822
+ * Center on the current step of a route.
823
+ * @param routeId The ID of the route. If not provided, uses the last added route.
824
+ */
825
+ centerOnCurrentStep(routeId) {
826
+ var _a;
827
+ const instance = this.resolveInstance(routeId);
828
+ if (!instance) {
829
+ throw new Error("Error: Does not exist step animation");
830
+ }
831
+ if (instance.stepAnimationStatus === "NO_ROUTE") {
832
+ throw new Error("Error: Does not exist step animation");
833
+ }
834
+ if (instance.conditions == null || instance.animationConfig == null || instance.route == null) {
835
+ throw new Error("Error: conditions, animationConfig or route should not be null at this point");
836
+ }
837
+ const currentMarkerPosition = (_a = instance.routeMarker) === null || _a === void 0 ? void 0 : _a.getLngLat();
838
+ if (currentMarkerPosition) {
839
+ this.map.panTo(currentMarkerPosition);
840
+ }
841
+ else {
842
+ throw new Error("Error: marker has no position set");
843
+ }
844
+ }
845
+ prepareForNextStep(timestamp, instance) {
846
+ var _a, _b, _c, _d, _e, _f;
847
+ if (instance.conditions == null || instance.animationConfig == null || instance.route == null) {
848
+ throw new Error("Error: conditions, animationConfig or route should not be null at this point");
849
+ }
850
+ const { index } = instance.conditions;
851
+ const behindSteps = instance.route.steps.slice(0, index + 1);
852
+ const aheadSteps = instance.route.steps.slice(index + 1);
853
+ this.setSourceData(instance, instance.behindId, behindSteps);
854
+ this.setSourceData(instance, instance.aheadId, aheadSteps);
855
+ instance.currentSourceData.geometry.coordinates = [];
856
+ if (index + 1 < instance.route.steps.length) {
857
+ const step = instance.route.steps[index + 1];
858
+ instance.currentSourceData.geometry.coordinates.push([
859
+ step.startLocation.lng,
860
+ step.startLocation.lat,
861
+ ]);
862
+ instance.currentSourceData.properties = {
863
+ floor_key: this.getFloorKeyForStep(step),
864
+ };
865
+ instance.conditions.startTime = timestamp;
866
+ instance.conditions.index++;
867
+ instance.conditions.coordinatesIndex = 0;
868
+ instance.conditions.progress = 0;
869
+ instance.conditions.rotatingIcon = true;
870
+ if (!(0, nav_functions_1.compareLatLng)(instance.route.steps[index].endLocation, step.startLocation))
871
+ instance.conditions.nextFloorFirstStepIndex = index + 2;
872
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
873
+ // Auto-fit by place if enabled and place changed
874
+ if (((_a = instance.animationConfig.autoFitByPlace) === null || _a === void 0 ? void 0 : _a.enabled) && step && instance.route != null) {
875
+ const stepPlaceId = step.startInsidePlace || step.endInsidePlace;
876
+ if (stepPlaceId && stepPlaceId !== instance.currentPlaceId) {
877
+ instance.currentPlaceId = stepPlaceId;
878
+ const fitOptions = {
879
+ padding: (_b = instance.animationConfig.autoFitByPlace.padding) !== null && _b !== void 0 ? _b : DEFAULT_AUTO_FIT_PADDING,
880
+ };
881
+ this.mapvxMap.fitRouteByPlace(instance.route, stepPlaceId, fitOptions);
882
+ }
883
+ }
884
+ (_d = (_c = instance.animationConfig).callBack) === null || _d === void 0 ? void 0 : _d.call(_c, {
885
+ isFinished: false,
886
+ step: instance.route.steps[index + 1],
887
+ });
888
+ }
889
+ else {
890
+ // finishes animation
891
+ (_f = (_e = instance.animationConfig).callBack) === null || _f === void 0 ? void 0 : _f.call(_e, { isFinished: true, step: null });
892
+ instance.animationStatus = "FINISHED";
893
+ }
894
+ }
895
+ animateStep(timestamp, instance) {
896
+ var _a, _b;
897
+ if (instance.conditions == null || instance.animationConfig == null || instance.route == null) {
898
+ throw new Error("Error: conditions and animationConfig should not be null at this point");
899
+ }
900
+ let { startTime, resetTime, progress } = instance.conditions;
901
+ const { coordinatesIndex, iconRotation, index, onFinish, rotatingIcon, waitStartTime } = instance.conditions;
902
+ const { stepTime, minimumSpeed, iconRotationTime, changeFloorTime } = instance.animationConfig;
903
+ if (startTime == null) {
904
+ instance.conditions.startTime = timestamp;
905
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
906
+ return;
907
+ }
908
+ if (resetTime) {
909
+ startTime = timestamp - progress;
910
+ instance.conditions.startTime = startTime;
911
+ resetTime = false;
912
+ instance.conditions.resetTime = resetTime;
913
+ }
914
+ else {
915
+ progress = timestamp - startTime;
916
+ instance.conditions.progress = progress;
917
+ }
918
+ const progressInSeconds = progress / 1000;
919
+ const step = instance.route.steps[index];
920
+ if (step.coordinates.length <= 0) {
921
+ onFinish === null || onFinish === void 0 ? void 0 : onFinish(timestamp);
922
+ return;
923
+ }
924
+ const start = step.coordinates[coordinatesIndex];
925
+ const end = step.coordinates[coordinatesIndex + 1];
926
+ if (start != null && end != null) {
927
+ if (rotatingIcon) {
928
+ const angle = nav_functions_1.NavFunctions.bearingInDegBetween(start, end);
929
+ if (iconRotationTime === 0 ||
930
+ instance.conditions.nextFloorFirstStepIndex === index ||
931
+ Math.abs(angle - instance.conditions.iconRotation) < 15) {
932
+ instance.conditions.nextFloorFirstStepIndex = undefined;
933
+ this.setMarkerRotation(instance, angle);
934
+ instance.conditions.startTime = timestamp;
935
+ instance.conditions.rotatingIcon = false;
936
+ instance.conditions.iconRotation = angle;
937
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
938
+ return;
939
+ }
940
+ else if (progressInSeconds < iconRotationTime) {
941
+ const intermediateAngle = nav_functions_1.NavFunctions.intermediateAngleBetween(iconRotation, angle, progressInSeconds / iconRotationTime);
942
+ this.setMarkerRotation(instance, intermediateAngle);
943
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
944
+ return;
945
+ }
946
+ else {
947
+ this.setMarkerRotation(instance, angle);
948
+ instance.conditions.startTime = timestamp;
949
+ instance.conditions.rotatingIcon = false;
950
+ instance.conditions.iconRotation = angle;
951
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
952
+ return;
953
+ }
954
+ }
955
+ const distance = nav_functions_1.NavFunctions.distance(start, end);
956
+ const speed = Math.max(step.distance / stepTime, minimumSpeed !== null && minimumSpeed !== void 0 ? minimumSpeed : 0);
957
+ if (speed * progressInSeconds > distance) {
958
+ instance.currentSourceData.geometry.coordinates.push([end.lng, end.lat]);
959
+ const source = this.map.getSource(instance.currentId);
960
+ source === null || source === void 0 ? void 0 : source.setData(instance.currentSourceData);
961
+ if (coordinatesIndex + 2 < step.coordinates.length) {
962
+ const next = step.coordinates[coordinatesIndex + 2];
963
+ if (!(0, nav_functions_1.compareLatLng)(end, next)) {
964
+ if (instance.conditions.isStepByStep) {
965
+ instance.conditions.rotatingIcon = true;
966
+ }
967
+ else {
968
+ const nextAngle = nav_functions_1.NavFunctions.bearingInDegBetween(end, next);
969
+ instance.conditions.iconRotation = nextAngle;
970
+ (_a = instance.routeMarker) === null || _a === void 0 ? void 0 : _a.setRotation(nextAngle);
971
+ }
972
+ }
973
+ instance.conditions.startTime = timestamp;
974
+ instance.conditions.progress = 0;
975
+ instance.conditions.coordinatesIndex++;
976
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
977
+ return;
978
+ }
979
+ else if (step.startInsideFloor !== step.endInsideFloor) {
980
+ if (waitStartTime == null) {
981
+ instance.conditions.waitStartTime = timestamp;
982
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
983
+ return;
984
+ }
985
+ if (timestamp - waitStartTime < changeFloorTime * 1000) {
986
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
987
+ return;
988
+ }
989
+ else {
990
+ this.updatePlaceFloorForRouting(instance, step.endInsidePlace, step.endInsideFloor);
991
+ this.setMarkerLngLat(instance, step.endLocation);
992
+ instance.conditions.waitStartTime = undefined;
993
+ onFinish === null || onFinish === void 0 ? void 0 : onFinish(timestamp);
994
+ return;
995
+ }
996
+ }
997
+ else {
998
+ onFinish === null || onFinish === void 0 ? void 0 : onFinish(timestamp);
999
+ return;
1000
+ }
1001
+ }
1002
+ const fraction = (speed * progressInSeconds) / distance;
1003
+ const point = distance === 0
1004
+ ? end
1005
+ : nav_functions_1.NavFunctions.intermediatePointBetween(start, end, Math.min(fraction, 1));
1006
+ instance.currentSourceData.geometry.coordinates.push([point.lng, point.lat]);
1007
+ const source = this.map.getSource(instance.currentId);
1008
+ source === null || source === void 0 ? void 0 : source.setData(instance.currentSourceData);
1009
+ this.setMarkerLngLat(instance, point);
1010
+ (_b = instance.routeMarker) === null || _b === void 0 ? void 0 : _b.addTo(this.map);
1011
+ instance.conditions.animationId = requestAnimationFrame((time) => this.animateStep(time, instance));
1012
+ return;
1013
+ }
1014
+ else {
1015
+ onFinish === null || onFinish === void 0 ? void 0 : onFinish(timestamp);
1016
+ return;
1017
+ }
1018
+ }
1019
+ setMarkerLngLat(instance, point) {
1020
+ var _a, _b;
1021
+ if ((_a = instance.conditions) === null || _a === void 0 ? void 0 : _a.isStepByStep) {
1022
+ this.cameraFollow(instance, point);
1023
+ }
1024
+ (_b = instance.routeMarker) === null || _b === void 0 ? void 0 : _b.setLngLat(point);
1025
+ }
1026
+ setMarkerRotation(instance, angle) {
1027
+ var _a, _b, _c, _d;
1028
+ if ((_a = instance.conditions) === null || _a === void 0 ? void 0 : _a.isStepByStep) {
1029
+ this.mapvxMap.updateCamera({
1030
+ duration: (_b = instance.animationConfig) === null || _b === void 0 ? void 0 : _b.iconRotationTime,
1031
+ animate: true,
1032
+ bearing: angle,
1033
+ center: (_c = instance.routeMarker) === null || _c === void 0 ? void 0 : _c.getLngLat(),
1034
+ });
1035
+ }
1036
+ return (_d = instance.routeMarker) === null || _d === void 0 ? void 0 : _d.setRotation(angle);
1037
+ }
1038
+ setMarkerFloor(floorId, routeId) {
1039
+ var _a;
1040
+ const instance = this.resolveInstance(routeId);
1041
+ (_a = instance === null || instance === void 0 ? void 0 : instance.routeMarker) === null || _a === void 0 ? void 0 : _a.setFloor(floorId);
1042
+ }
1043
+ cameraFollow(instance, point) {
1044
+ var _a, _b;
1045
+ this.mapvxMap.updateCamera({
1046
+ center: point,
1047
+ animate: true,
1048
+ bearing: (_a = instance.routeMarker) === null || _a === void 0 ? void 0 : _a.getRotation(),
1049
+ duration: (_b = instance.animationConfig) === null || _b === void 0 ? void 0 : _b.iconRotationTime,
1050
+ });
1051
+ }
1052
+ }
1053
+ exports.RouteController = RouteController;
1054
+ //# sourceMappingURL=routeController.js.map