@mountaya/studio 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 (524) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/LICENCE.fr.txt +280 -0
  3. package/LICENSE.txt +262 -0
  4. package/README.md +917 -2
  5. package/dist/agent/index.cjs +2854 -0
  6. package/dist/agent/index.cjs.map +1 -0
  7. package/dist/agent/index.d.cts +1257 -0
  8. package/dist/agent/index.d.ts +1257 -0
  9. package/dist/agent/index.js +2818 -0
  10. package/dist/agent/index.js.map +1 -0
  11. package/dist/bus-BwiNiXdH.d.ts +514 -0
  12. package/dist/bus-DzmhPwdK.d.cts +514 -0
  13. package/dist/chainModel-B23pEP_1.d.cts +127 -0
  14. package/dist/chainModel-B23pEP_1.d.ts +127 -0
  15. package/dist/chunk-2HFY7ETU.js +5721 -0
  16. package/dist/chunk-2HFY7ETU.js.map +1 -0
  17. package/dist/chunk-355TOXSB.js +72 -0
  18. package/dist/chunk-355TOXSB.js.map +1 -0
  19. package/dist/chunk-4ZCUZVSV.js +10275 -0
  20. package/dist/chunk-4ZCUZVSV.js.map +1 -0
  21. package/dist/chunk-6HEKY3NF.js +95 -0
  22. package/dist/chunk-6HEKY3NF.js.map +1 -0
  23. package/dist/chunk-7GFLGGBX.cjs +8 -0
  24. package/dist/chunk-7GFLGGBX.cjs.map +1 -0
  25. package/dist/chunk-7NBRCENN.cjs +19 -0
  26. package/dist/chunk-7NBRCENN.cjs.map +1 -0
  27. package/dist/chunk-AF5GCXE3.js +8 -0
  28. package/dist/chunk-AF5GCXE3.js.map +1 -0
  29. package/dist/chunk-CJDIFRGZ.cjs +2005 -0
  30. package/dist/chunk-CJDIFRGZ.cjs.map +1 -0
  31. package/dist/chunk-CNPZY7N3.js +349 -0
  32. package/dist/chunk-CNPZY7N3.js.map +1 -0
  33. package/dist/chunk-DZJHTWSF.cjs +45 -0
  34. package/dist/chunk-DZJHTWSF.cjs.map +1 -0
  35. package/dist/chunk-EABIHHWA.js +42 -0
  36. package/dist/chunk-EABIHHWA.js.map +1 -0
  37. package/dist/chunk-EKZWV6RS.cjs +415 -0
  38. package/dist/chunk-EKZWV6RS.cjs.map +1 -0
  39. package/dist/chunk-EOKRXXAC.cjs +24 -0
  40. package/dist/chunk-EOKRXXAC.cjs.map +1 -0
  41. package/dist/chunk-F73W2ZTJ.js +1126 -0
  42. package/dist/chunk-F73W2ZTJ.js.map +1 -0
  43. package/dist/chunk-H4DVOZ5O.js +1897 -0
  44. package/dist/chunk-H4DVOZ5O.js.map +1 -0
  45. package/dist/chunk-HI52PBFT.cjs +10314 -0
  46. package/dist/chunk-HI52PBFT.cjs.map +1 -0
  47. package/dist/chunk-IDBXFBLG.cjs +1225 -0
  48. package/dist/chunk-IDBXFBLG.cjs.map +1 -0
  49. package/dist/chunk-LBWTJZUJ.js +297 -0
  50. package/dist/chunk-LBWTJZUJ.js.map +1 -0
  51. package/dist/chunk-NCLA6DKD.cjs +310 -0
  52. package/dist/chunk-NCLA6DKD.cjs.map +1 -0
  53. package/dist/chunk-O4MC5DPD.js +19 -0
  54. package/dist/chunk-O4MC5DPD.js.map +1 -0
  55. package/dist/chunk-OP37FKW6.cjs +98 -0
  56. package/dist/chunk-OP37FKW6.cjs.map +1 -0
  57. package/dist/chunk-OQSYFH3Z.cjs +5945 -0
  58. package/dist/chunk-OQSYFH3Z.cjs.map +1 -0
  59. package/dist/chunk-PACIO4NS.cjs +26 -0
  60. package/dist/chunk-PACIO4NS.cjs.map +1 -0
  61. package/dist/chunk-PSZ2R3TC.cjs +75 -0
  62. package/dist/chunk-PSZ2R3TC.cjs.map +1 -0
  63. package/dist/chunk-QFO5CZG2.cjs +136 -0
  64. package/dist/chunk-QFO5CZG2.cjs.map +1 -0
  65. package/dist/chunk-QL63MUEW.cjs +140 -0
  66. package/dist/chunk-QL63MUEW.cjs.map +1 -0
  67. package/dist/chunk-RFUPPVZO.js +17 -0
  68. package/dist/chunk-RFUPPVZO.js.map +1 -0
  69. package/dist/chunk-RPG2LWMP.js +23 -0
  70. package/dist/chunk-RPG2LWMP.js.map +1 -0
  71. package/dist/chunk-TIBXK6B7.cjs +12 -0
  72. package/dist/chunk-TIBXK6B7.cjs.map +1 -0
  73. package/dist/chunk-UU65VNEV.js +381 -0
  74. package/dist/chunk-UU65VNEV.js.map +1 -0
  75. package/dist/chunk-VGX6TR2I.js +209 -0
  76. package/dist/chunk-VGX6TR2I.js.map +1 -0
  77. package/dist/chunk-WUTDDBVP.js +130 -0
  78. package/dist/chunk-WUTDDBVP.js.map +1 -0
  79. package/dist/chunk-WVQQLKCI.cjs +224 -0
  80. package/dist/chunk-WVQQLKCI.cjs.map +1 -0
  81. package/dist/chunk-WZYXG3SE.js +111 -0
  82. package/dist/chunk-WZYXG3SE.js.map +1 -0
  83. package/dist/chunk-XDI2X3KE.js +6 -0
  84. package/dist/chunk-XDI2X3KE.js.map +1 -0
  85. package/dist/chunk-XKHLRIC7.cjs +381 -0
  86. package/dist/chunk-XKHLRIC7.cjs.map +1 -0
  87. package/dist/context-DNtd2WUv.d.cts +11666 -0
  88. package/dist/context-DgB72Bur.d.ts +11666 -0
  89. package/dist/directorThreads-CqmvsV8b.d.cts +80 -0
  90. package/dist/directorThreads-CqmvsV8b.d.ts +80 -0
  91. package/dist/en-Bu4Ti9Ev.d.cts +2315 -0
  92. package/dist/en-Bu4Ti9Ev.d.ts +2315 -0
  93. package/dist/engines/index.cjs +3446 -0
  94. package/dist/engines/index.cjs.map +1 -0
  95. package/dist/engines/index.d.cts +2216 -0
  96. package/dist/engines/index.d.ts +2216 -0
  97. package/dist/engines/index.js +3416 -0
  98. package/dist/engines/index.js.map +1 -0
  99. package/dist/handlers/index.cjs +99 -0
  100. package/dist/handlers/index.cjs.map +1 -0
  101. package/dist/handlers/index.d.cts +445 -0
  102. package/dist/handlers/index.d.ts +445 -0
  103. package/dist/handlers/index.js +42 -0
  104. package/dist/handlers/index.js.map +1 -0
  105. package/dist/index.cjs +4562 -0
  106. package/dist/index.cjs.map +1 -0
  107. package/dist/index.d.cts +7297 -0
  108. package/dist/index.d.ts +7297 -0
  109. package/dist/index.js +3223 -0
  110. package/dist/index.js.map +1 -0
  111. package/dist/plugins/index.cjs +977 -0
  112. package/dist/plugins/index.cjs.map +1 -0
  113. package/dist/plugins/index.d.cts +313 -0
  114. package/dist/plugins/index.d.ts +313 -0
  115. package/dist/plugins/index.js +933 -0
  116. package/dist/plugins/index.js.map +1 -0
  117. package/dist/saveFile-j-1kkApx.d.cts +123 -0
  118. package/dist/saveFile-j-1kkApx.d.ts +123 -0
  119. package/dist/seams/index.cjs +152 -0
  120. package/dist/seams/index.cjs.map +1 -0
  121. package/dist/seams/index.d.cts +485 -0
  122. package/dist/seams/index.d.ts +485 -0
  123. package/dist/seams/index.js +79 -0
  124. package/dist/seams/index.js.map +1 -0
  125. package/dist/shareLink-B6hlt942.d.ts +144 -0
  126. package/dist/shareLink-C7rIMb7x.d.ts +527 -0
  127. package/dist/shareLink-CnTxxXjp.d.cts +144 -0
  128. package/dist/shareLink-DyZVYH2V.d.cts +527 -0
  129. package/dist/strings/fr/index.cjs +2121 -0
  130. package/dist/strings/fr/index.cjs.map +1 -0
  131. package/dist/strings/fr/index.d.cts +19 -0
  132. package/dist/strings/fr/index.d.ts +19 -0
  133. package/dist/strings/fr/index.js +2119 -0
  134. package/dist/strings/fr/index.js.map +1 -0
  135. package/dist/strings/index.cjs +2678 -0
  136. package/dist/strings/index.cjs.map +1 -0
  137. package/dist/strings/index.d.cts +731 -0
  138. package/dist/strings/index.d.ts +731 -0
  139. package/dist/strings/index.js +2644 -0
  140. package/dist/strings/index.js.map +1 -0
  141. package/dist/studioPlugin-C3C7VjMy.d.ts +847 -0
  142. package/dist/studioPlugin-Cf3OBNUv.d.cts +847 -0
  143. package/dist/tabs-B2nRO4p_.d.cts +15 -0
  144. package/dist/tabs-B2nRO4p_.d.ts +15 -0
  145. package/dist/testing/index.cjs +292 -0
  146. package/dist/testing/index.cjs.map +1 -0
  147. package/dist/testing/index.d.cts +306 -0
  148. package/dist/testing/index.d.ts +306 -0
  149. package/dist/testing/index.js +284 -0
  150. package/dist/testing/index.js.map +1 -0
  151. package/dist/time/index.cjs +28 -0
  152. package/dist/time/index.cjs.map +1 -0
  153. package/dist/time/index.d.cts +43 -0
  154. package/dist/time/index.d.ts +43 -0
  155. package/dist/time/index.js +26 -0
  156. package/dist/time/index.js.map +1 -0
  157. package/dist/types-BzJRV6UI.d.cts +845 -0
  158. package/dist/types-BzJRV6UI.d.ts +845 -0
  159. package/dist/zoneForm-CdYNtnnA.d.cts +320 -0
  160. package/dist/zoneForm-mG85yt5e.d.ts +320 -0
  161. package/package.json +225 -4
  162. package/src/agent/engines/agentThreads.ts +1601 -0
  163. package/src/agent/engines/directorChat.ts +500 -0
  164. package/src/agent/index.ts +67 -0
  165. package/src/agent/rules/agentEditLock.ts +115 -0
  166. package/src/agent/rules/agentErrorCopy.ts +44 -0
  167. package/src/agent/rules/copilotOrganization.ts +36 -0
  168. package/src/agent/rules/playbook.gen.ts +444 -0
  169. package/src/agent/rules/router.ts +518 -0
  170. package/src/agent/rules/stateDelta.ts +28 -0
  171. package/src/agent/rules/studioRouter.ts +123 -0
  172. package/src/agent/rules/surfaces.gen.ts +633 -0
  173. package/src/agent/rules/threadsUrl.ts +48 -0
  174. package/src/agent/rules/transcriptObserver.ts +90 -0
  175. package/src/agent/stores/agentThreads.ts +454 -0
  176. package/src/bus/contracts/noData.ts +18 -0
  177. package/src/bus/contracts/shared.ts +172 -0
  178. package/src/bus/contracts/studioTools.ts +224 -0
  179. package/src/bus/rules/bus.ts +858 -0
  180. package/src/bus/rules/confirmation.ts +22 -0
  181. package/src/bus/rules/defineRegistry.ts +26 -0
  182. package/src/bus/rules/errors.ts +401 -0
  183. package/src/bus/rules/handlerErrors.ts +103 -0
  184. package/src/bus/rules/handlerRegistry.ts +627 -0
  185. package/src/bus/rules/inputSchema.ts +232 -0
  186. package/src/bus/rules/invalidInput.ts +441 -0
  187. package/src/bus/rules/lateBoundTools.ts +100 -0
  188. package/src/bus/rules/studioRegistry.ts +324 -0
  189. package/src/bus/rules/studioToolBus.ts +73 -0
  190. package/src/bus/rules/types.ts +805 -0
  191. package/src/chrome/contracts/alert.ts +42 -0
  192. package/src/chrome/contracts/itinerary.ts +26 -0
  193. package/src/chrome/contracts/map.ts +23 -0
  194. package/src/chrome/contracts/overlay.ts +46 -0
  195. package/src/chrome/contracts/panel.ts +29 -0
  196. package/src/chrome/contracts/question.ts +52 -0
  197. package/src/chrome/contracts/selection.ts +26 -0
  198. package/src/chrome/contracts/sidenav.ts +23 -0
  199. package/src/chrome/contracts/snapshot.ts +319 -0
  200. package/src/chrome/contracts/state.ts +22 -0
  201. package/src/chrome/contracts/tabs.ts +56 -0
  202. package/src/chrome/handlers/alert.ts +91 -0
  203. package/src/chrome/handlers/introspection.ts +180 -0
  204. package/src/chrome/handlers/panels.ts +42 -0
  205. package/src/chrome/handlers/question.ts +24 -0
  206. package/src/chrome/handlers/sidenav.ts +116 -0
  207. package/src/chrome/handlers/snapshot.ts +451 -0
  208. package/src/chrome/handlers/stateDelta.ts +125 -0
  209. package/src/chrome/handlers/tabs.ts +143 -0
  210. package/src/chrome/handlers/timestamp.ts +19 -0
  211. package/src/chrome/rules/agentSelectors.ts +210 -0
  212. package/src/chrome/rules/mapAlert.ts +13 -0
  213. package/src/chrome/rules/question.ts +25 -0
  214. package/src/chrome/rules/tabs.ts +13 -0
  215. package/src/chrome/stores/activeDraftSession.ts +134 -0
  216. package/src/chrome/stores/chrome.ts +527 -0
  217. package/src/chrome/stores/uiStore.ts +573 -0
  218. package/src/collab/contracts/collab.ts +261 -0
  219. package/src/collab/handlers/collab.ts +468 -0
  220. package/src/collab/rules/toolNames.ts +33 -0
  221. package/src/collab/stores/collab.ts +899 -0
  222. package/src/collections/contracts/collection.ts +182 -0
  223. package/src/collections/handlers/collectionAttach.ts +141 -0
  224. package/src/collections/handlers/collections.ts +499 -0
  225. package/src/collections/handlers/heldCollection.ts +42 -0
  226. package/src/collections/handlers/restCollections.ts +386 -0
  227. package/src/collections/rules/collections.ts +138 -0
  228. package/src/collections/rules/entityCollections.ts +53 -0
  229. package/src/collections/stores/collections.ts +133 -0
  230. package/src/data/contracts/data.ts +233 -0
  231. package/src/data/contracts/itinerary.ts +71 -0
  232. package/src/data/handlers/activityResolve.ts +76 -0
  233. package/src/data/handlers/data.ts +200 -0
  234. package/src/data/handlers/graphql.ts +26 -0
  235. package/src/data/handlers/mutationSink.ts +1577 -0
  236. package/src/data/handlers/profile.ts +83 -0
  237. package/src/data/handlers/writeThrough.ts +417 -0
  238. package/src/data/rules/cache.ts +181 -0
  239. package/src/data/rules/dataTypes.ts +40 -0
  240. package/src/data/rules/keys.ts +106 -0
  241. package/src/data/rules/persistence.ts +1058 -0
  242. package/src/data/rules/requestBody.ts +43 -0
  243. package/src/data/rules/restErrors.ts +354 -0
  244. package/src/data/rules/sessionSurface.ts +156 -0
  245. package/src/data/rules/toolResultData.ts +73 -0
  246. package/src/data/rules/uuid.ts +24 -0
  247. package/src/edit/contracts/edit.ts +37 -0
  248. package/src/edit/contracts/itinerary.ts +57 -0
  249. package/src/edit/handlers/draftCommit.ts +257 -0
  250. package/src/edit/handlers/editDiscard.ts +34 -0
  251. package/src/edit/handlers/editLock.ts +949 -0
  252. package/src/edit/handlers/editor.ts +203 -0
  253. package/src/edit/handlers/formUnsaved.ts +24 -0
  254. package/src/edit/rules/draftMetadata.ts +117 -0
  255. package/src/edit/rules/editKeyboard.ts +222 -0
  256. package/src/edit/rules/editShortcuts.ts +102 -0
  257. package/src/edit/rules/editTooltip.ts +174 -0
  258. package/src/edit/rules/editorTaken.ts +49 -0
  259. package/src/edit/rules/history.ts +26 -0
  260. package/src/edit/rules/unsavedWork.ts +60 -0
  261. package/src/edit/stores/editorReservation.ts +70 -0
  262. package/src/edit/stores/formsUnsaved.ts +54 -0
  263. package/src/embed/contracts/embed.ts +48 -0
  264. package/src/embed/engines/embedFraming.ts +1329 -0
  265. package/src/embed/engines/embedReady.ts +353 -0
  266. package/src/embed/engines/framingPageSession.ts +169 -0
  267. package/src/embed/handlers/embed.ts +130 -0
  268. package/src/embed/rules/allowedDomains.ts +71 -0
  269. package/src/embed/rules/bridgeMessages.ts +224 -0
  270. package/src/embed/rules/defaults.ts +173 -0
  271. package/src/embed/rules/displaySeed.ts +115 -0
  272. package/src/embed/rules/embedAllowlist.ts +146 -0
  273. package/src/embed/rules/embedConstraints.ts +215 -0
  274. package/src/embed/rules/embedElements.ts +277 -0
  275. package/src/embed/rules/embedSectionFields.ts +126 -0
  276. package/src/embed/rules/embedSecurity.ts +116 -0
  277. package/src/embed/rules/fieldDependencies.ts +87 -0
  278. package/src/embed/rules/fieldOptions.ts +138 -0
  279. package/src/embed/rules/layerOptions.ts +161 -0
  280. package/src/embed/rules/readyProtocol.ts +66 -0
  281. package/src/embed/rules/safetyRules.ts +213 -0
  282. package/src/embed/rules/snippet.ts +531 -0
  283. package/src/embed/rules/tableCode.ts +269 -0
  284. package/src/embed/stores/embed.ts +60 -0
  285. package/src/embed/stores/embedContent.ts +77 -0
  286. package/src/engines/index.ts +81 -0
  287. package/src/handlers/index.ts +66 -0
  288. package/src/index.ts +1086 -0
  289. package/src/itinerary/contracts/itinerary.ts +705 -0
  290. package/src/itinerary/engines/itineraryPace.ts +612 -0
  291. package/src/itinerary/engines/profileMarker.ts +238 -0
  292. package/src/itinerary/handlers/importStaging.ts +352 -0
  293. package/src/itinerary/handlers/itinerary.ts +572 -0
  294. package/src/itinerary/handlers/itineraryDuplicate.ts +177 -0
  295. package/src/itinerary/handlers/itineraryExport.ts +117 -0
  296. package/src/itinerary/handlers/itineraryImport.ts +783 -0
  297. package/src/itinerary/handlers/itineraryPublish.ts +118 -0
  298. package/src/itinerary/handlers/itinerarySelection.ts +354 -0
  299. package/src/itinerary/handlers/itinerarySuggest.ts +1186 -0
  300. package/src/itinerary/handlers/itineraryUnpublish.ts +101 -0
  301. package/src/itinerary/handlers/publicationScope.ts +118 -0
  302. package/src/itinerary/handlers/restItineraries.ts +752 -0
  303. package/src/itinerary/handlers/restItineraryExport.ts +70 -0
  304. package/src/itinerary/handlers/restItineraryImport.ts +311 -0
  305. package/src/itinerary/handlers/restItineraryPace.ts +87 -0
  306. package/src/itinerary/handlers/restItineraryRecord.ts +36 -0
  307. package/src/itinerary/handlers/suggestParams.ts +379 -0
  308. package/src/itinerary/handlers/suggestStaging.ts +363 -0
  309. package/src/itinerary/handlers/surfaceOpen.ts +389 -0
  310. package/src/itinerary/rules/activity.ts +139 -0
  311. package/src/itinerary/rules/analysis.ts +42 -0
  312. package/src/itinerary/rules/ceiling.ts +49 -0
  313. package/src/itinerary/rules/createFlow.ts +107 -0
  314. package/src/itinerary/rules/densify.ts +440 -0
  315. package/src/itinerary/rules/draftSurface.ts +219 -0
  316. package/src/itinerary/rules/editorView.ts +83 -0
  317. package/src/itinerary/rules/export.ts +159 -0
  318. package/src/itinerary/rules/friendlyName.ts +77 -0
  319. package/src/itinerary/rules/import.ts +1052 -0
  320. package/src/itinerary/rules/importFiles.ts +140 -0
  321. package/src/itinerary/rules/importTotals.ts +77 -0
  322. package/src/itinerary/rules/liveSegment.ts +712 -0
  323. package/src/itinerary/rules/lngLat.ts +17 -0
  324. package/src/itinerary/rules/mapSync.ts +100 -0
  325. package/src/itinerary/rules/previewRender.ts +416 -0
  326. package/src/itinerary/rules/profileReadout.ts +216 -0
  327. package/src/itinerary/rules/routing.ts +707 -0
  328. package/src/itinerary/rules/suggest.ts +522 -0
  329. package/src/itinerary/rules/suggestionPreview.ts +119 -0
  330. package/src/itinerary/rules/view.ts +61 -0
  331. package/src/itinerary/stores/importSession.ts +319 -0
  332. package/src/itinerary/stores/itinerary.ts +331 -0
  333. package/src/itinerary/stores/itineraryDuplicate.ts +76 -0
  334. package/src/itinerary/stores/sessionIdentity.ts +43 -0
  335. package/src/itinerary/stores/suggestSession.ts +418 -0
  336. package/src/layers/contracts/itinerary.ts +46 -0
  337. package/src/layers/contracts/overlay.ts +132 -0
  338. package/src/layers/handlers/enrichment.ts +36 -0
  339. package/src/layers/handlers/overlay.ts +406 -0
  340. package/src/layers/handlers/restLayers.ts +94 -0
  341. package/src/layers/handlers/tiles.ts +25 -0
  342. package/src/layers/rules/layers.ts +212 -0
  343. package/src/layers/rules/overlayInstant.ts +12 -0
  344. package/src/layers/rules/reachabilityIcon.ts +18 -0
  345. package/src/layers/rules/readout.ts +102 -0
  346. package/src/layers/stores/layers.ts +262 -0
  347. package/src/map/contracts/contextmenu.ts +33 -0
  348. package/src/map/contracts/geolocate.ts +37 -0
  349. package/src/map/contracts/map.ts +146 -0
  350. package/src/map/contracts/streetview.ts +53 -0
  351. package/src/map/contracts/terrain.ts +152 -0
  352. package/src/map/handlers/contextMenu.ts +135 -0
  353. package/src/map/handlers/geolocate.ts +52 -0
  354. package/src/map/handlers/map.ts +391 -0
  355. package/src/map/handlers/streetview.ts +94 -0
  356. package/src/map/handlers/terrain.ts +663 -0
  357. package/src/map/rules/baseTerrain.ts +75 -0
  358. package/src/map/rules/clickTargets.ts +464 -0
  359. package/src/map/rules/constraints.ts +32 -0
  360. package/src/map/rules/contextMenuReadout.ts +67 -0
  361. package/src/map/rules/coordinates.ts +71 -0
  362. package/src/map/rules/itineraryFit.ts +8 -0
  363. package/src/map/rules/mapEvents.ts +64 -0
  364. package/src/map/rules/mapProjection.ts +476 -0
  365. package/src/map/rules/terrainReading.ts +62 -0
  366. package/src/plugins/contracts/ids.ts +66 -0
  367. package/src/plugins/contracts/plugin.ts +200 -0
  368. package/src/plugins/contracts/slots.ts +137 -0
  369. package/src/plugins/engines/studioPlugin.ts +1365 -0
  370. package/src/plugins/index.ts +111 -0
  371. package/src/plugins/rules/contributions.ts +152 -0
  372. package/src/plugins/rules/errors.ts +60 -0
  373. package/src/plugins/rules/ids.ts +42 -0
  374. package/src/plugins/rules/validation.ts +249 -0
  375. package/src/rules/listeners.ts +57 -0
  376. package/src/rules/origin.ts +13 -0
  377. package/src/rules/storeWrite.ts +37 -0
  378. package/src/rules/types.ts +136 -0
  379. package/src/seams/index.ts +79 -0
  380. package/src/seams/rules/clock.ts +28 -0
  381. package/src/seams/rules/formatters.ts +209 -0
  382. package/src/seams/rules/ids.ts +102 -0
  383. package/src/seams/rules/links.ts +66 -0
  384. package/src/seams/rules/navigation.ts +222 -0
  385. package/src/seams/rules/notify.ts +49 -0
  386. package/src/seams/rules/persistenceDrawer.ts +220 -0
  387. package/src/seams/rules/saveFile.ts +101 -0
  388. package/src/seams/rules/seams.ts +156 -0
  389. package/src/seams/rules/storage.ts +116 -0
  390. package/src/search/contracts/overlay.ts +74 -0
  391. package/src/search/contracts/search.ts +197 -0
  392. package/src/search/handlers/pois.ts +57 -0
  393. package/src/search/handlers/search.ts +280 -0
  394. package/src/search/rules/params.ts +925 -0
  395. package/src/search/rules/poiGroups.ts +138 -0
  396. package/src/search/rules/searchFetch.ts +139 -0
  397. package/src/search/rules/timeWindow.ts +30 -0
  398. package/src/search/stores/search.ts +51 -0
  399. package/src/segments/contracts/itinerary.ts +433 -0
  400. package/src/segments/contracts/segment.ts +35 -0
  401. package/src/segments/engines/segmentDraft.ts +926 -0
  402. package/src/segments/handlers/chainGuards.ts +67 -0
  403. package/src/segments/handlers/directions.ts +44 -0
  404. package/src/segments/handlers/itineraryEcho.ts +45 -0
  405. package/src/segments/handlers/roadAccessDialog.ts +34 -0
  406. package/src/segments/handlers/segment.ts +111 -0
  407. package/src/segments/handlers/segmentEdit.ts +1341 -0
  408. package/src/segments/handlers/segmentGroups.ts +347 -0
  409. package/src/segments/handlers/segmentStructure.ts +1144 -0
  410. package/src/segments/rules/chain.ts +196 -0
  411. package/src/segments/rules/chainModel.ts +217 -0
  412. package/src/segments/rules/colors.ts +11 -0
  413. package/src/segments/rules/commit.ts +76 -0
  414. package/src/segments/rules/draft.ts +90 -0
  415. package/src/segments/rules/draftDisposition.ts +43 -0
  416. package/src/segments/rules/draftSegmentEdit.ts +129 -0
  417. package/src/segments/rules/engine.ts +222 -0
  418. package/src/segments/rules/groupSave.ts +234 -0
  419. package/src/segments/rules/hazardPrompt.ts +60 -0
  420. package/src/segments/rules/itineraryEcho.ts +40 -0
  421. package/src/segments/rules/liveSegmentProjection.ts +55 -0
  422. package/src/segments/rules/merge.ts +51 -0
  423. package/src/segments/rules/metrics.ts +456 -0
  424. package/src/segments/rules/naming.ts +168 -0
  425. package/src/segments/rules/segmentArming.ts +144 -0
  426. package/src/segments/rules/splitPick.ts +84 -0
  427. package/src/segments/rules/viaSimplify.ts +230 -0
  428. package/src/segments/stores/directions.ts +77 -0
  429. package/src/segments/stores/roadAccessDialog.ts +58 -0
  430. package/src/segments/stores/segmentEdit.ts +922 -0
  431. package/src/segments/stores/segmentGroupEdit.ts +84 -0
  432. package/src/segments/stores/segmentSplit.ts +77 -0
  433. package/src/share/contracts/share.ts +39 -0
  434. package/src/share/contracts/shareLink.ts +63 -0
  435. package/src/share/engines/shareLink.ts +1053 -0
  436. package/src/share/handlers/share.ts +47 -0
  437. package/src/share/handlers/shareLink.ts +231 -0
  438. package/src/share/handlers/shareScope.ts +54 -0
  439. package/src/share/rules/link.ts +89 -0
  440. package/src/share/rules/shareLink.ts +218 -0
  441. package/src/share/rules/targets.ts +92 -0
  442. package/src/share/rules/viewConfig.ts +95 -0
  443. package/src/share/stores/share.ts +58 -0
  444. package/src/strings/fr/index.ts +18 -0
  445. package/src/strings/fr/rules/fr.ts +2368 -0
  446. package/src/strings/index.ts +98 -0
  447. package/src/strings/rules/confirmCopy.ts +156 -0
  448. package/src/strings/rules/draftToolNames.ts +94 -0
  449. package/src/strings/rules/en.ts +2519 -0
  450. package/src/strings/rules/failureAlert.ts +115 -0
  451. package/src/strings/rules/formError.ts +400 -0
  452. package/src/strings/rules/maneuvers.ts +107 -0
  453. package/src/strings/rules/outputOptions.ts +126 -0
  454. package/src/strings/rules/publicationState.ts +100 -0
  455. package/src/strings/rules/routeHazardCopy.ts +62 -0
  456. package/src/strings/rules/searchLabels.ts +50 -0
  457. package/src/strings/rules/segmentChainVerbs.ts +62 -0
  458. package/src/strings/rules/studioCopy.ts +130 -0
  459. package/src/strings/rules/unitOptions.ts +119 -0
  460. package/src/testing/checkedBus.ts +226 -0
  461. package/src/testing/index.ts +34 -0
  462. package/src/testing/plugins.ts +106 -0
  463. package/src/testing/studio.ts +267 -0
  464. package/src/testing/urlSeam.ts +153 -0
  465. package/src/time/index.ts +12 -0
  466. package/src/time/rules/sun.ts +78 -0
  467. package/src/video/contracts/cameraSchemas.ts +266 -0
  468. package/src/video/contracts/profileSchemas.ts +37 -0
  469. package/src/video/contracts/video.ts +601 -0
  470. package/src/video/handlers/video.ts +1638 -0
  471. package/src/video/handlers/videoDirector.ts +114 -0
  472. package/src/video/rules/previewRefresh.ts +76 -0
  473. package/src/video/rules/profileSource.ts +51 -0
  474. package/src/video/rules/routeSpans.ts +79 -0
  475. package/src/video/rules/shotDefaults.ts +28 -0
  476. package/src/video/rules/stepOrder.ts +17 -0
  477. package/src/video/rules/videoSnapshot.ts +136 -0
  478. package/src/video/stores/directorThreads.ts +167 -0
  479. package/src/video/stores/videoExport.ts +290 -0
  480. package/src/viewer/contracts/preferences.ts +40 -0
  481. package/src/viewer/handlers/preferences.ts +91 -0
  482. package/src/viewer/rules/capabilities.ts +42 -0
  483. package/src/viewer/rules/config.ts +266 -0
  484. package/src/viewer/rules/context.ts +375 -0
  485. package/src/viewer/rules/ownership.ts +134 -0
  486. package/src/viewer/rules/platformViewer.ts +198 -0
  487. package/src/viewer/rules/scope.ts +197 -0
  488. package/src/viewer/rules/url.ts +145 -0
  489. package/src/viewer/rules/viewer.ts +307 -0
  490. package/src/viewer/rules/viewerSeam.ts +49 -0
  491. package/src/viewer/rules/viewerUnits.ts +34 -0
  492. package/src/waypoints/contracts/itinerary.ts +417 -0
  493. package/src/waypoints/handlers/poiWaypointStyle.ts +32 -0
  494. package/src/waypoints/handlers/waypointDetailsDialog.ts +38 -0
  495. package/src/waypoints/handlers/waypointEdit.ts +1073 -0
  496. package/src/waypoints/rules/amenities.ts +30 -0
  497. package/src/waypoints/rules/defaults.ts +31 -0
  498. package/src/waypoints/rules/details.ts +213 -0
  499. package/src/waypoints/rules/detailsDraft.ts +312 -0
  500. package/src/waypoints/rules/detailsPreview.ts +76 -0
  501. package/src/waypoints/rules/detailsSave.ts +356 -0
  502. package/src/waypoints/rules/draftDirty.ts +45 -0
  503. package/src/waypoints/rules/icons.ts +32 -0
  504. package/src/waypoints/rules/liveWaypoint.ts +63 -0
  505. package/src/waypoints/rules/naming.ts +185 -0
  506. package/src/waypoints/rules/sections.ts +77 -0
  507. package/src/waypoints/rules/waypointDraft.ts +62 -0
  508. package/src/waypoints/stores/waypointDetails.ts +62 -0
  509. package/src/waypoints/stores/waypointEdit.ts +566 -0
  510. package/src/zones/contracts/collection.ts +37 -0
  511. package/src/zones/contracts/zone.ts +528 -0
  512. package/src/zones/engines/zoneForm.ts +1773 -0
  513. package/src/zones/handlers/restZones.ts +287 -0
  514. package/src/zones/handlers/zonePublish.ts +206 -0
  515. package/src/zones/handlers/zoneUnpublish.ts +56 -0
  516. package/src/zones/handlers/zones.ts +2254 -0
  517. package/src/zones/rules/geometry.ts +946 -0
  518. package/src/zones/rules/zoneDefaults.ts +34 -0
  519. package/src/zones/rules/zoneDraft.ts +54 -0
  520. package/src/zones/rules/zoneForm.ts +563 -0
  521. package/src/zones/rules/zoneMetadata.ts +29 -0
  522. package/src/zones/rules/zoneSource.ts +87 -0
  523. package/src/zones/rules/zoneSourceRefusal.ts +104 -0
  524. package/src/zones/stores/zoneEdit.ts +998 -0
