@mountaya/studio 0.1.0 → 0.2.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 (260) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/agent/index.cjs +2561 -2815
  3. package/dist/agent/index.cjs.map +1 -1
  4. package/dist/agent/index.d.cts +766 -786
  5. package/dist/agent/index.d.ts +766 -786
  6. package/dist/agent/index.js +2553 -2790
  7. package/dist/agent/index.js.map +1 -1
  8. package/dist/chunk-3Oi_Zrtm.js +9 -0
  9. package/dist/chunk-3Oi_Zrtm.js.map +1 -0
  10. package/dist/chunk-B18OPIu_.js +6 -0
  11. package/dist/chunk-B18OPIu_.js.map +1 -0
  12. package/dist/chunk-B5Uz3Qct.cjs +15 -0
  13. package/dist/chunk-B5Uz3Qct.cjs.map +1 -0
  14. package/dist/chunk-BBEJwkd3.d.cts +839 -0
  15. package/dist/chunk-BIEc_SkR.cjs +29 -0
  16. package/dist/chunk-BIEc_SkR.cjs.map +1 -0
  17. package/dist/chunk-BKMFOe-N.js +171 -0
  18. package/dist/chunk-BKMFOe-N.js.map +1 -0
  19. package/dist/chunk-BP4uy7E1.d.ts +11583 -0
  20. package/dist/chunk-BSHTsFiB.js +1403 -0
  21. package/dist/chunk-BSHTsFiB.js.map +1 -0
  22. package/dist/chunk-BTUUABGI.js +17 -0
  23. package/dist/chunk-BTUUABGI.js.map +1 -0
  24. package/dist/chunk-BaPiaz5X.cjs +115 -0
  25. package/dist/chunk-BaPiaz5X.cjs.map +1 -0
  26. package/dist/chunk-BeCVpkYr.cjs +542 -0
  27. package/dist/chunk-BeCVpkYr.cjs.map +1 -0
  28. package/dist/chunk-BgngsvK8.cjs +6202 -0
  29. package/dist/chunk-BgngsvK8.cjs.map +1 -0
  30. package/dist/chunk-BhInd7CJ.d.cts +253 -0
  31. package/dist/chunk-Bn6ZbxkS.cjs +27 -0
  32. package/dist/chunk-By9ZnkVI.js +60 -0
  33. package/dist/chunk-By9ZnkVI.js.map +1 -0
  34. package/dist/chunk-BzqPhxsz.cjs +367 -0
  35. package/dist/chunk-BzqPhxsz.cjs.map +1 -0
  36. package/dist/chunk-C2mMX81q.d.ts +443 -0
  37. package/dist/chunk-C2rr9Q0V.cjs +1402 -0
  38. package/dist/chunk-C2rr9Q0V.cjs.map +1 -0
  39. package/dist/{directorThreads-CqmvsV8b.d.cts → chunk-CDJCbwIQ.d.cts} +20 -22
  40. package/dist/chunk-CLGvBOVH.d.cts +1654 -0
  41. package/dist/chunk-COdw1dc6.d.ts +525 -0
  42. package/dist/chunk-CQCJnT2i.d.ts +511 -0
  43. package/dist/chunk-CSyHY67q.cjs +353 -0
  44. package/dist/chunk-CSyHY67q.cjs.map +1 -0
  45. package/dist/chunk-CiK1Iqrv.js +950 -0
  46. package/dist/chunk-CiK1Iqrv.js.map +1 -0
  47. package/dist/chunk-CmJBgSwZ.cjs +24 -0
  48. package/dist/chunk-CmJBgSwZ.cjs.map +1 -0
  49. package/dist/chunk-CnrsRK2u.cjs +83 -0
  50. package/dist/chunk-CnrsRK2u.cjs.map +1 -0
  51. package/dist/chunk-Co782_9r.js +326 -0
  52. package/dist/chunk-Co782_9r.js.map +1 -0
  53. package/dist/chunk-Csr3KDpZ.cjs +32 -0
  54. package/dist/chunk-Csr3KDpZ.cjs.map +1 -0
  55. package/dist/chunk-CwkmccXv.js +89 -0
  56. package/dist/chunk-CwkmccXv.js.map +1 -0
  57. package/dist/chunk-D0Q4iL9B.cjs +255 -0
  58. package/dist/chunk-D0Q4iL9B.cjs.map +1 -0
  59. package/dist/chunk-DFwiSzUS.cjs +72 -0
  60. package/dist/chunk-DFwiSzUS.cjs.map +1 -0
  61. package/dist/chunk-DIFayl2P.d.cts +443 -0
  62. package/dist/chunk-DIGF58ux.d.cts +525 -0
  63. package/dist/chunk-DKuuuld5.js +101 -0
  64. package/dist/chunk-DKuuuld5.js.map +1 -0
  65. package/dist/chunk-DMePkFEo.js +5054 -0
  66. package/dist/chunk-DMePkFEo.js.map +1 -0
  67. package/dist/chunk-DO5SIBgu.js +305 -0
  68. package/dist/chunk-DO5SIBgu.js.map +1 -0
  69. package/dist/chunk-DOQ_7eE5.d.ts +6662 -0
  70. package/dist/{tabs-B2nRO4p_.d.ts → chunk-DThaaNeb.d.cts} +2 -2
  71. package/dist/{tabs-B2nRO4p_.d.cts → chunk-DThaaNeb.d.ts} +2 -2
  72. package/dist/{directorThreads-CqmvsV8b.d.ts → chunk-DUQzjUJy.d.ts} +20 -22
  73. package/dist/chunk-DX37IPhV.cjs +1903 -0
  74. package/dist/chunk-DX37IPhV.cjs.map +1 -0
  75. package/dist/chunk-Damps5Tk.cjs +155 -0
  76. package/dist/chunk-Damps5Tk.cjs.map +1 -0
  77. package/dist/chunk-DbK5PhpJ.d.ts +1654 -0
  78. package/dist/chunk-De0vAASv.d.ts +253 -0
  79. package/dist/chunk-DhSZ7YZt.d.cts +6662 -0
  80. package/dist/chunk-DjEvqvPA.cjs +43 -0
  81. package/dist/chunk-DjEvqvPA.cjs.map +1 -0
  82. package/dist/{saveFile-j-1kkApx.d.cts → chunk-DkwDzwvu.d.cts} +7 -9
  83. package/dist/{saveFile-j-1kkApx.d.ts → chunk-DkwDzwvu.d.ts} +7 -9
  84. package/dist/chunk-Dmszv9If.js +71 -0
  85. package/dist/chunk-Dmszv9If.js.map +1 -0
  86. package/dist/chunk-Dp_ftNWY.d.cts +511 -0
  87. package/dist/chunk-DsHQySz0.js +31 -0
  88. package/dist/chunk-DsHQySz0.js.map +1 -0
  89. package/dist/chunk-DwoUyHHh.js +281 -0
  90. package/dist/chunk-DwoUyHHh.js.map +1 -0
  91. package/dist/chunk-IaIDQflj.d.cts +2315 -0
  92. package/dist/chunk-IaIDQflj.d.ts +2315 -0
  93. package/dist/chunk-cVXLsZfL.d.ts +839 -0
  94. package/dist/chunk-mIaCX9EJ.d.cts +11583 -0
  95. package/dist/chunk-nJQxbOwQ.cjs +8962 -0
  96. package/dist/chunk-nJQxbOwQ.cjs.map +1 -0
  97. package/dist/chunk-o9jaxhCO.js +8852 -0
  98. package/dist/chunk-o9jaxhCO.js.map +1 -0
  99. package/dist/chunk-p-Tt_Lwz.js +14 -0
  100. package/dist/chunk-p-Tt_Lwz.js.map +1 -0
  101. package/dist/engines/index.cjs +2046 -3401
  102. package/dist/engines/index.cjs.map +1 -1
  103. package/dist/engines/index.d.cts +1510 -1550
  104. package/dist/engines/index.d.ts +1510 -1550
  105. package/dist/engines/index.js +2039 -3380
  106. package/dist/engines/index.js.map +1 -1
  107. package/dist/handlers/index.cjs +47 -93
  108. package/dist/handlers/index.cjs.map +1 -1
  109. package/dist/handlers/index.d.cts +61 -103
  110. package/dist/handlers/index.d.ts +61 -103
  111. package/dist/handlers/index.js +27 -36
  112. package/dist/handlers/index.js.map +1 -1
  113. package/dist/index.cjs +3347 -4398
  114. package/dist/index.cjs.map +1 -1
  115. package/dist/index.d.cts +8 -7297
  116. package/dist/index.d.ts +8 -7297
  117. package/dist/index.js +2997 -3187
  118. package/dist/index.js.map +1 -1
  119. package/dist/plugins/index.cjs +482 -949
  120. package/dist/plugins/index.cjs.map +1 -1
  121. package/dist/plugins/index.d.cts +44 -61
  122. package/dist/plugins/index.d.ts +44 -61
  123. package/dist/plugins/index.js +471 -915
  124. package/dist/plugins/index.js.map +1 -1
  125. package/dist/seams/index.cjs +77 -140
  126. package/dist/seams/index.cjs.map +1 -1
  127. package/dist/seams/index.d.cts +125 -158
  128. package/dist/seams/index.d.ts +125 -158
  129. package/dist/seams/index.js +41 -71
  130. package/dist/seams/index.js.map +1 -1
  131. package/dist/strings/fr/index.cjs +2130 -2116
  132. package/dist/strings/fr/index.cjs.map +1 -1
  133. package/dist/strings/fr/index.d.cts +3 -5
  134. package/dist/strings/fr/index.d.ts +3 -5
  135. package/dist/strings/fr/index.js +2125 -2114
  136. package/dist/strings/fr/index.js.map +1 -1
  137. package/dist/strings/index.cjs +2331 -2625
  138. package/dist/strings/index.cjs.map +1 -1
  139. package/dist/strings/index.d.cts +3 -731
  140. package/dist/strings/index.d.ts +3 -731
  141. package/dist/strings/index.js +2324 -2615
  142. package/dist/strings/index.js.map +1 -1
  143. package/dist/testing/index.cjs +214 -276
  144. package/dist/testing/index.cjs.map +1 -1
  145. package/dist/testing/index.d.cts +61 -121
  146. package/dist/testing/index.d.ts +61 -121
  147. package/dist/testing/index.js +208 -273
  148. package/dist/testing/index.js.map +1 -1
  149. package/dist/time/index.cjs +23 -23
  150. package/dist/time/index.cjs.map +1 -1
  151. package/dist/time/index.d.cts +5 -7
  152. package/dist/time/index.d.ts +5 -7
  153. package/dist/time/index.js +18 -21
  154. package/dist/time/index.js.map +1 -1
  155. package/package.json +14 -15
  156. package/src/agent/rules/stateDelta.ts +1 -0
  157. package/src/agent/stores/agentThreads.ts +1 -4
  158. package/src/bus/rules/bus.ts +1 -2
  159. package/src/bus/rules/defineRegistry.ts +3 -5
  160. package/src/bus/rules/types.ts +6 -7
  161. package/src/chrome/stores/uiStore.ts +4 -2
  162. package/src/embed/rules/fieldDependencies.ts +2 -0
  163. package/src/embed/rules/safetyRules.ts +2 -0
  164. package/src/embed/rules/tableCode.ts +4 -3
  165. package/src/index.ts +6 -27
  166. package/src/itinerary/rules/import.ts +6 -8
  167. package/src/plugins/contracts/plugin.ts +4 -2
  168. package/src/seams/rules/formatters.ts +5 -3
  169. package/src/testing/index.ts +1 -5
  170. package/src/viewer/rules/platformViewer.ts +1 -0
  171. package/dist/bus-BwiNiXdH.d.ts +0 -514
  172. package/dist/bus-DzmhPwdK.d.cts +0 -514
  173. package/dist/chainModel-B23pEP_1.d.cts +0 -127
  174. package/dist/chainModel-B23pEP_1.d.ts +0 -127
  175. package/dist/chunk-2HFY7ETU.js +0 -5721
  176. package/dist/chunk-2HFY7ETU.js.map +0 -1
  177. package/dist/chunk-355TOXSB.js +0 -72
  178. package/dist/chunk-355TOXSB.js.map +0 -1
  179. package/dist/chunk-4ZCUZVSV.js +0 -10275
  180. package/dist/chunk-4ZCUZVSV.js.map +0 -1
  181. package/dist/chunk-6HEKY3NF.js +0 -95
  182. package/dist/chunk-6HEKY3NF.js.map +0 -1
  183. package/dist/chunk-7GFLGGBX.cjs +0 -8
  184. package/dist/chunk-7GFLGGBX.cjs.map +0 -1
  185. package/dist/chunk-7NBRCENN.cjs +0 -19
  186. package/dist/chunk-7NBRCENN.cjs.map +0 -1
  187. package/dist/chunk-AF5GCXE3.js +0 -8
  188. package/dist/chunk-AF5GCXE3.js.map +0 -1
  189. package/dist/chunk-CJDIFRGZ.cjs +0 -2005
  190. package/dist/chunk-CJDIFRGZ.cjs.map +0 -1
  191. package/dist/chunk-CNPZY7N3.js +0 -349
  192. package/dist/chunk-CNPZY7N3.js.map +0 -1
  193. package/dist/chunk-DZJHTWSF.cjs +0 -45
  194. package/dist/chunk-DZJHTWSF.cjs.map +0 -1
  195. package/dist/chunk-EABIHHWA.js +0 -42
  196. package/dist/chunk-EABIHHWA.js.map +0 -1
  197. package/dist/chunk-EKZWV6RS.cjs +0 -415
  198. package/dist/chunk-EKZWV6RS.cjs.map +0 -1
  199. package/dist/chunk-EOKRXXAC.cjs +0 -24
  200. package/dist/chunk-EOKRXXAC.cjs.map +0 -1
  201. package/dist/chunk-F73W2ZTJ.js +0 -1126
  202. package/dist/chunk-F73W2ZTJ.js.map +0 -1
  203. package/dist/chunk-H4DVOZ5O.js +0 -1897
  204. package/dist/chunk-H4DVOZ5O.js.map +0 -1
  205. package/dist/chunk-HI52PBFT.cjs +0 -10314
  206. package/dist/chunk-HI52PBFT.cjs.map +0 -1
  207. package/dist/chunk-IDBXFBLG.cjs +0 -1225
  208. package/dist/chunk-IDBXFBLG.cjs.map +0 -1
  209. package/dist/chunk-LBWTJZUJ.js +0 -297
  210. package/dist/chunk-LBWTJZUJ.js.map +0 -1
  211. package/dist/chunk-NCLA6DKD.cjs +0 -310
  212. package/dist/chunk-NCLA6DKD.cjs.map +0 -1
  213. package/dist/chunk-O4MC5DPD.js +0 -19
  214. package/dist/chunk-O4MC5DPD.js.map +0 -1
  215. package/dist/chunk-OP37FKW6.cjs +0 -98
  216. package/dist/chunk-OP37FKW6.cjs.map +0 -1
  217. package/dist/chunk-OQSYFH3Z.cjs +0 -5945
  218. package/dist/chunk-OQSYFH3Z.cjs.map +0 -1
  219. package/dist/chunk-PACIO4NS.cjs +0 -26
  220. package/dist/chunk-PACIO4NS.cjs.map +0 -1
  221. package/dist/chunk-PSZ2R3TC.cjs +0 -75
  222. package/dist/chunk-PSZ2R3TC.cjs.map +0 -1
  223. package/dist/chunk-QFO5CZG2.cjs +0 -136
  224. package/dist/chunk-QFO5CZG2.cjs.map +0 -1
  225. package/dist/chunk-QL63MUEW.cjs +0 -140
  226. package/dist/chunk-QL63MUEW.cjs.map +0 -1
  227. package/dist/chunk-RFUPPVZO.js +0 -17
  228. package/dist/chunk-RFUPPVZO.js.map +0 -1
  229. package/dist/chunk-RPG2LWMP.js +0 -23
  230. package/dist/chunk-RPG2LWMP.js.map +0 -1
  231. package/dist/chunk-TIBXK6B7.cjs +0 -12
  232. package/dist/chunk-TIBXK6B7.cjs.map +0 -1
  233. package/dist/chunk-UU65VNEV.js +0 -381
  234. package/dist/chunk-UU65VNEV.js.map +0 -1
  235. package/dist/chunk-VGX6TR2I.js +0 -209
  236. package/dist/chunk-VGX6TR2I.js.map +0 -1
  237. package/dist/chunk-WUTDDBVP.js +0 -130
  238. package/dist/chunk-WUTDDBVP.js.map +0 -1
  239. package/dist/chunk-WVQQLKCI.cjs +0 -224
  240. package/dist/chunk-WVQQLKCI.cjs.map +0 -1
  241. package/dist/chunk-WZYXG3SE.js +0 -111
  242. package/dist/chunk-WZYXG3SE.js.map +0 -1
  243. package/dist/chunk-XDI2X3KE.js +0 -6
  244. package/dist/chunk-XDI2X3KE.js.map +0 -1
  245. package/dist/chunk-XKHLRIC7.cjs +0 -381
  246. package/dist/chunk-XKHLRIC7.cjs.map +0 -1
  247. package/dist/context-DNtd2WUv.d.cts +0 -11666
  248. package/dist/context-DgB72Bur.d.ts +0 -11666
  249. package/dist/en-Bu4Ti9Ev.d.cts +0 -2315
  250. package/dist/en-Bu4Ti9Ev.d.ts +0 -2315
  251. package/dist/shareLink-B6hlt942.d.ts +0 -144
  252. package/dist/shareLink-C7rIMb7x.d.ts +0 -527
  253. package/dist/shareLink-CnTxxXjp.d.cts +0 -144
  254. package/dist/shareLink-DyZVYH2V.d.cts +0 -527
  255. package/dist/studioPlugin-C3C7VjMy.d.ts +0 -847
  256. package/dist/studioPlugin-Cf3OBNUv.d.cts +0 -847
  257. package/dist/types-BzJRV6UI.d.cts +0 -845
  258. package/dist/types-BzJRV6UI.d.ts +0 -845
  259. package/dist/zoneForm-CdYNtnnA.d.cts +0 -320
  260. package/dist/zoneForm-mG85yt5e.d.ts +0 -320
