@mountaya/elements 0.0.0-stage → 0.1.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 (831) hide show
  1. package/CHANGELOG.md +235 -0
  2. package/LICENCE.fr.txt +280 -0
  3. package/LICENSE.txt +262 -0
  4. package/README.md +1509 -2
  5. package/THIRD-PARTY-NOTICES.txt +103 -0
  6. package/dist/accentColor-GNKBD2CW.js +4 -0
  7. package/dist/accentColor-GNKBD2CW.js.map +1 -0
  8. package/dist/accentColor-VX2JSMGE.cjs +17 -0
  9. package/dist/accentColor-VX2JSMGE.cjs.map +1 -0
  10. package/dist/agent/index.cjs +1964 -0
  11. package/dist/agent/index.cjs.map +1 -0
  12. package/dist/agent/index.d.cts +2016 -0
  13. package/dist/agent/index.d.ts +2016 -0
  14. package/dist/agent/index.js +1937 -0
  15. package/dist/agent/index.js.map +1 -0
  16. package/dist/amenities-B3-qAjxu.d.cts +160 -0
  17. package/dist/amenities-B3-qAjxu.d.ts +160 -0
  18. package/dist/bundle-Je5zsRFg.d.cts +222 -0
  19. package/dist/bundle-xYrrbJTH.d.ts +222 -0
  20. package/dist/camera/index.cjs +3477 -0
  21. package/dist/camera/index.cjs.map +1 -0
  22. package/dist/camera/index.d.cts +1751 -0
  23. package/dist/camera/index.d.ts +1751 -0
  24. package/dist/camera/index.js +3328 -0
  25. package/dist/camera/index.js.map +1 -0
  26. package/dist/camera-BrFLU1DH.d.cts +549 -0
  27. package/dist/camera-C48Ykaxv.d.ts +549 -0
  28. package/dist/chunk-23PFRRB6.js +3 -0
  29. package/dist/chunk-23PFRRB6.js.map +1 -0
  30. package/dist/chunk-2GI5SAH2.js +71 -0
  31. package/dist/chunk-2GI5SAH2.js.map +1 -0
  32. package/dist/chunk-2MQK6A74.js +39 -0
  33. package/dist/chunk-2MQK6A74.js.map +1 -0
  34. package/dist/chunk-2RE7R4LD.js +73 -0
  35. package/dist/chunk-2RE7R4LD.js.map +1 -0
  36. package/dist/chunk-3JZQKN4O.js +6 -0
  37. package/dist/chunk-3JZQKN4O.js.map +1 -0
  38. package/dist/chunk-3NDXVUUI.js +50 -0
  39. package/dist/chunk-3NDXVUUI.js.map +1 -0
  40. package/dist/chunk-3R4GFTUM.cjs +59 -0
  41. package/dist/chunk-3R4GFTUM.cjs.map +1 -0
  42. package/dist/chunk-3RVUQ6JN.cjs +22 -0
  43. package/dist/chunk-3RVUQ6JN.cjs.map +1 -0
  44. package/dist/chunk-4F6BJMJC.cjs +49 -0
  45. package/dist/chunk-4F6BJMJC.cjs.map +1 -0
  46. package/dist/chunk-4NWQD4BX.js +132 -0
  47. package/dist/chunk-4NWQD4BX.js.map +1 -0
  48. package/dist/chunk-5K2MH3R6.js +10 -0
  49. package/dist/chunk-5K2MH3R6.js.map +1 -0
  50. package/dist/chunk-6ACRNQQQ.cjs +8 -0
  51. package/dist/chunk-6ACRNQQQ.cjs.map +1 -0
  52. package/dist/chunk-6D26E3IA.js +66 -0
  53. package/dist/chunk-6D26E3IA.js.map +1 -0
  54. package/dist/chunk-6ESAW35P.cjs +80 -0
  55. package/dist/chunk-6ESAW35P.cjs.map +1 -0
  56. package/dist/chunk-6LIW2A5M.cjs +1176 -0
  57. package/dist/chunk-6LIW2A5M.cjs.map +1 -0
  58. package/dist/chunk-6OTTWVCA.js +57 -0
  59. package/dist/chunk-6OTTWVCA.js.map +1 -0
  60. package/dist/chunk-6VROJ4UG.js +862 -0
  61. package/dist/chunk-6VROJ4UG.js.map +1 -0
  62. package/dist/chunk-6Y7FTGO4.js +23 -0
  63. package/dist/chunk-6Y7FTGO4.js.map +1 -0
  64. package/dist/chunk-75I4CG64.js +104 -0
  65. package/dist/chunk-75I4CG64.js.map +1 -0
  66. package/dist/chunk-7CUBXHAH.cjs +14 -0
  67. package/dist/chunk-7CUBXHAH.cjs.map +1 -0
  68. package/dist/chunk-7GTCURVY.js +52 -0
  69. package/dist/chunk-7GTCURVY.js.map +1 -0
  70. package/dist/chunk-7IWOL6AM.cjs +100 -0
  71. package/dist/chunk-7IWOL6AM.cjs.map +1 -0
  72. package/dist/chunk-7QN7M667.cjs +151 -0
  73. package/dist/chunk-7QN7M667.cjs.map +1 -0
  74. package/dist/chunk-A6KQDKLM.cjs +1197 -0
  75. package/dist/chunk-A6KQDKLM.cjs.map +1 -0
  76. package/dist/chunk-A77EA67G.js +354 -0
  77. package/dist/chunk-A77EA67G.js.map +1 -0
  78. package/dist/chunk-AFKOABJ4.cjs +7194 -0
  79. package/dist/chunk-AFKOABJ4.cjs.map +1 -0
  80. package/dist/chunk-AG6JV5Z2.cjs +183 -0
  81. package/dist/chunk-AG6JV5Z2.cjs.map +1 -0
  82. package/dist/chunk-APBK7NMS.js +30 -0
  83. package/dist/chunk-APBK7NMS.js.map +1 -0
  84. package/dist/chunk-AWO5YA7A.cjs +33 -0
  85. package/dist/chunk-AWO5YA7A.cjs.map +1 -0
  86. package/dist/chunk-AZATU6QW.js +108 -0
  87. package/dist/chunk-AZATU6QW.js.map +1 -0
  88. package/dist/chunk-BD2U3WST.cjs +623 -0
  89. package/dist/chunk-BD2U3WST.cjs.map +1 -0
  90. package/dist/chunk-BHBEOU6L.cjs +65 -0
  91. package/dist/chunk-BHBEOU6L.cjs.map +1 -0
  92. package/dist/chunk-CNOSNYNE.js +8 -0
  93. package/dist/chunk-CNOSNYNE.js.map +1 -0
  94. package/dist/chunk-CW3EFR4O.js +12 -0
  95. package/dist/chunk-CW3EFR4O.js.map +1 -0
  96. package/dist/chunk-DASVRNBK.js +7187 -0
  97. package/dist/chunk-DASVRNBK.js.map +1 -0
  98. package/dist/chunk-DJ6LCKYP.js +42 -0
  99. package/dist/chunk-DJ6LCKYP.js.map +1 -0
  100. package/dist/chunk-E5FHQAIO.cjs +45 -0
  101. package/dist/chunk-E5FHQAIO.cjs.map +1 -0
  102. package/dist/chunk-EOML5OTY.cjs +360 -0
  103. package/dist/chunk-EOML5OTY.cjs.map +1 -0
  104. package/dist/chunk-EP5CASHL.js +613 -0
  105. package/dist/chunk-EP5CASHL.js.map +1 -0
  106. package/dist/chunk-EP5OEEVZ.cjs +14 -0
  107. package/dist/chunk-EP5OEEVZ.cjs.map +1 -0
  108. package/dist/chunk-EUXI3FGQ.js +150 -0
  109. package/dist/chunk-EUXI3FGQ.js.map +1 -0
  110. package/dist/chunk-EWFSHCOS.js +40 -0
  111. package/dist/chunk-EWFSHCOS.js.map +1 -0
  112. package/dist/chunk-EX2C5K2T.cjs +25 -0
  113. package/dist/chunk-EX2C5K2T.cjs.map +1 -0
  114. package/dist/chunk-FEXWDQIZ.cjs +8 -0
  115. package/dist/chunk-FEXWDQIZ.cjs.map +1 -0
  116. package/dist/chunk-FEYBFY7H.cjs +358 -0
  117. package/dist/chunk-FEYBFY7H.cjs.map +1 -0
  118. package/dist/chunk-FRGAV6N6.cjs +34 -0
  119. package/dist/chunk-FRGAV6N6.cjs.map +1 -0
  120. package/dist/chunk-G5DHP5VF.js +6 -0
  121. package/dist/chunk-G5DHP5VF.js.map +1 -0
  122. package/dist/chunk-G5W2UHV2.js +99 -0
  123. package/dist/chunk-G5W2UHV2.js.map +1 -0
  124. package/dist/chunk-G7OP7O2C.cjs +39 -0
  125. package/dist/chunk-G7OP7O2C.cjs.map +1 -0
  126. package/dist/chunk-GE6CFCAM.cjs +25 -0
  127. package/dist/chunk-GE6CFCAM.cjs.map +1 -0
  128. package/dist/chunk-GIFALLHI.cjs +111 -0
  129. package/dist/chunk-GIFALLHI.cjs.map +1 -0
  130. package/dist/chunk-GLFET5GM.js +129 -0
  131. package/dist/chunk-GLFET5GM.js.map +1 -0
  132. package/dist/chunk-GQ6UFPFM.js +22 -0
  133. package/dist/chunk-GQ6UFPFM.js.map +1 -0
  134. package/dist/chunk-GQJWVMXS.js +129 -0
  135. package/dist/chunk-GQJWVMXS.js.map +1 -0
  136. package/dist/chunk-GVVJPUKC.js +80 -0
  137. package/dist/chunk-GVVJPUKC.js.map +1 -0
  138. package/dist/chunk-GZ2HOCQ2.cjs +134 -0
  139. package/dist/chunk-GZ2HOCQ2.cjs.map +1 -0
  140. package/dist/chunk-HCBOHXWP.js +37 -0
  141. package/dist/chunk-HCBOHXWP.js.map +1 -0
  142. package/dist/chunk-IBQJDVHF.cjs +281 -0
  143. package/dist/chunk-IBQJDVHF.cjs.map +1 -0
  144. package/dist/chunk-ISLB6Y5Q.cjs +106 -0
  145. package/dist/chunk-ISLB6Y5Q.cjs.map +1 -0
  146. package/dist/chunk-J55CRR4F.js +105 -0
  147. package/dist/chunk-J55CRR4F.js.map +1 -0
  148. package/dist/chunk-JBG6Z6MQ.cjs +28 -0
  149. package/dist/chunk-JBG6Z6MQ.cjs.map +1 -0
  150. package/dist/chunk-K3RQOZRU.js +61 -0
  151. package/dist/chunk-K3RQOZRU.js.map +1 -0
  152. package/dist/chunk-KDJYS4GB.cjs +703 -0
  153. package/dist/chunk-KDJYS4GB.cjs.map +1 -0
  154. package/dist/chunk-KMCAHUZM.cjs +4 -0
  155. package/dist/chunk-KMCAHUZM.cjs.map +1 -0
  156. package/dist/chunk-KUCBNPC6.js +87 -0
  157. package/dist/chunk-KUCBNPC6.js.map +1 -0
  158. package/dist/chunk-KV6UE5A4.js +50 -0
  159. package/dist/chunk-KV6UE5A4.js.map +1 -0
  160. package/dist/chunk-L6TZ2HQR.cjs +18 -0
  161. package/dist/chunk-L6TZ2HQR.cjs.map +1 -0
  162. package/dist/chunk-L7QHHGG2.cjs +141 -0
  163. package/dist/chunk-L7QHHGG2.cjs.map +1 -0
  164. package/dist/chunk-LHK3Y2AL.js +271 -0
  165. package/dist/chunk-LHK3Y2AL.js.map +1 -0
  166. package/dist/chunk-LO5RYRBH.cjs +6317 -0
  167. package/dist/chunk-LO5RYRBH.cjs.map +1 -0
  168. package/dist/chunk-LS5SJMUO.cjs +194 -0
  169. package/dist/chunk-LS5SJMUO.cjs.map +1 -0
  170. package/dist/chunk-LUGTMZFN.cjs +42 -0
  171. package/dist/chunk-LUGTMZFN.cjs.map +1 -0
  172. package/dist/chunk-LVUQU6D5.js +32 -0
  173. package/dist/chunk-LVUQU6D5.js.map +1 -0
  174. package/dist/chunk-M2QRC2GZ.js +166 -0
  175. package/dist/chunk-M2QRC2GZ.js.map +1 -0
  176. package/dist/chunk-M6QJYQIM.cjs +53 -0
  177. package/dist/chunk-M6QJYQIM.cjs.map +1 -0
  178. package/dist/chunk-MGCPH5EO.js +12 -0
  179. package/dist/chunk-MGCPH5EO.js.map +1 -0
  180. package/dist/chunk-MLVUWEZR.cjs +474 -0
  181. package/dist/chunk-MLVUWEZR.cjs.map +1 -0
  182. package/dist/chunk-MTAMJMZL.cjs +707 -0
  183. package/dist/chunk-MTAMJMZL.cjs.map +1 -0
  184. package/dist/chunk-MXL5AT3N.js +48 -0
  185. package/dist/chunk-MXL5AT3N.js.map +1 -0
  186. package/dist/chunk-MYEQSESM.cjs +75 -0
  187. package/dist/chunk-MYEQSESM.cjs.map +1 -0
  188. package/dist/chunk-N3VPF6ZD.js +427 -0
  189. package/dist/chunk-N3VPF6ZD.js.map +1 -0
  190. package/dist/chunk-N6VUAIGI.js +7 -0
  191. package/dist/chunk-N6VUAIGI.js.map +1 -0
  192. package/dist/chunk-N6XRLUN6.js +6286 -0
  193. package/dist/chunk-N6XRLUN6.js.map +1 -0
  194. package/dist/chunk-NOGDOZIT.cjs +114 -0
  195. package/dist/chunk-NOGDOZIT.cjs.map +1 -0
  196. package/dist/chunk-NUWXEISH.cjs +10 -0
  197. package/dist/chunk-NUWXEISH.cjs.map +1 -0
  198. package/dist/chunk-NZCZHXYN.cjs +161 -0
  199. package/dist/chunk-NZCZHXYN.cjs.map +1 -0
  200. package/dist/chunk-ODROSWQX.cjs +53 -0
  201. package/dist/chunk-ODROSWQX.cjs.map +1 -0
  202. package/dist/chunk-OE36AYKG.cjs +82 -0
  203. package/dist/chunk-OE36AYKG.cjs.map +1 -0
  204. package/dist/chunk-OLON7MO6.cjs +437 -0
  205. package/dist/chunk-OLON7MO6.cjs.map +1 -0
  206. package/dist/chunk-PBUOR2IT.js +277 -0
  207. package/dist/chunk-PBUOR2IT.js.map +1 -0
  208. package/dist/chunk-PC2ELXFF.cjs +225 -0
  209. package/dist/chunk-PC2ELXFF.cjs.map +1 -0
  210. package/dist/chunk-PCSGXLOC.js +71 -0
  211. package/dist/chunk-PCSGXLOC.js.map +1 -0
  212. package/dist/chunk-PFNMP6FQ.js +56 -0
  213. package/dist/chunk-PFNMP6FQ.js.map +1 -0
  214. package/dist/chunk-PIWSZTIP.js +690 -0
  215. package/dist/chunk-PIWSZTIP.js.map +1 -0
  216. package/dist/chunk-PKWHJ2GI.js +136 -0
  217. package/dist/chunk-PKWHJ2GI.js.map +1 -0
  218. package/dist/chunk-PLMVBX2A.cjs +76 -0
  219. package/dist/chunk-PLMVBX2A.cjs.map +1 -0
  220. package/dist/chunk-PM3XCD2G.cjs +113 -0
  221. package/dist/chunk-PM3XCD2G.cjs.map +1 -0
  222. package/dist/chunk-QAL4GZO7.cjs +143 -0
  223. package/dist/chunk-QAL4GZO7.cjs.map +1 -0
  224. package/dist/chunk-QDB2SEA2.js +74 -0
  225. package/dist/chunk-QDB2SEA2.js.map +1 -0
  226. package/dist/chunk-QOV7UNUN.js +25 -0
  227. package/dist/chunk-QOV7UNUN.js.map +1 -0
  228. package/dist/chunk-QQUWYLSF.cjs +50 -0
  229. package/dist/chunk-QQUWYLSF.cjs.map +1 -0
  230. package/dist/chunk-QUMBH3U4.cjs +9 -0
  231. package/dist/chunk-QUMBH3U4.cjs.map +1 -0
  232. package/dist/chunk-R4KA7OFQ.js +12 -0
  233. package/dist/chunk-R4KA7OFQ.js.map +1 -0
  234. package/dist/chunk-RBSGAZQQ.js +17 -0
  235. package/dist/chunk-RBSGAZQQ.js.map +1 -0
  236. package/dist/chunk-RM5YJWZI.js +46 -0
  237. package/dist/chunk-RM5YJWZI.js.map +1 -0
  238. package/dist/chunk-ROKNKXA4.cjs +8 -0
  239. package/dist/chunk-ROKNKXA4.cjs.map +1 -0
  240. package/dist/chunk-RQG6D546.cjs +75 -0
  241. package/dist/chunk-RQG6D546.cjs.map +1 -0
  242. package/dist/chunk-SG4YDD5L.cjs +74 -0
  243. package/dist/chunk-SG4YDD5L.cjs.map +1 -0
  244. package/dist/chunk-SNRCA7EO.js +56 -0
  245. package/dist/chunk-SNRCA7EO.js.map +1 -0
  246. package/dist/chunk-SO75R4WW.cjs +22 -0
  247. package/dist/chunk-SO75R4WW.cjs.map +1 -0
  248. package/dist/chunk-SP34NHFI.js +45 -0
  249. package/dist/chunk-SP34NHFI.js.map +1 -0
  250. package/dist/chunk-SSKSSBWJ.cjs +179 -0
  251. package/dist/chunk-SSKSSBWJ.cjs.map +1 -0
  252. package/dist/chunk-TB5663C2.js +1108 -0
  253. package/dist/chunk-TB5663C2.js.map +1 -0
  254. package/dist/chunk-TGH4NRES.js +220 -0
  255. package/dist/chunk-TGH4NRES.js.map +1 -0
  256. package/dist/chunk-TJ6ZPNID.js +189 -0
  257. package/dist/chunk-TJ6ZPNID.js.map +1 -0
  258. package/dist/chunk-U45T35N2.cjs +90 -0
  259. package/dist/chunk-U45T35N2.cjs.map +1 -0
  260. package/dist/chunk-UKVOPEZ2.js +442 -0
  261. package/dist/chunk-UKVOPEZ2.js.map +1 -0
  262. package/dist/chunk-UTB4NROA.cjs +887 -0
  263. package/dist/chunk-UTB4NROA.cjs.map +1 -0
  264. package/dist/chunk-UTW33B5V.js +6 -0
  265. package/dist/chunk-UTW33B5V.js.map +1 -0
  266. package/dist/chunk-UYUBSD2V.cjs +33 -0
  267. package/dist/chunk-UYUBSD2V.cjs.map +1 -0
  268. package/dist/chunk-V3JEP5AG.cjs +59 -0
  269. package/dist/chunk-V3JEP5AG.cjs.map +1 -0
  270. package/dist/chunk-VFAGJXHR.js +18 -0
  271. package/dist/chunk-VFAGJXHR.js.map +1 -0
  272. package/dist/chunk-VMEE57E5.cjs +58 -0
  273. package/dist/chunk-VMEE57E5.cjs.map +1 -0
  274. package/dist/chunk-VQVBEX3Y.cjs +113 -0
  275. package/dist/chunk-VQVBEX3Y.cjs.map +1 -0
  276. package/dist/chunk-VZDXX7TT.cjs +64 -0
  277. package/dist/chunk-VZDXX7TT.cjs.map +1 -0
  278. package/dist/chunk-WE5ZTI4D.js +346 -0
  279. package/dist/chunk-WE5ZTI4D.js.map +1 -0
  280. package/dist/chunk-WEFUVABP.js +19 -0
  281. package/dist/chunk-WEFUVABP.js.map +1 -0
  282. package/dist/chunk-WMU4LRKC.js +28 -0
  283. package/dist/chunk-WMU4LRKC.js.map +1 -0
  284. package/dist/chunk-WQ24RRHL.cjs +354 -0
  285. package/dist/chunk-WQ24RRHL.cjs.map +1 -0
  286. package/dist/chunk-WW4CGS7G.cjs +26 -0
  287. package/dist/chunk-WW4CGS7G.cjs.map +1 -0
  288. package/dist/chunk-WXE5WCTM.js +1144 -0
  289. package/dist/chunk-WXE5WCTM.js.map +1 -0
  290. package/dist/chunk-X23BGIYA.cjs +37 -0
  291. package/dist/chunk-X23BGIYA.cjs.map +1 -0
  292. package/dist/chunk-XEW4FTR2.js +98 -0
  293. package/dist/chunk-XEW4FTR2.js.map +1 -0
  294. package/dist/chunk-XIOI4IYW.js +167 -0
  295. package/dist/chunk-XIOI4IYW.js.map +1 -0
  296. package/dist/chunk-XLVPJ37V.cjs +44 -0
  297. package/dist/chunk-XLVPJ37V.cjs.map +1 -0
  298. package/dist/chunk-XOHAXXZA.cjs +51 -0
  299. package/dist/chunk-XOHAXXZA.cjs.map +1 -0
  300. package/dist/chunk-Y4NRIHK6.cjs +313 -0
  301. package/dist/chunk-Y4NRIHK6.cjs.map +1 -0
  302. package/dist/chunk-Y4YMMKL3.js +23 -0
  303. package/dist/chunk-Y4YMMKL3.js.map +1 -0
  304. package/dist/chunk-YJNYBVE3.cjs +14 -0
  305. package/dist/chunk-YJNYBVE3.cjs.map +1 -0
  306. package/dist/chunk-Z762QNQP.cjs +60 -0
  307. package/dist/chunk-Z762QNQP.cjs.map +1 -0
  308. package/dist/chunk-ZG5KMBOF.js +669 -0
  309. package/dist/chunk-ZG5KMBOF.js.map +1 -0
  310. package/dist/chunk-ZKONQEFA.js +344 -0
  311. package/dist/chunk-ZKONQEFA.js.map +1 -0
  312. package/dist/chunk-ZR5X7QMH.js +39 -0
  313. package/dist/chunk-ZR5X7QMH.js.map +1 -0
  314. package/dist/chunk-ZW4BJQ26.js +84 -0
  315. package/dist/chunk-ZW4BJQ26.js.map +1 -0
  316. package/dist/climbs-BhlWuu0x.d.ts +70 -0
  317. package/dist/climbs-DgBFwySV.d.cts +70 -0
  318. package/dist/collab/index.cjs +1283 -0
  319. package/dist/collab/index.cjs.map +1 -0
  320. package/dist/collab/index.d.cts +850 -0
  321. package/dist/collab/index.d.ts +850 -0
  322. package/dist/collab/index.js +1274 -0
  323. package/dist/collab/index.js.map +1 -0
  324. package/dist/data/index.cjs +132 -0
  325. package/dist/data/index.cjs.map +1 -0
  326. package/dist/data/index.d.cts +468 -0
  327. package/dist/data/index.d.ts +468 -0
  328. package/dist/data/index.js +15 -0
  329. package/dist/data/index.js.map +1 -0
  330. package/dist/editor/index.cjs +4506 -0
  331. package/dist/editor/index.cjs.map +1 -0
  332. package/dist/editor/index.d.cts +59 -0
  333. package/dist/editor/index.d.ts +59 -0
  334. package/dist/editor/index.js +4486 -0
  335. package/dist/editor/index.js.map +1 -0
  336. package/dist/elevationTiles-pmsb9wnU.d.cts +77 -0
  337. package/dist/elevationTiles-pmsb9wnU.d.ts +77 -0
  338. package/dist/errors/index.cjs +28 -0
  339. package/dist/errors/index.cjs.map +1 -0
  340. package/dist/errors/index.d.cts +125 -0
  341. package/dist/errors/index.d.ts +125 -0
  342. package/dist/errors/index.js +3 -0
  343. package/dist/errors/index.js.map +1 -0
  344. package/dist/geo/index.cjs +232 -0
  345. package/dist/geo/index.cjs.map +1 -0
  346. package/dist/geo/index.d.cts +821 -0
  347. package/dist/geo/index.d.ts +821 -0
  348. package/dist/geo/index.js +15 -0
  349. package/dist/geo/index.js.map +1 -0
  350. package/dist/geodesy-543qXKtI.d.cts +78 -0
  351. package/dist/geodesy-543qXKtI.d.ts +78 -0
  352. package/dist/geolocation-DDkQdWMN.d.cts +106 -0
  353. package/dist/geolocation-DDkQdWMN.d.ts +106 -0
  354. package/dist/i18n/fr/index.cjs +338 -0
  355. package/dist/i18n/fr/index.cjs.map +1 -0
  356. package/dist/i18n/fr/index.d.cts +25 -0
  357. package/dist/i18n/fr/index.d.ts +25 -0
  358. package/dist/i18n/fr/index.js +336 -0
  359. package/dist/i18n/fr/index.js.map +1 -0
  360. package/dist/i18n/index.cjs +464 -0
  361. package/dist/i18n/index.cjs.map +1 -0
  362. package/dist/i18n/index.d.cts +227 -0
  363. package/dist/i18n/index.d.ts +227 -0
  364. package/dist/i18n/index.js +430 -0
  365. package/dist/i18n/index.js.map +1 -0
  366. package/dist/icons/index.cjs +116 -0
  367. package/dist/icons/index.cjs.map +1 -0
  368. package/dist/icons/index.d.cts +457 -0
  369. package/dist/icons/index.d.ts +457 -0
  370. package/dist/icons/index.js +11 -0
  371. package/dist/icons/index.js.map +1 -0
  372. package/dist/index.cjs +1869 -0
  373. package/dist/index.cjs.map +1 -0
  374. package/dist/index.d.cts +251 -0
  375. package/dist/index.d.ts +251 -0
  376. package/dist/index.js +67 -0
  377. package/dist/index.js.map +1 -0
  378. package/dist/itinerary-Dp2ZnqgD.d.cts +178 -0
  379. package/dist/itinerary-Dp2ZnqgD.d.ts +178 -0
  380. package/dist/language-CEWQ5uYw.d.cts +69 -0
  381. package/dist/language-CEWQ5uYw.d.ts +69 -0
  382. package/dist/layers/index.cjs +318 -0
  383. package/dist/layers/index.cjs.map +1 -0
  384. package/dist/layers/index.d.cts +1555 -0
  385. package/dist/layers/index.d.ts +1555 -0
  386. package/dist/layers/index.js +17 -0
  387. package/dist/layers/index.js.map +1 -0
  388. package/dist/map-client/index.cjs +4 -0
  389. package/dist/map-client/index.cjs.map +1 -0
  390. package/dist/map-client/index.d.cts +1856 -0
  391. package/dist/map-client/index.d.ts +1856 -0
  392. package/dist/map-client/index.js +3 -0
  393. package/dist/map-client/index.js.map +1 -0
  394. package/dist/maplibre-worker.mjs +12 -0
  395. package/dist/markerSprite-DGBQF6PO.cjs +49 -0
  396. package/dist/markerSprite-DGBQF6PO.cjs.map +1 -0
  397. package/dist/markerSprite-DZLTR6F6.js +8 -0
  398. package/dist/markerSprite-DZLTR6F6.js.map +1 -0
  399. package/dist/mountayaMap-C9mxRFib.d.cts +3277 -0
  400. package/dist/mountayaMap-DgnlQ2fE.d.ts +3277 -0
  401. package/dist/navigation/index.cjs +699 -0
  402. package/dist/navigation/index.cjs.map +1 -0
  403. package/dist/navigation/index.d.cts +632 -0
  404. package/dist/navigation/index.d.ts +632 -0
  405. package/dist/navigation/index.js +689 -0
  406. package/dist/navigation/index.js.map +1 -0
  407. package/dist/order-BLhsGsH8.d.ts +132 -0
  408. package/dist/order-BZkUwMou.d.cts +132 -0
  409. package/dist/paint-BgUcj8l7.d.cts +118 -0
  410. package/dist/paint-Dx_qGNE_.d.ts +118 -0
  411. package/dist/profile/index.cjs +675 -0
  412. package/dist/profile/index.cjs.map +1 -0
  413. package/dist/profile/index.d.cts +2086 -0
  414. package/dist/profile/index.d.ts +2086 -0
  415. package/dist/profile/index.js +18 -0
  416. package/dist/profile/index.js.map +1 -0
  417. package/dist/provider-DM71XnLX.d.cts +121 -0
  418. package/dist/provider-DM71XnLX.d.ts +121 -0
  419. package/dist/roadAccess-D_rOE4xW.d.cts +86 -0
  420. package/dist/roadAccess-D_rOE4xW.d.ts +86 -0
  421. package/dist/routeProfile-BKfSfxx6.d.ts +210 -0
  422. package/dist/routeProfile-BsSUABXv.d.cts +210 -0
  423. package/dist/seams/index.cjs +39 -0
  424. package/dist/seams/index.cjs.map +1 -0
  425. package/dist/seams/index.d.cts +254 -0
  426. package/dist/seams/index.d.ts +254 -0
  427. package/dist/seams/index.js +6 -0
  428. package/dist/seams/index.js.map +1 -0
  429. package/dist/search/index.cjs +147 -0
  430. package/dist/search/index.cjs.map +1 -0
  431. package/dist/search/index.d.cts +888 -0
  432. package/dist/search/index.d.ts +888 -0
  433. package/dist/search/index.js +14 -0
  434. package/dist/search/index.js.map +1 -0
  435. package/dist/searchHighlight-DFE7LVIL.cjs +33 -0
  436. package/dist/searchHighlight-DFE7LVIL.cjs.map +1 -0
  437. package/dist/searchHighlight-MHAQZVWG.js +12 -0
  438. package/dist/searchHighlight-MHAQZVWG.js.map +1 -0
  439. package/dist/searchLimits-j99-NTXR.d.cts +24 -0
  440. package/dist/searchLimits-j99-NTXR.d.ts +24 -0
  441. package/dist/sections-CVlc2Inr.d.cts +953 -0
  442. package/dist/sections-CmtaduLc.d.ts +953 -0
  443. package/dist/segmentRoute-C5UL_5bp.d.ts +172 -0
  444. package/dist/segmentRoute-CIo6dR8Y.d.cts +172 -0
  445. package/dist/strings-30RSdIat.d.cts +552 -0
  446. package/dist/strings-DPTIbzT5.d.ts +552 -0
  447. package/dist/stripeImage-CQUXM2YI.js +14 -0
  448. package/dist/stripeImage-CQUXM2YI.js.map +1 -0
  449. package/dist/stripeImage-R43OPA6U.cjs +39 -0
  450. package/dist/stripeImage-R43OPA6U.cjs.map +1 -0
  451. package/dist/style/index.cjs +116 -0
  452. package/dist/style/index.cjs.map +1 -0
  453. package/dist/style/index.d.cts +538 -0
  454. package/dist/style/index.d.ts +538 -0
  455. package/dist/style/index.js +11 -0
  456. package/dist/style/index.js.map +1 -0
  457. package/dist/styles.css +11 -0
  458. package/dist/testing/index.cjs +629 -0
  459. package/dist/testing/index.cjs.map +1 -0
  460. package/dist/testing/index.d.cts +265 -0
  461. package/dist/testing/index.d.ts +265 -0
  462. package/dist/testing/index.js +623 -0
  463. package/dist/testing/index.js.map +1 -0
  464. package/dist/timezone/index.cjs +759 -0
  465. package/dist/timezone/index.cjs.map +1 -0
  466. package/dist/timezone/index.d.cts +53 -0
  467. package/dist/timezone/index.d.ts +53 -0
  468. package/dist/timezone/index.js +757 -0
  469. package/dist/timezone/index.js.map +1 -0
  470. package/dist/types-B034JMjl.d.ts +973 -0
  471. package/dist/types-B2NDLxQA.d.cts +21 -0
  472. package/dist/types-B2NDLxQA.d.ts +21 -0
  473. package/dist/types-BEv8V_8V.d.cts +55 -0
  474. package/dist/types-BEv8V_8V.d.ts +55 -0
  475. package/dist/types-C8aX5KMU.d.cts +973 -0
  476. package/dist/types-CTQwbSdA.d.cts +321 -0
  477. package/dist/types-nO2joeRk.d.ts +321 -0
  478. package/dist/units/index.cjs +99 -0
  479. package/dist/units/index.cjs.map +1 -0
  480. package/dist/units/index.d.cts +75 -0
  481. package/dist/units/index.d.ts +75 -0
  482. package/dist/units/index.js +6 -0
  483. package/dist/units/index.js.map +1 -0
  484. package/dist/units-D9mBrusY.d.cts +900 -0
  485. package/dist/units-D9mBrusY.d.ts +900 -0
  486. package/dist/video/index.cjs +2198 -0
  487. package/dist/video/index.cjs.map +1 -0
  488. package/dist/video/index.d.cts +873 -0
  489. package/dist/video/index.d.ts +873 -0
  490. package/dist/video/index.js +2173 -0
  491. package/dist/video/index.js.map +1 -0
  492. package/dist/videoOverlay-Dh_D5_Zs.d.cts +44 -0
  493. package/dist/videoOverlay-Dh_D5_Zs.d.ts +44 -0
  494. package/dist/view/index.cjs +43 -0
  495. package/dist/view/index.cjs.map +1 -0
  496. package/dist/view/index.d.cts +836 -0
  497. package/dist/view/index.d.ts +836 -0
  498. package/dist/view/index.js +34 -0
  499. package/dist/view/index.js.map +1 -0
  500. package/dist/zones-B05QA8fy.d.cts +75 -0
  501. package/dist/zones-B05QA8fy.d.ts +75 -0
  502. package/package.json +433 -4
  503. package/src/agent/engines/session.ts +2255 -0
  504. package/src/agent/index.ts +109 -0
  505. package/src/agent/rules/agentError.ts +128 -0
  506. package/src/agent/rules/boundedInputJson.ts +53 -0
  507. package/src/agent/rules/conversation.ts +629 -0
  508. package/src/agent/rules/conversationFaults.ts +349 -0
  509. package/src/agent/rules/conversationHost.ts +390 -0
  510. package/src/agent/rules/dispatcher.ts +102 -0
  511. package/src/agent/rules/errorCodes.ts +78 -0
  512. package/src/agent/rules/errorStatus.ts +65 -0
  513. package/src/agent/rules/scriptedTransport.ts +390 -0
  514. package/src/agent/rules/stickToBottom.ts +38 -0
  515. package/src/agent/rules/toolResultPayload.ts +197 -0
  516. package/src/auth/rules/clientHeader.ts +22 -0
  517. package/src/auth/rules/sentCredential.ts +76 -0
  518. package/src/auth/rules/transformRequest.ts +803 -0
  519. package/src/camera/engines/videoFlight.ts +1758 -0
  520. package/src/camera/index.ts +157 -0
  521. package/src/camera/rules/clearance.ts +1099 -0
  522. package/src/camera/rules/fit.ts +132 -0
  523. package/src/camera/rules/modes.ts +1023 -0
  524. package/src/camera/rules/plan.ts +478 -0
  525. package/src/camera/rules/planner.ts +129 -0
  526. package/src/camera/rules/poseRanges.ts +38 -0
  527. package/src/camera/rules/presets.ts +185 -0
  528. package/src/camera/rules/profileSamples.ts +243 -0
  529. package/src/camera/rules/route.ts +596 -0
  530. package/src/camera/rules/routeContent.ts +104 -0
  531. package/src/camera/rules/spline.ts +765 -0
  532. package/src/camera/rules/sweptViewports.ts +39 -0
  533. package/src/camera/rules/track.ts +1412 -0
  534. package/src/camera/rules/vocabulary.ts +130 -0
  535. package/src/camera/rules/zoom.ts +216 -0
  536. package/src/collab/engines/session.ts +1902 -0
  537. package/src/collab/engines/trailingThrottle.ts +151 -0
  538. package/src/collab/index.ts +56 -0
  539. package/src/collab/rules/dispatch.ts +143 -0
  540. package/src/collab/rules/peerNames.ts +51 -0
  541. package/src/collab/rules/scriptedTransport.ts +244 -0
  542. package/src/compose/engines/baseMapSwitch.ts +1136 -0
  543. package/src/compose/engines/events.ts +962 -0
  544. package/src/compose/engines/mountayaMap.ts +5674 -0
  545. package/src/compose/engines/sentCredentials.ts +146 -0
  546. package/src/compose/engines/slotRequests.ts +413 -0
  547. package/src/compose/rules/accessRefusal.ts +109 -0
  548. package/src/compose/rules/accessStanding.ts +75 -0
  549. package/src/compose/rules/analysisKinds.ts +331 -0
  550. package/src/compose/rules/analysisLayers.ts +176 -0
  551. package/src/compose/rules/cameraMoves.ts +38 -0
  552. package/src/compose/rules/carriedLayers.ts +87 -0
  553. package/src/compose/rules/developmentWarnings.ts +166 -0
  554. package/src/compose/rules/fitCamera.ts +54 -0
  555. package/src/compose/rules/geoJsonSlot.ts +61 -0
  556. package/src/compose/rules/geometrySlots.ts +155 -0
  557. package/src/compose/rules/glyphNode.ts +62 -0
  558. package/src/compose/rules/layerKeys.ts +92 -0
  559. package/src/compose/rules/layerOrder.ts +85 -0
  560. package/src/compose/rules/layersManifest.ts +26 -0
  561. package/src/compose/rules/mapOptions.ts +300 -0
  562. package/src/compose/rules/maplibreWorkerVersion.gen.ts +8 -0
  563. package/src/compose/rules/markerPin.ts +122 -0
  564. package/src/compose/rules/markerRegistry.ts +85 -0
  565. package/src/compose/rules/markerSprite.ts +382 -0
  566. package/src/compose/rules/maxBounds.ts +120 -0
  567. package/src/compose/rules/overlayLookup.ts +49 -0
  568. package/src/compose/rules/paintDiff.ts +38 -0
  569. package/src/compose/rules/panLock.ts +77 -0
  570. package/src/compose/rules/patch.ts +124 -0
  571. package/src/compose/rules/queriedFeature.ts +55 -0
  572. package/src/compose/rules/queryLayers.ts +46 -0
  573. package/src/compose/rules/searchHighlight.ts +313 -0
  574. package/src/compose/rules/slotNames.ts +19 -0
  575. package/src/compose/rules/stripeImage.ts +253 -0
  576. package/src/compose/rules/swapMarker.ts +66 -0
  577. package/src/compose/rules/terrainVariant.ts +88 -0
  578. package/src/compose/rules/types.ts +566 -0
  579. package/src/compose/rules/urlHash.ts +19 -0
  580. package/src/compose/rules/viewOptions.ts +451 -0
  581. package/src/compose/rules/workerUrl.ts +96 -0
  582. package/src/data/engines/itineraryResource.ts +643 -0
  583. package/src/data/index.ts +78 -0
  584. package/src/data/rules/adapt.ts +473 -0
  585. package/src/data/rules/editModes.ts +51 -0
  586. package/src/data/rules/itinerary.ts +168 -0
  587. package/src/data/rules/nullable.ts +63 -0
  588. package/src/data/rules/roadAccess.ts +169 -0
  589. package/src/data/rules/segmentGroups.ts +309 -0
  590. package/src/data/rules/selectors.ts +95 -0
  591. package/src/data/rules/zones.ts +79 -0
  592. package/src/draw/engines/boundaryEngine.ts +1003 -0
  593. package/src/draw/engines/framedAdapter.ts +198 -0
  594. package/src/draw/engines/pointerCursor.ts +205 -0
  595. package/src/draw/engines/segmentEngine.ts +1405 -0
  596. package/src/draw/engines/snapIndex.ts +254 -0
  597. package/src/draw/engines/waypointEngine.ts +574 -0
  598. package/src/draw/engines/zoneEngine.ts +1137 -0
  599. package/src/draw/rules/drawFrame.ts +123 -0
  600. package/src/draw/rules/insertVertex.ts +226 -0
  601. package/src/draw/rules/screenSpace.ts +62 -0
  602. package/src/draw/rules/seeds.ts +185 -0
  603. package/src/draw/rules/snap.ts +115 -0
  604. package/src/draw/rules/snapCameraKey.ts +50 -0
  605. package/src/draw/rules/terraDrawShared.ts +214 -0
  606. package/src/draw/rules/zoneOutline.ts +213 -0
  607. package/src/editing/engines/cursor.ts +505 -0
  608. package/src/editing/engines/draftMarker.ts +149 -0
  609. package/src/editing/rules/accent.ts +11 -0
  610. package/src/editing/rules/engine.ts +286 -0
  611. package/src/editing/rules/placement.ts +22 -0
  612. package/src/editing/rules/positions.ts +89 -0
  613. package/src/editing/rules/sources.ts +9 -0
  614. package/src/editing/rules/types.ts +457 -0
  615. package/src/editing/rules/vocabulary.ts +10 -0
  616. package/src/editing/rules/waypointCursor.ts +228 -0
  617. package/src/editor/engines/directionArrows.ts +459 -0
  618. package/src/editor/engines/directions.ts +1383 -0
  619. package/src/editor/engines/editorClient.ts +134 -0
  620. package/src/editor/engines/eventScope.ts +59 -0
  621. package/src/editor/engines/frameLoop.ts +159 -0
  622. package/src/editor/engines/itineraryPreview.ts +272 -0
  623. package/src/editor/engines/mapLockGuard.ts +66 -0
  624. package/src/editor/engines/overlayRenderer.ts +2696 -0
  625. package/src/editor/engines/peerDraft.ts +760 -0
  626. package/src/editor/engines/poiPick.ts +305 -0
  627. package/src/editor/engines/pointPick.ts +84 -0
  628. package/src/editor/engines/roadAccessLine.ts +140 -0
  629. package/src/editor/engines/searchHighlight.ts +183 -0
  630. package/src/editor/engines/viewClient.ts +4083 -0
  631. package/src/editor/engines/zoneBadges.ts +503 -0
  632. package/src/editor/index.ts +97 -0
  633. package/src/editor/rules/accentColor.ts +116 -0
  634. package/src/editor/rules/camera.ts +121 -0
  635. package/src/editor/rules/contract.ts +125 -0
  636. package/src/editor/rules/icons.ts +825 -0
  637. package/src/editor/rules/markerElements.ts +244 -0
  638. package/src/editor/rules/style.ts +51 -0
  639. package/src/editor/rules/terrain.ts +98 -0
  640. package/src/editor/rules/tileWarm.ts +191 -0
  641. package/src/editor/rules/tilesReload.ts +158 -0
  642. package/src/editor/rules/zoneBadgePlacement.ts +1832 -0
  643. package/src/editor/rules/zoneTimeStyling.ts +119 -0
  644. package/src/errors/index.ts +25 -0
  645. package/src/errors/rules/errors.ts +157 -0
  646. package/src/errors/rules/print.ts +129 -0
  647. package/src/geo/index.ts +94 -0
  648. package/src/geo/rules/boundaries.ts +105 -0
  649. package/src/geo/rules/camera.ts +496 -0
  650. package/src/geo/rules/corridor.ts +242 -0
  651. package/src/geo/rules/elevationTiles.ts +269 -0
  652. package/src/geo/rules/formatLngLat.ts +63 -0
  653. package/src/geo/rules/geodesy.ts +125 -0
  654. package/src/geo/rules/geometry.ts +362 -0
  655. package/src/geo/rules/lineWalk.ts +77 -0
  656. package/src/geo/rules/longitude.ts +99 -0
  657. package/src/geo/rules/searchLimits.ts +22 -0
  658. package/src/geo/rules/segmentGeometry.ts +80 -0
  659. package/src/geo/rules/terrain.ts +107 -0
  660. package/src/geo/rules/tuples.ts +124 -0
  661. package/src/geo/rules/types.ts +54 -0
  662. package/src/geo/rules/webMercator.ts +57 -0
  663. package/src/i18n/fr/index.ts +17 -0
  664. package/src/i18n/fr/rules/fr.ts +85 -0
  665. package/src/i18n/fr/rules/words.gen.ts +277 -0
  666. package/src/i18n/index.ts +81 -0
  667. package/src/i18n/rules/bundle.ts +378 -0
  668. package/src/i18n/rules/config.ts +71 -0
  669. package/src/i18n/rules/endonyms.gen.ts +19 -0
  670. package/src/i18n/rules/language.ts +92 -0
  671. package/src/i18n/rules/localizedName.ts +33 -0
  672. package/src/i18n/rules/merge.ts +106 -0
  673. package/src/i18n/rules/scope.ts +127 -0
  674. package/src/i18n/rules/strings.ts +632 -0
  675. package/src/i18n/rules/videoOverlay.ts +121 -0
  676. package/src/i18n/rules/wordForms.ts +95 -0
  677. package/src/i18n/rules/words.gen.ts +277 -0
  678. package/src/icons/index.ts +54 -0
  679. package/src/icons/rules/activities.ts +40 -0
  680. package/src/icons/rules/amenities.ts +250 -0
  681. package/src/icons/rules/artwork.gen.ts +83 -0
  682. package/src/icons/rules/artwork.ts +47 -0
  683. package/src/icons/rules/fallback.ts +21 -0
  684. package/src/icons/rules/lucideMarkers.gen.ts +112 -0
  685. package/src/icons/rules/lucideUi.gen.ts +197 -0
  686. package/src/icons/rules/paint.ts +107 -0
  687. package/src/icons/rules/parse.ts +475 -0
  688. package/src/icons/rules/provider.ts +373 -0
  689. package/src/icons/rules/sprites.ts +54 -0
  690. package/src/icons/rules/ui.ts +348 -0
  691. package/src/icons/rules/waypoints.ts +215 -0
  692. package/src/index.ts +1012 -0
  693. package/src/layers/engines/layersSelection.ts +515 -0
  694. package/src/layers/engines/readoutEngine.ts +131 -0
  695. package/src/layers/index.ts +151 -0
  696. package/src/layers/rules/analysis.ts +135 -0
  697. package/src/layers/rules/enrichment.ts +30 -0
  698. package/src/layers/rules/geoJson.ts +270 -0
  699. package/src/layers/rules/hover.ts +67 -0
  700. package/src/layers/rules/itineraries.ts +182 -0
  701. package/src/layers/rules/layersPanel.ts +237 -0
  702. package/src/layers/rules/order.ts +194 -0
  703. package/src/layers/rules/overlayInstant.ts +49 -0
  704. package/src/layers/rules/overlays.ts +52 -0
  705. package/src/layers/rules/poiPanel.ts +119 -0
  706. package/src/layers/rules/pois.ts +114 -0
  707. package/src/layers/rules/readout.ts +340 -0
  708. package/src/layers/rules/streetView.ts +16 -0
  709. package/src/layers/rules/tileTimestamp.ts +146 -0
  710. package/src/layers/rules/timeSlider.ts +192 -0
  711. package/src/layers/rules/timeWindow.ts +123 -0
  712. package/src/layers/rules/zones.ts +43 -0
  713. package/src/layers/rules/zoom.ts +77 -0
  714. package/src/map-client/index.ts +71 -0
  715. package/src/map-client/rules/mapClient.ts +1943 -0
  716. package/src/navigation/engines/navigation.ts +493 -0
  717. package/src/navigation/index.ts +51 -0
  718. package/src/navigation/rules/followedRoute.ts +78 -0
  719. package/src/navigation/rules/instructions.ts +89 -0
  720. package/src/navigation/rules/itineraryRoute.ts +232 -0
  721. package/src/navigation/rules/offRoute.ts +41 -0
  722. package/src/navigation/rules/progress.ts +230 -0
  723. package/src/navigation/rules/prompts.ts +217 -0
  724. package/src/navigation/rules/routeRequest.ts +98 -0
  725. package/src/navigation/rules/status.ts +142 -0
  726. package/src/navigation/rules/steps.ts +234 -0
  727. package/src/navigation/rules/types.ts +83 -0
  728. package/src/profile/index.ts +307 -0
  729. package/src/profile/rules/amenityBadge.ts +35 -0
  730. package/src/profile/rules/amenityFilter.ts +74 -0
  731. package/src/profile/rules/amenityStacks.ts +66 -0
  732. package/src/profile/rules/axis.ts +89 -0
  733. package/src/profile/rules/axisCulling.ts +83 -0
  734. package/src/profile/rules/axisLookup.ts +180 -0
  735. package/src/profile/rules/climbs.ts +292 -0
  736. package/src/profile/rules/cursorMarker.ts +122 -0
  737. package/src/profile/rules/cursorReadout.ts +104 -0
  738. package/src/profile/rules/curvePlacement.ts +216 -0
  739. package/src/profile/rules/dock.ts +293 -0
  740. package/src/profile/rules/elevation.ts +1263 -0
  741. package/src/profile/rules/instant.ts +89 -0
  742. package/src/profile/rules/intl.ts +237 -0
  743. package/src/profile/rules/legEmphasis.ts +53 -0
  744. package/src/profile/rules/profileColors.ts +66 -0
  745. package/src/profile/rules/profileLayout.ts +59 -0
  746. package/src/profile/rules/profileSlices.ts +55 -0
  747. package/src/profile/rules/routeProfile.ts +475 -0
  748. package/src/profile/rules/rowMatch.ts +50 -0
  749. package/src/profile/rules/scale.ts +650 -0
  750. package/src/profile/rules/scaleFrame.ts +171 -0
  751. package/src/profile/rules/sectionChips.ts +83 -0
  752. package/src/profile/rules/sections.ts +923 -0
  753. package/src/profile/rules/slopeRamp.ts +160 -0
  754. package/src/profile/rules/statStrip.ts +103 -0
  755. package/src/profile/rules/steepness.ts +51 -0
  756. package/src/profile/rules/tableCells.ts +269 -0
  757. package/src/profile/rules/tableCursor.ts +87 -0
  758. package/src/profile/rules/unitPatterns.ts +335 -0
  759. package/src/profile/rules/units.ts +1025 -0
  760. package/src/profile/rules/waypointCard.ts +593 -0
  761. package/src/profile/rules/webAddress.ts +130 -0
  762. package/src/profile/rules/windowSpans.ts +65 -0
  763. package/src/rules/asciiFold.ts +17 -0
  764. package/src/rules/inDevelopment.ts +54 -0
  765. package/src/rules/listeners.ts +62 -0
  766. package/src/rules/timers.ts +9 -0
  767. package/src/rules/types.ts +22 -0
  768. package/src/rules/uuid.ts +87 -0
  769. package/src/seams/engines/geolocateControl.ts +286 -0
  770. package/src/seams/index.ts +50 -0
  771. package/src/seams/rules/clock.ts +169 -0
  772. package/src/seams/rules/geolocation.ts +165 -0
  773. package/src/seams/rules/segmentRoute.ts +187 -0
  774. package/src/search/engines/search.ts +1093 -0
  775. package/src/search/index.ts +114 -0
  776. package/src/search/rules/describe.ts +383 -0
  777. package/src/search/rules/filters.ts +195 -0
  778. package/src/search/rules/highlight.ts +270 -0
  779. package/src/search/rules/pick.ts +90 -0
  780. package/src/search/rules/rows.ts +258 -0
  781. package/src/search/rules/searchFocus.ts +27 -0
  782. package/src/search/rules/searchViewport.ts +44 -0
  783. package/src/search/rules/shown.ts +77 -0
  784. package/src/search/rules/types.ts +340 -0
  785. package/src/stream/rules/reconnectSchedule.ts +83 -0
  786. package/src/style/engines/organizationRead.ts +80 -0
  787. package/src/style/index.ts +63 -0
  788. package/src/style/rules/apply.ts +268 -0
  789. package/src/style/rules/attribution.ts +119 -0
  790. package/src/style/rules/itineraryLine.ts +142 -0
  791. package/src/style/rules/language.ts +668 -0
  792. package/src/style/rules/layout.gen.ts +27 -0
  793. package/src/style/rules/organization.ts +96 -0
  794. package/src/style/rules/paint.ts +143 -0
  795. package/src/style/rules/panelLayout.ts +51 -0
  796. package/src/style/rules/roadAccessColors.ts +29 -0
  797. package/src/style/rules/roadAccessLine.ts +267 -0
  798. package/src/style/rules/segmentColors.ts +207 -0
  799. package/src/testing/catalogs.ts +103 -0
  800. package/src/testing/index.ts +30 -0
  801. package/src/testing/mapClient.ts +241 -0
  802. package/src/testing/mountayaMap.ts +741 -0
  803. package/src/timezone/index.ts +14 -0
  804. package/src/timezone/rules/viewport.ts +875 -0
  805. package/src/units/index.ts +55 -0
  806. package/src/units/rules/conversions.ts +620 -0
  807. package/src/units/rules/preferenceChoices.ts +124 -0
  808. package/src/units/rules/preferences.ts +77 -0
  809. package/src/units/rules/rounding.ts +69 -0
  810. package/src/video/engines/videoRun.ts +654 -0
  811. package/src/video/engines/viewClient.ts +6 -0
  812. package/src/video/index.ts +83 -0
  813. package/src/video/profileOverlay/rules/contract.ts +212 -0
  814. package/src/video/profileOverlay/rules/curve.ts +216 -0
  815. package/src/video/profileOverlay/rules/draw.ts +410 -0
  816. package/src/video/profileOverlay/rules/fonts.ts +54 -0
  817. package/src/video/profileOverlay/rules/graphDesign.ts +690 -0
  818. package/src/video/profileOverlay/rules/minimalDesign.ts +144 -0
  819. package/src/video/profileOverlay/rules/registry.ts +23 -0
  820. package/src/video/profileOverlay/rules/staticLayer.ts +582 -0
  821. package/src/video/profileOverlay/rules/stripDesign.ts +327 -0
  822. package/src/video/profileOverlay/rules/types.ts +78 -0
  823. package/src/video/rules/videoConstants.ts +250 -0
  824. package/src/video/rules/videoEncoder.ts +277 -0
  825. package/src/video/rules/videoFrames.ts +99 -0
  826. package/src/video/rules/videoPreview.ts +185 -0
  827. package/src/video/rules/videoRecorder.ts +746 -0
  828. package/src/video/rules/videoWatermark.ts +155 -0
  829. package/src/video/rules/watermarkMark.ts +40 -0
  830. package/src/view/engines/viewClient.ts +6 -0
  831. package/src/view/index.ts +20 -0