package/dist/index.cjs ADDED
@@ -0,0 +1,4562 @@
1
+ 'use strict';
2
+
3
+ var chunkQFO5CZG2_cjs = require('./chunk-QFO5CZG2.cjs');
4
+ var chunkXKHLRIC7_cjs = require('./chunk-XKHLRIC7.cjs');
5
+ var chunk7NBRCENN_cjs = require('./chunk-7NBRCENN.cjs');
6
+ var chunkCJDIFRGZ_cjs = require('./chunk-CJDIFRGZ.cjs');
7
+ var chunkOQSYFH3Z_cjs = require('./chunk-OQSYFH3Z.cjs');
8
+ var chunkEKZWV6RS_cjs = require('./chunk-EKZWV6RS.cjs');
9
+ var chunkIDBXFBLG_cjs = require('./chunk-IDBXFBLG.cjs');
10
+ var chunkPSZ2R3TC_cjs = require('./chunk-PSZ2R3TC.cjs');
11
+ var chunkWVQQLKCI_cjs = require('./chunk-WVQQLKCI.cjs');
12
+ var chunkEOKRXXAC_cjs = require('./chunk-EOKRXXAC.cjs');
13
+ var chunkQL63MUEW_cjs = require('./chunk-QL63MUEW.cjs');
14
+ var z4 = require('zod');
15
+ var errors = require('@mountaya/elements/errors');
16
+ var geo = require('@mountaya/elements/geo');
17
+ var profile = require('@mountaya/elements/profile');
18
+ var i18n = require('@mountaya/elements/i18n');
19
+ var style = require('@mountaya/elements/style');
20
+ var units = require('@mountaya/elements/units');
21
+ var layers = require('@mountaya/elements/layers');
22
+ var icons = require('@mountaya/elements/icons');
23
+ var data = require('@mountaya/elements/data');
24
+ var collab = require('@mountaya/elements/collab');
25
+ var camera = require('@mountaya/elements/camera');
26
+
27
+ function _interopNamespace(e) {
28
+ if (e && e.__esModule) return e;
29
+ var n = Object.create(null);
30
+ if (e) {
31
+ Object.keys(e).forEach(function (k) {
32
+ if (k !== 'default') {
33
+ var d = Object.getOwnPropertyDescriptor(e, k);
34
+ Object.defineProperty(n, k, d.get ? d : {
35
+ enumerable: true,
36
+ get: function () { return e[k]; }
37
+ });
38
+ }
39
+ });
40
+ }
41
+ n.default = e;
42
+ return Object.freeze(n);
43
+ }
44
+
45
+ var z4__namespace = /*#__PURE__*/_interopNamespace(z4);
46
+
47
+ // src/bus/rules/defineRegistry.ts
48
+ var defineRegistry = (registry) => registry;
49
+
50
+ // src/bus/rules/lateBoundTools.ts
51
+ var lateBoundTool = (read) => ({
52
+ get agentHidden() {
53
+ return read().agentHidden;
54
+ },
55
+ get capability() {
56
+ return read().capability;
57
+ },
58
+ get confirmation() {
59
+ return read().confirmation;
60
+ },
61
+ get confirmationValues() {
62
+ return read().confirmationValues;
63
+ },
64
+ get description() {
65
+ return read().description;
66
+ },
67
+ get handler() {
68
+ return read().handler;
69
+ },
70
+ get input() {
71
+ return read().input;
72
+ },
73
+ get name() {
74
+ return read().name;
75
+ },
76
+ get output() {
77
+ return read().output;
78
+ },
79
+ get precondition() {
80
+ return read().precondition;
81
+ },
82
+ get requiresConfirmation() {
83
+ return read().requiresConfirmation;
84
+ }
85
+ });
86
+ var lateBoundTools = (names, tools) => {
87
+ const bound = {};
88
+ for (const name of names) {
89
+ const record = tools();
90
+ const initial = Object.hasOwn(record, name) ? record[name] : void 0;
91
+ if (initial === void 0) {
92
+ continue;
93
+ }
94
+ let held = initial;
95
+ bound[name] = lateBoundTool(() => {
96
+ const current = tools();
97
+ held = (Object.hasOwn(current, name) ? current[name] : void 0) ?? held;
98
+ return held;
99
+ });
100
+ }
101
+ return bound;
102
+ };
103
+
104
+ // src/collab/rules/toolNames.ts
105
+ var studioCollabTools = {
106
+ changeApply: "studio.collab.change.apply",
107
+ listApply: "studio.collab.list.apply",
108
+ lockClear: "studio.collab.lock.clear",
109
+ lockSet: "studio.collab.lock.set",
110
+ lockSnapshot: "studio.collab.lock.snapshot",
111
+ peerDraftClear: "studio.collab.peerDraft.clear",
112
+ peerDraftSet: "studio.collab.peerDraft.set",
113
+ peerSelectionSet: "studio.collab.peerSelection.set",
114
+ presenceClear: "studio.collab.presence.clear",
115
+ presenceSet: "studio.collab.presence.set",
116
+ presenceSnapshot: "studio.collab.presence.snapshot"
117
+ };
118
+ var collectionContentRoles = /* @__PURE__ */ new Set(["owner", "admin", "contributor"]);
119
+ var collectionMetadataRoles = /* @__PURE__ */ new Set(["owner", "admin"]);
120
+ var canEditCollection = (role) => collectionContentRoles.has(role);
121
+ var canEditCollectionMetadata = (role, isAuthor) => collectionMetadataRoles.has(role) || isAuthor && collectionContentRoles.has(role);
122
+ var canDeleteCollection = canEditCollectionMetadata;
123
+ var collectionFormSchema = z4__namespace.object({
124
+ description: chunkIDBXFBLG_cjs.descriptionSchema,
125
+ isPrivate: z4__namespace.boolean(),
126
+ name: chunkIDBXFBLG_cjs.displayNameSchema
127
+ });
128
+ var collectionCreateScope = (organizationId, isPersonalScope) => isPersonalScope(organizationId) ? void 0 : organizationId ?? void 0;
129
+
130
+ // src/collections/rules/entityCollections.ts
131
+ var projectEntityCollections = (collections, holding) => {
132
+ const held = new Set(holding.map(({ id }) => id));
133
+ const rows = /* @__PURE__ */ new Map();
134
+ for (const collection of [...collections, ...holding]) {
135
+ if (!rows.has(collection.id)) {
136
+ rows.set(collection.id, {
137
+ has: held.has(collection.id),
138
+ id: collection.id,
139
+ name: collection.name,
140
+ role: collection.role
141
+ });
142
+ }
143
+ }
144
+ return [...rows.values()];
145
+ };
146
+
147
+ // src/data/rules/keys.ts
148
+ var KEY_PREFIX_LENGTH = 7;
149
+ var KEY_SUFFIX_LENGTH = 4;
150
+ var truncateKey = (key) => key.length <= KEY_PREFIX_LENGTH + KEY_SUFFIX_LENGTH + 1 ? key : `${key.slice(0, KEY_PREFIX_LENGTH)}\u2026${key.slice(-KEY_SUFFIX_LENGTH)}`;
151
+ var itineraryUpdateFields = {
152
+ description: true,
153
+ is_private: true,
154
+ name: true
155
+ };
156
+ var itineraryCreateFields = {
157
+ activity_id: true,
158
+ description: true,
159
+ is_private: true,
160
+ name: true,
161
+ organization_id: true
162
+ };
163
+ var segmentCreateFields = {
164
+ before_segment_id: true,
165
+ color: true,
166
+ description: true,
167
+ geojson: true,
168
+ mode: true,
169
+ name: true,
170
+ speed: true,
171
+ start_at: true
172
+ };
173
+ var segmentUpdateFields = {
174
+ color: true,
175
+ description: true,
176
+ geojson: true,
177
+ name: true,
178
+ speed: true,
179
+ start_at: true
180
+ };
181
+ var segmentSplitFields = {
182
+ first_name: true,
183
+ fraction: true,
184
+ second_name: true
185
+ };
186
+ var segmentConvertFields = { mode: true };
187
+ var segmentGroupCreateFields = {
188
+ color: true,
189
+ name: true,
190
+ segment_ids: true,
191
+ speed: true
192
+ };
193
+ var segmentGroupUpdateFields = {
194
+ color: true,
195
+ name: true,
196
+ segment_ids: true,
197
+ speed: true
198
+ };
199
+ var itineraryDuplicateFields = {
200
+ name: true,
201
+ organization_id: true,
202
+ segment_ids: true,
203
+ waypoint_ids: true
204
+ };
205
+ var waypointCreateFields = {
206
+ amenities: true,
207
+ color: true,
208
+ contact: true,
209
+ description: true,
210
+ geojson: true,
211
+ icon: true,
212
+ media: true,
213
+ mode: true,
214
+ name: true,
215
+ position: true,
216
+ properties: true,
217
+ timing: true
218
+ };
219
+ var waypointUpdateFields = {
220
+ amenities: true,
221
+ color: true,
222
+ contact: true,
223
+ description: true,
224
+ geojson: true,
225
+ icon: true,
226
+ media: true,
227
+ name: true,
228
+ position: true,
229
+ properties: true,
230
+ timing: true
231
+ };
232
+ var partOf = (parts, id, operation) => {
233
+ const part = parts.find((candidate) => candidate.id === id);
234
+ if (part === void 0) {
235
+ throw new errors.MountayaElementsError(
236
+ `${operation}: the write landed, and the itinerary it answered holds no part ${String(id)}. Read the itinerary again to see it.`
237
+ );
238
+ }
239
+ return part;
240
+ };
241
+ var updateItinerary = async (client, itineraryId, params) => {
242
+ const body = await client.studio.itineraries.patchItinerary({
243
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, itineraryUpdateFields),
244
+ itinerary_id: itineraryId
245
+ });
246
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
247
+ };
248
+ var updateSegment = async (client, itineraryId, segmentId, params) => {
249
+ try {
250
+ const body = await client.studio.itineraries.patchItinerarySegment({
251
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, segmentUpdateFields),
252
+ itinerary_id: itineraryId,
253
+ segment_id: segmentId
254
+ });
255
+ return chunkCJDIFRGZ_cjs.withSegmentAnalysis(partOf(body.data.segments, segmentId, "update segment"));
256
+ } catch (error) {
257
+ return chunkCJDIFRGZ_cjs.rethrowSegmentWriteError(error);
258
+ }
259
+ };
260
+ var deleteItinerary = async (client, itineraryId) => {
261
+ await client.studio.itineraries.deleteItinerary({
262
+ itinerary_id: itineraryId
263
+ });
264
+ };
265
+ var readMadeItinerary = async (client, location) => {
266
+ const itineraryId = chunkCJDIFRGZ_cjs.createdIdOf({ location });
267
+ if (itineraryId === void 0) {
268
+ return null;
269
+ }
270
+ try {
271
+ return await chunkCJDIFRGZ_cjs.fetchItineraryRecord(client, itineraryId);
272
+ } catch {
273
+ return null;
274
+ }
275
+ };
276
+ var createItinerary = async (client, params) => chunkCJDIFRGZ_cjs.reconcileMadeWrite(
277
+ async () => {
278
+ const body = await client.studio.itineraries.postItinerary({
279
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, itineraryCreateFields)
280
+ });
281
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
282
+ },
283
+ (answer) => readMadeItinerary(client, answer.location)
284
+ );
285
+ var createSegment = async (client, itineraryId, params) => {
286
+ try {
287
+ const body = await client.studio.itineraries.postItinerarySegment({
288
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, segmentCreateFields),
289
+ itinerary_id: itineraryId
290
+ });
291
+ return chunkCJDIFRGZ_cjs.withSegmentAnalysis(
292
+ partOf(body.data.segments, body.extensions.metadata.created.id, "create segment")
293
+ );
294
+ } catch (error) {
295
+ return chunkCJDIFRGZ_cjs.rethrowSegmentWriteError(error);
296
+ }
297
+ };
298
+ var deleteSegment = async (client, itineraryId, segmentId) => {
299
+ try {
300
+ await client.studio.itineraries.deleteItinerarySegment({
301
+ itinerary_id: itineraryId,
302
+ segment_id: segmentId
303
+ });
304
+ } catch (error) {
305
+ return chunkCJDIFRGZ_cjs.rethrowSegmentWriteError(error, "delete");
306
+ }
307
+ };
308
+ var mergeSegment = async (client, itineraryId, segmentId) => {
309
+ try {
310
+ const body = await client.studio.itineraries.postItinerarySegmentMerge({
311
+ itinerary_id: itineraryId,
312
+ segment_id: segmentId
313
+ });
314
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
315
+ } catch (error) {
316
+ return chunkCJDIFRGZ_cjs.rethrowSegmentWriteError(error);
317
+ }
318
+ };
319
+ var splitSegment = async (client, itineraryId, segmentId, params) => {
320
+ try {
321
+ const body = await client.studio.itineraries.postItinerarySegmentSplit({
322
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, segmentSplitFields),
323
+ itinerary_id: itineraryId,
324
+ segment_id: segmentId
325
+ });
326
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
327
+ } catch (error) {
328
+ return chunkCJDIFRGZ_cjs.rethrowSegmentWriteError(error);
329
+ }
330
+ };
331
+ var convertSegment = async (client, itineraryId, segmentId, params) => {
332
+ try {
333
+ const body = await client.studio.itineraries.postItinerarySegmentConvert({
334
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, segmentConvertFields),
335
+ itinerary_id: itineraryId,
336
+ segment_id: segmentId
337
+ });
338
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
339
+ } catch (error) {
340
+ return chunkCJDIFRGZ_cjs.rethrowSegmentWriteError(error);
341
+ }
342
+ };
343
+ var createSegmentGroup = async (client, itineraryId, params) => {
344
+ try {
345
+ const body = await client.studio.itineraries.postItinerarySegmentGroup({
346
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, segmentGroupCreateFields),
347
+ itinerary_id: itineraryId
348
+ });
349
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
350
+ } catch (error) {
351
+ return chunkCJDIFRGZ_cjs.rethrowSegmentWriteError(error);
352
+ }
353
+ };
354
+ var updateSegmentGroup = async (client, itineraryId, groupId, params) => {
355
+ try {
356
+ const body = await client.studio.itineraries.patchItinerarySegmentGroup({
357
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, segmentGroupUpdateFields),
358
+ group_id: groupId,
359
+ itinerary_id: itineraryId
360
+ });
361
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
362
+ } catch (error) {
363
+ return chunkCJDIFRGZ_cjs.rethrowSegmentWriteError(error);
364
+ }
365
+ };
366
+ var deleteSegmentGroup = async (client, itineraryId, groupId) => {
367
+ try {
368
+ const body = await client.studio.itineraries.deleteItinerarySegmentGroup({
369
+ group_id: groupId,
370
+ itinerary_id: itineraryId
371
+ });
372
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
373
+ } catch (error) {
374
+ return chunkCJDIFRGZ_cjs.rethrowSegmentWriteError(error);
375
+ }
376
+ };
377
+ var duplicateItinerary = async (client, itineraryId, params) => chunkCJDIFRGZ_cjs.reconcileMadeWrite(
378
+ async () => {
379
+ const body = await client.studio.itineraries.postItineraryDuplicate({
380
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, itineraryDuplicateFields),
381
+ itinerary_id: itineraryId
382
+ });
383
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
384
+ },
385
+ (answer) => readMadeItinerary(client, answer.location)
386
+ );
387
+ var publishItinerary = async (client, itineraryId) => chunkCJDIFRGZ_cjs.reconcileMadeWrite(
388
+ async () => {
389
+ try {
390
+ const body = await client.studio.itineraries.postItineraryPublication({
391
+ itinerary_id: itineraryId
392
+ });
393
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
394
+ } catch (error) {
395
+ return chunkCJDIFRGZ_cjs.rethrowSegmentWriteError(error);
396
+ }
397
+ },
398
+ () => chunkCJDIFRGZ_cjs.fetchItineraryRecord(client, itineraryId)
399
+ );
400
+ var unpublishItinerary = async (client, itineraryId) => chunkCJDIFRGZ_cjs.reconcileMadeWrite(
401
+ async () => {
402
+ const body = await client.studio.itineraries.deleteItineraryPublication({
403
+ itinerary_id: itineraryId
404
+ });
405
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis(body.data);
406
+ },
407
+ () => chunkCJDIFRGZ_cjs.fetchItineraryRecord(client, itineraryId)
408
+ );
409
+ var createWaypoint = async (client, itineraryId, params) => {
410
+ const body = await client.studio.itineraries.postItineraryWaypoint({
411
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, waypointCreateFields),
412
+ itinerary_id: itineraryId
413
+ });
414
+ return partOf(body.data.waypoints, body.extensions.metadata.created.id, "create waypoint");
415
+ };
416
+ var updateWaypoint = async (client, itineraryId, waypointId, params) => {
417
+ const body = await client.studio.itineraries.patchItineraryWaypoint({
418
+ body: chunkCJDIFRGZ_cjs.declaredBody(params, waypointUpdateFields),
419
+ itinerary_id: itineraryId,
420
+ waypoint_id: waypointId
421
+ });
422
+ return partOf(body.data.waypoints, waypointId, "update waypoint");
423
+ };
424
+ var deleteWaypoint = async (client, itineraryId, waypointId) => {
425
+ await client.studio.itineraries.deleteItineraryWaypoint({
426
+ itinerary_id: itineraryId,
427
+ waypoint_id: waypointId
428
+ });
429
+ };
430
+ var shareLinkSchema = z4__namespace.object({
431
+ created_at: z4__namespace.date(),
432
+ share_token: z4__namespace.string().min(1)
433
+ });
434
+ var shareLinkResponseSchema = z4__namespace.object({ data: shareLinkSchema });
435
+ var shareLinkReadSchema = z4__namespace.object({ data: shareLinkSchema.nullable() });
436
+ var mintItineraryShareLink = async (client, itineraryId) => {
437
+ const envelope = await client.studio.itineraries.postItineraryShareLink({
438
+ itinerary_id: itineraryId
439
+ });
440
+ return shareLinkResponseSchema.parse(envelope).data;
441
+ };
442
+ var rotateItineraryShareLink = async (client, itineraryId) => {
443
+ const envelope = await client.studio.itineraries.postItineraryShareLinkRotate({
444
+ itinerary_id: itineraryId
445
+ });
446
+ return shareLinkResponseSchema.parse(envelope).data;
447
+ };
448
+ var disableItineraryShareLink = async (client, itineraryId) => {
449
+ await client.studio.itineraries.deleteItineraryShareLink({ itinerary_id: itineraryId });
450
+ };
451
+ var fetchItineraryShareLink = async (client, itineraryId) => {
452
+ const envelope = await client.studio.itineraries.getItineraryShareLink({
453
+ itinerary_id: itineraryId
454
+ });
455
+ return shareLinkReadSchema.parse(envelope).data;
456
+ };
457
+
458
+ // src/data/rules/persistence.ts
459
+ var restStudioPersistence = (client) => ({
460
+ tiled: true,
461
+ convertSegment: (itineraryId, segmentId, params) => convertSegment(client, itineraryId, segmentId, params),
462
+ createItinerary: (params) => createItinerary(client, params),
463
+ createSegment: (itineraryId, params) => createSegment(client, itineraryId, params),
464
+ createSegmentGroup: (itineraryId, params) => createSegmentGroup(client, itineraryId, params),
465
+ createWaypoint: (itineraryId, params) => createWaypoint(client, itineraryId, params),
466
+ deleteItinerary: (itineraryId) => deleteItinerary(client, itineraryId),
467
+ deleteSegment: (itineraryId, segmentId) => deleteSegment(client, itineraryId, segmentId),
468
+ deleteSegmentGroup: (itineraryId, groupId) => deleteSegmentGroup(client, itineraryId, groupId),
469
+ deleteWaypoint: (itineraryId, waypointId) => deleteWaypoint(client, itineraryId, waypointId),
470
+ disableItineraryShareLink: (itineraryId) => disableItineraryShareLink(client, itineraryId),
471
+ duplicateItinerary: (itineraryId, params) => duplicateItinerary(client, itineraryId, params),
472
+ fetchItineraryRecord: (itineraryId, surface) => chunkCJDIFRGZ_cjs.fetchItineraryRecord(client, itineraryId, surface),
473
+ fetchItineraryShareLink: (itineraryId) => fetchItineraryShareLink(client, itineraryId),
474
+ mergeSegment: (itineraryId, segmentId) => mergeSegment(client, itineraryId, segmentId),
475
+ mintItineraryShareLink: (itineraryId) => mintItineraryShareLink(client, itineraryId),
476
+ publishItinerary: (itineraryId) => publishItinerary(client, itineraryId),
477
+ rotateItineraryShareLink: (itineraryId) => rotateItineraryShareLink(client, itineraryId),
478
+ splitSegment: (itineraryId, segmentId, params) => splitSegment(client, itineraryId, segmentId, params),
479
+ unpublishItinerary: (itineraryId) => unpublishItinerary(client, itineraryId),
480
+ updateItinerary: (itineraryId, params) => updateItinerary(client, itineraryId, params),
481
+ updateSegment: (itineraryId, segmentId, params) => updateSegment(client, itineraryId, segmentId, params),
482
+ updateSegmentGroup: (itineraryId, groupId, params) => updateSegmentGroup(client, itineraryId, groupId, params),
483
+ updateWaypoint: (itineraryId, waypointId, params) => updateWaypoint(client, itineraryId, waypointId, params)
484
+ });
485
+ var PERSISTENCE_REFUSED_NAME = "StudioPersistenceRefusedError";
486
+ var StudioPersistenceRefusedError = class extends errors.MountayaElementsError {
487
+ name = PERSISTENCE_REFUSED_NAME;
488
+ };
489
+ var refusedError = (verb) => new StudioPersistenceRefusedError(`${verb} is not available in a local studio session`);
490
+ var DEFAULT_NAMESPACE = "studio";
491
+ var instantOf = (clock) => {
492
+ const reading = clock.now();
493
+ const instant = new Date(reading);
494
+ if (Number.isNaN(instant.getTime())) {
495
+ throw new errors.MountayaElementsError(
496
+ `local studio session: the clock seam reads no instant (${String(reading)}), so the write has no time to carry. Hand the session a clock whose now() answers epoch milliseconds.`
497
+ );
498
+ }
499
+ return instant;
500
+ };
501
+ var withLocalMetrics = (segment) => {
502
+ let ascent = 0;
503
+ let descent = 0;
504
+ let lowest = Number.POSITIVE_INFINITY;
505
+ let highest = Number.NEGATIVE_INFINITY;
506
+ let readings = 0;
507
+ let distance = null;
508
+ for (const line of geo.extractLines(segment.geojson)) {
509
+ if (line.coordinates.length > 1) {
510
+ distance = (distance ?? 0) + chunkOQSYFH3Z_cjs.segmentLengthMeters(line);
511
+ }
512
+ let previous = null;
513
+ for (const position of line.coordinates) {
514
+ const elevation = position[2];
515
+ if (typeof elevation !== "number") continue;
516
+ if (previous !== null) {
517
+ const step = elevation - previous;
518
+ if (step > 0) ascent += step;
519
+ else descent -= step;
520
+ }
521
+ lowest = Math.min(lowest, elevation);
522
+ highest = Math.max(highest, elevation);
523
+ previous = elevation;
524
+ readings += 1;
525
+ }
526
+ }
527
+ const has3d = readings > 1;
528
+ return chunkCJDIFRGZ_cjs.withSegmentAnalysis({
529
+ ...segment,
530
+ altitude_max: has3d ? highest : null,
531
+ altitude_min: has3d ? lowest : null,
532
+ ascent: has3d ? ascent : null,
533
+ descent: has3d ? descent : null,
534
+ distance
535
+ });
536
+ };
537
+ var routedGeometry = async (geojson, mode, activityId, route) => {
538
+ if (!route || mode !== "directions" || !geojson) return geojson;
539
+ if (geo.extractLines(geojson).length > 0) return geojson;
540
+ const vias = geo.extractVias(geojson);
541
+ if (vias.length < 2) return geojson;
542
+ try {
543
+ const line = await route({ activityId, vias: vias.map((via) => [...via]) });
544
+ return line ? geo.buildGeometryCollection([line, { coordinates: vias, type: "MultiPoint" }]) : geojson;
545
+ } catch {
546
+ return geojson;
547
+ }
548
+ };
549
+ var sum = (values) => {
550
+ const present = values.filter((value) => value !== null);
551
+ return present.length ? present.reduce((total, value) => total + value, 0) : null;
552
+ };
553
+ var withRollUp = (itinerary) => {
554
+ const segments = itinerary.segments.map((segment, index) => ({ ...segment, position: index }));
555
+ return chunkCJDIFRGZ_cjs.withItineraryAnalysis({
556
+ ...itinerary,
557
+ ascent: sum(segments.map((segment) => segment.ascent)),
558
+ count: {
559
+ ...itinerary.count,
560
+ groups: itinerary.groups.length,
561
+ segments: segments.length,
562
+ waypoints: itinerary.waypoints.length
563
+ },
564
+ distance: sum(segments.map((segment) => segment.distance)),
565
+ segments
566
+ });
567
+ };
568
+ var clearedText = (sent, held) => {
569
+ if (sent === void 0) return held;
570
+ return sent === null || sent.trim() === "" ? null : sent;
571
+ };
572
+ var segmentOf = (record, segmentId) => {
573
+ const segment = record.segments.find((candidate) => candidate.id === segmentId);
574
+ if (!segment) {
575
+ throw new errors.MountayaElementsNotFoundError(`local studio session holds no segment ${segmentId}`);
576
+ }
577
+ return segment;
578
+ };
579
+ var waypointOf = (record, waypointId) => {
580
+ const waypoint = record.waypoints.find((candidate) => candidate.id === waypointId);
581
+ if (!waypoint) {
582
+ throw new errors.MountayaElementsNotFoundError(`local studio session holds no waypoint ${waypointId}`);
583
+ }
584
+ return waypoint;
585
+ };
586
+ var activityDefaultSpeed = (read, activityId) => {
587
+ if (!read) return null;
588
+ try {
589
+ const speed = read(activityId);
590
+ return typeof speed === "number" && Number.isFinite(speed) && speed > 0 ? speed : null;
591
+ } catch {
592
+ return null;
593
+ }
594
+ };
595
+ var rescaledDuration = (segment, speed, activityDefault) => {
596
+ const held = profile.resolveSpeedKmh(segment.speed, activityDefault);
597
+ const next = profile.resolveSpeedKmh(speed, activityDefault);
598
+ if (held === null || next === null) {
599
+ return segment.duration;
600
+ }
601
+ return profile.durationForSpeed({
602
+ baseDurationSeconds: segment.duration,
603
+ baseSpeedKmh: held,
604
+ distanceMeters: segment.distance,
605
+ targetSpeedKmh: next
606
+ }) ?? segment.duration;
607
+ };
608
+ var updatedSegment = (segment, params, geojson, activityDefault) => {
609
+ const next = {
610
+ ...segment,
611
+ color: params.color === void 0 ? segment.color : params.color,
612
+ description: clearedText(params.description, segment.description),
613
+ duration: params.speed === void 0 ? segment.duration : rescaledDuration(segment, params.speed, activityDefault),
614
+ geojson: geojson ?? segment.geojson,
615
+ name: params.name ?? segment.name,
616
+ revision: segment.revision + 1,
617
+ speed: params.speed === void 0 ? segment.speed : params.speed,
618
+ start_at: params.start_at === void 0 ? segment.start_at : params.start_at
619
+ };
620
+ return geojson ? withLocalMetrics(next) : next;
621
+ };
622
+ var updatedWaypoint = (waypoint, params) => ({
623
+ ...waypoint,
624
+ amenities: params.amenities === void 0 ? waypoint.amenities : params.amenities ?? [],
625
+ color: params.color === void 0 ? waypoint.color : params.color,
626
+ contact: params.contact === void 0 ? waypoint.contact : params.contact,
627
+ description: clearedText(params.description, waypoint.description),
628
+ geojson: params.geojson ?? waypoint.geojson,
629
+ icon: params.icon ?? waypoint.icon,
630
+ media: params.media === void 0 ? waypoint.media : params.media,
631
+ name: params.name === void 0 ? waypoint.name : params.name,
632
+ position: params.position ?? waypoint.position,
633
+ properties: params.properties === void 0 ? waypoint.properties : params.properties,
634
+ revision: waypoint.revision + 1,
635
+ timing: params.timing === void 0 ? waypoint.timing : params.timing
636
+ });
637
+ var sameRecord = (kept, written) => kept === written || kept !== void 0 && JSON.stringify(kept) === JSON.stringify(written);
638
+ var createLocalRecords = (drawer, clock, seed) => {
639
+ let seeded = null;
640
+ let unkept = null;
641
+ const seedRecords = () => {
642
+ seeded ??= Object.fromEntries(
643
+ seed.map((itinerary) => [itinerary.id, withRollUp(itinerary)])
644
+ );
645
+ return seeded;
646
+ };
647
+ const written = () => unkept ?? drawer.read() ?? {};
648
+ const recordIn = (document, itineraryId) => {
649
+ const record = document[itineraryId] ?? seedRecords()[itineraryId];
650
+ if (!record) {
651
+ throw new errors.MountayaElementsNotFoundError(
652
+ `local studio session holds no itinerary ${itineraryId}`
653
+ );
654
+ }
655
+ return record;
656
+ };
657
+ return {
658
+ commit: (itineraryId, change) => {
659
+ const held = written();
660
+ const current = recordIn(held, itineraryId);
661
+ const stamp = instantOf(clock);
662
+ const next = withRollUp({ ...change(current, stamp), updated_at: stamp });
663
+ const document = { ...held, [next.id]: next };
664
+ drawer.write(document);
665
+ unkept = sameRecord(drawer.read()?.[next.id], next) ? null : document;
666
+ return next;
667
+ },
668
+ recordOf: (itineraryId) => recordIn(written(), itineraryId)
669
+ };
670
+ };
671
+ var createLocalPersistence = (drawer, options) => {
672
+ const { clock = chunkWVQQLKCI_cjs.studioSeamAbsences.clock, ids = chunkWVQQLKCI_cjs.studioSeamAbsences.ids } = options;
673
+ const { defaultSpeed, route, seed = [] } = options;
674
+ const records = createLocalRecords(drawer, clock, seed);
675
+ const refuse = (verb) => Promise.reject(refusedError(verb));
676
+ return {
677
+ tiled: false,
678
+ convertSegment: () => refuse("Changing a segment's authoring mode"),
679
+ createItinerary: () => refuse("Creating an itinerary"),
680
+ createSegment: async (itineraryId, params) => {
681
+ const { activity_id: activityId } = records.recordOf(itineraryId);
682
+ const geojson = await routedGeometry(params.geojson, params.mode, activityId, route);
683
+ const id = localId(ids);
684
+ const saved = records.commit(itineraryId, (current, stamp) => {
685
+ const segment = withLocalMetrics({
686
+ ...blankSegment(current, stamp, id),
687
+ color: params.color ?? null,
688
+ description: params.description ?? null,
689
+ geojson: geojson ?? null,
690
+ mode: params.mode,
691
+ name: params.name,
692
+ speed: params.speed ?? null,
693
+ start_at: params.start_at ?? null
694
+ });
695
+ const before = params.before_segment_id;
696
+ const at = before === void 0 ? current.segments.length : current.segments.indexOf(segmentOf(current, before));
697
+ return {
698
+ ...current,
699
+ segments: [...current.segments.slice(0, at), segment, ...current.segments.slice(at)]
700
+ };
701
+ });
702
+ return segmentOf(saved, id);
703
+ },
704
+ createSegmentGroup: () => refuse("Creating a segment group"),
705
+ createWaypoint: async (itineraryId, params) => {
706
+ const id = localId(ids);
707
+ const saved = records.commit(itineraryId, (current, stamp) => ({
708
+ ...current,
709
+ waypoints: [
710
+ ...current.waypoints,
711
+ {
712
+ ...blankWaypoint(current, stamp, id),
713
+ amenities: params.amenities ?? [],
714
+ color: params.color ?? null,
715
+ contact: params.contact ?? null,
716
+ description: params.description ?? null,
717
+ geojson: params.geojson ?? null,
718
+ icon: params.icon ?? null,
719
+ media: params.media ?? null,
720
+ mode: params.mode,
721
+ name: params.name ?? null,
722
+ position: params.position,
723
+ properties: params.properties ?? null,
724
+ timing: params.timing ?? null
725
+ }
726
+ ]
727
+ }));
728
+ return waypointOf(saved, id);
729
+ },
730
+ deleteItinerary: () => refuse("Deleting an itinerary"),
731
+ deleteSegment: async (itineraryId, segmentId) => {
732
+ records.commit(itineraryId, (current) => {
733
+ const index = current.segments.indexOf(segmentOf(current, segmentId));
734
+ if (index > 0 && index < current.segments.length - 1) {
735
+ throw new chunkCJDIFRGZ_cjs.SegmentDeleteNotEdgeError(
736
+ `local studio session: segment ${segmentId} is neither the first nor the last of the chain, and a chain shrinks from its ends only`
737
+ );
738
+ }
739
+ return {
740
+ ...current,
741
+ segments: current.segments.filter((segment) => segment.id !== segmentId)
742
+ };
743
+ });
744
+ },
745
+ deleteSegmentGroup: () => refuse("Deleting a segment group"),
746
+ deleteWaypoint: async (itineraryId, waypointId) => {
747
+ records.commit(itineraryId, (current) => {
748
+ const removed = waypointOf(current, waypointId);
749
+ return {
750
+ ...current,
751
+ waypoints: current.waypoints.filter((waypoint) => waypoint !== removed)
752
+ };
753
+ });
754
+ },
755
+ disableItineraryShareLink: () => refuse("Disabling a share link"),
756
+ duplicateItinerary: () => refuse("Duplicating an itinerary"),
757
+ fetchItineraryRecord: async (itineraryId) => records.recordOf(itineraryId),
758
+ fetchItineraryShareLink: () => refuse("Reading a share link"),
759
+ mergeSegment: () => refuse("Merging two segments"),
760
+ mintItineraryShareLink: () => refuse("Minting a share link"),
761
+ publishItinerary: () => refuse("Publishing an itinerary"),
762
+ rotateItineraryShareLink: () => refuse("Rotating a share link"),
763
+ splitSegment: () => refuse("Splitting a segment"),
764
+ unpublishItinerary: () => refuse("Unpublishing an itinerary"),
765
+ updateItinerary: async (itineraryId, params) => records.commit(itineraryId, (current) => ({
766
+ ...current,
767
+ description: clearedText(params.description, current.description),
768
+ is_private: params.is_private ?? current.is_private,
769
+ name: params.name ?? current.name,
770
+ revision: current.revision + 1
771
+ })),
772
+ updateSegment: async (itineraryId, segmentId, params) => {
773
+ const record = records.recordOf(itineraryId);
774
+ const { mode } = segmentOf(record, segmentId);
775
+ const geojson = await routedGeometry(params.geojson, mode, record.activity_id, route);
776
+ const activityDefault = params.speed === void 0 ? null : activityDefaultSpeed(defaultSpeed, record.activity_id);
777
+ const saved = records.commit(itineraryId, (current) => {
778
+ const held = segmentOf(current, segmentId);
779
+ return {
780
+ ...current,
781
+ segments: current.segments.map(
782
+ (segment) => segment === held ? updatedSegment(segment, params, geojson, activityDefault) : segment
783
+ )
784
+ };
785
+ });
786
+ return segmentOf(saved, segmentId);
787
+ },
788
+ updateSegmentGroup: () => refuse("Updating a segment group"),
789
+ updateWaypoint: async (itineraryId, waypointId, params) => {
790
+ const saved = records.commit(itineraryId, (current) => {
791
+ const held = waypointOf(current, waypointId);
792
+ return {
793
+ ...current,
794
+ waypoints: current.waypoints.map(
795
+ (waypoint) => waypoint === held ? updatedWaypoint(waypoint, params) : waypoint
796
+ )
797
+ };
798
+ });
799
+ return waypointOf(saved, waypointId);
800
+ }
801
+ };
802
+ };
803
+ var localStudioPersistence = (options = {}) => createLocalPersistence(chunkPSZ2R3TC_cjs.localPersistenceDrawer(options.namespace ?? DEFAULT_NAMESPACE), options);
804
+ var memoryStudioPersistence = (options = {}) => createLocalPersistence(chunkPSZ2R3TC_cjs.memoryPersistenceDrawer(), options);
805
+ var blankSegment = (record, stamp, id) => ({
806
+ altitude_max: null,
807
+ altitude_min: null,
808
+ ascent: null,
809
+ color: null,
810
+ created_at: stamp,
811
+ created_by: record.created_by,
812
+ descent: null,
813
+ description: null,
814
+ distance: null,
815
+ duration: null,
816
+ geojson: null,
817
+ gradient_max: null,
818
+ gradient_min: null,
819
+ group_id: null,
820
+ id,
821
+ itinerary_id: record.id,
822
+ mode: "linestring",
823
+ name: "",
824
+ position: 0,
825
+ revision: 1,
826
+ road_access_info: null,
827
+ slope_info: [],
828
+ speed: null,
829
+ speed_info: null,
830
+ start_at: null,
831
+ steps: [],
832
+ surface_info: [],
833
+ trail_difficulty_info: [],
834
+ way_type_info: []
835
+ });
836
+ var blankWaypoint = (record, stamp, id) => ({
837
+ amenities: [],
838
+ color: null,
839
+ contact: null,
840
+ created_at: stamp,
841
+ created_by: record.created_by,
842
+ description: null,
843
+ geojson: null,
844
+ icon: null,
845
+ id,
846
+ itinerary_id: record.id,
847
+ media: null,
848
+ mode: "point",
849
+ name: null,
850
+ position: 0,
851
+ properties: null,
852
+ revision: 1,
853
+ timing: null
854
+ });
855
+ var localId = (ids) => `local-${ids.next()}`;
856
+
857
+ // src/data/rules/sessionSurface.ts
858
+ var SESSION_TOKEN_PREFIX = "sess_";
859
+ var DEFAULT_SURFACE = "api";
860
+ var STUDIO_SURFACE = "studio-embedded";
861
+ var BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
862
+ var base64UrlBytes = (text2) => {
863
+ if (text2.length % 4 === 1) {
864
+ return void 0;
865
+ }
866
+ const bytes = [];
867
+ let buffer = 0;
868
+ let bits = 0;
869
+ for (const character of text2) {
870
+ const value = BASE64URL_ALPHABET.indexOf(character);
871
+ if (value === -1) {
872
+ return void 0;
873
+ }
874
+ buffer = buffer << 6 | value;
875
+ bits += 6;
876
+ if (bits >= 8) {
877
+ bits -= 8;
878
+ bytes.push(buffer >> bits & 255);
879
+ buffer &= (1 << bits) - 1;
880
+ }
881
+ }
882
+ return Uint8Array.from(bytes);
883
+ };
884
+ var payloadOf = (token) => {
885
+ if (!token.startsWith(SESSION_TOKEN_PREFIX)) {
886
+ return void 0;
887
+ }
888
+ const body = token.slice(SESSION_TOKEN_PREFIX.length);
889
+ const dot = body.indexOf(".");
890
+ if (dot <= 0 || dot === body.length - 1) {
891
+ return void 0;
892
+ }
893
+ const bytes = base64UrlBytes(body.slice(0, dot));
894
+ if (bytes === void 0) {
895
+ return void 0;
896
+ }
897
+ let parsed;
898
+ try {
899
+ parsed = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
900
+ } catch {
901
+ return void 0;
902
+ }
903
+ return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : void 0;
904
+ };
905
+ var sessionTokenSurface = (token) => {
906
+ const payload = payloadOf(token);
907
+ if (payload === void 0) {
908
+ return void 0;
909
+ }
910
+ if (!("surface" in payload) || payload.surface === void 0) {
911
+ return DEFAULT_SURFACE;
912
+ }
913
+ return typeof payload.surface === "string" ? payload.surface : void 0;
914
+ };
915
+ var isStudioSessionToken = (token) => sessionTokenSurface(token) === STUDIO_SURFACE;
916
+
917
+ // src/edit/rules/editKeyboard.ts
918
+ var latinLetter = /^[a-z]$/i;
919
+ var LAST_ASCII_CODE_POINT = 127;
920
+ var isCharacterOutsideAscii = (key) => {
921
+ const [first, ...rest] = key;
922
+ return first !== void 0 && rest.length === 0 && (first.codePointAt(0) ?? 0) > LAST_ASCII_CODE_POINT;
923
+ };
924
+ var physicalLetter = /^Key([A-Z])$/;
925
+ var chordLetter = (stroke) => {
926
+ if (latinLetter.test(stroke.key)) {
927
+ return stroke.key.toLowerCase();
928
+ }
929
+ if (stroke.code === void 0 || !isCharacterOutsideAscii(stroke.key)) {
930
+ return null;
931
+ }
932
+ return physicalLetter.exec(stroke.code)?.[1]?.toLowerCase() ?? null;
933
+ };
934
+ var editToolPrefixes = {
935
+ segment: "studio.itinerary.segment.",
936
+ waypoint: "studio.itinerary.waypoint.",
937
+ zone: "studio.zone."
938
+ };
939
+ var editToolVerbs = {
940
+ cancel: "editCancel",
941
+ commit: "editCommit",
942
+ redo: "editRedo",
943
+ undo: "editUndo"
944
+ };
945
+ var editToolName = (family, intent) => `${editToolPrefixes[family]}${editToolVerbs[intent]}`;
946
+ var editHijacksNativeShortcut = (stroke) => {
947
+ if (stroke.key === "Enter") {
948
+ return true;
949
+ }
950
+ const letter = chordLetter(stroke);
951
+ return stroke.meta && (letter === "z" || letter === "y" || letter === "s");
952
+ };
953
+ var editKeyIntent = (stroke, options = {}) => {
954
+ const { escapeCancels = true } = options;
955
+ const letter = chordLetter(stroke);
956
+ if (stroke.key === "Enter" || stroke.meta && letter === "s") {
957
+ return "commit";
958
+ }
959
+ if (escapeCancels && stroke.key === "Escape") {
960
+ return "cancel";
961
+ }
962
+ if (stroke.meta && letter === "z") {
963
+ return stroke.shift ? "redo" : "undo";
964
+ }
965
+ if (stroke.meta && letter === "y") {
966
+ return "redo";
967
+ }
968
+ return null;
969
+ };
970
+
971
+ // src/edit/rules/editShortcuts.ts
972
+ var editShortcuts = (input) => {
973
+ const modifier = input.apple ? "command" : "control";
974
+ const shortcuts = [];
975
+ if (input.canUndo) {
976
+ shortcuts.push({ action: "undo", keys: [modifier, "z"] });
977
+ }
978
+ if (input.canRedo) {
979
+ shortcuts.push({
980
+ action: "redo",
981
+ keys: input.apple ? ["shift", "command", "z"] : ["control", "y"]
982
+ });
983
+ }
984
+ if (input.escape !== null) {
985
+ shortcuts.push({ action: input.escape, keys: ["escape"] });
986
+ }
987
+ if (input.canCommit) {
988
+ shortcuts.push({ action: "commit", keys: ["enter"] });
989
+ }
990
+ return shortcuts;
991
+ };
992
+ var zoneEditTooltipText = (texts, hasShape) => {
993
+ if (hasShape) {
994
+ return texts.reshape;
995
+ }
996
+ return texts.draw;
997
+ };
998
+ var segmentEditTooltipContent = (texts, viaCount, mode) => {
999
+ if (mode === "directions" && viaCount >= geo.DIRECTIONS_VIA_MAX) {
1000
+ return { hint: null, primary: texts.viaCapReached, tone: "limit" };
1001
+ }
1002
+ if (mode === "directions" && viaCount >= geo.DIRECTIONS_VIA_COUNTER_THRESHOLD) {
1003
+ return { hint: null, primary: texts.viaCapCounter(viaCount), tone: "warning" };
1004
+ }
1005
+ return {
1006
+ hint: texts.finishHint,
1007
+ primary: viaCount >= geo.SEGMENT_MIN_VIAS ? texts.reshape : texts.addPoint,
1008
+ tone: "info"
1009
+ };
1010
+ };
1011
+ var waypointEditTooltipText = (texts, mode, hasDraft, poiUnderCursor) => {
1012
+ if (mode === "point") {
1013
+ return hasDraft ? texts.clickToMove : texts.clickToDrop;
1014
+ }
1015
+ return poiUnderCursor ? texts.clickToCapture : texts.clickAPoi;
1016
+ };
1017
+
1018
+ // src/embed/rules/allowedDomains.ts
1019
+ var leadingWww = /^www\./;
1020
+ var loopbackIpv4 = /^127(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/;
1021
+ var ipv6Text = /^[0-9a-f:.]+$/;
1022
+ var loopbackIpv6 = /^\[(?:::1|::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4})\]$/;
1023
+ var isLoopbackHost = (host) => {
1024
+ if (host === "localhost" || host.endsWith(".localhost") || loopbackIpv4.test(host)) {
1025
+ return true;
1026
+ }
1027
+ if (!host.includes(":") || !ipv6Text.test(host)) {
1028
+ return false;
1029
+ }
1030
+ try {
1031
+ return loopbackIpv6.test(new URL(`http://[${host}]`).hostname);
1032
+ } catch {
1033
+ return false;
1034
+ }
1035
+ };
1036
+ var isLoopbackDomain = (entry) => {
1037
+ const text2 = entry.toLowerCase().replace(leadingWww, "");
1038
+ if (text2.startsWith("[")) {
1039
+ const close = text2.indexOf("]");
1040
+ const rest = close === -1 ? "" : text2.slice(close + 1);
1041
+ return close !== -1 && (rest === "" || rest.startsWith(":")) && isLoopbackHost(text2.slice(1, close));
1042
+ }
1043
+ const colons = text2.split(":").length - 1;
1044
+ return isLoopbackHost(colons === 1 ? text2.slice(0, text2.indexOf(":")) : text2);
1045
+ };
1046
+
1047
+ // src/embed/rules/snippet.ts
1048
+ var EMBED_CONFIG_FIELDS = [
1049
+ // Appearance.
1050
+ { key: "preferredLanguage", kind: "enum", param: "preferred_language" },
1051
+ { key: "preferredTheme", kind: "enum", param: "preferred_theme" },
1052
+ { key: "preferredUnitLength", kind: "enum", param: "preferred_unit_length" },
1053
+ { key: "preferredUnitPace", kind: "enum", param: "preferred_unit_pace" },
1054
+ { key: "preferredUnitSlope", kind: "enum", param: "preferred_unit_slope" },
1055
+ { key: "preferredUnitTemperature", kind: "enum", param: "preferred_unit_temperature" },
1056
+ { key: "terrain", kind: "string", param: "terrain" },
1057
+ { key: "terrainVariant", kind: "enum", param: "terrain_variant" },
1058
+ { key: "segmentsColor", kind: "string", param: "segments_color" },
1059
+ // Map controls, in the top-right stack's render order: zoom, preferences, download,
1060
+ // directions, Street View (the overlay time slider is in the Layers section below).
1061
+ { key: "withNavigationControl", kind: "boolean", param: "with_navigation_control" },
1062
+ { key: "withPreferencesControl", kind: "boolean", param: "with_preferences_control" },
1063
+ { key: "withDownloadControl", kind: "boolean", param: "with_download_control" },
1064
+ { key: "withDirectionsControl", kind: "boolean", param: "with_directions_control" },
1065
+ { key: "withStreetviewControl", kind: "boolean", param: "with_streetview_control" },
1066
+ // Profile panel, in the elevation panel's render order: characteristics, elevation,
1067
+ // analysis.
1068
+ { key: "withProfileCharacteristics", kind: "boolean", param: "with_profile_characteristics" },
1069
+ { key: "withProfileElevation", kind: "boolean", param: "with_profile_elevation" },
1070
+ { key: "withProfilePaceControl", kind: "boolean", param: "with_profile_pace_control" },
1071
+ { key: "withProfileAnalysis", kind: "boolean", param: "with_profile_analysis" },
1072
+ // Layers: the layers-button toggle that governs the panel, then the terrain and
1073
+ // overlay allowlists it offers, then the restricted stretches the routes are drawn with.
1074
+ { key: "withOverlaysControl", kind: "boolean", param: "with_overlays_control" },
1075
+ { key: "withTerrains", kind: "stringArray", param: "with_terrains" },
1076
+ { key: "withOverlays", kind: "stringArray", param: "with_overlays" },
1077
+ { key: "withAccessRestrictions", kind: "boolean", param: "with_access_restrictions" }
1078
+ ];
1079
+ var emptyEmbedSearch = chunkOQSYFH3Z_cjs.embedSearchSchema.parse({});
1080
+ var resolveEmbedDefaults = (defaultProps) => chunkOQSYFH3Z_cjs.resolveEmbedConfig(emptyEmbedSearch, defaultProps);
1081
+ var arraysDifferByContents = (a, b) => {
1082
+ if (a.length !== b.length) {
1083
+ return true;
1084
+ }
1085
+ const sortedA = [...a].sort();
1086
+ const sortedB = [...b].sort();
1087
+ return sortedA.some((value, index) => value !== sortedB[index]);
1088
+ };
1089
+ var allowlistEntries = (param, value, fallback) => {
1090
+ if (chunkCJDIFRGZ_cjs.allowlistUnrestricted(value)) {
1091
+ return chunkCJDIFRGZ_cjs.allowlistUnrestricted(fallback) ? [] : [[param, chunkCJDIFRGZ_cjs.ALLOWLIST_WILDCARD]];
1092
+ }
1093
+ return arraysDifferByContents(value, fallback) ? value.map((slug) => [param, slug]) : [];
1094
+ };
1095
+ var fieldEntries = (field, config, defaults) => {
1096
+ const value = config[field.key];
1097
+ const fallback = defaults[field.key];
1098
+ if (Array.isArray(value)) {
1099
+ return allowlistEntries(field.param, value, Array.isArray(fallback) ? fallback : []);
1100
+ }
1101
+ if (value === fallback) {
1102
+ return [];
1103
+ }
1104
+ return [[field.param, typeof value === "boolean" ? value ? "true" : "false" : value]];
1105
+ };
1106
+ var buildEmbedSearch = (input) => {
1107
+ const entries = [["publishable_key", input.publishableKey]];
1108
+ if (input.itineraryId) {
1109
+ entries.push(["itinerary_id", input.itineraryId]);
1110
+ }
1111
+ if (input.collectionId) {
1112
+ entries.push(["collection_id", input.collectionId]);
1113
+ }
1114
+ if (input.sessionToken) {
1115
+ entries.push(["session_token", input.sessionToken]);
1116
+ }
1117
+ for (const field of EMBED_CONFIG_FIELDS) {
1118
+ entries.push(...fieldEntries(field, input.config, input.defaults));
1119
+ }
1120
+ return entries;
1121
+ };
1122
+ var buildEmbedSrc = (origin, search, hash = "") => {
1123
+ const params = new URLSearchParams(search);
1124
+ return `${chunkIDBXFBLG_cjs.originBase(origin)}/studio/embed?${params.toString()}${hash}`;
1125
+ };
1126
+ var buildEmbedViewHash = (view) => {
1127
+ if (view.center === null || view.zoom === null) {
1128
+ return "";
1129
+ }
1130
+ const [lng, lat] = view.center;
1131
+ const bearing = Math.round(view.bearing ?? 0);
1132
+ const pitch = Math.round(view.pitch ?? 0);
1133
+ return `#view=${view.zoom.toFixed(2)}/${lat.toFixed(6)}/${lng.toFixed(6)}/${bearing}/${pitch}`;
1134
+ };
1135
+ var EMBED_IFRAME_RADIUS_PX = 8;
1136
+ var escapeHtmlAttribute = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1137
+ var buildEmbedIframe = (input) => [
1138
+ "<iframe",
1139
+ ` src="${escapeHtmlAttribute(input.src)}"`,
1140
+ ` width="${escapeHtmlAttribute(input.width)}"`,
1141
+ ` height="${escapeHtmlAttribute(input.height)}"`,
1142
+ ` title="${escapeHtmlAttribute(input.title)}"`,
1143
+ ` style="border:0;border-radius:${EMBED_IFRAME_RADIUS_PX}px"`,
1144
+ ' loading="lazy"',
1145
+ ' referrerpolicy="strict-origin-when-cross-origin"',
1146
+ "></iframe>"
1147
+ ].join("\n");
1148
+ var EMBED_SESSION_ENDPOINT = "/api/mountaya-embed-session";
1149
+ var scriptString = (value) => JSON.stringify(value).replace(/</g, "\\u003c");
1150
+ var buildEmbedSessionScript = (input) => [
1151
+ "<script>",
1152
+ " // Answers each Mountaya embed's request for a session token from your endpoint, which",
1153
+ " // calls POST /v1/sessions with your secret key and answers its body, or the session in it.",
1154
+ " (function () {",
1155
+ ` var origin = ${scriptString(chunkIDBXFBLG_cjs.originBase(input.appOrigin))};`,
1156
+ ` var endpoint = ${scriptString(input.endpoint ?? EMBED_SESSION_ENDPOINT)};`,
1157
+ " if (window.mountayaEmbedSession) return;",
1158
+ " window.mountayaEmbedSession = true;",
1159
+ ' window.addEventListener("message", function (event) {',
1160
+ " if (event.origin !== origin || !event.data) return;",
1161
+ ` if (event.data.type !== ${scriptString(chunkIDBXFBLG_cjs.REQUEST_SESSION_TOKEN_MESSAGE)}) return;`,
1162
+ " var frame = event.source;",
1163
+ ' fetch(endpoint, { credentials: "same-origin" })',
1164
+ " .then(function (response) {",
1165
+ ' if (!response.ok) throw new Error("Session endpoint answered " + response.status);',
1166
+ " return response.json();",
1167
+ " })",
1168
+ " .then(function (body) {",
1169
+ " var session = body && body.data ? body.data : body;",
1170
+ ' if (!session || typeof session.token !== "string") {',
1171
+ ' throw new Error("Session endpoint answered no token");',
1172
+ " }",
1173
+ ' if (typeof session.user_id === "string") {',
1174
+ ' throw new Error("Session endpoint answered a token naming a user: mint without user_id");',
1175
+ " }",
1176
+ " frame.postMessage(",
1177
+ ` { type: ${scriptString(chunkIDBXFBLG_cjs.SET_SESSION_TOKEN_MESSAGE)}, token: session.token, expiresAt: session.expires_at },`,
1178
+ " origin",
1179
+ " );",
1180
+ " })",
1181
+ " .catch(function (error) {",
1182
+ " console.error(error);",
1183
+ " });",
1184
+ " });",
1185
+ " })();",
1186
+ "</script>"
1187
+ ].join("\n");
1188
+
1189
+ // src/embed/rules/defaults.ts
1190
+ var embedFallbackProps = {
1191
+ preferred_language: "en",
1192
+ preferred_theme: "light",
1193
+ preferred_unit_length: "metric",
1194
+ preferred_unit_pace: "per-time",
1195
+ preferred_unit_slope: "degrees",
1196
+ preferred_unit_temperature: "celsius",
1197
+ segments_color: "",
1198
+ terrain: chunkOQSYFH3Z_cjs.DEFAULT_TERRAIN,
1199
+ terrain_variant: "light",
1200
+ with_access_restrictions: true,
1201
+ with_collection_itineraries: true,
1202
+ with_collection_zones: true,
1203
+ with_directions_control: false,
1204
+ with_download_control: false,
1205
+ with_navigation_control: true,
1206
+ with_overlays: [],
1207
+ with_overlays_control: false,
1208
+ with_preferences_control: true,
1209
+ with_profile_analysis: false,
1210
+ with_profile_characteristics: true,
1211
+ with_profile_elevation: true,
1212
+ with_profile_pace_control: true,
1213
+ with_streetview_control: false,
1214
+ with_terrains: []
1215
+ };
1216
+ var normalizeDefaultProps = (props) => {
1217
+ if (!props) {
1218
+ return embedFallbackProps;
1219
+ }
1220
+ const language = chunkOQSYFH3Z_cjs.languageSchema.safeParse(props.preferred_language);
1221
+ const theme = chunkOQSYFH3Z_cjs.themeSchema.safeParse(props.preferred_theme);
1222
+ const unitLength = chunkOQSYFH3Z_cjs.unitLengthSchema.safeParse(props.preferred_unit_length);
1223
+ const unitPace = chunkOQSYFH3Z_cjs.unitPaceSchema.safeParse(props.preferred_unit_pace);
1224
+ const unitSlope = chunkOQSYFH3Z_cjs.unitSlopeSchema.safeParse(props.preferred_unit_slope);
1225
+ const unitTemperature = chunkOQSYFH3Z_cjs.unitTemperatureSchema.safeParse(props.preferred_unit_temperature);
1226
+ const terrainVariant = chunkOQSYFH3Z_cjs.terrainVariantSchema.safeParse(props.terrain_variant);
1227
+ return {
1228
+ preferred_language: language.success ? language.data : embedFallbackProps.preferred_language,
1229
+ preferred_theme: theme.success ? theme.data : embedFallbackProps.preferred_theme,
1230
+ preferred_unit_length: unitLength.success ? unitLength.data : embedFallbackProps.preferred_unit_length,
1231
+ preferred_unit_pace: unitPace.success ? unitPace.data : embedFallbackProps.preferred_unit_pace,
1232
+ preferred_unit_slope: unitSlope.success ? unitSlope.data : embedFallbackProps.preferred_unit_slope,
1233
+ preferred_unit_temperature: unitTemperature.success ? unitTemperature.data : embedFallbackProps.preferred_unit_temperature,
1234
+ segments_color: props.segments_color ?? embedFallbackProps.segments_color,
1235
+ terrain: props.terrain || embedFallbackProps.terrain,
1236
+ terrain_variant: terrainVariant.success ? terrainVariant.data : embedFallbackProps.terrain_variant,
1237
+ with_access_restrictions: props.with_access_restrictions,
1238
+ with_collection_itineraries: props.with_collection_itineraries,
1239
+ with_collection_zones: props.with_collection_zones,
1240
+ with_directions_control: props.with_directions_control,
1241
+ with_download_control: props.with_download_control,
1242
+ with_navigation_control: props.with_navigation_control,
1243
+ with_overlays: props.with_overlays,
1244
+ with_overlays_control: props.with_overlays_control,
1245
+ with_preferences_control: props.with_preferences_control,
1246
+ with_profile_analysis: props.with_profile_analysis,
1247
+ with_profile_characteristics: props.with_profile_characteristics,
1248
+ with_profile_elevation: props.with_profile_elevation,
1249
+ with_profile_pace_control: props.with_profile_pace_control,
1250
+ with_streetview_control: props.with_streetview_control,
1251
+ with_terrains: props.with_terrains
1252
+ };
1253
+ };
1254
+ var resolveOrgEmbedDefaults = (props) => resolveEmbedDefaults(normalizeDefaultProps(props));
1255
+
1256
+ // src/embed/rules/displaySeed.ts
1257
+ var displaySeedDispatches = (previous, next) => {
1258
+ const dispatches = [];
1259
+ if (previous === null || previous.terrain !== next.terrain || previous.terrainVariant !== next.terrainVariant) {
1260
+ dispatches.push({
1261
+ input: { terrain: next.terrain, variant: next.terrainVariant },
1262
+ name: "studio.terrain.set"
1263
+ });
1264
+ }
1265
+ if (previous === null || previous.overlay !== next.overlay) {
1266
+ dispatches.push({ input: { overlay: next.overlay }, name: "studio.overlay.set" });
1267
+ }
1268
+ const previousEnrichments = previous?.enrichments ?? [];
1269
+ for (const slug of next.enrichments) {
1270
+ if (!previousEnrichments.includes(slug)) {
1271
+ dispatches.push({
1272
+ input: { enabled: true, overlay: slug },
1273
+ name: "studio.overlay.enrichment.set"
1274
+ });
1275
+ }
1276
+ }
1277
+ for (const slug of previousEnrichments) {
1278
+ if (!next.enrichments.includes(slug)) {
1279
+ dispatches.push({
1280
+ input: { enabled: false, overlay: slug },
1281
+ name: "studio.overlay.enrichment.set"
1282
+ });
1283
+ }
1284
+ }
1285
+ return dispatches;
1286
+ };
1287
+
1288
+ // src/embed/rules/embedAllowlist.ts
1289
+ var capPermits = (cap, slug) => {
1290
+ if (cap === void 0) {
1291
+ return true;
1292
+ }
1293
+ const mode = chunkCJDIFRGZ_cjs.allowlistMode(cap, "cap");
1294
+ return mode === "all" || mode === "specific" && cap.includes(slug);
1295
+ };
1296
+ var clampConfigToAllowlists = (config, cap) => {
1297
+ const displayUnrestricted = chunkCJDIFRGZ_cjs.allowlistUnrestricted(config.withOverlays);
1298
+ const permits = (slug) => capPermits(cap, slug) && (displayUnrestricted || config.withOverlays.includes(slug));
1299
+ let next = config;
1300
+ if (next.overlay !== null && !permits(next.overlay)) {
1301
+ next = { ...next, overlay: null };
1302
+ }
1303
+ if (next.enrichments.length > 0) {
1304
+ const allowedEnrichments = next.enrichments.filter(permits);
1305
+ if (allowedEnrichments.length !== next.enrichments.length) {
1306
+ next = { ...next, enrichments: allowedEnrichments };
1307
+ }
1308
+ }
1309
+ const capMode = cap === void 0 ? "all" : chunkCJDIFRGZ_cjs.allowlistMode(cap, "cap");
1310
+ if (capMode !== "all") {
1311
+ const offered = displayUnrestricted ? cap ?? [] : config.withOverlays.filter((slug) => capPermits(cap, slug));
1312
+ if (offered.length > 0 && (displayUnrestricted || offered.length !== config.withOverlays.length)) {
1313
+ next = { ...next, withOverlays: [...offered] };
1314
+ }
1315
+ }
1316
+ if (!chunkCJDIFRGZ_cjs.allowlistUnrestricted(next.withTerrains) && !next.withTerrains.includes(next.terrain)) {
1317
+ const fallbackTerrain = next.withTerrains[0];
1318
+ if (fallbackTerrain !== void 0) {
1319
+ next = { ...next, terrain: fallbackTerrain };
1320
+ }
1321
+ }
1322
+ return next;
1323
+ };
1324
+ var overlaysOffered = (withOverlays, cap) => {
1325
+ const capMode = cap === void 0 ? "all" : chunkCJDIFRGZ_cjs.allowlistMode(cap, "cap");
1326
+ if (capMode !== "specific") {
1327
+ return capMode === "all";
1328
+ }
1329
+ return chunkCJDIFRGZ_cjs.allowlistUnrestricted(withOverlays) || withOverlays.some((slug) => capPermits(cap, slug));
1330
+ };
1331
+ var layersControlOffered = (config, cap) => overlaysOffered(config.withOverlays, cap) || !chunkCJDIFRGZ_cjs.allowlistUnrestricted(config.withTerrains);
1332
+
1333
+ // src/embed/rules/embedSectionFields.ts
1334
+ var EMBED_SECTION_ORDER = [
1335
+ "appearance",
1336
+ "controls",
1337
+ "profile",
1338
+ "layers"
1339
+ ];
1340
+ var embedSectionFieldKeys = {
1341
+ appearance: /* @__PURE__ */ new Set([
1342
+ "preferredLanguage",
1343
+ "preferredTheme",
1344
+ "preferredUnitLength",
1345
+ "preferredUnitPace",
1346
+ "preferredUnitSlope",
1347
+ "preferredUnitTemperature",
1348
+ "terrain",
1349
+ "terrainVariant",
1350
+ "segmentsColor"
1351
+ ]),
1352
+ // Empty: the collection section's toggles are organization clamps with no
1353
+ // per-embed spelling, so they carry no EMBED_CONFIG_FIELDS descriptor. They reach
1354
+ // an organization settings form through orgOnlySectionProps below.
1355
+ collection: /* @__PURE__ */ new Set(),
1356
+ controls: /* @__PURE__ */ new Set([
1357
+ "withNavigationControl",
1358
+ "withPreferencesControl",
1359
+ "withDownloadControl",
1360
+ "withDirectionsControl",
1361
+ "withStreetviewControl"
1362
+ ]),
1363
+ layers: /* @__PURE__ */ new Set([
1364
+ "withOverlaysControl",
1365
+ "withTerrains",
1366
+ "withOverlays",
1367
+ "withAccessRestrictions"
1368
+ ]),
1369
+ profile: /* @__PURE__ */ new Set([
1370
+ "withProfileCharacteristics",
1371
+ "withProfileElevation",
1372
+ "withProfilePaceControl",
1373
+ "withProfileAnalysis"
1374
+ ])
1375
+ };
1376
+ var sectionFields = (section) => EMBED_CONFIG_FIELDS.filter((field) => embedSectionFieldKeys[section].has(field.key));
1377
+ var orgOnlySectionProps = {
1378
+ collection: ["with_collection_itineraries", "with_collection_zones"]
1379
+ };
1380
+ var sectionDefaultPropsFields = (section) => [
1381
+ ...sectionFields(section).map((field) => field.param),
1382
+ ...orgOnlySectionProps[section] ?? []
1383
+ ];
1384
+
1385
+ // src/embed/rules/embedElements.ts
1386
+ var EMBED_ELEMENTS = ["map", "segment-table", "waypoint-table"];
1387
+ var isEmbedTableElement = (element) => element !== "map";
1388
+ var isPerEmbedSection = (section) => section !== "collection";
1389
+ var embedElementSections = (element, withGeneral) => {
1390
+ const own = isEmbedTableElement(element) ? ["columns", "appearance"] : ["defaultView", ...EMBED_SECTION_ORDER.filter(isPerEmbedSection)];
1391
+ return [...withGeneral ? ["general"] : [], ...own, "code"];
1392
+ };
1393
+ var tableFieldKeys = /* @__PURE__ */ new Set([
1394
+ "preferredLanguage",
1395
+ "preferredUnitLength"
1396
+ ]);
1397
+ var embedElementSupportsField = (element, key) => !isEmbedTableElement(element) || tableFieldKeys.has(key);
1398
+ var embedElementSectionFields = (element, section) => sectionFields(section).filter((field) => embedElementSupportsField(element, field.key));
1399
+ var embedSectionChanges = (element, section, config, defaults) => embedElementSectionFields(element, section).filter((field) => {
1400
+ const value = config[field.key];
1401
+ const fallback = defaults[field.key];
1402
+ return Array.isArray(value) && Array.isArray(fallback) ? arraysDifferByContents(value, fallback) : value !== fallback;
1403
+ }).length;
1404
+ var EMBED_SEGMENT_TABLE_COLUMNS = [
1405
+ "segment",
1406
+ "profile",
1407
+ "distance",
1408
+ "elevation",
1409
+ "altitude",
1410
+ "duration",
1411
+ "difficulty"
1412
+ ];
1413
+ var EMBED_WAYPOINT_TABLE_COLUMNS = [
1414
+ "waypoint",
1415
+ "profile",
1416
+ "distance",
1417
+ "elevation",
1418
+ "altitude",
1419
+ "amenities",
1420
+ "cutoff",
1421
+ "properties"
1422
+ ];
1423
+ var defaultEmbedTableOptions = {
1424
+ segmentColumns: profile.DEFAULT_SEGMENT_TABLE_COLUMNS,
1425
+ serviceFilter: false,
1426
+ waypointColumns: profile.DEFAULT_WAYPOINT_TABLE_COLUMNS
1427
+ };
1428
+ var toggleEmbedTableColumn = (all, columns, column, shown) => all.filter(
1429
+ (candidate, index) => candidate === column ? shown || index === 0 : columns.includes(candidate)
1430
+ );
1431
+ var embedTableColumns = (element, options) => element === "segment-table" ? options.segmentColumns : options.waypointColumns;
1432
+ var embedTableChanges = (element, options) => {
1433
+ const columns = embedTableColumns(element, options);
1434
+ const defaults = element === "segment-table" ? profile.DEFAULT_SEGMENT_TABLE_COLUMNS : profile.DEFAULT_WAYPOINT_TABLE_COLUMNS;
1435
+ const moved = columns.filter((column) => !defaults.includes(column)).length + defaults.filter((column) => !columns.includes(column)).length;
1436
+ return moved + (element === "waypoint-table" && options.serviceFilter ? 1 : 0);
1437
+ };
1438
+
1439
+ // src/embed/rules/fieldDependencies.ts
1440
+ var embedFieldDependencies = {
1441
+ withProfileAnalysis: ["withProfileElevation"],
1442
+ withProfilePaceControl: ["withProfileElevation", "withProfileCharacteristics"]
1443
+ };
1444
+ var isDependentFieldKey = (key) => Object.hasOwn(embedFieldDependencies, key);
1445
+ var fieldDependenciesUnmet = (key, config) => {
1446
+ if (!isDependentFieldKey(key)) {
1447
+ return [];
1448
+ }
1449
+ const required = embedFieldDependencies[key];
1450
+ return required.filter((field) => config[field] === false);
1451
+ };
1452
+ var clampConfigToFieldDependencies = (config) => {
1453
+ let next = config;
1454
+ for (const key of Object.keys(embedFieldDependencies).filter(isDependentFieldKey)) {
1455
+ if (next[key] && fieldDependenciesUnmet(key, next).length > 0) {
1456
+ next = { ...next, [key]: false };
1457
+ }
1458
+ }
1459
+ return next;
1460
+ };
1461
+
1462
+ // src/embed/rules/embedSecurity.ts
1463
+ var clampEmbedConfigToSecurity = (config, safetyRules) => clampConfigToFieldDependencies(
1464
+ clampConfigToAllowlists(
1465
+ chunkCJDIFRGZ_cjs.clampConfigToSafetyRules(config, safetyRules),
1466
+ safetyRules?.with_overlays
1467
+ )
1468
+ );
1469
+ var applyEmbedOverrides = (config, content) => {
1470
+ const { itineraryId, overrides } = content;
1471
+ const next = { ...config, itineraryId };
1472
+ if (overrides.terrain !== void 0) {
1473
+ next.terrain = overrides.terrain;
1474
+ }
1475
+ if (Array.isArray(overrides.withOverlays)) {
1476
+ next.withOverlays = overrides.withOverlays;
1477
+ }
1478
+ if (Array.isArray(overrides.withTerrains)) {
1479
+ next.withTerrains = overrides.withTerrains;
1480
+ }
1481
+ if (overrides.withAccessRestrictions !== void 0) {
1482
+ next.withAccessRestrictions = overrides.withAccessRestrictions;
1483
+ }
1484
+ if (overrides.withDirectionsControl !== void 0) {
1485
+ next.withDirectionsControl = overrides.withDirectionsControl;
1486
+ }
1487
+ if (overrides.withDownloadControl !== void 0) {
1488
+ next.withDownloadControl = overrides.withDownloadControl;
1489
+ }
1490
+ if (overrides.withNavigationControl !== void 0) {
1491
+ next.withNavigationControl = overrides.withNavigationControl;
1492
+ }
1493
+ if (overrides.withOverlaysControl !== void 0) {
1494
+ next.withOverlaysControl = overrides.withOverlaysControl;
1495
+ }
1496
+ if (overrides.withPreferencesControl !== void 0) {
1497
+ next.withPreferencesControl = overrides.withPreferencesControl;
1498
+ }
1499
+ if (overrides.withProfileAnalysis !== void 0) {
1500
+ next.withProfileAnalysis = overrides.withProfileAnalysis;
1501
+ }
1502
+ if (overrides.withProfileCharacteristics !== void 0) {
1503
+ next.withProfileCharacteristics = overrides.withProfileCharacteristics;
1504
+ }
1505
+ if (overrides.withProfileElevation !== void 0) {
1506
+ next.withProfileElevation = overrides.withProfileElevation;
1507
+ }
1508
+ if (overrides.withProfilePaceControl !== void 0) {
1509
+ next.withProfilePaceControl = overrides.withProfilePaceControl;
1510
+ }
1511
+ if (overrides.withStreetviewControl !== void 0) {
1512
+ next.withStreetviewControl = overrides.withStreetviewControl;
1513
+ }
1514
+ return next;
1515
+ };
1516
+ var languageOptions = () => i18n.MAP_LANGUAGES.map((value) => ({ label: i18n.languageEndonym[value], value }));
1517
+ var themeOptions = (words) => [
1518
+ { label: words.embed.options.theme.light, value: "light" },
1519
+ { label: words.embed.options.theme.dark, value: "dark" }
1520
+ ];
1521
+ var unitLengthOptions = (words) => [
1522
+ { label: words.preferences.units.metric.name, value: "metric" },
1523
+ { label: words.preferences.units.imperial.name, value: "imperial" }
1524
+ ];
1525
+ var unitPaceOptions = (words) => [
1526
+ { label: words.preferences.units.perTime.name, value: "per-time" },
1527
+ { label: words.preferences.units.perDistance.name, value: "per-distance" }
1528
+ ];
1529
+ var unitSlopeOptions = (words) => [
1530
+ { label: words.preferences.units.degrees.name, value: "degrees" },
1531
+ { label: words.preferences.units.percentage.name, value: "percentage" }
1532
+ ];
1533
+ var unitTemperatureOptions = (words) => [
1534
+ { label: words.preferences.units.celsius.name, value: "celsius" },
1535
+ { label: words.preferences.units.fahrenheit.name, value: "fahrenheit" }
1536
+ ];
1537
+ var terrainVariantOptions = (words) => [
1538
+ { label: words.embed.options.terrainVariant.light, value: "light" },
1539
+ { label: words.embed.options.terrainVariant.dark, value: "dark" }
1540
+ ];
1541
+ var enumFieldOptions = (key, words) => {
1542
+ switch (key) {
1543
+ case "preferredLanguage":
1544
+ return languageOptions();
1545
+ case "preferredTheme":
1546
+ return themeOptions(words);
1547
+ case "preferredUnitLength":
1548
+ return unitLengthOptions(words);
1549
+ case "preferredUnitPace":
1550
+ return unitPaceOptions(words);
1551
+ case "preferredUnitSlope":
1552
+ return unitSlopeOptions(words);
1553
+ case "preferredUnitTemperature":
1554
+ return unitTemperatureOptions(words);
1555
+ case "terrainVariant":
1556
+ return terrainVariantOptions(words);
1557
+ default:
1558
+ return [];
1559
+ }
1560
+ };
1561
+
1562
+ // src/embed/rules/layerOptions.ts
1563
+ var isLayerSlug = (slug) => slug.length > 0 && slug !== chunkCJDIFRGZ_cjs.ALLOWLIST_WILDCARD;
1564
+ var missingOptions = (selected, known) => [...new Set(selected)].filter((slug) => isLayerSlug(slug) && !known.has(slug)).map((slug) => ({ label: slug, value: slug }));
1565
+ var withSelectedTerrains = (terrains, selected) => {
1566
+ const extra = missingOptions(selected, new Set(terrains.map((option) => option.value)));
1567
+ return extra.length === 0 ? terrains : [...terrains, ...extra];
1568
+ };
1569
+ var cappedOverlayGroups = (groups, allowed) => {
1570
+ if (allowed === void 0 || allowed.includes(chunkCJDIFRGZ_cjs.ALLOWLIST_WILDCARD)) {
1571
+ return groups;
1572
+ }
1573
+ const permitted = new Set(allowed);
1574
+ return groups.map((group) => ({
1575
+ group: group.group,
1576
+ items: group.items.filter((item) => permitted.has(item.value))
1577
+ })).filter((group) => group.items.length > 0);
1578
+ };
1579
+ var withSelectedOverlays = (groups, selected, otherLabel) => {
1580
+ const extra = missingOptions(
1581
+ selected,
1582
+ new Set(groups.flatMap((group) => group.items.map((item) => item.value)))
1583
+ );
1584
+ return extra.length === 0 ? groups : [...groups, { group: otherLabel, items: extra }];
1585
+ };
1586
+ var embedLayerOptions = (catalog, config, allowedOverlays, otherLabel) => ({
1587
+ overlayGroups: withSelectedOverlays(
1588
+ cappedOverlayGroups(catalog.overlayGroups, allowedOverlays),
1589
+ config.withOverlays,
1590
+ otherLabel
1591
+ ),
1592
+ terrains: withSelectedTerrains(catalog.terrains, [config.terrain, ...config.withTerrains])
1593
+ });
1594
+ var EMBED_TABLE_INSTALL_COMMAND = "npm install @mountaya/elements-react @mountaya/elements @mountaya/client";
1595
+ var tableComponents = {
1596
+ "segment-table": { element: "ItinerarySegmentTable", wrapper: "SegmentTable" },
1597
+ "waypoint-table": { element: "ItineraryWaypointTable", wrapper: "WaypointTable" }
1598
+ };
1599
+ var defaultColumns = {
1600
+ "segment-table": profile.DEFAULT_SEGMENT_TABLE_COLUMNS,
1601
+ "waypoint-table": profile.DEFAULT_WAYPOINT_TABLE_COLUMNS
1602
+ };
1603
+ var instantColumns = /* @__PURE__ */ new Set(["cutoff", "properties"]);
1604
+ var codeString = (value) => JSON.stringify(value).replace(/</g, "\\u003c");
1605
+ var plainAttribute = /^[\w-]*$/;
1606
+ var attribute = (name, value) => plainAttribute.test(value) ? `${name}="${value}"` : `${name}={${codeString(value)}}`;
1607
+ var sameOrder = (a, b) => a.length === b.length && a.every((value, index) => value === b[index]);
1608
+ var sessionLines = (endpoint) => [
1609
+ "// Your organization requires a session token. This asks your own endpoint for one, which",
1610
+ "// calls POST /v1/sessions with your secret key and answers its body, or the session in it.",
1611
+ "const session = new SessionTokenEngine({",
1612
+ " mint: async () => {",
1613
+ ` const response = await fetch(${codeString(endpoint)}, { credentials: "same-origin" });`,
1614
+ " if (!response.ok) {",
1615
+ ' throw new Error("Session endpoint answered " + response.status);',
1616
+ " }",
1617
+ " const body = await response.json();",
1618
+ "",
1619
+ " return body.data ?? body;",
1620
+ " },",
1621
+ "});",
1622
+ "// The engine mints again before each token expires, for as long as something subscribes.",
1623
+ "session.subscribe(() => undefined);",
1624
+ ""
1625
+ ];
1626
+ var buildEmbedTableCode = (input) => {
1627
+ const { element, wrapper } = tableComponents[input.element];
1628
+ const requireSessionToken = input.requireSessionToken === true;
1629
+ const filtered = input.element === "waypoint-table" && input.serviceFilter === true;
1630
+ const statesColumns = !sameOrder(input.columns, defaultColumns[input.element]);
1631
+ const formatsInstants = input.element === "waypoint-table" && input.columns.some((column) => instantColumns.has(column));
1632
+ const french = input.language === "fr";
1633
+ const imperial = input.length === "imperial";
1634
+ const imports = [
1635
+ ...filtered ? ['import { useState } from "react";', ""] : [],
1636
+ `import { Mountaya${requireSessionToken ? ", SessionTokenEngine" : ""} } from "@mountaya/client/browser";`,
1637
+ ...french ? ['import { frElementsStrings } from "@mountaya/elements/i18n/fr";'] : [],
1638
+ ...imperial ? ['import { defaultUnits, type UnitFormatOptions } from "@mountaya/elements/profile";'] : [],
1639
+ `import { ${element} } from "@mountaya/elements-react/elements";`,
1640
+ 'import { MountayaElementsProvider } from "@mountaya/elements-react/headless";'
1641
+ ];
1642
+ const credential = requireSessionToken ? `{ publishableKey: ${codeString(input.publishableKey)}, sessionToken: session }` : `{ publishableKey: ${codeString(input.publishableKey)} }`;
1643
+ const units = imperial ? [
1644
+ `const units: UnitFormatOptions = { ...defaultUnits, ${input.language === "en" ? "" : `language: ${codeString(input.language)}, `}length: "imperial" };`,
1645
+ ""
1646
+ ] : [];
1647
+ const formatter = formatsInstants ? [
1648
+ "// A cut-off is written in the visitor's own time zone: state `timeZone` to write it in",
1649
+ "// your event's instead.",
1650
+ "const formatCutoffAt = (instant: Date): string =>",
1651
+ ` new Intl.DateTimeFormat(${codeString(input.language)}, { dateStyle: "medium", timeStyle: "short" }).format(instant);`,
1652
+ ""
1653
+ ] : [];
1654
+ const provider = french ? [
1655
+ "<MountayaElementsProvider",
1656
+ " client={client}",
1657
+ ' language="fr"',
1658
+ " translations={{ fr: frElementsStrings }}",
1659
+ ">"
1660
+ ] : input.language === "en" ? ["<MountayaElementsProvider client={client}>"] : [`<MountayaElementsProvider client={client} ${attribute("language", input.language)}>`];
1661
+ const props = [
1662
+ ...statesColumns ? [`columns={[${input.columns.map(codeString).join(", ")}]}`] : [],
1663
+ ...filtered ? ["filter={filter}"] : [],
1664
+ ...formatsInstants ? ["formatCutoffAt={formatCutoffAt}"] : [],
1665
+ attribute("itineraryId", input.itineraryId),
1666
+ ...filtered ? ["onFilterChange={setFilter}"] : [],
1667
+ 'surface="published"',
1668
+ ...imperial ? ["units={units}"] : []
1669
+ ];
1670
+ const tree = [
1671
+ ...provider,
1672
+ ...props.length <= 2 ? [` <${element} ${props.join(" ")} />`] : [` <${element}`, ...props.map((prop) => ` ${prop}`), " />"],
1673
+ "</MountayaElementsProvider>"
1674
+ ];
1675
+ const component = filtered ? [
1676
+ `export const ${wrapper} = () => {`,
1677
+ " // Controlled, so the chosen services can live in a URL. Several at once keep the",
1678
+ " // waypoints that offer all of them.",
1679
+ " const [filter, setFilter] = useState<readonly string[]>([]);",
1680
+ "",
1681
+ " return (",
1682
+ ...tree.map((line) => ` ${line}`),
1683
+ " );",
1684
+ "};"
1685
+ ] : [`export const ${wrapper} = () => (`, ...tree.map((line) => ` ${line}`), ");"];
1686
+ return [
1687
+ 'import "@mountaya/elements-react/styles.css";',
1688
+ "",
1689
+ ...imports,
1690
+ "",
1691
+ ...requireSessionToken ? sessionLines(input.sessionEndpoint ?? EMBED_SESSION_ENDPOINT) : [],
1692
+ "const client = new Mountaya({",
1693
+ ` credential: ${credential},`,
1694
+ "});",
1695
+ "",
1696
+ ...units,
1697
+ ...formatter,
1698
+ ...component
1699
+ ].join("\n");
1700
+ };
1701
+
1702
+ // src/itinerary/rules/ceiling.ts
1703
+ var itineraryCeiling = (limit, count) => {
1704
+ if (limit === null || !Number.isFinite(limit) || limit < 0) {
1705
+ return { full: false, limit: null };
1706
+ }
1707
+ return { full: count >= limit, limit };
1708
+ };
1709
+ var firstSegmentEditInput = (activity, segmentId, random) => ({
1710
+ activitySlug: activity?.slug ?? void 0,
1711
+ color: style.pickLivelyColor(null, void 0, random),
1712
+ mode: chunkEKZWV6RS_cjs.defaultEngineForActivity(activity?.capabilities),
1713
+ name: chunkOQSYFH3Z_cjs.defaultSegmentName(0),
1714
+ segmentId
1715
+ });
1716
+ var createFormChanged = (state) => state.name.trim() !== state.seededName.trim() || state.activityId !== null && state.activityId !== state.defaultActivityId || state.organizationId !== null && state.organizationId !== state.defaultOrganizationId || state.collectionIds.length > 0;
1717
+
1718
+ // src/itinerary/rules/view.ts
1719
+ var persistedItineraryView = (itinerary) => ({
1720
+ mode: "persisted",
1721
+ source: {
1722
+ activity_id: itinerary.activity_id,
1723
+ id: itinerary.id,
1724
+ segments: itinerary.segments,
1725
+ waypoints: itinerary.waypoints
1726
+ }
1727
+ });
1728
+
1729
+ // src/itinerary/rules/editorView.ts
1730
+ var emptyEditorView = Object.freeze({
1731
+ mode: "persisted",
1732
+ source: Object.freeze({ activity_id: null, id: null, segments: [], waypoints: [] })
1733
+ });
1734
+ var editorItineraryView = (sources) => {
1735
+ const { draft, itinerary, selectedCandidate: selectedCandidate2, suggestSurfaceShows } = sources;
1736
+ if (draft !== null) {
1737
+ return { mode: "preview", source: chunkOQSYFH3Z_cjs.draftToView(draft) };
1738
+ }
1739
+ if (selectedCandidate2 !== null && suggestSurfaceShows) {
1740
+ return { mode: "preview", source: chunkOQSYFH3Z_cjs.suggestionCandidateToView(selectedCandidate2) };
1741
+ }
1742
+ return itinerary === null ? emptyEditorView : persistedItineraryView(itinerary);
1743
+ };
1744
+
1745
+ // src/itinerary/rules/friendlyName.ts
1746
+ var pick = (items, random) => {
1747
+ const index = Math.floor(random() * items.length);
1748
+ const clamped = Number.isFinite(index) ? Math.min(Math.max(index, 0), items.length - 1) : 0;
1749
+ return items[clamped] ?? "";
1750
+ };
1751
+ var generateFriendlyName = (copy, random) => {
1752
+ const adjective = pick(copy.nameAdjectives, random);
1753
+ const noun = pick(copy.nameNouns, random);
1754
+ if (adjective === "" || noun === "") {
1755
+ return `${adjective}${noun}`;
1756
+ }
1757
+ return copy.friendlyName(adjective, noun);
1758
+ };
1759
+ var IMPORT_FILE_MAX_SIZE = units.convertDataSize(20, "megabyte", "byte");
1760
+ var IMPORT_FILE_FORMATS = [
1761
+ { extension: ".gpx", mimeTypes: ["application/gpx+xml"], provider: "gpx" },
1762
+ {
1763
+ extension: ".geojson",
1764
+ mimeTypes: ["application/geo+json", "application/json"],
1765
+ provider: "geojson"
1766
+ },
1767
+ {
1768
+ extension: ".kml",
1769
+ mimeTypes: ["application/vnd.google-earth.kml+xml", "text/xml"],
1770
+ provider: "kml"
1771
+ },
1772
+ {
1773
+ extension: ".kmz",
1774
+ mimeTypes: [
1775
+ "application/vnd.google-earth.kmz",
1776
+ "application/zip",
1777
+ "application/x-zip-compressed"
1778
+ ],
1779
+ provider: "kmz"
1780
+ },
1781
+ {
1782
+ extension: ".fit",
1783
+ mimeTypes: ["application/vnd.ant.fit", "application/octet-stream"],
1784
+ provider: "fit"
1785
+ },
1786
+ {
1787
+ extension: ".tcx",
1788
+ mimeTypes: ["application/vnd.garmin.tcx+xml", "application/xml"],
1789
+ provider: "tcx"
1790
+ }
1791
+ ];
1792
+ IMPORT_FILE_FORMATS.map((format) => format.extension);
1793
+ var importDropzoneAccept = IMPORT_FILE_FORMATS.reduce((accept, format) => {
1794
+ for (const mimeType of format.mimeTypes) {
1795
+ accept[mimeType] = [...accept[mimeType] ?? [], format.extension];
1796
+ }
1797
+ return accept;
1798
+ }, {});
1799
+ var fileProviderByExtension = new Map(
1800
+ IMPORT_FILE_FORMATS.map((format) => [format.extension, format.provider])
1801
+ );
1802
+ var detectFileProvider = (fileName) => {
1803
+ const lowered = fileName.toLowerCase();
1804
+ for (const [extension, provider] of fileProviderByExtension) {
1805
+ if (lowered.endsWith(extension)) {
1806
+ return provider;
1807
+ }
1808
+ }
1809
+ return null;
1810
+ };
1811
+
1812
+ // src/itinerary/rules/importTotals.ts
1813
+ var EMPTY_SEGMENTS = Object.freeze([]);
1814
+ var importSegmentCounts = (segments) => {
1815
+ let routable = 0;
1816
+ let snapped = 0;
1817
+ for (const segment of segments) {
1818
+ if (segment.directions === null) {
1819
+ continue;
1820
+ }
1821
+ routable += 1;
1822
+ if (segment.mode === "directions") {
1823
+ snapped += 1;
1824
+ }
1825
+ }
1826
+ return {
1827
+ exact: segments.length - snapped,
1828
+ routable,
1829
+ snapped,
1830
+ total: segments.length,
1831
+ unroutable: segments.length - routable
1832
+ };
1833
+ };
1834
+ var itinerarySpriteIcons = (itinerary) => {
1835
+ const [startIcon, endIcon] = layers.ITINERARY_ENDPOINT_ICONS;
1836
+ const icons = [];
1837
+ for (const waypoint of itinerary.waypoints ?? []) {
1838
+ if (waypoint.icon && waypoint.color) {
1839
+ icons.push({ color: waypoint.color, icon: waypoint.icon });
1840
+ }
1841
+ }
1842
+ for (const segment of itinerary.segments ?? []) {
1843
+ if (segment.color) {
1844
+ icons.push(
1845
+ { color: segment.color, icon: startIcon },
1846
+ { color: segment.color, icon: endIcon }
1847
+ );
1848
+ }
1849
+ }
1850
+ return icons;
1851
+ };
1852
+ var itineraryEmphasisFor = (selection, itinerary) => {
1853
+ if (selection !== null) {
1854
+ return { id: selection.id, mode: selection.kind };
1855
+ }
1856
+ return itinerary === null ? { mode: "none" } : { id: itinerary.id, mode: "itinerary" };
1857
+ };
1858
+ var chosenAndOther = (segment) => {
1859
+ const chosen = chunkOQSYFH3Z_cjs.chosenCandidate(segment);
1860
+ const other = chosen === segment.linestring ? segment.directions : segment.linestring;
1861
+ return { chosen: chosen.geojson, other: other?.geojson ?? null };
1862
+ };
1863
+ var [DRAFT_START_ICON, DRAFT_END_ICON] = layers.ITINERARY_ENDPOINT_ICONS;
1864
+ var endpointMarkers = (draft, active) => chainEndpointMarkers(
1865
+ draft.segments.map((segment) => ({
1866
+ color: segment.color,
1867
+ geometry: chosenAndOther(segment).chosen,
1868
+ id: segment.id
1869
+ })),
1870
+ active
1871
+ );
1872
+ var chainEndpointMarkers = (chain, active) => {
1873
+ const first = chain[0];
1874
+ const last = chain[chain.length - 1];
1875
+ if (!first || !last) {
1876
+ return [];
1877
+ }
1878
+ const markers = [];
1879
+ if (first.id !== active.segmentId) {
1880
+ const head = chunkCJDIFRGZ_cjs.lngLatOf(geo.extractLines(first.geometry)[0]?.coordinates[0]);
1881
+ if (head) {
1882
+ markers.push({ color: first.color, icon: DRAFT_START_ICON, lngLat: head });
1883
+ }
1884
+ }
1885
+ if (last.id !== active.segmentId) {
1886
+ const tail = chunkCJDIFRGZ_cjs.lngLatOf(geo.extractLines(last.geometry).at(-1)?.coordinates.at(-1));
1887
+ if (tail) {
1888
+ markers.push({ color: last.color, icon: DRAFT_END_ICON, lngLat: tail });
1889
+ }
1890
+ }
1891
+ return markers;
1892
+ };
1893
+ var draftToPreviewRender = (glyphs, draft, active) => {
1894
+ const lines = [];
1895
+ for (const segment of draft.segments) {
1896
+ if (segment.id === active.segmentId) {
1897
+ continue;
1898
+ }
1899
+ const { chosen, other } = chosenAndOther(segment);
1900
+ for (const line of geo.extractLines(chosen)) {
1901
+ lines.push({ color: segment.color, coordinates: line.coordinates, dashed: false });
1902
+ }
1903
+ if (other) {
1904
+ for (const line of geo.extractLines(other)) {
1905
+ lines.push({ color: segment.color, coordinates: line.coordinates, dashed: true });
1906
+ }
1907
+ }
1908
+ }
1909
+ const waypoints = [];
1910
+ for (const waypoint of draft.waypoints) {
1911
+ if (waypoint.id === active.waypointId) {
1912
+ continue;
1913
+ }
1914
+ const lngLat = chunkCJDIFRGZ_cjs.lngLatOf(geo.extractPoint(waypoint.geojson)?.coordinates);
1915
+ if (!lngLat) {
1916
+ continue;
1917
+ }
1918
+ waypoints.push({
1919
+ // The draft carries no per-waypoint color, so fall back to the ONE default tint:
1920
+ // the same hex the tile builder coalesces to when a waypoint names none, so the
1921
+ // overlay marker and the tile marker for the same point are one colour. A null icon
1922
+ // falls back to the generic pin glyph, matching the persisted render.
1923
+ color: icons.DEFAULT_WAYPOINT_COLOR,
1924
+ icon: waypoint.icon ?? glyphs.WAYPOINT_FALLBACK_ICON,
1925
+ lngLat
1926
+ });
1927
+ }
1928
+ waypoints.push(...endpointMarkers(draft, active));
1929
+ return { lines, waypoints };
1930
+ };
1931
+ var itineraryToPreviewRender = (glyphs, itinerary, active) => {
1932
+ const chain = (itinerary.segments ?? []).map((segment) => ({
1933
+ color: segment.color ?? style.DEFAULT_SEGMENT_COLOR,
1934
+ geometry: segment.geojson,
1935
+ id: segment.id
1936
+ }));
1937
+ const lines = [];
1938
+ for (const segment of chain) {
1939
+ if (segment.id === active.segmentId) {
1940
+ continue;
1941
+ }
1942
+ for (const line of geo.extractLines(segment.geometry)) {
1943
+ lines.push({ color: segment.color, coordinates: line.coordinates, dashed: false });
1944
+ }
1945
+ }
1946
+ const waypoints = [];
1947
+ for (const waypoint of itinerary.waypoints ?? []) {
1948
+ if (waypoint.id === active.waypointId) {
1949
+ continue;
1950
+ }
1951
+ const lngLat = chunkCJDIFRGZ_cjs.lngLatOf(geo.extractPoint(waypoint.geojson)?.coordinates);
1952
+ if (!lngLat) {
1953
+ continue;
1954
+ }
1955
+ waypoints.push({
1956
+ // Its own colour, unlike a draft's: a persisted waypoint has one, and the fallback is the
1957
+ // hex the tile builder coalesces to so the overlay marker and the tile marker for the same
1958
+ // point are one colour.
1959
+ color: waypoint.color ?? icons.DEFAULT_WAYPOINT_COLOR,
1960
+ icon: waypoint.icon ?? glyphs.WAYPOINT_FALLBACK_ICON,
1961
+ lngLat
1962
+ });
1963
+ }
1964
+ waypoints.push(...chainEndpointMarkers(chain, active));
1965
+ return { lines, waypoints };
1966
+ };
1967
+ var itineraryExclusions = (itinerary) => ({
1968
+ segmentIds: (itinerary.segments ?? []).map((segment) => segment.id),
1969
+ waypointIds: (itinerary.waypoints ?? []).map((waypoint) => waypoint.id)
1970
+ });
1971
+ var draftGeometries = (draft) => {
1972
+ const geometries = [];
1973
+ for (const segment of draft.segments) {
1974
+ geometries.push(chosenAndOther(segment).chosen);
1975
+ }
1976
+ for (const waypoint of draft.waypoints) {
1977
+ geometries.push(waypoint.geojson);
1978
+ }
1979
+ return geometries;
1980
+ };
1981
+ var zoneBandsToPreviewRender = (glyphs, preview) => {
1982
+ const color = layers.zoneLevelColors[preview.level];
1983
+ const lines = [];
1984
+ for (const band of preview.bands) {
1985
+ for (const ring of band.geometry.coordinates) {
1986
+ lines.push({ color, coordinates: ring, dashed: false });
1987
+ }
1988
+ }
1989
+ const waypoints = preview.origin ? [
1990
+ {
1991
+ color,
1992
+ icon: glyphs.activityMarkerIcon(preview.activity) ?? glyphs.WAYPOINT_FALLBACK_ICON,
1993
+ lngLat: preview.origin
1994
+ }
1995
+ ] : [];
1996
+ return { lines, waypoints };
1997
+ };
1998
+
1999
+ // src/layers/rules/reachabilityIcon.ts
2000
+ var REACHABILITY_GLYPH = "reachability";
2001
+ var MIN_VALUE_KEY = "minValue";
2002
+ var MAX_VALUE_KEY = "maxValue";
2003
+ var overlayReadouts = {
2004
+ humidity: { format: profile.formatHumidity, glyph: "datum-humidity" },
2005
+ snowdepth: { format: profile.formatSnowDepth, glyph: "datum-snow-depth" },
2006
+ "snowfall-daily": { format: profile.formatSnowfall, glyph: "datum-snowfall" },
2007
+ "snowfall-hourly": { format: profile.formatSnowfall, glyph: "datum-snowfall" },
2008
+ "temperature-actual": { format: profile.formatTemperature, glyph: "datum-temperature" },
2009
+ "temperature-perceived": { format: profile.formatTemperature, glyph: "datum-temperature" },
2010
+ "temperature-soil": { format: profile.formatTemperature, glyph: "datum-temperature" },
2011
+ visibility: { format: profile.formatDistance, glyph: "datum-visibility" },
2012
+ wind: {
2013
+ format: (value, options) => profile.formatSpeed(value, { ...options, pace: "per-time" }),
2014
+ glyph: "datum-wind"
2015
+ }
2016
+ };
2017
+ var overlayReadoutFor = (slug) => (
2018
+ // An own member alone: a slug is a free string, and `constructor` names what every object
2019
+ // inherits, which is no readout.
2020
+ slug && Object.hasOwn(overlayReadouts, slug) ? overlayReadouts[slug] ?? null : null
2021
+ );
2022
+ var extractOverlayBand = (features) => {
2023
+ for (const feature of features) {
2024
+ const min = feature[MIN_VALUE_KEY];
2025
+ const max = feature[MAX_VALUE_KEY];
2026
+ const hasMin = typeof min === "number" && Number.isFinite(min);
2027
+ const hasMax = typeof max === "number" && Number.isFinite(max);
2028
+ if (hasMin || hasMax) {
2029
+ return { max: hasMax ? max : null, min: hasMin ? min : null };
2030
+ }
2031
+ }
2032
+ return null;
2033
+ };
2034
+
2035
+ // src/map/rules/baseTerrain.ts
2036
+ var resolveBaseTerrain = (terrains, slug, variant, demUrl) => {
2037
+ const terrain = terrains.find((candidate) => candidate.slug === slug) ?? terrains[0];
2038
+ if (!terrain) {
2039
+ return null;
2040
+ }
2041
+ const tint = terrain.variants[variant] ?? terrain.variants.light ?? terrain.variants.dark;
2042
+ if (!tint) {
2043
+ return null;
2044
+ }
2045
+ const config = { styleUrl: tint.style.url };
2046
+ if (demUrl) {
2047
+ config.demUrl = demUrl;
2048
+ }
2049
+ return config;
2050
+ };
2051
+ var attributeOf = (hit, name) => {
2052
+ const value = hit.properties[name];
2053
+ return typeof value === "string" && value !== "" ? value : null;
2054
+ };
2055
+ var itineraryTileFeature = (hit) => {
2056
+ const waypointId = attributeOf(hit, "waypoint_id");
2057
+ if (waypointId !== null) {
2058
+ return { id: waypointId, kind: "waypoint" };
2059
+ }
2060
+ const segmentId = attributeOf(hit, "segment_id");
2061
+ return segmentId === null ? null : { id: segmentId, kind: "segment" };
2062
+ };
2063
+ var drawnByItinerary = (hit) => attributeOf(hit, "itinerary_id") !== null || itineraryTileFeature(hit) !== null;
2064
+ var itineraryLayerIdsOf = (sources) => {
2065
+ const lines = [];
2066
+ const points = [];
2067
+ const icons = [];
2068
+ for (const source of sources) {
2069
+ for (const layer of source.layers) {
2070
+ if (layer.source_layer === layers.ITINERARY_LINE_SOURCE_LAYER) {
2071
+ lines.push(layer.id);
2072
+ } else if (layer.source_layer === layers.ITINERARY_POINT_SOURCE_LAYER) {
2073
+ points.push(layer.id);
2074
+ }
2075
+ }
2076
+ const icon = layers.roadAccessIconLayerIdOf(source);
2077
+ if (icon !== null) {
2078
+ icons.push(icon);
2079
+ }
2080
+ }
2081
+ return [...lines, ...points, ...icons];
2082
+ };
2083
+ var roadAccessStretchOf = (hit) => {
2084
+ if (hit.sourceLayer !== layers.ITINERARY_RESTRICTION_SOURCE_LAYER) {
2085
+ return null;
2086
+ }
2087
+ const segmentId = attributeOf(hit, "segment_id");
2088
+ const itineraryId = attributeOf(hit, "itinerary_id");
2089
+ if (segmentId === null || itineraryId === null) {
2090
+ return null;
2091
+ }
2092
+ const stated = hit.properties.kind;
2093
+ const kind = data.ROAD_ACCESS_KINDS.find((known) => known === stated) ?? "restricted";
2094
+ return { itineraryId, kind, segmentId };
2095
+ };
2096
+ var itineraryClickTarget = (kind, hit, state, readOnly) => {
2097
+ const itinerary = state.activeItinerary;
2098
+ const feature = itineraryTileFeature(hit);
2099
+ const ofTheOpenItinerary = itinerary !== null && hit.properties.itinerary_id === itinerary.id;
2100
+ if (kind !== "itinerary" && !readOnly && !ofTheOpenItinerary) {
2101
+ return null;
2102
+ }
2103
+ if (kind === "roadAccess") {
2104
+ const stretch = roadAccessStretchOf(hit);
2105
+ return stretch === null ? null : { kind, stretch };
2106
+ }
2107
+ if (kind === "segment") {
2108
+ if (feature?.kind !== "segment") {
2109
+ return null;
2110
+ }
2111
+ const segmentId = feature.id;
2112
+ const editable = !readOnly && itinerary !== null && itinerary.segments.some((segment) => segment.id === segmentId) && hit.sourceLayer !== layers.ITINERARY_RESTRICTION_SOURCE_LAYER && chunkCJDIFRGZ_cjs.showingDraftSurface(state) === null && !state.agentDriving && state.segmentSplitPick === null && state.collabByResource[chunkOQSYFH3Z_cjs.collabResourceKey({ id: itinerary.id, kind: "itineraries" })]?.locks[chunkOQSYFH3Z_cjs.collabLockKey("segment", segmentId)] === void 0;
2113
+ return { edit: editable, kind, segmentId };
2114
+ }
2115
+ if (kind === "waypoint") {
2116
+ return feature?.kind === "waypoint" ? {
2117
+ details: ofTheOpenItinerary,
2118
+ kind,
2119
+ waypointId: feature.id
2120
+ } : null;
2121
+ }
2122
+ const itineraryId = hit.properties.itinerary_id;
2123
+ if (readOnly || typeof itineraryId !== "string" || itineraryId.length === 0) {
2124
+ return null;
2125
+ }
2126
+ return itinerary?.id === itineraryId ? null : { itineraryId, kind };
2127
+ };
2128
+ var zoneClickTarget = (hit, activeZone, userId, writableOrganizationIds) => {
2129
+ const zoneId = hit.properties.id ?? hit.id;
2130
+ if (typeof zoneId !== "string" || !chunkCJDIFRGZ_cjs.hasUuidShape(zoneId)) {
2131
+ return null;
2132
+ }
2133
+ if (activeZone?.id === zoneId) {
2134
+ const geometry = activeZone.geojson.geometry;
2135
+ const editable2 = chunkEKZWV6RS_cjs.canEditOwnedResource(
2136
+ { createdById: activeZone.created_by.id, organizationId: activeZone.organization_id },
2137
+ userId,
2138
+ writableOrganizationIds
2139
+ );
2140
+ if (!editable2 || geometry.type !== "Polygon" || activeZone.source) {
2141
+ return null;
2142
+ }
2143
+ return {
2144
+ input: {
2145
+ intent: "edit",
2146
+ level: activeZone.level,
2147
+ mode: activeZone.mode,
2148
+ seedGeometry: geometry,
2149
+ zoneId
2150
+ },
2151
+ kind: "reshape"
2152
+ };
2153
+ }
2154
+ const createdBy = hit.properties.created_by;
2155
+ const organizationId = hit.properties.organization_id;
2156
+ const editable = chunkEKZWV6RS_cjs.canEditOwnedResource(
2157
+ {
2158
+ createdById: typeof createdBy === "string" ? createdBy : null,
2159
+ organizationId: typeof organizationId === "string" ? organizationId : null
2160
+ },
2161
+ userId,
2162
+ writableOrganizationIds
2163
+ );
2164
+ return { kind: editable ? "edit" : "view", zoneId };
2165
+ };
2166
+ var mapInteractionScope = (state) => {
2167
+ if (state.segmentEditSession !== null || state.waypointEditSession !== null || state.zoneEditSession !== null) {
2168
+ return "locked";
2169
+ }
2170
+ if (state.activeZone !== null) {
2171
+ return "zone";
2172
+ }
2173
+ return state.activeItinerary === null ? "free" : "itinerary";
2174
+ };
2175
+
2176
+ // src/map/rules/contextMenuReadout.ts
2177
+ var READOUT_KEYS = ["elevation", "slope", "aspect", "steepness_class"];
2178
+ var contextMenuReadout = (features) => {
2179
+ const rows = [];
2180
+ for (const key of READOUT_KEYS) {
2181
+ const value = features.find((feature) => feature[key] != null)?.[key];
2182
+ if (value != null) {
2183
+ rows.push({ key, value });
2184
+ }
2185
+ }
2186
+ return rows;
2187
+ };
2188
+ var SUGGESTION_PREVIEW_COLOR = "#228be6";
2189
+ var SUGGESTION_START_ICON = layers.ITINERARY_ENDPOINT_ICONS[0];
2190
+ var SUGGESTION_END_ICON = layers.ITINERARY_ENDPOINT_ICONS[1];
2191
+ var suggestionPreviewRender = (inputs) => {
2192
+ const { candidates, end, routeType, selectedSeed, start } = inputs;
2193
+ const candidate = selectedSeed === null ? null : candidates.find((entry) => entry.seed === selectedSeed) ?? null;
2194
+ const lines = candidate ? geo.extractLines(candidate.geometry).map((line) => ({
2195
+ color: candidate.color,
2196
+ coordinates: line.coordinates,
2197
+ dashed: false
2198
+ })) : [];
2199
+ const waypoints = [];
2200
+ if (start) {
2201
+ waypoints.push({ color: SUGGESTION_PREVIEW_COLOR, icon: SUGGESTION_START_ICON, lngLat: start });
2202
+ }
2203
+ if (routeType === "point_to_point" && end) {
2204
+ waypoints.push({ color: SUGGESTION_PREVIEW_COLOR, icon: SUGGESTION_END_ICON, lngLat: end });
2205
+ }
2206
+ return { lines, waypoints };
2207
+ };
2208
+ var previewProjection = (glyphs, input) => {
2209
+ const { activeItinerary, draft, suggestion, tiled, zonePreview } = input;
2210
+ const editing = { segmentId: input.editSegmentId, waypointId: input.editWaypointId };
2211
+ if (zonePreview && zonePreview.bands.length > 0) {
2212
+ return {
2213
+ draft: null,
2214
+ exclusions: null,
2215
+ render: zoneBandsToPreviewRender(glyphs, zonePreview)
2216
+ };
2217
+ }
2218
+ if (draft && (draft.segments.length > 0 || draft.waypoints.length > 0)) {
2219
+ return { draft, exclusions: null, render: draftToPreviewRender(glyphs, draft, editing) };
2220
+ }
2221
+ if (suggestion) {
2222
+ const render = suggestionPreviewRender(suggestion);
2223
+ if (render.lines.length > 0 || render.waypoints.length > 0) {
2224
+ return { draft: null, exclusions: null, render };
2225
+ }
2226
+ }
2227
+ if (!tiled && activeItinerary) {
2228
+ return {
2229
+ draft: null,
2230
+ exclusions: itineraryExclusions(activeItinerary),
2231
+ render: itineraryToPreviewRender(glyphs, activeItinerary, editing)
2232
+ };
2233
+ }
2234
+ return { draft: null, exclusions: null, render: null };
2235
+ };
2236
+ var peerDraftGhosts = (input) => {
2237
+ const present = new Set(input.presentPeerIds);
2238
+ const ghosts = [];
2239
+ for (const [key, draft] of Object.entries(input.drafts)) {
2240
+ if (!present.has(draft.userId)) {
2241
+ continue;
2242
+ }
2243
+ const color = chunkOQSYFH3Z_cjs.collabPeerColor(draft.userId);
2244
+ const label = input.resolveName?.(draft.userId) ?? collab.peerDraftInitials(draft.userId);
2245
+ if (draft.kind === "segment") {
2246
+ if (draft.segment.id === input.localSegmentEditId) {
2247
+ continue;
2248
+ }
2249
+ const line = geo.extractLines(draft.segment.geojson).find(
2250
+ (candidate) => candidate.coordinates.length >= 2
2251
+ );
2252
+ if (!line) {
2253
+ continue;
2254
+ }
2255
+ ghosts.push({
2256
+ color,
2257
+ entity: { id: draft.segment.id, kind: "segment" },
2258
+ geometry: line,
2259
+ key,
2260
+ label
2261
+ });
2262
+ continue;
2263
+ }
2264
+ const zoneId = key.slice(key.indexOf("/") + 1);
2265
+ if (zoneId === input.localZoneEditId) {
2266
+ continue;
2267
+ }
2268
+ ghosts.push({
2269
+ color,
2270
+ entity: { id: zoneId, kind: "zone" },
2271
+ geometry: draft.zone,
2272
+ key,
2273
+ label
2274
+ });
2275
+ }
2276
+ return ghosts;
2277
+ };
2278
+ var permittedEnrichmentOverlays = (layers$1, activeEnrichments, overlaysEntitled, poisEntitled) => [...new Set(activeEnrichments)].flatMap((slug) => {
2279
+ if (!(slug === chunkCJDIFRGZ_cjs.POIS_OVERLAY_SLUG ? poisEntitled : overlaysEntitled)) {
2280
+ return [];
2281
+ }
2282
+ const overlay = layers.findOverlay({ overlays: layers$1.overlays ?? [] }, slug);
2283
+ return overlay === null ? [] : [overlay];
2284
+ });
2285
+ var permittedClassicOverlay = (layers$1, activeOverlay, overlaysEntitled) => overlaysEntitled && activeOverlay !== null ? layers.findOverlay({ overlays: layers$1.overlays ?? [] }, activeOverlay) : null;
2286
+ var poiGroupByLayerKey = new Map(
2287
+ chunkOQSYFH3Z_cjs.POI_GROUPS.flatMap((group) => group.layerKeys.map((key) => [key, group.id]))
2288
+ );
2289
+ var poiLayerVisibility = (layers$1, activePoiGroups) => {
2290
+ const overlay = layers.findOverlay({ overlays: layers$1.overlays ?? [] }, chunkCJDIFRGZ_cjs.POIS_OVERLAY_SLUG);
2291
+ if (!overlay) {
2292
+ return [];
2293
+ }
2294
+ const active = new Set(activePoiGroups);
2295
+ return overlay.sources.flatMap(
2296
+ (source) => source.layers.map((layer) => {
2297
+ const group = poiGroupByLayerKey.get(layer.key);
2298
+ return { layerId: layer.id, visible: group === void 0 || active.has(group) };
2299
+ })
2300
+ );
2301
+ };
2302
+ var ZONE_TIME_REFERENCE_INTERVAL_MS = /* @__PURE__ */ units.convertDuration(
2303
+ 1,
2304
+ "minute",
2305
+ "millisecond"
2306
+ );
2307
+ var zoneTimeReferenceSeconds = (overlayTimestamp, nowMs) => {
2308
+ const pinnedMs = overlayTimestamp ? new Date(overlayTimestamp).getTime() : Number.NaN;
2309
+ if (!Number.isNaN(pinnedMs)) {
2310
+ return Math.floor(units.convertDuration(pinnedMs, "millisecond", "second"));
2311
+ }
2312
+ const intervalStartMs = Math.floor(nowMs / ZONE_TIME_REFERENCE_INTERVAL_MS) * ZONE_TIME_REFERENCE_INTERVAL_MS;
2313
+ return units.convertDuration(intervalStartMs, "millisecond", "second");
2314
+ };
2315
+ var activeSegmentLines = (itinerary) => (itinerary?.segments ?? []).flatMap(
2316
+ (segment) => geo.extractLines(segment.geojson).map((line) => line.coordinates)
2317
+ );
2318
+ var resolveDemUrl = (layers, demUrl) => demUrl || layers?.elevation?.url || void 0;
2319
+ var SEARCH_REFUSED_NAME = "SearchRefusedError";
2320
+ var SearchRefusedError = class extends errors.MountayaElementsError {
2321
+ name = SEARCH_REFUSED_NAME;
2322
+ /** The refusal's machine-readable code, or undefined for a refusal that carried none. */
2323
+ code;
2324
+ /**
2325
+ * The server's own sentence for the refusal, already in the reader's language, or undefined
2326
+ * where the refusal carried none.
2327
+ */
2328
+ detail;
2329
+ constructor(refusal) {
2330
+ super(refusal.error);
2331
+ this.code = refusal.code;
2332
+ this.detail = refusal.detail;
2333
+ }
2334
+ };
2335
+ var targetFlags = {
2336
+ collections: true,
2337
+ itineraries: true,
2338
+ places: true,
2339
+ pois: true,
2340
+ ways: true,
2341
+ zones: true
2342
+ };
2343
+ var isTargetName = (name) => Object.hasOwn(targetFlags, name);
2344
+ var enabledTarget = (targets) => Object.keys(targetFlags).find(
2345
+ (name) => isTargetName(name) && targets[name] === true
2346
+ );
2347
+ var createSearchFetch = (dispatch) => async (input) => {
2348
+ const target = enabledTarget(input.targets);
2349
+ if (target === void 0) {
2350
+ throw new errors.MountayaElementsError("no search target requested");
2351
+ }
2352
+ const result = await dispatch("studio.search.run", {
2353
+ // The wire types the coordinates as an open number[] and the tool takes fixed tuples, so a
2354
+ // pair of the wrong length or with a non-finite member is dropped here and the round runs
2355
+ // unscoped: the boundary would otherwise reject a shape the caller cannot fix.
2356
+ bbox: geo.boundsTuple(input.bbox),
2357
+ focus: geo.pointTuple(input.focus),
2358
+ language: input.language ?? void 0,
2359
+ limit: input.limit ?? void 0,
2360
+ query: input.query,
2361
+ target
2362
+ });
2363
+ if (!result.ok) {
2364
+ throw new SearchRefusedError(result);
2365
+ }
2366
+ return result.data;
2367
+ };
2368
+ var buildSegmentChainMerges = (segments, lockedSegmentIds = /* @__PURE__ */ new Set()) => {
2369
+ const byAbsorber = /* @__PURE__ */ new Map();
2370
+ const byFolded = /* @__PURE__ */ new Map();
2371
+ for (let index = 1; index < segments.length; index += 1) {
2372
+ const previous = segments[index - 1];
2373
+ const segment = segments[index];
2374
+ if (!previous || !segment) {
2375
+ continue;
2376
+ }
2377
+ let disabledReason = null;
2378
+ if (previous.mode !== segment.mode) {
2379
+ disabledReason = "engine";
2380
+ } else if (previous.group_id !== segment.group_id) {
2381
+ disabledReason = "group";
2382
+ } else if (chunkCJDIFRGZ_cjs.exceedsMergeViaCeiling(previous, segment)) {
2383
+ disabledReason = "waypointsMax";
2384
+ } else if (lockedSegmentIds.has(previous.id) || lockedSegmentIds.has(segment.id)) {
2385
+ disabledReason = "locked";
2386
+ }
2387
+ const merge = {
2388
+ disabledReason,
2389
+ intoSegmentId: segment.id,
2390
+ segmentId: previous.id
2391
+ };
2392
+ byFolded.set(previous.id, merge);
2393
+ byAbsorber.set(segment.id, merge);
2394
+ }
2395
+ return { byAbsorber, byFolded };
2396
+ };
2397
+ var segmentChainEnds = (segments) => ({
2398
+ committedIds: new Set(segments.map((segment) => segment.id)),
2399
+ firstCommittedId: segments[0]?.id ?? null,
2400
+ lastCommittedId: segments.at(-1)?.id ?? null
2401
+ });
2402
+ var buildSegmentGroupRuns = (segments, groups) => {
2403
+ const byId = new Map(groups.map((group) => [group.id, group]));
2404
+ const memberCounts = /* @__PURE__ */ new Map();
2405
+ for (const segment of segments) {
2406
+ if (segment.group_id !== null) {
2407
+ memberCounts.set(segment.group_id, (memberCounts.get(segment.group_id) ?? 0) + 1);
2408
+ }
2409
+ }
2410
+ const groupOf = (segment) => segment.group_id === null ? null : byId.get(segment.group_id) ?? null;
2411
+ const runs = /* @__PURE__ */ new Map();
2412
+ segments.forEach((segment, index) => {
2413
+ const group = groupOf(segment);
2414
+ const previous = segments[index - 1];
2415
+ const next = segments[index + 1];
2416
+ runs.set(segment.id, {
2417
+ group,
2418
+ hasFreeNeighbour: previous !== void 0 && groupOf(previous) === null || next !== void 0 && groupOf(next) === null,
2419
+ isFirst: group === null ? false : previous?.group_id !== group.id,
2420
+ isLast: group === null ? false : next?.group_id !== group.id,
2421
+ memberCount: group === null ? 0 : memberCounts.get(group.id) ?? 0
2422
+ });
2423
+ });
2424
+ return runs;
2425
+ };
2426
+ var segmentGroupDissolvesOnLeave = (memberCount) => memberCount - 1 < data.SEGMENT_GROUP_MIN_MEMBERS;
2427
+
2428
+ // src/segments/rules/commit.ts
2429
+ var buildSegmentEditCommitInput = ({
2430
+ coordinates,
2431
+ draftColor,
2432
+ draftName,
2433
+ itineraryId,
2434
+ mode,
2435
+ segmentId
2436
+ }) => {
2437
+ if (draftName !== null) {
2438
+ return mode === "directions" ? {
2439
+ color: draftColor ?? void 0,
2440
+ itineraryId,
2441
+ mode: "directions",
2442
+ name: draftName,
2443
+ vias: coordinates
2444
+ } : {
2445
+ color: draftColor ?? void 0,
2446
+ itineraryId,
2447
+ line: coordinates,
2448
+ mode: "linestring",
2449
+ name: draftName
2450
+ };
2451
+ }
2452
+ return mode === "directions" ? { itineraryId, mode: "directions", segmentId, vias: coordinates } : { itineraryId, line: coordinates, mode: "linestring", segmentId };
2453
+ };
2454
+ var draftSeed = (segment) => {
2455
+ if (segment.mode === "directions") {
2456
+ if (!segment.directions) {
2457
+ return null;
2458
+ }
2459
+ const vias = geo.extractVias(segment.directions.geojson);
2460
+ const rawSeed = vias.length > 0 ? vias : chunkEKZWV6RS_cjs.simplifyToVias(geo.segmentLineCoordinates(segment.directions.geojson), geo.DIRECTIONS_VIA_MAX);
2461
+ return rawSeed.length > 0 ? chunkEKZWV6RS_cjs.seedFromCoordinates(rawSeed) : null;
2462
+ }
2463
+ const line = geo.segmentLineCoordinates(segment.linestring.geojson);
2464
+ return line.length > 0 ? chunkEKZWV6RS_cjs.seedFromCoordinates(line) : null;
2465
+ };
2466
+ var beginDraftSegmentEdit = (dispatch, segment, anchor, activitySlug) => {
2467
+ const mode = segment.mode;
2468
+ const seed = draftSeed(segment);
2469
+ if (!seed) {
2470
+ return Promise.resolve(null);
2471
+ }
2472
+ const previousPin = anchor.previousEnd ? chunkEKZWV6RS_cjs.clampSeedPoint(anchor.previousEnd) : null;
2473
+ const pinnedStart = anchor.isFirst ? void 0 : previousPin ?? seed.pinnedStart;
2474
+ return dispatch("studio.itinerary.segment.editBegin", {
2475
+ activitySlug: activitySlug ?? void 0,
2476
+ color: chunkOQSYFH3Z_cjs.hexColorSchema.safeParse(segment.color).success ? segment.color : style.DEFAULT_SEGMENT_COLOR,
2477
+ mode,
2478
+ pinnedStart,
2479
+ seedVias: seed.seedVias,
2480
+ segmentId: segment.id
2481
+ });
2482
+ };
2483
+ var heldRun = (segments, groupId) => segments.filter((segment) => segment.group_id === groupId).map((segment) => segment.id);
2484
+ var segmentGroupForm = (group, segments) => ({
2485
+ color: group.color,
2486
+ name: group.name,
2487
+ opened: { color: group.color, groupId: group.id, name: group.name, speed: group.speed },
2488
+ segmentIds: heldRun(segments, group.id),
2489
+ speed: group.speed
2490
+ });
2491
+ var formRefusal = (form) => {
2492
+ if (form.segmentIds.length < data.SEGMENT_GROUP_MIN_MEMBERS) {
2493
+ return "minMembers";
2494
+ }
2495
+ return chunkIDBXFBLG_cjs.displayNameSchema.safeParse(form.name).success ? null : "nameError";
2496
+ };
2497
+ var sameRun = (left, right) => left.length === right.length && left.every((id, index) => id === right[index]);
2498
+ var segmentGroupSavePlan = (itineraryId, segments, form) => {
2499
+ const name = form.name.trim();
2500
+ const refusal = formRefusal(form);
2501
+ const { opened } = form;
2502
+ if (opened === null) {
2503
+ const create = {
2504
+ input: {
2505
+ color: form.color,
2506
+ itineraryId,
2507
+ name,
2508
+ segmentIds: [...form.segmentIds],
2509
+ speed: form.speed
2510
+ },
2511
+ name: "studio.itinerary.group.create"
2512
+ };
2513
+ return { changed: true, refusal, steps: refusal === null ? [create] : [] };
2514
+ }
2515
+ const subject = { groupId: opened.groupId, itineraryId };
2516
+ const runMoved = !sameRun(heldRun(segments, opened.groupId), form.segmentIds);
2517
+ const display = {
2518
+ ...form.color === opened.color ? {} : { color: form.color },
2519
+ ...name === opened.name.trim() ? {} : { name },
2520
+ ...form.speed === opened.speed ? {} : { speed: form.speed }
2521
+ };
2522
+ const displayMoved = Object.keys(display).length > 0;
2523
+ const changed = runMoved || displayMoved;
2524
+ if (refusal !== null) {
2525
+ return { changed, refusal, steps: [] };
2526
+ }
2527
+ const steps = [];
2528
+ if (runMoved) {
2529
+ steps.push({
2530
+ input: { ...subject, segmentIds: [...form.segmentIds] },
2531
+ name: "studio.itinerary.group.setRange"
2532
+ });
2533
+ }
2534
+ if (displayMoved) {
2535
+ steps.push({ input: { ...display, ...subject }, name: "studio.itinerary.group.update" });
2536
+ }
2537
+ return { changed, refusal, steps };
2538
+ };
2539
+
2540
+ // src/share/rules/targets.ts
2541
+ var buildShareText = (name, meta) => meta ? `${name} \xB7 ${meta}` : name;
2542
+ var SOCIAL_SHARE_TARGETS = [
2543
+ {
2544
+ buildHref: (url, text2) => `https://wa.me/?text=${encodeURIComponent(`${text2} ${url}`)}`,
2545
+ id: "whatsapp"
2546
+ },
2547
+ {
2548
+ buildHref: (url, text2) => `https://twitter.com/intent/tweet?text=${encodeURIComponent(text2)}&url=${encodeURIComponent(url)}`,
2549
+ id: "x"
2550
+ },
2551
+ {
2552
+ buildHref: (url, text2) => `https://t.me/share/url?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text2)}`,
2553
+ id: "telegram"
2554
+ },
2555
+ {
2556
+ buildHref: (url) => `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`,
2557
+ id: "facebook"
2558
+ },
2559
+ {
2560
+ buildHref: (url, text2) => `https://www.reddit.com/submit?url=${encodeURIComponent(url)}&title=${encodeURIComponent(text2)}`,
2561
+ id: "reddit"
2562
+ },
2563
+ {
2564
+ buildHref: (url) => `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`,
2565
+ id: "linkedin"
2566
+ },
2567
+ {
2568
+ buildHref: (url, text2) => `mailto:?subject=${encodeURIComponent(text2)}&body=${encodeURIComponent(url)}`,
2569
+ id: "email"
2570
+ }
2571
+ ];
2572
+
2573
+ // src/share/rules/viewConfig.ts
2574
+ var fallbackLanguage = resolveOrgEmbedDefaults(void 0).preferredLanguage;
2575
+ var buildShareViewConfig = (target, language) => {
2576
+ const known = chunkOQSYFH3Z_cjs.languageSchema.safeParse(language);
2577
+ return {
2578
+ activity: null,
2579
+ collectionId: target.kind === "collection" ? target.id : null,
2580
+ embedded: true,
2581
+ enrichments: [],
2582
+ itineraryId: target.kind === "itinerary" ? target.id : null,
2583
+ overlay: null,
2584
+ preferredLanguage: known.success ? known.data : fallbackLanguage,
2585
+ preferredTheme: "light",
2586
+ preferredUnitLength: "metric",
2587
+ preferredUnitPace: "per-time",
2588
+ preferredUnitSlope: "degrees",
2589
+ preferredUnitTemperature: "celsius",
2590
+ segmentsColor: "",
2591
+ terrain: chunkOQSYFH3Z_cjs.DEFAULT_TERRAIN,
2592
+ terrainVariant: "light",
2593
+ // A share link always warns where its route's access is restricted: no organization
2594
+ // default reaches a share view to turn it off.
2595
+ withAccessRestrictions: true,
2596
+ // Left to the server, which resolves the share link's organization's own defaults.
2597
+ withCollectionItineraries: null,
2598
+ withCollectionZones: null,
2599
+ withDirectionsControl: false,
2600
+ withDownloadControl: true,
2601
+ withNavigationControl: true,
2602
+ withOverlays: [],
2603
+ withOverlaysControl: true,
2604
+ withPreferencesControl: true,
2605
+ withProfileAnalysis: true,
2606
+ withProfileCharacteristics: true,
2607
+ withProfileElevation: true,
2608
+ withProfilePaceControl: true,
2609
+ withStreetviewControl: false,
2610
+ withTerrains: []
2611
+ };
2612
+ };
2613
+ var previewRefreshDisposition = (status, plan) => {
2614
+ if (status === null || status.kind === "recording") {
2615
+ return { kind: "keep" };
2616
+ }
2617
+ if (status.kind === "previewing") {
2618
+ return { kind: "restart" };
2619
+ }
2620
+ return { fraction: camera.representativeStillFraction(plan), kind: "park" };
2621
+ };
2622
+ var videoRouteSpans = (itinerary, segmentId) => {
2623
+ const segments = data.segmentsForSelection(itinerary, segmentId);
2624
+ const stretches = new Map(
2625
+ profile.buildInfoBands(segments, (segment) => [
2626
+ { from_index: 0, to_index: Number.MAX_SAFE_INTEGER, value: segment }
2627
+ ]).map((band) => [band.value, band])
2628
+ );
2629
+ const spans = [];
2630
+ let startKm = 0;
2631
+ for (const segment of segments) {
2632
+ const endKm = stretches.get(segment)?.endKm ?? startKm;
2633
+ spans.push({
2634
+ endKm,
2635
+ name: segment.name,
2636
+ speed: segment.speed === null ? null : units.convertSpeed(segment.speed, "kilometer-per-hour", "meter-per-second"),
2637
+ startKm
2638
+ });
2639
+ startKm = endKm;
2640
+ }
2641
+ return spans;
2642
+ };
2643
+
2644
+ // src/video/rules/profileSource.ts
2645
+ var videoProfileSource = (itinerary, segmentId) => {
2646
+ const segments = data.segmentsForSelection(itinerary, segmentId);
2647
+ return {
2648
+ elevationPoints: profile.buildElevationPoints(segments),
2649
+ segmentSpans: videoRouteSpans(itinerary, segmentId),
2650
+ slopeBands: profile.buildInfoBands(segments, (segment) => segment.slope_info),
2651
+ surfaceBands: profile.buildInfoBands(segments, (segment) => segment.surface_info),
2652
+ waytypeBands: profile.buildInfoBands(segments, (segment) => segment.way_type_info)
2653
+ };
2654
+ };
2655
+
2656
+ // src/video/rules/shotDefaults.ts
2657
+ var DEFAULT_SHOT_PITCH_DEG = 60;
2658
+ var DEFAULT_SHOT_ZOOM = 13;
2659
+ var DEFAULT_HOLD_MS = 2e3;
2660
+ var PREVIEW_PLAN_REFRESH_DEBOUNCE_MS = 250;
2661
+
2662
+ // src/video/rules/stepOrder.ts
2663
+ var VIDEO_STEP_ORDER = ["format", "camera", "profile", "review"];
2664
+ var studioCapabilitySchema = z4__namespace.enum(["authenticated", "editor", "embedding", "share"]);
2665
+ var studioConfigSchema = z4__namespace.object({
2666
+ /** The base terrain the studio opens on, by slug. */
2667
+ terrain: z4__namespace.string(),
2668
+ /** Which variant of the base terrain draws, light or dark. */
2669
+ terrainVariant: chunkOQSYFH3Z_cjs.terrainVariantSchema,
2670
+ /** Whether the directions control shows. */
2671
+ withDirectionsControl: z4__namespace.boolean(),
2672
+ /** Whether the download control shows. */
2673
+ withDownloadControl: z4__namespace.boolean(),
2674
+ /**
2675
+ * Whether the layers control shows: the button that opens the panel switching terrains and
2676
+ * overlays. Its own gate, never the time slider's: an embed answers it from the overlays its
2677
+ * cap leaves and the terrains it names (`layersControlOffered`).
2678
+ */
2679
+ withLayersControl: z4__namespace.boolean(),
2680
+ /** Whether the navigation control shows. */
2681
+ withNavigationControl: z4__namespace.boolean(),
2682
+ /** The overlays the studio may switch to, by slug; empty offers every one. */
2683
+ withOverlays: z4__namespace.array(z4__namespace.string()),
2684
+ /**
2685
+ * Whether the overlay time slider shows, letting a viewer move the overlays backwards or
2686
+ * forwards in time. It neither offers nor hides the layers control.
2687
+ */
2688
+ withOverlaysControl: z4__namespace.boolean(),
2689
+ /** Whether the units and language control shows. */
2690
+ withPreferencesControl: z4__namespace.boolean(),
2691
+ /** Whether the Street View control shows. */
2692
+ withStreetviewControl: z4__namespace.boolean(),
2693
+ /** The terrains the studio may switch between, by slug; empty offers every one. */
2694
+ withTerrains: z4__namespace.array(z4__namespace.string())
2695
+ });
2696
+ var defaultStudioConfig = studioConfigSchema.parse({
2697
+ terrain: chunkOQSYFH3Z_cjs.DEFAULT_TERRAIN,
2698
+ terrainVariant: "light",
2699
+ withDirectionsControl: true,
2700
+ withDownloadControl: true,
2701
+ withLayersControl: true,
2702
+ withNavigationControl: true,
2703
+ withOverlays: [],
2704
+ withOverlaysControl: true,
2705
+ withPreferencesControl: true,
2706
+ withStreetviewControl: true,
2707
+ withTerrains: []
2708
+ });
2709
+ var embedBaseline = resolveOrgEmbedDefaults(void 0);
2710
+ var memberOr = (schema, value, fallback) => {
2711
+ const parsed = schema.safeParse(value);
2712
+ return parsed.success ? parsed.data : fallback;
2713
+ };
2714
+ var listOr = (schema, value, fallback) => {
2715
+ const parsed = schema.safeParse(value);
2716
+ return parsed.success ? parsed.data : [...fallback];
2717
+ };
2718
+ var embedConfigToStudioConfig = (embedConfig, cap) => {
2719
+ const { shape } = studioConfigSchema;
2720
+ const withOverlays = listOr(
2721
+ shape.withOverlays,
2722
+ embedConfig.withOverlays,
2723
+ embedBaseline.withOverlays
2724
+ );
2725
+ const withTerrains = listOr(
2726
+ shape.withTerrains,
2727
+ embedConfig.withTerrains,
2728
+ embedBaseline.withTerrains
2729
+ );
2730
+ return {
2731
+ terrain: memberOr(shape.terrain, embedConfig.terrain, embedBaseline.terrain),
2732
+ terrainVariant: memberOr(
2733
+ shape.terrainVariant,
2734
+ embedConfig.terrainVariant,
2735
+ embedBaseline.terrainVariant
2736
+ ),
2737
+ withDirectionsControl: memberOr(
2738
+ shape.withDirectionsControl,
2739
+ embedConfig.withDirectionsControl,
2740
+ embedBaseline.withDirectionsControl
2741
+ ),
2742
+ withDownloadControl: memberOr(
2743
+ shape.withDownloadControl,
2744
+ embedConfig.withDownloadControl,
2745
+ embedBaseline.withDownloadControl
2746
+ ),
2747
+ withLayersControl: layersControlOffered({ withOverlays, withTerrains }, cap),
2748
+ withNavigationControl: memberOr(
2749
+ shape.withNavigationControl,
2750
+ embedConfig.withNavigationControl,
2751
+ embedBaseline.withNavigationControl
2752
+ ),
2753
+ withOverlays,
2754
+ withOverlaysControl: memberOr(
2755
+ shape.withOverlaysControl,
2756
+ embedConfig.withOverlaysControl,
2757
+ embedBaseline.withOverlaysControl
2758
+ ),
2759
+ withPreferencesControl: memberOr(
2760
+ shape.withPreferencesControl,
2761
+ embedConfig.withPreferencesControl,
2762
+ embedBaseline.withPreferencesControl
2763
+ ),
2764
+ withStreetviewControl: memberOr(
2765
+ shape.withStreetviewControl,
2766
+ embedConfig.withStreetviewControl,
2767
+ embedBaseline.withStreetviewControl
2768
+ ),
2769
+ withTerrains
2770
+ };
2771
+ };
2772
+ var clampStudioConfigToSafetyRules = (config, safetyRules) => {
2773
+ if (safetyRules === void 0) {
2774
+ return config;
2775
+ }
2776
+ let next = config;
2777
+ if (next.withOverlaysControl && safetyRules.with_overlays_control === false) {
2778
+ next = { ...next, withOverlaysControl: false };
2779
+ }
2780
+ const cap = safetyRules.with_overlays;
2781
+ if (cap === void 0) {
2782
+ return next;
2783
+ }
2784
+ if (chunkCJDIFRGZ_cjs.allowlistMode(cap, "cap") === "specific") {
2785
+ const unrestricted = chunkCJDIFRGZ_cjs.allowlistUnrestricted(next.withOverlays);
2786
+ const offered = unrestricted ? [...cap] : next.withOverlays.filter((slug) => cap.includes(slug));
2787
+ if (offered.length > 0 && (unrestricted || offered.length !== next.withOverlays.length)) {
2788
+ next = { ...next, withOverlays: offered };
2789
+ }
2790
+ }
2791
+ if (next.withLayersControl && !layersControlOffered(next, cap)) {
2792
+ next = { ...next, withLayersControl: false };
2793
+ }
2794
+ return next;
2795
+ };
2796
+
2797
+ // src/viewer/rules/platformViewer.ts
2798
+ var createPlatformViewer = ({
2799
+ isPersonalScope = chunkIDBXFBLG_cjs.defaultStudioScope.isPersonalScope,
2800
+ memberships,
2801
+ personalSpace,
2802
+ scope,
2803
+ viewer
2804
+ }) => {
2805
+ const scopeOf = (organizationId) => organizationId === void 0 || organizationId === "" || isPersonalScope(organizationId) ? null : organizationId;
2806
+ const answerFor = (organizationId) => organizationId === null ? personalSpace?.read() : memberships.read()?.find((membership) => membership.organization_id === organizationId);
2807
+ return {
2808
+ getItineraryLimit: (organizationId) => answerFor(scopeOf(organizationId))?.itinerary_limit ?? null,
2809
+ getPreferences: () => viewer.getPreferences(),
2810
+ getUserId: () => viewer.getUserId(),
2811
+ hasEntitlement: (entitlement) => answerFor(scopeOf(scope.read()))?.studio_entitlements.includes(entitlement) ?? false,
2812
+ setPreferences: (partial) => viewer.setPreferences(partial),
2813
+ subscribe: (onChange) => {
2814
+ let inView = scopeOf(scope.read());
2815
+ const releases = [
2816
+ viewer.subscribe(onChange),
2817
+ memberships.subscribe(onChange),
2818
+ personalSpace?.subscribe(onChange),
2819
+ scope.subscribe(() => {
2820
+ const next = scopeOf(scope.read());
2821
+ if (next !== inView) {
2822
+ inView = next;
2823
+ onChange();
2824
+ }
2825
+ })
2826
+ ];
2827
+ return () => {
2828
+ for (const release of releases) {
2829
+ release?.();
2830
+ }
2831
+ };
2832
+ }
2833
+ };
2834
+ };
2835
+
2836
+ // src/viewer/rules/url.ts
2837
+ var nothingMirrored = {};
2838
+ var releaseNothing = () => {
2839
+ };
2840
+ var inertStudioUrlSeam = {
2841
+ read: () => nothingMirrored,
2842
+ readOnce: () => nothingMirrored,
2843
+ subscribe: () => releaseNothing,
2844
+ write: () => {
2845
+ }
2846
+ };
2847
+
2848
+ // src/viewer/rules/viewerSeam.ts
2849
+ var sameViewerValues = (a, b) => {
2850
+ for (const key of /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)])) {
2851
+ if (Reflect.get(a, key) !== Reflect.get(b, key)) {
2852
+ return false;
2853
+ }
2854
+ }
2855
+ return true;
2856
+ };
2857
+ var inertViewer = /* @__PURE__ */ chunkOQSYFH3Z_cjs.createStaticViewer();
2858
+ var mintRowId = (ids = chunkWVQQLKCI_cjs.studioSeamAbsences.ids) => ids.next();
2859
+ var shownMinutes = (seconds) => seconds == null ? null : Math.round(seconds / units.SECONDS_PER_MINUTE);
2860
+ var storedSeconds = (minutes) => minutes === null ? null : Math.round(minutes) * units.SECONDS_PER_MINUTE;
2861
+ var stopSeconds = (draft) => {
2862
+ const stored = draft.storedStopSeconds;
2863
+ return stored !== void 0 && shownMinutes(stored) === draft.stopMinutes ? stored : storedSeconds(draft.stopMinutes);
2864
+ };
2865
+ var cutoffInstant = (cutoffAt) => {
2866
+ if (cutoffAt === null) {
2867
+ return null;
2868
+ }
2869
+ if (Number.isNaN(cutoffAt.getTime())) {
2870
+ throw new errors.MountayaElementsError(
2871
+ "patch waypoint details: the cut-off is no valid date. Set it to a date and a time, or clear it."
2872
+ );
2873
+ }
2874
+ return cutoffAt.toISOString();
2875
+ };
2876
+ var text = (value) => value ?? "";
2877
+ var orNull = (value) => {
2878
+ const trimmed = value.trim();
2879
+ return trimmed === "" ? null : trimmed;
2880
+ };
2881
+ var draftFromWaypoint = (waypoint) => ({
2882
+ // Left out, and not stated as undefined, for a waypoint that stores no stop duration.
2883
+ ...waypoint.timing?.stop_duration == null ? {} : { storedStopSeconds: waypoint.timing.stop_duration },
2884
+ address: text(waypoint.contact?.address),
2885
+ amenities: [...waypoint.amenities ?? []],
2886
+ bookingUrl: text(waypoint.contact?.booking_url),
2887
+ cutoffAt: waypoint.timing?.cutoff_at ?? null,
2888
+ email: text(waypoint.contact?.email),
2889
+ links: (waypoint.media?.links ?? []).map((link) => ({
2890
+ label: link.label,
2891
+ rowId: mintRowId(),
2892
+ url: link.url
2893
+ })),
2894
+ openingHours: text(waypoint.contact?.opening_hours),
2895
+ phone: text(waypoint.contact?.phone),
2896
+ photos: (waypoint.media?.photos ?? []).map((photo) => ({
2897
+ caption: text(photo.caption),
2898
+ rowId: mintRowId(),
2899
+ url: photo.url
2900
+ })),
2901
+ properties: (waypoint.properties ?? []).map((property) => ({
2902
+ format: property.format ?? "text",
2903
+ key: property.key,
2904
+ label: property.label,
2905
+ rowId: mintRowId(),
2906
+ value: property.value
2907
+ })),
2908
+ stopMinutes: shownMinutes(waypoint.timing?.stop_duration),
2909
+ website: text(waypoint.contact?.website)
2910
+ });
2911
+ var patchFromDraft = (draft) => {
2912
+ const timing = {
2913
+ cutoff_at: cutoffInstant(draft.cutoffAt),
2914
+ stop_duration: stopSeconds(draft)
2915
+ };
2916
+ const contact = {
2917
+ address: orNull(draft.address),
2918
+ booking_url: orNull(draft.bookingUrl),
2919
+ email: orNull(draft.email),
2920
+ opening_hours: orNull(draft.openingHours),
2921
+ phone: orNull(draft.phone),
2922
+ website: orNull(draft.website)
2923
+ };
2924
+ const photos = draft.photos.filter((photo) => photo.url.trim() !== "").map((photo) => ({ caption: orNull(photo.caption), url: photo.url.trim() }));
2925
+ const links = draft.links.filter((link) => link.label.trim() !== "" && link.url.trim() !== "").map((link) => ({ label: link.label.trim(), url: link.url.trim() }));
2926
+ const properties = draft.properties.filter((property) => property.key.trim() !== "" && property.label.trim() !== "").map((property) => ({
2927
+ format: property.format,
2928
+ key: property.key.trim(),
2929
+ label: property.label.trim(),
2930
+ value: property.value.trim()
2931
+ }));
2932
+ const media = { links, photos };
2933
+ return {
2934
+ amenities: draft.amenities,
2935
+ contact: Object.values(contact).every((value) => value === null) ? null : contact,
2936
+ media: links.length === 0 && photos.length === 0 ? null : media,
2937
+ properties: properties.length === 0 ? null : properties,
2938
+ timing: Object.values(timing).every((value) => value === null) ? null : timing
2939
+ };
2940
+ };
2941
+ var nextPropertyKey = (properties) => {
2942
+ const taken = new Set(properties.map((property) => property.key));
2943
+ let index = properties.length + 1;
2944
+ while (taken.has(`field-${index}`)) {
2945
+ index += 1;
2946
+ }
2947
+ return `field-${index}`;
2948
+ };
2949
+
2950
+ // src/waypoints/rules/detailsPreview.ts
2951
+ var previewWaypoint = (waypoint, fields) => {
2952
+ const patch = patchFromDraft(fields.draft);
2953
+ const description = fields.description.trim();
2954
+ const name = fields.name.trim();
2955
+ return {
2956
+ ...waypoint,
2957
+ amenities: patch.amenities ?? [],
2958
+ color: fields.color,
2959
+ contact: patch.contact ?? null,
2960
+ description: description === "" ? null : description,
2961
+ icon: fields.icon,
2962
+ media: patch.media ?? null,
2963
+ name: name === "" ? null : name,
2964
+ properties: patch.properties ?? null,
2965
+ timing: patch.timing == null ? null : { ...patch.timing, cutoff_at: fields.draft.cutoffAt }
2966
+ };
2967
+ };
2968
+ var waypointDetailsForm = (waypoint) => {
2969
+ const fields = {
2970
+ color: waypoint.color ?? icons.DEFAULT_WAYPOINT_COLOR,
2971
+ description: waypoint.description ?? "",
2972
+ details: draftFromWaypoint(waypoint),
2973
+ icon: waypoint.icon,
2974
+ name: waypoint.name ?? ""
2975
+ };
2976
+ return { ...fields, opened: fields };
2977
+ };
2978
+ var filledAndRefused = (value, accepts) => value.trim() !== "" && !accepts(value.trim());
2979
+ var detailsRefusal = (details) => {
2980
+ if (filledAndRefused(details.phone, chunkOQSYFH3Z_cjs.isWaypointPhone)) {
2981
+ return "phoneInvalid";
2982
+ }
2983
+ if (filledAndRefused(details.email, chunkOQSYFH3Z_cjs.isWaypointEmail)) {
2984
+ return "emailInvalid";
2985
+ }
2986
+ const addresses = [
2987
+ details.website,
2988
+ details.bookingUrl,
2989
+ ...details.photos.map((photo) => photo.url),
2990
+ ...details.links.map((link) => link.url)
2991
+ ];
2992
+ if (addresses.some((address) => filledAndRefused(address, chunkOQSYFH3Z_cjs.isWaypointWebUrl))) {
2993
+ return "urlInvalid";
2994
+ }
2995
+ if (details.properties.some((property) => filledAndRefused(property.key, chunkOQSYFH3Z_cjs.isWaypointPropertyKey))) {
2996
+ return "keyInvalid";
2997
+ }
2998
+ const mismatched = details.properties.some(
2999
+ (property) => !chunkOQSYFH3Z_cjs.waypointPropertyValueMatchesFormat(property.value, property.format)
3000
+ );
3001
+ return mismatched ? "valueFormatInvalid" : null;
3002
+ };
3003
+ var formRefusal2 = (form) => {
3004
+ const name = form.name.trim();
3005
+ if (name !== "" && !chunkIDBXFBLG_cjs.displayNameSchema.safeParse(name).success) {
3006
+ return "nameInvalid";
3007
+ }
3008
+ if (!chunkIDBXFBLG_cjs.descriptionSchema.safeParse(form.description).success) {
3009
+ return "descriptionInvalid";
3010
+ }
3011
+ return detailsRefusal(form.details);
3012
+ };
3013
+ var DETAILS_MEMBERS = ["amenities", "contact", "media", "properties", "timing"];
3014
+ var openedPatches = /* @__PURE__ */ new WeakMap();
3015
+ var openedPatch = (draft) => {
3016
+ const held = openedPatches.get(draft);
3017
+ if (held !== void 0) {
3018
+ return held;
3019
+ }
3020
+ const patch = patchFromDraft(draft);
3021
+ openedPatches.set(draft, patch);
3022
+ return patch;
3023
+ };
3024
+ var orNull2 = (value) => {
3025
+ const trimmed = value.trim();
3026
+ return trimmed === "" ? null : trimmed;
3027
+ };
3028
+ var waypointSavePlan = (itineraryId, waypoint, form) => {
3029
+ const subject = { itineraryId, waypointId: waypoint.id };
3030
+ const { opened } = form;
3031
+ const name = form.name.trim();
3032
+ const openedName = opened.name.trim();
3033
+ const nameMoved = name === "" ? waypoint.mode === "point" && openedName !== "" : name !== openedName;
3034
+ const icon = chunkOQSYFH3Z_cjs.userWaypointIconSchema.safeParse(form.icon);
3035
+ const iconMoved = icon.success && icon.data !== opened.icon;
3036
+ const colorMoved = form.color !== opened.color;
3037
+ const descriptionMoved = form.description.trim() !== opened.description.trim();
3038
+ const patch = patchFromDraft(form.details);
3039
+ const baseline = openedPatch(opened.details);
3040
+ const movedDetails = DETAILS_MEMBERS.filter(
3041
+ (member) => JSON.stringify(patch[member]) !== JSON.stringify(baseline[member])
3042
+ );
3043
+ const detailsMoved = descriptionMoved || movedDetails.length > 0;
3044
+ const changed = nameMoved || iconMoved || colorMoved || detailsMoved;
3045
+ const refusal = formRefusal2(form);
3046
+ if (refusal !== null) {
3047
+ return { changed, refusal, steps: [] };
3048
+ }
3049
+ const details = detailsMoved ? {
3050
+ input: {
3051
+ ...movedDetails.includes("amenities") ? { amenities: patch.amenities } : {},
3052
+ ...movedDetails.includes("contact") ? { contact: patch.contact } : {},
3053
+ ...movedDetails.includes("media") ? { media: patch.media } : {},
3054
+ ...movedDetails.includes("properties") ? { properties: patch.properties } : {},
3055
+ ...movedDetails.includes("timing") ? { timing: patch.timing } : {},
3056
+ ...subject,
3057
+ ...descriptionMoved ? { description: orNull2(form.description) } : {}
3058
+ },
3059
+ name: "studio.itinerary.waypoint.setDetails"
3060
+ } : null;
3061
+ const accepted = details === null || chunkOQSYFH3Z_cjs.itineraryWaypointsToolContracts["studio.itinerary.waypoint.setDetails"].input.safeParse(
3062
+ details.input
3063
+ ).success;
3064
+ if (details !== null && !accepted) {
3065
+ return { changed, refusal, steps: [details] };
3066
+ }
3067
+ const steps = [];
3068
+ if (nameMoved) {
3069
+ steps.push({
3070
+ input: { ...subject, name: name === "" ? null : name },
3071
+ name: "studio.itinerary.waypoint.rename"
3072
+ });
3073
+ }
3074
+ if (iconMoved) {
3075
+ steps.push({
3076
+ input: { ...subject, icon: icon.data },
3077
+ name: "studio.itinerary.waypoint.setIcon"
3078
+ });
3079
+ }
3080
+ if (colorMoved) {
3081
+ steps.push({
3082
+ input: { ...subject, color: form.color },
3083
+ name: "studio.itinerary.waypoint.recolor"
3084
+ });
3085
+ }
3086
+ if (details !== null) {
3087
+ steps.push(details);
3088
+ }
3089
+ return { changed, refusal, steps };
3090
+ };
3091
+
3092
+ // src/waypoints/rules/liveWaypoint.ts
3093
+ var substituteLiveWaypoint = (waypoints, session, itineraryId) => {
3094
+ if (session === null) {
3095
+ return waypoints;
3096
+ }
3097
+ const { draft, waypointId } = session;
3098
+ const name = draft.name === "" ? null : draft.name;
3099
+ const index = waypoints.findIndex((waypoint) => waypoint.id === waypointId);
3100
+ const saved = waypoints[index];
3101
+ if (saved === void 0) {
3102
+ return session.intent === "create" ? [
3103
+ ...waypoints,
3104
+ chunkOQSYFH3Z_cjs.synthesizeDraftWaypoint({
3105
+ draft: { color: draft.color, icon: draft.icon, lngLat: draft.lngLat, name },
3106
+ itineraryId,
3107
+ waypointId
3108
+ })
3109
+ ] : waypoints;
3110
+ }
3111
+ const savedPoint = saved.geojson?.type === "Point" ? saved.geojson.coordinates : null;
3112
+ const moved = draft.lngLat !== null && (savedPoint === null || savedPoint[0] !== draft.lngLat[0] || savedPoint[1] !== draft.lngLat[1]);
3113
+ const live = {
3114
+ ...saved,
3115
+ color: draft.color,
3116
+ geojson: moved && draft.lngLat !== null ? { coordinates: [draft.lngLat[0], draft.lngLat[1]], type: "Point" } : saved.geojson,
3117
+ icon: draft.icon,
3118
+ name
3119
+ };
3120
+ return waypoints.map((waypoint, at) => at === index ? live : waypoint);
3121
+ };
3122
+ var defaultWaypointName = (label, occurrence) => `${label} #${occurrence}`;
3123
+ var iconOf = (icon) => icon ?? icons.DEFAULT_WAYPOINT_ICON;
3124
+ var waypointIconOccurrence = (waypoints, index) => {
3125
+ const entry = waypoints[index];
3126
+ if (entry === void 0) {
3127
+ return 0;
3128
+ }
3129
+ const target = iconOf(entry.icon);
3130
+ let occurrence = 0;
3131
+ for (let position = 0; position <= index; position += 1) {
3132
+ const candidate = waypoints[position];
3133
+ if (candidate !== void 0 && iconOf(candidate.icon) === target) {
3134
+ occurrence += 1;
3135
+ }
3136
+ }
3137
+ return occurrence;
3138
+ };
3139
+ var waypointIconLabel = (icon, names) => names[iconOf(icon)];
3140
+ var waypointDefaultName = (waypoints, index, names, icon = waypoints[index]?.icon) => {
3141
+ if (icon === waypoints[index]?.icon) {
3142
+ return defaultWaypointName(
3143
+ waypointIconLabel(icon, names),
3144
+ waypointIconOccurrence(waypoints, index)
3145
+ );
3146
+ }
3147
+ const target = iconOf(icon);
3148
+ const before = waypoints.slice(0, Math.max(0, index)).filter((waypoint) => iconOf(waypoint.icon) === target).length;
3149
+ return defaultWaypointName(waypointIconLabel(icon, names), before + 1);
3150
+ };
3151
+ var waypointDefaultNames = (waypoints, names) => {
3152
+ const counts = /* @__PURE__ */ new Map();
3153
+ return waypoints.map((waypoint) => {
3154
+ const icon = iconOf(waypoint.icon);
3155
+ const occurrence = (counts.get(icon) ?? 0) + 1;
3156
+ counts.set(icon, occurrence);
3157
+ return defaultWaypointName(waypointIconLabel(icon, names), occurrence);
3158
+ });
3159
+ };
3160
+ var nextWaypointDefaultName = (saved, icon, names) => defaultWaypointName(
3161
+ waypointIconLabel(icon, names),
3162
+ saved.filter((waypoint) => iconOf(waypoint.icon) === iconOf(icon)).length + 1
3163
+ );
3164
+ var resolveWaypointName = (name, defaultName) => name !== null && name !== "" ? name : defaultName;
3165
+
3166
+ // src/waypoints/rules/sections.ts
3167
+ var WAYPOINT_SECTIONS = [
3168
+ { glyph: "appearance", id: "appearance" },
3169
+ { glyph: "amenities", id: "amenities" },
3170
+ { glyph: "timing", id: "timing" },
3171
+ { glyph: "contact", id: "contact" },
3172
+ { glyph: "media", id: "media" },
3173
+ { glyph: "properties", id: "properties" }
3174
+ ];
3175
+ var waypointSectionLabel = (words, id) => {
3176
+ const copy = words.waypointDetails;
3177
+ switch (id) {
3178
+ case "amenities":
3179
+ return copy.amenitiesSection;
3180
+ case "appearance":
3181
+ return copy.appearanceSection;
3182
+ case "contact":
3183
+ return copy.contactSection;
3184
+ case "media":
3185
+ return copy.mediaSection;
3186
+ case "properties":
3187
+ return copy.propertiesSection;
3188
+ case "timing":
3189
+ return copy.timingSection;
3190
+ }
3191
+ };
3192
+
3193
+ // src/waypoints/rules/waypointDraft.ts
3194
+ var recordWaypointDraftChange = (bus, context, change) => {
3195
+ const state = context.ui.getState();
3196
+ const waypointId = state.waypointEditSession?.waypointId;
3197
+ if (waypointId === void 0) {
3198
+ return "drop";
3199
+ }
3200
+ const disposition = chunkXKHLRIC7_cjs.draftChangeDisposition({
3201
+ agentDriving: state.agentDriving,
3202
+ programmatic: false
3203
+ });
3204
+ if (disposition !== "record") {
3205
+ return disposition;
3206
+ }
3207
+ void Promise.resolve(
3208
+ bus.dispatch(context, "studio.itinerary.waypoint.editSetPosition", {
3209
+ lngLat: change.lngLat,
3210
+ poiSeed: change.poiSeed,
3211
+ waypointId
3212
+ })
3213
+ ).then(void 0, () => {
3214
+ });
3215
+ return disposition;
3216
+ };
3217
+
3218
+ // src/zones/rules/zoneDraft.ts
3219
+ var recordZoneDraftChange = (ui, draft) => {
3220
+ const state = ui.getState();
3221
+ const disposition = chunkXKHLRIC7_cjs.draftChangeDisposition({
3222
+ agentDriving: state.agentDriving,
3223
+ programmatic: draft.programmatic
3224
+ });
3225
+ if (disposition !== "record") {
3226
+ return disposition;
3227
+ }
3228
+ const geometry = chunkOQSYFH3Z_cjs.wrapZoneGeometryPastRange(draft.geometry);
3229
+ if (draft.phase === "live") {
3230
+ state.setZoneEditLiveDraft(geometry);
3231
+ } else {
3232
+ state.pushZoneDraft(geometry);
3233
+ }
3234
+ return disposition;
3235
+ };
3236
+
3237
+ Object.defineProperty(exports, "buildVideoSnapshot", {
3238
+ enumerable: true,
3239
+ get: function () { return chunkQFO5CZG2_cjs.buildVideoSnapshot; }
3240
+ });
3241
+ Object.defineProperty(exports, "createVideoDirectorStore", {
3242
+ enumerable: true,
3243
+ get: function () { return chunkQFO5CZG2_cjs.createVideoDirectorStore; }
3244
+ });
3245
+ Object.defineProperty(exports, "selectDirecting", {
3246
+ enumerable: true,
3247
+ get: function () { return chunkQFO5CZG2_cjs.selectDirecting; }
3248
+ });
3249
+ Object.defineProperty(exports, "videoSnapshotSchema", {
3250
+ enumerable: true,
3251
+ get: function () { return chunkQFO5CZG2_cjs.videoSnapshotSchema; }
3252
+ });
3253
+ Object.defineProperty(exports, "EMBED_COVER_MAX_MS", {
3254
+ enumerable: true,
3255
+ get: function () { return chunkXKHLRIC7_cjs.EMBED_COVER_MAX_MS; }
3256
+ });
3257
+ Object.defineProperty(exports, "buildReadyPayload", {
3258
+ enumerable: true,
3259
+ get: function () { return chunkXKHLRIC7_cjs.buildReadyPayload; }
3260
+ });
3261
+ Object.defineProperty(exports, "buildSegmentEditOptions", {
3262
+ enumerable: true,
3263
+ get: function () { return chunkXKHLRIC7_cjs.buildSegmentEditOptions; }
3264
+ });
3265
+ Object.defineProperty(exports, "draftChangeDisposition", {
3266
+ enumerable: true,
3267
+ get: function () { return chunkXKHLRIC7_cjs.draftChangeDisposition; }
3268
+ });
3269
+ Object.defineProperty(exports, "embedConstraintsFor", {
3270
+ enumerable: true,
3271
+ get: function () { return chunkXKHLRIC7_cjs.embedConstraintsFor; }
3272
+ });
3273
+ Object.defineProperty(exports, "profileCursorReadout", {
3274
+ enumerable: true,
3275
+ get: function () { return chunkXKHLRIC7_cjs.profileCursorReadout; }
3276
+ });
3277
+ Object.defineProperty(exports, "profileMarkerIcon", {
3278
+ enumerable: true,
3279
+ get: function () { return chunkXKHLRIC7_cjs.profileMarkerIcon; }
3280
+ });
3281
+ Object.defineProperty(exports, "resolveFramedError", {
3282
+ enumerable: true,
3283
+ get: function () { return chunkXKHLRIC7_cjs.resolveFramedError; }
3284
+ });
3285
+ Object.defineProperty(exports, "routeHazardConfirmation", {
3286
+ enumerable: true,
3287
+ get: function () { return chunkXKHLRIC7_cjs.routeHazardConfirmation; }
3288
+ });
3289
+ Object.defineProperty(exports, "layerToolContext", {
3290
+ enumerable: true,
3291
+ get: function () { return chunk7NBRCENN_cjs.layerToolContext; }
3292
+ });
3293
+ Object.defineProperty(exports, "HILLSHADE_OVERLAY_SLUG", {
3294
+ enumerable: true,
3295
+ get: function () { return chunkCJDIFRGZ_cjs.HILLSHADE_OVERLAY_SLUG; }
3296
+ });
3297
+ Object.defineProperty(exports, "POIS_OVERLAY_SLUG", {
3298
+ enumerable: true,
3299
+ get: function () { return chunkCJDIFRGZ_cjs.POIS_OVERLAY_SLUG; }
3300
+ });
3301
+ Object.defineProperty(exports, "ToolBus", {
3302
+ enumerable: true,
3303
+ get: function () { return chunkCJDIFRGZ_cjs.ToolBus; }
3304
+ });
3305
+ Object.defineProperty(exports, "allowlistForMode", {
3306
+ enumerable: true,
3307
+ get: function () { return chunkCJDIFRGZ_cjs.allowlistForMode; }
3308
+ });
3309
+ Object.defineProperty(exports, "allowlistMode", {
3310
+ enumerable: true,
3311
+ get: function () { return chunkCJDIFRGZ_cjs.allowlistMode; }
3312
+ });
3313
+ Object.defineProperty(exports, "allowlistUnrestricted", {
3314
+ enumerable: true,
3315
+ get: function () { return chunkCJDIFRGZ_cjs.allowlistUnrestricted; }
3316
+ });
3317
+ Object.defineProperty(exports, "clampConfigToSafetyRules", {
3318
+ enumerable: true,
3319
+ get: function () { return chunkCJDIFRGZ_cjs.clampConfigToSafetyRules; }
3320
+ });
3321
+ Object.defineProperty(exports, "classicOverlays", {
3322
+ enumerable: true,
3323
+ get: function () { return chunkCJDIFRGZ_cjs.classicOverlays; }
3324
+ });
3325
+ Object.defineProperty(exports, "collectAttributions", {
3326
+ enumerable: true,
3327
+ get: function () { return chunkCJDIFRGZ_cjs.collectAttributions; }
3328
+ });
3329
+ Object.defineProperty(exports, "confirmationToneSchema", {
3330
+ enumerable: true,
3331
+ get: function () { return chunkCJDIFRGZ_cjs.confirmationToneSchema; }
3332
+ });
3333
+ Object.defineProperty(exports, "contiguousRunBounds", {
3334
+ enumerable: true,
3335
+ get: function () { return chunkCJDIFRGZ_cjs.contiguousRunBounds; }
3336
+ });
3337
+ Object.defineProperty(exports, "createUiStore", {
3338
+ enumerable: true,
3339
+ get: function () { return chunkCJDIFRGZ_cjs.createUiStore; }
3340
+ });
3341
+ Object.defineProperty(exports, "describeInvalidInput", {
3342
+ enumerable: true,
3343
+ get: function () { return chunkCJDIFRGZ_cjs.describeInvalidInput; }
3344
+ });
3345
+ Object.defineProperty(exports, "directionsTargetSchema", {
3346
+ enumerable: true,
3347
+ get: function () { return chunkCJDIFRGZ_cjs.directionsTargetSchema; }
3348
+ });
3349
+ Object.defineProperty(exports, "embedUiBaseline", {
3350
+ enumerable: true,
3351
+ get: function () { return chunkCJDIFRGZ_cjs.embedUiBaseline; }
3352
+ });
3353
+ Object.defineProperty(exports, "enrichmentOverlays", {
3354
+ enumerable: true,
3355
+ get: function () { return chunkCJDIFRGZ_cjs.enrichmentOverlays; }
3356
+ });
3357
+ Object.defineProperty(exports, "exceedsMergeViaCeiling", {
3358
+ enumerable: true,
3359
+ get: function () { return chunkCJDIFRGZ_cjs.exceedsMergeViaCeiling; }
3360
+ });
3361
+ Object.defineProperty(exports, "filterEnrichmentOverlays", {
3362
+ enumerable: true,
3363
+ get: function () { return chunkCJDIFRGZ_cjs.filterEnrichmentOverlays; }
3364
+ });
3365
+ Object.defineProperty(exports, "filterOverlayCategories", {
3366
+ enumerable: true,
3367
+ get: function () { return chunkCJDIFRGZ_cjs.filterOverlayCategories; }
3368
+ });
3369
+ Object.defineProperty(exports, "filterTerrains", {
3370
+ enumerable: true,
3371
+ get: function () { return chunkCJDIFRGZ_cjs.filterTerrains; }
3372
+ });
3373
+ Object.defineProperty(exports, "findHillshadeOverlay", {
3374
+ enumerable: true,
3375
+ get: function () { return chunkCJDIFRGZ_cjs.findHillshadeOverlay; }
3376
+ });
3377
+ Object.defineProperty(exports, "isContiguousRun", {
3378
+ enumerable: true,
3379
+ get: function () { return chunkCJDIFRGZ_cjs.isContiguousRun; }
3380
+ });
3381
+ Object.defineProperty(exports, "isFieldRestricted", {
3382
+ enumerable: true,
3383
+ get: function () { return chunkCJDIFRGZ_cjs.isFieldRestricted; }
3384
+ });
3385
+ Object.defineProperty(exports, "isZoneWorkUnsaved", {
3386
+ enumerable: true,
3387
+ get: function () { return chunkCJDIFRGZ_cjs.isZoneWorkUnsaved; }
3388
+ });
3389
+ Object.defineProperty(exports, "makeWaypointId", {
3390
+ enumerable: true,
3391
+ get: function () { return chunkCJDIFRGZ_cjs.makeWaypointId; }
3392
+ });
3393
+ Object.defineProperty(exports, "registerStudioTools", {
3394
+ enumerable: true,
3395
+ get: function () { return chunkCJDIFRGZ_cjs.registerStudioTools; }
3396
+ });
3397
+ Object.defineProperty(exports, "resolveViewerUnits", {
3398
+ enumerable: true,
3399
+ get: function () { return chunkCJDIFRGZ_cjs.resolveViewerUnits; }
3400
+ });
3401
+ Object.defineProperty(exports, "selectActiveDraft", {
3402
+ enumerable: true,
3403
+ get: function () { return chunkCJDIFRGZ_cjs.selectActiveDraft; }
3404
+ });
3405
+ Object.defineProperty(exports, "selectActiveDraftSession", {
3406
+ enumerable: true,
3407
+ get: function () { return chunkCJDIFRGZ_cjs.selectActiveDraftSession; }
3408
+ });
3409
+ Object.defineProperty(exports, "selectAgentHandoffArmed", {
3410
+ enumerable: true,
3411
+ get: function () { return chunkCJDIFRGZ_cjs.selectAgentHandoffArmed; }
3412
+ });
3413
+ Object.defineProperty(exports, "selectBaseMapLocked", {
3414
+ enumerable: true,
3415
+ get: function () { return chunkCJDIFRGZ_cjs.selectBaseMapLocked; }
3416
+ });
3417
+ Object.defineProperty(exports, "selectDirections", {
3418
+ enumerable: true,
3419
+ get: function () { return chunkCJDIFRGZ_cjs.selectDirections; }
3420
+ });
3421
+ Object.defineProperty(exports, "selectEditDirtyTick", {
3422
+ enumerable: true,
3423
+ get: function () { return chunkCJDIFRGZ_cjs.selectEditDirtyTick; }
3424
+ });
3425
+ Object.defineProperty(exports, "selectEditorTakenBy", {
3426
+ enumerable: true,
3427
+ get: function () { return chunkCJDIFRGZ_cjs.selectEditorTakenBy; }
3428
+ });
3429
+ Object.defineProperty(exports, "selectEmbed", {
3430
+ enumerable: true,
3431
+ get: function () { return chunkCJDIFRGZ_cjs.selectEmbed; }
3432
+ });
3433
+ Object.defineProperty(exports, "selectEmbedContent", {
3434
+ enumerable: true,
3435
+ get: function () { return chunkCJDIFRGZ_cjs.selectEmbedContent; }
3436
+ });
3437
+ Object.defineProperty(exports, "selectImportSession", {
3438
+ enumerable: true,
3439
+ get: function () { return chunkCJDIFRGZ_cjs.selectImportSession; }
3440
+ });
3441
+ Object.defineProperty(exports, "selectProfilePaceKmh", {
3442
+ enumerable: true,
3443
+ get: function () { return chunkCJDIFRGZ_cjs.selectProfilePaceKmh; }
3444
+ });
3445
+ Object.defineProperty(exports, "selectProfileSheetSnap", {
3446
+ enumerable: true,
3447
+ get: function () { return chunkCJDIFRGZ_cjs.selectProfileSheetSnap; }
3448
+ });
3449
+ Object.defineProperty(exports, "selectSegmentViaPrompt", {
3450
+ enumerable: true,
3451
+ get: function () { return chunkCJDIFRGZ_cjs.selectSegmentViaPrompt; }
3452
+ });
3453
+ Object.defineProperty(exports, "selectSelectedSuggestionCandidate", {
3454
+ enumerable: true,
3455
+ get: function () { return chunkCJDIFRGZ_cjs.selectSelectedSuggestionCandidate; }
3456
+ });
3457
+ Object.defineProperty(exports, "selectShare", {
3458
+ enumerable: true,
3459
+ get: function () { return chunkCJDIFRGZ_cjs.selectShare; }
3460
+ });
3461
+ Object.defineProperty(exports, "selectUnsavedWork", {
3462
+ enumerable: true,
3463
+ get: function () { return chunkCJDIFRGZ_cjs.selectUnsavedWork; }
3464
+ });
3465
+ Object.defineProperty(exports, "selectVideoExport", {
3466
+ enumerable: true,
3467
+ get: function () { return chunkCJDIFRGZ_cjs.selectVideoExport; }
3468
+ });
3469
+ Object.defineProperty(exports, "selectVideoExportPlan", {
3470
+ enumerable: true,
3471
+ get: function () { return chunkCJDIFRGZ_cjs.selectVideoExportPlan; }
3472
+ });
3473
+ Object.defineProperty(exports, "selectVideoExportRoute", {
3474
+ enumerable: true,
3475
+ get: function () { return chunkCJDIFRGZ_cjs.selectVideoExportRoute; }
3476
+ });
3477
+ Object.defineProperty(exports, "selectVideoExportStatus", {
3478
+ enumerable: true,
3479
+ get: function () { return chunkCJDIFRGZ_cjs.selectVideoExportStatus; }
3480
+ });
3481
+ Object.defineProperty(exports, "selectWaypointDetails", {
3482
+ enumerable: true,
3483
+ get: function () { return chunkCJDIFRGZ_cjs.selectWaypointDetails; }
3484
+ });
3485
+ Object.defineProperty(exports, "selectZoneCreateSetup", {
3486
+ enumerable: true,
3487
+ get: function () { return chunkCJDIFRGZ_cjs.selectZoneCreateSetup; }
3488
+ });
3489
+ Object.defineProperty(exports, "selectZoneEditDirty", {
3490
+ enumerable: true,
3491
+ get: function () { return chunkCJDIFRGZ_cjs.selectZoneEditDirty; }
3492
+ });
3493
+ Object.defineProperty(exports, "splitPickVerdict", {
3494
+ enumerable: true,
3495
+ get: function () { return chunkCJDIFRGZ_cjs.splitPickVerdict; }
3496
+ });
3497
+ Object.defineProperty(exports, "studioRegistry", {
3498
+ enumerable: true,
3499
+ get: function () { return chunkCJDIFRGZ_cjs.studioRegistry; }
3500
+ });
3501
+ Object.defineProperty(exports, "toggleableSegmentIds", {
3502
+ enumerable: true,
3503
+ get: function () { return chunkCJDIFRGZ_cjs.toggleableSegmentIds; }
3504
+ });
3505
+ Object.defineProperty(exports, "toolCapabilitySchema", {
3506
+ enumerable: true,
3507
+ get: function () { return chunkCJDIFRGZ_cjs.toolCapabilitySchema; }
3508
+ });
3509
+ Object.defineProperty(exports, "toolConfirmationSchema", {
3510
+ enumerable: true,
3511
+ get: function () { return chunkCJDIFRGZ_cjs.toolConfirmationSchema; }
3512
+ });
3513
+ Object.defineProperty(exports, "toolErrorCodeSchema", {
3514
+ enumerable: true,
3515
+ get: function () { return chunkCJDIFRGZ_cjs.toolErrorCodeSchema; }
3516
+ });
3517
+ Object.defineProperty(exports, "withItineraryAnalysis", {
3518
+ enumerable: true,
3519
+ get: function () { return chunkCJDIFRGZ_cjs.withItineraryAnalysis; }
3520
+ });
3521
+ Object.defineProperty(exports, "AGENT_PANEL_SEARCH_KEYS", {
3522
+ enumerable: true,
3523
+ get: function () { return chunkOQSYFH3Z_cjs.AGENT_PANEL_SEARCH_KEYS; }
3524
+ });
3525
+ Object.defineProperty(exports, "COLLAB_PEER_COLORS", {
3526
+ enumerable: true,
3527
+ get: function () { return chunkOQSYFH3Z_cjs.COLLAB_PEER_COLORS; }
3528
+ });
3529
+ Object.defineProperty(exports, "DEFAULT_ENABLED_POI_GROUP_IDS", {
3530
+ enumerable: true,
3531
+ get: function () { return chunkOQSYFH3Z_cjs.DEFAULT_ENABLED_POI_GROUP_IDS; }
3532
+ });
3533
+ Object.defineProperty(exports, "DEFAULT_TERRAIN", {
3534
+ enumerable: true,
3535
+ get: function () { return chunkOQSYFH3Z_cjs.DEFAULT_TERRAIN; }
3536
+ });
3537
+ Object.defineProperty(exports, "DUPLICATE_SEGMENT_IDS_MAX", {
3538
+ enumerable: true,
3539
+ get: function () { return chunkOQSYFH3Z_cjs.DUPLICATE_SEGMENT_IDS_MAX; }
3540
+ });
3541
+ Object.defineProperty(exports, "DUPLICATE_WAYPOINT_IDS_MAX", {
3542
+ enumerable: true,
3543
+ get: function () { return chunkOQSYFH3Z_cjs.DUPLICATE_WAYPOINT_IDS_MAX; }
3544
+ });
3545
+ Object.defineProperty(exports, "EXPORT_FORMATS", {
3546
+ enumerable: true,
3547
+ get: function () { return chunkOQSYFH3Z_cjs.EXPORT_FORMATS; }
3548
+ });
3549
+ Object.defineProperty(exports, "EXPORT_VARIANTS", {
3550
+ enumerable: true,
3551
+ get: function () { return chunkOQSYFH3Z_cjs.EXPORT_VARIANTS; }
3552
+ });
3553
+ Object.defineProperty(exports, "MAP_STATE_SEARCH_KEYS", {
3554
+ enumerable: true,
3555
+ get: function () { return chunkOQSYFH3Z_cjs.MAP_STATE_SEARCH_KEYS; }
3556
+ });
3557
+ Object.defineProperty(exports, "POI_GROUPS", {
3558
+ enumerable: true,
3559
+ get: function () { return chunkOQSYFH3Z_cjs.POI_GROUPS; }
3560
+ });
3561
+ Object.defineProperty(exports, "POI_GROUP_COUNT", {
3562
+ enumerable: true,
3563
+ get: function () { return chunkOQSYFH3Z_cjs.POI_GROUP_COUNT; }
3564
+ });
3565
+ Object.defineProperty(exports, "POI_GROUP_IDS", {
3566
+ enumerable: true,
3567
+ get: function () { return chunkOQSYFH3Z_cjs.POI_GROUP_IDS; }
3568
+ });
3569
+ Object.defineProperty(exports, "SPLIT_MIN_END_DISTANCE_METERS", {
3570
+ enumerable: true,
3571
+ get: function () { return chunkOQSYFH3Z_cjs.SPLIT_MIN_END_DISTANCE_METERS; }
3572
+ });
3573
+ Object.defineProperty(exports, "SPLIT_PICK_TOLERANCE_PX", {
3574
+ enumerable: true,
3575
+ get: function () { return chunkOQSYFH3Z_cjs.SPLIT_PICK_TOLERANCE_PX; }
3576
+ });
3577
+ Object.defineProperty(exports, "SUGGESTION_MAX_KEPT", {
3578
+ enumerable: true,
3579
+ get: function () { return chunkOQSYFH3Z_cjs.SUGGESTION_MAX_KEPT; }
3580
+ });
3581
+ Object.defineProperty(exports, "SUGGESTION_TARGET_COUNT", {
3582
+ enumerable: true,
3583
+ get: function () { return chunkOQSYFH3Z_cjs.SUGGESTION_TARGET_COUNT; }
3584
+ });
3585
+ Object.defineProperty(exports, "TIME_OFFSET_MAX_MINUTES", {
3586
+ enumerable: true,
3587
+ get: function () { return chunkOQSYFH3Z_cjs.TIME_OFFSET_MAX_MINUTES; }
3588
+ });
3589
+ Object.defineProperty(exports, "TIME_OFFSET_MIN_MINUTES", {
3590
+ enumerable: true,
3591
+ get: function () { return chunkOQSYFH3Z_cjs.TIME_OFFSET_MIN_MINUTES; }
3592
+ });
3593
+ Object.defineProperty(exports, "TIME_WINDOW_FUTURE_HOURS", {
3594
+ enumerable: true,
3595
+ get: function () { return chunkOQSYFH3Z_cjs.TIME_WINDOW_FUTURE_HOURS; }
3596
+ });
3597
+ Object.defineProperty(exports, "TIME_WINDOW_PAST_HOURS", {
3598
+ enumerable: true,
3599
+ get: function () { return chunkOQSYFH3Z_cjs.TIME_WINDOW_PAST_HOURS; }
3600
+ });
3601
+ Object.defineProperty(exports, "agentHandoffTarget", {
3602
+ enumerable: true,
3603
+ get: function () { return chunkOQSYFH3Z_cjs.agentHandoffTarget; }
3604
+ });
3605
+ Object.defineProperty(exports, "buildExportFilename", {
3606
+ enumerable: true,
3607
+ get: function () { return chunkOQSYFH3Z_cjs.buildExportFilename; }
3608
+ });
3609
+ Object.defineProperty(exports, "cameraBearingModeSchema", {
3610
+ enumerable: true,
3611
+ get: function () { return chunkOQSYFH3Z_cjs.cameraBearingModeSchema; }
3612
+ });
3613
+ Object.defineProperty(exports, "cameraFpsSchema", {
3614
+ enumerable: true,
3615
+ get: function () { return chunkOQSYFH3Z_cjs.cameraFpsSchema; }
3616
+ });
3617
+ Object.defineProperty(exports, "cameraModeSchema", {
3618
+ enumerable: true,
3619
+ get: function () { return chunkOQSYFH3Z_cjs.cameraModeSchema; }
3620
+ });
3621
+ Object.defineProperty(exports, "cameraOutputBaseSchema", {
3622
+ enumerable: true,
3623
+ get: function () { return chunkOQSYFH3Z_cjs.cameraOutputBaseSchema; }
3624
+ });
3625
+ Object.defineProperty(exports, "cameraOutputFormatSchema", {
3626
+ enumerable: true,
3627
+ get: function () { return chunkOQSYFH3Z_cjs.cameraOutputFormatSchema; }
3628
+ });
3629
+ Object.defineProperty(exports, "cameraOutputSchema", {
3630
+ enumerable: true,
3631
+ get: function () { return chunkOQSYFH3Z_cjs.cameraOutputSchema; }
3632
+ });
3633
+ Object.defineProperty(exports, "cameraPlanSchema", {
3634
+ enumerable: true,
3635
+ get: function () { return chunkOQSYFH3Z_cjs.cameraPlanSchema; }
3636
+ });
3637
+ Object.defineProperty(exports, "cameraResolutionSchema", {
3638
+ enumerable: true,
3639
+ get: function () { return chunkOQSYFH3Z_cjs.cameraResolutionSchema; }
3640
+ });
3641
+ Object.defineProperty(exports, "cameraShotBaseSchema", {
3642
+ enumerable: true,
3643
+ get: function () { return chunkOQSYFH3Z_cjs.cameraShotBaseSchema; }
3644
+ });
3645
+ Object.defineProperty(exports, "cameraShotSchema", {
3646
+ enumerable: true,
3647
+ get: function () { return chunkOQSYFH3Z_cjs.cameraShotSchema; }
3648
+ });
3649
+ Object.defineProperty(exports, "climbCategorySchema", {
3650
+ enumerable: true,
3651
+ get: function () { return chunkOQSYFH3Z_cjs.climbCategorySchema; }
3652
+ });
3653
+ Object.defineProperty(exports, "collabLockEntrySchema", {
3654
+ enumerable: true,
3655
+ get: function () { return chunkOQSYFH3Z_cjs.collabLockEntrySchema; }
3656
+ });
3657
+ Object.defineProperty(exports, "collabLockKey", {
3658
+ enumerable: true,
3659
+ get: function () { return chunkOQSYFH3Z_cjs.collabLockKey; }
3660
+ });
3661
+ Object.defineProperty(exports, "collabLockKindSchema", {
3662
+ enumerable: true,
3663
+ get: function () { return chunkOQSYFH3Z_cjs.collabLockKindSchema; }
3664
+ });
3665
+ Object.defineProperty(exports, "collabPeerColor", {
3666
+ enumerable: true,
3667
+ get: function () { return chunkOQSYFH3Z_cjs.collabPeerColor; }
3668
+ });
3669
+ Object.defineProperty(exports, "collabPeerColorIndex", {
3670
+ enumerable: true,
3671
+ get: function () { return chunkOQSYFH3Z_cjs.collabPeerColorIndex; }
3672
+ });
3673
+ Object.defineProperty(exports, "collabPresencePeerSchema", {
3674
+ enumerable: true,
3675
+ get: function () { return chunkOQSYFH3Z_cjs.collabPresencePeerSchema; }
3676
+ });
3677
+ Object.defineProperty(exports, "collabResourceKey", {
3678
+ enumerable: true,
3679
+ get: function () { return chunkOQSYFH3Z_cjs.collabResourceKey; }
3680
+ });
3681
+ Object.defineProperty(exports, "collabResourceKindSchema", {
3682
+ enumerable: true,
3683
+ get: function () { return chunkOQSYFH3Z_cjs.collabResourceKindSchema; }
3684
+ });
3685
+ Object.defineProperty(exports, "collabResourceSchema", {
3686
+ enumerable: true,
3687
+ get: function () { return chunkOQSYFH3Z_cjs.collabResourceSchema; }
3688
+ });
3689
+ Object.defineProperty(exports, "collectionsTargetSchema", {
3690
+ enumerable: true,
3691
+ get: function () { return chunkOQSYFH3Z_cjs.collectionsTargetSchema; }
3692
+ });
3693
+ Object.defineProperty(exports, "contextMenuSchema", {
3694
+ enumerable: true,
3695
+ get: function () { return chunkOQSYFH3Z_cjs.contextMenuSchema; }
3696
+ });
3697
+ Object.defineProperty(exports, "contextMenuZoneSchema", {
3698
+ enumerable: true,
3699
+ get: function () { return chunkOQSYFH3Z_cjs.contextMenuZoneSchema; }
3700
+ });
3701
+ Object.defineProperty(exports, "createMemoryViewer", {
3702
+ enumerable: true,
3703
+ get: function () { return chunkOQSYFH3Z_cjs.createMemoryViewer; }
3704
+ });
3705
+ Object.defineProperty(exports, "createStaticViewer", {
3706
+ enumerable: true,
3707
+ get: function () { return chunkOQSYFH3Z_cjs.createStaticViewer; }
3708
+ });
3709
+ Object.defineProperty(exports, "defaultSegmentGroupName", {
3710
+ enumerable: true,
3711
+ get: function () { return chunkOQSYFH3Z_cjs.defaultSegmentGroupName; }
3712
+ });
3713
+ Object.defineProperty(exports, "defaultSegmentName", {
3714
+ enumerable: true,
3715
+ get: function () { return chunkOQSYFH3Z_cjs.defaultSegmentName; }
3716
+ });
3717
+ Object.defineProperty(exports, "defaultVideoExportProfile", {
3718
+ enumerable: true,
3719
+ get: function () { return chunkOQSYFH3Z_cjs.defaultVideoExportProfile; }
3720
+ });
3721
+ Object.defineProperty(exports, "destinationPoint", {
3722
+ enumerable: true,
3723
+ get: function () { return chunkOQSYFH3Z_cjs.destinationPoint; }
3724
+ });
3725
+ Object.defineProperty(exports, "editingCollectionSchema", {
3726
+ enumerable: true,
3727
+ get: function () { return chunkOQSYFH3Z_cjs.editingCollectionSchema; }
3728
+ });
3729
+ Object.defineProperty(exports, "embedAuthSearchSchema", {
3730
+ enumerable: true,
3731
+ get: function () { return chunkOQSYFH3Z_cjs.embedAuthSearchSchema; }
3732
+ });
3733
+ Object.defineProperty(exports, "embedConfigSchema", {
3734
+ enumerable: true,
3735
+ get: function () { return chunkOQSYFH3Z_cjs.embedConfigSchema; }
3736
+ });
3737
+ Object.defineProperty(exports, "embedConfigSearchSchema", {
3738
+ enumerable: true,
3739
+ get: function () { return chunkOQSYFH3Z_cjs.embedConfigSearchSchema; }
3740
+ });
3741
+ Object.defineProperty(exports, "embedSearchSchema", {
3742
+ enumerable: true,
3743
+ get: function () { return chunkOQSYFH3Z_cjs.embedSearchSchema; }
3744
+ });
3745
+ Object.defineProperty(exports, "embedThemeSchema", {
3746
+ enumerable: true,
3747
+ get: function () { return chunkOQSYFH3Z_cjs.embedThemeSchema; }
3748
+ });
3749
+ Object.defineProperty(exports, "exportExtension", {
3750
+ enumerable: true,
3751
+ get: function () { return chunkOQSYFH3Z_cjs.exportExtension; }
3752
+ });
3753
+ Object.defineProperty(exports, "exportFileStem", {
3754
+ enumerable: true,
3755
+ get: function () { return chunkOQSYFH3Z_cjs.exportFileStem; }
3756
+ });
3757
+ Object.defineProperty(exports, "exportFormatVariants", {
3758
+ enumerable: true,
3759
+ get: function () { return chunkOQSYFH3Z_cjs.exportFormatVariants; }
3760
+ });
3761
+ Object.defineProperty(exports, "exportTargetSchema", {
3762
+ enumerable: true,
3763
+ get: function () { return chunkOQSYFH3Z_cjs.exportTargetSchema; }
3764
+ });
3765
+ Object.defineProperty(exports, "featureHitSchema", {
3766
+ enumerable: true,
3767
+ get: function () { return chunkOQSYFH3Z_cjs.featureHitSchema; }
3768
+ });
3769
+ Object.defineProperty(exports, "hexColorSchema", {
3770
+ enumerable: true,
3771
+ get: function () { return chunkOQSYFH3Z_cjs.hexColorSchema; }
3772
+ });
3773
+ Object.defineProperty(exports, "importReasonSentence", {
3774
+ enumerable: true,
3775
+ get: function () { return chunkOQSYFH3Z_cjs.importReasonSentence; }
3776
+ });
3777
+ Object.defineProperty(exports, "importWarningSentence", {
3778
+ enumerable: true,
3779
+ get: function () { return chunkOQSYFH3Z_cjs.importWarningSentence; }
3780
+ });
3781
+ Object.defineProperty(exports, "isDefaultSegmentName", {
3782
+ enumerable: true,
3783
+ get: function () { return chunkOQSYFH3Z_cjs.isDefaultSegmentName; }
3784
+ });
3785
+ Object.defineProperty(exports, "isWaypointEmail", {
3786
+ enumerable: true,
3787
+ get: function () { return chunkOQSYFH3Z_cjs.isWaypointEmail; }
3788
+ });
3789
+ Object.defineProperty(exports, "isWaypointPhone", {
3790
+ enumerable: true,
3791
+ get: function () { return chunkOQSYFH3Z_cjs.isWaypointPhone; }
3792
+ });
3793
+ Object.defineProperty(exports, "isWaypointPropertyKey", {
3794
+ enumerable: true,
3795
+ get: function () { return chunkOQSYFH3Z_cjs.isWaypointPropertyKey; }
3796
+ });
3797
+ Object.defineProperty(exports, "isWaypointWebUrl", {
3798
+ enumerable: true,
3799
+ get: function () { return chunkOQSYFH3Z_cjs.isWaypointWebUrl; }
3800
+ });
3801
+ Object.defineProperty(exports, "languageSchema", {
3802
+ enumerable: true,
3803
+ get: function () { return chunkOQSYFH3Z_cjs.languageSchema; }
3804
+ });
3805
+ Object.defineProperty(exports, "mapAlertSchema", {
3806
+ enumerable: true,
3807
+ get: function () { return chunkOQSYFH3Z_cjs.mapAlertSchema; }
3808
+ });
3809
+ Object.defineProperty(exports, "mapStateShape", {
3810
+ enumerable: true,
3811
+ get: function () { return chunkOQSYFH3Z_cjs.mapStateShape; }
3812
+ });
3813
+ Object.defineProperty(exports, "overlayFeatureSchema", {
3814
+ enumerable: true,
3815
+ get: function () { return chunkOQSYFH3Z_cjs.overlayFeatureSchema; }
3816
+ });
3817
+ Object.defineProperty(exports, "overlaySampleResultSchema", {
3818
+ enumerable: true,
3819
+ get: function () { return chunkOQSYFH3Z_cjs.overlaySampleResultSchema; }
3820
+ });
3821
+ Object.defineProperty(exports, "peerSegmentDraftsOf", {
3822
+ enumerable: true,
3823
+ get: function () { return chunkOQSYFH3Z_cjs.peerSegmentDraftsOf; }
3824
+ });
3825
+ Object.defineProperty(exports, "poiGroupIdSchema", {
3826
+ enumerable: true,
3827
+ get: function () { return chunkOQSYFH3Z_cjs.poiGroupIdSchema; }
3828
+ });
3829
+ Object.defineProperty(exports, "poiGroupSchema", {
3830
+ enumerable: true,
3831
+ get: function () { return chunkOQSYFH3Z_cjs.poiGroupSchema; }
3832
+ });
3833
+ Object.defineProperty(exports, "poiInfoSchema", {
3834
+ enumerable: true,
3835
+ get: function () { return chunkOQSYFH3Z_cjs.poiInfoSchema; }
3836
+ });
3837
+ Object.defineProperty(exports, "pointAtFraction", {
3838
+ enumerable: true,
3839
+ get: function () { return chunkOQSYFH3Z_cjs.pointAtFraction; }
3840
+ });
3841
+ Object.defineProperty(exports, "profileDesignSchema", {
3842
+ enumerable: true,
3843
+ get: function () { return chunkOQSYFH3Z_cjs.profileDesignSchema; }
3844
+ });
3845
+ Object.defineProperty(exports, "profileSheetSnapSchema", {
3846
+ enumerable: true,
3847
+ get: function () { return chunkOQSYFH3Z_cjs.profileSheetSnapSchema; }
3848
+ });
3849
+ Object.defineProperty(exports, "profileSourceSchema", {
3850
+ enumerable: true,
3851
+ get: function () { return chunkOQSYFH3Z_cjs.profileSourceSchema; }
3852
+ });
3853
+ Object.defineProperty(exports, "projectOnSegment", {
3854
+ enumerable: true,
3855
+ get: function () { return chunkOQSYFH3Z_cjs.projectOnSegment; }
3856
+ });
3857
+ Object.defineProperty(exports, "qualitySchema", {
3858
+ enumerable: true,
3859
+ get: function () { return chunkOQSYFH3Z_cjs.qualitySchema; }
3860
+ });
3861
+ Object.defineProperty(exports, "renumberDefaultSegments", {
3862
+ enumerable: true,
3863
+ get: function () { return chunkOQSYFH3Z_cjs.renumberDefaultSegments; }
3864
+ });
3865
+ Object.defineProperty(exports, "resolveEmbedConfig", {
3866
+ enumerable: true,
3867
+ get: function () { return chunkOQSYFH3Z_cjs.resolveEmbedConfig; }
3868
+ });
3869
+ Object.defineProperty(exports, "routeGeometrySchema", {
3870
+ enumerable: true,
3871
+ get: function () { return chunkOQSYFH3Z_cjs.routeGeometrySchema; }
3872
+ });
3873
+ Object.defineProperty(exports, "routeProfilePointSchema", {
3874
+ enumerable: true,
3875
+ get: function () { return chunkOQSYFH3Z_cjs.routeProfilePointSchema; }
3876
+ });
3877
+ Object.defineProperty(exports, "segmentGroupEditTargetSchema", {
3878
+ enumerable: true,
3879
+ get: function () { return chunkOQSYFH3Z_cjs.segmentGroupEditTargetSchema; }
3880
+ });
3881
+ Object.defineProperty(exports, "segmentLengthMeters", {
3882
+ enumerable: true,
3883
+ get: function () { return chunkOQSYFH3Z_cjs.segmentLengthMeters; }
3884
+ });
3885
+ Object.defineProperty(exports, "segmentSpanSchema", {
3886
+ enumerable: true,
3887
+ get: function () { return chunkOQSYFH3Z_cjs.segmentSpanSchema; }
3888
+ });
3889
+ Object.defineProperty(exports, "segmentSplitPickSchema", {
3890
+ enumerable: true,
3891
+ get: function () { return chunkOQSYFH3Z_cjs.segmentSplitPickSchema; }
3892
+ });
3893
+ Object.defineProperty(exports, "segmentsColorSchema", {
3894
+ enumerable: true,
3895
+ get: function () { return chunkOQSYFH3Z_cjs.segmentsColorSchema; }
3896
+ });
3897
+ Object.defineProperty(exports, "selectActiveEditEngine", {
3898
+ enumerable: true,
3899
+ get: function () { return chunkOQSYFH3Z_cjs.selectActiveEditEngine; }
3900
+ });
3901
+ Object.defineProperty(exports, "selectAgentEntityLocked", {
3902
+ enumerable: true,
3903
+ get: function () { return chunkOQSYFH3Z_cjs.selectAgentEntityLocked; }
3904
+ });
3905
+ Object.defineProperty(exports, "selectCollabLockHolder", {
3906
+ enumerable: true,
3907
+ get: function () { return chunkOQSYFH3Z_cjs.selectCollabLockHolder; }
3908
+ });
3909
+ Object.defineProperty(exports, "selectCollabLockHolderIds", {
3910
+ enumerable: true,
3911
+ get: function () { return chunkOQSYFH3Z_cjs.selectCollabLockHolderIds; }
3912
+ });
3913
+ Object.defineProperty(exports, "selectCollabPeerDrafts", {
3914
+ enumerable: true,
3915
+ get: function () { return chunkOQSYFH3Z_cjs.selectCollabPeerDrafts; }
3916
+ });
3917
+ Object.defineProperty(exports, "selectCollabPeers", {
3918
+ enumerable: true,
3919
+ get: function () { return chunkOQSYFH3Z_cjs.selectCollabPeers; }
3920
+ });
3921
+ Object.defineProperty(exports, "selectSegmentGroupEdit", {
3922
+ enumerable: true,
3923
+ get: function () { return chunkOQSYFH3Z_cjs.selectSegmentGroupEdit; }
3924
+ });
3925
+ Object.defineProperty(exports, "selectSegmentSplitPick", {
3926
+ enumerable: true,
3927
+ get: function () { return chunkOQSYFH3Z_cjs.selectSegmentSplitPick; }
3928
+ });
3929
+ Object.defineProperty(exports, "selectSuggestionSession", {
3930
+ enumerable: true,
3931
+ get: function () { return chunkOQSYFH3Z_cjs.selectSuggestionSession; }
3932
+ });
3933
+ Object.defineProperty(exports, "selectedCandidate", {
3934
+ enumerable: true,
3935
+ get: function () { return chunkOQSYFH3Z_cjs.selectedCandidate; }
3936
+ });
3937
+ Object.defineProperty(exports, "shareSearchSchema", {
3938
+ enumerable: true,
3939
+ get: function () { return chunkOQSYFH3Z_cjs.shareSearchSchema; }
3940
+ });
3941
+ Object.defineProperty(exports, "splitSegmentNames", {
3942
+ enumerable: true,
3943
+ get: function () { return chunkOQSYFH3Z_cjs.splitSegmentNames; }
3944
+ });
3945
+ Object.defineProperty(exports, "streetviewPositionSchema", {
3946
+ enumerable: true,
3947
+ get: function () { return chunkOQSYFH3Z_cjs.streetviewPositionSchema; }
3948
+ });
3949
+ Object.defineProperty(exports, "studioAlertCodeSchema", {
3950
+ enumerable: true,
3951
+ get: function () { return chunkOQSYFH3Z_cjs.studioAlertCodeSchema; }
3952
+ });
3953
+ Object.defineProperty(exports, "studioContentSchema", {
3954
+ enumerable: true,
3955
+ get: function () { return chunkOQSYFH3Z_cjs.studioContentSchema; }
3956
+ });
3957
+ Object.defineProperty(exports, "studioEntitlementSchema", {
3958
+ enumerable: true,
3959
+ get: function () { return chunkOQSYFH3Z_cjs.studioEntitlementSchema; }
3960
+ });
3961
+ Object.defineProperty(exports, "studioMapStateSearchSchema", {
3962
+ enumerable: true,
3963
+ get: function () { return chunkOQSYFH3Z_cjs.studioMapStateSearchSchema; }
3964
+ });
3965
+ Object.defineProperty(exports, "studioModalSchema", {
3966
+ enumerable: true,
3967
+ get: function () { return chunkOQSYFH3Z_cjs.studioModalSchema; }
3968
+ });
3969
+ Object.defineProperty(exports, "studioPanelSchema", {
3970
+ enumerable: true,
3971
+ get: function () { return chunkOQSYFH3Z_cjs.studioPanelSchema; }
3972
+ });
3973
+ Object.defineProperty(exports, "studioToolContracts", {
3974
+ enumerable: true,
3975
+ get: function () { return chunkOQSYFH3Z_cjs.studioToolContracts; }
3976
+ });
3977
+ Object.defineProperty(exports, "suggestRouteTypeSchema", {
3978
+ enumerable: true,
3979
+ get: function () { return chunkOQSYFH3Z_cjs.suggestRouteTypeSchema; }
3980
+ });
3981
+ Object.defineProperty(exports, "synthesizeDraftWaypoint", {
3982
+ enumerable: true,
3983
+ get: function () { return chunkOQSYFH3Z_cjs.synthesizeDraftWaypoint; }
3984
+ });
3985
+ Object.defineProperty(exports, "terrainVariantSchema", {
3986
+ enumerable: true,
3987
+ get: function () { return chunkOQSYFH3Z_cjs.terrainVariantSchema; }
3988
+ });
3989
+ Object.defineProperty(exports, "themeSchema", {
3990
+ enumerable: true,
3991
+ get: function () { return chunkOQSYFH3Z_cjs.themeSchema; }
3992
+ });
3993
+ Object.defineProperty(exports, "timeSliderWindow", {
3994
+ enumerable: true,
3995
+ get: function () { return chunkOQSYFH3Z_cjs.timeSliderWindow; }
3996
+ });
3997
+ Object.defineProperty(exports, "unitLengthSchema", {
3998
+ enumerable: true,
3999
+ get: function () { return chunkOQSYFH3Z_cjs.unitLengthSchema; }
4000
+ });
4001
+ Object.defineProperty(exports, "unitPaceSchema", {
4002
+ enumerable: true,
4003
+ get: function () { return chunkOQSYFH3Z_cjs.unitPaceSchema; }
4004
+ });
4005
+ Object.defineProperty(exports, "unitSlopeSchema", {
4006
+ enumerable: true,
4007
+ get: function () { return chunkOQSYFH3Z_cjs.unitSlopeSchema; }
4008
+ });
4009
+ Object.defineProperty(exports, "unitTemperatureSchema", {
4010
+ enumerable: true,
4011
+ get: function () { return chunkOQSYFH3Z_cjs.unitTemperatureSchema; }
4012
+ });
4013
+ Object.defineProperty(exports, "urlBoolean", {
4014
+ enumerable: true,
4015
+ get: function () { return chunkOQSYFH3Z_cjs.urlBoolean; }
4016
+ });
4017
+ Object.defineProperty(exports, "userWaypointIconSchema", {
4018
+ enumerable: true,
4019
+ get: function () { return chunkOQSYFH3Z_cjs.userWaypointIconSchema; }
4020
+ });
4021
+ Object.defineProperty(exports, "videoExportProfileSchema", {
4022
+ enumerable: true,
4023
+ get: function () { return chunkOQSYFH3Z_cjs.videoExportProfileSchema; }
4024
+ });
4025
+ Object.defineProperty(exports, "videoExportSchema", {
4026
+ enumerable: true,
4027
+ get: function () { return chunkOQSYFH3Z_cjs.videoExportSchema; }
4028
+ });
4029
+ Object.defineProperty(exports, "videoExportStatusSchema", {
4030
+ enumerable: true,
4031
+ get: function () { return chunkOQSYFH3Z_cjs.videoExportStatusSchema; }
4032
+ });
4033
+ Object.defineProperty(exports, "videoPresetSchema", {
4034
+ enumerable: true,
4035
+ get: function () { return chunkOQSYFH3Z_cjs.videoPresetSchema; }
4036
+ });
4037
+ Object.defineProperty(exports, "waypointAmenitySchema", {
4038
+ enumerable: true,
4039
+ get: function () { return chunkOQSYFH3Z_cjs.waypointAmenitySchema; }
4040
+ });
4041
+ Object.defineProperty(exports, "waypointDetailLimits", {
4042
+ enumerable: true,
4043
+ get: function () { return chunkOQSYFH3Z_cjs.waypointDetailLimits; }
4044
+ });
4045
+ Object.defineProperty(exports, "waypointDraftSchema", {
4046
+ enumerable: true,
4047
+ get: function () { return chunkOQSYFH3Z_cjs.waypointDraftSchema; }
4048
+ });
4049
+ Object.defineProperty(exports, "waypointEditIntentSchema", {
4050
+ enumerable: true,
4051
+ get: function () { return chunkOQSYFH3Z_cjs.waypointEditIntentSchema; }
4052
+ });
4053
+ Object.defineProperty(exports, "waypointEditModeSchema", {
4054
+ enumerable: true,
4055
+ get: function () { return chunkOQSYFH3Z_cjs.waypointEditModeSchema; }
4056
+ });
4057
+ Object.defineProperty(exports, "waypointIconSchema", {
4058
+ enumerable: true,
4059
+ get: function () { return chunkOQSYFH3Z_cjs.waypointIconSchema; }
4060
+ });
4061
+ Object.defineProperty(exports, "waypointPoiSeedSchema", {
4062
+ enumerable: true,
4063
+ get: function () { return chunkOQSYFH3Z_cjs.waypointPoiSeedSchema; }
4064
+ });
4065
+ Object.defineProperty(exports, "waypointPropertyFormatSchema", {
4066
+ enumerable: true,
4067
+ get: function () { return chunkOQSYFH3Z_cjs.waypointPropertyFormatSchema; }
4068
+ });
4069
+ Object.defineProperty(exports, "waypointPropertyValueMatchesFormat", {
4070
+ enumerable: true,
4071
+ get: function () { return chunkOQSYFH3Z_cjs.waypointPropertyValueMatchesFormat; }
4072
+ });
4073
+ Object.defineProperty(exports, "wrapZoneGeometryPastRange", {
4074
+ enumerable: true,
4075
+ get: function () { return chunkOQSYFH3Z_cjs.wrapZoneGeometryPastRange; }
4076
+ });
4077
+ Object.defineProperty(exports, "zoneCircleGeometry", {
4078
+ enumerable: true,
4079
+ get: function () { return chunkOQSYFH3Z_cjs.zoneCircleGeometry; }
4080
+ });
4081
+ Object.defineProperty(exports, "zoneCircleParamsSchema", {
4082
+ enumerable: true,
4083
+ get: function () { return chunkOQSYFH3Z_cjs.zoneCircleParamsSchema; }
4084
+ });
4085
+ Object.defineProperty(exports, "zoneCreateMethodSchema", {
4086
+ enumerable: true,
4087
+ get: function () { return chunkOQSYFH3Z_cjs.zoneCreateMethodSchema; }
4088
+ });
4089
+ Object.defineProperty(exports, "zoneEditBeginSchema", {
4090
+ enumerable: true,
4091
+ get: function () { return chunkOQSYFH3Z_cjs.zoneEditBeginSchema; }
4092
+ });
4093
+ Object.defineProperty(exports, "zoneEditLevelSchema", {
4094
+ enumerable: true,
4095
+ get: function () { return chunkOQSYFH3Z_cjs.zoneEditLevelSchema; }
4096
+ });
4097
+ Object.defineProperty(exports, "zoneEditModeSchema", {
4098
+ enumerable: true,
4099
+ get: function () { return chunkOQSYFH3Z_cjs.zoneEditModeSchema; }
4100
+ });
4101
+ Object.defineProperty(exports, "zonePreviewQueryKey", {
4102
+ enumerable: true,
4103
+ get: function () { return chunkOQSYFH3Z_cjs.zonePreviewQueryKey; }
4104
+ });
4105
+ Object.defineProperty(exports, "zoneReachPole", {
4106
+ enumerable: true,
4107
+ get: function () { return chunkOQSYFH3Z_cjs.zoneReachPole; }
4108
+ });
4109
+ Object.defineProperty(exports, "zoneSectorGeometry", {
4110
+ enumerable: true,
4111
+ get: function () { return chunkOQSYFH3Z_cjs.zoneSectorGeometry; }
4112
+ });
4113
+ Object.defineProperty(exports, "zoneSectorParamsSchema", {
4114
+ enumerable: true,
4115
+ get: function () { return chunkOQSYFH3Z_cjs.zoneSectorParamsSchema; }
4116
+ });
4117
+ Object.defineProperty(exports, "zoneSensorGeometry", {
4118
+ enumerable: true,
4119
+ get: function () { return chunkOQSYFH3Z_cjs.zoneSensorGeometry; }
4120
+ });
4121
+ Object.defineProperty(exports, "zoneSensorParamsSchema", {
4122
+ enumerable: true,
4123
+ get: function () { return chunkOQSYFH3Z_cjs.zoneSensorParamsSchema; }
4124
+ });
4125
+ Object.defineProperty(exports, "ITINERARY_FIT_MAX_ZOOM", {
4126
+ enumerable: true,
4127
+ get: function () { return chunkEKZWV6RS_cjs.ITINERARY_FIT_MAX_ZOOM; }
4128
+ });
4129
+ Object.defineProperty(exports, "ZONE_PREVIEW_DEBOUNCE_MS", {
4130
+ enumerable: true,
4131
+ get: function () { return chunkEKZWV6RS_cjs.ZONE_PREVIEW_DEBOUNCE_MS; }
4132
+ });
4133
+ Object.defineProperty(exports, "activityForId", {
4134
+ enumerable: true,
4135
+ get: function () { return chunkEKZWV6RS_cjs.activityForId; }
4136
+ });
4137
+ Object.defineProperty(exports, "availableEnginesForActivity", {
4138
+ enumerable: true,
4139
+ get: function () { return chunkEKZWV6RS_cjs.availableEnginesForActivity; }
4140
+ });
4141
+ Object.defineProperty(exports, "canEditItinerary", {
4142
+ enumerable: true,
4143
+ get: function () { return chunkEKZWV6RS_cjs.canEditItinerary; }
4144
+ });
4145
+ Object.defineProperty(exports, "canEditOwnedResource", {
4146
+ enumerable: true,
4147
+ get: function () { return chunkEKZWV6RS_cjs.canEditOwnedResource; }
4148
+ });
4149
+ Object.defineProperty(exports, "clampSeedPoint", {
4150
+ enumerable: true,
4151
+ get: function () { return chunkEKZWV6RS_cjs.clampSeedPoint; }
4152
+ });
4153
+ Object.defineProperty(exports, "defaultEngineForActivity", {
4154
+ enumerable: true,
4155
+ get: function () { return chunkEKZWV6RS_cjs.defaultEngineForActivity; }
4156
+ });
4157
+ Object.defineProperty(exports, "defaultSpeedForActivity", {
4158
+ enumerable: true,
4159
+ get: function () { return chunkEKZWV6RS_cjs.defaultSpeedForActivity; }
4160
+ });
4161
+ Object.defineProperty(exports, "firstActivityId", {
4162
+ enumerable: true,
4163
+ get: function () { return chunkEKZWV6RS_cjs.firstActivityId; }
4164
+ });
4165
+ Object.defineProperty(exports, "isRetryableShareLinkFailure", {
4166
+ enumerable: true,
4167
+ get: function () { return chunkEKZWV6RS_cjs.isRetryableShareLinkFailure; }
4168
+ });
4169
+ Object.defineProperty(exports, "isShareLinkDisableSettled", {
4170
+ enumerable: true,
4171
+ get: function () { return chunkEKZWV6RS_cjs.isShareLinkDisableSettled; }
4172
+ });
4173
+ Object.defineProperty(exports, "isZoneMetadataDirty", {
4174
+ enumerable: true,
4175
+ get: function () { return chunkEKZWV6RS_cjs.isZoneMetadataDirty; }
4176
+ });
4177
+ Object.defineProperty(exports, "seedFromCoordinates", {
4178
+ enumerable: true,
4179
+ get: function () { return chunkEKZWV6RS_cjs.seedFromCoordinates; }
4180
+ });
4181
+ Object.defineProperty(exports, "seedFromPersistedSegment", {
4182
+ enumerable: true,
4183
+ get: function () { return chunkEKZWV6RS_cjs.seedFromPersistedSegment; }
4184
+ });
4185
+ Object.defineProperty(exports, "shareLinkActions", {
4186
+ enumerable: true,
4187
+ get: function () { return chunkEKZWV6RS_cjs.shareLinkActions; }
4188
+ });
4189
+ Object.defineProperty(exports, "shareLinkScope", {
4190
+ enumerable: true,
4191
+ get: function () { return chunkEKZWV6RS_cjs.shareLinkScope; }
4192
+ });
4193
+ Object.defineProperty(exports, "simplifyToVias", {
4194
+ enumerable: true,
4195
+ get: function () { return chunkEKZWV6RS_cjs.simplifyToVias; }
4196
+ });
4197
+ Object.defineProperty(exports, "zoneAutoName", {
4198
+ enumerable: true,
4199
+ get: function () { return chunkEKZWV6RS_cjs.zoneAutoName; }
4200
+ });
4201
+ Object.defineProperty(exports, "zoneSaveRequest", {
4202
+ enumerable: true,
4203
+ get: function () { return chunkEKZWV6RS_cjs.zoneSaveRequest; }
4204
+ });
4205
+ Object.defineProperty(exports, "CAMERA_MESSAGE", {
4206
+ enumerable: true,
4207
+ get: function () { return chunkIDBXFBLG_cjs.CAMERA_MESSAGE; }
4208
+ });
4209
+ Object.defineProperty(exports, "DEFAULT_ZONE_CREATE_METHOD", {
4210
+ enumerable: true,
4211
+ get: function () { return chunkIDBXFBLG_cjs.DEFAULT_ZONE_CREATE_METHOD; }
4212
+ });
4213
+ Object.defineProperty(exports, "DEFAULT_ZONE_LEVEL", {
4214
+ enumerable: true,
4215
+ get: function () { return chunkIDBXFBLG_cjs.DEFAULT_ZONE_LEVEL; }
4216
+ });
4217
+ Object.defineProperty(exports, "DEFAULT_ZONE_MODE", {
4218
+ enumerable: true,
4219
+ get: function () { return chunkIDBXFBLG_cjs.DEFAULT_ZONE_MODE; }
4220
+ });
4221
+ Object.defineProperty(exports, "DESCRIPTION_MAX_LENGTH", {
4222
+ enumerable: true,
4223
+ get: function () { return chunkIDBXFBLG_cjs.DESCRIPTION_MAX_LENGTH; }
4224
+ });
4225
+ Object.defineProperty(exports, "DISPLAY_NAME_MAX_LENGTH", {
4226
+ enumerable: true,
4227
+ get: function () { return chunkIDBXFBLG_cjs.DISPLAY_NAME_MAX_LENGTH; }
4228
+ });
4229
+ Object.defineProperty(exports, "DISPLAY_NAME_MIN_LENGTH", {
4230
+ enumerable: true,
4231
+ get: function () { return chunkIDBXFBLG_cjs.DISPLAY_NAME_MIN_LENGTH; }
4232
+ });
4233
+ Object.defineProperty(exports, "READY_MESSAGE", {
4234
+ enumerable: true,
4235
+ get: function () { return chunkIDBXFBLG_cjs.READY_MESSAGE; }
4236
+ });
4237
+ Object.defineProperty(exports, "REQUEST_CAMERA_MESSAGE", {
4238
+ enumerable: true,
4239
+ get: function () { return chunkIDBXFBLG_cjs.REQUEST_CAMERA_MESSAGE; }
4240
+ });
4241
+ Object.defineProperty(exports, "REQUEST_SESSION_TOKEN_MESSAGE", {
4242
+ enumerable: true,
4243
+ get: function () { return chunkIDBXFBLG_cjs.REQUEST_SESSION_TOKEN_MESSAGE; }
4244
+ });
4245
+ Object.defineProperty(exports, "SET_ITINERARY_MESSAGE", {
4246
+ enumerable: true,
4247
+ get: function () { return chunkIDBXFBLG_cjs.SET_ITINERARY_MESSAGE; }
4248
+ });
4249
+ Object.defineProperty(exports, "SET_SESSION_TOKEN_MESSAGE", {
4250
+ enumerable: true,
4251
+ get: function () { return chunkIDBXFBLG_cjs.SET_SESSION_TOKEN_MESSAGE; }
4252
+ });
4253
+ Object.defineProperty(exports, "activeStudioScope", {
4254
+ enumerable: true,
4255
+ get: function () { return chunkIDBXFBLG_cjs.activeStudioScope; }
4256
+ });
4257
+ Object.defineProperty(exports, "buildShareSearch", {
4258
+ enumerable: true,
4259
+ get: function () { return chunkIDBXFBLG_cjs.buildShareSearch; }
4260
+ });
4261
+ Object.defineProperty(exports, "buildShareSrc", {
4262
+ enumerable: true,
4263
+ get: function () { return chunkIDBXFBLG_cjs.buildShareSrc; }
4264
+ });
4265
+ Object.defineProperty(exports, "cameraMessageSchema", {
4266
+ enumerable: true,
4267
+ get: function () { return chunkIDBXFBLG_cjs.cameraMessageSchema; }
4268
+ });
4269
+ Object.defineProperty(exports, "defaultStudioScope", {
4270
+ enumerable: true,
4271
+ get: function () { return chunkIDBXFBLG_cjs.defaultStudioScope; }
4272
+ });
4273
+ Object.defineProperty(exports, "descriptionSchema", {
4274
+ enumerable: true,
4275
+ get: function () { return chunkIDBXFBLG_cjs.descriptionSchema; }
4276
+ });
4277
+ Object.defineProperty(exports, "displayNameSchema", {
4278
+ enumerable: true,
4279
+ get: function () { return chunkIDBXFBLG_cjs.displayNameSchema; }
4280
+ });
4281
+ Object.defineProperty(exports, "draftActivityInput", {
4282
+ enumerable: true,
4283
+ get: function () { return chunkIDBXFBLG_cjs.draftActivityInput; }
4284
+ });
4285
+ Object.defineProperty(exports, "draftCollectionsInput", {
4286
+ enumerable: true,
4287
+ get: function () { return chunkIDBXFBLG_cjs.draftCollectionsInput; }
4288
+ });
4289
+ Object.defineProperty(exports, "draftNameInput", {
4290
+ enumerable: true,
4291
+ get: function () { return chunkIDBXFBLG_cjs.draftNameInput; }
4292
+ });
4293
+ Object.defineProperty(exports, "draftOrganizationInput", {
4294
+ enumerable: true,
4295
+ get: function () { return chunkIDBXFBLG_cjs.draftOrganizationInput; }
4296
+ });
4297
+ Object.defineProperty(exports, "draftPositionCount", {
4298
+ enumerable: true,
4299
+ get: function () { return chunkIDBXFBLG_cjs.draftPositionCount; }
4300
+ });
4301
+ Object.defineProperty(exports, "draftPrivateInput", {
4302
+ enumerable: true,
4303
+ get: function () { return chunkIDBXFBLG_cjs.draftPrivateInput; }
4304
+ });
4305
+ Object.defineProperty(exports, "fitDisplayName", {
4306
+ enumerable: true,
4307
+ get: function () { return chunkIDBXFBLG_cjs.fitDisplayName; }
4308
+ });
4309
+ Object.defineProperty(exports, "inboundBridgeMessageSchema", {
4310
+ enumerable: true,
4311
+ get: function () { return chunkIDBXFBLG_cjs.inboundBridgeMessageSchema; }
4312
+ });
4313
+ Object.defineProperty(exports, "isPublishableScope", {
4314
+ enumerable: true,
4315
+ get: function () { return chunkIDBXFBLG_cjs.isPublishableScope; }
4316
+ });
4317
+ Object.defineProperty(exports, "mapBoundsSchema", {
4318
+ enumerable: true,
4319
+ get: function () { return chunkIDBXFBLG_cjs.mapBoundsSchema; }
4320
+ });
4321
+ Object.defineProperty(exports, "readyErrorSchema", {
4322
+ enumerable: true,
4323
+ get: function () { return chunkIDBXFBLG_cjs.readyErrorSchema; }
4324
+ });
4325
+ Object.defineProperty(exports, "readyMessageSchema", {
4326
+ enumerable: true,
4327
+ get: function () { return chunkIDBXFBLG_cjs.readyMessageSchema; }
4328
+ });
4329
+ Object.defineProperty(exports, "renumber", {
4330
+ enumerable: true,
4331
+ get: function () { return chunkIDBXFBLG_cjs.renumber; }
4332
+ });
4333
+ Object.defineProperty(exports, "requestCameraMessageSchema", {
4334
+ enumerable: true,
4335
+ get: function () { return chunkIDBXFBLG_cjs.requestCameraMessageSchema; }
4336
+ });
4337
+ Object.defineProperty(exports, "requestSessionTokenMessageSchema", {
4338
+ enumerable: true,
4339
+ get: function () { return chunkIDBXFBLG_cjs.requestSessionTokenMessageSchema; }
4340
+ });
4341
+ Object.defineProperty(exports, "requireWritableScope", {
4342
+ enumerable: true,
4343
+ get: function () { return chunkIDBXFBLG_cjs.requireWritableScope; }
4344
+ });
4345
+ Object.defineProperty(exports, "resolveActivity", {
4346
+ enumerable: true,
4347
+ get: function () { return chunkIDBXFBLG_cjs.resolveActivity; }
4348
+ });
4349
+ Object.defineProperty(exports, "segmentEditModeSchema", {
4350
+ enumerable: true,
4351
+ get: function () { return chunkIDBXFBLG_cjs.segmentEditModeSchema; }
4352
+ });
4353
+ Object.defineProperty(exports, "segmentInsertAnchorSchema", {
4354
+ enumerable: true,
4355
+ get: function () { return chunkIDBXFBLG_cjs.segmentInsertAnchorSchema; }
4356
+ });
4357
+ Object.defineProperty(exports, "setSessionTokenMessageSchema", {
4358
+ enumerable: true,
4359
+ get: function () { return chunkIDBXFBLG_cjs.setSessionTokenMessageSchema; }
4360
+ });
4361
+ Object.defineProperty(exports, "shareLinkTargetSchema", {
4362
+ enumerable: true,
4363
+ get: function () { return chunkIDBXFBLG_cjs.shareLinkTargetSchema; }
4364
+ });
4365
+ Object.defineProperty(exports, "substituteLiveSegment", {
4366
+ enumerable: true,
4367
+ get: function () { return chunkIDBXFBLG_cjs.substituteLiveSegment; }
4368
+ });
4369
+ Object.defineProperty(exports, "switchOverridesSchema", {
4370
+ enumerable: true,
4371
+ get: function () { return chunkIDBXFBLG_cjs.switchOverridesSchema; }
4372
+ });
4373
+ Object.defineProperty(exports, "synthesizeDraftSegment", {
4374
+ enumerable: true,
4375
+ get: function () { return chunkIDBXFBLG_cjs.synthesizeDraftSegment; }
4376
+ });
4377
+ Object.defineProperty(exports, "toolNoDataSchema", {
4378
+ enumerable: true,
4379
+ get: function () { return chunkIDBXFBLG_cjs.toolNoDataSchema; }
4380
+ });
4381
+ Object.defineProperty(exports, "zoneDescriptionSchema", {
4382
+ enumerable: true,
4383
+ get: function () { return chunkIDBXFBLG_cjs.zoneDescriptionSchema; }
4384
+ });
4385
+ Object.defineProperty(exports, "zoneNameSchema", {
4386
+ enumerable: true,
4387
+ get: function () { return chunkIDBXFBLG_cjs.zoneNameSchema; }
4388
+ });
4389
+ Object.defineProperty(exports, "isConfirmationWithheld", {
4390
+ enumerable: true,
4391
+ get: function () { return chunkEOKRXXAC_cjs.isConfirmationWithheld; }
4392
+ });
4393
+ Object.defineProperty(exports, "codeForThrown", {
4394
+ enumerable: true,
4395
+ get: function () { return chunkQL63MUEW_cjs.codeForThrown; }
4396
+ });
4397
+ Object.defineProperty(exports, "failureFromThrown", {
4398
+ enumerable: true,
4399
+ get: function () { return chunkQL63MUEW_cjs.failureFromThrown; }
4400
+ });
4401
+ Object.defineProperty(exports, "restStatusCodes", {
4402
+ enumerable: true,
4403
+ get: function () { return chunkQL63MUEW_cjs.restStatusCodes; }
4404
+ });
4405
+ Object.defineProperty(exports, "overlayInstant", {
4406
+ enumerable: true,
4407
+ get: function () { return layers.overlayInstant; }
4408
+ });
4409
+ Object.defineProperty(exports, "timestampedSources", {
4410
+ enumerable: true,
4411
+ get: function () { return layers.timestampedSources; }
4412
+ });
4413
+ exports.DEFAULT_HOLD_MS = DEFAULT_HOLD_MS;
4414
+ exports.DEFAULT_SHOT_PITCH_DEG = DEFAULT_SHOT_PITCH_DEG;
4415
+ exports.DEFAULT_SHOT_ZOOM = DEFAULT_SHOT_ZOOM;
4416
+ exports.EMBED_CONFIG_FIELDS = EMBED_CONFIG_FIELDS;
4417
+ exports.EMBED_ELEMENTS = EMBED_ELEMENTS;
4418
+ exports.EMBED_IFRAME_RADIUS_PX = EMBED_IFRAME_RADIUS_PX;
4419
+ exports.EMBED_SECTION_ORDER = EMBED_SECTION_ORDER;
4420
+ exports.EMBED_SEGMENT_TABLE_COLUMNS = EMBED_SEGMENT_TABLE_COLUMNS;
4421
+ exports.EMBED_SESSION_ENDPOINT = EMBED_SESSION_ENDPOINT;
4422
+ exports.EMBED_TABLE_INSTALL_COMMAND = EMBED_TABLE_INSTALL_COMMAND;
4423
+ exports.EMBED_WAYPOINT_TABLE_COLUMNS = EMBED_WAYPOINT_TABLE_COLUMNS;
4424
+ exports.EMPTY_SEGMENTS = EMPTY_SEGMENTS;
4425
+ exports.IMPORT_FILE_FORMATS = IMPORT_FILE_FORMATS;
4426
+ exports.IMPORT_FILE_MAX_SIZE = IMPORT_FILE_MAX_SIZE;
4427
+ exports.PREVIEW_PLAN_REFRESH_DEBOUNCE_MS = PREVIEW_PLAN_REFRESH_DEBOUNCE_MS;
4428
+ exports.REACHABILITY_GLYPH = REACHABILITY_GLYPH;
4429
+ exports.SOCIAL_SHARE_TARGETS = SOCIAL_SHARE_TARGETS;
4430
+ exports.StudioPersistenceRefusedError = StudioPersistenceRefusedError;
4431
+ exports.VIDEO_STEP_ORDER = VIDEO_STEP_ORDER;
4432
+ exports.WAYPOINT_SECTIONS = WAYPOINT_SECTIONS;
4433
+ exports.ZONE_TIME_REFERENCE_INTERVAL_MS = ZONE_TIME_REFERENCE_INTERVAL_MS;
4434
+ exports.activeSegmentLines = activeSegmentLines;
4435
+ exports.applyEmbedOverrides = applyEmbedOverrides;
4436
+ exports.beginDraftSegmentEdit = beginDraftSegmentEdit;
4437
+ exports.buildEmbedIframe = buildEmbedIframe;
4438
+ exports.buildEmbedSearch = buildEmbedSearch;
4439
+ exports.buildEmbedSessionScript = buildEmbedSessionScript;
4440
+ exports.buildEmbedSrc = buildEmbedSrc;
4441
+ exports.buildEmbedTableCode = buildEmbedTableCode;
4442
+ exports.buildEmbedViewHash = buildEmbedViewHash;
4443
+ exports.buildSegmentChainMerges = buildSegmentChainMerges;
4444
+ exports.buildSegmentEditCommitInput = buildSegmentEditCommitInput;
4445
+ exports.buildSegmentGroupRuns = buildSegmentGroupRuns;
4446
+ exports.buildShareText = buildShareText;
4447
+ exports.buildShareViewConfig = buildShareViewConfig;
4448
+ exports.canDeleteCollection = canDeleteCollection;
4449
+ exports.canEditCollection = canEditCollection;
4450
+ exports.canEditCollectionMetadata = canEditCollectionMetadata;
4451
+ exports.clampConfigToAllowlists = clampConfigToAllowlists;
4452
+ exports.clampConfigToFieldDependencies = clampConfigToFieldDependencies;
4453
+ exports.clampEmbedConfigToSecurity = clampEmbedConfigToSecurity;
4454
+ exports.clampStudioConfigToSafetyRules = clampStudioConfigToSafetyRules;
4455
+ exports.collectionCreateScope = collectionCreateScope;
4456
+ exports.collectionFormSchema = collectionFormSchema;
4457
+ exports.contextMenuReadout = contextMenuReadout;
4458
+ exports.createFormChanged = createFormChanged;
4459
+ exports.createPlatformViewer = createPlatformViewer;
4460
+ exports.createSearchFetch = createSearchFetch;
4461
+ exports.defaultEmbedTableOptions = defaultEmbedTableOptions;
4462
+ exports.defaultStudioConfig = defaultStudioConfig;
4463
+ exports.defaultWaypointName = defaultWaypointName;
4464
+ exports.defineRegistry = defineRegistry;
4465
+ exports.detectFileProvider = detectFileProvider;
4466
+ exports.displaySeedDispatches = displaySeedDispatches;
4467
+ exports.draftFromWaypoint = draftFromWaypoint;
4468
+ exports.draftGeometries = draftGeometries;
4469
+ exports.drawnByItinerary = drawnByItinerary;
4470
+ exports.editHijacksNativeShortcut = editHijacksNativeShortcut;
4471
+ exports.editKeyIntent = editKeyIntent;
4472
+ exports.editShortcuts = editShortcuts;
4473
+ exports.editToolName = editToolName;
4474
+ exports.editorItineraryView = editorItineraryView;
4475
+ exports.embedConfigToStudioConfig = embedConfigToStudioConfig;
4476
+ exports.embedElementSectionFields = embedElementSectionFields;
4477
+ exports.embedElementSections = embedElementSections;
4478
+ exports.embedElementSupportsField = embedElementSupportsField;
4479
+ exports.embedFieldDependencies = embedFieldDependencies;
4480
+ exports.embedLayerOptions = embedLayerOptions;
4481
+ exports.embedSectionChanges = embedSectionChanges;
4482
+ exports.embedSectionFieldKeys = embedSectionFieldKeys;
4483
+ exports.embedTableChanges = embedTableChanges;
4484
+ exports.embedTableColumns = embedTableColumns;
4485
+ exports.enumFieldOptions = enumFieldOptions;
4486
+ exports.extractOverlayBand = extractOverlayBand;
4487
+ exports.fieldDependenciesUnmet = fieldDependenciesUnmet;
4488
+ exports.firstSegmentEditInput = firstSegmentEditInput;
4489
+ exports.generateFriendlyName = generateFriendlyName;
4490
+ exports.importDropzoneAccept = importDropzoneAccept;
4491
+ exports.importSegmentCounts = importSegmentCounts;
4492
+ exports.inertStudioUrlSeam = inertStudioUrlSeam;
4493
+ exports.inertViewer = inertViewer;
4494
+ exports.isEmbedTableElement = isEmbedTableElement;
4495
+ exports.isLoopbackDomain = isLoopbackDomain;
4496
+ exports.isStudioSessionToken = isStudioSessionToken;
4497
+ exports.itineraryCeiling = itineraryCeiling;
4498
+ exports.itineraryClickTarget = itineraryClickTarget;
4499
+ exports.itineraryEmphasisFor = itineraryEmphasisFor;
4500
+ exports.itineraryLayerIdsOf = itineraryLayerIdsOf;
4501
+ exports.itinerarySpriteIcons = itinerarySpriteIcons;
4502
+ exports.itineraryTileFeature = itineraryTileFeature;
4503
+ exports.lateBoundTools = lateBoundTools;
4504
+ exports.layersControlOffered = layersControlOffered;
4505
+ exports.localStudioPersistence = localStudioPersistence;
4506
+ exports.mapInteractionScope = mapInteractionScope;
4507
+ exports.memoryStudioPersistence = memoryStudioPersistence;
4508
+ exports.mintRowId = mintRowId;
4509
+ exports.nextPropertyKey = nextPropertyKey;
4510
+ exports.nextWaypointDefaultName = nextWaypointDefaultName;
4511
+ exports.normalizeDefaultProps = normalizeDefaultProps;
4512
+ exports.overlayReadoutFor = overlayReadoutFor;
4513
+ exports.overlaysOffered = overlaysOffered;
4514
+ exports.patchFromDraft = patchFromDraft;
4515
+ exports.peerDraftGhosts = peerDraftGhosts;
4516
+ exports.permittedClassicOverlay = permittedClassicOverlay;
4517
+ exports.permittedEnrichmentOverlays = permittedEnrichmentOverlays;
4518
+ exports.persistedItineraryView = persistedItineraryView;
4519
+ exports.poiLayerVisibility = poiLayerVisibility;
4520
+ exports.previewProjection = previewProjection;
4521
+ exports.previewRefreshDisposition = previewRefreshDisposition;
4522
+ exports.previewWaypoint = previewWaypoint;
4523
+ exports.projectEntityCollections = projectEntityCollections;
4524
+ exports.recordWaypointDraftChange = recordWaypointDraftChange;
4525
+ exports.recordZoneDraftChange = recordZoneDraftChange;
4526
+ exports.resolveBaseTerrain = resolveBaseTerrain;
4527
+ exports.resolveDemUrl = resolveDemUrl;
4528
+ exports.resolveEmbedDefaults = resolveEmbedDefaults;
4529
+ exports.resolveOrgEmbedDefaults = resolveOrgEmbedDefaults;
4530
+ exports.resolveWaypointName = resolveWaypointName;
4531
+ exports.restStudioPersistence = restStudioPersistence;
4532
+ exports.sameViewerValues = sameViewerValues;
4533
+ exports.sectionDefaultPropsFields = sectionDefaultPropsFields;
4534
+ exports.sectionFields = sectionFields;
4535
+ exports.segmentChainEnds = segmentChainEnds;
4536
+ exports.segmentEditTooltipContent = segmentEditTooltipContent;
4537
+ exports.segmentGroupDissolvesOnLeave = segmentGroupDissolvesOnLeave;
4538
+ exports.segmentGroupForm = segmentGroupForm;
4539
+ exports.segmentGroupSavePlan = segmentGroupSavePlan;
4540
+ exports.sessionTokenSurface = sessionTokenSurface;
4541
+ exports.studioCapabilitySchema = studioCapabilitySchema;
4542
+ exports.studioCollabTools = studioCollabTools;
4543
+ exports.studioConfigSchema = studioConfigSchema;
4544
+ exports.substituteLiveWaypoint = substituteLiveWaypoint;
4545
+ exports.terrainVariantOptions = terrainVariantOptions;
4546
+ exports.toggleEmbedTableColumn = toggleEmbedTableColumn;
4547
+ exports.truncateKey = truncateKey;
4548
+ exports.videoProfileSource = videoProfileSource;
4549
+ exports.videoRouteSpans = videoRouteSpans;
4550
+ exports.waypointDefaultName = waypointDefaultName;
4551
+ exports.waypointDefaultNames = waypointDefaultNames;
4552
+ exports.waypointDetailsForm = waypointDetailsForm;
4553
+ exports.waypointEditTooltipText = waypointEditTooltipText;
4554
+ exports.waypointIconLabel = waypointIconLabel;
4555
+ exports.waypointIconOccurrence = waypointIconOccurrence;
4556
+ exports.waypointSavePlan = waypointSavePlan;
4557
+ exports.waypointSectionLabel = waypointSectionLabel;
4558
+ exports.zoneClickTarget = zoneClickTarget;
4559
+ exports.zoneEditTooltipText = zoneEditTooltipText;
4560
+ exports.zoneTimeReferenceSeconds = zoneTimeReferenceSeconds;
4561
+ //# sourceMappingURL=index.cjs.map
4562
+ //# sourceMappingURL=index.cjs.map