@@ -0,0 +1,1402 @@
1
+ "use strict";
2
+ const require_rolldown_runtime = require("./chunk-Bn6ZbxkS.cjs");
3
+ let zod = require("zod");
4
+ zod = require_rolldown_runtime.__toESM(zod);
5
+ let _mountaya_elements_geo = require("@mountaya/elements/geo");
6
+ let _mountaya_elements_data = require("@mountaya/elements/data");
7
+ let _mountaya_elements_units = require("@mountaya/elements/units");
8
+ let _mountaya_elements_errors = require("@mountaya/elements/errors");
9
+ let _mountaya_elements_profile = require("@mountaya/elements/profile");
10
+ const toolNoDataSchema = zod.undefined();
11
+ const appendHistoryStep = (history, step) => {
12
+ const next = [...history, step];
13
+ return next.length > 100 ? next.slice(next.length - 100) : next;
14
+ };
15
+ const restActivitySlugs = {
16
+ "hiking-and-trail": "hiking-and-trail",
17
+ "professional-trail": "professional-trail",
18
+ running: "running",
19
+ "road-cycling": "road-cycling",
20
+ "gravel-bike": "gravel-bike",
21
+ "mountain-bike": "mountain-bike",
22
+ "backcountry-skiing": "backcountry-skiing",
23
+ "ski-touring": "ski-touring",
24
+ "cross-country-skiing": "cross-country-skiing",
25
+ "snowshoe-walking": "snowshoe-walking"
26
+ };
27
+ const restActivitySlugSchema = zod.enum(restActivitySlugs);
28
+ const toDataActivity = (slug) => {
29
+ const parsed = restActivitySlugSchema.safeParse(slug);
30
+ if (!parsed.success) throw new _mountaya_elements_errors.MountayaElementsError(`toDataActivity: ${JSON.stringify(slug)} is not an activity slug of the REST API; pass one of ${restActivitySlugSchema.options.join(", ")}`, { cause: parsed.error });
31
+ return parsed.data.toUpperCase().replaceAll("-", "_");
32
+ };
33
+ const toRestActivity = (value) => value.toLowerCase().replaceAll("_", "-");
34
+ const isRestActivity = (slug) => Object.hasOwn(restActivitySlugs, slug);
35
+ const isDataActivity = (slug) => {
36
+ const rest = slug.toLowerCase().replaceAll("_", "-");
37
+ return isRestActivity(rest) && rest.toUpperCase().replaceAll("-", "_") === slug;
38
+ };
39
+ const resolveActivity = (slug) => {
40
+ if (isRestActivity(slug)) return slug;
41
+ return isDataActivity(slug) ? toRestActivity(slug) : void 0;
42
+ };
43
+ const itinerarySelectionSchema = zod.discriminatedUnion("kind", [zod.object({
44
+ id: zod.string(),
45
+ kind: zod.literal("segment")
46
+ }), zod.object({
47
+ id: zod.string(),
48
+ kind: zod.literal("waypoint")
49
+ })]);
50
+ const mapSegments = (itinerary, transform) => {
51
+ if (!itinerary) return null;
52
+ return {
53
+ ...itinerary,
54
+ segments: transform(itinerary.segments)
55
+ };
56
+ };
57
+ const applyWaypointDetails = (waypoint, details) => {
58
+ const { amenities, ...rest } = details;
59
+ return {
60
+ ...waypoint,
61
+ ...rest,
62
+ ...amenities === void 0 ? {} : { amenities: amenities ?? [] }
63
+ };
64
+ };
65
+ const mapWaypoints = (itinerary, transform) => {
66
+ if (!itinerary) return null;
67
+ return {
68
+ ...itinerary,
69
+ waypoints: transform(itinerary.waypoints)
70
+ };
71
+ };
72
+ const patchSegment = (state, segmentId, patch) => {
73
+ if (!state.activeItinerary?.segments.some((segment) => segment.id === segmentId)) return state;
74
+ return { activeItinerary: mapSegments(state.activeItinerary, (segments) => segments.map((segment) => segment.id === segmentId ? patch(segment) : segment)) };
75
+ };
76
+ const patchWaypoint = (state, waypointId, patch) => {
77
+ if (!state.activeItinerary?.waypoints.some((waypoint) => waypoint.id === waypointId)) return state;
78
+ return { activeItinerary: mapWaypoints(state.activeItinerary, (waypoints) => waypoints.map((waypoint) => waypoint.id === waypointId ? patch(waypoint) : waypoint)) };
79
+ };
80
+ const renumber = (items) => items.map((item, index) => ({
81
+ ...item,
82
+ position: index
83
+ }));
84
+ const itineraryInitialState = {
85
+ activeItinerary: null,
86
+ hoveredEntity: null,
87
+ selection: null
88
+ };
89
+ const createItinerarySlice = (set) => ({
90
+ moveWaypoint: (waypointId, geometry) => set((state) => patchWaypoint(state, waypointId, (waypoint) => ({
91
+ ...waypoint,
92
+ geojson: geometry
93
+ }))),
94
+ recolorSegment: (segmentId, color) => set((state) => patchSegment(state, segmentId, (segment) => ({
95
+ ...segment,
96
+ color
97
+ }))),
98
+ recolorWaypoint: (waypointId, color) => set((state) => patchWaypoint(state, waypointId, (waypoint) => ({
99
+ ...waypoint,
100
+ color
101
+ }))),
102
+ setWaypointDetails: (waypointId, details) => set((state) => patchWaypoint(state, waypointId, (waypoint) => applyWaypointDetails(waypoint, details))),
103
+ renameActiveItinerary: (name) => set((state) => state.activeItinerary ? { activeItinerary: {
104
+ ...state.activeItinerary,
105
+ name
106
+ } } : state),
107
+ renameSegment: (segmentId, name) => set((state) => patchSegment(state, segmentId, (segment) => ({
108
+ ...segment,
109
+ name
110
+ }))),
111
+ renameWaypoint: (waypointId, name) => set((state) => patchWaypoint(state, waypointId, (waypoint) => ({
112
+ ...waypoint,
113
+ name
114
+ }))),
115
+ select: (selection) => set({ selection }),
116
+ setActiveItinerary: (activeItinerary) => set({ activeItinerary }),
117
+ setHoveredEntity: (hoveredEntity) => set((state) => state.hoveredEntity?.id === hoveredEntity?.id && state.hoveredEntity?.kind === hoveredEntity?.kind ? state : { hoveredEntity }),
118
+ setSegmentGeometry: (segmentId, geometry) => set((state) => patchSegment(state, segmentId, (segment) => ({
119
+ ...segment,
120
+ geojson: geometry
121
+ }))),
122
+ setSegmentSpeed: (segmentId, speed, duration) => set((state) => patchSegment(state, segmentId, (segment) => ({
123
+ ...segment,
124
+ duration,
125
+ speed
126
+ }))),
127
+ setWaypointIcon: (waypointId, icon) => set((state) => patchWaypoint(state, waypointId, (waypoint) => ({
128
+ ...waypoint,
129
+ icon
130
+ })))
131
+ });
132
+ const DISPLAY_NAME_MAX_LENGTH = 30;
133
+ const DISPLAY_NAME_MIN_LENGTH = 2;
134
+ const displayNameSchema = zod.string().trim().min(2).max(30);
135
+ const fitDisplayName = (text) => {
136
+ const collapsed = text.replace(/\s+/g, " ").trim();
137
+ const characters = Array.from(collapsed);
138
+ const lead = characters.slice(0, 31).join("");
139
+ const boundary = lead.lastIndexOf(" ");
140
+ const fitted = characters.length <= 30 ? collapsed : boundary > 0 ? lead.slice(0, boundary).trimEnd() : characters.slice(0, 30).join("");
141
+ return displayNameSchema.safeParse(fitted).success ? fitted : "";
142
+ };
143
+ const DESCRIPTION_MAX_LENGTH = 100;
144
+ const descriptionSchema = zod.string().trim().max(100);
145
+ const draftActivityInput = zod.object({ activityId: zod.string().nullable() });
146
+ const draftNameInput = zod.object({ name: zod.string() });
147
+ const draftOrganizationInput = zod.object({ organizationId: zod.string().nullable() });
148
+ const draftPrivateInput = zod.object({ isPrivate: zod.boolean() });
149
+ const draftCollectionsInput = zod.object({ collectionIds: zod.array(zod.string()) });
150
+ const originBase = (origin) => origin.endsWith("/") ? origin.slice(0, -1) : origin;
151
+ const shareLinkTargetSchema = zod.object({
152
+ id: zod.string(),
153
+ kind: zod.enum(["collection", "itinerary"])
154
+ });
155
+ const buildShareSearch = (input) => input.collectionId !== void 0 ? [["collection_id", input.collectionId], ["share_token", input.shareToken]] : [["itinerary_id", input.itineraryId], ["share_token", input.shareToken]];
156
+ const buildShareSrc = (origin, input) => {
157
+ const params = new URLSearchParams(buildShareSearch(input));
158
+ return `${originBase(origin)}/studio/share?${params.toString()}`;
159
+ };
160
+ const switchOverridesSchema = zod.object({
161
+ terrain: zod.string().optional(),
162
+ withAccessRestrictions: zod.boolean().optional(),
163
+ withDirectionsControl: zod.boolean().optional(),
164
+ withDownloadControl: zod.boolean().optional(),
165
+ withNavigationControl: zod.boolean().optional(),
166
+ withOverlays: zod.array(zod.string()).nullable().optional(),
167
+ withOverlaysControl: zod.boolean().optional(),
168
+ withPreferencesControl: zod.boolean().optional(),
169
+ withProfileAnalysis: zod.boolean().optional(),
170
+ withProfileCharacteristics: zod.boolean().optional(),
171
+ withProfileElevation: zod.boolean().optional(),
172
+ withProfilePaceControl: zod.boolean().optional(),
173
+ withStreetviewControl: zod.boolean().optional(),
174
+ withTerrains: zod.array(zod.string()).nullable().optional()
175
+ });
176
+ const embedSetContentInput = switchOverridesSchema.extend({ itineraryId: zod.string().nullable() });
177
+ const SET_ITINERARY_MESSAGE = "mountaya:setItinerary";
178
+ const READY_MESSAGE = "mountaya:ready";
179
+ const REQUEST_CAMERA_MESSAGE = "mountaya:requestCamera";
180
+ const CAMERA_MESSAGE = "mountaya:camera";
181
+ const requestCameraMessageSchema = zod.object({ type: zod.literal(REQUEST_CAMERA_MESSAGE) });
182
+ const cameraMessageSchema = zod.object({
183
+ bearing: zod.number(),
184
+ center: zod.tuple([zod.number(), zod.number()]),
185
+ pitch: zod.number(),
186
+ type: zod.literal(CAMERA_MESSAGE),
187
+ zoom: zod.number()
188
+ });
189
+ const REQUEST_SESSION_TOKEN_MESSAGE = "mountaya:requestSessionToken";
190
+ const SET_SESSION_TOKEN_MESSAGE = "mountaya:setSessionToken";
191
+ const requestSessionTokenMessageSchema = zod.object({ type: zod.literal(REQUEST_SESSION_TOKEN_MESSAGE) });
192
+ const setSessionTokenMessageSchema = zod.object({
193
+ expiresAt: zod.iso.datetime({ offset: true }),
194
+ token: zod.string().regex(/^sess_\S+$/),
195
+ type: zod.literal(SET_SESSION_TOKEN_MESSAGE)
196
+ });
197
+ const inboundBridgeMessageSchema = zod.discriminatedUnion("type", [embedSetContentInput.extend({ type: zod.literal(SET_ITINERARY_MESSAGE) })]);
198
+ const readyErrorSchema = zod.enum(["timeout", "not_found"]).nullable();
199
+ const mapBoundsSchema = zod.tuple([
200
+ zod.number(),
201
+ zod.number(),
202
+ zod.number(),
203
+ zod.number()
204
+ ]).nullable();
205
+ const readyMessageSchema = zod.object({
206
+ bounds: mapBoundsSchema,
207
+ error: readyErrorSchema,
208
+ itineraryId: zod.string().nullable(),
209
+ terrain: zod.string(),
210
+ type: zod.literal(READY_MESSAGE)
211
+ });
212
+ const lineLengthMeters = (line) => {
213
+ let meters = 0;
214
+ for (let index = 1; index < line.length; index += 1) {
215
+ const previous = line[index - 1];
216
+ const current = line[index];
217
+ if (previous && current) meters += (0, _mountaya_elements_profile.haversineMeters)(previous, current);
218
+ }
219
+ return meters;
220
+ };
221
+ const LINESTRING_PROFILE_MAX_SAMPLES = 4e3;
222
+ const profileSampleCap = (lengthMeters) => {
223
+ const needed = Math.floor(lengthMeters / 50) + 2;
224
+ if (!(needed >= 400)) return 400;
225
+ if (needed > 4e3) return LINESTRING_PROFILE_MAX_SAMPLES;
226
+ return needed;
227
+ };
228
+ const MAX_SEGMENT_POSITIONS = 1e4;
229
+ const freehandInsertBudget = (drawnVertices, sampleCap, keepsVias) => {
230
+ const held = keepsVias ? drawnVertices * 2 : drawnVertices;
231
+ return Math.min(sampleCap, MAX_SEGMENT_POSITIONS - held);
232
+ };
233
+ const FREEHAND_FIT_FIRST_TOLERANCE_METERS = 3;
234
+ const FREEHAND_FIT_ROUNDS = 40;
235
+ const keptWithinTolerance = (line, indices, toleranceMeters, metersPerDegree) => {
236
+ if (indices.length < 3) return [...indices];
237
+ const toleranceSquared = toleranceMeters * toleranceMeters;
238
+ const keep = new Uint8Array(indices.length);
239
+ keep[0] = 1;
240
+ keep[indices.length - 1] = 1;
241
+ const stack = [[0, indices.length - 1]];
242
+ while (stack.length > 0) {
243
+ const span = stack.pop();
244
+ if (!span) continue;
245
+ const [from, to] = span;
246
+ const start = line[indices[from] ?? -1];
247
+ const end = line[indices[to] ?? -1];
248
+ if (to - from < 2 || !start || !end) continue;
249
+ const [startLng = 0, startLat = 0] = start;
250
+ const lngMeters = metersPerDegree * Math.cos(startLat * _mountaya_elements_units.DEGREES_TO_RADIANS);
251
+ const endX = (0, _mountaya_elements_geo.longitudeDelta)(startLng, end[0] ?? 0) * lngMeters;
252
+ const endY = ((end[1] ?? 0) - startLat) * metersPerDegree;
253
+ const lengthSquared = endX * endX + endY * endY;
254
+ let farthest = -1;
255
+ let farthestSquared = -1;
256
+ for (let at = from + 1; at < to; at += 1) {
257
+ const point = line[indices[at] ?? -1];
258
+ if (!point) continue;
259
+ const x = (0, _mountaya_elements_geo.longitudeDelta)(startLng, point[0] ?? 0) * lngMeters;
260
+ const y = ((point[1] ?? 0) - startLat) * metersPerDegree;
261
+ const along = lengthSquared === 0 ? 0 : Math.min(1, Math.max(0, (x * endX + y * endY) / lengthSquared));
262
+ const offX = x - along * endX;
263
+ const offY = y - along * endY;
264
+ const squared = offX * offX + offY * offY;
265
+ if (squared > farthestSquared) {
266
+ farthest = at;
267
+ farthestSquared = squared;
268
+ }
269
+ }
270
+ if (farthest !== -1 && farthestSquared > toleranceSquared) {
271
+ keep[farthest] = 1;
272
+ stack.push([from, farthest], [farthest, to]);
273
+ }
274
+ }
275
+ return indices.filter((_index, at) => keep[at] === 1);
276
+ };
277
+ const fitFreehandLines = (lines) => {
278
+ const positions = (sets) => sets.reduce((sum, set) => sum + set.length, 0);
279
+ if (positions(lines) <= 1e4) return null;
280
+ const metersPerDegree = _mountaya_elements_geo.EARTH_RADIUS_METERS * _mountaya_elements_units.DEGREES_TO_RADIANS;
281
+ let tolerance = FREEHAND_FIT_FIRST_TOLERANCE_METERS;
282
+ let kept = lines.map((line) => keptWithinTolerance(line, line.map((_position, index) => index), tolerance, metersPerDegree));
283
+ for (let round = 0; round < FREEHAND_FIT_ROUNDS && positions(kept) > 1e4; round += 1) {
284
+ tolerance *= 2;
285
+ kept = kept.map((indices, at) => keptWithinTolerance(lines[at] ?? [], indices, tolerance, metersPerDegree));
286
+ }
287
+ return kept;
288
+ };
289
+ const storedMeters = (meters) => Math.round(meters * 100) / 100;
290
+ const interpolateGreatCircle = (start, end, fraction) => {
291
+ const latStart = (start[1] ?? 0) * _mountaya_elements_units.DEGREES_TO_RADIANS;
292
+ const lngStart = (start[0] ?? 0) * _mountaya_elements_units.DEGREES_TO_RADIANS;
293
+ const latEnd = (end[1] ?? 0) * _mountaya_elements_units.DEGREES_TO_RADIANS;
294
+ const lngEnd = (end[0] ?? 0) * _mountaya_elements_units.DEGREES_TO_RADIANS;
295
+ const delta = 2 * Math.asin(Math.min(1, Math.sqrt(Math.sin((latEnd - latStart) / 2) ** 2 + Math.cos(latStart) * Math.cos(latEnd) * Math.sin((lngEnd - lngStart) / 2) ** 2)));
296
+ if (delta === 0) return [start[0] ?? 0, start[1] ?? 0];
297
+ const a = Math.sin((1 - fraction) * delta) / Math.sin(delta);
298
+ const b = Math.sin(fraction * delta) / Math.sin(delta);
299
+ const x = a * Math.cos(latStart) * Math.cos(lngStart) + b * Math.cos(latEnd) * Math.cos(lngEnd);
300
+ const y = a * Math.cos(latStart) * Math.sin(lngStart) + b * Math.cos(latEnd) * Math.sin(lngEnd);
301
+ const z = a * Math.sin(latStart) + b * Math.sin(latEnd);
302
+ return [Math.atan2(y, x) * _mountaya_elements_units.RADIANS_TO_DEGREES, Math.atan2(z, Math.hypot(x, y)) * _mountaya_elements_units.RADIANS_TO_DEGREES];
303
+ };
304
+ const vertexWithinRange = (vertex) => [(0, _mountaya_elements_geo.wrapLongitudePastRange)(vertex[0] ?? 0), vertex[1] ?? 0];
305
+ const densifyLine = (line, intervalMeters, maxSamples) => {
306
+ if (line.length < 2) return line.map(vertexWithinRange);
307
+ const totalMeters = lineLengthMeters(line);
308
+ const interval = totalMeters > 0 ? Math.max(intervalMeters, totalMeters / maxSamples) : intervalMeters;
309
+ const head = line[0];
310
+ const densified = head ? [vertexWithinRange(head)] : [];
311
+ for (let index = 1; index < line.length; index += 1) {
312
+ const start = line[index - 1];
313
+ const end = line[index];
314
+ if (!start || !end) continue;
315
+ const edgeMeters = (0, _mountaya_elements_profile.haversineMeters)(start, end);
316
+ const steps = interval > 0 ? Math.max(1, Math.ceil(edgeMeters / interval)) : 1;
317
+ for (let step = 1; step < steps; step += 1) densified.push(interpolateGreatCircle(start, end, step / steps));
318
+ densified.push(vertexWithinRange(end));
319
+ }
320
+ return densified;
321
+ };
322
+ const densifyFreehandLine = (line) => {
323
+ const meters = lineLengthMeters(line);
324
+ const keepsVias = line.length < profileSampleCap(storedMeters(meters));
325
+ const budget = freehandInsertBudget(line.length, profileSampleCap(meters), keepsVias);
326
+ if (budget <= 0) return line.map(vertexWithinRange);
327
+ return densifyLine(line, 50, budget);
328
+ };
329
+ const surfaceTypeSchema = zod.enum({
330
+ unknown: "unknown",
331
+ paved: "paved",
332
+ unpaved: "unpaved",
333
+ asphalt: "asphalt",
334
+ concrete: "concrete",
335
+ cobblestone: "cobblestone",
336
+ metal: "metal",
337
+ wood: "wood",
338
+ "compacted-gravel": "compacted-gravel",
339
+ "fine-gravel": "fine-gravel",
340
+ gravel: "gravel",
341
+ dirt: "dirt",
342
+ ground: "ground",
343
+ ice: "ice",
344
+ "paving-stones": "paving-stones",
345
+ sand: "sand",
346
+ woodchips: "woodchips",
347
+ grass: "grass",
348
+ "grass-paver": "grass-paver"
349
+ });
350
+ const wayTypeSchema = zod.enum({
351
+ unknown: "unknown",
352
+ "state-road": "state-road",
353
+ road: "road",
354
+ street: "street",
355
+ path: "path",
356
+ track: "track",
357
+ cycleway: "cycleway",
358
+ footway: "footway",
359
+ steps: "steps",
360
+ ferry: "ferry",
361
+ construction: "construction"
362
+ });
363
+ const trailDifficultyTypeSchema = zod.enum({
364
+ unknown: "unknown",
365
+ hiking: "hiking",
366
+ "mountain-hiking": "mountain-hiking",
367
+ "demanding-mountain-hiking": "demanding-mountain-hiking",
368
+ "alpine-hiking": "alpine-hiking",
369
+ "demanding-alpine-hiking": "demanding-alpine-hiking",
370
+ "difficult-alpine-hiking": "difficult-alpine-hiking",
371
+ "mtb-0": "mtb-0",
372
+ "mtb-1": "mtb-1",
373
+ "mtb-2": "mtb-2",
374
+ "mtb-3": "mtb-3",
375
+ "mtb-4": "mtb-4",
376
+ "mtb-5": "mtb-5",
377
+ "mtb-6": "mtb-6"
378
+ });
379
+ const indexedInfoSchema = (value) => zod.object({
380
+ from_index: zod.number().int(),
381
+ to_index: zod.number().int(),
382
+ value
383
+ });
384
+ const liveSegmentRouteAnalysisSchema = zod.object({
385
+ slopeInfo: zod.array(indexedInfoSchema(zod.number())),
386
+ speedInfo: zod.array(indexedInfoSchema(zod.number())),
387
+ surfaceInfo: zod.array(indexedInfoSchema(surfaceTypeSchema)),
388
+ trailDifficultyInfo: zod.array(indexedInfoSchema(trailDifficultyTypeSchema)),
389
+ wayTypeInfo: zod.array(indexedInfoSchema(wayTypeSchema))
390
+ });
391
+ const liveSegmentRouteElevationSchema = zod.object({
392
+ altitudeMax: zod.number(),
393
+ altitudeMin: zod.number(),
394
+ ascent: zod.number(),
395
+ descent: zod.number(),
396
+ gradientMax: zod.number(),
397
+ gradientMin: zod.number()
398
+ });
399
+ zod.enum({
400
+ ASPHALT: "ASPHALT",
401
+ COBBLESTONE: "COBBLESTONE",
402
+ COMPACTED_GRAVEL: "COMPACTED_GRAVEL",
403
+ CONCRETE: "CONCRETE",
404
+ DIRT: "DIRT",
405
+ FINE_GRAVEL: "FINE_GRAVEL",
406
+ GRASS: "GRASS",
407
+ GRASS_PAVER: "GRASS_PAVER",
408
+ GRAVEL: "GRAVEL",
409
+ GROUND: "GROUND",
410
+ ICE: "ICE",
411
+ METAL: "METAL",
412
+ PAVED: "PAVED",
413
+ PAVING_STONES: "PAVING_STONES",
414
+ SAND: "SAND",
415
+ UNKNOWN: "UNKNOWN",
416
+ UNPAVED: "UNPAVED",
417
+ WOOD: "WOOD",
418
+ WOODCHIPS: "WOODCHIPS"
419
+ });
420
+ zod.enum({
421
+ CONSTRUCTION: "CONSTRUCTION",
422
+ CYCLEWAY: "CYCLEWAY",
423
+ FERRY: "FERRY",
424
+ FOOTWAY: "FOOTWAY",
425
+ PATH: "PATH",
426
+ ROAD: "ROAD",
427
+ STATE_ROAD: "STATE_ROAD",
428
+ STEPS: "STEPS",
429
+ STREET: "STREET",
430
+ TRACK: "TRACK",
431
+ UNKNOWN: "UNKNOWN"
432
+ });
433
+ zod.enum({
434
+ ALPINE_HIKING: "ALPINE_HIKING",
435
+ DEMANDING_ALPINE_HIKING: "DEMANDING_ALPINE_HIKING",
436
+ DEMANDING_MOUNTAIN_HIKING: "DEMANDING_MOUNTAIN_HIKING",
437
+ DIFFICULT_ALPINE_HIKING: "DIFFICULT_ALPINE_HIKING",
438
+ HIKING: "HIKING",
439
+ MOUNTAIN_HIKING: "MOUNTAIN_HIKING",
440
+ MTB_0: "MTB_0",
441
+ MTB_1: "MTB_1",
442
+ MTB_2: "MTB_2",
443
+ MTB_3: "MTB_3",
444
+ MTB_4: "MTB_4",
445
+ MTB_5: "MTB_5",
446
+ MTB_6: "MTB_6",
447
+ UNKNOWN: "UNKNOWN"
448
+ });
449
+ const dataToRestSurface = {
450
+ ASPHALT: "asphalt",
451
+ COBBLESTONE: "cobblestone",
452
+ COMPACTED_GRAVEL: "compacted-gravel",
453
+ CONCRETE: "concrete",
454
+ DIRT: "dirt",
455
+ FINE_GRAVEL: "fine-gravel",
456
+ GRASS: "grass",
457
+ GRASS_PAVER: "grass-paver",
458
+ GRAVEL: "gravel",
459
+ GROUND: "ground",
460
+ ICE: "ice",
461
+ METAL: "metal",
462
+ PAVED: "paved",
463
+ PAVING_STONES: "paving-stones",
464
+ SAND: "sand",
465
+ UNKNOWN: "unknown",
466
+ UNPAVED: "unpaved",
467
+ WOOD: "wood",
468
+ WOODCHIPS: "woodchips"
469
+ };
470
+ const dataToRestWaytype = {
471
+ CONSTRUCTION: "construction",
472
+ CYCLEWAY: "cycleway",
473
+ FERRY: "ferry",
474
+ FOOTWAY: "footway",
475
+ PATH: "path",
476
+ ROAD: "road",
477
+ STATE_ROAD: "state-road",
478
+ STEPS: "steps",
479
+ STREET: "street",
480
+ TRACK: "track",
481
+ UNKNOWN: "unknown"
482
+ };
483
+ const dataToRestTrailDifficulty = {
484
+ ALPINE_HIKING: "alpine-hiking",
485
+ DEMANDING_ALPINE_HIKING: "demanding-alpine-hiking",
486
+ DEMANDING_MOUNTAIN_HIKING: "demanding-mountain-hiking",
487
+ DIFFICULT_ALPINE_HIKING: "difficult-alpine-hiking",
488
+ HIKING: "hiking",
489
+ MOUNTAIN_HIKING: "mountain-hiking",
490
+ MTB_0: "mtb-0",
491
+ MTB_1: "mtb-1",
492
+ MTB_2: "mtb-2",
493
+ MTB_3: "mtb-3",
494
+ MTB_4: "mtb-4",
495
+ MTB_5: "mtb-5",
496
+ MTB_6: "mtb-6",
497
+ UNKNOWN: "unknown"
498
+ };
499
+ const toRestSurface = (value) => dataToRestSurface[value];
500
+ const toRestWayType = (value) => dataToRestWaytype[value];
501
+ const toRestTrailDifficulty = (value) => dataToRestTrailDifficulty[value];
502
+ const dataToRestRoadAccess = {
503
+ AGRICULTURAL: "agricultural",
504
+ CUSTOMERS: "customers",
505
+ DELIVERY: "delivery",
506
+ DESTINATION: "destination",
507
+ FORESTRY: "forestry",
508
+ NO: "no",
509
+ PERMISSIVE: "permissive",
510
+ PERMIT: "permit",
511
+ PRIVATE: "private",
512
+ RESTRICTED: "restricted",
513
+ SERVICE: "service",
514
+ UNKNOWN: "unknown"
515
+ };
516
+ const graphqlRoadAccessToInfo = (advisories) => advisories.roadAccessInfo.map((info) => ({
517
+ from_index: info.fromIndex,
518
+ to_index: info.toIndex,
519
+ values: info.values.map((value) => dataToRestRoadAccess[value])
520
+ }));
521
+ const toAnalysisEntries = (entries, convert) => entries.map((entry) => ({
522
+ from_index: entry.fromIndex,
523
+ to_index: entry.toIndex,
524
+ value: convert(entry.value)
525
+ }));
526
+ const graphqlElevationToSummary = (elevation) => ({
527
+ altitudeMax: elevation.altitude.max,
528
+ altitudeMin: elevation.altitude.min,
529
+ ascent: elevation.ascent,
530
+ descent: elevation.descent,
531
+ gradientMax: elevation.gradient.max,
532
+ gradientMin: elevation.gradient.min
533
+ });
534
+ const graphqlAnalysisToEntries = (analysis) => ({
535
+ slopeInfo: toAnalysisEntries(analysis.slopeInfo, (value) => value),
536
+ speedInfo: toAnalysisEntries(analysis.speedInfo, (value) => value),
537
+ surfaceInfo: toAnalysisEntries(analysis.surfaceInfo, toRestSurface),
538
+ trailDifficultyInfo: toAnalysisEntries(analysis.trailDifficultyInfo, toRestTrailDifficulty),
539
+ wayTypeInfo: toAnalysisEntries(analysis.wayTypeInfo, toRestWayType)
540
+ });
541
+ const routeLineOf = (geometry) => {
542
+ const lines = (0, _mountaya_elements_geo.extractLines)(geometry);
543
+ const [only] = lines;
544
+ if (lines.length === 1 && only !== void 0) return only;
545
+ return {
546
+ coordinates: (0, _mountaya_elements_geo.segmentLineCoordinates)(geometry),
547
+ type: "LineString"
548
+ };
549
+ };
550
+ const graphqlRouteToLiveRoute = (itinerary) => ({
551
+ analysis: itinerary.analysis ? graphqlAnalysisToEntries(itinerary.analysis) : void 0,
552
+ distance: itinerary.distance,
553
+ duration: itinerary.duration,
554
+ elevation: itinerary.elevation ? graphqlElevationToSummary(itinerary.elevation) : void 0,
555
+ geometry: itinerary.geometry,
556
+ roadAccessInfo: itinerary.analysis ? graphqlRoadAccessToInfo(itinerary.analysis.advisories) : void 0
557
+ });
558
+ const overlayRouteAnalysis = (base, itinerary) => ({
559
+ ...base,
560
+ altitude_max: itinerary.elevation?.altitudeMax ?? base.altitude_max,
561
+ altitude_min: itinerary.elevation?.altitudeMin ?? base.altitude_min,
562
+ ascent: itinerary.elevation?.ascent ?? base.ascent,
563
+ descent: itinerary.elevation?.descent ?? base.descent,
564
+ gradient_max: itinerary.elevation?.gradientMax ?? base.gradient_max,
565
+ gradient_min: itinerary.elevation?.gradientMin ?? base.gradient_min,
566
+ road_access_info: itinerary.roadAccessInfo ? [...itinerary.roadAccessInfo] : null,
567
+ slope_info: itinerary.analysis?.slopeInfo ?? base.slope_info,
568
+ speed_info: itinerary.analysis?.speedInfo ?? base.speed_info,
569
+ surface_info: itinerary.analysis?.surfaceInfo ?? base.surface_info,
570
+ trail_difficulty_info: itinerary.analysis?.trailDifficultyInfo ?? base.trail_difficulty_info,
571
+ way_type_info: itinerary.analysis?.wayTypeInfo ?? base.way_type_info
572
+ });
573
+ const buildLiveSegment = (base, itinerary) => {
574
+ const geojson = {
575
+ geometries: [itinerary.geometry],
576
+ type: "GeometryCollection"
577
+ };
578
+ return {
579
+ ...overlayRouteAnalysis(base, itinerary),
580
+ distance: itinerary.distance,
581
+ duration: itinerary.duration,
582
+ geojson
583
+ };
584
+ };
585
+ const substituteLiveSegment = (segments, live, insertAnchor) => {
586
+ if (!live) return segments;
587
+ if (segments.some((segment) => segment.id === live.id)) return segments.map((segment) => segment.id === live.id ? live : segment);
588
+ if (insertAnchor === void 0) return [...segments, live];
589
+ const anchorIndex = insertAnchor === null ? -1 : segments.findIndex((s) => s.id === insertAnchor);
590
+ if (insertAnchor !== null && anchorIndex === -1) return [...segments, live];
591
+ return [
592
+ ...segments.slice(0, anchorIndex + 1),
593
+ live,
594
+ ...segments.slice(anchorIndex + 1)
595
+ ];
596
+ };
597
+ const draftPositionCount = (geometry) => {
598
+ const leaf = geometry.type === "GeometryCollection" ? geometry.geometries[0] : geometry;
599
+ if (leaf && (leaf.type === "MultiPoint" || leaf.type === "LineString")) return leaf.coordinates.length;
600
+ return 0;
601
+ };
602
+ const draftCoordinates = (draft) => {
603
+ if (!draft) return [];
604
+ const leaves = draft.type === "GeometryCollection" ? draft.geometries : [draft];
605
+ for (const leaf of leaves) if (leaf.type === "MultiPoint" || leaf.type === "LineString") return leaf.coordinates;
606
+ return [];
607
+ };
608
+ const segmentDraftHandles = (draft, seedVias) => draft === null ? seedVias : draftCoordinates(draft);
609
+ const sameHandles = (a, b) => a.length === b.length && a.every((handle, index) => {
610
+ const other = b[index];
611
+ return other !== void 0 && handle[0] === other[0] && handle[1] === other[1];
612
+ });
613
+ const isSegmentDraftDirty = (session) => session !== null && !sameHandles(segmentDraftHandles(session.draft, session.seedVias), session.savedVias);
614
+ const segmentEditModeSchema = zod.enum(_mountaya_elements_data.SEGMENT_EDIT_MODES);
615
+ const synthesizeDraftSegment = (params) => ({
616
+ altitude_max: null,
617
+ altitude_min: null,
618
+ ascent: null,
619
+ color: params.draftColor,
620
+ created_at: /* @__PURE__ */ new Date(0),
621
+ created_by: { id: "" },
622
+ descent: null,
623
+ description: null,
624
+ distance: null,
625
+ duration: null,
626
+ geojson: null,
627
+ gradient_max: null,
628
+ gradient_min: null,
629
+ group_id: null,
630
+ id: params.segmentId,
631
+ itinerary_id: params.itineraryId,
632
+ mode: params.mode,
633
+ name: params.draftName ?? "",
634
+ position: 0,
635
+ revision: 0,
636
+ road_access_info: null,
637
+ slope_info: [],
638
+ speed: null,
639
+ speed_info: [],
640
+ start_at: null,
641
+ steps: [],
642
+ surface_info: [],
643
+ trail_difficulty_info: [],
644
+ way_type_info: []
645
+ });
646
+ const segmentInsertAnchorSchema = zod.object({ afterSegmentId: zod.string().nullable() });
647
+ const segmentEditSessionMark = (session) => session.seedVias;
648
+ const seedViasEqual = (a, b) => {
649
+ if (a.length !== b.length) return false;
650
+ return a.every((via, index) => {
651
+ const other = b[index];
652
+ return other !== void 0 && via[0] === other[0] && via[1] === other[1];
653
+ });
654
+ };
655
+ const pinnedPointsEqual = (a, b) => a === null || b === null ? a === null && b === null : a[0] === b[0] && a[1] === b[1];
656
+ const segmentEditInitialState = {
657
+ editDirtyTick: 0,
658
+ segmentEditSession: null,
659
+ segmentViaPrompt: null
660
+ };
661
+ const createSegmentEditSlice = (set) => ({
662
+ acknowledgeRouteHazards: (keys) => set((state) => {
663
+ const session = state.segmentEditSession;
664
+ if (!session) return {};
665
+ const held = new Set(session.acknowledgedRouteHazards);
666
+ const added = [...new Set(keys)].filter((key) => !held.has(key));
667
+ if (added.length === 0) return {};
668
+ return { segmentEditSession: {
669
+ ...session,
670
+ acknowledgedRouteHazards: [...session.acknowledgedRouteHazards, ...added]
671
+ } };
672
+ }),
673
+ adoptCreatedSegment: (saved) => set((state) => {
674
+ const session = state.segmentEditSession;
675
+ if (!session) return {};
676
+ const rekeyed = (segment) => segment ? {
677
+ ...segment,
678
+ id: saved.id
679
+ } : null;
680
+ const rekeyedStep = (step) => ({
681
+ draft: step.draft,
682
+ liveSegment: rekeyed(step.liveSegment)
683
+ });
684
+ const itinerary = state.activeItinerary;
685
+ return {
686
+ activeItinerary: itinerary !== null && itinerary.id === saved.itinerary_id && !itinerary.segments.some((segment) => segment.id === saved.id) ? {
687
+ ...itinerary,
688
+ segments: substituteLiveSegment(itinerary.segments, saved, session.insertAnchor === null ? void 0 : session.insertAnchor.afterSegmentId)
689
+ } : itinerary,
690
+ editDirtyTick: state.editDirtyTick + 1,
691
+ segmentEditSession: {
692
+ ...session,
693
+ draftName: null,
694
+ future: session.future.map(rekeyedStep),
695
+ gestureStart: session.gestureStart && rekeyedStep(session.gestureStart),
696
+ insertAnchor: null,
697
+ liveSegment: rekeyed(session.liveSegment),
698
+ past: session.past.map(rekeyedStep),
699
+ segmentId: saved.id
700
+ }
701
+ };
702
+ }),
703
+ beginSegmentEdit: (begin) => set((state) => {
704
+ const active = state.segmentEditSession;
705
+ if (active?.segmentId === begin.segmentId && active?.mode === begin.mode && seedViasEqual(active.seedVias, begin.seedVias ?? []) && pinnedPointsEqual(active.pinnedStart, begin.pinnedStart ?? null) && pinnedPointsEqual(active.pinnedEnd, begin.pinnedEnd ?? null)) return {};
706
+ const liveSegment = state.activeItinerary?.segments?.find((segment) => segment.id === begin.segmentId) ? null : synthesizeDraftSegment({
707
+ draftColor: begin.draftColor ?? null,
708
+ draftName: begin.draftName ?? null,
709
+ itineraryId: state.activeItinerary?.id ?? "",
710
+ mode: begin.mode,
711
+ segmentId: begin.segmentId
712
+ });
713
+ return {
714
+ editDirtyTick: state.editDirtyTick + 1,
715
+ segmentEditSession: {
716
+ acknowledgedRouteHazards: [],
717
+ activitySlug: begin.activitySlug ?? null,
718
+ draft: null,
719
+ draftColor: begin.draftColor ?? null,
720
+ draftName: begin.draftName ?? null,
721
+ future: [],
722
+ gestureStart: null,
723
+ insertAnchor: begin.insertAnchor ?? null,
724
+ liveSegment,
725
+ mode: begin.mode,
726
+ past: [],
727
+ pinnedEnd: begin.pinnedEnd ?? null,
728
+ pinnedStart: begin.pinnedStart ?? null,
729
+ savedVias: [...begin.savedVias ?? begin.seedVias ?? []],
730
+ seedVias: [...begin.seedVias ?? []],
731
+ segmentId: begin.segmentId
732
+ },
733
+ segmentViaPrompt: null,
734
+ selection: null
735
+ };
736
+ }),
737
+ bumpEditDirtyTick: () => set((state) => ({ editDirtyTick: state.editDirtyTick + 1 })),
738
+ cancelSegmentEdit: () => set((state) => ({
739
+ editDirtyTick: state.editDirtyTick + 1,
740
+ segmentEditSession: null,
741
+ segmentViaPrompt: null
742
+ })),
743
+ commitSegmentEdit: () => set((state) => ({
744
+ editDirtyTick: state.editDirtyTick + 1,
745
+ segmentEditSession: null,
746
+ segmentViaPrompt: null
747
+ })),
748
+ markSegmentDraftSaved: (draft) => set((state) => {
749
+ const session = state.segmentEditSession;
750
+ if (!session) return {};
751
+ const saved = segmentDraftHandles(draft, session.seedVias).map(([lng = 0, lat = 0]) => [lng, lat]);
752
+ return { segmentEditSession: {
753
+ ...session,
754
+ savedVias: saved
755
+ } };
756
+ }),
757
+ pushSegmentDraft: (geometry) => set((state) => {
758
+ if (!state.segmentEditSession) return {};
759
+ const { draft, gestureStart, liveSegment, past } = state.segmentEditSession;
760
+ return {
761
+ editDirtyTick: state.editDirtyTick + 1,
762
+ segmentEditSession: {
763
+ ...state.segmentEditSession,
764
+ draft: geometry,
765
+ future: [],
766
+ gestureStart: null,
767
+ past: appendHistoryStep(past, gestureStart ?? {
768
+ draft,
769
+ liveSegment
770
+ })
771
+ }
772
+ };
773
+ }),
774
+ recolorSegmentEditLive: (color) => set((state) => {
775
+ const session = state.segmentEditSession;
776
+ if (!session) return {};
777
+ const recolor = (segment) => segment ? {
778
+ ...segment,
779
+ color
780
+ } : null;
781
+ return {
782
+ editDirtyTick: state.editDirtyTick + 1,
783
+ segmentEditSession: {
784
+ ...session,
785
+ draftColor: color,
786
+ future: session.future.map((snapshot) => ({
787
+ ...snapshot,
788
+ liveSegment: recolor(snapshot.liveSegment)
789
+ })),
790
+ gestureStart: session.gestureStart && {
791
+ ...session.gestureStart,
792
+ liveSegment: recolor(session.gestureStart.liveSegment)
793
+ },
794
+ liveSegment: recolor(session.liveSegment),
795
+ past: session.past.map((snapshot) => ({
796
+ ...snapshot,
797
+ liveSegment: recolor(snapshot.liveSegment)
798
+ }))
799
+ }
800
+ };
801
+ }),
802
+ redoSegmentDraft: () => set((state) => {
803
+ const session = state.segmentEditSession;
804
+ if (!session) return {};
805
+ if (session.future.length === 0) return {};
806
+ const { draft, future, liveSegment, past } = session;
807
+ const [next, ...remaining] = future;
808
+ if (next === void 0) return {};
809
+ return {
810
+ editDirtyTick: state.editDirtyTick + 1,
811
+ segmentEditSession: {
812
+ ...session,
813
+ draft: next.draft,
814
+ future: remaining,
815
+ gestureStart: null,
816
+ liveSegment: next.liveSegment,
817
+ past: appendHistoryStep(past, {
818
+ draft,
819
+ liveSegment
820
+ })
821
+ }
822
+ };
823
+ }),
824
+ removeSegment: (segmentId) => set((state) => {
825
+ const activeItinerary = mapSegments(state.activeItinerary, (segments) => segments.filter((segment) => segment.id !== segmentId));
826
+ if (state.segmentEditSession?.segmentId !== segmentId) return { activeItinerary };
827
+ return {
828
+ activeItinerary,
829
+ editDirtyTick: state.editDirtyTick + 1,
830
+ segmentEditSession: null,
831
+ segmentViaPrompt: null
832
+ };
833
+ }),
834
+ setSegmentEditDraft: (geometry) => set((state) => state.segmentEditSession ? { segmentEditSession: {
835
+ ...state.segmentEditSession,
836
+ draft: geometry
837
+ } } : {}),
838
+ setSegmentEditLiveDraft: (geometry) => set((state) => {
839
+ const session = state.segmentEditSession;
840
+ if (!session) return {};
841
+ return { segmentEditSession: {
842
+ ...session,
843
+ draft: geometry,
844
+ gestureStart: session.gestureStart ?? {
845
+ draft: session.draft,
846
+ liveSegment: session.liveSegment
847
+ }
848
+ } };
849
+ }),
850
+ setSegmentEditLiveSegment: (segment, routedFor) => set((state) => {
851
+ const session = state.segmentEditSession;
852
+ if (!session) return {};
853
+ if (routedFor === void 0 || segment === null) return {
854
+ editDirtyTick: state.editDirtyTick + 1,
855
+ segmentEditSession: {
856
+ ...session,
857
+ liveSegment: segment
858
+ }
859
+ };
860
+ const pair = (step) => sameHandles(segmentDraftHandles(step.draft, session.seedVias), routedFor) ? {
861
+ ...step,
862
+ liveSegment: segment
863
+ } : step;
864
+ return {
865
+ editDirtyTick: state.editDirtyTick + 1,
866
+ segmentEditSession: {
867
+ ...session,
868
+ future: session.future.map(pair),
869
+ gestureStart: session.gestureStart && pair(session.gestureStart),
870
+ liveSegment: segment,
871
+ past: session.past.map(pair)
872
+ }
873
+ };
874
+ }),
875
+ setSegmentViaPrompt: (segmentViaPrompt) => set((state) => segmentViaPrompt !== null && !state.segmentEditSession ? {} : { segmentViaPrompt }),
876
+ undoSegmentDraft: () => set((state) => {
877
+ const session = state.segmentEditSession;
878
+ if (!session) return {};
879
+ if (session.past.length === 0) return {};
880
+ const { draft, future, liveSegment, past } = session;
881
+ const previous = past[past.length - 1];
882
+ if (previous === void 0) return {};
883
+ return {
884
+ editDirtyTick: state.editDirtyTick + 1,
885
+ segmentEditSession: {
886
+ ...session,
887
+ draft: previous.draft,
888
+ future: [{
889
+ draft,
890
+ liveSegment
891
+ }, ...future],
892
+ gestureStart: null,
893
+ liveSegment: previous.liveSegment,
894
+ past: past.slice(0, -1)
895
+ }
896
+ };
897
+ })
898
+ });
899
+ const issuedShareTokenSchema = zod.strictObject({ shareToken: zod.string().min(1) });
900
+ const shareLinkToolContracts = {
901
+ "studio.shareLink.disable": {
902
+ capability: "editor",
903
+ description: "Disable the share link for an itinerary or a collection. The token is revoked and every URL carrying it stops working; a later mint issues a different link.",
904
+ input: shareLinkTargetSchema,
905
+ output: toolNoDataSchema
906
+ },
907
+ "studio.shareLink.mint": {
908
+ capability: "editor",
909
+ description: "Get or create the read-only share link for an itinerary or a collection and return its token. Idempotent: an existing link is returned unchanged rather than replaced.",
910
+ input: shareLinkTargetSchema,
911
+ output: issuedShareTokenSchema
912
+ },
913
+ "studio.shareLink.rotate": {
914
+ capability: "editor",
915
+ description: "Reset the share link for an itinerary or a collection, retiring the current token and returning a fresh one. Every URL already handed out stops working.",
916
+ input: shareLinkTargetSchema,
917
+ output: issuedShareTokenSchema
918
+ }
919
+ };
920
+ const zoneNameSchema = displayNameSchema;
921
+ const zoneDescriptionSchema = descriptionSchema;
922
+ const defaultStudioScope = { isPersonalScope: (organizationId) => organizationId === null || organizationId === void 0 };
923
+ const writeResourceNames = {
924
+ collection: "a collection",
925
+ itinerary: "an itinerary",
926
+ zone: "a zone"
927
+ };
928
+ const requireWritableScope = (ctx, resource, organizationId) => {
929
+ const refusal = ctx.scope?.writeRefusal?.(resource, organizationId) ?? null;
930
+ const name = writeResourceNames[resource];
931
+ switch (refusal) {
932
+ case "personal": return {
933
+ code: "forbidden",
934
+ error: `the personal space holds no ${resource}: write ${name} in an organization whose agreement includes Map Studio`,
935
+ ok: false
936
+ };
937
+ case "agreement": return {
938
+ code: "upgrade-required",
939
+ error: `not part of the organization's agreement: writing ${name} needs an organization whose agreement includes Map Studio`,
940
+ ok: false
941
+ };
942
+ default: return null;
943
+ }
944
+ };
945
+ const activeStudioScope = (ctx) => {
946
+ const named = ctx.url?.read().organization_id;
947
+ const { isPersonalScope } = ctx.scope ?? defaultStudioScope;
948
+ return named === void 0 || named === "" || isPersonalScope(named) ? null : named;
949
+ };
950
+ const isPublishableScope = (organizationId, isPersonalScope) => Boolean(organizationId) && !isPersonalScope(organizationId);
951
+ Object.defineProperty(exports, "CAMERA_MESSAGE", {
952
+ enumerable: true,
953
+ get: function() {
954
+ return CAMERA_MESSAGE;
955
+ }
956
+ });
957
+ Object.defineProperty(exports, "DESCRIPTION_MAX_LENGTH", {
958
+ enumerable: true,
959
+ get: function() {
960
+ return DESCRIPTION_MAX_LENGTH;
961
+ }
962
+ });
963
+ Object.defineProperty(exports, "DISPLAY_NAME_MAX_LENGTH", {
964
+ enumerable: true,
965
+ get: function() {
966
+ return DISPLAY_NAME_MAX_LENGTH;
967
+ }
968
+ });
969
+ Object.defineProperty(exports, "DISPLAY_NAME_MIN_LENGTH", {
970
+ enumerable: true,
971
+ get: function() {
972
+ return DISPLAY_NAME_MIN_LENGTH;
973
+ }
974
+ });
975
+ Object.defineProperty(exports, "READY_MESSAGE", {
976
+ enumerable: true,
977
+ get: function() {
978
+ return READY_MESSAGE;
979
+ }
980
+ });
981
+ Object.defineProperty(exports, "REQUEST_CAMERA_MESSAGE", {
982
+ enumerable: true,
983
+ get: function() {
984
+ return REQUEST_CAMERA_MESSAGE;
985
+ }
986
+ });
987
+ Object.defineProperty(exports, "REQUEST_SESSION_TOKEN_MESSAGE", {
988
+ enumerable: true,
989
+ get: function() {
990
+ return REQUEST_SESSION_TOKEN_MESSAGE;
991
+ }
992
+ });
993
+ Object.defineProperty(exports, "SET_ITINERARY_MESSAGE", {
994
+ enumerable: true,
995
+ get: function() {
996
+ return SET_ITINERARY_MESSAGE;
997
+ }
998
+ });
999
+ Object.defineProperty(exports, "SET_SESSION_TOKEN_MESSAGE", {
1000
+ enumerable: true,
1001
+ get: function() {
1002
+ return SET_SESSION_TOKEN_MESSAGE;
1003
+ }
1004
+ });
1005
+ Object.defineProperty(exports, "activeStudioScope", {
1006
+ enumerable: true,
1007
+ get: function() {
1008
+ return activeStudioScope;
1009
+ }
1010
+ });
1011
+ Object.defineProperty(exports, "appendHistoryStep", {
1012
+ enumerable: true,
1013
+ get: function() {
1014
+ return appendHistoryStep;
1015
+ }
1016
+ });
1017
+ Object.defineProperty(exports, "buildLiveSegment", {
1018
+ enumerable: true,
1019
+ get: function() {
1020
+ return buildLiveSegment;
1021
+ }
1022
+ });
1023
+ Object.defineProperty(exports, "buildShareSearch", {
1024
+ enumerable: true,
1025
+ get: function() {
1026
+ return buildShareSearch;
1027
+ }
1028
+ });
1029
+ Object.defineProperty(exports, "buildShareSrc", {
1030
+ enumerable: true,
1031
+ get: function() {
1032
+ return buildShareSrc;
1033
+ }
1034
+ });
1035
+ Object.defineProperty(exports, "cameraMessageSchema", {
1036
+ enumerable: true,
1037
+ get: function() {
1038
+ return cameraMessageSchema;
1039
+ }
1040
+ });
1041
+ Object.defineProperty(exports, "createItinerarySlice", {
1042
+ enumerable: true,
1043
+ get: function() {
1044
+ return createItinerarySlice;
1045
+ }
1046
+ });
1047
+ Object.defineProperty(exports, "createSegmentEditSlice", {
1048
+ enumerable: true,
1049
+ get: function() {
1050
+ return createSegmentEditSlice;
1051
+ }
1052
+ });
1053
+ Object.defineProperty(exports, "defaultStudioScope", {
1054
+ enumerable: true,
1055
+ get: function() {
1056
+ return defaultStudioScope;
1057
+ }
1058
+ });
1059
+ Object.defineProperty(exports, "densifyFreehandLine", {
1060
+ enumerable: true,
1061
+ get: function() {
1062
+ return densifyFreehandLine;
1063
+ }
1064
+ });
1065
+ Object.defineProperty(exports, "descriptionSchema", {
1066
+ enumerable: true,
1067
+ get: function() {
1068
+ return descriptionSchema;
1069
+ }
1070
+ });
1071
+ Object.defineProperty(exports, "displayNameSchema", {
1072
+ enumerable: true,
1073
+ get: function() {
1074
+ return displayNameSchema;
1075
+ }
1076
+ });
1077
+ Object.defineProperty(exports, "draftActivityInput", {
1078
+ enumerable: true,
1079
+ get: function() {
1080
+ return draftActivityInput;
1081
+ }
1082
+ });
1083
+ Object.defineProperty(exports, "draftCollectionsInput", {
1084
+ enumerable: true,
1085
+ get: function() {
1086
+ return draftCollectionsInput;
1087
+ }
1088
+ });
1089
+ Object.defineProperty(exports, "draftCoordinates", {
1090
+ enumerable: true,
1091
+ get: function() {
1092
+ return draftCoordinates;
1093
+ }
1094
+ });
1095
+ Object.defineProperty(exports, "draftNameInput", {
1096
+ enumerable: true,
1097
+ get: function() {
1098
+ return draftNameInput;
1099
+ }
1100
+ });
1101
+ Object.defineProperty(exports, "draftOrganizationInput", {
1102
+ enumerable: true,
1103
+ get: function() {
1104
+ return draftOrganizationInput;
1105
+ }
1106
+ });
1107
+ Object.defineProperty(exports, "draftPositionCount", {
1108
+ enumerable: true,
1109
+ get: function() {
1110
+ return draftPositionCount;
1111
+ }
1112
+ });
1113
+ Object.defineProperty(exports, "draftPrivateInput", {
1114
+ enumerable: true,
1115
+ get: function() {
1116
+ return draftPrivateInput;
1117
+ }
1118
+ });
1119
+ Object.defineProperty(exports, "embedSetContentInput", {
1120
+ enumerable: true,
1121
+ get: function() {
1122
+ return embedSetContentInput;
1123
+ }
1124
+ });
1125
+ Object.defineProperty(exports, "fitDisplayName", {
1126
+ enumerable: true,
1127
+ get: function() {
1128
+ return fitDisplayName;
1129
+ }
1130
+ });
1131
+ Object.defineProperty(exports, "fitFreehandLines", {
1132
+ enumerable: true,
1133
+ get: function() {
1134
+ return fitFreehandLines;
1135
+ }
1136
+ });
1137
+ Object.defineProperty(exports, "graphqlAnalysisToEntries", {
1138
+ enumerable: true,
1139
+ get: function() {
1140
+ return graphqlAnalysisToEntries;
1141
+ }
1142
+ });
1143
+ Object.defineProperty(exports, "graphqlElevationToSummary", {
1144
+ enumerable: true,
1145
+ get: function() {
1146
+ return graphqlElevationToSummary;
1147
+ }
1148
+ });
1149
+ Object.defineProperty(exports, "graphqlRoadAccessToInfo", {
1150
+ enumerable: true,
1151
+ get: function() {
1152
+ return graphqlRoadAccessToInfo;
1153
+ }
1154
+ });
1155
+ Object.defineProperty(exports, "graphqlRouteToLiveRoute", {
1156
+ enumerable: true,
1157
+ get: function() {
1158
+ return graphqlRouteToLiveRoute;
1159
+ }
1160
+ });
1161
+ Object.defineProperty(exports, "inboundBridgeMessageSchema", {
1162
+ enumerable: true,
1163
+ get: function() {
1164
+ return inboundBridgeMessageSchema;
1165
+ }
1166
+ });
1167
+ Object.defineProperty(exports, "indexedInfoSchema", {
1168
+ enumerable: true,
1169
+ get: function() {
1170
+ return indexedInfoSchema;
1171
+ }
1172
+ });
1173
+ Object.defineProperty(exports, "isPublishableScope", {
1174
+ enumerable: true,
1175
+ get: function() {
1176
+ return isPublishableScope;
1177
+ }
1178
+ });
1179
+ Object.defineProperty(exports, "isSegmentDraftDirty", {
1180
+ enumerable: true,
1181
+ get: function() {
1182
+ return isSegmentDraftDirty;
1183
+ }
1184
+ });
1185
+ Object.defineProperty(exports, "issuedShareTokenSchema", {
1186
+ enumerable: true,
1187
+ get: function() {
1188
+ return issuedShareTokenSchema;
1189
+ }
1190
+ });
1191
+ Object.defineProperty(exports, "itineraryInitialState", {
1192
+ enumerable: true,
1193
+ get: function() {
1194
+ return itineraryInitialState;
1195
+ }
1196
+ });
1197
+ Object.defineProperty(exports, "itinerarySelectionSchema", {
1198
+ enumerable: true,
1199
+ get: function() {
1200
+ return itinerarySelectionSchema;
1201
+ }
1202
+ });
1203
+ Object.defineProperty(exports, "lineLengthMeters", {
1204
+ enumerable: true,
1205
+ get: function() {
1206
+ return lineLengthMeters;
1207
+ }
1208
+ });
1209
+ Object.defineProperty(exports, "liveSegmentRouteAnalysisSchema", {
1210
+ enumerable: true,
1211
+ get: function() {
1212
+ return liveSegmentRouteAnalysisSchema;
1213
+ }
1214
+ });
1215
+ Object.defineProperty(exports, "liveSegmentRouteElevationSchema", {
1216
+ enumerable: true,
1217
+ get: function() {
1218
+ return liveSegmentRouteElevationSchema;
1219
+ }
1220
+ });
1221
+ Object.defineProperty(exports, "mapBoundsSchema", {
1222
+ enumerable: true,
1223
+ get: function() {
1224
+ return mapBoundsSchema;
1225
+ }
1226
+ });
1227
+ Object.defineProperty(exports, "mapWaypoints", {
1228
+ enumerable: true,
1229
+ get: function() {
1230
+ return mapWaypoints;
1231
+ }
1232
+ });
1233
+ Object.defineProperty(exports, "originBase", {
1234
+ enumerable: true,
1235
+ get: function() {
1236
+ return originBase;
1237
+ }
1238
+ });
1239
+ Object.defineProperty(exports, "overlayRouteAnalysis", {
1240
+ enumerable: true,
1241
+ get: function() {
1242
+ return overlayRouteAnalysis;
1243
+ }
1244
+ });
1245
+ Object.defineProperty(exports, "readyErrorSchema", {
1246
+ enumerable: true,
1247
+ get: function() {
1248
+ return readyErrorSchema;
1249
+ }
1250
+ });
1251
+ Object.defineProperty(exports, "readyMessageSchema", {
1252
+ enumerable: true,
1253
+ get: function() {
1254
+ return readyMessageSchema;
1255
+ }
1256
+ });
1257
+ Object.defineProperty(exports, "renumber", {
1258
+ enumerable: true,
1259
+ get: function() {
1260
+ return renumber;
1261
+ }
1262
+ });
1263
+ Object.defineProperty(exports, "requestCameraMessageSchema", {
1264
+ enumerable: true,
1265
+ get: function() {
1266
+ return requestCameraMessageSchema;
1267
+ }
1268
+ });
1269
+ Object.defineProperty(exports, "requestSessionTokenMessageSchema", {
1270
+ enumerable: true,
1271
+ get: function() {
1272
+ return requestSessionTokenMessageSchema;
1273
+ }
1274
+ });
1275
+ Object.defineProperty(exports, "requireWritableScope", {
1276
+ enumerable: true,
1277
+ get: function() {
1278
+ return requireWritableScope;
1279
+ }
1280
+ });
1281
+ Object.defineProperty(exports, "resolveActivity", {
1282
+ enumerable: true,
1283
+ get: function() {
1284
+ return resolveActivity;
1285
+ }
1286
+ });
1287
+ Object.defineProperty(exports, "restActivitySlugSchema", {
1288
+ enumerable: true,
1289
+ get: function() {
1290
+ return restActivitySlugSchema;
1291
+ }
1292
+ });
1293
+ Object.defineProperty(exports, "routeLineOf", {
1294
+ enumerable: true,
1295
+ get: function() {
1296
+ return routeLineOf;
1297
+ }
1298
+ });
1299
+ Object.defineProperty(exports, "segmentEditInitialState", {
1300
+ enumerable: true,
1301
+ get: function() {
1302
+ return segmentEditInitialState;
1303
+ }
1304
+ });
1305
+ Object.defineProperty(exports, "segmentEditModeSchema", {
1306
+ enumerable: true,
1307
+ get: function() {
1308
+ return segmentEditModeSchema;
1309
+ }
1310
+ });
1311
+ Object.defineProperty(exports, "segmentEditSessionMark", {
1312
+ enumerable: true,
1313
+ get: function() {
1314
+ return segmentEditSessionMark;
1315
+ }
1316
+ });
1317
+ Object.defineProperty(exports, "segmentInsertAnchorSchema", {
1318
+ enumerable: true,
1319
+ get: function() {
1320
+ return segmentInsertAnchorSchema;
1321
+ }
1322
+ });
1323
+ Object.defineProperty(exports, "setSessionTokenMessageSchema", {
1324
+ enumerable: true,
1325
+ get: function() {
1326
+ return setSessionTokenMessageSchema;
1327
+ }
1328
+ });
1329
+ Object.defineProperty(exports, "shareLinkTargetSchema", {
1330
+ enumerable: true,
1331
+ get: function() {
1332
+ return shareLinkTargetSchema;
1333
+ }
1334
+ });
1335
+ Object.defineProperty(exports, "shareLinkToolContracts", {
1336
+ enumerable: true,
1337
+ get: function() {
1338
+ return shareLinkToolContracts;
1339
+ }
1340
+ });
1341
+ Object.defineProperty(exports, "substituteLiveSegment", {
1342
+ enumerable: true,
1343
+ get: function() {
1344
+ return substituteLiveSegment;
1345
+ }
1346
+ });
1347
+ Object.defineProperty(exports, "surfaceTypeSchema", {
1348
+ enumerable: true,
1349
+ get: function() {
1350
+ return surfaceTypeSchema;
1351
+ }
1352
+ });
1353
+ Object.defineProperty(exports, "switchOverridesSchema", {
1354
+ enumerable: true,
1355
+ get: function() {
1356
+ return switchOverridesSchema;
1357
+ }
1358
+ });
1359
+ Object.defineProperty(exports, "synthesizeDraftSegment", {
1360
+ enumerable: true,
1361
+ get: function() {
1362
+ return synthesizeDraftSegment;
1363
+ }
1364
+ });
1365
+ Object.defineProperty(exports, "toDataActivity", {
1366
+ enumerable: true,
1367
+ get: function() {
1368
+ return toDataActivity;
1369
+ }
1370
+ });
1371
+ Object.defineProperty(exports, "toolNoDataSchema", {
1372
+ enumerable: true,
1373
+ get: function() {
1374
+ return toolNoDataSchema;
1375
+ }
1376
+ });
1377
+ Object.defineProperty(exports, "trailDifficultyTypeSchema", {
1378
+ enumerable: true,
1379
+ get: function() {
1380
+ return trailDifficultyTypeSchema;
1381
+ }
1382
+ });
1383
+ Object.defineProperty(exports, "wayTypeSchema", {
1384
+ enumerable: true,
1385
+ get: function() {
1386
+ return wayTypeSchema;
1387
+ }
1388
+ });
1389
+ Object.defineProperty(exports, "zoneDescriptionSchema", {
1390
+ enumerable: true,
1391
+ get: function() {
1392
+ return zoneDescriptionSchema;
1393
+ }
1394
+ });
1395
+ Object.defineProperty(exports, "zoneNameSchema", {
1396
+ enumerable: true,
1397
+ get: function() {
1398
+ return zoneNameSchema;
1399
+ }
1400
+ });
1401
+
1402
+ //# sourceMappingURL=chunk-C2rr9Q0V.cjs.map