@@ -0,0 +1,1003 @@
1
+ import type { Polygon, Position } from "geojson";
2
+ import type { Map as MapLibreMap } from "maplibre-gl";
3
+ import {
4
+ type GeoJSONStoreFeatures,
5
+ TerraDraw,
6
+ type TerraDrawEventListeners,
7
+ TerraDrawRectangleMode,
8
+ TerraDrawSelectMode,
9
+ } from "terra-draw";
10
+
11
+ import type { MapEventEngine } from "../../compose/engines/events.js";
12
+ import {
13
+ attachCursorReassert,
14
+ attachEditHoverCursor,
15
+ type CursorEngine,
16
+ ZONE_CREATE_CURSOR,
17
+ } from "../../editing/engines/cursor.js";
18
+ import type { BoundaryEditEngine, EmitBoundaryDraft } from "../../editing/rules/engine.js";
19
+ import { readEditColor } from "../../editing/rules/positions.js";
20
+ import type { BoundaryEditOptions, DraftPhase } from "../../editing/rules/types.js";
21
+ import { normalizeBoundingBox } from "../../geo/rules/camera.js";
22
+ import { boundingBoxToPolygon } from "../../geo/rules/geometry.js";
23
+ import { LONGITUDE_LIMIT } from "../../geo/rules/longitude.js";
24
+ import type { BoundingBox } from "../../geo/rules/types.js";
25
+ import { notifyListeners } from "../../rules/listeners.js";
26
+ import { clampCoordinatePrecision } from "../rules/insertVertex.js";
27
+ import {
28
+ addDrawFeature,
29
+ applyHeldWrite,
30
+ type DrawRefusalSubject,
31
+ drawIdStrategy,
32
+ isProgrammaticChange,
33
+ SELECT_MODE,
34
+ updateDrawGeometry,
35
+ } from "../rules/terraDrawShared.js";
36
+ import { FramedMapLibreAdapter } from "./framedAdapter.js";
37
+
38
+ /**
39
+ * BOUNDARY_DRAW_MODE_NAME is the mode name TerraDrawRectangleMode registers under —
40
+ * the library's own `mode` property value. Held here so setMode, updateModeOptions,
41
+ * and the seeded feature's `properties.mode` all read one value.
42
+ */
43
+ export const BOUNDARY_DRAW_MODE_NAME = "rectangle";
44
+
45
+ /**
46
+ * The id prefix every TerraDraw-rendered source + layer is namespaced with, so a
47
+ * teardown leaves no orphan layer behind and the prefix never collides with the
48
+ * other authoring families (zones under `td-zone`, segments/waypoints under
49
+ * `td-edit`/`td-waypoint`).
50
+ */
51
+ const BOUNDARY_TERRADRAW_PREFIX = "td-boundary";
52
+
53
+ /**
54
+ * The MapLibre layer id the adapter renders the drawn box's fill on. The adapter
55
+ * names its layers `${prefixId}-${geometryType.toLowerCase()}`, and a rectangle is a
56
+ * Polygon, so the fill lands here. The engine scopes the whole-box grab cursor to it.
57
+ */
58
+ const BOUNDARY_FILL_LAYER_ID = `${BOUNDARY_TERRADRAW_PREFIX}-polygon`;
59
+
60
+ /**
61
+ * The MapLibre layer id the adapter renders every point feature on — here the select
62
+ * mode's four corner handles. The engine layers the drag affordance over it.
63
+ */
64
+ const BOUNDARY_VERTEX_LAYER_ID = `${BOUNDARY_TERRADRAW_PREFIX}-point`;
65
+
66
+ /**
67
+ * BOUNDARY_RING_CORNERS is how many distinct corners an axis-aligned rectangle ring
68
+ * carries. TerraDraw stores the ring closed — five positions, the first repeated last
69
+ * — so the corner reads drop that trailing duplicate.
70
+ */
71
+ const BOUNDARY_RING_CORNERS = 4;
72
+
73
+ /** boundaryRefusal names this engine and its shape in the error for a box TerraDraw refuses. */
74
+ const boundaryRefusal: DrawRefusalSubject = { engine: "TerraDrawBoundaryEngine", shape: "box" };
75
+
76
+ /**
77
+ * BoundaryDrawFactory builds the TerraDraw instance for a boundary edit. It is
78
+ * injected so a unit test can drive the engine's orchestration (the draft seam, the
79
+ * re-rectangling, the cursor handoff) against a fake TerraDraw without a WebGL
80
+ * context, while production passes the real construction. It mirrors
81
+ * {@link ZoneDrawFactory} minus the mode member — a boundary has exactly one
82
+ * primitive, so there is nothing to select between.
83
+ */
84
+ export type BoundaryDrawFactory = (config: { map: MapLibreMap; prefixId: string }) => TerraDraw;
85
+
86
+ /**
87
+ * buildBoundaryDrawMode constructs the draw mode a boundary is authored with: the
88
+ * AXIS-ALIGNED rectangle mode, drawn by pressing at one corner and dragging to the
89
+ * opposite one. Deliberately not the angled variant — a rotated rectangle's extent is
90
+ * strictly larger than the shape the user drew, so the box would silently grow every
91
+ * time it round-tripped through a bbox.
92
+ */
93
+ export const buildBoundaryDrawMode = (): TerraDrawRectangleMode => new TerraDrawRectangleMode();
94
+
95
+ /**
96
+ * buildBoundarySelectFlags builds the TerraDraw select-mode `flags` for a drawn box:
97
+ * the four corners are draggable (so the box resizes from any corner) and the whole
98
+ * feature is draggable (so it can be repositioned wholesale), while midpoints and
99
+ * coordinate deletion stay off — a rectangle has exactly four corners and inserting or
100
+ * removing one would stop being a rectangle.
101
+ *
102
+ * Corner dragging alone is not enough to keep the shape rectangular: TerraDraw moves
103
+ * each coordinate INDEPENDENTLY, so dragging one corner shears the box into a general
104
+ * quad. The engine re-rectangles after every such change (see handleChange), which is
105
+ * what makes this flag set safe to expose. Exported so a unit test pins the contract
106
+ * without constructing a real TerraDraw (which needs a WebGL context).
107
+ */
108
+ export const buildBoundarySelectFlags = () => ({
109
+ [BOUNDARY_DRAW_MODE_NAME]: {
110
+ feature: {
111
+ coordinates: { deletable: false, draggable: true, midpoints: false },
112
+ draggable: true,
113
+ },
114
+ },
115
+ });
116
+
117
+ /**
118
+ * defaultBoundaryDrawFactory builds the production TerraDraw for a boundary edit: the
119
+ * MapLibre adapter namespaced by prefixId, a permissive id strategy that accepts the
120
+ * caller's feature id (TerraDraw rejects any non-UUID4 id by default), and the two
121
+ * modes the editor needs — the rectangle draw mode and a select mode whose flags
122
+ * ({@link buildBoundarySelectFlags}) expose draggable corners and a draggable box.
123
+ */
124
+ const defaultBoundaryDrawFactory: BoundaryDrawFactory = ({ map, prefixId }) =>
125
+ new TerraDraw({
126
+ adapter: new FramedMapLibreAdapter({ map, prefixId }, { longitude: 0 }),
127
+ idStrategy: drawIdStrategy,
128
+ modes: [
129
+ buildBoundaryDrawMode(),
130
+ new TerraDrawSelectMode({ flags: buildBoundarySelectFlags() }),
131
+ ],
132
+ });
133
+
134
+ /**
135
+ * ringCorners reads a polygon's outer ring as its distinct corner positions, dropping
136
+ * the closing duplicate. Returns null for anything that is not a four-corner ring —
137
+ * the shape a rectangle mode produces and the only shape this engine manipulates.
138
+ */
139
+ const ringCorners = (geometry: Polygon): Position[] | null => {
140
+ const ring = geometry.coordinates[0];
141
+ if (!ring || ring.length !== BOUNDARY_RING_CORNERS + 1) {
142
+ return null;
143
+ }
144
+
145
+ return ring.slice(0, BOUNDARY_RING_CORNERS);
146
+ };
147
+
148
+ /**
149
+ * isAxisAlignedRectangle reports whether four corners are the rectangle of their own extent:
150
+ * they span at most two longitudes and two latitudes, and every corner of that extent is one of
151
+ * them. A freshly drawn box and a wholesale drag both satisfy it (a drag adds the same delta to
152
+ * every corner); a single-corner drag does not, which is the case the engine repairs.
153
+ *
154
+ * A box with no width or no height satisfies it too, with its corners meeting in pairs. It has
155
+ * to: the repair writes the rectangle of the extent back, so a ring that already is that
156
+ * rectangle and still read as sheared would be repaired into itself, and each write's own change
157
+ * would ask for the repair again.
158
+ */
159
+ const isAxisAlignedRectangle = (corners: Position[]): boolean => {
160
+ const lngs = new Set(corners.map((corner) => corner[0]));
161
+ const lats = new Set(corners.map((corner) => corner[1]));
162
+ if (lngs.size > 2 || lats.size > 2) {
163
+ return false;
164
+ }
165
+
166
+ const held = new Set(corners.map((corner) => `${corner[0]}|${corner[1]}`));
167
+
168
+ return [...lngs].every((lng) => [...lats].every((lat) => held.has(`${lng}|${lat}`)));
169
+ };
170
+
171
+ /**
172
+ * cornersFromCornerDrag rebuilds the box after ONE corner was dragged out of alignment, and
173
+ * answers its four corners index for index with the ring they were read from. The moved corner
174
+ * and the corner diagonally opposite it (two indices along a four-corner ring) are the box's new
175
+ * extent, so the two edges meeting the dragged corner follow it while the other two stay put:
176
+ * the resize every direct-manipulation editor performs.
177
+ *
178
+ * The indices are kept, never re-ordered west to east. TerraDraw drags one coordinate of the
179
+ * ring by its index for the whole gesture, so the dragged corner has to stay under its index
180
+ * when the drag crosses the opposite edge and the box turns over. Written back in canonical
181
+ * order, another corner would sit under that index, the next frame would resize from the wrong
182
+ * anchor, and the box would shrink to a sliver between two pointer positions. A box that has
183
+ * turned over is the same extent with its ring wound the other way.
184
+ *
185
+ * Returns null when the previous corners are unknown or more than one moved, so the
186
+ * caller falls back to the shape's own extent rather than guessing at an anchor.
187
+ */
188
+ const cornersFromCornerDrag = (
189
+ previous: Position[] | null,
190
+ corners: Position[],
191
+ ): Position[] | null => {
192
+ if (!previous || previous.length !== corners.length) {
193
+ return null;
194
+ }
195
+
196
+ const moved = corners.reduce<number[]>((indices, corner, index) => {
197
+ const before = previous[index];
198
+ if (!before || before[0] !== corner[0] || before[1] !== corner[1]) {
199
+ indices.push(index);
200
+ }
201
+
202
+ return indices;
203
+ }, []);
204
+
205
+ const movedIndex = moved.length === 1 ? moved[0] : undefined;
206
+ if (movedIndex === undefined) {
207
+ return null;
208
+ }
209
+
210
+ const besideIndex = (movedIndex + 1) % BOUNDARY_RING_CORNERS;
211
+ const anchorIndex = (movedIndex + 2) % BOUNDARY_RING_CORNERS;
212
+ const acrossIndex = (movedIndex + 3) % BOUNDARY_RING_CORNERS;
213
+ const [draggedLng, draggedLat] = corners[movedIndex] ?? [];
214
+ const [anchorLng, anchorLat] = corners[anchorIndex] ?? [];
215
+ if (
216
+ draggedLng === undefined ||
217
+ draggedLat === undefined ||
218
+ anchorLng === undefined ||
219
+ anchorLat === undefined
220
+ ) {
221
+ return null;
222
+ }
223
+
224
+ // The extent in canonical form, then each of the two corners on its own side of it.
225
+ const [west, south, east, north] = normalizeBoundingBox([
226
+ draggedLng,
227
+ draggedLat,
228
+ anchorLng,
229
+ anchorLat,
230
+ ]);
231
+ const draggedIsWest = draggedLng <= anchorLng;
232
+ const draggedIsSouth = draggedLat <= anchorLat;
233
+ const dragged: Position = [draggedIsWest ? west : east, draggedIsSouth ? south : north];
234
+ const anchor: Position = [draggedIsWest ? east : west, draggedIsSouth ? north : south];
235
+
236
+ // The corner after the dragged one stood on its meridian or on its parallel before the drag,
237
+ // and stands there still; the corner before it takes the other pairing.
238
+ const besideSharesLng = previous[besideIndex]?.[0] === previous[movedIndex]?.[0];
239
+ const onDraggedMeridian: Position = [dragged[0] ?? 0, anchor[1] ?? 0];
240
+ const onDraggedParallel: Position = [anchor[0] ?? 0, dragged[1] ?? 0];
241
+
242
+ const rebuilt: Position[] = [...corners];
243
+ rebuilt[movedIndex] = dragged;
244
+ rebuilt[anchorIndex] = anchor;
245
+ rebuilt[besideIndex] = besideSharesLng ? onDraggedMeridian : onDraggedParallel;
246
+ rebuilt[acrossIndex] = besideSharesLng ? onDraggedParallel : onDraggedMeridian;
247
+
248
+ return rebuilt;
249
+ };
250
+
251
+ /** closedRing writes four corners as the rectangle `Polygon` of their ring, first repeated last. */
252
+ const closedRing = (corners: Position[]): Polygon => ({
253
+ coordinates: [[...corners, ...corners.slice(0, 1)]],
254
+ type: "Polygon",
255
+ });
256
+
257
+ /**
258
+ * drawableBox writes a box as TerraDraw can hold it: in canonical form
259
+ * ({@link normalizeBoundingBox}), with a box that crosses the antimeridian cut at the line, at
260
+ * the nine decimals the library takes ({@link clampCoordinatePrecision}). A box read off a map's
261
+ * own bounds holds some fifteen.
262
+ *
263
+ * TerraDraw takes longitudes within [-180, 180] and nothing else, while a box that crosses the
264
+ * antimeridian is written with its east edge past 180. Handed over as written, it fails TerraDraw's
265
+ * validation: `updateFeatureGeometry` throws, and `addFeatures` refuses the seed and leaves nothing
266
+ * to select. So the box is drawn up to the line, from the side its west edge is on, which is where
267
+ * `normalizeBoundingBox` puts the west edge of every box; `[170, s, 190, n]` and
268
+ * `[-190, s, -170, n]` both draw as `[170, s, 180, n]`.
269
+ *
270
+ * A box whose west edge is on the line itself touches it rather than crossing it: it lies wholly
271
+ * east of the line, and is drawn whole from the line's east side, so `[180, s, 190, n]` draws as
272
+ * `[-180, s, -170, n]`. Cut at the line, it would be drawn zero wide, which TerraDraw cannot hold.
273
+ *
274
+ * `readDraft`, and the draft an `applyDraft` emits, report the box as drawn. A seed is not emitted,
275
+ * so a host that seeds a box across the line holds the box it gave until the next change reports
276
+ * the one drawn.
277
+ */
278
+ const drawableBox = (bbox: BoundingBox): BoundingBox => {
279
+ const [west, south, east, north] = normalizeBoundingBox(bbox);
280
+ // A box whose west edge is on the line starts at -180 instead, as wide as it is written.
281
+ const [drawnWest, drawnEast] =
282
+ west === LONGITUDE_LIMIT && east > LONGITUDE_LIMIT
283
+ ? [-LONGITUDE_LIMIT, east - west - LONGITUDE_LIMIT]
284
+ : [west, Math.min(east, LONGITUDE_LIMIT)];
285
+ const southWest = clampCoordinatePrecision([drawnWest, south]);
286
+ const northEast = clampCoordinatePrecision([drawnEast, north]);
287
+
288
+ return [southWest[0], southWest[1], northEast[0], northEast[1]];
289
+ };
290
+
291
+ /**
292
+ * sameBoundingBox reports whether two extents (either possibly absent) are
293
+ * element-wise equal, so the engine can drop an emission that would carry no news.
294
+ */
295
+ const sameBoundingBox = (a: BoundingBox | null, b: BoundingBox | null): boolean => {
296
+ if (a === null || b === null) {
297
+ return a === b;
298
+ }
299
+
300
+ return a.every((value, index) => value === b[index]);
301
+ };
302
+
303
+ /**
304
+ * TerraDrawBoundaryEngine implements the boundary-edit engine the MapLibreClient
305
+ * builds for a boundary edit. It owns one TerraDraw instance for the duration of the
306
+ * edit, arms the rectangle draw mode (plus a select mode for repositioning and
307
+ * resizing), attaches + seeds itself in the constructor, and emits the box's extent
308
+ * through the injected sink on every change.
309
+ *
310
+ * Two behaviours set it apart from the zone engine it otherwise mirrors:
311
+ *
312
+ * - It KEEPS THE SHAPE RECTANGULAR. TerraDraw drags each coordinate independently, so
313
+ * a corner drag would otherwise shear the box into a quad whose extent is bigger
314
+ * than the shape on screen. Every non-rectangular change is immediately rewritten
315
+ * as the box spanning the dragged corner and the one opposite it, which reads on
316
+ * screen as an ordinary corner resize.
317
+ * - It OWNS ITS CURSOR LOCK. The zone and segment engines rely on an editing hook one
318
+ * layer up to pin their create cursor; a boundary is edited in a self-contained
319
+ * surface with no such layer, so this engine locks the create cursor while the
320
+ * canvas is empty and releases it the moment a box exists (from then on the
321
+ * affordances are the corner-drag and whole-box-grab overrides).
322
+ *
323
+ * A seed or an applied box is read in canonical form and drawn within [-180, 180], the only
324
+ * longitudes TerraDraw holds. A box that crosses the antimeridian is drawn up to the line from
325
+ * the side of its west edge, so `[170, s, 190, n]` draws as `[170, s, 180, n]`, and a box whose
326
+ * west edge is on the line is drawn whole from -180, so `[180, s, 190, n]` draws as
327
+ * `[-180, s, -170, n]`. `readDraft` and every emitted draft carry the box as drawn; a seed is not
328
+ * emitted.
329
+ */
330
+ export class TerraDrawBoundaryEngine implements BoundaryEditEngine {
331
+ private readonly draw: TerraDraw;
332
+ private readonly featureId: string;
333
+ // The id the drawn box actually lives under in the TerraDraw store. It starts at
334
+ // featureId — the id a seeded edit adds the saved box under — but a create-draw
335
+ // produces a feature under the id strategy's TerraDraw-assigned id, so the finish
336
+ // handler re-points this to that drawn id. Every store read/write keys off this
337
+ // field. The type widens to string | number because the id strategy can mint
338
+ // either kind (terra-draw's FeatureId is not re-exported from the package entry).
339
+ private activeFeatureId: string | number;
340
+ // Whether a box currently exists. It gates the draw-vs-select mode, the cursor
341
+ // lock, and the create-draw's one-shot finish handling; clearDraft flips it back so
342
+ // the surface can be drawn on again.
343
+ private hasBox = false;
344
+ // The box's corners as of the last observed change, so a corner drag can be told
345
+ // from a wholesale move and the drag's anchor identified. Null until a box exists.
346
+ private lastCorners: Position[] | null = null;
347
+ // The last extent handed to the sink, so the programmatic echo of the engine's own
348
+ // re-rectangling write is dropped instead of reaching the consumer twice per frame.
349
+ private lastEmitted: BoundingBox | null = null;
350
+ // The current draft color, held so a base-map switch replay can re-apply it.
351
+ private color: `#${string}`;
352
+ // The map event engine the cursor listeners detach through; held so dispose/replay
353
+ // tears them down by reference. Null on the factory-only unit-test path.
354
+ private readonly events: MapEventEngine | null;
355
+ // The cursor controller this engine locks the create cursor on and layers the
356
+ // corner/grab overrides above. Null on the factory-only unit-test path.
357
+ private readonly cursor: CursorEngine | null;
358
+ private detachHoverCursor: (() => void) | null = null;
359
+ // Whether a drag has reported a live frame its release has not settled yet.
360
+ private gestureOpen = false;
361
+ // Whether the engine is writing a repaired rectangle back, whose echo it does not read.
362
+ private repairing = false;
363
+ private detachCursorReassert: (() => void) | null = null;
364
+ // The stable change/finish listener references, held so the pre-swap detach can `off`
365
+ // exactly what the constructor registered. A TerraDraw listener lives on the instance
366
+ // rather than on the adapter, so `stop()` does NOT drop it — an inline closure per
367
+ // replay would stack one more binding on every base-map switch.
368
+ private readonly changeHandler: TerraDrawEventListeners["change"];
369
+ private readonly finishHandler: TerraDrawEventListeners["finish"];
370
+ // The box read off the store by {@link detachBeforeStyleReload}, held for the replay to
371
+ // re-seed from. It exists because stopping TerraDraw EMPTIES the store: `stop()`
372
+ // unregisters the adapter, whose base `unregister()` ends in its own `clear()`, which
373
+ // calls back through `onClear` into `_store.clear()`. So by the time the replay runs
374
+ // there is nothing left to read, and a replay that re-registered the adapter correctly
375
+ // still came back to five empty layers. Null while no swap is in flight.
376
+ private detachedBbox: BoundingBox | null = null;
377
+ // Whether TerraDraw is stopped for a style reload: raised by the detach, lowered by the replay.
378
+ // While it is raised the store is empty and refuses every write, so the engine reads and
379
+ // writes what it holds itself.
380
+ private detached = false;
381
+ // The latest write made while TerraDraw is stopped for a style reload, applied when the replay
382
+ // ends: a box as it is drawn, or null for a clear. Undefined when none was made.
383
+ private heldDraft: BoundingBox | null | undefined;
384
+ // Whether the edit is over. A disposed engine has no replay to come, so a box or a clear
385
+ // applied to it inside the detach window is held by nothing.
386
+ private disposed = false;
387
+
388
+ constructor(
389
+ private readonly map: MapLibreMap,
390
+ options: BoundaryEditOptions,
391
+ private readonly emitDraft: EmitBoundaryDraft,
392
+ createDraw: BoundaryDrawFactory = defaultBoundaryDrawFactory,
393
+ // Optional so a unit test that drives the engine through its factory injection
394
+ // alone still constructs without a real MapEventEngine; the cursor wiring only
395
+ // attaches when both are present.
396
+ events?: MapEventEngine,
397
+ cursor?: CursorEngine,
398
+ ) {
399
+ this.featureId = options.featureId;
400
+ this.activeFeatureId = options.featureId;
401
+ this.color = readEditColor(options.color, "TerraDrawBoundaryEngine");
402
+ this.events = events ?? null;
403
+ this.cursor = cursor ?? null;
404
+
405
+ this.changeHandler = (ids, _type, context) => {
406
+ this.handleChange(ids, isProgrammaticChange(context));
407
+ };
408
+ this.finishHandler = (id) => {
409
+ this.handleFinish(id);
410
+ };
411
+
412
+ this.draw = createDraw({ map: this.map, prefixId: BOUNDARY_TERRADRAW_PREFIX });
413
+
414
+ this.draw.start();
415
+ this.attachDrawListeners();
416
+
417
+ if (options.seedBbox) {
418
+ const seed = drawableBox(options.seedBbox);
419
+ // The seed is not emitted, since the consumer supplied it, but it is recorded as drawn,
420
+ // and before it is added: TerraDraw fires a change for the feature the seed adds, which
421
+ // would report it. Recorded, the first clear is also news and not a repeat of the initial
422
+ // null. For a seed across the antimeridian the consumer holds the box it gave, not this
423
+ // one, until the next change reports the box as drawn.
424
+ this.lastEmitted = seed;
425
+ try {
426
+ this.seedFeature(seed);
427
+ } catch (error) {
428
+ // No engine is handed back to dispose, so what the lines above started and subscribed
429
+ // comes off here.
430
+ this.dispose();
431
+ throw error;
432
+ }
433
+ } else {
434
+ this.armDrawMode();
435
+ }
436
+
437
+ this.applyBoundaryDraftStyle(this.color);
438
+
439
+ this.detachHoverCursor = this.attachHoverCursor();
440
+
441
+ // Attached LAST, after draw.start() wired TerraDraw's own move handler, so
442
+ // MapLibre dispatches the re-pin after TerraDraw and it wins any listener-order
443
+ // race — the same ordering every lock-holding engine uses.
444
+ this.detachCursorReassert = this.attachCursorReassert();
445
+ }
446
+
447
+ setDraftStyle(style: { color: string }): void {
448
+ // The edit is over. A disposed engine writes and starts nothing, wherever it was disposed.
449
+ if (this.disposed) {
450
+ return;
451
+ }
452
+
453
+ this.color = readEditColor(style.color, "TerraDrawBoundaryEngine");
454
+
455
+ // A stopped instance refuses a mode's options. The replay styles the scene in the color
456
+ // held above.
457
+ if (this.detached) {
458
+ return;
459
+ }
460
+
461
+ this.applyBoundaryDraftStyle(this.color);
462
+ }
463
+
464
+ readDraft(): BoundingBox | null {
465
+ // The edit is over, and a disposed engine holds no draft.
466
+ if (this.disposed) {
467
+ return null;
468
+ }
469
+
470
+ // The store is empty between the detach and the replay, so the box is the one the engine
471
+ // holds for the replay: the write made since the detach, or the box the detach read. It is
472
+ // answered as a copy, as a read off the store is.
473
+ if (this.detached) {
474
+ const held = this.heldDraft === undefined ? this.detachedBbox : this.heldDraft;
475
+
476
+ return held === null ? null : [...held];
477
+ }
478
+
479
+ return this.currentBbox();
480
+ }
481
+
482
+ applyDraft(bbox: BoundingBox): void {
483
+ // The edit is over. A disposed engine writes and starts nothing, wherever it was disposed.
484
+ if (this.disposed) {
485
+ return;
486
+ }
487
+
488
+ const normalized = drawableBox(bbox);
489
+
490
+ // A stopped instance refuses every write, so a box applied between the detach and the
491
+ // replay is held, the latest write alone, and the replay writes it when it ends.
492
+ if (this.detached) {
493
+ this.heldDraft = normalized;
494
+
495
+ return;
496
+ }
497
+
498
+ if (this.hasBox) {
499
+ updateDrawGeometry(
500
+ this.draw,
501
+ this.activeFeatureId,
502
+ boundingBoxToPolygon(normalized),
503
+ boundaryRefusal,
504
+ );
505
+
506
+ return;
507
+ }
508
+
509
+ // No box yet — a programmatic write is the first one, so it lands as a seed
510
+ // (which also switches the surface into its manipulate state).
511
+ this.seedFeature(normalized);
512
+ this.emitBbox(normalized, true, "settled");
513
+ }
514
+
515
+ clearDraft(): void {
516
+ // The edit is over. A disposed engine writes and starts nothing, wherever it was disposed.
517
+ if (this.disposed) {
518
+ return;
519
+ }
520
+
521
+ // Held as an applied box is: the replay clears the box it has drawn again.
522
+ if (this.detached) {
523
+ this.heldDraft = null;
524
+
525
+ return;
526
+ }
527
+
528
+ this.draw.clear();
529
+ this.hasBox = false;
530
+ this.lastCorners = null;
531
+ this.activeFeatureId = this.featureId;
532
+ this.armDrawMode();
533
+ this.gestureOpen = false;
534
+ this.emitBbox(null, false, "settled");
535
+ }
536
+
537
+ dispose(): void {
538
+ // Drop the map-level re-assert FIRST so a move landing during teardown cannot
539
+ // re-pin a lock for an edit that has ended — the listeners-before-instance
540
+ // ordering every lock-holding engine uses.
541
+ this.detachCursorReassert?.();
542
+ this.detachCursorReassert = null;
543
+
544
+ this.detachHoverCursor?.();
545
+ this.detachHoverCursor = null;
546
+ this.cursor?.popOverride();
547
+ this.cursor?.unlock();
548
+
549
+ // Drop the listeners by reference, then clear the store (removing the rendered
550
+ // feature) and stop TerraDraw (removing its sources + layers from the style). The
551
+ // clear is guarded on `enabled` because `TerraDraw.clear()` runs `checkEnabled()`
552
+ // and throws on a stopped instance: a dispose landing inside the detach window —
553
+ // an edit ended while a base-map switch is still waiting for its style — reaches
554
+ // an instance `detachBeforeStyleReload` already stopped.
555
+ this.detachDrawListeners();
556
+ if (this.draw.enabled) {
557
+ this.draw.clear();
558
+ }
559
+ this.draw.stop();
560
+
561
+ // A dispose inside the detach window ends an edit whose replay never comes, so what the
562
+ // engine held for it goes with the edit and a late read answers no box. The window's flag
563
+ // stays raised: a late write is dropped where the stopped library would refuse it.
564
+ this.disposed = true;
565
+ this.heldDraft = undefined;
566
+ this.detachedBbox = null;
567
+ }
568
+
569
+ /**
570
+ * detachBeforeStyleReload stops TerraDraw before the swap, so the replay's `start()`
571
+ * actually re-registers the adapter. See {@link EditEngine.detachBeforeStyleReload}
572
+ * for why the pair is needed and why the order is load-bearing: the adapter's
573
+ * `unregister()` removes five layers and three sources unguarded, which succeeds
574
+ * silently on the outgoing style and is noisy-then-fatal on the incoming one.
575
+ *
576
+ * The box is read off the store FIRST, because `stop()` empties it — the adapter's base
577
+ * `unregister()` ends in its own `clear()`, which calls back through `onClear` into
578
+ * `_store.clear()`. And the listeners come off before that, so the deletion the clear
579
+ * emits is not turned into a draft saying the user erased their box mid-swap.
580
+ */
581
+ detachBeforeStyleReload(): void {
582
+ // The edit is over. A disposed engine writes and starts nothing, wherever it was disposed.
583
+ if (this.disposed) {
584
+ return;
585
+ }
586
+
587
+ // A second detach before the replay reads a store the first one emptied: the box held for
588
+ // the replay stands.
589
+ if (this.detached) {
590
+ return;
591
+ }
592
+
593
+ this.detached = true;
594
+ this.detachedBbox = this.currentBbox();
595
+ this.detachDrawListeners();
596
+ this.draw.stop();
597
+ }
598
+
599
+ /**
600
+ * replayAfterStyleReload re-renders the active edit after a base-map switch wiped
601
+ * the style. It re-attaches what setStyle tore down: the library's layers + change
602
+ * listeners, the box, its color, and the hover cursor over its corners and interior (the
603
+ * TerraDraw point/polygon layers are rebuilt). A no-op-safe rebuild — the previous
604
+ * detaches already ran when the style reload tore the layers down.
605
+ *
606
+ * It is the second half of a pair: {@link detachBeforeStyleReload} must have stopped
607
+ * the instance before the swap, or the `start()` below returns early and re-registers
608
+ * nothing.
609
+ */
610
+ replayAfterStyleReload(): void {
611
+ // The edit is over. A disposed engine writes and starts nothing, wherever it was disposed.
612
+ if (this.disposed) {
613
+ return;
614
+ }
615
+
616
+ // The detach's snapshot first: `stop()` emptied the store, so reading it here answers
617
+ // null for every edit that was actually detached. The store read is the fallback for a
618
+ // replay reached without one.
619
+ const bbox = this.detachedBbox ?? this.currentBbox();
620
+ this.detachedBbox = null;
621
+ this.detached = false;
622
+
623
+ this.draw.start();
624
+ this.attachDrawListeners();
625
+
626
+ if (bbox) {
627
+ // Cleared before the re-seed, because the STORE survives a style swap while the
628
+ // adapter's layers do not. `addFeatures` reports an id already in the store
629
+ // invalid rather than throwing, so a bare re-seed would add nothing and the
630
+ // re-registered layers would stay empty; and a box drawn interactively lives
631
+ // under TerraDraw's own generated id, so re-seeding under `featureId` beside it
632
+ // would leave two boxes on screen. The bbox above was read before this ran.
633
+ this.draw.clear();
634
+ this.seedFeature(bbox);
635
+ } else {
636
+ this.armDrawMode();
637
+ }
638
+
639
+ this.applyBoundaryDraftStyle(this.color);
640
+
641
+ this.detachHoverCursor?.();
642
+ this.detachHoverCursor = this.attachHoverCursor();
643
+
644
+ // Rebuilt LAST, after the re-started TerraDraw re-wired its own move handler, so
645
+ // the re-pin keeps dispatching after it.
646
+ this.detachCursorReassert?.();
647
+ this.detachCursorReassert = this.attachCursorReassert();
648
+
649
+ // The write made while the instance was stopped lands last, on the scene the lines above
650
+ // rebuilt, as it would have landed outside the window.
651
+ const held = this.heldDraft;
652
+ this.heldDraft = undefined;
653
+ if (held === null) {
654
+ applyHeldWrite(() => this.clearDraft());
655
+ } else if (held !== undefined) {
656
+ applyHeldWrite(() => this.applyDraft(held));
657
+ }
658
+ }
659
+
660
+ /**
661
+ * attachDrawListeners wires the change + finish listeners onto the (re-)started
662
+ * TerraDraw instance. Shared by the constructor and the style-reload replay so both
663
+ * paths subscribe identically.
664
+ */
665
+ private attachDrawListeners(): void {
666
+ this.draw.on("change", this.changeHandler);
667
+ this.draw.on("finish", this.finishHandler);
668
+ }
669
+
670
+ /**
671
+ * detachDrawListeners drops the change + finish listeners by reference. The detach
672
+ * half of {@link attachDrawListeners}, needed because a TerraDraw listener lives on
673
+ * the instance and not on the adapter: `stop()` unregisters the adapter and leaves
674
+ * every listener attached.
675
+ */
676
+ private detachDrawListeners(): void {
677
+ this.draw.off("change", this.changeHandler);
678
+ this.draw.off("finish", this.finishHandler);
679
+ }
680
+
681
+ /**
682
+ * handleChange is the single fan-out the change listener calls on every geometry
683
+ * change. It reads the box back, repairs it when a corner drag sheared it out of
684
+ * alignment, and emits the resulting extent.
685
+ *
686
+ * The repair is what makes corner-resizing possible at all: TerraDraw drags each
687
+ * coordinate independently, so the store briefly holds a general quad. Rewriting it
688
+ * as the box spanning the dragged corner and the one opposite it happens within the
689
+ * same change, so the user sees a rectangle tracking the pointer rather than a
690
+ * shearing quad.
691
+ */
692
+ private handleChange(ids: (string | number)[], programmatic: boolean): void {
693
+ // The echo of the engine's own repair carries the extent just reported, and it is no
694
+ // programmatic write: reading it as one would close the drag it belongs to.
695
+ if (this.repairing) {
696
+ return;
697
+ }
698
+
699
+ // Only the active feature's changes drive the draft. Before a create-draw
700
+ // finishes (and handleFinish adopts the drawn id) the in-progress feature lives
701
+ // under a TerraDraw-assigned id, so its mid-draw changes are skipped — the
702
+ // completed box emits once, on finish.
703
+ if (!ids.includes(this.activeFeatureId)) {
704
+ return;
705
+ }
706
+
707
+ const geometry = this.geometryOf(this.activeFeatureId);
708
+ if (!geometry) {
709
+ return;
710
+ }
711
+
712
+ const corners = ringCorners(geometry);
713
+ if (!corners) {
714
+ return;
715
+ }
716
+
717
+ if (!isAxisAlignedRectangle(corners)) {
718
+ const dragged = cornersFromCornerDrag(this.lastCorners, corners);
719
+ const repairedPolygon = dragged
720
+ ? closedRing(dragged)
721
+ : boundingBoxToPolygon(this.extentOf(geometry));
722
+ const repaired = this.extentOf(repairedPolygon);
723
+ this.lastCorners = ringCorners(repairedPolygon);
724
+
725
+ // Report BEFORE writing the correction back. updateFeatureGeometry fires its own
726
+ // api-origin change SYNCHRONOUSLY, so writing first would let the echo reach the
727
+ // sink ahead of this call and report the user's own drag as programmatic. Emitting
728
+ // first reports the gesture as what it is and leaves the echo carrying no news, so
729
+ // the consumer sees exactly one draft per gesture either way.
730
+ this.emitChange(repaired, programmatic);
731
+ this.repairing = true;
732
+ try {
733
+ this.draw.updateFeatureGeometry(this.activeFeatureId, repairedPolygon);
734
+ } finally {
735
+ this.repairing = false;
736
+ }
737
+
738
+ return;
739
+ }
740
+
741
+ this.lastCorners = corners;
742
+ this.emitChange(this.extentOf(geometry), programmatic);
743
+ }
744
+
745
+ /**
746
+ * emitChange reports a changed box with the phase its origin gives it. A change TerraDraw
747
+ * makes under the pointer (a corner drag, a whole-box drag) is one frame of a gesture the
748
+ * select mode's `finish` closes, so it is `live` and {@link handleFinish} settles it. A
749
+ * store-API write is whole when it lands, so it is `settled`, and it closes a drag still open:
750
+ * it replaces the box the drag moved.
751
+ */
752
+ private emitChange(bbox: BoundingBox, programmatic: boolean): void {
753
+ const phase: DraftPhase = programmatic ? "settled" : "live";
754
+ this.gestureOpen = phase === "live";
755
+ this.emitBbox(bbox, programmatic, phase);
756
+ }
757
+
758
+ /**
759
+ * handleFinish runs when TerraDraw completes a drawn rectangle. It is the
760
+ * create-draw's completion seam: the drawn feature carries the id strategy's
761
+ * TerraDraw-assigned id, not featureId, so until this fires the feature is invisible
762
+ * to the featureId-keyed reads and no draft emits. The handler adopts the drawn id,
763
+ * switches into the select mode and selects the feature (so only ONE box is ever
764
+ * drawn and it becomes resizable), hands the cursor over from "draw here" to the
765
+ * manipulation affordances, and emits the finished extent so the consumer's confirm
766
+ * enables.
767
+ *
768
+ * Guarded to run once per box: a resize after the switch flows through `change`, and
769
+ * a seeded edit never fires finish at all. A redraw re-opens the guard through
770
+ * clearDraft.
771
+ */
772
+ private handleFinish(id: string | number): void {
773
+ if (this.hasBox) {
774
+ if (id === this.activeFeatureId) {
775
+ this.settleGesture();
776
+ }
777
+
778
+ return;
779
+ }
780
+
781
+ const geometry = this.geometryOf(id);
782
+ const corners = geometry ? ringCorners(geometry) : null;
783
+ if (!geometry || !corners) {
784
+ return;
785
+ }
786
+
787
+ this.activeFeatureId = id;
788
+ this.adoptBox(corners);
789
+ this.draw.selectFeature(id);
790
+ this.emitBbox(this.extentOf(geometry), false, "settled");
791
+ }
792
+
793
+ /**
794
+ * settleGesture reports the box once more, `settled` and interactive, when a drag that
795
+ * reported `live` frames is released, and does nothing when none is open: the select mode
796
+ * finishes every pointer release, a release that moved nothing included.
797
+ */
798
+ private settleGesture(): void {
799
+ if (!this.gestureOpen) {
800
+ return;
801
+ }
802
+
803
+ this.gestureOpen = false;
804
+ const bbox = this.currentBbox();
805
+ if (bbox !== null) {
806
+ this.emitBbox(bbox, false, "settled", true);
807
+ }
808
+ }
809
+
810
+ /**
811
+ * seedFeature adds the box feature under featureId, selects it, and shows its corner
812
+ * handles. The feature carries the draw mode name in `properties.mode` so TerraDraw
813
+ * renders it under the rectangle mode's styling.
814
+ */
815
+ private seedFeature(bbox: BoundingBox): void {
816
+ const feature: GeoJSONStoreFeatures = {
817
+ geometry: boundingBoxToPolygon(bbox),
818
+ id: this.featureId,
819
+ properties: { mode: BOUNDARY_DRAW_MODE_NAME },
820
+ type: "Feature",
821
+ };
822
+ addDrawFeature(this.draw, feature, boundaryRefusal);
823
+ // The seed always lands under featureId, so re-anchor the active id to it: a
824
+ // style-reload replay re-seeds the current box (whatever id it had drawn under)
825
+ // back under featureId, and the reads that follow must track featureId again.
826
+ this.activeFeatureId = this.featureId;
827
+
828
+ const corners = ringCorners(boundingBoxToPolygon(bbox));
829
+ this.adoptBox(corners ?? []);
830
+ this.draw.selectFeature(this.featureId);
831
+ }
832
+
833
+ /**
834
+ * adoptBox moves the surface into its "a box exists" state: it records the corners,
835
+ * switches into the select mode so no second box can be started, and releases the
836
+ * create cursor — from here the affordances are the corner-drag and whole-box-grab
837
+ * overrides, and a locked "draw here" cursor would misdescribe them.
838
+ */
839
+ private adoptBox(corners: Position[]): void {
840
+ this.hasBox = true;
841
+ this.lastCorners = corners;
842
+ this.draw.setMode(SELECT_MODE);
843
+ this.cursor?.unlock();
844
+ }
845
+
846
+ /**
847
+ * armDrawMode moves the surface into its empty state: the rectangle draw mode so the
848
+ * next gesture draws a box, and the "+" create cursor pinned so the empty canvas
849
+ * reads as drawable. Without the explicit setMode, start() leaves TerraDraw in its
850
+ * no-op default mode and the canvas cannot draw at all.
851
+ */
852
+ private armDrawMode(): void {
853
+ this.draw.setMode(BOUNDARY_DRAW_MODE_NAME);
854
+ this.cursor?.lock(ZONE_CREATE_CURSOR);
855
+ }
856
+
857
+ /**
858
+ * emitBbox hands an extent to the sink, dropping an emission that carries no news.
859
+ * The dedupe is load-bearing rather than cosmetic: the engine repairs a sheared box
860
+ * by writing the corrected rectangle back, and that write fires its own api-origin
861
+ * change carrying the extent just emitted. Without the guard every corner-drag frame
862
+ * would reach the consumer twice.
863
+ */
864
+ private emitBbox(
865
+ bbox: BoundingBox | null,
866
+ programmatic: boolean,
867
+ phase: DraftPhase,
868
+ closesGesture = false,
869
+ ): void {
870
+ // The draft that settles a drag carries the extent of its last frame, and it is news: it
871
+ // says the drag is over.
872
+ if (!closesGesture && sameBoundingBox(bbox, this.lastEmitted)) {
873
+ return;
874
+ }
875
+
876
+ this.lastEmitted = bbox;
877
+ notifyListeners([this.emitDraft], { bbox, phase, programmatic });
878
+ }
879
+
880
+ /**
881
+ * currentBbox reads the box's current extent from the TerraDraw store, or null when
882
+ * no box exists (before the first draw, after a clear).
883
+ */
884
+ private currentBbox(): BoundingBox | null {
885
+ const geometry = this.geometryOf(this.activeFeatureId);
886
+
887
+ return geometry ? this.extentOf(geometry) : null;
888
+ }
889
+
890
+ /**
891
+ * extentOf reduces a polygon to its normalized [west, south, east, north] extent, planar over
892
+ * its outer ring as the engine drew it: a box wider than half the world keeps its sides, where
893
+ * `boundsOf` would read it across the antimeridian. For a rectangle that is a lossless read;
894
+ * for the transient quad a mid-drag store holds it is the fallback the repair path degrades to.
895
+ *
896
+ * The ring is folded position by position rather than spread into `Math.min` and `Math.max`,
897
+ * which throw a RangeError once a ring is longer than a call's argument list.
898
+ */
899
+ private extentOf(geometry: Polygon): BoundingBox {
900
+ let west = Number.POSITIVE_INFINITY;
901
+ let south = Number.POSITIVE_INFINITY;
902
+ let east = Number.NEGATIVE_INFINITY;
903
+ let north = Number.NEGATIVE_INFINITY;
904
+ for (const [lng, lat] of geometry.coordinates[0] ?? []) {
905
+ if (
906
+ lng === undefined ||
907
+ lat === undefined ||
908
+ !Number.isFinite(lng) ||
909
+ !Number.isFinite(lat)
910
+ ) {
911
+ continue;
912
+ }
913
+
914
+ west = Math.min(west, lng);
915
+ south = Math.min(south, lat);
916
+ east = Math.max(east, lng);
917
+ north = Math.max(north, lat);
918
+ }
919
+
920
+ // No finite position leaves the fold where it started, and the extent is the empty box at
921
+ // the origin.
922
+ return normalizeBoundingBox(west <= east ? [west, south, east, north] : [0, 0, 0, 0]);
923
+ }
924
+
925
+ /**
926
+ * geometryOf reads one feature's shape from the TerraDraw store by id and narrows it
927
+ * to a Polygon — or null when the feature is gone or its kind does not match (a
928
+ * transient state mid-draw, or the Point geometry the store union also admits).
929
+ */
930
+ private geometryOf(id: string | number): Polygon | null {
931
+ const feature = this.draw.getSnapshotFeature(id);
932
+ if (!feature) {
933
+ return null;
934
+ }
935
+
936
+ const geometry = feature.geometry;
937
+
938
+ return geometry.type === "Polygon" ? geometry : null;
939
+ }
940
+
941
+ /**
942
+ * applyBoundaryDraftStyle pushes the draft color onto the rectangle draw mode and the
943
+ * select mode so the box's fill, outline, and corner handles all render in it.
944
+ * updateModeOptions accepts a partial options object and runs while the modes are
945
+ * started, recoloring live. The color was held to `#rrggbb` as it was handed over
946
+ * ({@link readEditColor}).
947
+ */
948
+ private applyBoundaryDraftStyle(hex: `#${string}`): void {
949
+ this.draw.updateModeOptions<typeof TerraDrawRectangleMode>(BOUNDARY_DRAW_MODE_NAME, {
950
+ styles: { fillColor: hex, fillOpacity: 0.2, outlineColor: hex, outlineWidth: 2 },
951
+ });
952
+
953
+ this.draw.updateModeOptions<typeof TerraDrawSelectMode>(SELECT_MODE, {
954
+ styles: {
955
+ selectedLineStringColor: hex,
956
+ selectedPointColor: hex,
957
+ selectedPolygonColor: hex,
958
+ selectedPolygonOutlineColor: hex,
959
+ selectionPointColor: hex,
960
+ },
961
+ });
962
+ }
963
+
964
+ /**
965
+ * attachCursorReassert subscribes the shared map-level mousemove re-assert that
966
+ * re-pins the held create cursor (or an override above it) after a cursor clobber on
967
+ * a plain move. A no-op (null detach) when the event engine or cursor controller is
968
+ * absent — the factory-only unit-test path.
969
+ */
970
+ private attachCursorReassert(): (() => void) | null {
971
+ if (!this.events || !this.cursor) {
972
+ return null;
973
+ }
974
+
975
+ return attachCursorReassert(this.events, this.cursor);
976
+ }
977
+
978
+ /**
979
+ * attachHoverCursor layers the edit's hover cursor over whatever cursor is held, through the
980
+ * shared {@link attachEditHoverCursor}: the `move` cursor over a corner handle, which a drag
981
+ * resizes the box by, and grab (grabbing while pressed) over the box's interior, which a drag
982
+ * repositions. A corner wins over the interior it sits on: resize beats reposition. The box
983
+ * carries no insert midpoint (a rectangle has exactly four corners), so the midpoint property
984
+ * never appears on its handles. A no-op (empty detach) on the factory-only unit-test path.
985
+ */
986
+ private attachHoverCursor(): () => void {
987
+ const events = this.events;
988
+ const cursor = this.cursor;
989
+ if (!events || !cursor) {
990
+ return () => {};
991
+ }
992
+
993
+ return attachEditHoverCursor({
994
+ cursor,
995
+ events,
996
+ layers: [
997
+ { kind: "handle", layerId: BOUNDARY_VERTEX_LAYER_ID, midpointProperty: "midPoint" },
998
+ { kind: "interior", layerId: BOUNDARY_FILL_LAYER_ID },
999
+ ],
1000
+ map: this.map,
1001
+ });
1002
+ }
1003
+ }